Commit 8a490428 authored by Karl Palmen's avatar Karl Palmen
Browse files

Remove Object_sptr etc. re #12827



Signed-off-by: default avatarKarl Palmen <karl.palmen@stfc.ac.uk>
parent 2e79802f
......@@ -565,14 +565,14 @@ Instrument_sptr CreateSampleWorkspace::createTestInstrumentRectangular(
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(new CSGObject), testInst.get());
new ObjComponent("moderator", IObject_sptr(new CSGObject), testInst.get());
source->setPos(V3D(0.0, 0.0, -sourceSampleDistance));
testInst->add(source);
testInst->markAsSource(source);
// Add chopper
ObjComponent *chopper = new ObjComponent(
"chopper-position", Object_sptr(new CSGObject), testInst.get());
"chopper-position", IObject_sptr(new CSGObject), testInst.get());
chopper->setPos(V3D(0.0, 0.0, -0.25 * sourceSampleDistance));
testInst->add(chopper);
......
......@@ -539,13 +539,13 @@ public:
// Define a source and sample position
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(), testInst.get());
new ObjComponent("moderator", IObject_sptr(), testInst.get());
source->setPos(V3D(0, 0.0, -11.739));
testInst->add(source);
testInst->markAsSource(source);
// Define a sample as a simple sphere
ObjComponent *sample =
new ObjComponent("samplePos", Object_sptr(), testInst.get());
new ObjComponent("samplePos", IObject_sptr(), testInst.get());
testInst->setPos(0.0, 0.0, 0.0);
testInst->add(sample);
testInst->markAsSamplePos(sample);
......
......@@ -119,7 +119,6 @@ private:
using Mantid::Geometry::Instrument;
using Mantid::Geometry::CompAssembly;
using Mantid::Geometry::Detector;
using Mantid::Geometry::Object_sptr;
using Mantid::Kernel::V3D;
// Need a tube based instrument.
......
......@@ -12,7 +12,6 @@
using Mantid::API::MatrixWorkspace_sptr;
using Mantid::DataObjects::Workspace2D_sptr;
using Mantid::Geometry::Object_sptr;
class CuboidGaugeVolumeAbsorptionTest : public CxxTest::TestSuite {
public:
......
......@@ -42,14 +42,14 @@ public:
// Define a source and sample position
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(), testInst.get());
new ObjComponent("moderator", IObject_sptr(), testInst.get());
source->setPos(V3D(0.0, 0.0, -95.0));
testInst->add(source);
testInst->markAsSource(source);
// Define a sample as a simple sphere
ObjComponent *sample =
new ObjComponent("samplePos", Object_sptr(), testInst.get());
new ObjComponent("samplePos", IObject_sptr(), testInst.get());
testInst->setPos(0.0, 0.0, 0.0);
testInst->add(sample);
testInst->markAsSamplePos(sample);
......
......@@ -69,7 +69,7 @@ private:
/// Run the algorithm
void exec() override;
/// Function to return a cuboid shape, with widths dx,dy,dz
Geometry::Object_sptr createCuboid(double dx, double dy, double dz);
Geometry::IObject_sptr createCuboid(double dx, double dy, double dz);
};
} // namespace DataHandling
......
......@@ -275,7 +275,7 @@ void LoadNXSPE::exec() {
instrument->add(sample);
instrument->markAsSamplePos(sample);
Geometry::Object_const_sptr cuboid(
Geometry::IObject_const_sptr cuboid(
createCuboid(0.1, 0.1, 0.1)); // FIXME: memory hog on rendering. Also,
// make each detector separate size
for (std::size_t i = 0; i < numSpectra; ++i) {
......@@ -342,7 +342,7 @@ void LoadNXSPE::exec() {
setProperty("OutputWorkspace", outputWS);
}
Geometry::Object_sptr LoadNXSPE::createCuboid(double dx, double dy, double dz) {
Geometry::IObject_sptr LoadNXSPE::createCuboid(double dx, double dy, double dz) {
dx = 0.5 * std::fabs(dx);
dy = 0.5 * std::fabs(dy);
......@@ -403,7 +403,7 @@ Geometry::Object_sptr LoadNXSPE::createCuboid(double dx, double dy, double dz) {
// A sphere
std::string ObjSphere = "-41";
Geometry::Object_sptr retVal = boost::make_shared<Geometry::CSGObject>();
Geometry::IObject_sptr retVal = boost::make_shared<Geometry::CSGObject>();
retVal->setObject(41, ObjSphere);
retVal->populate(SphSurMap);
......
......@@ -273,11 +273,6 @@ protected:
/// including complementary object ?)
};
/// Typdef for a shared pointer
typedef boost::shared_ptr<CSGObject> Object_sptr;
/// Typdef for a shared pointer to a const object
typedef boost::shared_ptr<const CSGObject> Object_const_sptr;
} // NAMESPACE Geometry
} // NAMESPACE Mantid
......
......@@ -131,7 +131,7 @@ public:
}
void testCreateUnitCube() {
Object_sptr geom_obj = createUnitCube();
boost::shared_ptr<CSGObject> geom_obj = createUnitCube();
TS_ASSERT_EQUALS(geom_obj->str(), "68 1 -2 3 -4 5 -6");
......@@ -140,7 +140,7 @@ public:
}
void testIsOnSideCappedCylinder() {
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
// inside
TS_ASSERT_EQUALS(geom_obj->isOnSide(V3D(0, 0, 0)), false); // origin
TS_ASSERT_EQUALS(geom_obj->isOnSide(V3D(0, 2.9, 0)), false);
......@@ -174,7 +174,7 @@ public:
}
void testIsValidCappedCylinder() {
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
// inside
TS_ASSERT_EQUALS(geom_obj->isValid(V3D(0, 0, 0)), true); // origin
TS_ASSERT_EQUALS(geom_obj->isValid(V3D(0, 2.9, 0)), true);
......@@ -287,7 +287,7 @@ public:
}
void testCalcValidTypeCappedCylinder() {
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
// entry on the normal
TS_ASSERT_EQUALS(geom_obj->calcValidType(V3D(-3.2, 0, 0), V3D(1, 0, 0)), 1);
TS_ASSERT_EQUALS(geom_obj->calcValidType(V3D(-3.2, 0, 0), V3D(-1, 0, 0)),
......@@ -321,7 +321,7 @@ public:
// A sphere
std::string ObjSphere = "-41";
Object_sptr geom_obj = Object_sptr(new CSGObject);
boost::shared_ptr<CSGObject> geom_obj = boost::shared_ptr<CSGObject>(new CSGObject);
geom_obj->setObject(41, ObjSphere);
geom_obj->populate(SphSurMap);
......@@ -361,7 +361,7 @@ public:
void testInterceptSurfaceCappedCylinderY() {
std::vector<Link> expectedResults;
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
// format = startPoint, endPoint, total distance so far
expectedResults.push_back(Link(V3D(0, -3, 0), V3D(0, 3, 0), 13, *geom_obj));
......@@ -371,7 +371,7 @@ public:
void testInterceptSurfaceCappedCylinderX() {
std::vector<Link> expectedResults;
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
Track track(V3D(-10, 0, 0), V3D(1, 0, 0));
// format = startPoint, endPoint, total distance so far
......@@ -383,7 +383,7 @@ public:
void testInterceptSurfaceCappedCylinderMiss() {
std::vector<Link>
expectedResults; // left empty as there are no expected results
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
Track track(V3D(-10, 0, 0), V3D(1, 1, 0));
checkTrackIntercept(geom_obj, track, expectedResults);
......@@ -618,7 +618,7 @@ public:
Test find point in cube
*/
{
Object_sptr geom_obj = createUnitCube();
boost::shared_ptr<CSGObject> geom_obj = createUnitCube();
// initial guess in object
Kernel::V3D pt;
TS_ASSERT_EQUALS(geom_obj->getPointInObject(pt), 1);
......@@ -626,17 +626,17 @@ public:
// initial guess not in object, but on x-axis
std::vector<std::string> planes{"px 10", "px 11", "py -0.5",
"py 0.5", "pz -0.5", "pz 0.5"};
Object_sptr B = createCuboid(planes);
boost::shared_ptr<CSGObject> B = createCuboid(planes);
TS_ASSERT_EQUALS(B->getPointInObject(pt), 1);
TS_ASSERT_EQUALS(pt, V3D(10, 0, 0));
// on y axis
planes = {"px -0.5", "px 0.5", "py -22", "py -21", "pz -0.5", "pz 0.5"};
Object_sptr C = createCuboid(planes);
boost::shared_ptr<CSGObject> C = createCuboid(planes);
TS_ASSERT_EQUALS(C->getPointInObject(pt), 1);
TS_ASSERT_EQUALS(pt, V3D(0, -21, 0));
// not on principle axis, now works using getBoundingBox
planes = {"px 0.5", "px 1.5", "py -22", "py -21", "pz -0.5", "pz 0.5"};
Object_sptr D = createCuboid(planes);
boost::shared_ptr<CSGObject> D = createCuboid(planes);
TS_ASSERT_EQUALS(D->getPointInObject(pt), 1);
TS_ASSERT_DELTA(pt.X(), 1.0, 1e-6);
TS_ASSERT_DELTA(pt.Y(), -21.5, 1e-6);
......@@ -655,7 +655,7 @@ public:
"p 0 .70710678118 .70710678118 -0.1",
"p 0 -.70710678118 .70710678118 -0.5",
"p 0 -.70710678118 .70710678118 0.5"};
Object_sptr E = createCuboid(planes);
boost::shared_ptr<CSGObject> E = createCuboid(planes);
TS_ASSERT_EQUALS(E->getPointInObject(pt), 1);
TS_ASSERT_DELTA(pt.X(), 0.0, 1e-6);
TS_ASSERT_DELTA(pt.Y(), -0.1414213562373, 1e-6);
......@@ -670,7 +670,7 @@ public:
"p 0 .70710678118 .70710678118 -1",
"p 0 -.70710678118 .70710678118 -0.5",
"p 0 -.70710678118 .70710678118 0.5"};
Object_sptr F = createCuboid(planes);
boost::shared_ptr<CSGObject> F = createCuboid(planes);
TS_ASSERT_EQUALS(F->getPointInObject(pt), 1); // This now succeeds
// Test use of defineBoundingBox to explictly set the bounding box, when the
// automatic method fails
......@@ -777,7 +777,7 @@ public:
Test solid angle calculation for a capped cylinder
*/
{
Object_sptr geom_obj = createSmallCappedCylinder();
boost::shared_ptr<CSGObject> geom_obj = createSmallCappedCylinder();
// Want to test triangulation so setup a geometry handler
boost::shared_ptr<GluGeometryHandler> h =
boost::shared_ptr<GluGeometryHandler>(
......@@ -824,7 +824,7 @@ public:
- test for using Open Cascade surface triangulation for all solid angles.
*/
{
Object_sptr geom_obj = createUnitCube();
boost::shared_ptr<CSGObject> geom_obj = createUnitCube();
double satol = 1e-3; // tolerance for solid angle
// solid angle at distance 0.5 should be 4pi/6 by symmetry
......@@ -847,7 +847,7 @@ public:
/** Add a scale factor */
void testSolidAngleCubeTriangles_WithScaleFactor() {
Object_sptr geom_obj = createUnitCube();
boost::shared_ptr<CSGObject> geom_obj = createUnitCube();
double satol = 1e-3; // tolerance for solid angle
// solid angle at distance 0.5 should be 4pi/6 by symmetry
double expected = M_PI * 2.0 / 3.0;
......@@ -954,7 +954,7 @@ public:
Test bounding box for a object capped cylinder
*/
{
Object_sptr geom_obj = createCappedCylinder();
IObject_sptr geom_obj = createCappedCylinder();
double xmax, ymax, zmax, xmin, ymin, zmin;
xmax = ymax = zmax = 100;
xmin = ymin = zmin = -100;
......@@ -968,7 +968,7 @@ public:
}
void testGetBoundingBoxForCuboid() {
Object_sptr cuboid = createUnitCube();
boost::shared_ptr<CSGObject> cuboid = createUnitCube();
double xmax, ymax, zmax, xmin, ymin, zmin;
xmax = ymax = zmax = 100;
xmin = ymin = zmin = -100;
......@@ -997,7 +997,7 @@ public:
hex.rft = V3D(0.5, 0.5, 2);
hex.rbt = V3D(0, 0.5, 2);
Object_sptr hexahedron = createHexahedron(hex);
boost::shared_ptr<CSGObject> hexahedron = createHexahedron(hex);
auto bb = hexahedron->getBoundingBox();
......@@ -1014,7 +1014,7 @@ public:
Test use of defineBoundingBox
*/
{
Object_sptr geom_obj = createCappedCylinder();
boost::shared_ptr<CSGObject> geom_obj = createCappedCylinder();
double xmax, ymax, zmax, xmin, ymin, zmin;
xmax = 1.2;
ymax = 3.0;
......@@ -1047,7 +1047,7 @@ public:
Test triangle solid angle calc
*/
{
Object_sptr geom_obj = createCappedCylinder();
boost::shared_ptr<CSGObject> geom_obj = createCappedCylinder();
double xmax, ymax, zmax, xmin, ymin, zmin;
xmax = 20;
ymax = 20.0;
......@@ -1140,7 +1140,7 @@ private:
STYPE SMap; ///< Surface Map
Object_sptr createCappedCylinder() {
boost::shared_ptr<CSGObject> createCappedCylinder() {
std::string C31 = "cx 3.0"; // cylinder x-axis radius 3
std::string C32 = "px 1.2";
std::string C33 = "px -3.2";
......@@ -1162,7 +1162,7 @@ private:
// using surface ids: 31 (cylinder) 32 (plane (top) ) and 33 (plane (base))
std::string ObjCapCylinder = "-31 -32 33";
Object_sptr retVal = Object_sptr(new CSGObject);
boost::shared_ptr<CSGObject> retVal = boost::shared_ptr<CSGObject>(new CSGObject);
retVal->setObject(21, ObjCapCylinder);
retVal->populate(CylSurMap);
......@@ -1174,7 +1174,7 @@ private:
// This creates a cylinder to test the solid angle that is more realistic in
// size
// for a detector cylinder
Object_sptr createSmallCappedCylinder() {
boost::shared_ptr<CSGObject> createSmallCappedCylinder() {
std::string C31 =
"cx 0.005"; // cylinder x-axis radius 0.005 and height 0.003
std::string C32 = "px -0.997";
......@@ -1197,7 +1197,7 @@ private:
// using surface ids: 31 (cylinder) 32 (plane (top) ) and 33 (plane (base))
std::string ObjCapCylinder = "-31 -32 33";
Object_sptr retVal = Object_sptr(new CSGObject);
boost::shared_ptr<CSGObject> retVal = boost::shared_ptr<CSGObject>(new CSGObject);
retVal->setObject(21, ObjCapCylinder);
retVal->populate(CylSurMap);
......@@ -1263,7 +1263,7 @@ private:
return;
}
Object_sptr createUnitCube() {
boost::shared_ptr<CSGObject> createUnitCube() {
std::string C1 = "px -0.5"; // cube +/-0.5
std::string C2 = "px 0.5";
std::string C3 = "py -0.5";
......@@ -1297,14 +1297,14 @@ private:
// using surface ids: 1-6
std::string ObjCube = "1 -2 3 -4 5 -6";
Object_sptr retVal = Object_sptr(new CSGObject);
boost::shared_ptr<CSGObject> retVal = boost::shared_ptr<CSGObject>(new CSGObject);
retVal->setObject(68, ObjCube);
retVal->populate(CubeSurMap);
return retVal;
}
Object_sptr createCuboid(std::vector<std::string> &planes) {
boost::shared_ptr<CSGObject> createCuboid(std::vector<std::string> &planes) {
std::string C1 = planes[0];
std::string C2 = planes[1];
std::string C3 = planes[2];
......@@ -1338,14 +1338,14 @@ private:
// using surface ids: 1-6
std::string ObjCube = "1 -2 3 -4 5 -6";
Object_sptr retVal = Object_sptr(new CSGObject);
boost::shared_ptr<CSGObject> retVal = boost::shared_ptr<CSGObject>(new CSGObject);
retVal->setObject(68, ObjCube);
retVal->populate(CubeSurMap);
return retVal;
}
Object_sptr createHexahedron(Hexahedron &hex) {
boost::shared_ptr<CSGObject> createHexahedron(Hexahedron &hex) {
// Create surfaces
std::map<int, boost::shared_ptr<Surface>> HexSurMap;
HexSurMap[1] = boost::make_shared<Plane>();
......@@ -1418,7 +1418,7 @@ private:
std::string ObjHex = "-1 2 3 -4 -5 6";
Object_sptr retVal = Object_sptr(new CSGObject);
boost::shared_ptr<CSGObject> retVal = boost::shared_ptr<CSGObject>(new CSGObject);
// Explicitly setting the GluGeometryHanler hexahedron allows
// for the correct bounding box calculation.
......
......@@ -40,12 +40,12 @@ public:
void testShape() {
// Create an empty shape and put it in an ObjComponent
Object_const_sptr shape(new CSGObject);
IObject_const_sptr shape(new CSGObject);
ObjComponent objComp("obj", shape);
// Get it back - it's the same one
TS_ASSERT_EQUALS(objComp.shape(), shape);
// Put a different shape object in there and check we get back that one
Object_const_sptr shape2(new CSGObject);
IObject_const_sptr shape2(new CSGObject);
objComp.setShape(shape2);
TS_ASSERT_DIFFERS(objComp.shape(), shape);
TS_ASSERT_EQUALS(objComp.shape(), shape2);
......
......@@ -36,13 +36,13 @@ Mantid::API::MatrixWorkspace_sptr MakeWorkspace(double xmin, double dx,
// Define a source and sample position
// Define a source component
Mantid::Geometry::ObjComponent *source = new Mantid::Geometry::ObjComponent(
"moderator", Mantid::Geometry::Object_sptr(), testInst.get());
"moderator", Mantid::Geometry::IObject_sptr(), testInst.get());
source->setPos(Mantid::Kernel::V3D(0, 0.0, -15.));
testInst->add(source);
testInst->markAsSource(source);
// Define a sample as a simple sphere
Mantid::Geometry::ObjComponent *sample = new Mantid::Geometry::ObjComponent(
"samplePos", Mantid::Geometry::Object_sptr(), testInst.get());
"samplePos", Mantid::Geometry::IObject_sptr(), testInst.get());
testInst->setPos(0.0, 0.0, 0.0);
testInst->add(sample);
testInst->markAsSamplePos(sample);
......
......@@ -215,13 +215,13 @@ private:
// Define a source and sample position
// Define a source component
Mantid::Geometry::ObjComponent *source = new Mantid::Geometry::ObjComponent(
"moderator", Mantid::Geometry::Object_sptr(), testInst.get());
"moderator", Mantid::Geometry::IObject_sptr(), testInst.get());
source->setPos(Mantid::Kernel::V3D(0, 0.0, -15.));
testInst->add(source);
testInst->markAsSource(source);
// Define a sample as a simple sphere
Mantid::Geometry::ObjComponent *sample = new Mantid::Geometry::ObjComponent(
"samplePos", Mantid::Geometry::Object_sptr(), testInst.get());
"samplePos", Mantid::Geometry::IObject_sptr(), testInst.get());
testInst->setPos(0.0, 0.0, 0.0);
testInst->add(sample);
testInst->markAsSamplePos(sample);
......
......@@ -301,7 +301,7 @@ Instrument_sptr createTestInstrumentCylindrical(
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(new CSGObject), testInst.get());
new ObjComponent("moderator", IObject_sptr(new CSGObject), testInst.get());
source->setPos(sourcePos);
testInst->add(source);
testInst->markAsSource(source);
......@@ -392,7 +392,7 @@ createCylInstrumentWithDetInGivenPositions(const std::vector<double> &L2,
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(new CSGObject), testInst.get());
new ObjComponent("moderator", IObject_sptr(new CSGObject), testInst.get());
source->setPos(V3D(0.0, 0.0, -L2_min));
testInst->add(source);
testInst->markAsSource(source);
......@@ -541,7 +541,7 @@ Instrument_sptr createTestInstrumentRectangular2(int num_banks, int pixels,
// Define a source component
ObjComponent *source =
new ObjComponent("moderator", Object_sptr(new CSGObject), testInst.get());
new ObjComponent("moderator", IObject_sptr(new CSGObject), testInst.get());
source->setPos(V3D(0.0, 0.0, -10.));
testInst->add(source);
testInst->markAsSource(source);
......
......@@ -49,7 +49,7 @@ void addFullInstrumentToWorkspace(MatrixWorkspace &workspace,
{
Detector *monitor1 =
new Detector("mon1", workspace.getAxis(1)->spectraNo(ndets),
Object_sptr(), instrument.get());
IObject_sptr(), instrument.get());
monitor1->setPos(0.0, 0.0, -9.0);
instrument->add(monitor1);
instrument->markAsMonitor(monitor1);
......@@ -57,7 +57,7 @@ void addFullInstrumentToWorkspace(MatrixWorkspace &workspace,
Detector *monitor2 =
new Detector("mon2", workspace.getAxis(1)->spectraNo(ndets) + 1,
Object_sptr(), instrument.get());
IObject_sptr(), instrument.get());
monitor2->setPos(0.0, 0.0, -2.0);
instrument->add(monitor2);
instrument->markAsMonitor(monitor2);
......
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