Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Mantid::Geometry::ObjCompAssembly Class Reference

Class for Assembly of geometric components. More...

#include <ObjCompAssembly.h>

Inheritance diagram for Mantid::Geometry::ObjCompAssembly:
Mantid::Geometry::ICompAssembly Mantid::Geometry::ObjComponent Mantid::Geometry::IComponent Mantid::Geometry::IObjComponent Mantid::Geometry::Component Mantid::Geometry::IComponent Mantid::Geometry::IComponent

Public Member Functions

int add (IComponent *) override
 Add a component to the assembly. More...
 
int addCopy (IComponent *) override
 Add a copy (clone) of a component. More...
 
int addCopy (IComponent *, const std::string &) override
 Add a copy (clone) of a component and rename it. More...
 
IComponentclone () const override
 Make a clone of the present component. More...
 
std::shared_ptr< IObjectcreateOutline ()
 Set the outline of the assembly. More...
 
std::shared_ptr< IComponentgetChild (const int i) const override
 Get a pointer to the ith component within the assembly. Easier to use than. More...
 
void getChildren (std::vector< IComponent_const_sptr > &outVector, bool recursive) const override
 Get all children. More...
 
std::shared_ptr< const IComponentgetComponentByName (const std::string &cname, int nlevels=0) const override
 Returns a pointer to the first component of assembly encountered with the. More...
 
Kernel::V3D getPos () const override
 Gets the absolute position of the Parametrized ObjCompAssembly This attempts to read the cached position value from the parameter map, and creates it if it is not available. More...
 
Kernel::Quat getRotation () const override
 Gets the absolute position of the Parametrized ObjCompAssembly This attempts to read the cached position value from the parameter map, and creates it if it is not available. More...
 
int nelements () const override
 Return the number of elements in the assembly. More...
 
 ObjCompAssembly (const IComponent *base, const ParameterMap *map)
 Empty constructor. More...
 
 ObjCompAssembly (const ObjCompAssembly &)
 Copy constructor. More...
 
 ObjCompAssembly (const std::string &, IComponent *reference=nullptr)
 Constructor with a name and parent reference. More...
 
ObjCompAssemblyoperator= (const ObjCompAssembly &)
 
std::shared_ptr< IComponentoperator[] (int i) const override
 Get a pointer to the ith component in the assembly. More...
 
void printChildren (std::ostream &) const override
 Print information about all children. More...
 
void printTree (std::ostream &) const override
 Print information about all the elements in the tree to a stream Loops through all components in the tree and call printSelf(os). More...
 
size_t registerContents (class Mantid::Geometry::ComponentVisitor &visitor) const override
 Register the contents of this ObjComponent. More...
 
void setOutline (std::shared_ptr< const IObject > obj)
 Sets the outline shape for this assembly. More...
 
void testIntersectionWithChildren (Track &, std::deque< IComponent_const_sptr > &) const override
 Test the intersection of the ray with the children of the component assembly
More...
 
std::string type () const override
 String description of the type of component. More...
 
 ~ObjCompAssembly () override
 Destructor. More...
 
- Public Member Functions inherited from Mantid::Geometry::ICompAssembly
virtual int add (IComponent *)=0
 Add a component to the assembly. More...
 
virtual int addCopy (IComponent *)=0
 Add a copy (clone) of a component. More...
 
virtual int addCopy (IComponent *, const std::string &)=0
 Add a copy (clone) of a component and rename it. More...
 
IComponentclone () const override=0
 Make a clone of the present component. More...
 
virtual std::shared_ptr< IComponentgetChild (const int i) const =0
 Get a pointer to the ith component within the assembly. More...
 
virtual void getChildren (std::vector< IComponent_const_sptr > &outVector, bool recursive) const =0
 Get all children. More...
 
virtual std::shared_ptr< const IComponentgetComponentByName (const std::string &cname, int nlevels=0) const =0
 Returns a pointer to the first component of assembly encountered with the given name. More...
 
 ICompAssembly ()
 
