Defines an abstract mesh. More...
#include <MeshViz/3Ddata/PbMesh.h>
Public Types | |
enum | DataBinding { PER_CELL = PoMeshProperty::PER_CELL , PER_NODE = PoMeshProperty::PER_NODE } |
Data binding. More... | |
Public Member Functions | |
PbMesh (SbBool is_data_duplicated=TRUE) | |
Constructor. | |
PbMesh (const PbMesh &mesh) | |
Copy constructor. | |
~PbMesh () | |
Destructor. | |
PbMesh & | operator= (const PbMesh &mesh) |
Assignment operator. | |
int | getNumNodes () const |
Gets the number of nodes in the mesh. | |
int | getNumCells () const |
Gets the number of cells in the mesh. | |
virtual SbVec3f | getNodeCoord (int nod_index) const =0 |
Gets the coordinates of a node. | |
SbBox3f | getBoundingBox () const |
Gets the bounding box of the mesh. | |
SbBool | isDataDuplicated () const |
Returns TRUE if mesh's data are duplicated, FALSE otherwise. | |
virtual void | addValuesSet (int set_index, const float *val, const SbString &set_name="") |
Adds a set of scalar values. | |
void | 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. | |
DataBinding | getValuesBinding (int set_index) const |
Gets the binding of the scalar value set. | |
virtual void | addStringsSet (int set_index, const SbString *val, const SbString &set_name="") |
Adds a set of string values . | |
virtual void | addVecsSet (int set_index, const SbVec3f *val, const SbString &set_name="") |
Adds a set of vector values . | |
virtual const SbString * | getValuesSetName (int set_index) const |
Gets the name associated to a scalar values set. | |
virtual const SbString * | getStringsSetName (int set_index) const |
Gets the name associated to a string values set. | |
virtual const SbString * | getVecsSetName (int set_index) const |
Gets the name associated to a vec values set. | |
virtual const float * | getValuesSet (int set_index) const |
Gets a set of scalar values. | |
virtual const SbString * | getStringsSet (int set_index) const |
Gets a set of string values. | |
virtual const SbVec3f * | getVecsSet (int set_index) const |
Gets a set of vector values. | |
virtual SbBool | removeValuesSet (int set_index) |
Remove a set of scalar values. | |
virtual SbBool | removeStringsSet (int set_index) |
Remove a set of string values. | |
virtual SbBool | removeVecsSet (int set_index) |
Remove a set of vector values. | |
virtual void | removeAllValuesSet () |
Remove all sets of scalar values. | |
virtual void | removeAllStringsSet () |
Remove all sets of strings values. | |
virtual void | removeAllVecsSet () |
Remove all sets of vector values. | |
virtual int | getNumValuesSet () const |
Gets the number of set of scalar values. | |
virtual int | getNumStringsSet () const |
Gets the number of set of string values. | |
virtual int | getNumVecsSet () const |
Gets the number of set of vector values. | |
virtual SbBool | getMinValuesSet (int set_index, float &min) const |
Gets the min of a set of scalars. | |
virtual SbBool | getMinVecsSet (int set_index, float &min) const |
Gets the min module of a set of vectors. | |
virtual SbBool | getMaxValuesSet (int set_index, float &max) const |
Gets the max of a set of scalars. | |
virtual SbBool | getMaxVecsSet (int set_index, float &max) const |
Gets the max module of a set of vectors. | |
virtual void | getNodeOwnerCellsInd (int nod_index, PbArrayOfInt &owner_cells) const =0 |
Gets the list of indices of cells that own the node "nod_index". | |
virtual void | getNodesOwnerCellsInd (const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const |
Gets the list of indices of cells that own the list of nodes "nod_indices". | |
virtual void | getAdjacentCellsIndByNode (int cell_index, PbArrayOfInt &adjacent_cells) const |
Gets the list of indices of cells that are adjacent (by a node) to cell_index. | |
virtual void | getAdjacentCellsIndByFacet (int cell_index, PbArrayOfInt &adjacent_cells) const |
Gets the list of indices of cells that are adjacent (by a facet) to cell_index. | |
virtual const PbCell * | getCell (int cell_index) const =0 |
Gets the cell with index cell_index. | |
virtual SbBox3f | getSmallestCellBox (int &cell_index) const |
Gets the smallest cell's bounding box, returns also the index of this cell. | |
virtual SbBox3f | getBiggestCellBox (int &cell_index) const |
Gets the biggest cell's bounding box, returns also the index of this cell. | |
virtual float | getVolume () const =0 |
Gets the volume of the mesh. | |
virtual float | getArea () const =0 |
Gets the area of the mesh. | |
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 |
Find the cell that contains the point. | |
virtual void | setCoordinates (const float *x_nod, const float *y_nod, const float *z_nod) |
Set new node coordinates without modifying the mesh topology. | |
virtual void | getCoordinates (const float *&xnod, const float *&ynod, const float *&znod, int &size_xnod, int &size_ynod, int &size_znod) const |
Get the current coordinates of the nodes of this mesh. | |
Public Member Functions inherited from PbBase | |
void | enableConnection (SbBool flag) |
Activates/deactivates the mechanism of connection. | |
SbBool | isConnectionEnabled () const |
Returns TRUE if the connection mechanism is active, otherwise FALSE. | |
void | touch () |
Simulates the changing of an instance of this object, so all connected objects are informed of this change. | |
PbBase & | operator= (const PbBase &base) |
Assignment operator. | |
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 |
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 |
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).
|
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.
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 |
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 |
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 |
Reimplemented in PbMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbRegularCartesianGrid2D, and PbRegularCartesianGrid3D.
|
virtual |
|
virtual |
|
pure virtual |
Gets the area of the mesh.
Returns always 0 for a volume mesh
Implemented in PbMesh1D, PbMesh2D, PbMesh3D, PbParalCartesianGrid2D, and PbRegularCartesianGrid2D.
|
virtual |
Gets the biggest cell's bounding box, returns also the index of this cell.
|
inline |
|
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.
|
inlinevirtual |
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 PbParalCartesianGrid3D, PbCartesianGrid3D, PbIndexedMesh3D, and PbRegularCartesianGrid3D.
|
virtual |
Gets the max of a set of scalars.
|
virtual |
Gets the max module of a set of vectors.
|
virtual |
Gets the min of a set of scalars.
|
virtual |
Gets the min module of a set of vectors.
|
pure virtual |
Gets the coordinates of a node.
Implemented in PbCartesianGrid2D, PbCartesianGrid3D, PbIndexedMesh2D, PbIndexedMesh3D, PbIrregularMesh1D, PbParalCartesianGrid2D, PbParalCartesianGrid3D, PbPolarGrid2D, PbRegularCartesianGrid2D, PbRegularCartesianGrid3D, PbRegularMesh1D, PbGrid2D, and PbGrid3D.
|
pure virtual |
Gets the list of indices of cells that own the node "nod_index".
Implemented in PbGrid2D, PbGrid3D, PbIndexedMesh2D, PbIndexedMesh3D, and PbMesh1D.
|
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.
|
inline |
|
inline |
|
virtual |
Gets the number of set of string values.
|
virtual |
Gets the number of set of scalar values.
|
virtual |
Gets the number of set of vector values.
|
virtual |
Gets the smallest cell's bounding box, returns also the index of this cell.
|
virtual |
Gets a set of string values.
|
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 |
Gets a set of scalar values.
|
virtual |
Gets the name associated to a scalar values set.
NULL is returned if the set does not exist.
|
virtual |
Gets a set of vector values.
|
virtual |
Gets the name associated to a vec values set.
NULL is returned if the set does not exist.
|
pure virtual |
Gets the volume of the mesh.
Returns always 0 for a surface mesh
Implemented in PbMesh1D, PbMesh2D, PbMesh3D, PbParalCartesianGrid3D, and PbRegularCartesianGrid3D.
|
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.
|
virtual |
Remove all sets of strings values.
|
virtual |
Remove all sets of scalar values.
|
virtual |
Remove all sets of vector values.
|
virtual |
Remove a set of string values.
|
virtual |
Remove a set of scalar values.
|
virtual |
Remove a set of vector values.
|
inlinevirtual |
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 PbIndexedMesh3D, PbCartesianGrid3D, PbParalCartesianGrid3D, and PbRegularCartesianGrid3D.