Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
PbMesh Class Referenceabstract

MeshViz Defines an abstract mesh. More...

#include <MeshViz/3Ddata/PbMesh.h>

+ Inheritance diagram for PbMesh:

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.
 
PbMeshoperator= (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 SbStringgetValuesSetName (int set_index) const
 Gets the name associated to a scalar values set.
 
virtual const SbStringgetStringsSetName (int set_index) const
 Gets the name associated to a string values set.
 
virtual const SbStringgetVecsSetName (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 SbStringgetStringsSet (int set_index) const
 Gets a set of string values.
 
virtual const SbVec3fgetVecsSet (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 PbCellgetCell (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 PbCellfindContainingCell (const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const
 
virtual const PbCellfindContainingCell (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.
 
PbBaseoperator= (const PbBase &base)
 Assignment operator.
 

Detailed Description

MeshViz Defines an abstract mesh.

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:

If the last argument is_data_duplicate of a constructor of a derived class is FALSE, the geometry and values sets are not copied by the object.

In this case, the methods setGeometry, addValuesSet, addStringsSet and addVecsSet save only the adress of the user data set and it is the application's responsibility to manage the validity of data during the existence of the mesh object.

Definition at line 84 of file PbMesh.h.

Member Enumeration Documentation

◆ DataBinding

Data binding.

Specifies how data is specified (i.e., per cell or per node) for a data set.

Enumerator
PER_CELL 

The data set contains one data value per cell.

PER_NODE 

The data set contains one data value per node.

Definition at line 94 of file PbMesh.h.

Constructor & Destructor Documentation

◆ PbMesh() [1/2]

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() [2/2]

PbMesh::PbMesh ( const PbMesh mesh)

Copy constructor.

◆ ~PbMesh()

PbMesh::~PbMesh ( )

Destructor.

Member Function Documentation

◆ addStringsSet()

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

◆ addValuesSet() [1/2]

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.

Parameters
set_indexthe index of the new set added.
valthe array of values. Its size must be the number of nodes.
set_namestring 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.

◆ addValuesSet() [2/2]

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.

Parameters
set_indexthe index of the new set added.
valthe array of values. Its size must be either the number of nodes or the number of cells depending on the binding argument.
bindingspecifies the location of the values.
set_namestring 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.

◆ addVecsSet()

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

◆ findContainingCell() [1/2]

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.

◆ findContainingCell() [2/2]

virtual const PbCell * PbMesh::findContainingCell ( const SbVec3f point,
float  tolerance,
SbVec3f pcoord,
const PbCell adjacent_cell 
) const
virtual

◆ getAdjacentCellsIndByFacet()

virtual void PbMesh::getAdjacentCellsIndByFacet ( int  cell_index,
PbArrayOfInt adjacent_cells 
) const
virtual

Gets the list of indices of cells that are adjacent (by a facet) to cell_index.

Two cells are adjacent by a facet if they own at least one facet of the mesh in common

Reimplemented in PbGrid2D, PbGrid3D, and PbMesh1D.

◆ getAdjacentCellsIndByNode()

virtual void PbMesh::getAdjacentCellsIndByNode ( int  cell_index,
PbArrayOfInt adjacent_cells 
) const
virtual

Gets the list of indices of cells that are adjacent (by a node) to cell_index.

Two cells are adjacent by a node if they own at least one node of the mesh in common.

Reimplemented in PbGrid2D, PbGrid3D, and PbMesh1D.

◆ getArea()

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.

◆ getBiggestCellBox()

virtual SbBox3f PbMesh::getBiggestCellBox ( int &  cell_index) const
virtual

Gets the biggest cell's bounding box, returns also the index of this cell.

◆ getBoundingBox()

SbBox3f PbMesh::getBoundingBox ( ) const
inline

Gets the bounding box of the mesh.

Definition at line 521 of file PbMesh.h.

◆ getCell()

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.

◆ getCoordinates()

void PbMesh::getCoordinates ( const float *&  xnod,
const float *&  ynod,
const float *&  znod,
int &  size_xnod,
int &  size_ynod,
int &  size_znod 
) const
inlinevirtual

Get the current coordinates of the nodes of this mesh.

Parameters
xnodarray of x coord
ynodarray of y coord
znodarray of z coord
size_xnodsize of the array xnod
size_ynodsize of the array ynod
size_znodsize of the array znod

Reimplemented in PbParalCartesianGrid3D, PbCartesianGrid3D, PbIndexedMesh3D, and PbRegularCartesianGrid3D.

Definition at line 532 of file PbMesh.h.

◆ getMaxValuesSet()

virtual SbBool PbMesh::getMaxValuesSet ( int  set_index,
float &  max 
) const
virtual

Gets the max of a set of scalars.

Returns
FALSE if the scalar set does not exist,
TRUE otherwise.

◆ getMaxVecsSet()

virtual SbBool PbMesh::getMaxVecsSet ( int  set_index,
float &  max 
) const
virtual

Gets the max module of a set of vectors.

Returns
FALSE if the vector set does not exist,
TRUE otherwise.

◆ getMinValuesSet()

virtual SbBool PbMesh::getMinValuesSet ( int  set_index,
float &  min 
) const
virtual

Gets the min of a set of scalars.

Returns
FALSE if the scalar set does not exist,
TRUE otherwise.

◆ getMinVecsSet()

virtual SbBool PbMesh::getMinVecsSet ( int  set_index,
float &  min 
) const
virtual

Gets the min module of a set of vectors.

Returns
FALSE if the vector set does not exist,
TRUE otherwise.

◆ getNodeCoord()

◆ getNodeOwnerCellsInd()

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.

◆ getNodesOwnerCellsInd()

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.

◆ getNumCells()

int PbMesh::getNumCells ( ) const
inline

Gets the number of cells in the mesh.

Definition at line 517 of file PbMesh.h.

◆ getNumNodes()

int PbMesh::getNumNodes ( ) const
inline

Gets the number of nodes in the mesh.

Definition at line 513 of file PbMesh.h.

◆ getNumStringsSet()

virtual int PbMesh::getNumStringsSet ( ) const
virtual

Gets the number of set of string values.

◆ getNumValuesSet()

virtual int PbMesh::getNumValuesSet ( ) const
virtual

Gets the number of set of scalar values.

◆ getNumVecsSet()

virtual int PbMesh::getNumVecsSet ( ) const
virtual

Gets the number of set of vector values.

◆ getSmallestCellBox()

virtual SbBox3f PbMesh::getSmallestCellBox ( int &  cell_index) const
virtual

Gets the smallest cell's bounding box, returns also the index of this cell.

◆ getStringsSet()

virtual const SbString * PbMesh::getStringsSet ( int  set_index) const
virtual

Gets a set of string values.

◆ getStringsSetName()

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.

◆ getValuesBinding()

DataBinding PbMesh::getValuesBinding ( int  set_index) const

Gets the binding of the scalar value set.

Parameters
set_indexthe index of the set of scalar values.
Returns
PER_CELL or PER_NODE, or undefined binding if specified data set does not exist.

◆ getValuesSet()

virtual const float * PbMesh::getValuesSet ( int  set_index) const
virtual

Gets a set of scalar values.

◆ getValuesSetName()

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.

◆ getVecsSet()

virtual const SbVec3f * PbMesh::getVecsSet ( int  set_index) const
virtual

Gets a set of vector values.

◆ getVecsSetName()

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.

◆ getVolume()

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.

◆ isDataDuplicated()

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.

Definition at line 151 of file PbMesh.h.

◆ operator=()

PbMesh & PbMesh::operator= ( const PbMesh mesh)

Assignment operator.

◆ removeAllStringsSet()

virtual void PbMesh::removeAllStringsSet ( )
virtual

Remove all sets of strings values.

◆ removeAllValuesSet()

virtual void PbMesh::removeAllValuesSet ( )
virtual

Remove all sets of scalar values.

◆ removeAllVecsSet()

virtual void PbMesh::removeAllVecsSet ( )
virtual

Remove all sets of vector values.

◆ removeStringsSet()

virtual SbBool PbMesh::removeStringsSet ( int  set_index)
virtual

Remove a set of string values.

Returns
FALSE if the scalar set does not exist,
TRUE otherwise.

◆ removeValuesSet()

virtual SbBool PbMesh::removeValuesSet ( int  set_index)
virtual

Remove a set of scalar values.

Returns
FALSE if the scalar set does not exist,
TRUE otherwise.

◆ removeVecsSet()

virtual SbBool PbMesh::removeVecsSet ( int  set_index)
virtual

Remove a set of vector values.

Returns
FALSE if the vector set does not exist,
TRUE otherwise.

◆ setCoordinates()

void PbMesh::setCoordinates ( const float *  x_nod,
const float *  y_nod,
const float *  z_nod 
)
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.

Definition at line 528 of file PbMesh.h.


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