virtual int nelements () const =0
 Return the number of elements in the assembly. More...
 
virtual std::shared_ptr< IComponentoperator[] (int i) const =0
 Overloaded index operator. More...
 
virtual void printChildren (std::ostream &) const =0
 Print information about all children. More...
 
virtual void printTree (std::ostream &) const =0
 Print information about all the elements in the tree to a stream Loops through all components in the tree and call printSelf(os). More...
 
virtual void testIntersectionWithChildren (Track &testRay, std::deque< IComponent_const_sptr > &searchQueue) const =0
 Test the intersection of the ray with the children of the component assembly. More...
 
std::string type () const override
 String description of the type of component. More...
 
- Public Member Functions inherited from Mantid::Geometry::IComponent
virtual IComponentclone () const =0
 Return a clone to the current object. More...
 
virtual std::vector< std::shared_ptr< const IComponent > > getAncestors () const =0
 Return an array of all ancestors, the nearest first. More...
 
virtual const IComponentgetBareParent () const =0
 Returns the bare pointer to the IComponent parent. More...
 
virtual IComponent const * getBaseComponent () const =0
 Returns const pointer to base component if this component is parametrized. More...
 
virtual void getBoundingBox (BoundingBox &boundingBox) const =0
 Get the bounding box for this component and store it in the given argument. More...
 
virtual ComponentID getComponentID () const =0
 Returns the ComponentID - a unique identifier of the component. More...
 
virtual double getDistance (const IComponent &) const =0
 Get the distance to another IComponent. More...
 
virtual std::string getFullName () const =0
 Get the IComponent full path name. More...
 
virtual std::string getName () const =0
 Get the IComponent name. More...
 
virtual std::shared_ptr< const IComponentgetParent () const =0
 Return a pointer to the current parent. More...
 
virtual Kernel::V3D getPos () const =0
 Get the position of the IComponent. Tree structure is traverse through the. More...
 
virtual Kernel::V3D getRelativePos () const =0
 Get the position relative to the parent IComponent (absolute if no parent) More...
 
virtual Kernel::Quat getRelativeRot () const =0
 Get the relative Orientation. More...
 
virtual Kernel::Quat getRotation () const =0
 Get the absolute orientation of the IComponent. More...
 
virtual Kernel::V3D getScaleFactor () const
 Gets the scaling factor of the object for the Object Component. More...
 
virtual void rotate (const Kernel::Quat &)=0
 Rotate the IComponent. This is relative to parent. More...
 
virtual void rotate (double, const Kernel::V3D &)=0
 Rotate the IComponent by an angle in degrees with respect to an axis. More...
 
virtual void setName (const std::string &)=0
 Set the IComponent name. More...
 
virtual void setParent (IComponent *)=0
 Assign a parent IComponent. Previous parent link is lost. More...
 
virtual void setPos (const Kernel::V3D &)=0
 Set the position of the component The position is with respect to the parent component. More...
 
virtual void setPos (double, double, double)=0
 Set the IComponent position, x, y, z respective to parent (if present) More...
 
virtual void setRot (const Kernel::Quat &)=0
 Set the orientation Kernel::Quaternion relative to parent (if present) More...
 
virtual void translate (const Kernel::V3D &)=0
 Copy the Rotation from another IComponent. More...
 
virtual void translate (double, double, double)=0
 Translate the IComponent (x,y,z form). This is relative to parent if. More...
 
virtual std::string type () const
 Returns a string representation of the IComponent type. More...
 
virtual ~IComponent ()=default
 Destructor. More...
 
- Public Member Functions inherited from Mantid::Geometry::ObjComponent
void boundingBox (double &xmax, double &ymax, double &zmax, double &xmin, double &ymin, double &zmin) const
 
IComponentclone () const override
 Virtual Copy Constructor. More...
 
void draw () const override
 Draws the objcomponent, If the handler is not set then this function does nothing. More...
 
void drawObject () const override
 Draws the Object. More...
 
void getBoundingBox (BoundingBox &absoluteBB) const override
 get bounding box, which may or may not be axis aligned; More...
 
