Computer Assisted Medical Intervention Tool Kit  version 5.2
 
Loading...
Searching...
No Matches
Cell Class Reference

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)
 
 Cell (PhysicalModel *myPM, const StructureProperties::GeometricType t)
 constructor that generates a unique index
 
 Cell (PhysicalModel *myPM, const StructureProperties::GeometricType t, const unsigned int ind)
 When you know the index of the cell, use this constructor.
 
 Cell (PhysicalModel *myPM, physicalModel::Cell xmlCell, StructuralComponent *sc)
 constructor from xml node: try to read and get the parameters from xml
 
StructuralComponent::ComposedBy composedBy () override
 overloaded from Structural component, always return StructuralComponent::ATOMS
 
void deleteAllStructures () override
 This method overload the one defined in StructuralComponent.
 
const StructuralComponentgetParentSC ()
 Get the direct parent structural that own this cell.
 
CellPropertiesgetProperties ()
 return the property
 
StructuralComponentgetQuadFaces ()
 Return a new structural component directly representing the Cell as a list of quad faces (when possible)
 
StructuralComponentgetTriangleFaces ()
 Return a new structural component directly representing the Cell as a list of triangular faces (when possible)
 
bool isInstanceOf (const char *) const override
 return true only if the parameter is equal to "MultiComponent"
 
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?
 
double * normal ()
 compute the normal of the facet Warning : Only available for QUAD and TRIANGLE type cells
 
bool setIndex (const unsigned int) override
 set the index.
 
double signedVolumeTriangle (double p1[3], double p2[3], double p3[3])
 Compute the volume of a triangle with the origin of the coordinate system.
 
double surface ()
 Compute the surface of the cell.
 
double volume ()
 Compute the volume of the cell.
 
void xmlPrint (std::ostream &, const StructuralComponent *) override
 print to an output stream in "pseudo" XML format.
 
 ~Cell () override
 the destructor, my tailor. BECAREFUL: the atoms should not not be deleted here...
 
- Public Member Functions inherited from Structure
std::vector< StructuralComponent * > getAllStructuralComponents ()
 get the list of all the StructuralComponent that are using this structure
 
unsigned int getIndex () const
 get the structure unique index (stored in its property)
 
std::string getName () const
 get the name of the structure
 
unsigned int getNumberOfStructuralComponents () const
 get the number of StructuralComponent that are using this structure
 
StructuralComponentgetStructuralComponent (unsigned int i)
 get a particular StructuralComponent that is using this structure
 
StructureProperties::GeometricType getType () const
 get the type of index
 
void removeStructuralComponent (StructuralComponent *)
 remove a particular StructuralComponent from the list
 
void setName (std::string)
 set the name of the structure
 
virtual void setPhysicalModel (PhysicalModel *)
 set the physical model
 
 Structure ()
 Base constructor.
 
virtual ~Structure ()=default
 Virtual destructor needed here as this is an abstract class (pure virtual)
 
- 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).
 
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).
 
StructuralComponentgetAtoms ()
 Return a StructuralComponent with all the atoms of this structural component.
 
CellgetCell (unsigned int) const override
 get cell by order number (not cell index)
 
double * getColor () const
 Get the color.
 
void getColor (double *r, double *g, double *b, double *a) const
 Get the color by its 4 componants r,g,b and a.
 
RenderingMode::Mode getMode () const
 get the rendering mode
 
unsigned int getNumberOfCells () const override
 get the total nr of cell of the component
 
unsigned int getNumberOfStructures () const
 get the number of structures
 
StructuralComponentPropertiesgetProperties ()
 get the structural component properties of this SC
 
StructuralComponentProperties::Color getStructuralComponentPropertiesColor () const
 Return the color as a code (see StructuralComponentProperties::Color enum)
 
StructuregetStructure (const unsigned int) const
 get a structure by its index (fisrt structure is at index 0)
 
StructuregetStructureByIndex (const unsigned int)
 get a structure by its unique index
 
StructuregetStructureByName (const std::string)
 get a structure by its name
 
