|
Mantid
|
Constructive Solid Geometry object. More...
#include <CSGObject.h>
Public Member Functions | |
| int | addSurfString (const std::string &) |
| Not implemented. | |
| 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. | |
| 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. | |
| std::string | cellCompStr () const |
| Write the object to a string. | |
| std::string | cellStr (const std::map< int, CSGObject > &) const |
| Returns just the cell string object. | |
| IObject * | clone () const override |
| Clone. | |
| IObject * | cloneWithMaterial (const Kernel::Material &material) const override |
| void | convertComplement (const std::map< int, CSGObject > &) |
| Returns just the cell string object. | |
| int | createSurfaceList (const int outFlag=0) |
| create Surface list | |
| CSGObject () | |
| Default constructor. | |
| CSGObject (const CSGObject &) | |
| Copy constructor. | |
| CSGObject (std::string shapeXML) | |
| Constructor providing shape xml. | |
| 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. | |
| double | distance (const Track &track) const override |
| Compute the distance to the first point of intersection with the surface. | |
| void | draw () const override |
| Draws the Object using geometry handler, If the handler is not set then this function does nothing. | |
| std::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. | |
| std::optional< Kernel::V3D > | generatePointInObject (Kernel::PseudoRandomNumberGenerator &rng, const size_t) const override |
| Select a random point within the object. | |
| const BoundingBox & | getBoundingBox () const override |
| Return cached value of axis-aligned bounding box. | |
| 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) | |
| std::shared_ptr< GeometryHandler > | getGeometryHandler () const override |
| Returns the geometry handler. | |
| int | getName () const override |
| Get Name. | |
| void | GetObjectGeom (detail::ShapeInfo::GeometryShape &type, std::vector< Kernel::V3D > &vectors, double &innerRadius, double &radius, double &height) const override |
| get info on standard shapes | |
| int | getPointInObject (Kernel::V3D &point) const override |
| Try to find a point that lies within (or on) the object. | |
| std::string | getShapeXML () const |
| Getter for the shape xml. | |
| std::vector< int > | getSurfaceIndex () const |
| Returns all of the numbers of surfaces. | |
| std::vector< const Surface * > & | getSurfacePtr () |
| Get the list of surfaces. | |
| const std::vector< const Surface * > & | getSurfacePtr () const |
| Get the list of surfaces (const version) | |
| int | hasComplement () const |
| Determine if the object has a complementary object. | |
| bool | hasValidShape () const override |
| Return whether this object has a valid shape. | |
| 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. | |
| int | interceptSurface (Geometry::Track &track) const override |
| Given a track, fill the track with valid section. | |
| bool | isFiniteGeometry () const override |
| bool | isOnSide (const Kernel::V3D &) const override |
| bool | isValid (const Kernel::V3D &) const override |
| Check if a point is valid. | |
| bool | isValid (const std::map< int, int > &) const |
| Check if a set of surfaces are valid. | |
| void | makeComplement () |
| Takes the complement of a group. | |
| const Kernel::Material & | material () const override |
| CSGObject & | operator= (const CSGObject &) |
| Assignment operator. | |
| 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) | |
| virtual void | print () const |
| Prints almost everything. | |
| void | printTree () const |
| Displays the rule tree. | |
| void | procString (const std::string &lineStr) |
| Processes the cell string. | |
| double | rayTraceSolidAngle (const Kernel::V3D &observer) const |
| Given an observer position find the approximate solid angle of the object. | |
| int | removeSurface (const int surfNum) |
| Removes a surface and then re-builds the cell. | |
| void | setFiniteGeometryFlag (bool isFinite) override |
| void | setGeometryHandler (const std::shared_ptr< GeometryHandler > &h) |
| Set Geometry Handler. | |
| void | setID (const std::string &id) override |
| void | setMaterial (const Kernel::Material &material) override |
| void | setName (const int objNum) |
| Set Name. | |
| void | setNullBoundingBox () |
| Set a null bounding box for this object. | |
| int | setObject (const int objName, const std::string &lineStr) |
| Object line == cell. | |
| void | setVtkGeometryCacheReader (std::shared_ptr< vtkGeometryCacheReader >) |
| set vtkGeometryCache reader | |
| void | setVtkGeometryCacheWriter (std::shared_ptr< vtkGeometryCacheWriter >) |
| set vtkGeometryCache writer | |
| detail::ShapeInfo::GeometryShape | shape () const override |
| const detail::ShapeInfo & | shapeInfo () const override |
| double | solidAngle (const SolidAngleParams ¶ms) const override |
| Find solid angle of object wrt the observer. | |
| double | solidAngle (const SolidAngleParams ¶ms, const Kernel::V3D &scaleFactor) const override |
| Find solid angle of object wrt the observer with a scaleFactor for the object. | |
| std::string | str () const |
| Write the object to a string. | |
| int | substituteSurf (const int surfNum, const int newSurfNum, const std::shared_ptr< Surface > &surfPtr) |
| Removes a surface and then re-builds the cell. | |
| const Rule * | topRule () const |
| Return the top rule. | |
| double | triangulatedSolidAngle (const SolidAngleParams ¶ms) const |
| Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists. | |
| double | triangulatedSolidAngle (const SolidAngleParams ¶ms, const Kernel::V3D &scaleFactor) const |
| Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists. | |
| double | volume () const override |
| Calculates the volume of this object. | |
| void | write (std::ostream &) const |
| MCNPX output. | |
| ~CSGObject () override | |
| Destructor. | |
Public Member Functions inherited from Mantid::Geometry::IObject | |
| virtual | ~IObject ()=default |
Protected Attributes | |
| std::vector< const Surface * > | m_surList |
| Full surfaces (make a map. | |
Private Member Functions | |
| void | calcBoundingBoxByGeometry () |
| Calculate bounding box using object's geometric data. | |
| void | calcBoundingBoxByRule () |
| Calculate bounding box using Rule system. | |
| void | calcBoundingBoxByVertices () |
| Calculate bounding box using object's vertices. | |
| 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. | |
| const std::vector< uint32_t > & | getTriangleFaces () const |
| for solid angle from triangulation | |
| const std::vector< double > & | getTriangleVertices () const |
| get vertices | |
| double | monteCarloVolume () const |
| Returns the volume. | |
| 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. | |
| 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. | |
| int | searchForObject (Kernel::V3D &) const |
| Try to find a point that lies within (or on) the object, given a seed point. | |
| double | singleShotMonteCarloVolume (const int shotSize, const size_t seed) const |
| Returns the volume. | |
| void | updateGeometryHandler () |
| Updates the geometry handler if needed. | |
Private Attributes | |
| double | AABBxMax |
| xmax of Axis aligned bounding box cache | |
| double | AABBxMin |
| xmin of Axis aligned bounding box cache | |
| double | AABByMax |
| ymax of Axis aligned bounding box cache | |
| double | AABByMin |
| xmin of Axis aligned bounding box cache | |
| double | AABBzMax |
| zmax of Axis aligned bounding box cache | |
| double | AABBzMin |
| zmin of Axis Aligned Bounding Box Cache | |
| bool | bGeometryCaching |
| Is geometry caching enabled? | |
| bool | boolBounded |
| flag true if a bounding box exists, either by | |
| BoundingBox | m_boundingBox |
| Object's bounding box. | |
| std::shared_ptr< GeometryHandler > | m_handler |
| Geometry Handle for rendering. | |
| std::string | m_id |
| Optional string identifier. | |
| bool | m_isFiniteGeometry = true |
| Whether or not the object geometry is finite. | |
| std::unique_ptr< Kernel::Material > | m_material |
| material composition | |
| int | m_objNum |
| Creation number. | |
| std::string | m_shapeXML |
| original shape xml used to generate this object. | |
| std::unique_ptr< Rule > | m_topRule |
| Top rule [ Geometric scope of object]. | |
| std::shared_ptr< vtkGeometryCacheReader > | vtkCacheReader |
| a pointer to a class for reading from the geometry cache | |
| std::shared_ptr< vtkGeometryCacheWriter > | vtkCacheWriter |
| a pointer to a class for writing to the geometry cache | |
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 393 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 399 of file CSGObject.cpp.
| Mantid::Geometry::CSGObject::CSGObject | ( | const CSGObject & | A | ) |
Copy constructor.
| A | :: The object to initialise this copy from |
Definition at line 410 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 1727 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, m_handler, 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 1659 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 1690 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 1109 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 1130 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 911 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 505 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 726 of file CSGObject.cpp.
References isValid(), tmp, and Mantid::Kernel::Tolerance.
Referenced by isOnSide().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
| 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 493 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 763 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 1900 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 1084 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 2085 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 2005 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, m_handler, 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 1959 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 1612 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(), triangulatedSolidAngle(), 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 1858 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 2122 of file CSGObject.cpp.
References m_handler.
|
inlineoverridevirtual |
|
overridevirtual |
get info on standard shapes
Implements Mantid::Geometry::IObject.
Definition at line 2201 of file CSGObject.cpp.
References height, m_handler, and Mantid::Geometry::detail::ShapeInfo::NOSHAPE.
Referenced by generatePointInObject(), triangulatedSolidAngle(), 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 1925 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 2212 of file CSGObject.cpp.
References m_shapeXML.
Referenced by export_Object(), and wrapMeshWithNDArray().
| std::vector< int > Mantid::Geometry::CSGObject::getSurfaceIndex | ( | ) | const |
Returns all of the numbers of surfaces.
Definition at line 812 of file CSGObject.cpp.
References Mantid::Geometry::Surface::getName(), and m_surList.
|
inline |
Get the list of surfaces.
Definition at line 114 of file CSGObject.h.
|
inline |
Get the list of surfaces (const version)
Definition at line 112 of file CSGObject.h.
|
private |
for solid angle from triangulation
get faces
Definition at line 2175 of file CSGObject.cpp.
References m_handler.
Referenced by triangulatedSolidAngle(), and triangulatedSolidAngle().
|
private |
get vertices
Definition at line 2165 of file CSGObject.cpp.
References m_handler.
Referenced by calcBoundingBoxByVertices(), triangulatedSolidAngle(), and triangulatedSolidAngle().
| int Mantid::Geometry::CSGObject::hasComplement | ( | ) | const |
Determine if the object has a complementary object.
| 1 | :: true |
| 0 | :: false |
Definition at line 537 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 464 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 2097 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 1030 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 688 of file CSGObject.cpp.
References checkSurfaceValid(), m_surList, and Mantid::Kernel::V3D::normalize().
Referenced by rayTraceSolidAngle(), triangulatedSolidAngle(), 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 740 of file CSGObject.cpp.
References m_topRule.
Referenced by calcValidType(), calcValidTypeBy3Points(), checkSurfaceValid(), rayTraceSolidAngle(), searchForObject(), singleShotMonteCarloVolume(), triangulatedSolidAngle(), 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 751 of file CSGObject.cpp.
References m_topRule.
| void Mantid::Geometry::CSGObject::makeComplement | ( | ) |
Takes the complement of a group.
Definition at line 893 of file CSGObject.cpp.
References m_topRule, and procComp().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 457 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 1526 of file CSGObject.cpp.
References singleShotMonteCarloVolume().
Referenced by volume().
|
private |
Definition at line 2152 of file CSGObject.cpp.
References m_handler.
Referenced by solidAngle(), triangulatedSolidAngle(), and triangulatedSolidAngle().
|
private |
Definition at line 2157 of file CSGObject.cpp.
References m_handler.
Referenced by calcBoundingBoxByVertices().
Assignment operator.
| A | :: Object to copy |
Definition at line 417 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 551 of file CSGObject.cpp.
References createSurfaceList(), Mantid::Geometry::Rule::leaf(), m_topRule, and Mantid::Geometry::SurfPoint::setKey().
|
virtual |
Prints almost everything.
Definition at line 854 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 901 of file CSGObject.cpp.
|
private |
Takes a Rule item and makes it a complementary group.
| ruleItem | :: to encapsulate |
Definition at line 654 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 595 of file CSGObject.cpp.
References Mantid::Kernel::Strings::convert().
Referenced by procString().
| void 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 949 of file CSGObject.cpp.
References Mantid::Kernel::Strings::convPartNum(), m_topRule, procComp(), procPair(), and std::to_string().
Referenced by 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 1193 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(), triangulatedSolidAngle(), 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 826 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 2054 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 2076 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 452 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 1918 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 475 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 2114 of file CSGObject.cpp.
References updateGeometryHandler(), and vtkCacheReader.
| void Mantid::Geometry::CSGObject::setVtkGeometryCacheWriter | ( | std::shared_ptr< vtkGeometryCacheWriter > | writer | ) |
set vtkGeometryCache writer
Definition at line 2106 of file CSGObject.cpp.
References updateGeometryHandler(), and vtkCacheWriter.
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 2182 of file CSGObject.cpp.
References m_handler, and Mantid::Geometry::detail::ShapeInfo::NOSHAPE.
Referenced by generatePointInObject().
|
overridevirtual |
Implements Mantid::Geometry::IObject.
Definition at line 2190 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 1560 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.
| params | :: point to measure solid angle from, and number of cylinder slices |
Implements Mantid::Geometry::IObject.
Definition at line 1170 of file CSGObject.cpp.
References numberOfTriangles(), Mantid::Geometry::SolidAngleParams::observer(), rayTraceSolidAngle(), and triangulatedSolidAngle().
|
overridevirtual |
Find solid angle of object wrt the observer with a scaleFactor for the object.
| params | :: point to measure solid angle from, and number of cylinder slices |
| scaleFactor | :: V3D giving scaling of the object |
Implements Mantid::Geometry::IObject.
Definition at line 1184 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 842 of file CSGObject.cpp.
References createSurfaceList(), and m_topRule.
|
inline |
| double Mantid::Geometry::CSGObject::triangulatedSolidAngle | ( | const SolidAngleParams & | params | ) | const |
Find solid angle of object from point "observer" using the OC triangulation of the object, if it exists.
| params | :: Point from which solid angle is required, and number of cylinder slices |
Definition at line 1311 of file CSGObject.cpp.
References Mantid::Geometry::detail::ShapeInfo::CONE, Mantid::Geometry::detail::ShapeInfo::CUBOID, Mantid::Geometry::detail::ShapeInfo::CYLINDER, Mantid::Geometry::SolidAngleParams::cylinderSlices(), getBoundingBox(), GetObjectGeom(), getTriangleFaces(), getTriangleVertices(), height, Mantid::Geometry::BoundingBox::isNonNull(), isOnSide(), Mantid::Geometry::BoundingBox::isPointInside(), isValid(), numberOfTriangles(), Mantid::Geometry::SolidAngleParams::observer(), rayTraceSolidAngle(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
Referenced by solidAngle(), and solidAngle().
| double Mantid::Geometry::CSGObject::triangulatedSolidAngle | ( | const SolidAngleParams & | params, |
| 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.
| params | :: Point from which solid angle is required, and number of cylinder slices |
| scaleFactor | :: V3D each component giving the scaling of the object only (not observer) |
Definition at line 1398 of file CSGObject.cpp.
References Mantid::Geometry::detail::ShapeInfo::CUBOID, getBoundingBox(), GetObjectGeom(), getTriangleFaces(), getTriangleVertices(), height, Mantid::Geometry::BoundingBox::isNonNull(), isOnSide(), Mantid::Geometry::BoundingBox::isPointInside(), isValid(), numberOfTriangles(), Mantid::Geometry::SolidAngleParams::observer(), rayTraceSolidAngle(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
|
private |
Updates the geometry handler if needed.
Definition at line 2131 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 1470 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, monteCarloVolume(), Mantid::Kernel::V3D::scalar_prod(), and Mantid::Geometry::detail::ShapeInfo::SPHERE.
Referenced by export_Object().
| 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 937 of file CSGObject.cpp.
References str(), and Mantid::Kernel::Strings::writeMCNPX().
|
friend |
Definition at line 217 of file CSGObject.h.
|
friend |
Definition at line 218 of file CSGObject.h.
|
mutableprivate |
xmax of Axis aligned bounding box cache
Definition at line 205 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
xmin of Axis aligned bounding box cache
Definition at line 208 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
ymax of Axis aligned bounding box cache
Definition at line 206 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
xmin of Axis aligned bounding box cache
Definition at line 209 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
zmax of Axis aligned bounding box cache
Definition at line 207 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
zmin of Axis Aligned Bounding Box Cache
Definition at line 210 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
Is geometry caching enabled?
Definition at line 220 of file CSGObject.h.
Referenced by operator=(), and updateGeometryHandler().
|
mutableprivate |
flag true if a bounding box exists, either by
Definition at line 211 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and operator=().
|
private |
Object's bounding box.
Definition at line 203 of file CSGObject.h.
Referenced by defineBoundingBox(), getBoundingBox(), and setNullBoundingBox().
|
private |
Geometry Handle for rendering.
Definition at line 216 of file CSGObject.h.
Referenced by calcBoundingBoxByGeometry(), draw(), generatePointInObject(), 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 238 of file CSGObject.h.
|
mutableprivate |
material composition
Definition at line 236 of file CSGObject.h.
Referenced by material(), operator=(), and setMaterial().
|
private |
Creation number.
Definition at line 214 of file CSGObject.h.
Referenced by operator=(), print(), printTree(), setObject(), and str().
|
private |
original shape xml used to generate this object.
Definition at line 232 of file CSGObject.h.
Referenced by getShapeXML(), and operator=().
|
protected |
Full surfaces (make a map.
Definition at line 241 of file CSGObject.h.
Referenced by createSurfaceList(), distance(), getSurfaceIndex(), hasValidShape(), interceptSurface(), isOnSide(), and setObject().
|
private |
Top rule [ Geometric scope of object].
Definition at line 201 of file CSGObject.h.
Referenced by calcBoundingBoxByRule(), cellCompStr(), createSurfaceList(), getBoundingBox(), getBoundingBox(), hasComplement(), hasValidShape(), isValid(), 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 222 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 224 of file CSGObject.h.
Referenced by operator=(), setVtkGeometryCacheWriter(), and updateGeometryHandler().