Mantid
|
Constructive Solid Geometry object. More...
#include <CSGObject.h>
Public Member Functions | |
int | addSurfString (const std::string &) |
Not implemented. More... | |
Mantid::Geometry::TrackDirection | calcValidType (const Kernel::V3D &Pt, const Kernel::V3D &uVec) const |
Calculate if a point PT is a valid point on the track. More... | |
Mantid::Geometry::TrackDirection | calcValidTypeBy3Points (const Kernel::V3D &prePt, const Kernel::V3D &curPt, const Kernel::V3D &nxtPt) const |
Check if an intercept is guiding the ray into the shape or leaving the shape. More... | |
std::string | cellCompStr () const |
Write the object to a string. More... | |
std::string | cellStr (const std::map< int, CSGObject > &) const |
Returns just the cell string object. More... | |
IObject * | clone () const override |
Clone. More... | |
IObject * | cloneWithMaterial (const Kernel::Material &material) const override |
int | complementaryObject (const int cellNum, std::string &lineStr) |
Process a complementary object. More... | |
void | convertComplement (const std::map< int, CSGObject > &) |
Returns just the cell string object. More... | |
int | createSurfaceList (const int outFlag=0) |
create Surface list More... | |
CSGObject () | |
Default constructor. More... | |
CSGObject (const CSGObject &) | |
Copy constructor. More... | |
CSGObject (std::string shapeXML) | |
Constructor providing shape xml. More... | |
void | defineBoundingBox (const double &xMax, const double &yMax, const double &zMax, const double &xMin, const double &yMin, const double &zMin) |
Define axis-aligned bounding box. More... | |
double | distance (const Track &track) const override |
Compute the distance to the first point of intersection with the surface. More... | |
void | draw () const override |
Draws the Object using geometry handler, If the handler is not set then this function does nothing. More... | |
boost::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &activeRegion, const size_t) const override |
Generate a random point within the object that is also bound by the activeRegion box. More... | |
boost::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const size_t) const override |
Select a random point within the object. More... | |
const BoundingBox & | getBoundingBox () const override |
Return cached value of axis-aligned bounding box. More... | |
void | getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const override |
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED) More... | |
std::shared_ptr< GeometryHandler > | getGeometryHandler () const override |
Returns the geometry handler. More... | |
int | getName () const override |
Get Name. More... | |
void | GetObjectGeom (detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const override |
get info on standard shapes More... | |
int | getPointInObject (Kernel::V3D &point) const override |
Try to find a point that lies within (or on) the object. More... | |
std::string | getShapeXML () const |
Getter for the shape xml. More... | |
std::vector< int > | getSurfaceIndex () const |
Returns all of the numbers of surfaces. More... | |
std::vector< const Surface * > & | getSurfacePtr () |
Get the list of surfaces. More... | |
const std::vector< const Surface * > & | getSurfacePtr () const |
Get the list of surfaces (const version) More... | |
int | hasComplement () const |
Determine if the object has a complementary object. More... | |
bool | hasValidShape () const override |
Return whether this object has a valid shape. More... | |
const std::string & | id () const override |
void | initDraw () const override |
Initializes/prepares the object to be rendered, this will generate geometry for object, If the handler is not set then this function does nothing. More... | |
int | interceptSurface (Geometry::Track &track) const override |
Given a track, fill the track with valid section. More... | |
bool | isFiniteGeometry () const override |
bool | isOnSide (const Kernel::V3D &) const override |
bool | isValid (const Kernel::V3D &) const override |
Check if a point is valid. More... | |
bool | isValid (const std::map< int, int > &) const |
Check if a set of surfaces are valid. More... | |
void | makeComplement () |
Takes the complement of a group. More... | |
const Kernel::Material & | material () const override |
CSGObject & | operator= (const CSGObject &) |
Assignment operator. More... | |
int | populate (const std::map< int, std::shared_ptr< Surface > > &) |
Goes through the cell objects and adds the pointers to the SurfPoint keys (using their keyN) More... | |
virtual void | print () const |
Prints almost everything. More... | |
void | printTree () const |
Displays the rule tree. More... | |
int | procString (const std::string &lineStr) |
Processes the cell string. More... | |
double | rayTraceSolidAngle (const Kernel::V3D &observer) const |
Given an observer position find the approximate solid angle of the object. More... | |
int | removeSurface (const int surfNum) |
Removes a surface and then re-builds the cell. More... | |
void | setFiniteGeometryFlag (bool isFinite) override |
void | setGeometryHandler (const std::shared_ptr< GeometryHandler > &h) |
Set Geometry Handler. More... | |
void | setID (const std::string &id) override |
void | setMaterial (const Kernel::Material &material) override |
void | setName (const int objNum) |
Set Name. More... | |
void | setNullBoundingBox () |
Set a null bounding box for this object. More... | |
int | setObject (const int objName, const std::string &lineStr) |
Object line == cell. More... | |
void | setVtkGeometryCacheReader (std::shared_ptr< vtkGeometryCacheReader >) |
set vtkGeometryCache reader More... | |
void | setVtkGeometryCacheWriter (std::shared_ptr< vtkGeometryCacheWriter >) |
set vtkGeometryCache writer More... | |
detail::ShapeInfo::GeometryShape | shape () const override |
const detail::ShapeInfo & | shapeInfo () const override |
double | solidAngle (const Kernel::V3D &observer) const override |
Find solid angle of object wrt the observer. More... | |
double | solidAngle (const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const override |
Find solid angle of object wrt the observer with a scaleFactor for the object. More... | |
std::string | str () const |
Write the object to a string. More... | |
int | substituteSurf (const int surfNum, const int newSurfNum, const std::shared_ptr< Surface > &surfPtr) |
Removes a surface and then re-builds the cell. More... | |
const Rule * | topRule () const |
Return the top rule. More... | |
double | triangulatedSolidAngle (const Kernel::V3D &observer) const |
Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists. More... | |
double | triangulatedSolidAngle (const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const |
Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists. More... | |
double | volume () const override |
Calculates the volume of this object. More... | |
void | write (std::ostream &) const |
MCNPX output. More... | |
~CSGObject () override | |
Destructor. More... | |
Public Member Functions inherited from Mantid::Geometry::IObject | |
virtual IObject * | clone () const =0 |
virtual IObject * | cloneWithMaterial (const Kernel::Material &material) const =0 |
virtual double | distance (const Geometry::Track &) const =0 |
virtual void | draw () const =0 |
virtual boost::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const BoundingBox &activeRegion, const size_t) const =0 |
virtual boost::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const size_t) const =0 |
virtual const BoundingBox & | getBoundingBox () const =0 |
Return cached value of axis-aligned bounding box. More... | |
virtual void | getBoundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const =0 |
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED) More... | |
virtual std::shared_ptr< GeometryHandler > | getGeometryHandler () const =0 |
virtual int | getName () const =0 |
virtual void | GetObjectGeom (detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const =0 |
virtual int | getPointInObject (Kernel::V3D &point) const =0 |
virtual bool | hasValidShape () const =0 |
virtual const std::string & | id () const =0 |
virtual void | initDraw () const =0 |
virtual int | interceptSurface (Geometry::Track &) const =0 |
virtual bool | isFiniteGeometry () const |
virtual bool | isOnSide (const Kernel::V3D &) const =0 |
virtual bool | isValid (const Kernel::V3D &) const =0 |
virtual const Kernel::Material & | material () const =0 |
virtual void | setFiniteGeometryFlag (bool) |
virtual void | setID (const std::string &id)=0 |
virtual void | setMaterial (const Kernel::Material &material)=0 |
virtual detail::ShapeInfo::GeometryShape | shape () const =0 |
virtual const detail::ShapeInfo & | shapeInfo () const =0 |
virtual double | solidAngle (const Kernel::V3D &observer) const =0 |
virtual double | solidAngle (const Kernel::V3D &observer, const Kernel::V3D &scaleFactor) const =0 |
virtual double | volume () const =0 |
virtual | ~IObject ()=default |
Protected Attributes | |
std::vector< const Surface * > | m_surList |
Full surfaces (make a map. More... | |
Private Member Functions | |
void | calcBoundingBoxByGeometry () |
Calculate bounding box using object's geometric data. More... | |
void | calcBoundingBoxByRule () |
Calculate bounding box using Rule system. More... | |
void | calcBoundingBoxByVertices () |
Calculate bounding box using object's vertices. More... | |
int | checkSurfaceValid (const Kernel::V3D &, const Kernel::V3D &) const |
Determine if a point is valid by checking both directions of the normal away from the line A good point will have one valid and one invalid. More... | |
const std::vector< uint32_t > & | getTriangleFaces () const |
for solid angle from triangulation More... | |
const std::vector< double > & | getTriangleVertices () const |
get vertices More... | |
double | monteCarloVolume () const |
Returns the volume. More... | |
size_t | numberOfTriangles () const |
size_t | numberOfVertices () const |
std::unique_ptr< CompGrp > | procComp (std::unique_ptr< Rule >) const |
Takes a Rule item and makes it a complementary group. More... | |
int | procPair (std::string &lineStr, std::map< int, std::unique_ptr< Rule > > &ruleMap, int &compUnit) const |
This takes a string lineStr, finds the first two Rxxx function, determines their join type make the rule, adds to vector then removes two old rules from the vector, updates string. More... | |
int | searchForObject (Kernel::V3D &) const |
Try to find a point that lies within (or on) the object, given a seed point. More... | |
double | singleShotMonteCarloVolume (const int shotSize, const size_t seed) const |
Returns the volume. More... | |
void | updateGeometryHandler () |
Updates the geometry handler if needed. More... | |
Private Attributes | |
double | AABBxMax |
xmax of Axis aligned bounding box cache More... | |
double | AABBxMin |
xmin of Axis aligned bounding box cache More... | |
double | AABByMax |
ymax of Axis aligned bounding box cache More... | |
double | AABByMin |
xmin of Axis aligned bounding box cache More... | |
double | AABBzMax |
zmax of Axis aligned bounding box cache More... | |
double | AABBzMin |
zmin of Axis Aligned Bounding Box Cache More... | |
bool | bGeometryCaching |
Is geometry caching enabled? More... | |
bool | boolBounded |
flag true if a bounding box exists, either by More... | |
BoundingBox | m_boundingBox |
Object's bounding box. More... | |
std::shared_ptr< GeometryHandler > | m_handler |
Geometry Handle for rendering. More... | |
std::string | m_id |
Optional string identifier. More... | |
bool | m_isFiniteGeometry = true |
Whether or not the object geometry is finite. More... | |
std::unique_ptr< Kernel::Material > | m_material |
material composition More... | |
int | m_objNum |
Creation number. More... | |
std::string | m_shapeXML |
original shape xml used to generate this object. More... | |
std::unique_ptr< Rule > | m_topRule |
Top rule [ Geometric scope of object]. More... | |
std::shared_ptr< vtkGeometryCacheReader > | vtkCacheReader |
a pointer to a class for reading from the geometry cache More... | |
std::shared_ptr< vtkGeometryCacheWriter > | vtkCacheWriter |
a pointer to a class for writing to the geometry cache More... | |
Friends | |
class | GeometryHandler |
class | GeometryRenderer |
Constructive Solid Geometry object.
A Constructive Solid Geometry (CSG) object, implemented as a collection of Rules and surface objects
Definition at line 51 of file CSGObject.h.
Mantid::Geometry::CSGObject::CSGObject | ( | ) |
Default constructor.
Definition at line 388 of file CSGObject.cpp.
Mantid::Geometry::CSGObject::CSGObject | ( | std::string | shapeXML | ) |
Constructor providing shape xml.
Construct with original shape xml knowledge.
shapeXML | : string with original shape xml. |
Definition at line 394 of file CSGObject.cpp.
Mantid::Geometry::CSGObject::CSGObject | ( | const CSGObject & | A | ) |
Copy constructor.
A | :: The object to initialise this copy from |
Definition at line 405 of file CSGObject.cpp.
|
overridedefault |
Destructor.
Destructor in .cpp so we can forward declare Rule class.
int Mantid::Geometry::CSGObject::addSurfString | ( | const std::string & | ) |
Not implemented.
|
private |
Calculate bounding box using object's geometric data.
Attempts to calculate bounding box using object geometry.
Stores result in bounding box cache if successful. Will only work for basic shapes that are handled by GluGeometryHandler.
Definition at line 1769 of file CSGObject.cpp.
References Mantid::Geometry::detail::ShapeInfo::CONE, Mantid::Geometry::detail::ShapeInfo::CUBOID, Mantid::Geometry::detail::ShapeInfo::CYLINDER, defineBoundingBox(), height, Mantid::Geometry::detail::ShapeInfo::HEXAHEDRON, innerRadius, m_handler, radius, top, Mantid::Kernel::V3D::X(), Mantid::Kernel::V3D::Y(), and Mantid::Kernel::V3D::Z().
Referenced by getBoundingBox().
|
private |
Calculate bounding box using Rule system.
Attempts to calculate bounding box using Rule system.
Stores result in bounding box cache if successful. Will only work for shapes that consist entirely of axis-aligned surfaces and a few special cases (such as Spheres).
Definition at line 1701 of file CSGObject.cpp.
References defineBoundingBox(), and m_topRule.
Referenced by getBoundingBox().
|
private |
Calculate bounding box using object's vertices.
Attempts to calculate bounding box using vertex array.
Stores result in bounding box cache if successful. Will only work for shapes that have handlers capable of providing a vertex mesh.
Definition at line 1732 of file CSGObject.cpp.
References defineBoundingBox(), getTriangleVertices(), and numberOfVertices().
Referenced by getBoundingBox().
TrackDirection Mantid::Geometry::CSGObject::calcValidType | ( | const Kernel::V3D & | point, |
const Kernel::V3D & | uVec | ||
) | const |
Calculate if a point PT is a valid point on the track.
point | :: Point to calculate from. |
uVec | :: Unit vector of the track |
0 | :: Not valid / double valid |
1 | :: Entry point |
-1 | :: Exit Point |
Definition at line 1155 of file CSGObject.cpp.
References Mantid::Geometry::ENTERING, Mantid::Geometry::INVALID, isValid(), and Mantid::Geometry::LEAVING.
TrackDirection Mantid::Geometry::CSGObject::calcValidTypeBy3Points | ( | const Kernel::V3D & | prePt, |
const Kernel::V3D & | curPt, | ||
const Kernel::V3D & | nxtPt | ||
) | const |
Check if an intercept is guiding the ray into the shape or leaving the shape.
prePt | :: the previous point on the Line |
curPt | :: the current point on the Line |
nxtPt | :: Unit vector of the track |
1 | :: Entry point |
-1 | :: Exit Point |
0 | :: Not valid / double valid |
Definition at line 1176 of file CSGObject.cpp.
References Mantid::Geometry::ENTERING, Mantid::Geometry::INVALID, isValid(), and Mantid::Geometry::LEAVING.
Referenced by interceptSurface().
std::string Mantid::Geometry::CSGObject::cellCompStr | ( | ) | const |
Write the object to a string.
This includes only rules.
Definition at line 955 of file CSGObject.cpp.
References m_topRule.
std::string Mantid::Geometry::CSGObject::cellStr | ( | const std::map< int, CSGObject > & | MList | ) | const |
Returns just the cell string object.
MList | :: List of indexable Hulls |
Definition at line 502 of file CSGObject.cpp.
References Mantid::Kernel::Strings::convPartNum(), Mantid::Geometry::Rule::display(), and topRule().
Referenced by convertComplement().
|
private |
Determine if a point is valid by checking both directions of the normal away from the line A good point will have one valid and one invalid.
point | :: Point on a basic surface to check |
direction | :: Direction +/- to be checked |
+1 | :: Point outlayer (ie not in object) |
-1 | :: Point included (e.g at convex intersection) |
0 | :: success |
Definition at line 770 of file CSGObject.cpp.
References isValid(), tmp, and Mantid::Kernel::Tolerance.
Referenced by isOnSide().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
int Mantid::Geometry::CSGObject::complementaryObject | ( | const int | cellNum, |
std::string & | lineStr | ||
) |
Process a complementary object.
Definition at line 538 of file CSGObject.cpp.
References m_objNum, m_surList, and procString().
void Mantid::Geometry::CSGObject::convertComplement | ( | const std::map< int, CSGObject > & | MList | ) |
Returns just the cell string object.
MList | :: List of indexable Hulls |
Definition at line 490 of file CSGObject.cpp.
References cellStr(), and procString().
int Mantid::Geometry::CSGObject::createSurfaceList | ( | const int | outFlag = 0 | ) |
create Surface list
Uses the topRule* to create a surface list by iterating throught the tree.
outFlag | :: Sends output to standard error if true |
Definition at line 807 of file CSGObject.cpp.
References Mantid::Geometry::Rule::leaf(), m_surList, and m_topRule.
Referenced by operator=(), populate(), removeSurface(), and substituteSurf().
void Mantid::Geometry::CSGObject::defineBoundingBox | ( | const double & | xMax, |
const double & | yMax, | ||
const double & | zMax, | ||
const double & | xMin, | ||
const double & | yMin, | ||
const double & | zMin | ||
) |
Define axis-aligned bounding box.
Takes input axis aligned bounding box max and min points and stores these as the bounding box for the object.
Can be used when getBoundingBox fails and bounds are known.
xMax | :: Maximum value for the bounding box in x direction |
yMax | :: Maximum value for the bounding box in y direction |
zMax | :: Maximum value for the bounding box in z direction |
xMin | :: Minimum value for the bounding box in x direction |
yMin | :: Minimum value for the bounding box in y direction |
zMin | :: Minimum value for the bounding box in z direction |
Definition at line 1942 of file CSGObject.cpp.
References AABBxMax, AABBxMin, AABByMax, AABByMin, AABBzMax, AABBzMin, boolBounded, Mantid::Geometry::BoundingBox::checkValid(), defineBoundingBox(), m_boundingBox, and PARALLEL_CRITICAL.
Referenced by calcBoundingBoxByGeometry(), calcBoundingBoxByRule(), calcBoundingBoxByVertices(), defineBoundingBox(), and getBoundingBox().
|
overridevirtual |
Compute the distance to the first point of intersection with the surface.
track | Track defining start/direction |
std::runtime_error | if no intersection was found |
Implements Mantid::Geometry::IObject.
Definition at line 1130 of file CSGObject.cpp.
References Mantid::Geometry::Track::direction(), Mantid::Geometry::LineIntersectVisit::getDistance(), m_surList, Mantid::Geometry::LineIntersectVisit::sortAndRemoveDuplicates(), and Mantid::Geometry::Track::startPoint().
|
overridevirtual |
Draws the Object using geometry handler, If the handler is not set then this function does nothing.
Implements Mantid::Geometry::IObject.
Definition at line 2127 of file CSGObject.cpp.
References m_handler.
|
overridevirtual |
Generate a random point within the object that is also bound by the activeRegion box.
rng | A reference to a PseudoRandomNumberGenerator where nextValue should return a flat random number between 0.0 & 1.0 |
activeRegion | Restrict point generation to this sub-region of the object |
maxAttempts | The maximum number of attempts at generating a point |
Implements Mantid::Geometry::IObject.
Definition at line 2047 of file CSGObject.cpp.
References Mantid::Geometry::RandomPoint::bounded(), Mantid::Geometry::detail::ShapeInfo::CUBOID, Mantid::Geometry::detail::ShapeInfo::CYLINDER, GetObjectGeom(), height, Mantid::Geometry::detail::ShapeInfo::HOLLOWCYLINDER, innerRadius, m_handler, radius, shape(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
|
overridevirtual |
Select a random point within the object.
Generate a random point within the object.
For certain simple shapes, the point is generated directly inside the shape. In the general case, the method simply generates a point within the bounding box and tests if this is a valid point within the object: if so the point is returned otherwise a new point is selected.
rng | A reference to a PseudoRandomNumberGenerator where nextValue should return a flat random number between 0.0 & 1.0 |
maxAttempts | The maximum number of attempts at generating a point |
Implements Mantid::Geometry::IObject.
Definition at line 2001 of file CSGObject.cpp.
References Mantid::Geometry::detail::ShapeInfo::CUBOID, Mantid::Geometry::detail::ShapeInfo::CYLINDER, Mantid::Geometry::detail::ShapeInfo::HOLLOWCYLINDER, Mantid::Geometry::RandomPoint::inCuboid(), Mantid::Geometry::RandomPoint::inCylinder(), Mantid::Geometry::RandomPoint::inGenericShape(), Mantid::Geometry::RandomPoint::inHollowCylinder(), Mantid::Geometry::RandomPoint::inSphere(), m_handler, shape(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
|
overridevirtual |
Return cached value of axis-aligned bounding box.
Returns an axis-aligned bounding box that will fit the shape.
Implements Mantid::Geometry::IObject.
Definition at line 1654 of file CSGObject.cpp.
References calcBoundingBoxByGeometry(), calcBoundingBoxByRule(), calcBoundingBoxByVertices(), defineBoundingBox(), Mantid::Geometry::BoundingBox::isNonNull(), m_boundingBox, m_topRule, and setNullBoundingBox().
Referenced by export_Object(), getPointInObject(), rayTraceSolidAngle(), singleShotMonteCarloVolume(), and triangulatedSolidAngle().
|
overridevirtual |
Calculate (or return cached value of) Axis Aligned Bounding box (DEPRECATED)
Takes input axis aligned bounding box max and min points and calculates the bounding box for the object and returns them back in max and min points.
xmax | :: Maximum value for the bounding box in x direction |
ymax | :: Maximum value for the bounding box in y direction |
zmax | :: Maximum value for the bounding box in z direction |
xmin | :: Minimum value for the bounding box in x direction |
ymin | :: Minimum value for the bounding box in y direction |
zmin | :: Minimum value for the bounding box in z direction |
Implements Mantid::Geometry::IObject.
Definition at line 1900 of file CSGObject.cpp.
References AABBxMax, AABBxMin, AABByMax, AABByMin, AABBzMax, AABBzMin, boolBounded, and m_topRule.
Referenced by Mantid::Geometry::CompObj::getBoundingBox().
|
overridevirtual |
Returns the geometry handler.
Implements Mantid::Geometry::IObject.
Definition at line 2164 of file CSGObject.cpp.
References m_handler.
|
inlineoverridevirtual |
|
overridevirtual |
get info on standard shapes
Implements Mantid::Geometry::IObject.
Definition at line 2243 of file CSGObject.cpp.
References height, innerRadius, m_handler, Mantid::Geometry::detail::ShapeInfo::NOSHAPE, and radius.
Referenced by generatePointInObject(), triangulatedSolidAngle(), and volume().
|
overridevirtual |
Try to find a point that lies within (or on) the object.
[out] | point | :: on exit set to the point value, if found |
Implements Mantid::Geometry::IObject.
Definition at line 1967 of file CSGObject.cpp.
References Mantid::Geometry::BoundingBox::centrePoint(), getBoundingBox(), Mantid::Geometry::BoundingBox::isNonNull(), and searchForObject().
Referenced by rayTraceSolidAngle().
std::string Mantid::Geometry::CSGObject::getShapeXML | ( | ) | const |
Getter for the shape xml.
Definition at line 2254 of file CSGObject.cpp.
References m_shapeXML.
Referenced by export_Object().
std::vector< int > Mantid::Geometry::CSGObject::getSurfaceIndex | ( | ) | const |
Returns all of the numbers of surfaces.
Definition at line 856 of file CSGObject.cpp.
References Mantid::Geometry::Surface::getName(), and m_surList.
|
inline |
Get the list of surfaces.
Definition at line 116 of file CSGObject.h.
|
inline |
Get the list of surfaces (const version)
Definition at line 114 of file CSGObject.h.
|
private |
for solid angle from triangulation
get faces
Definition at line 2217 of file CSGObject.cpp.
References m_handler.
Referenced by triangulatedSolidAngle().
|
private |
get vertices
Definition at line 2207 of file CSGObject.cpp.
References m_handler.
Referenced by calcBoundingBoxByVertices(), and triangulatedSolidAngle().
int Mantid::Geometry::CSGObject::hasComplement | ( | ) | const |
Determine if the object has a complementary object.
1 | :: true |
0 | :: false |
Definition at line 581 of file CSGObject.cpp.
References m_topRule.
|
overridevirtual |
Return whether this object has a valid shape.
Returns whether this object has a valid shape.
Implements Mantid::Geometry::IObject.
Definition at line 455 of file CSGObject.cpp.
|
inlineoverridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 78 of file CSGObject.h.
|
overridevirtual |
Initializes/prepares the object to be rendered, this will generate geometry for object, If the handler is not set then this function does nothing.
Implements Mantid::Geometry::IObject.
Definition at line 2139 of file CSGObject.cpp.
References m_handler.
|
overridevirtual |
Given a track, fill the track with valid section.
track | :: Initial track |
Implements Mantid::Geometry::IObject.
Definition at line 1076 of file CSGObject.cpp.
References Mantid::Geometry::Track::addPoint(), Mantid::Geometry::Track::buildLink(), calcValidTypeBy3Points(), Mantid::Geometry::Track::count(), Mantid::Geometry::Track::direction(), Mantid::Geometry::LineIntersectVisit::getDistance(), Mantid::Geometry::LineIntersectVisit::getPoints(), Mantid::Geometry::INVALID, m_surList, Mantid::Geometry::LineIntersectVisit::sortAndRemoveDuplicates(), and Mantid::Geometry::Track::startPoint().
Referenced by rayTraceSolidAngle(), and searchForObject().
|
inlineoverridevirtual |
Reimplemented from Mantid::Geometry::IObject.
Definition at line 72 of file CSGObject.h.
|
overridevirtual |
(d) Return 1 / 0 depending on test (c)
point | :: Point to check |
Implements Mantid::Geometry::IObject.
Definition at line 732 of file CSGObject.cpp.
References checkSurfaceValid(), m_surList, and Mantid::Kernel::V3D::normalize().
Referenced by rayTraceSolidAngle(), and triangulatedSolidAngle().
|
overridevirtual |
Check if a point is valid.
Determines is point is within the object or on the surface.
point | :: Point to be tested |
Implements Mantid::Geometry::IObject.
Definition at line 784 of file CSGObject.cpp.
References m_topRule.
Referenced by calcValidType(), calcValidTypeBy3Points(), checkSurfaceValid(), rayTraceSolidAngle(), searchForObject(), singleShotMonteCarloVolume(), and triangulatedSolidAngle().
bool Mantid::Geometry::CSGObject::isValid | ( | const std::map< int, int > & | SMap | ) | const |
Check if a set of surfaces are valid.
Determines is group of surface maps are valid.
SMap | :: map of SurfaceNumber : status |
Definition at line 795 of file CSGObject.cpp.
References m_topRule.
void Mantid::Geometry::CSGObject::makeComplement | ( | ) |
Takes the complement of a group.
Definition at line 937 of file CSGObject.cpp.
References m_topRule, and procComp().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 448 of file CSGObject.cpp.
References m_material.
Referenced by operator=(), and setMaterial().
|
private |
Returns the volume.
Calculates the volume of this object by the Monte Carlo method.
This method manages singleShotMonteCarloVolume() and uses the standard error as the convergence criteria.
Definition at line 1568 of file CSGObject.cpp.
References singleShotMonteCarloVolume(), and volume().
Referenced by volume().
|
private |
Definition at line 2194 of file CSGObject.cpp.
References m_handler.
Referenced by solidAngle(), and triangulatedSolidAngle().
|
private |
Definition at line 2199 of file CSGObject.cpp.
References m_handler.
Referenced by calcBoundingBoxByVertices().
Assignment operator.
A | :: Object to copy |
Definition at line 412 of file CSGObject.cpp.
References AABBxMax, AABBxMin, AABByMax, AABByMin, AABBzMax, AABBzMin, bGeometryCaching, boolBounded, createSurfaceList(), m_handler, m_id, m_material, m_objNum, m_shapeXML, m_topRule, material(), vtkCacheReader, and vtkCacheWriter.
int Mantid::Geometry::CSGObject::populate | ( | const std::map< int, std::shared_ptr< Surface > > & | surfMap | ) |
Goes through the cell objects and adds the pointers to the SurfPoint keys (using their keyN)
surfMap | :: Map of surface Keys and Surface Pointers |
1000+ | keyNumber :: Error with keyNumber |
0 | :: successfully populated all the whole Object. |
Definition at line 595 of file CSGObject.cpp.
References createSurfaceList(), Mantid::Geometry::Rule::leaf(), m_topRule, and Mantid::Geometry::SurfPoint::setKey().
|
virtual |
Prints almost everything.
Definition at line 898 of file CSGObject.cpp.
References Mantid::Geometry::Rule::leaf(), m_objNum, and m_topRule.
void Mantid::Geometry::CSGObject::printTree | ( | ) | const |
Displays the rule tree.
Definition at line 945 of file CSGObject.cpp.
|
private |
Takes a Rule item and makes it a complementary group.
ruleItem | :: to encapsulate |
Definition at line 698 of file CSGObject.cpp.
References Mantid::Geometry::Rule::findLeaf(), Mantid::Geometry::Rule::getParent(), and Mantid::Geometry::Rule::setLeaf().
Referenced by makeComplement(), and procString().
|
private |
This takes a string lineStr, finds the first two Rxxx function, determines their join type make the rule, adds to vector then removes two old rules from the vector, updates string.
lineStr | :: String to process |
ruleMap | :: Map of rules (added to) |
compUnit | :: Last computed unit |
0 | :: No rule to find |
1 | :: A rule has been combined |
Definition at line 639 of file CSGObject.cpp.
References Mantid::Kernel::Strings::convert().
Referenced by procString().
int Mantid::Geometry::CSGObject::procString | ( | const std::string & | lineStr | ) |
Processes the cell string.
This is an internal function to process a string with - String type has #( and ( )
lineStr | :: String value |
Definition at line 994 of file CSGObject.cpp.
References Mantid::Kernel::Strings::convPartNum(), m_topRule, procComp(), procPair(), and std::to_string().
Referenced by complementaryObject(), convertComplement(), and setObject().
double Mantid::Geometry::CSGObject::rayTraceSolidAngle | ( | const Kernel::V3D & | observer | ) | const |
Given an observer position find the approximate solid angle of the object.
observer | :: position of the observer (V3D) |
Definition at line 1239 of file CSGObject.cpp.
References Mantid::Geometry::BoundingBox::angularWidth(), Mantid::Geometry::BoundingBox::centrePoint(), count, Mantid::Kernel::V3D::cross_prod(), Mantid::Geometry::BoundingBox::doesLineIntersect(), getBoundingBox(), getPointInObject(), interceptSurface(), Mantid::Geometry::BoundingBox::isNonNull(), isOnSide(), Mantid::Geometry::BoundingBox::isPointInside(), isValid(), Mantid::Kernel::V3D::norm(), Mantid::Kernel::V3D::nullVector(), Mantid::Kernel::Quat::rotate(), and Mantid::Kernel::V3D::Z().
Referenced by solidAngle(), and triangulatedSolidAngle().
int Mantid::Geometry::CSGObject::removeSurface | ( | const int | surfNum | ) |
Removes a surface and then re-builds the cell.
This could be done by just removing the surface from the object.
surfNum | :: Number for the surface |
Definition at line 870 of file CSGObject.cpp.
References createSurfaceList(), m_topRule, and Mantid::Geometry::Rule::removeItem().
|
private |
Try to find a point that lies within (or on) the object, given a seed point.
point | :: on entry the seed point, on exit point in object, if found |
Definition at line 2096 of file CSGObject.cpp.
References Mantid::Geometry::Track::cbegin(), interceptSurface(), and isValid().
Referenced by getPointInObject().
|
inlineoverridevirtual |
Reimplemented from Mantid::Geometry::IObject.
Definition at line 73 of file CSGObject.h.
void Mantid::Geometry::CSGObject::setGeometryHandler | ( | const std::shared_ptr< GeometryHandler > & | h | ) |
Set Geometry Handler.
Set the geometry handler for Object.
[in] | h | is pointer to the geometry handler. |
Definition at line 2118 of file CSGObject.cpp.
References m_handler.
|
inlineoverridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 77 of file CSGObject.h.
|
overridevirtual |
material | The new Material that the object is composed from |
Implements Mantid::Geometry::IObject.
Definition at line 443 of file CSGObject.cpp.
References m_material, and material().
|
inline |
Set Name.
Definition at line 80 of file CSGObject.h.
void Mantid::Geometry::CSGObject::setNullBoundingBox | ( | ) |
Set a null bounding box for this object.
Set the bounding box to a null box.
Definition at line 1960 of file CSGObject.cpp.
References m_boundingBox.
Referenced by getBoundingBox().
int Mantid::Geometry::CSGObject::setObject | ( | const int | objName, |
const std::string & | lineStr | ||
) |
Object line == cell.
objName | :: Object name |
lineStr | :: Input string must be : {rules} |
Definition at line 466 of file CSGObject.cpp.
References m_objNum, m_surList, procString(), and Mantid::Kernel::Strings::StrLook().
void Mantid::Geometry::CSGObject::setVtkGeometryCacheReader | ( | std::shared_ptr< vtkGeometryCacheReader > | reader | ) |
set vtkGeometryCache reader
Definition at line 2156 of file CSGObject.cpp.
References updateGeometryHandler(), and vtkCacheReader.
void Mantid::Geometry::CSGObject::setVtkGeometryCacheWriter | ( | std::shared_ptr< vtkGeometryCacheWriter > | writer | ) |
set vtkGeometryCache writer
Definition at line 2148 of file CSGObject.cpp.
References updateGeometryHandler(), and vtkCacheWriter.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 2224 of file CSGObject.cpp.
References m_handler, and Mantid::Geometry::detail::ShapeInfo::NOSHAPE.
Referenced by generatePointInObject().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 2232 of file CSGObject.cpp.
References m_handler.
Referenced by Mantid::Algorithms::CylinderAbsorption::getShapeFromSample().
|
private |
Returns the volume.
Calculates the volume using the Monte Carlo method.
shotSize | Number of iterations. |
seed | A number to seed the random number generator. |
Definition at line 1602 of file CSGObject.cpp.
References getBoundingBox(), isValid(), PARALLEL, PARALLEL_ATOMIC, PARALLEL_NUMBER_OF_THREADS, PARALLEL_THREAD_NUMBER, Mantid::Geometry::x, Mantid::Geometry::y, and Mantid::Geometry::z.
Referenced by monteCarloVolume().
|
overridevirtual |
Find solid angle of object wrt the observer.
This interface routine calls either getTriangleSolidAngle or getRayTraceSolidAngle. Choice made on number of triangles in the discrete surface representation.
observer | :: point to measure solid angle from |
Implements Mantid::Geometry::IObject.
Definition at line 1216 of file CSGObject.cpp.
References numberOfTriangles(), rayTraceSolidAngle(), and triangulatedSolidAngle().
|
overridevirtual |
Find solid angle of object wrt the observer with a scaleFactor for the object.
observer | :: point to measure solid angle from |
scaleFactor | :: V3D giving scaling of the object |
Implements Mantid::Geometry::IObject.
Definition at line 1230 of file CSGObject.cpp.
References triangulatedSolidAngle().
std::string Mantid::Geometry::CSGObject::str | ( | ) | const |
int Mantid::Geometry::CSGObject::substituteSurf | ( | const int | surfNum, |
const int | newSurfNum, | ||
const std::shared_ptr< Surface > & | surfPtr | ||
) |
Removes a surface and then re-builds the cell.
surfNum | :: Number for the surface |
newSurfNum | :: New surface number |
surfPtr | :: Surface pointer for surface NsurfN |
Definition at line 886 of file CSGObject.cpp.
References createSurfaceList(), and m_topRule.
|
inline |
double Mantid::Geometry::CSGObject::triangulatedSolidAngle | ( | const Kernel::V3D & | observer | ) | const |
Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists.
observer | :: Point from which solid angle is required |
Definition at line 1357 of file CSGObject.cpp.
References Mantid::Geometry::detail::ShapeInfo::CONE, Mantid::Geometry::detail::ShapeInfo::CUBOID, Mantid::Geometry::detail::ShapeInfo::CYLINDER, getBoundingBox(), GetObjectGeom(), getTriangleFaces(), getTriangleVertices(), height, innerRadius, Mantid::Geometry::BoundingBox::isNonNull(), isOnSide(), Mantid::Geometry::BoundingBox::isPointInside(), isValid(), numberOfTriangles(), radius, rayTraceSolidAngle(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
Referenced by solidAngle().
double Mantid::Geometry::CSGObject::triangulatedSolidAngle | ( | const Kernel::V3D & | observer, |
const Kernel::V3D & | scaleFactor | ||
) | const |
Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists.
This method expects a scaling vector scaleFactor that scales the three axes.
observer | :: Point from which solid angle is required. |
scaleFactor | :: V3D each component giving the scaling of the object only (not observer) |
Definition at line 1441 of file CSGObject.cpp.
References Mantid::Geometry::detail::ShapeInfo::CUBOID, getBoundingBox(), GetObjectGeom(), getTriangleFaces(), getTriangleVertices(), height, innerRadius, Mantid::Geometry::BoundingBox::isNonNull(), isOnSide(), Mantid::Geometry::BoundingBox::isPointInside(), isValid(), numberOfTriangles(), radius, rayTraceSolidAngle(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
|
private |
Updates the geometry handler if needed.
Definition at line 2173 of file CSGObject.cpp.
References bGeometryCaching, m_handler, vtkCacheReader, and vtkCacheWriter.
Referenced by Mantid::Geometry::GeometryHandler::initialize(), setVtkGeometryCacheReader(), and setVtkGeometryCacheWriter().
|
overridevirtual |
Calculates the volume of this object.
For simple shapes, the volume is calculated exactly.
For more complex cases, we fall back to Monte Carlo.
Implements Mantid::Geometry::IObject.
Definition at line 1512 of file CSGObject.cpp.
References Mantid::Kernel::V3D::cross_prod(), Mantid::Geometry::detail::ShapeInfo::CUBOID, Mantid::Geometry::detail::ShapeInfo::CYLINDER, GetObjectGeom(), height, Mantid::Geometry::detail::ShapeInfo::HOLLOWCYLINDER, innerRadius, monteCarloVolume(), radius, Mantid::Kernel::V3D::scalar_prod(), Mantid::Geometry::detail::ShapeInfo::SPHERE, and volume().
Referenced by export_Object(), monteCarloVolume(), and volume().
void Mantid::Geometry::CSGObject::write | ( | std::ostream & | outStream | ) | const |
MCNPX output.
Write the object to a standard stream in standard MCNPX output format.
outStream | :: Output stream (required for multiple std::endl) |
Definition at line 981 of file CSGObject.cpp.
References str(), and Mantid::Kernel::Strings::writeMCNPX().
|
friend |
Definition at line 220 of file CSGObject.h.
|
friend |
Definition at line 221 of file CSGObject.h.
|
mutableprivate |
xmax of Axis aligned bounding box cache
Definition at line 208 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
xmin of Axis aligned bounding box cache
Definition at line 211 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
ymax of Axis aligned bounding box cache
Definition at line 209 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
xmin of Axis aligned bounding box cache
Definition at line 212 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
zmax of Axis aligned bounding box cache
Definition at line 210 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
zmin of Axis Aligned Bounding Box Cache
Definition at line 213 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
Is geometry caching enabled?
Definition at line 223 of file CSGObject.h.
Referenced by operator=(), and updateGeometryHandler().
|
mutableprivate |
flag true if a bounding box exists, either by
Definition at line 214 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
Object's bounding box.
Definition at line 206 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and setNullBoundingBox().
|
private |
Geometry Handle for rendering.
Definition at line 219 of file CSGObject.h.
Referenced by calcBoundingBoxByGeometry(), draw(), generatePointInObject(), getGeometryHandler(), GetObjectGeom(), getTriangleFaces(), getTriangleVertices(), initDraw(), numberOfTriangles(), numberOfVertices(), operator=(), setGeometryHandler(), shape(), shapeInfo(), and updateGeometryHandler().
|
private |
|
private |
Whether or not the object geometry is finite.
Definition at line 241 of file CSGObject.h.
|
mutableprivate |
material composition
Definition at line 239 of file CSGObject.h.
Referenced by material(), operator=(), and setMaterial().
|
private |
Creation number.
Definition at line 217 of file CSGObject.h.
Referenced by complementaryObject(), operator=(), print(), printTree(), setObject(), and str().
|
private |
original shape xml used to generate this object.
Definition at line 235 of file CSGObject.h.
Referenced by getShapeXML(), and operator=().
|
protected |
Full surfaces (make a map.
Definition at line 244 of file CSGObject.h.
Referenced by complementaryObject(), createSurfaceList(), distance(), getSurfaceIndex(), hasValidShape(), interceptSurface(), isOnSide(), and setObject().
|
private |
Top rule [ Geometric scope of object].
Definition at line 204 of file CSGObject.h.
Referenced by calcBoundingBoxByRule(), cellCompStr(), createSurfaceList(), getBoundingBox(), hasComplement(), hasValidShape(), isValid(), makeComplement(), operator=(), populate(), print(), printTree(), procString(), removeSurface(), str(), and substituteSurf().
|
private |
a pointer to a class for reading from the geometry cache
Definition at line 225 of file CSGObject.h.
Referenced by operator=(), setVtkGeometryCacheReader(), and updateGeometryHandler().
|
private |
a pointer to a class for writing to the geometry cache
Definition at line 227 of file CSGObject.h.
Referenced by operator=(), setVtkGeometryCacheWriter(), and updateGeometryHandler().