Commit 8b43ef50 authored by Janik Zikovsky's avatar Janik Zikovsky
Browse files

Refs #2897: No warnings in Geometry or GeometryTest.

parent 0893c3cb
......@@ -84,10 +84,8 @@ private:
> Graph;
/// Vertex descriptor object for Graph
typedef boost::graph_traits<Graph>::vertex_descriptor Vertex;
/// map object of int to int
typedef boost::unordered_map<int64_t,int64_t> MapII;
/// map object of int to Graph Vertex descriptor
typedef boost::unordered_map<int64_t,Vertex> MapIV;
typedef boost::unordered_map<detid_t,Vertex> MapIV;
/// populates the graph with the nodes (detectors with id) and edges (neighbour links with distances)
void populate();
......
......@@ -61,7 +61,7 @@ std::map<detid_t, double> NearestNeighbours::neighbours(const detid_t detID) con
for ( adjIt = adjacent.first; adjIt != adjacent.second; adjIt++ )
{
Vertex nearest = (*adjIt);
detid_t nrID = m_vertexID[nearest];
detid_t nrID = detid_t(m_vertexID[nearest]);
std::pair<Graph::edge_descriptor, bool> nrEd = boost::edge(vertex->second, nearest, m_graph);
double distance = m_edgeLength[nrEd.first];
distance = sqrt(distance);
......
......@@ -34,16 +34,16 @@ MDGeometryDescription::getRotations()const
/// this extracts the size and shape of the current DND object
MDGeometryDescription::MDGeometryDescription(const MDGeometry &origin):
Rotations(3,3,true),
nContributedPixels(0)
nContributedPixels(0),
Rotations(3,3,true)
{
this->build_from_geometry(origin);
}
MDGeometryDescription::MDGeometryDescription(const MDGeometryBasis &basis):
Rotations(3,3,true),
nContributedPixels(0)
nContributedPixels(0),
Rotations(3,3,true)
{
......@@ -82,8 +82,7 @@ MDGeometryDescription::MDGeometryDescription(
Dimension_sptr dimensiont,
RotationMatrix rotationMatrix
):
Rotations(3,3,true),
nContributedPixels(0)
nContributedPixels(0), Rotations(3,3,true)
{
this->nDimensions = dimensions.size();
......@@ -123,10 +122,10 @@ nContributedPixels(0)
}
MDGeometryDescription::MDGeometryDescription(size_t numDims, size_t numRecDims):
nDimensions(numDims),
nReciprocalDimensions(numRecDims),
Rotations(3,3,true),
nContributedPixels(19531253125000)
nContributedPixels(19531253125000),
nDimensions(numDims),
nReciprocalDimensions(numRecDims),
Rotations(3,3,true)
{
this->intit_default_slicing(nDimensions,nReciprocalDimensions);
......
#ifndef TESTDETECTORGROUP_H_
#define TESTDETECTORGROUP_H_
#include <cxxtest/TestSuite.h>
#include "MantidGeometry/Instrument/DetectorGroup.h"
#include "MantidGeometry/IDetector.h"
#include "MantidGeometry/Instrument/Detector.h"
#include "MantidGeometry/Instrument/DetectorGroup.h"
#include "MantidTestHelpers/ComponentCreationHelper.h"
#include <cxxtest/TestSuite.h>
using namespace Mantid::Geometry;
using namespace Mantid;
class DetectorGroupTest : public CxxTest::TestSuite
{
......@@ -34,9 +35,9 @@ public:
void testGetDetectorIDs()
{
std::vector<int> detIDs = m_detGroup->getDetectorIDs();
std::vector<detid_t> detIDs = m_detGroup->getDetectorIDs();
TS_ASSERT_EQUALS( detIDs.size(), 5 );
for(int i = 0; i < detIDs.size(); ++i )
for(size_t i = 0; i < detIDs.size(); ++i )
{
TS_ASSERT_EQUALS(detIDs[i], i + 1);
}
......@@ -47,7 +48,7 @@ public:
{
std::vector<IDetector_sptr> dets = m_detGroup->getDetectors();
TS_ASSERT_EQUALS( dets.size(), 5 );
for(int i = 0; i < dets.size(); ++i )
for(size_t i = 0; i < dets.size(); ++i )
{
TS_ASSERT(dets[i]);
}
......
......@@ -18,7 +18,7 @@ public:
virtual double getMaximum() const{throw(Mantid::Kernel::Exception::NotImplementedError(""));return 0;}
virtual double getMinimum() const{throw(Mantid::Kernel::Exception::NotImplementedError(""));return 0;}
virtual size_t getNBins() const{throw(Mantid::Kernel::Exception::NotImplementedError(""));return 0;}
virtual double getX(size_t ind)const{throw(Mantid::Kernel::Exception::NotImplementedError(""));return 0;}
virtual double getX(size_t /*ind*/)const{throw(Mantid::Kernel::Exception::NotImplementedError(""));return 0;}
// virtual bool getIsIntegrated() const -- should trhow not-implemented through getNbins;
......@@ -98,4 +98,4 @@ public:
};
#endif
\ No newline at end of file
#endif
......@@ -92,14 +92,6 @@ public:
// The ones above below and next to it
nb = det->getNeighbours(2);
TS_ASSERT_EQUALS( nb.size(), 4 );
detid_t id = det->getID();
for (std::map<detid_t, double>::iterator it = nb.begin(); it != nb.end(); it++)
{
detid_t nid = it->first;
// One of 4 neighbors - we know what ID's they should be.
// TS_ASSERT( (nid==id+1) || (nid==id-1) || (nid==id+16) || (nid==id-16) ); disable this for now as I can't
// work out how to get it to work, and it relies on the "old" form of NN which no one cares about AFAIK. MW 22/12/10
}
}
......
......@@ -192,7 +192,6 @@ public:
ObjComponent A("ocyl", createCappedCylinder());
A.setPos(10,0,0);
A.setRot(Quat(90.0,V3D(0,0,1)));
const double big=1e6;
double xmax,ymax,zmax,xmin,ymin,zmin;
xmax=15; ymax=15; zmax=3;
xmin=5; ymin=-5; zmin=-3;
......
......@@ -37,7 +37,7 @@ public:
TS_ASSERT_EQUALS(geom_obj->str(),"68 -6 5 -4 3 -2 1");
double xmin(0.0), xmax(0.0), ymin(0.0), ymax(0.0), zmin(0.0), zmax(0.0);
geom_obj->getBoundingBox(xmax, ymax, zmax, xmin, ymax,zmin);
geom_obj->getBoundingBox(xmax, ymax, zmax, xmin, ymin, zmin);
}
......@@ -644,25 +644,25 @@ public:
TS_ASSERT_DELTA(geom_obj->triangleSolidAngle(V3D(0,0,1.0)),M_PI*2.0/3.0,satol);
TS_ASSERT_DELTA(geom_obj->triangleSolidAngle(V3D(0,0,-1.0)),M_PI*2.0/3.0,satol);
if(timeTest)
{
// block to test time of solid angle methods
// change false to true to include
double saRay,saTri;
V3D observer(1.0,0,0);
int iter=4000;
int starttime=clock();
for (int i=0;i<iter;i++)
saTri=geom_obj->triangleSolidAngle(observer);
int endtime=clock();
std::cout << std::endl << "Cube tri time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
iter=50;
starttime=clock();
for (int i=0;i<iter;i++)
saRay=geom_obj->rayTraceSolidAngle(observer);
endtime=clock();
std::cout << "Cube ray time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
}
// if(timeTest)
// {
// // block to test time of solid angle methods
// // change false to true to include
// double saRay,saTri;
// V3D observer(1.0,0,0);
// int iter=4000;
// int starttime=clock();
// for (int i=0;i<iter;i++)
// saTri=geom_obj->triangleSolidAngle(observer);
// int endtime=clock();
// std::cout << std::endl << "Cube tri time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
// iter=50;
// starttime=clock();
// for (int i=0;i<iter;i++)
// saRay=geom_obj->rayTraceSolidAngle(observer);
// endtime=clock();
// std::cout << "Cube ray time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
// }
}
......@@ -739,23 +739,23 @@ public:
double satol=1e-3; // typical result tolerance
if(timeTest)
{
// block to test time of solid angle methods
// change false to true to include
int iter=4000;
int starttime=clock();
for (int i=0;i<iter;i++)
saTri=geom_obj->triangleSolidAngle(observer);
int endtime=clock();
std::cout << std::endl << "Cyl tri time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
iter=50;
starttime=clock();
for (int i=0;i<iter;i++)
saRay=geom_obj->rayTraceSolidAngle(observer);
endtime=clock();
std::cout << "Cyl ray time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
}
// if(timeTest)
// {
// // block to test time of solid angle methods
// // change false to true to include
// int iter=4000;
// int starttime=clock();
// for (int i=0;i<iter;i++)
// saTri=geom_obj->triangleSolidAngle(observer);
// int endtime=clock();
// std::cout << std::endl << "Cyl tri time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
// iter=50;
// starttime=clock();
// for (int i=0;i<iter;i++)
// saRay=geom_obj->rayTraceSolidAngle(observer);
// endtime=clock();
// std::cout << "Cyl ray time=" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
// }
saTri=geom_obj->triangleSolidAngle(observer);
saRay=geom_obj->rayTraceSolidAngle(observer);
......@@ -806,25 +806,25 @@ public:
TS_ASSERT_DELTA(geom_obj->triangleSolidAngle(V3D(200,0,0)),0.0013204,satol*0.00132);
TS_ASSERT_DELTA(geom_obj->triangleSolidAngle(V3D(2000,0,0)),1.32025e-5,satol*1.32e-5);
if(timeTest)
{
// block to test time of solid angle methods
// change false to true to include
double saTri,saRay;
int iter=400;
V3D observer(8.1,0,0);
int starttime=clock();
for (int i=0;i<iter;i++)
saTri=geom_obj->triangleSolidAngle(observer);
int endtime=clock();
std::cout << std::endl << "Sphere tri time =" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
iter=40;
starttime=clock();
for (int i=0;i<iter;i++)
saRay=geom_obj->rayTraceSolidAngle(observer);
endtime=clock();
std::cout << "Sphere ray time =" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
}
// if(timeTest)
// {
// // block to test time of solid angle methods
// // change false to true to include
// double saTri,saRay;
// int iter=400;
// V3D observer(8.1,0,0);
// int starttime=clock();
// for (int i=0;i<iter;i++)
// saTri=geom_obj->triangleSolidAngle(observer);
// int endtime=clock();
// std::cout << std::endl << "Sphere tri time =" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
// iter=40;
// starttime=clock();
// for (int i=0;i<iter;i++)
// saRay=geom_obj->rayTraceSolidAngle(observer);
// endtime=clock();
// std::cout << "Sphere ray time =" << (endtime-starttime)/(static_cast<double>(CLOCKS_PER_SEC*iter)) << std::endl;
// }
}
......
......@@ -130,7 +130,7 @@ public:
V3D dir(1,0,0);
V3D xx = ort1.cross_prod(ort2);
double pp = xx.scalar_prod(dir); // dir should belong to ort1,ort2 plain
//double pp = xx.scalar_prod(dir); // dir should belong to ort1,ort2 plain
double p1=dir.scalar_prod(ort1)/ort1.norm();
double p2=dir.scalar_prod(ort2)/ort2.norm();
......
......@@ -61,8 +61,8 @@ namespace CxxTest
return !EOF;
else
{
int const ans1 = buffer1->sputc(c);
int const ans2 = buffer2->sputc(c);
int const ans1 = buffer1->sputc(static_cast<char>(c));
int const ans2 = buffer2->sputc(static_cast<char>(c));
return ans1 == EOF || ans2 == EOF ? EOF : c;
}
}
......@@ -425,12 +425,12 @@ namespace CxxTest
const double testRunTime = double(testRunStopTime - testRunStartTime)/CLOCKS_PER_SEC;
#else
gettimeofday(&testStopTime, 0);
double sec = testStopTime.tv_sec - testStartTime.tv_sec;
double usec = testStopTime.tv_usec - testStartTime.tv_usec;
double sec = double(testStopTime.tv_sec - testStartTime.tv_sec);
double usec = double(testStopTime.tv_usec - testStartTime.tv_usec);
double testTime = sec + (usec / 1000000.0);
sec = testRunStopTime.tv_sec - testRunStartTime.tv_sec;
usec = testRunStopTime.tv_usec - testRunStartTime.tv_usec;
sec = double(testRunStopTime.tv_sec - testRunStartTime.tv_sec);
usec = double(testRunStopTime.tv_usec - testRunStartTime.tv_usec);
double testRunTime = sec + (usec / 1000000.0);
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment