A structural component is composed either by cell or by atoms. More...
#include <StructuralComponent.h>
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... | |
StructuralComponent * | getAtoms () |
Return a StructuralComponent with all the atoms of this structural component. More... | |
Cell * | getCell (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... | |
StructuralComponentProperties * | getProperties () |
get the structural component properties of this SC More... | |
StructuralComponentProperties::Color | getStructuralComponentPropertiesColor () const |
Return the color as a code (see StructuralComponentProperties::Color enum) More... | |
Structure * | getStructure (const unsigned int) const |
get a structure by its index (fisrt structure is at index 0) More... | |
Structure * | getStructureByIndex (const unsigned int) |
get a structure by its unique index More... | |
Structure * | getStructureByName (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... | |
MultiComponent * | getParentMultiComponent (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... | |
PhysicalModel * | getPhysicalModel () const |
get the physical model More... | |
Properties * | getProperties () |
get the component structural properties (guarantied to be non NULL) More... | |
Protected Attributes | |
StructuralComponent * | atomList |
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 | |
Properties * | properties |
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... | |
A structural component is composed either by cell or by atoms.
StructuralComponent::StructuralComponent | ( | PhysicalModel * | p | ) |
Default Constructor.
References atomList, Component::deleteProperties(), and Component::properties.
Referenced by getAtoms(), Cell::getQuadFaces(), and Cell::getTriangleFaces().
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.
StructuralComponent::StructuralComponent | ( | PhysicalModel * | p, |
std::string | n | ||
) |
constructor that allows one to name the structure.
References atomList, Component::deleteProperties(), and Component::properties.
|
override |
delete all the structures (call the deleteAllStructures method)
References atomList, deleteAllStructures(), Component::deleteProperties(), and Component::removeFromParents().
|
inline |
Add a Structure in the list (and tells the structure to add this structural component in its list).
s | the 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().
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).
s | the structure to add |
References addStructure(), and isStructureIn().
Referenced by CreateSC::apply(), getAtoms(), and Facet::getCell().
|
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().
|
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().
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().
|
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().
double * StructuralComponent::getColor | ( | ) | const |
Get the color.
References Component::properties.
Referenced by PMLComponent::createCellSelectionVTKPipeline(), PMLExplorerWidget::createSCPropertyList(), Cell::xmlPrint(), and xmlPrint().
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.
RenderingMode::Mode StructuralComponent::getMode | ( | ) | const |
get the rendering mode
References Component::properties.
|
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().
|
inline |
get the number of structures
References structures.
Referenced by AtomIterator::AtomIterator(), PMLComponent::atomSCToVTK(), PMLExplorerWidget::buildCellTreeWidgetItem(), PMLExplorerWidget::buildStructuralComponentTreeWidgetItem(), MonitorForce::calculate(), MonitorVolume::calculate(), MonitorSurface::calculate(), PMLComponent::cellToVTK(), composedBy(), CreateSC::computeBoundsOfCellIds(), PMLExplorerWidget::createCellPropertyList(), SofaSimulator::createPml(), PMLExplorerWidget::createSCPropertyList(), PhysicalModel::exportAnsysMesh(), PhysicalModel::exportPatran(), SurfaceExtractor::generateExternalSurface(), PMLTransform::generateNeighborhood(), getAtoms(), PhysicalModel::getNumberOfAtoms(), PhysicalModel::optimizeIndexes(), PhysicalModel::parseTree(), PMLComponent::selectCell(), PMLComponent::selectSC(), PhysicalModel::setAtoms(), setPhysicalModel(), SofaSimulator::SofaSimulator(), Cell::surface(), xmlPrint(), and PhysicalModel::xmlPrint().
|
inline |
get the structural component properties of this SC
References Component::properties.
Referenced by PMLExplorerWidget::createSCPropertyList().
StructuralComponentProperties::Color StructuralComponent::getStructuralComponentPropertiesColor | ( | ) | const |
Return the color as a code (see StructuralComponentProperties::Color enum)
References Component::properties.
|
inline |
get a structure by its index (fisrt structure is at index 0)
References structures.
Referenced by SurfaceExtractor::AddCell(), CreateSC::apply(), AtomIterator::AtomIterator(), PMLComponent::atomSCToVTK(), PMLExplorerWidget::buildCellTreeWidgetItem(), PMLExplorerWidget::buildStructuralComponentTreeWidgetItem(), MonitorForce::calculate(), MonitorVolume::calculate(), MonitorSurface::calculate(), PMLComponent::cellToVTK(), composedBy(), CreateSC::computeBoundsOfCellIds(), PhysicalModel::exportAnsysMesh(), PhysicalModel::exportPatran(), SurfaceExtractor::generateExternalSurface(), PMLTransform::generateExternalSurface(), PMLTransform::generateNeighborhood(), PhysicalModel::getAtom(), getAtoms(), Reference::getDistanceToTriangularMesh(), PhysicalModel::getPositionPointer(), Cell::getQuadFaces(), Cell::getTriangleFaces(), Cell::normal(), PhysicalModel::optimizeIndexes(), PhysicalModel::parseTree(), PMLComponent::selectCell(), PMLComponent::selectSC(), PhysicalModel::setAtoms(), setPhysicalModel(), SofaSimulator::SofaSimulator(), Cell::surface(), Simulator::updatePositions(), and Cell::volume().
|
inline |
get a structure by its unique index
References structures.
|
inline |
get a structure by its name
References structures.
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().
|
inlineoverridevirtual |
return true only if the parameter is equal to "StructuralComponent"
Implements Component.
Referenced by composedBy(), and getCell().
bool StructuralComponent::isStructureIn | ( | Structure * | s | ) |
Check if a given structure is present in the list.
s | the structure to check |
References structures.
Referenced by addStructureIfNotIn().
|
overridevirtual |
tell if a specific rendering mode is visible or not
Implements Component.
References Component::properties.
|
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().
|
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.
s | the ptr to the structure to remove |
References Structure::removeStructuralComponent(), and structures.
void StructuralComponent::setColor | ( | const double | r, |
const double | b, | ||
const double | g | ||
) |
Set the new RGB color.
References Component::properties.
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.
void StructuralComponent::setColor | ( | const StructuralComponentProperties::Color | c | ) |
Set the new color (using a StructuralComponentProperties::Color enum)
References Component::properties.
Referenced by Cell::Cell().
void StructuralComponent::setMode | ( | const RenderingMode::Mode | m | ) |
set the rendering mode
References Component::properties.
Referenced by SofaSimulator::createPml().
|
overridevirtual |
set the physical model (recursively to all cells or to all atoms)
Reimplemented from Component.
References getNumberOfStructures(), getStructure(), Structure::setPhysicalModel(), and Component::setPhysicalModel().
|
overridevirtual |
set the visibility of a specific rendering mode
Implements Component.
References Component::properties.
|
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().
|
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().
|
protected |
List of the structure representing this component, all the structure in this list are either all Atom or all Cell (no mix!)
Referenced by addStructure(), Cell::deleteAllStructures(), deleteAllStructures(), getCell(), getNumberOfCells(), getNumberOfStructures(), getStructure(), getStructureByIndex(), getStructureByName(), isStructureIn(), plannedNumberOfStructures(), removeStructure(), Cell::xmlPrint(), and xmlPrint().