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

Class for Assembly of geometric components. More...

#include <CompAssembly.h>

Inheritance diagram for Mantid::Geometry::CompAssembly:
Mantid::Geometry::ICompAssembly Mantid::Geometry::Component Mantid::Geometry::IComponent Mantid::Geometry::IComponent Mantid::Geometry::GridDetector Mantid::Geometry::Instrument Mantid::Geometry::StructuredDetector Mantid::Geometry::RectangularDetector

Public Member Functions

int add (IComponent *) override
 Add a component to the assembly. More...
 
void addChildren (IComponent *comp)
 Add a copy (clone) of a component. More...
 
int addCopy (IComponent *) override
 AddCopy method. 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...
 
 CompAssembly ()
 Empty constructor. More...
 
 CompAssembly (const CompAssembly &)
 Copy constructor. More...
 
 CompAssembly (const IComponent *base, const ParameterMap *map)
 Constructor for parametrized version. More...
 
 CompAssembly (const std::string &, IComponent *reference=nullptr)
 Constructor with a name and parent reference. More...
 
void getBoundingBox (BoundingBox &assemblyBox) const override
 Get the bounding box for this component and store it in the given argument. 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
 Returns a vector of all children contained. 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 given name. More...
 
Kernel::V3D getPos () const override
 Gets the absolute position of the Parametrized CompAssembly 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 CompAssembly 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...
 
CompAssemblyoperator= (const CompAssembly &other)
 
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...
 
virtual size_t registerContents (class ComponentVisitor &componentVisitor) const override
 
int remove (IComponent *)
 Remove a component from the assembly. More...
 
void testIntersectionWithChildren (Track &testRay, std::deque< IComponent_const_sptr > &searchQueue) const override
 Test the intersection of the ray with the children of the component assembly, for InstrumentRayTracer
More...
 
std::string type () const override
 String description of the type of component. More...
 
 ~CompAssembly () 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::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...
 

Protected Types

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

Protected Attributes

BoundingBoxm_cachedBoundingBox
 A cached bounding box. More...
 
std::vector< IComponent * > m_children
 the group of child components 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...
 

Private Member Functions

CompAssemblyoperator= (const ICompAssembly &)
 Private copy assignment operator. 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::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...
 

Detailed Description

Class for Assembly of geometric components.

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

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

Definition at line 31 of file CompAssembly.h.

Member Typedef Documentation

◆ comp_it

using Mantid::Geometry::CompAssembly::comp_it = std::vector<IComponent *>::iterator
protected

Iterator type.

Definition at line 33 of file CompAssembly.h.

◆ const_comp_it

using Mantid::Geometry::CompAssembly::const_comp_it = std::vector<IComponent *>::const_iterator
protected

Const iterator type.

Definition at line 34 of file CompAssembly.h.

Constructor & Destructor Documentation

◆ CompAssembly() [1/4]

Mantid::Geometry::CompAssembly::CompAssembly ( )

◆ CompAssembly() [2/4]

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

Constructor for parametrized version.

Constructor for a parametrized CompAssembly.

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

Definition at line 32 of file CompAssembly.cpp.

◆ CompAssembly() [3/4]

