A cell has an unique index in the physical model object, is composed by atoms, and different basic properties. More...
#include <Cell.h>
Public Member Functions | |
void | addStructuralComponent (StructuralComponent *) override |
add a particular StructuralComponent in the list (and set parentSC if null) More... | |
Cell (PhysicalModel *myPM, const StructureProperties::GeometricType t) | |
constructor that generates a unique index More... | |
Cell (PhysicalModel *myPM, const StructureProperties::GeometricType t, const unsigned int ind) | |
When you know the index of the cell, use this constructor. More... | |
Cell (PhysicalModel *myPM, physicalModel::Cell xmlCell, StructuralComponent *sc) | |
constructor from xml node: try to read and get the parameters from xml More... | |
StructuralComponent::ComposedBy | composedBy () override |
overloaded from Structural component, always return StructuralComponent::ATOMS More... | |
void | deleteAllStructures () override |
This method overload the one defined in StructuralComponent. More... | |
const StructuralComponent * | getParentSC () |
Get the direct parent structural that own this cell. More... | |
CellProperties * | getProperties () |
return the property More... | |
StructuralComponent * | getQuadFaces () |
Return a new structural component directly representing the Cell as a list of quad faces (when possible) More... | |
StructuralComponent * | getTriangleFaces () |
Return a new structural component directly representing the Cell as a list of triangular faces (when possible) More... | |
bool | isInstanceOf (const char *) const override |
return true only if the parameter is equal to "MultiComponent" More... | |
bool | makePrintData (const StructuralComponent *) |
is this sc the one that will be the one that will make the cell to print out all its data or is this a sc that will just print out the cell ref? More... | |
double * | normal () |
compute the normal of the facet Warning : Only available for QUAD and TRIANGLE type cells More... | |
bool | setIndex (const unsigned int) override |
set the index. More... | |
double | signedVolumeTriangle (double p1[3], double p2[3], double p3[3]) |
Compute the volume of a triangle with the origin of the coordinate system. More... | |
double | surface () |
Compute the surface of the cell. More... | |
double | volume () |
Compute the volume of the cell. More... | |
void | xmlPrint (std::ostream &, const StructuralComponent *) override |
print to an output stream in "pseudo" XML format. More... | |
~Cell () override | |
the destructor, my tailor. BECAREFUL: the atoms should not not be deleted here... More... | |
Public Member Functions inherited from Structure | |
std::vector< StructuralComponent * > | getAllStructuralComponents () |
get the list of all the StructuralComponent that are using this structure More... | |
unsigned int | getIndex () const |
get the structure unique index (stored in its property) More... | |
std::string | getName () const |
get the name of the structure More... | |
unsigned int | getNumberOfStructuralComponents () const |
get the number of StructuralComponent that are using this structure More... | |
StructuralComponent * | getStructuralComponent (unsigned int i) |
get a particular StructuralComponent that is using this structure More... | |
StructureProperties::GeometricType | getType () const |
get the type of index More... | |
void | removeStructuralComponent (StructuralComponent *) |
remove a particular StructuralComponent from the list More... | |
void | setName (std::string) |
set the name of the structure More... | |
virtual void | setPhysicalModel (PhysicalModel *) |
set the physical model More... | |
Structure () | |
Base constructor. More... | |
virtual | ~Structure ()=default |
Virtual destructor needed here as this is an abstract class (pure virtual) More... | |
Public Member Functions inherited from StructuralComponent | |
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... | |
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... | |
Additional Inherited Members | |
Public Types inherited from StructuralComponent | |
enum | ComposedBy { NOTHING , CELLS , ATOMS } |
What this structural component is made of. More... | |
Public Attributes inherited from Structure | |
bool | hasIndex |
indicate if the Structure has an index (which is not the case all the time) More... | |
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... | |
Protected Attributes inherited from Structure | |
StructureProperties * | properties {nullptr} |
Property of the current structure. More... | |
Protected Attributes inherited from StructuralComponent | |
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 |
A cell has an unique index in the physical model object, is composed by atoms, and different basic properties.
It is the most basic component composing a physical model.
Cell::Cell | ( | PhysicalModel * | myPM, |
const StructureProperties::GeometricType | t | ||
) |
constructor that generates a unique index
myPM | the physical model the atom belongs to |
t | the type of the cell |
References Structure::properties.
Referenced by getQuadFaces(), and getTriangleFaces().
Cell::Cell | ( | PhysicalModel * | myPM, |
physicalModel::Cell | xmlCell, | ||
StructuralComponent * | sc | ||
) |
constructor from xml node: try to read and get the parameters from xml
myPM | the physical model the atom belongs to |
xmlCell | the xml node to read to get the information |
sc | the direct parent structural component that owns this cell |
References a, StructuralComponent::addStructure(), StructureProperties::ATOM, PhysicalModel::getAtom(), StructureProperties::HEXAHEDRON, StructureProperties::INVALID, StructureProperties::LINE, StructuralComponent::plannedNumberOfStructures(), StructureProperties::POLY_LINE, StructureProperties::POLY_VERTEX, Structure::properties, StructureProperties::PYRAMID, StructureProperties::QUAD, StructuralComponent::setColor(), StructureProperties::TETRAHEDRON, StructureProperties::TRIANGLE, and StructureProperties::WEDGE.
Cell::Cell | ( | PhysicalModel * | myPM, |
const StructureProperties::GeometricType | t, | ||
const unsigned int | ind | ||
) |
When you know the index of the cell, use this constructor.
myPM | the physical model the atom belongs to |
t | the type of the cell |
ind | give the unique index |
References Structure::properties.
|
override |
the destructor, my tailor. BECAREFUL: the atoms should not not be deleted here...
References StructuralComponent::atomList, deleteAllStructures(), Component::deleteProperties(), Structure::properties, and Component::removeFromParents().
|
inlineoverridevirtual |
add a particular StructuralComponent in the list (and set parentSC if null)
Reimplemented from Structure.
References Structure::addStructuralComponent().
|
inlineoverridevirtual |
overloaded from Structural component, always return StructuralComponent::ATOMS
Reimplemented from StructuralComponent.
References StructuralComponent::ATOMS.
|
overridevirtual |
This method overload the one defined in StructuralComponent.
The difference here is that the atoms composing the cell ARE NOT delete, still the list is cleared. After a call to this method getNumberOfSubStructures() should return 0
Reimplemented from StructuralComponent.
References a, and StructuralComponent::structures.
Referenced by ~Cell().
|
inline |
Get the direct parent structural that own this cell.
Referenced by PMLComponent::selectCell().
CellProperties * Cell::getProperties | ( | ) |
return the property
References Structure::properties.
Referenced by Reference::getDistanceToTriangularMesh(), getQuadFaces(), getTriangleFaces(), normal(), surface(), and volume().
StructuralComponent * Cell::getQuadFaces | ( | ) |
Return a new structural component directly representing the Cell as a list of quad faces (when possible)
References StructuralComponent::addStructure(), Cell(), Component::getPhysicalModel(), getProperties(), StructuralComponent::getStructure(), Structure::getType(), StructureProperties::HEXAHEDRON, StructureProperties::QUAD, StructuralComponent::StructuralComponent(), and StructureProperties::WEDGE.
StructuralComponent * Cell::getTriangleFaces | ( | ) |
Return a new structural component directly representing the Cell as a list of triangular faces (when possible)
References StructuralComponent::addStructure(), Cell(), Component::getPhysicalModel(), getProperties(), StructuralComponent::getStructure(), Structure::getType(), StructureProperties::HEXAHEDRON, StructureProperties::QUAD, StructuralComponent::StructuralComponent(), StructureProperties::TETRAHEDRON, StructureProperties::TRIANGLE, and StructureProperties::WEDGE.
Referenced by surface(), and volume().
|
inlineoverridevirtual |
return true only if the parameter is equal to "MultiComponent"
Implements Structure.
bool Cell::makePrintData | ( | const StructuralComponent * | sc | ) |
is this sc the one that will be the one that will make the cell to print out all its data or is this a sc that will just print out the cell ref?
References Structure::getNumberOfStructuralComponents(), Structure::getStructuralComponent(), and Component::isExclusive().
Referenced by xmlPrint().
double * Cell::normal | ( | ) |
compute the normal of the facet Warning : Only available for QUAD and TRIANGLE type cells
References getProperties(), StructuralComponent::getStructure(), Structure::getType(), StructureProperties::QUAD, and StructureProperties::TRIANGLE.
Referenced by surface(), and volume().
|
overridevirtual |
set the index.
The index have to be unique otherwise this method has no effect. The sub-classes method will check that this index is not in use.
Reimplemented from Structure.
References PhysicalModel::addGlobalIndexCellPair(), Component::getPhysicalModel(), and Structure::setIndex().
double Cell::signedVolumeTriangle | ( | double | p1[3], |
double | p2[3], | ||
double | p3[3] | ||
) |
Compute the volume of a triangle with the origin of the coordinate system.
If the triangle is A,B,C it computes the volume of the tetrahedron OABC.
Referenced by volume().
double Cell::surface | ( | ) |
Compute the surface of the cell.
References StructuralComponent::getCell(), StructuralComponent::getNumberOfCells(), StructuralComponent::getNumberOfStructures(), getProperties(), StructuralComponent::getStructure(), getTriangleFaces(), Structure::getType(), normal(), surface(), and StructureProperties::TRIANGLE.
Referenced by MonitorSurface::calculate(), surface(), and volume().
double Cell::volume | ( | ) |
Compute the volume of the cell.
References StructuralComponent::getCell(), StructuralComponent::getNumberOfCells(), getProperties(), StructuralComponent::getStructure(), getTriangleFaces(), Structure::getType(), normal(), StructureProperties::QUAD, signedVolumeTriangle(), surface(), and StructureProperties::TRIANGLE.
Referenced by MonitorVolume::calculate().
|
overridevirtual |
print to an output stream in "pseudo" XML format.
If the StructuralComponent that calls this method is not the first in the list of composing SC, then a cellRef tag is printed (otherwise the list of atom is printed).
Implements Structure.
References StructuralComponentProperties::DEFAULT, StructuralComponent::getColor(), Structure::getIndex(), makePrintData(), Component::properties, Structure::properties, and StructuralComponent::structures.