virtual double getDepth () const
 get Depth (Z-dimension) value for component More...
 
virtual double getHeight () const
 get Height (Y-dimension) value for component More...
 
int getPointInObject (Kernel::V3D &point) const override
 Try to find a point that lies within (or on) the object. More...
 
virtual double getWidth () const
 get Width (X-dimension) value for component More...
 
void initDraw () const override
 Initializes the ObjComponent for rendering, this function should be called before rendering. More...
 
int interceptSurface (Track &track) const override
 Checks whether the track given will pass through this Component. More...
 
bool isOnSide (const Kernel::V3D &point) const override
 Does the point given lie on the surface of this object component? More...
 
bool isValid (const Kernel::V3D &point) const override
 Does the point given lie within this object component? More...
 
const Kernel::Material material () const override
 Return the material this component is made from. More...
 
 ObjComponent (const IComponent *base, const ParameterMap *map)
 Constructor for parametrized component. More...
 
 ObjComponent (const std::string &name, IComponent *parent=nullptr)
 Constructor. More...
 
 ObjComponent (const std::string &name, std::shared_ptr< const IObject > shape, IComponent *parent=nullptr)
 Constructor. More...
 
virtual size_t registerContents (class ComponentVisitor &componentVisitor) const override
 Register the contents of this ObjComponent. More...
 
void setShape (std::shared_ptr< const IObject > newShape)
 Set a new shape on the component void setShape(std::shared_ptr<const IObject> newShape);. More...
 
const std::shared_ptr< const IObjectshape () const override
 Return the shape of the component. More...
 
double solidAngle (const Kernel::V3D &observer) const override
 Finds the approximate solid angle covered by the component when viewed from the point given. More...
 
std::string type () const override
 type string More...
 
- Public Member Functions inherited from Mantid::Geometry::IObjComponent
IComponentclone () const override=0
 Virtual Copy Constructor. More...
 
virtual void draw () const =0
 Draws the objcomponent. More...
 
virtual void drawObject () const =0
 Draws the Object. More...
 
virtual int getPointInObject (Kernel::V3D &point) const =0
 Try to find a point that lies within (or on) the object. More...
 
GeometryHandlerHandle () const
 Gets the GeometryHandler. More...
 
virtual void initDraw () const =0
 Initializes the ObjComponent for rendering, this function should be called before rendering. More...
 
virtual int interceptSurface (Track &track) const =0
 Checks whether the track given will pass through this Component. More...
 
 IObjComponent ()
 
 IObjComponent (const IObjComponent &)
 Copy constructor. More...
 
 IObjComponent (GeometryHandler *the_handler)
 Constructor, specifying the GeometryHandler (renderer engine) for this IObjComponent. More...
 
virtual bool isOnSide (const Kernel::V3D &point) const =0
 Does the point given lie on the surface of this object component? More...
 
virtual bool isValid (const Kernel::V3D &point) const =0
 Does the point given lie within this object component? More...
 
virtual const Kernel::Material material () const =0
 Returns the material of the Object. More...
 
IObjComponentoperator= (const IObjComponent &rhs)
 Assignment operator. More...
 
virtual const std::shared_ptr< const IObjectshape () const =0
 Returns the shape of the Object. More...
 
virtual double solidAngle (const Kernel::V3D &observer) const =0
 Finds the approximate solid angle covered by the component when viewed from the point given. More...
 
std::string type () const override
 type string More...
 
 ~IObjComponent () override
 
- Public Member Functions inherited from Mantid::Geometry::Component
IComponentclone () const override
 Clone method Make a copy of the Component. More...
 
 Component ()
 Create Empty Component at Origin, with no orientation and null parent. More...
 
 Component (const IComponent *base, const ParameterMap *map)
 Constructor for parametrized component. More...
 
 Component (std::string name, const Kernel::V3D &position, const Kernel::Quat &rotation, IComponent *parent=nullptr)
 Create a named component with positioning vector, orientation and parent. More...
 
 Component (std::string name, const Kernel::V3D &position, IComponent *parent=nullptr)
 Create a named component with positioning vector, and parent component. More...
 
 Component (std::string name, IComponent *parent=nullptr)
 Create a named component with a parent component (optional) More...
 