bool isCompatible (Structure *)
 return true if the given structure is compatible with what composes this structural component.
 
bool isInstanceOf (const char *) const override
 return true only if the parameter is equal to "StructuralComponent"
 
bool isStructureIn (Structure *s)
 Check if a given structure is present in the list.
 
bool isVisible (const RenderingMode::Mode mode) const override
 tell if a specific rendering mode is visible or not
 
void plannedNumberOfStructures (const unsigned int)
 optimize the I/O of the std:vector structures.
 
virtual void removeStructure (Structure *s)
 Remove a structure from the list (and tells the structure to remove this structural component from its list).
 
void setColor (const double r, const double b, const double g)
 Set the new RGB color.
 
void setColor (const double r, const double b, const double g, const double a)
 Set the new RGBA color.
 
void setColor (const StructuralComponentProperties::Color c)
 Set the new color (using a StructuralComponentProperties::Color enum)
 
void setMode (const RenderingMode::Mode)
 set the rendering mode
 
void setPhysicalModel (PhysicalModel *) override
 set the physical model (recursively to all cells or to all atoms)
 
void setVisible (const RenderingMode::Mode mode, const bool b) override
 set the visibility of a specific rendering mode
 
 StructuralComponent (PhysicalModel *)
 Default Constructor.
 
 StructuralComponent (PhysicalModel *, std::string)
 constructor that allows one to name the structure.
 
 StructuralComponent (PhysicalModel *p, physicalModel::StructuralComponent xmlSC)
 constructor from xml node: try to read and get the parmaters from xml
 
void xmlPrint (std::ostream &) const override
 print to an output stream in "pseudo" XML format (do nothing if there are no sub structures).
 
 ~StructuralComponent () override
 delete all the structures (call the deleteAllStructures method)
 
- Public Member Functions inherited from Component
 Component (PhysicalModel *, std::string n="")
 Default constructor, a component needs to know the PM it is in.
 
const std::string getName () const
 get the name of the component
 
bool isExclusive () const
 tell if this component is exclusive or not
 
void setExclusive (const bool)
 set the exclusive flag
 
void setName (const std::string)
 set the name of the component
 
virtual ~Component ()
 Virtual destructor needed here as this is an abstract class (pure virtual)
 
std::vector< MultiComponent * > getAllParentMultiComponents ()
 get the list of all the Multi Component that are using this Component
 
unsigned int getNumberOfParentMultiComponents () const
 get the number of MultiComponent that are using this Component (= nr of parent component)
 
MultiComponentgetParentMultiComponent (unsigned int)
 get a particular MultiComponent that is using this Component (a particular parent component)
 
void addParentMultiComponent (MultiComponent *)
 add a particular parent MultiComponent in the list
 
void removeParentMultiComponent (MultiComponent *)
 remove a particular parent MultiComponent
 
PhysicalModelgetPhysicalModel () const
 get the physical model
 
PropertiesgetProperties ()
 get the component structural properties (guarantied to be non NULL)
 

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)
 
- Protected Member Functions inherited from Component
void removeFromParents ()
 this tell the parent components that this component is removed from memory.
 
void deleteProperties ()
 delete the "properties" pointer and set it to NULL
 
- Protected Attributes inherited from Structure
StructurePropertiesproperties {nullptr}
 Property of the current structure.
 
- Protected Attributes inherited from StructuralComponent
StructuralComponentatomList
 List of all the atoms of this structural component, build the first time.
 
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!)
 
- 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 Structure::properties.

◆ Cell() [2/3]

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

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

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

◆ 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, Structure::removeStructuralComponent(), and StructuralComponent::structures.

Referenced by ~Cell().

◆ getParentSC()

const StructuralComponent * Cell::getParentSC ( )
inline

Get the direct parent structural that own this cell.

Referenced by PMLComponent::selectCell().

◆ getProperties()

CellProperties * Cell::getProperties ( )

◆ getQuadFaces()

◆ getTriangleFaces()

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

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

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

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

◆ surface()

◆ volume()

◆ 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(), Component::properties, Structure::properties, and StructuralComponent::structures.


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