Commit d5aeb97a authored by Hahn, Steven's avatar Hahn, Steven
Browse files

Refs #14137. Change from unique to shared ownership of shapes.

parent a433ae48
......@@ -368,14 +368,14 @@ Geometry::Object_sptr LoadNXSPE::createCuboid(double dx, double dy, double dz) {
std::string S41 = "so 0.01"; // Sphere at origin radius 0.01
// First create some surfaces
std::map<int, std::unique_ptr<Geometry::Surface>> SphSurMap;
SphSurMap[41] = std::unique_ptr<Geometry::Surface>(new Geometry::Sphere());
std::map<int, boost::shared_ptr<Geometry::Surface>> SphSurMap;
SphSurMap[41] = boost::make_shared<Geometry::Sphere>();
SphSurMap[41]->setSurface(S41);
SphSurMap[41]->setName(41);
// A sphere
std::string ObjSphere = "-41";
Geometry::Object_sptr retVal = Geometry::Object_sptr(new Geometry::Object);
Geometry::Object_sptr retVal = boost::make_shared<Geometry::Object>();
retVal->setObject(41, ObjSphere);
retVal->populate(SphSurMap);
......
......@@ -85,7 +85,7 @@ public:
std::string &Ln); ///< Process a complementary object
int hasComplement() const;
int populate(const std::map<int, std::unique_ptr<Surface>> &);
int populate(const std::map<int, boost::shared_ptr<Surface>> &);
int createSurfaceList(const int outFlag = 0); ///< create Surface list
int addSurfString(const std::string &); ///< Not implemented
int removeSurface(const int SurfN);
......
......@@ -2,7 +2,7 @@
#define Rules_h
#include <map>
#include <memory>
#include <boost/shared_ptr.hpp>
class TopoDS_Shape;
......@@ -229,7 +229,7 @@ be calculated
class MANTID_GEOMETRY_DLL SurfPoint : public Rule {
private:
std::unique_ptr<Surface> key; ///< Actual Surface Base Object
boost::shared_ptr<Surface> m_key; ///< Actual Surface Base Object
int keyN; ///< Key Number (identifer)
int sign; ///< +/- in Object unit
public:
......@@ -251,14 +251,14 @@ public:
int type() const { return 0; } ///< Effective name
void setKeyN(const int Ky); ///< set keyNumber
void setKey(std::unique_ptr<Surface> key);
void setKey(const boost::shared_ptr<Surface> &key);
bool isValid(const Kernel::V3D &) const;
bool isValid(const std::map<int, int> &) const;
int getSign() const { return sign; } ///< Get Sign
int getKeyN() const { return keyN; } ///< Get Key
int simplify();
Surface *getKey() const { return key.get(); } ///< Get Surface Ptr
Surface *getKey() const { return m_key.get(); } ///< Get Surface Ptr
std::string display() const;
std::string displayAddress() const;
void getBoundingBox(double &xmax, double &ymax, double &zmax, double &xmin,
......
......@@ -83,45 +83,46 @@ public:
private:
std::string parseSphere(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseInfinitePlane(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
int &l_id);
std::string
parseInfinitePlane(Poco::XML::Element *pElem,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string
parseInfiniteCylinder(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseCylinder(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string
parseSegmentedCylinder(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
CuboidCorners parseCuboid(Poco::XML::Element *pElem);
std::string parseCuboid(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseInfiniteCone(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseCone(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseHexahedron(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseTaperedGuide(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string parseTorus(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
std::string
parseSliceOfCylinderRing(Poco::XML::Element *pElem,
std::map<int, std::unique_ptr<Surface>> &prim,
std::map<int, boost::shared_ptr<Surface>> &prim,
int &l_id);
Poco::XML::Element *getShapeElement(Poco::XML::Element *pElem,
......
......@@ -267,7 +267,7 @@ int Object::hasComplement() const {
* @retval 1000+ keyNumber :: Error with keyNumber
* @retval 0 :: successfully populated all the whole Object.
*/
int Object::populate(const std::map<int, std::unique_ptr<Surface>> &Smap) {
int Object::populate(const std::map<int, boost::shared_ptr<Surface>> &Smap) {
std::deque<Rule *> Rst;
Rst.push_back(TopRule);
Rule *TA, *TB; // Tmp. for storage
......@@ -281,10 +281,10 @@ int Object::populate(const std::map<int, std::unique_ptr<Surface>> &Smap) {
SurfPoint *KV = dynamic_cast<SurfPoint *>(T1);
if (KV) {
// Ensure that we have a it in the surface list:
std::map<int, std::unique_ptr<Surface>>::const_iterator mf =
std::map<int, boost::shared_ptr<Surface>>::const_iterator mf =
Smap.find(KV->getKeyN());
if (mf != Smap.end()) {
KV->setKey(mf->second->clone());
KV->setKey(mf->second);
Rcount++;
} else {
throw Kernel::Exception::NotFoundError("Object::populate",
......
......@@ -697,14 +697,14 @@ TopoDS_Shape Union::analyze() {
//---------------------------------------------------------------
SurfPoint::SurfPoint()
: Rule(), key(), keyN(0), sign(1)
: Rule(), m_key(), keyN(0), sign(1)
/**
Constructor with null key/number
*/
{}
SurfPoint::SurfPoint(const SurfPoint &A)
: Rule(), key(A.key->clone()), keyN(A.keyN), sign(A.sign)
: Rule(), m_key(A.m_key), keyN(A.keyN), sign(A.sign)
/**
Copy constructor
@param A :: SurfPoint to copy
......@@ -728,7 +728,7 @@ SurfPoint &SurfPoint::operator=(const SurfPoint &A)
*/
{
if (&A != this) {
key = A.key->clone();
m_key = A.m_key;
keyN = A.keyN;
sign = A.sign;
}
......@@ -803,13 +803,13 @@ void SurfPoint::setKeyN(const int Ky)
return;
}
void SurfPoint::setKey(std::unique_ptr<Surface> Spoint)
void SurfPoint::setKey(const boost::shared_ptr<Surface> &Spoint)
/**
Sets the key pointer. The class takes ownership.
@param Spoint :: new key values
*/
{
key = std::move(Spoint);
m_key = Spoint;
return;
}
......@@ -832,8 +832,8 @@ bool SurfPoint::isValid(const Kernel::V3D &Pt) const
@retval 0 :: Pt is on the -ve side of the surface
*/
{
if (key) {
return (key->side(Pt) * sign) >= 0;
if (m_key) {
return (m_key->side(Pt) * sign) >= 0;
}
return false;
}
......@@ -889,7 +889,7 @@ std::string SurfPoint::displayAddress() const
void SurfPoint::getBoundingBox(double &xmax, double &ymax, double &zmax,
double &xmin, double &ymin, double &zmin) {
if (this->sign < 1) // If the object sign is positive then include
key->getBoundingBox(xmax, ymax, zmax, xmin, ymin, zmin);
m_key->getBoundingBox(xmax, ymax, zmax, xmin, ymin, zmin);
else { // if the object sign is negative then get the complement
std::vector<V3D> listOfPoints;
double gXmax, gYmax, gZmax, gXmin, gYmin, gZmin;
......@@ -899,7 +899,7 @@ void SurfPoint::getBoundingBox(double &xmax, double &ymax, double &zmax,
gXmin = xmin;
gYmin = ymin;
gZmin = zmin;
key->getBoundingBox(gXmax, gYmax, gZmax, gXmin, gYmin, gZmin);
m_key->getBoundingBox(gXmax, gYmax, gZmax, gXmin, gYmin, gZmin);
if (!((xmax <= gXmax && xmax >= gXmin) &&
(ymax <= gYmax && ymax >= gYmin) && (zmax <= gZmax && zmax >= gZmin)))
listOfPoints.push_back(V3D(xmax, ymax, zmax));
......@@ -985,10 +985,10 @@ void SurfPoint::getBoundingBox(double &xmax, double &ymax, double &zmax,
#ifdef ENABLE_OPENCASCADE
TopoDS_Shape SurfPoint::analyze() {
// Check for individual type of surfaces
TopoDS_Shape Result = key->createShape();
TopoDS_Shape Result = m_key->createShape();
if (sign > 0)
Result.Complement();
if (key->className() == "Plane") {
if (m_key->className() == "Plane") {
// build a box
gp_Pnt p(-1000.0, -1000.0, -1000.0);
TopoDS_Shape world = BRepPrimAPI_MakeBox(p, 2000.0, 2000.0, 2000.0).Shape();
......
......@@ -421,7 +421,7 @@ int Rule::removeItem(Rule *&TRule, const int SurfN)
throw std::logic_error("Failed to cast Rule object to SurfPoint");
}
SX->setKeyN(0);
SX->setKey(std::unique_ptr<Surface>());
SX->setKey(boost::shared_ptr<Surface>());
return cnt + 1;
}
delete Ptr;
......
......@@ -12,6 +12,8 @@
#include "MantidKernel/Timer.h"
#include "boost/make_shared.hpp"
using namespace Mantid::Kernel;
using namespace Mantid::Geometry;
......@@ -450,10 +452,10 @@ private:
std::string C33 = "px -3.2";
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> CylSurMap;
CylSurMap[31] = std::unique_ptr<Cylinder>(new Cylinder());
CylSurMap[32] = std::unique_ptr<Plane>(new Plane());
CylSurMap[33] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CylSurMap;
CylSurMap[31] = boost::make_shared<Cylinder>();
CylSurMap[32] = boost::make_shared<Plane>();
CylSurMap[33] = boost::make_shared<Plane>();
CylSurMap[31]->setSurface(C31);
CylSurMap[32]->setSurface(C32);
......@@ -479,10 +481,10 @@ private:
std::string C33 = "px -3.0";
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> CylSurMap;
CylSurMap[31] = std::unique_ptr<Cylinder>(new Cylinder());
CylSurMap[32] = std::unique_ptr<Plane>(new Plane());
CylSurMap[33] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CylSurMap;
CylSurMap[31] = boost::make_shared<Cylinder>();
CylSurMap[32] = boost::make_shared<Plane>();
CylSurMap[33] = boost::make_shared<Plane>();
CylSurMap[31]->setSurface(C31);
CylSurMap[32]->setSurface(C32);
......@@ -511,13 +513,13 @@ private:
std::string C6 = planes[5];
// Create surfaces
std::map<int, std::unique_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[2] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[3] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[4] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[5] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[6] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = boost::make_shared<Plane>();
CubeSurMap[2] = boost::make_shared<Plane>();
CubeSurMap[3] = boost::make_shared<Plane>();
CubeSurMap[4] = boost::make_shared<Plane>();
CubeSurMap[5] = boost::make_shared<Plane>();
CubeSurMap[6] = boost::make_shared<Plane>();
CubeSurMap[1]->setSurface(C1);
CubeSurMap[2]->setSurface(C2);
......
......@@ -8,7 +8,8 @@
#include <algorithm>
#include <ctime>
#include <boost/shared_ptr.hpp>
#include "boost/shared_ptr.hpp"
#include "boost/make_shared.hpp"
#include "MantidGeometry/Objects/Object.h"
#include "MantidGeometry/Surfaces/Cylinder.h"
......@@ -291,8 +292,8 @@ public:
std::string S41 = "s 1 1 1 4"; // Sphere at (1,1,1) radius 4
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> SphSurMap;
SphSurMap[41] = std::unique_ptr<Sphere>(new Sphere());
std::map<int, boost::shared_ptr<Surface>> SphSurMap;
SphSurMap[41] = boost::make_shared<Sphere>();
SphSurMap[41]->setSurface(S41);
SphSurMap[41]->setName(41);
......@@ -887,7 +888,7 @@ public:
private:
/// Surface type
typedef std::map<int, std::unique_ptr<Surface>> STYPE;
typedef std::map<int, boost::shared_ptr<Surface>> STYPE;
/// set timeTest true to get time comparisons of soild angle methods
const static bool timeTest = false;
......@@ -900,10 +901,10 @@ private:
std::string C33 = "px -3.2";
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> CylSurMap;
CylSurMap[31] = std::unique_ptr<Surface>(new Cylinder());
CylSurMap[32] = std::unique_ptr<Surface>(new Plane());
CylSurMap[33] = std::unique_ptr<Surface>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CylSurMap;
CylSurMap[31] = boost::make_shared<Cylinder>();
CylSurMap[32] = boost::make_shared<Plane>();
CylSurMap[33] = boost::make_shared<Plane>();
CylSurMap[31]->setSurface(C31);
CylSurMap[32]->setSurface(C32);
......@@ -935,10 +936,10 @@ private:
std::string C33 = "px -1.0";
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> CylSurMap;
CylSurMap[31] = std::unique_ptr<Cylinder>(new Cylinder());
CylSurMap[32] = std::unique_ptr<Plane>(new Plane());
CylSurMap[33] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CylSurMap;
CylSurMap[31] = boost::make_shared<Cylinder>();
CylSurMap[32] = boost::make_shared<Plane>();
CylSurMap[33] = boost::make_shared<Plane>();
CylSurMap[31]->setSurface(C31);
CylSurMap[32]->setSurface(C32);
......@@ -962,8 +963,8 @@ private:
std::string S41 = "so 4.1"; // Sphere at origin radius 4.1
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> SphSurMap;
SphSurMap[41] = std::unique_ptr<Sphere>(new Sphere());
std::map<int, boost::shared_ptr<Surface>> SphSurMap;
SphSurMap[41] = boost::make_shared<Sphere>();
SphSurMap[41]->setSurface(S41);
SphSurMap[41]->setName(41);
......@@ -1034,7 +1035,8 @@ private:
exit(1);
}
A->setName(vc->first);
SMap.insert(STYPE::value_type(vc->first, std::move(A)));
SMap.insert(STYPE::value_type(vc->first,
boost::shared_ptr<Surface>(std::move(A))));
}
return;
......@@ -1049,13 +1051,13 @@ private:
std::string C6 = "pz 0.5";
// Create surfaces
std::map<int, std::unique_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[2] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[3] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[4] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[5] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[6] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = boost::make_shared<Plane>();
CubeSurMap[2] = boost::make_shared<Plane>();
CubeSurMap[3] = boost::make_shared<Plane>();
CubeSurMap[4] = boost::make_shared<Plane>();
CubeSurMap[5] = boost::make_shared<Plane>();
CubeSurMap[6] = boost::make_shared<Plane>();
CubeSurMap[1]->setSurface(C1);
CubeSurMap[2]->setSurface(C2);
......@@ -1090,13 +1092,13 @@ private:
std::string C6 = planes[5];
// Create surfaces
std::map<int, std::unique_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[2] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[3] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[4] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[5] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[6] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = boost::make_shared<Plane>();
CubeSurMap[2] = boost::make_shared<Plane>();
CubeSurMap[3] = boost::make_shared<Plane>();
CubeSurMap[4] = boost::make_shared<Plane>();
CubeSurMap[5] = boost::make_shared<Plane>();
CubeSurMap[6] = boost::make_shared<Plane>();
CubeSurMap[1]->setSurface(C1);
CubeSurMap[2]->setSurface(C2);
......
......@@ -306,10 +306,10 @@ private:
std::string C33 = "px -3.2";
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> CylSurMap;
CylSurMap[31] = std::unique_ptr<Surface>(new Cylinder());
CylSurMap[32] = std::unique_ptr<Plane>(new Plane());
CylSurMap[33] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CylSurMap;
CylSurMap[31] = boost::make_shared<Cylinder>();
CylSurMap[32] = boost::make_shared<Plane>();
CylSurMap[33] = boost::make_shared<Plane>();
CylSurMap[31]->setSurface(C31);
CylSurMap[32]->setSurface(C32);
......@@ -338,13 +338,13 @@ private:
std::string C6 = planes[5];
// Create surfaces
std::map<int, std::unique_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[2] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[3] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[4] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[5] = std::unique_ptr<Plane>(new Plane());
CubeSurMap[6] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CubeSurMap;
CubeSurMap[1] = boost::make_shared<Plane>();
CubeSurMap[2] = boost::make_shared<Plane>();
CubeSurMap[3] = boost::make_shared<Plane>();
CubeSurMap[4] = boost::make_shared<Plane>();
CubeSurMap[5] = boost::make_shared<Plane>();
CubeSurMap[6] = boost::make_shared<Plane>();
CubeSurMap[1]->setSurface(C1);
CubeSurMap[2]->setSurface(C2);
......
......@@ -6,6 +6,9 @@
#include "MantidKernel/Logger.h"
#include "MantidKernel/System.h"
#include <cfloat>
#include "boost/make_shared.hpp"
#include "MantidKernel/V3D.h"
#include "MantidGeometry/Surfaces/Quadratic.h"
#include "MantidGeometry/Objects/Object.h"
......@@ -140,13 +143,13 @@ private:
SurfPoint *sR1, *sR2;
sR1 = new SurfPoint();
sR2 = new SurfPoint();
auto sP = std::unique_ptr<Surface>(new Sphere());
auto sP = boost::make_shared<Sphere>();
sP->setSurface("s 2.0 0.0 0.0 2");
sR1->setKey(std::move(sP)); // Sphere
sR1->setKey(sP); // Sphere
sR1->setKeyN(-10);
auto cP = std::unique_ptr<Surface>(new Cylinder());
auto cP = boost::make_shared<Cylinder>();
cP->setSurface("cy 1.0");
sR2->setKey(std::move(cP)); // cappedcylinder
sR2->setKey(cP); // cappedcylinder
sR2->setKeyN(-11);
Union *uR1;
uR1 = new Union(sR1, sR2);
......
......@@ -15,6 +15,8 @@
#include "MantidGeometry/Surfaces/Cylinder.h"
#include "MantidGeometry/Surfaces/Cone.h"
#include "boost/make_shared.hpp"
using namespace Mantid;
using namespace Geometry;
using Mantid::Kernel::V3D;
......@@ -190,10 +192,10 @@ private:
std::string C33 = "px -3.2";
// First create some surfaces
std::map<int, std::unique_ptr<Surface>> CylSurMap;
CylSurMap[31] = std::unique_ptr<Cylinder>(new Cylinder());
CylSurMap[32] = std::unique_ptr<Plane>(new Plane());
CylSurMap[33] = std::unique_ptr<Plane>(new Plane());
std::map<int, boost::shared_ptr<Surface>> CylSurMap;
CylSurMap[31] = boost::make_shared<Cylinder>();
CylSurMap[32] = boost::make_shared<Plane>();
CylSurMap[33] = boost::make_shared<Plane>();
CylSurMap[31]->setSurface(C31);
CylSurMap[32]->setSurface(C32);
......
......@@ -15,6 +15,8 @@
#include "MantidGeometry/Surfaces/Cylinder.h"
#include "MantidGeometry/Surfaces/Cone.h"
#include "boost/make_shared.hpp"
using namespace Mantid;
using namespace Geometry;
using Mantid::Kernel::V3D;
......@@ -42,16 +44,16 @@ public:
void testTwoRuleConstructor() { // Creating a half sphere
SurfPoint *S1, *S2;
auto P1 = std::unique_ptr<Surface>(new Plane);
auto Sp1 = std::unique_ptr<Surface>(new Sphere);
auto P1 = boost::make_shared<Plane>();
auto Sp1 = boost::make_shared<Sphere>();
P1->setSurface("px 5"); // yz plane with x=5
Sp1->setSurface("s 5.0 0.0 0.0 5"); // a sphere with center (5,0,0) and
// radius 5. this will touch origin
S1 = new SurfPoint();
S2 = new SurfPoint();
S1->setKey(std::move(P1));
S1->setKey(P1);
S1->setKeyN(10);
S2->setKey(std::move(Sp1));
S2->setKey(Sp1);
S2->setKeyN(-11);
Intersection A(S1, S2);
TS_ASSERT_EQUALS(A.leaf(0), S2);
......@@ -61,16 +63,17 @@ public:
void testThreeRuleConstructor() {
SurfPoint *S1, *S2;
auto P1 = std::unique_ptr<Surface>(new Plane);
auto Sp1 = std::unique_ptr<Surface>(new Sphere);
auto P1 = boost::make_shared<Plane>();
auto Sp1 = boost::make_shared<Sphere>();
P1->setSurface("px 5"); // yz plane with x=5
Sp1->setSurface("s 5.0 0.0 0.0 5"); // a sphere with center (5,0,0) and
// radius 5. this will touch origin
S1 = new SurfPoint();
S2 = new SurfPoint();
S1->setKey(std::move(P1));
S1->setKey(P1);
S1->setKeyN(10);