std::vector< std::shared_ptr< const IComponent > > getAncestors () const override
 Return an array of all ancestors. More...
 
IComponent const * getBaseComponent () const override
 Returns const pointer to base component if this component is parametrized. More...
 
void getBoundingBox (BoundingBox &boundingBox) const override
 Get the bounding box for this component and store it in the given argument. More...
 
ComponentID getComponentID () const override
 Returns the ComponentID - a unique identifier of the component. More...
 
double getDistance (const IComponent &) const override
 Get the distance to another IComponent. More...
 
std::string getFullName () const override
 Get the full pathname. More...
 
std::string getName () const override
 Get the IComponent name. More...
 
std::shared_ptr< const IComponentgetParent () const override
 Return a pointer to the current parent. as shared pointer. More...
 
Kernel::V3D getPos () const override
 Get the position of the IComponent. Tree structure is traverse through the. More...
 
Kernel::V3D getRelativePos () const override
 Get the position relative to the parent IComponent (absolute if no parent) More...
 
Kernel::Quat getRelativeRot () const override
 Get the relative Orientation. More...
 
Kernel::Quat getRotation () const override
 Get the absolute orientation of the IComponent. More...
 
bool isParentNamed (const std::string &expectedName, int maxDepth=-1) const
 Return true if one of the parents of this component is named something. More...
 
void rotate (const Kernel::Quat &) override
 Rotate the IComponent. This is relative to parent. More...
 
void rotate (double, const Kernel::V3D &) override
 Rotate the IComponent by an angle in degrees with respect to an axis. More...
 
void setName (const std::string &) override
 Set the IComponent name. More...
 
void setParent (IComponent *) override
 Assign a parent IComponent. Previous parent link is lost. More...
 
void setPos (const Kernel::V3D &) override
 Set the position of the Component The position is with respect to the parent Component. More...
 
void setPos (double, double, double) override
 Set the IComponent position, x, y, z respective to parent (if present) More...
 
void setRot (const Kernel::Quat &) override
 Set the orientation Kernel::Quaternion relative to parent (if present) More...
 
void translate (const Kernel::V3D &) override
 Translate the IComponent (vector form). This is relative to parent if. More...
 
void translate (double, double, double) override
 Translate the IComponent (x,y,z form). This is relative to parent if. More...
 
virtual std::string typeName () const
 
std::set< std::string > getParameterNames (bool recursive=true) const override
 Return the parameter names. More...
 
std::map< std::string, ComponentIDgetParameterNamesByComponent () const override
 return the parameter names and the component they are from More...
 
bool hasParameter (const std::string &name, bool recursive=true) const override
 Returns a boolean indicating if the component has the named parameter. More...
 
std::vector< double > getNumberParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a double. More...
 
std::vector< int > getIntParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as an int. More...
 
std::string getParameterType (const std::string &pname, bool recursive=true) const override
 Get a parameter's type – this is HACK until Python can export property regardless of the property type. More...
 
std::string getDescription () const
 Get this component parameter's description – no recursive search within children. More...
 
std::string getParamDescription (const std::string &pname, bool recursive=true) const
 Get description of a parameter attached to this component
More...
 
std::string getParamShortDescription (const std::string &pname, bool recursive=true) const
 Get a component's parameter short description. More...
 
std::string getShortDescription () const
 Get a components's short description. More...
 
void setDescription (const std::string &descr)
 Set components description. More...
 
std::vector< bool > getBoolParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a bool. More...
 
std::vector< Kernel::V3DgetPositionParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::V3D. More...
 
std::vector< Kernel::QuatgetRotationParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a Kernel::Quaternion. More...
 
std::vector< std::string > getStringParameter (const std::string &pname, bool recursive=true) const override
 Get a parameter defined as a string. More...
 