Mantid::Geometry::CompAssembly::CompAssembly ( 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 44 of file CompAssembly.cpp.

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

◆ CompAssembly() [4/4]

Mantid::Geometry::CompAssembly::CompAssembly ( const CompAssembly assem)

Copy constructor.

Parameters
assem:: assembly to copy

Definition at line 57 of file CompAssembly.cpp.

◆ ~CompAssembly()

Mantid::Geometry::CompAssembly::~CompAssembly ( )
override

Destructor.

Definition at line 76 of file CompAssembly.cpp.

References m_cachedBoundingBox.

Member Function Documentation

◆ add()

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

◆ addChildren()

void Mantid::Geometry::CompAssembly::addChildren ( IComponent comp)

Add a copy (clone) of a component.

◆ addCopy() [1/2]

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

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 117 of file CompAssembly.cpp.

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

◆ addCopy() [2/2]

int Mantid::Geometry::CompAssembly::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 138 of file CompAssembly.cpp.

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

◆ clone()

IComponent * Mantid::Geometry::CompAssembly::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.

Reimplemented in Mantid::Geometry::GridDetector, Mantid::Geometry::RectangularDetector, and Mantid::Geometry::StructuredDetector.

Definition at line 90 of file CompAssembly.cpp.

References CompAssembly().

◆ getBoundingBox()

void Mantid::Geometry::CompAssembly::getBoundingBox ( BoundingBox assemblyBox) const
overridevirtual

Get the bounding box for this component and store it in the given argument.

Get the bounding box for this assembly.

It is simply the sum of the bounding boxes of its children

Parameters
assemblyBox:: [Out] The resulting bounding box is stored here.

Implements Mantid::Geometry::IComponent.

Reimplemented in Mantid::Geometry::GridDetector, Mantid::Geometry::GridDetector, Mantid::Geometry::RectangularDetector, Mantid::Geometry::StructuredDetector, and Mantid::Geometry::StructuredDetector.

Definition at line 352 of file CompAssembly.cpp.

References Mantid::Geometry::ComponentInfo::boundingBox(), Mantid::Geometry::ParameterMap::componentInfo(), Mantid::Geometry::BoundingBox::grow(), Mantid::Geometry::Component::hasComponentInfo(), Mantid::Geometry::Component::index(), m_cachedBoundingBox, m_children, Mantid::Geometry::Component::m_map, nelements(), and operator[]().

◆ getChild()

std::shared_ptr< IComponent > Mantid::Geometry::CompAssembly::getChild ( const int  i) const
overridevirtual

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

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. Easier to use than the [] operator when you have a pointer

Parameters
i:: The index of the component you want
Returns
m_children[i]
Exceptions
std::runtime_errorif i is not in range

Implements Mantid::Geometry::ICompAssembly.

Reimplemented in Mantid::Geometry::Instrument.

Definition at line 197 of file CompAssembly.cpp.

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

Referenced by Mantid::Geometry::StructuredDetector::getAtXY(), Mantid::Geometry::GridDetector::getAtXYZ(), getChildren(), operator[](), and testIntersectionWithChildren().

◆ getChildren()

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

Returns a vector of all children contained.

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 229 of file CompAssembly.cpp.

References getChild(), and nelements().

Referenced by Mantid::Geometry::Instrument::Instrument().

◆ getComponentByName()

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

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

Find a component by name.

Parameters
cname:: The name of the component. If there are multiple matches, the first one found is returned. If the name contains '/', it will search for the component whose name occurs before the '/' then within that component's assembly, search the component whose name occurs after the '/' and so on with any subsequent '/'. For example to find 'tube020' in 'panel07', one could use the cname 'panel07/tube020', given that tube020 is unique within panel07.
nlevels:: Optional argument to limit number of levels searched. If cname has a '/', then nlevels will apply to each step delimited by the '/'s, rather than the whole search. In particular, nlevels=1, would force cname to be a full path name.
Returns
A shared pointer to the component

Implements Mantid::Geometry::ICompAssembly.

Reimplemented in Mantid::Geometry::GridDetector, and Mantid::Geometry::StructuredDetector.

Definition at line 262 of file CompAssembly.cpp.

References getComponentByName(), and Mantid::Geometry::Component::getName().

Referenced by Mantid::Crystal::CalibrationHelpers::adjustBankPositionsAndSizes(), getComponentByName(), Mantid::Geometry::GridDetector::getComponentByName(), Mantid::Geometry::StructuredDetector::getComponentByName(), Mantid::Geometry::Instrument::getDetectorsInBank(), Mantid::API::ExperimentInfo::readParameterMap(), and Mantid::Crystal::SCDCalibratePanels::saveXmlFile().

◆ getPos()

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

Gets the absolute position of the Parametrized CompAssembly 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 452 of file CompAssembly.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().

Referenced by Mantid::Geometry::Instrument::getBeamDirection(), and Mantid::Geometry::InstrumentDefinitionParser::setLocation().

◆ getRotation()

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

Gets the absolute position of the Parametrized CompAssembly 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 470 of file CompAssembly.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::CompAssembly::nelements ( ) const
overridevirtual

◆ operator=() [1/2]

CompAssembly & Mantid::Geometry::CompAssembly::operator= ( const CompAssembly other)

Definition at line 59 of file CompAssembly.cpp.

References m_cachedBoundingBox, and m_children.

◆ operator=() [2/2]

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

Private copy assignment operator.

◆ operator[]()

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

Get a pointer to the ith component in the assembly.

Overloaded index access operator.

getChild()

Parameters
i:: Element i within the component assembly
Returns
A shared pointer to the ith component
Exceptions
std:runtime_errorif i is out of range

Implements Mantid::Geometry::ICompAssembly.

Definition at line 220 of file CompAssembly.cpp.

References getChild().

Referenced by getBoundingBox().

◆ printChildren()

void Mantid::Geometry::CompAssembly::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 419 of file CompAssembly.cpp.

References nelements().

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

◆ printTree()

void Mantid::Geometry::CompAssembly::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 433 of file CompAssembly.cpp.

References Mantid::Geometry::Component::getName(), nelements(), and printTree().

Referenced by printTree().

◆ registerContents()

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

◆ remove()

int Mantid::Geometry::CompAssembly::remove ( IComponent comp)

Remove a component from the assembly.

Removes a component from the assembly.

The component will be deleted.

Parameters
compThe component to be removed
Returns
The (new) number of components in the assembly
Exceptions
std::runtime_errorif the component is not a child of this assembly

Definition at line 156 of file CompAssembly.cpp.

References Mantid::Geometry::IComponent::getName(), m_children, and Mantid::Geometry::Component::m_map.

Referenced by Mantid::Geometry::Instrument::removeDetector().

◆ testIntersectionWithChildren()

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

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

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.

Reimplemented in Mantid::Geometry::GridDetector, and Mantid::Geometry::RectangularDetector.

Definition at line 397 of file CompAssembly.cpp.

References getChild(), and nelements().

◆ type()

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

String description of the type of component.

Reimplemented from Mantid::Geometry::ICompAssembly.

Reimplemented in Mantid::Geometry::GridDetector, Mantid::Geometry::RectangularDetector, and Mantid::Geometry::StructuredDetector.

Definition at line 38 of file CompAssembly.h.

Member Data Documentation

◆ m_cachedBoundingBox

BoundingBox* Mantid::Geometry::CompAssembly::m_cachedBoundingBox
mutableprotected

◆ m_children

std::vector<IComponent *> Mantid::Geometry::CompAssembly::m_children
protected

the group of child components

Definition at line 98 of file CompAssembly.h.

Referenced by add(), addCopy(), Mantid::Geometry::Instrument::getBoundingBox(), getBoundingBox(), getChild(), nelements(), operator=(), and remove().


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