Defines an abstract mesh. More...
#include <MeshViz/3Ddata/PbMesh.h>
Public Types | |
enum | DataBinding { PER_CELL = PoMeshProperty::PER_CELL, PER_NODE = PoMeshProperty::PER_NODE } |
Public Member Functions | |
PbMesh (SbBool is_data_duplicated=TRUE) | |
PbMesh (const PbMesh &mesh) | |
~PbMesh () | |
PbMesh & | operator= (const PbMesh &mesh) |
int | getNumNodes () const |
int | getNumCells () const |
virtual SbVec3f | getNodeCoord (int nod_index) const =0 |
SbBox3f | getBoundingBox () const |
SbBool | isDataDuplicated () const |
virtual void | addValuesSet (int set_index, const float *val, const SbString &set_name="") |
void | addValuesSet (int set_index, const float *val, DataBinding binding, const SbString &set_name="") |
DataBinding | getValuesBinding (int set_index) const |
virtual void | addStringsSet (int set_index, const SbString *val, const SbString &set_name="") |
virtual void | addVecsSet (int set_index, const SbVec3f *val, const SbString &set_name="") |
virtual const SbString * | getValuesSetName (int set_index) const |
virtual const SbString * | getStringsSetName (int set_index) const |
virtual const SbString * | getVecsSetName (int set_index) const |
virtual const float * | getValuesSet (int set_index) const |
virtual const SbString * | getStringsSet (int set_index) const |
virtual const SbVec3f * | getVecsSet (int set_index) const |
virtual SbBool | removeValuesSet (int set_index) |
virtual SbBool | removeStringsSet (int set_index) |
virtual SbBool | removeVecsSet (int set_index) |
virtual void | removeAllValuesSet () |
virtual void | removeAllStringsSet () |
virtual void | removeAllVecsSet () |
virtual int | getNumValuesSet () const |
virtual int | getNumStringsSet () const |
virtual int | getNumVecsSet () const |
virtual SbBool | getMinValuesSet (int set_index, float &min) const |
virtual SbBool | getMinVecsSet (int set_index, float &min) const |
virtual SbBool | getMaxValuesSet (int set_index, float &max) const |
virtual SbBool | getMaxVecsSet (int set_index, float &max) const |
virtual void | getNodeOwnerCellsInd (int nod_index, PbArrayOfInt &owner_cells) const =0 |
virtual void | getNodesOwnerCellsInd (const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const |
virtual void | getAdjacentCellsIndByNode (int cell_index, PbArrayOfInt &adjacent_cells) const |
virtual void | getAdjacentCellsIndByFacet (int cell_index, PbArrayOfInt &adjacent_cells) const |
virtual const PbCell * | getCell (int cell_index) const =0 |
virtual SbBox3f | getSmallestCellBox (int &cell_index) const |
virtual SbBox3f | getBiggestCellBox (int &cell_index) const |
virtual float | getVolume () const =0 |
virtual float | getArea () const =0 |
virtual const PbCell * | findContainingCell (const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const |
virtual const PbCell * | findContainingCell (const SbVec3f &point, float tolerance, SbVec3f &pcoord) const |
virtual void | setCoordinates (const float *x_nod, const float *y_nod, const float *z_nod) |
virtual void | getCoordinates (const float *&xnod, const float *&ynod, const float *&znod, int &size_xnod, int &size_ynod, int &size_znod) const |
A mesh is a set of nodes linked by edges. A mesh can be a surface mesh (see PbMesh2D) or a volume mesh (see PbMesh3D). A surface mesh can be either 2D (its nodes have 2 coordinates) or 3D (its nodes have 3 coordinates). Each node is referred to by an index named node_index.
A mesh is composed of a list of cells. A cell is a "simple" basic volume or surface element that connects adjacent nodes of the mesh. Surface meshes can be defined by triangles, quadrangles and polygonal cells. Volume meshes can be defined by tetrahedrons, hexahedrons, prisms, or pyramid cells. A cell is defined by the list of nodes (node indices) that it connects. The order of the nodes that define a cell is the same for each cell in the mesh. Each cell is referred to by an index named cell_index.
A list of value-set can be defined. A value is a scalar (float), string, or a vector. Each value is located on mesh node, so the number of values in a set must be equal to the number of mesh's nodes. Each set of values can be named by a string.
A scalar value set is used to color the representations of the mesh. A string value set is used by some charting representations. A vector value set is used to make "hedgehog" vector field representations, or streamline representations. Each data-set is referred by an index named set_index. This index is used by classes of mesh representation to indicate which value set must be used for coloring. (see PoMesh::valuesIndex and PoMesh::vecsIndex). Mapping a scalar value onto a color is done by PbDataMapping or PoDataMapping classes (and derived).
Data duplication:
enum PbMesh::DataBinding |
PbMesh::PbMesh | ( | SbBool | is_data_duplicated = TRUE |
) |
Constructor.
If the argument is_data_duplicate is FALSE, the geometry and values sets are not copied by the object.
PbMesh::PbMesh | ( | const PbMesh & | mesh | ) |
Copy constructor.
PbMesh::~PbMesh | ( | ) |
Destructor.
virtual void PbMesh::addStringsSet | ( | int | set_index, | |
const SbString * | val, | |||
const SbString & | set_name = "" | |||
) | [virtual] |
Adds a set of string values .
The number of string in a set must be equal to the number of nodes in the mesh. The set can be optionally named (set_name parameter).
void PbMesh::addValuesSet | ( | int | set_index, | |
const float * | val, | |||
DataBinding | binding, | |||
const SbString & | set_name = "" | |||
) |
Adds a set of scalar values that can be located either at nodes or at cells.
Warning: At this time, the PER_CELL data binding is taken into account only by the following classes:
The other classes use inherited coloring mode when the PER_CELL binding is used.
set_index | the index of the new set added. | |
val | the array of values. Its size must be either the number of nodes or the number of cells depending on the binding argument. | |
binding | specifies the location of the values. | |
set_name | string associated with this set of values. |
NOTE: This method must be called after a setGeometry method because the size of the argument val is determined by the number of nodes in the mesh. The setGeometry methods are defined in subclasses of PbMesh.
virtual void PbMesh::addValuesSet | ( | int | set_index, | |
const float * | val, | |||
const SbString & | set_name = "" | |||
) | [virtual] |
Adds a set of scalar values.
The values are located at nodes so the number of values in a set must be equal to the number of nodes in the mesh.
set_index | the index of the new set added. | |
val | the array of values. Its size must be the number of nodes. | |
set_name | string associated with this set of values. |
NOTE: This method must be called after a setGeometry method because the size of the argument val is determined by the number of nodes in the mesh. The setGeometry methods are defined in subclasses of PbMesh.
virtual void PbMesh::addVecsSet | ( | int | set_index, | |
const SbVec3f * | val, | |||
const SbString & | set_name = "" | |||
) | [virtual] |
Adds a set of vector values .
The number of values in a set must be equal to the number of nodes in the mesh. The set can be optionally named (set_name parameter).
virtual const PbCell* PbMesh::findContainingCell | ( | const SbVec3f & | point, | |
float | tolerance, | |||
SbVec3f & | pcoord | |||
) | const [virtual] |
Find the cell that contains the point.
If the (optional) adjacent cell is given, searching the containing cell starts by the cells around this adjacent one. Returns also the parametric coordinates of the point in the found cell. Parametric coordinates are the coordinates of the point relative to a topological equivalent unit cell. A point is inside a cell if its parametric coordinates range from 0 to 1. However we use a test with a tolerance value : a point is inside the cell if its parametric coordinates p verify -tolerance <= p <= 1+tolerance. Parametric coordinates are useful to interpolate the value in the cell (see PbCell::getValue). Attention! This method returns always the same address of an internal private cell. This private cell is updated each time findContainingCell is called.
Reimplemented in PbMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbRegularCartesianGrid2D, and PbRegularCartesianGrid3D.
virtual const PbCell* PbMesh::findContainingCell | ( | const SbVec3f & | point, | |
float | tolerance, | |||
SbVec3f & | pcoord, | |||
const PbCell * | adjacent_cell | |||
) | const [virtual] |
Reimplemented in PbMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbRegularCartesianGrid2D, and PbRegularCartesianGrid3D.
virtual void PbMesh::getAdjacentCellsIndByFacet | ( | int | cell_index, | |
PbArrayOfInt & | adjacent_cells | |||
) | const [virtual] |
virtual void PbMesh::getAdjacentCellsIndByNode | ( | int | cell_index, | |
PbArrayOfInt & | adjacent_cells | |||
) | const [virtual] |
virtual float PbMesh::getArea | ( | ) | const [pure virtual] |
Gets the area of the mesh.
Returns always 0 for a volume mesh
Implemented in PbMesh1D, PbMesh2D, PbMesh3D, PbParalCartesianGrid2D, and PbRegularCartesianGrid2D.
virtual SbBox3f PbMesh::getBiggestCellBox | ( | int & | cell_index | ) | const [virtual] |
Gets the biggest cell's bounding box, returns also the index of this cell.
SbBox3f PbMesh::getBoundingBox | ( | ) | const [inline] |
Gets the bounding box of the mesh.
Reimplemented in PbMesh2D.
virtual const PbCell* PbMesh::getCell | ( | int | cell_index | ) | const [pure virtual] |
Gets the cell with index cell_index.
Returns NULL if the cell does not exist. Attention! this method returns always the same adress of an internal private cell. This private cell is updated each time getCell is called.
Implemented in PbCartesianGrid2D, PbCartesianGrid3D, PbHexahedronMesh3D, PbIndexedMesh2D, PbIndexedMesh3D, PbMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbPolarGrid2D, PbQuadrangleMesh2D, PbRegularCartesianGrid2D, PbRegularCartesianGrid3D, PbTetrahedronMesh3D, and PbTriangleMesh2D.
void PbMesh::getCoordinates | ( | const float *& | xnod, | |
const float *& | ynod, | |||
const float *& | znod, | |||
int & | size_xnod, | |||
int & | size_ynod, | |||
int & | size_znod | |||
) | const [inline, virtual] |
Get the current coordinates of the nodes of this mesh.
xnod | array of x coord | |
ynod | array of y coord | |
znod | array of z coord | |
size_xnod | size of the array xnod | |
size_ynod | size of the array ynod | |
size_znod | size of the array znod |
Reimplemented in PbCartesianGrid3D, PbIndexedMesh3D, PbParalCartesianGrid3D, and PbRegularCartesianGrid3D.
virtual SbBool PbMesh::getMaxValuesSet | ( | int | set_index, | |
float & | max | |||
) | const [virtual] |
Gets the max of a set of scalars.
virtual SbBool PbMesh::getMaxVecsSet | ( | int | set_index, | |
float & | max | |||
) | const [virtual] |
Gets the max module of a set of vectors.
virtual SbBool PbMesh::getMinValuesSet | ( | int | set_index, | |
float & | min | |||
) | const [virtual] |
Gets the min of a set of scalars.
virtual SbBool PbMesh::getMinVecsSet | ( | int | set_index, | |
float & | min | |||
) | const [virtual] |
Gets the min module of a set of vectors.
virtual SbVec3f PbMesh::getNodeCoord | ( | int | nod_index | ) | const [pure virtual] |
Gets the coordinates of a node.
Implemented in PbCartesianGrid2D, PbCartesianGrid3D, PbGrid2D, PbGrid3D, PbIndexedMesh2D, PbIndexedMesh3D, PbIrregularMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbPolarGrid2D, PbRegularCartesianGrid2D, PbRegularCartesianGrid3D, and PbRegularMesh1D.
virtual void PbMesh::getNodeOwnerCellsInd | ( | int | nod_index, | |
PbArrayOfInt & | owner_cells | |||
) | const [pure virtual] |
Gets the list of indices of cells that own the node "nod_index".
Implemented in PbGrid2D, PbGrid3D, PbIndexedMesh2D, PbIndexedMesh3D, and PbMesh1D.
virtual void PbMesh::getNodesOwnerCellsInd | ( | const PbArrayOfInt & | nod_indices, | |
PbArrayOfInt & | owner_cells | |||
) | const [virtual] |
Gets the list of indices of cells that own the list of nodes "nod_indices".
"nod_indices" can be the list of indices of a facet, an edge... For example, if "nod_indices" contains the 2 indices of the edge's nodes, getNodesOwnerCellsInd returns the list of cell's that own this edge.
Reimplemented in PbHexahedronMesh3D, PbMesh1D, PbQuadrangleMesh2D, PbTetrahedronMesh3D, and PbTriangleMesh2D.
int PbMesh::getNumCells | ( | ) | const [inline] |
Gets the number of cells in the mesh.
int PbMesh::getNumNodes | ( | ) | const [inline] |
Gets the number of nodes in the mesh.
virtual int PbMesh::getNumStringsSet | ( | ) | const [virtual] |
Gets the number of set of string values.
virtual int PbMesh::getNumValuesSet | ( | ) | const [virtual] |
Gets the number of set of scalar values.
virtual int PbMesh::getNumVecsSet | ( | ) | const [virtual] |
Gets the number of set of vector values.
virtual SbBox3f PbMesh::getSmallestCellBox | ( | int & | cell_index | ) | const [virtual] |
Gets the smallest cell's bounding box, returns also the index of this cell.
virtual const SbString* PbMesh::getStringsSet | ( | int | set_index | ) | const [virtual] |
Gets a set of string values.
virtual const SbString* PbMesh::getStringsSetName | ( | int | set_index | ) | const [virtual] |
Gets the name associated to a string values set.
NULL is returned if the set does not exist.
DataBinding PbMesh::getValuesBinding | ( | int | set_index | ) | const |
Gets the binding of the scalar value set.
set_index | the index of the set of scalar values. |
virtual const float* PbMesh::getValuesSet | ( | int | set_index | ) | const [virtual] |
Gets a set of scalar values.
virtual const SbString* PbMesh::getValuesSetName | ( | int | set_index | ) | const [virtual] |
Gets the name associated to a scalar values set.
NULL is returned if the set does not exist.
virtual const SbVec3f* PbMesh::getVecsSet | ( | int | set_index | ) | const [virtual] |
Gets a set of vector values.
virtual const SbString* PbMesh::getVecsSetName | ( | int | set_index | ) | const [virtual] |
Gets the name associated to a vec values set.
NULL is returned if the set does not exist.
virtual float PbMesh::getVolume | ( | ) | const [pure virtual] |
Gets the volume of the mesh.
Returns always 0 for a surface mesh
Implemented in PbMesh1D, PbMesh2D, PbMesh3D, PbParalCartesianGrid3D, and PbRegularCartesianGrid3D.
SbBool PbMesh::isDataDuplicated | ( | ) | const [inline] |
Returns TRUE if mesh's data are duplicated, FALSE otherwise.
If the data are not duplicated, the method addValuesSet, addStringsSet, addVecsSet save only the adress of the user data set. In this case, it user's responsibility to check the validity of data during the existence of the PbMesh object.
Assignment operator.
Reimplemented from PbBase.
Reimplemented in PbCartesianGrid2D, PbCartesianGrid3D, PbGrid2D, PbGrid3D, PbHexahedronMesh3D, PbIndexedMesh2D, PbIndexedMesh3D, PbIrregularMesh1D, PbMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbPolarGrid2D, PbQuadrangleMesh2D, PbRegularCartesianGrid2D, PbRegularCartesianGrid3D, PbRegularMesh1D, PbTetrahedronMesh3D, and PbTriangleMesh2D.
virtual void PbMesh::removeAllStringsSet | ( | ) | [virtual] |
Remove all sets of strings values.
virtual void PbMesh::removeAllValuesSet | ( | ) | [virtual] |
Remove all sets of scalar values.
virtual void PbMesh::removeAllVecsSet | ( | ) | [virtual] |
Remove all sets of vector values.
virtual SbBool PbMesh::removeStringsSet | ( | int | set_index | ) | [virtual] |
Remove a set of string values.
virtual SbBool PbMesh::removeValuesSet | ( | int | set_index | ) | [virtual] |
Remove a set of scalar values.
virtual SbBool PbMesh::removeVecsSet | ( | int | set_index | ) | [virtual] |
Remove a set of vector values.
void PbMesh::setCoordinates | ( | const float * | x_nod, | |
const float * | y_nod, | |||
const float * | z_nod | |||
) | [inline, virtual] |
Set new node coordinates without modifying the mesh topology.
For performance reasons, this method should be called instead of setGeometry when doing a mesh deformation animation.
Reimplemented in PbCartesianGrid3D, PbIndexedMesh3D, PbParalCartesianGrid3D, and PbRegularCartesianGrid3D.