std::string getParameterAsString (const std::string &pname, bool recursive=true) const override
 get a string representation of a parameter More...
 
bool getParameterVisible (const std::string &p_name, bool recursive) const override
 Get a visibility attribute of a parameter from the parameter map. More...
 
void printSelf (std::ostream &) const override
 Prints a text representation of itself. More...
 
const IComponentbase () const
 Returns the address of the base component. More...
 
Kernel::V3D getScaleFactor () const override
 Returns the ScaleFactor. More...
 
const IComponentgetBareParent () const override
 Returns the bare pointer to the IComponent parent. More...
 
virtual void readXMLAttributes (const Poco::XML::Attributes &attr)
 Reads the XML attributes from Poco XML parser. More...
 
virtual void writeXML (Poco::XML::XMLWriter &writer) const
 
virtual void appendXML (std::ostream &xmlStream) const
 Append to an open XML string. More...
 
bool isParametrized () const override
 Return true if the Component is, in fact, parametrized (that is - it has a valid parameter map) More...
 
bool hasComponentInfo () const
 
size_t index () const
 Helper for legacy access mode. Returns the index of the component. More...
 

Private Types

using comp_it = std::vector< ObjComponent * >::iterator
 Iterator type. More...
 
using const_comp_it = std::vector< ObjComponent * >::const_iterator
 Const iterator type. More...
 

Private Member Functions

ObjCompAssemblyoperator= (const ICompAssembly &)
 Private copy assignment operator. More...
 

Private Attributes

std::vector< ObjComponent * > m_group
 the group of child components More...
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::Geometry::ICompAssembly
 ICompAssembly (const ICompAssembly &)=default
 Protected copy constructor. More...
 
- Protected Member Functions inherited from Mantid::Geometry::ObjComponent
const Kernel::V3D factorOutComponentPosition (const Kernel::V3D &point) const
 Find the point that's in the same place relative to the constituent geometrical Object if the position and rotation introduced by the Component is ignored. More...
 
const Kernel::V3D takeOutRotation (Kernel::V3D point) const
 Rotates a point by the reverse of the component's rotation. More...
 
- Protected Member Functions inherited from Mantid::Geometry::IObjComponent
void setGeometryHandler (GeometryHandler *h)
 Reset the current geometry handler. More...
 
- Protected Member Functions inherited from Mantid::Geometry::Component
template<class TYPE >
std::vector< TYPEgetParameter (const std::string &p_name, bool recursive) const
 Get a parameter from the parameter map. More...
 
void swap (const Component *base, const ParameterMap *pmap)
 Swap the current references to the un-parameterized component and parameter map for new ones. More...
 
- Protected Attributes inherited from Mantid::Geometry::ObjComponent
std::shared_ptr< const IObjectm_shape
 The physical geometry representation. More...
 
- Protected Attributes inherited from Mantid::Geometry::Component
const IComponentm_parent
 Parent component in the tree. More...
 
const Componentm_base
 The base component - this is the unmodified component (without the parameters). More...
 
const ParameterMapm_map
 A pointer to const ParameterMap containing the parameters. More...
 
std::string m_name
 Name of the component. More...
 
Kernel::V3D m_pos
 Position w. More...
 
Kernel::Quat m_rot
 Orientation. More...
 

Detailed Description

Class for Assembly of geometric components.

Version
A
Author
Laurent C Chapon, ISIS RAL
Date
01/11/2007

ObjCompAssembly allows Components to be positioned in a hierarchical structure in the form of a tree. ObjCompAssembly inherits from component.

Definition at line 30 of file ObjCompAssembly.h.

Member Typedef Documentation

◆ comp_it

using Mantid::Geometry::ObjCompAssembly::comp_it = std::vector<ObjComponent *>::iterator
private

Iterator type.

Definition at line 31 of file ObjCompAssembly.h.

◆ const_comp_it

using Mantid::Geometry::ObjCompAssembly::const_comp_it = std::vector<ObjComponent *>::const_iterator
private

Const iterator type.

