Computer Assited Medical Intervention Tool Kit  version 5.0
StructuralComponent Class Reference

A structural component is composed either by cell or by atoms. More...

#include <StructuralComponent.h>

+ Inheritance diagram for StructuralComponent:
+ Collaboration diagram for StructuralComponent:

Public Types

enum  ComposedBy { NOTHING, CELLS, ATOMS }
 What this structural component is made of. More...
 

Public Member Functions

void addStructure (Structure *s, bool check=true)
 Add a Structure in the list (and tells the structure to add this structural component in its list). More...
 
bool addStructureIfNotIn (Structure *s)
 Add a Structure in the list, only if it is not already in (and in this case tells the structure to add this structural component to its list). More...
 
virtual ComposedBy composedBy ()
 return the type of structure composing the structural component: a structural component is either a list of cells or atoms, or of nothing if it is empty (see enum ComposedBy). More...
 
virtual void deleteAllStructures ()
 this method free all the sub-components (i.e. More...
 
StructuralComponentgetAtoms ()
 Return a StructuralComponent with all the atoms of this structural component. More...
 
CellgetCell (unsigned int) const override
 get cell by order number (not cell index) More...
 
double * getColor () const
 Get the color. More...
 
void getColor (double *r, double *g, double *b, double *a) const
 Get the color by its 4 componants r,g,b and a. More...
 
RenderingMode::Mode getMode () const
 get the rendering mode More...
 
unsigned int getNumberOfCells () const override
 get the total nr of cell of the component More...
 
unsigned int getNumberOfStructures () const
 get the number of structures More...
 
StructuralComponentPropertiesgetProperties ()
 get the structural component properties of this SC More...
 
StructuralComponentProperties::Color getStructuralComponentPropertiesColor () const
 Return the color as a code (see StructuralComponentProperties::Color enum) More...
 
StructuregetStructure (const unsigned int) const
 get a structure by its index (fisrt structure is at index 0) More...
 
StructuregetStructureByIndex (const unsigned int)
 get a structure by its unique index More...
 
StructuregetStructureByName (const std::string)
 get a structure by its name More...
 
bool isCompatible (Structure *)
 return true if the given structure is compatible with what composes this structural component. More...
 
bool isInstanceOf (const char *) const override
 return true only if the parameter is equal to "StructuralComponent" More...
 
bool isStructureIn (Structure *s)
 Check if a given structure is present in the list. More...
 
bool isVisible (const RenderingMode::Mode mode) const override
 tell if a specific rendering mode is visible or not More...
 
void plannedNumberOfStructures (const unsigned int)
 optimize the I/O of the std:vector structures. More...
 
virtual void removeStructure (Structure *s)
 Remove a structure from the list (and tells the structure to remove this structural component from its list). More...
 
void setColor (const double r, const double b, const double g)
 Set the new RGB color. More...
 
void setColor (const double r, const double b, const double g, const double a)
 Set the new RGBA color. More...
 
void setColor (const StructuralComponentProperties::Color c)
 Set the new color (using a StructuralComponentProperties::Color enum) More...
 
void setMode (const RenderingMode::Mode)
 set the rendering mode More...
 
void setPhysicalModel (PhysicalModel *) override
 set the physical model (recursively to all cells or to all atoms) More...
 
void setVisible (const RenderingMode::Mode mode, const bool b) override
 set the visibility of a specific rendering mode More...
 
 StructuralComponent (PhysicalModel *)
 Default Constructor. More...
 
 StructuralComponent (PhysicalModel *, std::string)
 constructor that allows one to name the structure. More...
 
 StructuralComponent (PhysicalModel *p, physicalModel::StructuralComponent xmlSC)
 constructor from xml node: try to read and get the parmaters from xml More...
 
void xmlPrint (std::ostream &) const override
 print to an output stream in "pseudo" XML format (do nothing if there are no sub structures). More...
 
 ~StructuralComponent () override
 delete all the structures (call the deleteAllStructures method) More...
 
- Public Member Functions inherited from Component
 Component (PhysicalModel *, std::string n="")
 Default constructor, a component needs to know the PM it is in. More...
 
const std::string getName () const
 get the name of the component More...
 
bool isExclusive () const
 tell if this component is exclusive or not More...
 
void setExclusive (const bool)
 set the exclusive flag More...
 
void setName (const std::string)
 set the name of the component More...
 
virtual ~Component ()
 Virtual destructor needed here as this is an abstract class (pure virtual) More...
 
std::vector< MultiComponent * > getAllParentMultiComponents ()
 get the list of all the Multi Component that are using this Component More...
 
unsigned int getNumberOfParentMultiComponents () const
 get the number of MultiComponent that are using this Component (= nr of parent component) More...
 
MultiComponentgetParentMultiComponent (unsigned int)
 get a particular MultiComponent that is using this Component (a particular parent component) More...
 
void addParentMultiComponent (MultiComponent *)
 add a particular parent MultiComponent in the list More...
 
void removeParentMultiComponent (MultiComponent *)
 remove a particular parent MultiComponent More...
 
PhysicalModelgetPhysicalModel () const
 get the physical model More...
 
PropertiesgetProperties ()
 get the component structural properties (guarantied to be non NULL) More...
 

Protected Attributes

StructuralComponentatomList
 List of all the atoms of this structural component, build the first time. More...
 
std::vector< Structure * > structures
 List of the structure representing this component, all the structure in this list are either all Atom or all Cell (no mix!) More...
 
- Protected Attributes inherited from Component
Propertiesproperties
 

Additional Inherited Members

- Protected Member Functions inherited from Component
void removeFromParents ()
 this tell the parent components that this component is removed from memory. More...
 
void deleteProperties ()
 delete the "properties" pointer and set it to NULL More...
 

Detailed Description

A structural component is composed either by cell or by atoms.

Member Enumeration Documentation

◆ ComposedBy

What this structural component is made of.

Enumerator
NOTHING 

there are no structure yet, so everything is possible

CELLS 

the structural component is made of cells

ATOMS 

the structural component is made of atoms

Constructor & Destructor Documentation

◆ StructuralComponent() [1/3]

StructuralComponent::StructuralComponent ( PhysicalModel p)

Default Constructor.

References atomList, Component::deleteProperties(), and Component::properties.

Referenced by getAtoms(), Cell::getQuadFaces(), and Cell::getTriangleFaces().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StructuralComponent() [2/3]

StructuralComponent::StructuralComponent ( PhysicalModel p,
physicalModel::StructuralComponent  xmlSC 
)

constructor from xml node: try to read and get the parmaters from xml

References atomList, Component::deleteProperties(), plannedNumberOfStructures(), and Component::properties.

+ Here is the call graph for this function:

◆ StructuralComponent() [3/3]

StructuralComponent::StructuralComponent ( PhysicalModel p,
std::string  n 
)

constructor that allows one to name the structure.

References atomList, Component::deleteProperties(), and Component::properties.

+ Here is the call graph for this function:

◆ ~StructuralComponent()

StructuralComponent::~StructuralComponent ( )
override

delete all the structures (call the deleteAllStructures method)

References atomList, deleteAllStructures(), Component::deleteProperties(), and Component::removeFromParents().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStructure()

void StructuralComponent::addStructure ( Structure s,
bool  check = true 
)
inline

Add a Structure in the list (and tells the structure to add this structural component in its list).

Parameters
sthe structure to add
check(default value: true) tell if the method should call isCompatible(Structure *s) before inserting s

References Structure::addStructuralComponent(), isCompatible(), and structures.

Referenced by PhysicalModel::addAtom(), addStructureIfNotIn(), CreateSC::apply(), Cell::Cell(), SofaSimulator::createPml(), SurfaceExtractor::generateExternalSurface(), PMLTransform::generateExternalSurface(), PMLTransform::generateNeighborhood(), Cell::getQuadFaces(), Cell::getTriangleFaces(), PhysicalModel::parseAtoms(), PhysicalModel::parseComponents(), PMLComponentExtension::save(), and GenerateModel::saveMMLFiles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addStructureIfNotIn()

bool StructuralComponent::addStructureIfNotIn ( Structure s)

Add a Structure in the list, only if it is not already in (and in this case tells the structure to add this structural component to its list).

Parameters
sthe structure to add
Returns
a boolean telling if s was added or not

References addStructure(), and isStructureIn().

Referenced by CreateSC::apply(), getAtoms(), and Facet::getCell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ composedBy()

StructuralComponent::ComposedBy StructuralComponent::composedBy ( )
virtual

return the type of structure composing the structural component: a structural component is either a list of cells or atoms, or of nothing if it is empty (see enum ComposedBy).

Reimplemented in Cell.

References ATOMS, CELLS, getNumberOfStructures(), getStructure(), isInstanceOf(), and NOTHING.

Referenced by PMLExplorerWidget::createSCPropertyList(), isCompatible(), PMLComponent::selectSC(), and PhysicalModel::setAtoms().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAllStructures()

void StructuralComponent::deleteAllStructures ( )
virtual

this method free all the sub-components (i.e.

delete all the sub component and clear the list). After this methode getNumberOfSubStructures() should return 0

Reimplemented in Cell.

References structures.

Referenced by ~StructuralComponent().

+ Here is the caller graph for this function:

◆ getAtoms()

StructuralComponent * StructuralComponent::getAtoms ( )

Return a StructuralComponent with all the atoms of this structural component.

If this structural component is already a composed of atoms, return this. If it is composed of cells or mixed atoms and cells, return all the atoms used. Each atom is present only once in the resulting SC.

References addStructureIfNotIn(), atomList, getNumberOfStructures(), Properties::getPhysicalModel(), getStructure(), Structure::isInstanceOf(), Component::properties, and StructuralComponent().

Referenced by SofaSimulator::SofaSimulator().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCell()

Cell * StructuralComponent::getCell ( unsigned int  cellOrderNr) const
overridevirtual

get cell by order number (not cell index)

Implements Component.

References isInstanceOf(), and structures.

Referenced by SurfaceExtractor::generateExternalSurface(), PMLTransform::generateExternalSurface(), PMLTransform::generateNeighborhood(), PMLComponent::parseMultiComponent(), PMLComponentExtension::save(), Cell::surface(), and Cell::volume().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColor() [1/2]

double * StructuralComponent::getColor ( ) const

Get the color.

Returns
an array of 4 doubles (red, blue, green and alpha values)

References Component::properties.

Referenced by PMLComponent::createCellSelectionVTKPipeline(), PMLExplorerWidget::createSCPropertyList(), Cell::xmlPrint(), and xmlPrint().

+ Here is the caller graph for this function:

◆ getColor() [2/2]

void StructuralComponent::getColor ( double *  r,
double *  g,
double *  b,
double *  a 
) const

Get the color by its 4 componants r,g,b and a.

References a, and Component::properties.

◆ getMode()

RenderingMode::Mode StructuralComponent::getMode ( ) const

get the rendering mode

References Component::properties.

◆ getNumberOfCells()

unsigned int StructuralComponent::getNumberOfCells ( ) const
overridevirtual

get the total nr of cell of the component

Implements Component.

References structures.

Referenced by SofaSimulator::createPml(), PMLTransform::generateExternalSurface(), PMLTransform::generateNeighborhood(), Cell::surface(), and Cell::volume().

+ Here is the caller graph for this function:

◆ getNumberOfStructures()

◆ getProperties()

StructuralComponentProperties * StructuralComponent::getProperties ( )
inline

get the structural component properties of this SC

References Component::properties.

Referenced by PMLExplorerWidget::createSCPropertyList().

+ Here is the caller graph for this function:

◆ getStructuralComponentPropertiesColor()

StructuralComponentProperties::Color StructuralComponent::getStructuralComponentPropertiesColor ( ) const

Return the color as a code (see StructuralComponentProperties::Color enum)

References Component::properties.

◆ getStructure()

◆ getStructureByIndex()

Structure * StructuralComponent::getStructureByIndex ( const unsigned int  i)
inline

get a structure by its unique index

References structures.

◆ getStructureByName()

Structure * StructuralComponent::getStructureByName ( const std::string  n)
inline

get a structure by its name

References structures.

◆ isCompatible()

bool StructuralComponent::isCompatible ( Structure s)

return true if the given structure is compatible with what composes this structural component.

E.g. if the structural is made of cell, and the structure is a cell.

References ATOMS, CELLS, composedBy(), Structure::isInstanceOf(), and NOTHING.

Referenced by addStructure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isInstanceOf()

bool StructuralComponent::isInstanceOf ( const char *  className) const
inlineoverridevirtual

return true only if the parameter is equal to "StructuralComponent"

Implements Component.

Referenced by composedBy(), and getCell().

+ Here is the caller graph for this function:

◆ isStructureIn()

bool StructuralComponent::isStructureIn ( Structure s)

Check if a given structure is present in the list.

Parameters
sthe structure to check
Returns
true if and only if the structure is already in the list

References structures.

Referenced by addStructureIfNotIn().

+ Here is the caller graph for this function:

◆ isVisible()

bool StructuralComponent::isVisible ( const RenderingMode::Mode  mode) const
overridevirtual

tell if a specific rendering mode is visible or not

Implements Component.

References Component::properties.

◆ plannedNumberOfStructures()

void StructuralComponent::plannedNumberOfStructures ( const unsigned int  size)
inline

optimize the I/O of the std:vector structures.

If you know the nr of structures to be in the SC, please give it here, it will greatly speed the building of the structure

References structures.

Referenced by Cell::Cell(), PhysicalModel::parseAtoms(), and StructuralComponent().

+ Here is the caller graph for this function:

◆ removeStructure()

void StructuralComponent::removeStructure ( Structure s)
inlinevirtual

Remove a structure from the list (and tells the structure to remove this structural component from its list).

Becareful: this method DOES NOT delete the object and/or free the memory.

Parameters
sthe ptr to the structure to remove

References Structure::removeStructuralComponent(), and structures.

+ Here is the call graph for this function:

◆ setColor() [1/3]

void StructuralComponent::setColor ( const double  r,
const double  b,
const double  g 
)

Set the new RGB color.

References Component::properties.

◆ setColor() [2/3]

void StructuralComponent::setColor ( const double  r,
const double  b,
const double  g,
const double  a 
)

Set the new RGBA color.

References a, and Component::properties.

◆ setColor() [3/3]

void StructuralComponent::setColor ( const StructuralComponentProperties::Color  c)

Set the new color (using a StructuralComponentProperties::Color enum)

References Component::properties.

Referenced by Cell::Cell().

+ Here is the caller graph for this function:

◆ setMode()

void StructuralComponent::setMode ( const RenderingMode::Mode  m)

set the rendering mode

References Component::properties.

Referenced by SofaSimulator::createPml().

+ Here is the caller graph for this function:

◆ setPhysicalModel()

void StructuralComponent::setPhysicalModel ( PhysicalModel pm)
overridevirtual

set the physical model (recursively to all cells or to all atoms)

Reimplemented from Component.

References getNumberOfStructures(), getStructure(), Structure::setPhysicalModel(), and Component::setPhysicalModel().

+ Here is the call graph for this function:

◆ setVisible()

void StructuralComponent::setVisible ( const RenderingMode::Mode  mode,
const bool  b 
)
overridevirtual

set the visibility of a specific rendering mode

Implements Component.

References Component::properties.

◆ xmlPrint()

void StructuralComponent::xmlPrint ( std::ostream &  o) const
overridevirtual

print to an output stream in "pseudo" XML format (do nothing if there are no sub structures).

Implements Component.

References StructuralComponentProperties::DEFAULT, getColor(), getNumberOfStructures(), Component::properties, and structures.

Referenced by PhysicalModel::xmlPrint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ atomList

StructuralComponent* StructuralComponent::atomList
protected

List of all the atoms of this structural component, build the first time.

Return a StructuralComponent is called.

Referenced by getAtoms(), StructuralComponent(), Cell::~Cell(), and ~StructuralComponent().

◆ structures

std::vector<Structure*> StructuralComponent::structures
protected

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