Computer Assited Medical Intervention Tool Kit  version 5.0
Cell Class Reference

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. More...

#include <Cell.h>

+ Inheritance diagram for Cell:
+ Collaboration diagram for Cell:

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 StructuralComponentgetParentSC ()
 Get the direct parent structural that own this cell. More...
 
CellPropertiesgetProperties ()
 return the property More...
 
StructuralComponentgetQuadFaces ()
 Return a new structural component directly representing the Cell as a list of quad faces (when possible) More...
 
StructuralComponentgetTriangleFaces ()
 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...
 
StructuralComponentgetStructuralComponent (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...
 
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...
 

Private Attributes

StructuralComponentparentSC
 Keep a reference to the direct parent structural component. 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
StructurePropertiesproperties {nullptr}
 Property of the current structure. More...
 
- Protected Attributes inherited from StructuralComponent
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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Cell() [1/3]

Cell::Cell ( PhysicalModel myPM,
const StructureProperties::GeometricType  t 
)

constructor that generates a unique index

Parameters
myPMthe physical model the atom belongs to
tthe type of the cell

References parentSC, and Structure::properties.

Referenced by getQuadFaces(), and getTriangleFaces().

+ Here is the caller graph for this function:

◆ Cell() [2/3]

Cell::Cell ( PhysicalModel myPM,
physicalModel::Cell  xmlCell,
StructuralComponent sc 
)

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

Parameters
myPMthe physical model the atom belongs to
xmlCellthe xml node to read to get the information
scthe direct parent structural component that owns this cell

References a, StructuralComponent::addStructure(), StructureProperties::ATOM, PhysicalModel::getAtom(), StructureProperties::HEXAHEDRON, StructureProperties::INVALID, StructureProperties::LINE, parentSC, StructuralComponent::plannedNumberOfStructures(), StructureProperties::POLY_LINE, StructureProperties::POLY_VERTEX, Structure::properties, StructureProperties::PYRAMID, StructureProperties::QUAD, StructuralComponent::setColor(), StructureProperties::TETRAHEDRON, StructureProperties::TRIANGLE, and StructureProperties::WEDGE.

+ Here is the call graph for this function:

◆ Cell() [3/3]

Cell::Cell ( PhysicalModel myPM,
const StructureProperties::GeometricType  t,
const unsigned int  ind 
)

When you know the index of the cell, use this constructor.

Parameters
myPMthe physical model the atom belongs to
tthe type of the cell
indgive the unique index

References Structure::properties.

◆ ~Cell()

Cell::~Cell ( )
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().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStructuralComponent()

void Cell::addStructuralComponent ( StructuralComponent sc)
inlineoverridevirtual

add a particular StructuralComponent in the list (and set parentSC if null)

Reimplemented from Structure.

References Structure::addStructuralComponent(), and parentSC.

+ Here is the call graph for this function:

◆ composedBy()

Cell::ComposedBy Cell::composedBy ( )
inlineoverridevirtual

overloaded from Structural component, always return StructuralComponent::ATOMS

Reimplemented from StructuralComponent.

References StructuralComponent::ATOMS.

◆ deleteAllStructures()

void Cell::deleteAllStructures ( )
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().

+ Here is the caller graph for this function:

◆ getParentSC()

const StructuralComponent* Cell::getParentSC ( )
inline

Get the direct parent structural that own this cell.

References parentSC.

Referenced by PMLComponent::selectCell().

+ Here is the caller graph for this function:

◆ getProperties()

CellProperties * Cell::getProperties ( )

return the property

References Structure::properties.

Referenced by PMLExplorerWidget::createCellPropertyList(), Reference::getDistanceToTriangularMesh(), getQuadFaces(), getTriangleFaces(), normal(), surface(), and volume().

+ Here is the caller graph for this function:

◆ getQuadFaces()

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.

+ Here is the call graph for this function:

◆ getTriangleFaces()

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().

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

◆ isInstanceOf()

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

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

Implements Structure.

◆ makePrintData()

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 PhysicalModel::optimizeIndexes(), and xmlPrint().

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

◆ normal()

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().

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

◆ setIndex()

bool Cell::setIndex ( const unsigned int  index)
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.

Returns
true only if the index of the structure was changed

Reimplemented from Structure.

References PhysicalModel::addGlobalIndexCellPair(), Component::getPhysicalModel(), and Structure::setIndex().

Referenced by PhysicalModel::optimizeIndexes(), and PMLComponent::parseMultiComponent().

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

◆ signedVolumeTriangle()

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.

See also
Zhang, C., and Chen, T., Efficient feature extraction for 2D/3D objects in mesh representation
Parameters
p1position of Triangle Atom
p2position of Triangle Atom
p3position of Triangle Atom
Returns
double a signed volume

Referenced by volume().

+ Here is the caller graph for this function:

◆ surface()

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().

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

◆ 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().

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

◆ xmlPrint()

void Cell::xmlPrint ( std::ostream &  o,
const StructuralComponent sc 
)
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(), Structure::properties, Component::properties, and StructuralComponent::structures.

+ Here is the call graph for this function:

Member Data Documentation

◆ parentSC

StructuralComponent* Cell::parentSC
private

Keep a reference to the direct parent structural component.

Referenced by addStructuralComponent(), Cell(), and getParentSC().


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