Definition at line 32 of file ObjCompAssembly.h.

Constructor & Destructor Documentation

◆ ObjCompAssembly() [1/3]

Mantid::Geometry::ObjCompAssembly::ObjCompAssembly ( const IComponent base,
const ParameterMap map 
)

Empty constructor.

Constructor for a parametrized ObjComponent.

Parameters
basethe base (un-parametrized) IComponent
mappointer to the ParameterMap

Definition at line 41 of file ObjCompAssembly.cpp.

◆ ObjCompAssembly() [2/3]

Mantid::Geometry::ObjCompAssembly::ObjCompAssembly ( const std::string &  n,
IComponent reference = nullptr 
)

Constructor with a name and parent reference.

Valued constructor.

Parameters
n:: name of the assembly
reference:: the parent Component
If the reference is an object of class Component,
normal parenting apply. If the reference object is an assembly itself, then in addition to parenting this is registered as a children of reference.

Definition at line 52 of file ObjCompAssembly.cpp.

References Mantid::Geometry::ICompAssembly::add().

◆ ObjCompAssembly() [3/3]

Mantid::Geometry::ObjCompAssembly::ObjCompAssembly ( const ObjCompAssembly assem)

Copy constructor.

Parameters
assem:: assembly to copy

Definition at line 63 of file ObjCompAssembly.cpp.

◆ ~ObjCompAssembly()

Mantid::Geometry::ObjCompAssembly::~ObjCompAssembly ( )
override

Destructor.

Definition at line 89 of file ObjCompAssembly.cpp.

References m_group.

Member Function Documentation

◆ add()

int Mantid::Geometry::ObjCompAssembly::add ( IComponent comp)
overridevirtual

Add a component to the assembly.

Add method.

Parameters
comp:: component to add
Returns
number of components in the assembly

This becomes the new parent of comp.

Implements Mantid::Geometry::ICompAssembly.

Definition at line 110 of file ObjCompAssembly.cpp.

References m_group, Mantid::Geometry::Component::m_map, and Mantid::Geometry::IComponent::setParent().

Referenced by InstrumentCreationHelper::addDetector(), ComponentCreationHelper::createCylInstrumentWithVerticalOffsetsSpecified(), and ComponentCreationHelper::createInstrumentWithPSDTubes().

◆ addCopy() [1/2]

int Mantid::Geometry::ObjCompAssembly::addCopy ( IComponent comp)
overridevirtual

Add a copy (clone) of a component.

AddCopy method.

Parameters
comp:: component to add
Returns
number of components in the assembly

Add a copy of a component in the assembly. Comp is cloned if valid, then added in the assembly This becomes the parent of the cloned component

Implements Mantid::Geometry::ICompAssembly.

Definition at line 134 of file ObjCompAssembly.cpp.

References Mantid::Geometry::IComponent::clone(), m_group, Mantid::Geometry::Component::m_map, and Mantid::Geometry::IComponent::setParent().

◆ addCopy() [2/2]

int Mantid::Geometry::ObjCompAssembly::addCopy ( IComponent comp,
const std::string &  n 
)
overridevirtual

Add a copy (clone) of a component and rename it.

AddCopy method.

Parameters
comp:: component to add
n:: name of the copied component.
Returns
number of components in the assembly

Add a copy of a component in the assembly. Comp is cloned if valid, then added in the assembly This becomes the parent of the cloned component

Implements Mantid::Geometry::ICompAssembly.

Definition at line 160 of file ObjCompAssembly.cpp.

References Mantid::Geometry::IComponent::clone(), m_group, Mantid::Geometry::Component::m_map, n, Mantid::Geometry::IComponent::setName(), and Mantid::Geometry::IComponent::setParent().

◆ clone()

IComponent * Mantid::Geometry::ObjCompAssembly::clone ( ) const
overridevirtual

Make a clone of the present component.

Clone method Make a copy of the component assembly.

Returns
new(*this)

Implements Mantid::Geometry::ICompAssembly.

Definition at line 102 of file ObjCompAssembly.cpp.

◆ createOutline()

std::shared_ptr< IObject > Mantid::Geometry::ObjCompAssembly::createOutline ( )

◆ getChild()

std::shared_ptr< IComponent > Mantid::Geometry::ObjCompAssembly::getChild ( const int  i) const
inlineoverridevirtual

Get a pointer to the ith component within the assembly. Easier to use than.

Implements Mantid::Geometry::ICompAssembly.

Definition at line 59 of file ObjCompAssembly.h.

Referenced by getChildren(), getComponentByName(), and testIntersectionWithChildren().

◆ getChildren()

void Mantid::Geometry::ObjCompAssembly::getChildren ( std::vector< IComponent_const_sptr > &  outVector,
bool  recursive 
) const
overridevirtual

Get all children.

Return a vector of all contained children components.

Parameters
outVector:: vector of IComponent sptr.
recursive:: if a child is a CompAssembly, returns its children recursively

Implements Mantid::Geometry::ICompAssembly.

Definition at line 225 of file ObjCompAssembly.cpp.

References getChild(), and nelements().

◆ getComponentByName()

std::shared_ptr< const IComponent > Mantid::Geometry::ObjCompAssembly::getComponentByName ( const std::string &  cname,
int  nlevels = 0 
) const
overridevirtual

Returns a pointer to the first component of assembly encountered with the.

Find a component by name.

Parameters
cname:: The name of the component. If there are multiple matches, the first one found is returned.
nlevels:: Optional argument to limit number of levels searched.
Returns
A shared pointer to the component

Implements Mantid::Geometry::ICompAssembly.

Definition at line 247 of file ObjCompAssembly.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::Geometry::g_log, getChild(), and nelements().

◆ getPos()

V3D Mantid::Geometry::ObjCompAssembly::getPos ( ) const
overridevirtual

Gets the absolute position of the Parametrized ObjCompAssembly This attempts to read the cached position value from the parameter map, and creates it if it is not available.

Returns
A vector of the absolute position

Implements Mantid::Geometry::IComponent.

Definition at line 300 of file ObjCompAssembly.cpp.

References Mantid::Geometry::ParameterMap::getCachedLocation(), Mantid::Geometry::Component::getPos(), Mantid::Geometry::Component::hasComponentInfo(), Mantid::Geometry::Component::m_base, Mantid::Geometry::Component::m_map, and Mantid::Geometry::ParameterMap::setCachedLocation().

◆ getRotation()

Quat Mantid::Geometry::ObjCompAssembly::getRotation ( ) const
overridevirtual

Gets the absolute position of the Parametrized ObjCompAssembly This attempts to read the cached position value from the parameter map, and creates it if it is not available.

Returns
A vector of the absolute position

Implements Mantid::Geometry::IComponent.

Definition at line 317 of file ObjCompAssembly.cpp.

References Mantid::Geometry::ParameterMap::getCachedRotation(), Mantid::Geometry::Component::getRotation(), Mantid::Geometry::Component::hasComponentInfo(), Mantid::Geometry::Component::m_base, Mantid::Geometry::Component::m_map, and Mantid::Geometry::ParameterMap::setCachedRotation().

◆ nelements()

int Mantid::Geometry::ObjCompAssembly::nelements ( ) const
overridevirtual

Return the number of elements in the assembly.

Return the number of components in the assembly.

Returns
group.size()

Implements Mantid::Geometry::ICompAssembly.

Definition at line 181 of file ObjCompAssembly.cpp.

References Mantid::Geometry::Component::m_base, m_group, and Mantid::Geometry::Component::m_map.

Referenced by createOutline(), getChildren(), getComponentByName(), Mantid::Geometry::operator<<(), operator[](), printChildren(), printTree(), and testIntersectionWithChildren().

◆ operator=() [1/2]

ObjCompAssembly & Mantid::Geometry::ObjCompAssembly::operator= ( const ICompAssembly )
private

Private copy assignment operator.

◆ operator=() [2/2]

ObjCompAssembly & Mantid::Geometry::ObjCompAssembly::operator= ( const ObjCompAssembly assem)

Definition at line 68 of file ObjCompAssembly.cpp.

References m_group.

◆ operator[]()

std::shared_ptr< IComponent > Mantid::Geometry::ObjCompAssembly::operator[] ( int  i) const
overridevirtual

Get a pointer to the ith component in the assembly.

Note standard C/C++ array notation used, that is, i most be an integer i = 0,1,..., N-1, where N is the number of component in the assembly.

Parameters
i:: The index of the component you want
Returns
group[i]

Throws if i is not in range

Implements Mantid::Geometry::ICompAssembly.

Definition at line 201 of file ObjCompAssembly.cpp.

References Mantid::Geometry::ParComponentFactory::create(), Mantid::Geometry::Component::m_base, m_group, Mantid::Geometry::Component::m_map, and nelements().

Referenced by printChildren(), and printTree().

◆ printChildren()

void Mantid::Geometry::ObjCompAssembly::printChildren ( std::ostream &  os) const
overridevirtual

Print information about all children.

Print information about elements in the assembly to a stream.

Parameters
os:: output stream

Loops through all components in the assembly and call printSelf(os).

Implements Mantid::Geometry::ICompAssembly.

Definition at line 265 of file ObjCompAssembly.cpp.

References nelements(), and operator[]().

Referenced by Mantid::Geometry::operator<<().

◆ printTree()

void Mantid::Geometry::ObjCompAssembly::printTree ( std::ostream &  os) const
overridevirtual

Print information about all the elements in the tree to a stream Loops through all components in the tree and call printSelf(os).

Parameters
os:: output stream

Implements Mantid::Geometry::ICompAssembly.

Definition at line 280 of file ObjCompAssembly.cpp.

References nelements(), and operator[]().

◆ registerContents()

size_t Mantid::Geometry::ObjCompAssembly::registerContents ( class Mantid::Geometry::ComponentVisitor componentVisitor) const
overridevirtual

Register the contents of this ObjComponent.

Reimplemented from Mantid::Geometry::ObjComponent.

Definition at line 353 of file ObjCompAssembly.cpp.

References Mantid::Geometry::ComponentVisitor::registerObjComponentAssembly().

◆ setOutline()

void Mantid::Geometry::ObjCompAssembly::setOutline ( std::shared_ptr< const IObject obj)

Sets the outline shape for this assembly.

Parameters
obj:: The outline shape created previously fith createOutline()

Definition at line 596 of file ObjCompAssembly.cpp.

References Mantid::Geometry::ObjComponent::m_shape, and obj.

Referenced by ComponentCreationHelper::createCylInstrumentWithVerticalOffsetsSpecified(), and createOutline().

◆ testIntersectionWithChildren()

void Mantid::Geometry::ObjCompAssembly::testIntersectionWithChildren ( Track testRay,
std::deque< IComponent_const_sptr > &  searchQueue 
) const
overridevirtual

Test the intersection of the ray with the children of the component assembly

Test the intersection of the ray with the children of the component assembly, for InstrumentRayTracer.

Parameters
testRay:: Track under test. The results are stored here.
searchQueue:: If a child is a sub-assembly then it is appended for later searching

Implements Mantid::Geometry::ICompAssembly.

Definition at line 337 of file ObjCompAssembly.cpp.

References getChild(), and nelements().

◆ type()

std::string Mantid::Geometry::ObjCompAssembly::type ( ) const
inlineoverridevirtual

String description of the type of component.

Reimplemented from Mantid::Geometry::ICompAssembly.

Definition at line 35 of file ObjCompAssembly.h.

Referenced by createOutline().

Member Data Documentation

◆ m_group

std::vector<ObjComponent *> Mantid::Geometry::ObjCompAssembly::m_group
private

the group of child components

Definition at line 90 of file ObjCompAssembly.h.

Referenced by add(), addCopy(), createOutline(), nelements(), operator=(), operator[](), and ~ObjCompAssembly().


The documentation for this class was generated from the following files: