Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
MiVolumeCell Class Referenceabstract

MeshViz Defines an abstract cell of an unstructured volume mesh. More...

#include <MeshVizXLM/mesh/cell/MiVolumeCell.h>

+ Inheritance diagram for MiVolumeCell:

Public Member Functions

virtual size_t getNumFacets () const =0
 Gets the number of facets.
 
virtual size_t appendNodesIndexOfFacet (size_t facet, std::vector< size_t > &facetNodes) const =0
 Appends the array of node indices belonging to a given facet to facetNode.
 
virtual size_t getSubTriangleNodesIndex (size_t facet, std::vector< size_t > &triangleNodeIds) const
 Get a triangulation of the given facet of a non linear volume cell.
 
virtual size_t getSubTetrahedronNodesIndex (std::vector< size_t > &tetrahedronNodeIds) const
 Get a decomposition in sub-tetrahedra of this volume cell.
 
virtual size_t appendLocalNodesIndexOfFacet (size_t facet, std::vector< size_t > &facetNodes) const
 Appends the array of local node indices belonging to a given facet to facetNodes.
 
virtual void getIsosurfTopology (unsigned char caseId, std::vector< std::pair< size_t, size_t > > &edgeList) const =0
 Gets the list of topological polygons defining the part of the isosurface topology in this cell.
 
virtual unsigned char getMarchingCaseId (std::vector< bool > &nodesSign, size_t beginNodeId=0) const
 Gets the isosurface "marching cube" entry according to the sign of each node in the cell.
 
virtual MbVec3d getFacetCenter (size_t facet, const MiGeometryI &geometry) const
 Gets the center of the specified cell facet.
 
- Public Member Functions inherited from MiCell
virtual ~MiCell ()
 Virtual destructor.
 
virtual size_t getNumNodes () const =0
 Gets the number of nodes.
 
virtual size_t getNodeIndex (size_t node) const =0
 Gets the index (in the mesh) of a node.
 
virtual double getRelativeSize (const MiGeometryI *meshGeometry) const
 Gets the relative size of the cell.
 
virtual void getWeight (const MbVec3d &ipcoord, std::vector< double > &weight) const
 Gets the weights of a point defined by its iso parametric coordinates.
 
virtual MbVec3d getIsoParametricCoord (size_t nodeIndex) const
 Gets the iso parametric coordinates of a cell's node.
 
virtual MbVec3d getCenter (const MiGeometryI &geometry) const
 Gets the center of the cell.
 
virtual bool isPointInsideCell (const MiGeometryI &meshGeometry, const MbVec3d &point, std::vector< double > &weights) const
 Checks if a point is inside or outside a cell.
 

Protected Member Functions

virtual std::ostream & toStream (std::ostream &s) const
 Performs an output operation on a stream which is returned afterward.
 

Detailed Description

MeshViz Defines an abstract cell of an unstructured volume mesh.

A volume cell is a polyhedron element that connects adjacent nodes of a volume mesh.

This class defines additional methods beyond MiCell to gives a complete description of a volume cell.

The methods getSubTriangleNodesIndex() and getSubTetrahedronNodesIndex() are only useful for non linear volume cells and generic polyhedron cells. For the most usual basic volume cells (tetrahedron, hexahedron, wedge, pyramid), the application only needs to implement facet numbering, the isosurface topology, and the methods defined in MiCell.

When the result of getSubTetrahedronNodesIndex() is > 0, the cell is considered to be a non linear cell, or a generic polyhedron cell. In that case, the given sub triangles and sub tetrahedra are used by various extractors (for instance MiSkinExtractUnstructured) and mesh representation classes (for instance MoMeshSkin, MoMeshCellShape). Furthermore if an MiTessellator is given, each sub triangle is tessellated by the method MiTessellator::tessellateSurfaceCell().

The utility classes MxXXXCellExtract can be used to help the application implement the various methods of MiCell and MiVolumeCell. These classes provide static implementations of the necessary methods for the most common linear and quadratic volume cells.

The implementation of all the methods of this class must be thread-safe because it might be called concurrently by multiple threads. If the implementation can't be thread-safe, MeshViz XLM must be forced to use only 1 thread. It can be done by calling MiMeshViz::init(1) or MoMeshViz::init(1) or setting the parallel argument to false for each extractor instantiation. For instance by calling MiSkinExtractUnstructured::getNewInstance(&mesh, false);

See also
MeXVolumeCell
MiVolumeTopologyExplicitI
MiTessellator
MxTetrahedronCellExtract
MxHexahedronCellExtract, MxHexahedron20CellExtract, MxHexahedron27CellExtract
MxWedgeCellExtract, MxWedge18CellExtract
MxPyramidCellExtract

Definition at line 88 of file MiVolumeCell.h.

Member Function Documentation

◆ appendLocalNodesIndexOfFacet()

virtual size_t MiVolumeCell::appendLocalNodesIndexOfFacet ( size_t  facet,
std::vector< size_t > &  facetNodes 
) const
inlinevirtual

Appends the array of local node indices belonging to a given facet to facetNodes.


This method is similar to appendNodesIndexOfFacet() but facetNodes must be filled only with local node ids (i.e. node ids relative to the number of nodes in the cell): 0 <= facetNodes[i] < getNumNodes() for each i.

The method must not include the additional nodes of a non linear cell. For instance an implementation of this method for a linear or quadratic tetrahedron cell like the following one

facetNodes of the pink face of these tetrahedra.

should return 3, and facetNodes should be appended by {0,2,1} if the facet argument corresponds to the pink one. (Provided that getNodeIndex() follows this tetrahedron node numbering.)

Parameters
[in]facetThe index of the facet (where 0 <= facet < getNumFacets()).
facetNodesA vector in which the local node indices of the facet will be appended. The given vector should not be cleared by this method. The implementation must use the push_back() method to add elements to the vector.
Returns
the number of nodes added.

Definition at line 174 of file MiVolumeCell.h.

◆ appendNodesIndexOfFacet()

virtual size_t MiVolumeCell::appendNodesIndexOfFacet ( size_t  facet,
std::vector< size_t > &  facetNodes 
) const
pure virtual

Appends the array of node indices belonging to a given facet to facetNode.


The method must not include the additional nodes of the non linear cell. For instance an implementation of this method for a linear or quadratic tetrahedron cell like the following one

facetNodes of the pink face of these tetrahedra.

should return 3, and facetNodes should be appended by = {node0,node2,node1} if the facet argument corresponds to the pink one. (Provided that getNodeIndex() follows this tetrahedron node numbering.)

Parameters
[in]facetThe index of the facet (where 0 <= facet < getNumFacets()).
facetNodesA vector in which the node indices of the facet will be appended. The given vector should not be cleared by this method. The implementation must use the push_back() method to add elements to the vector.
Returns
the number of nodes appended in facetNodes.

◆ getFacetCenter()

MbVec3d MiVolumeCell::getFacetCenter ( size_t  facet,
const MiGeometryI geometry 
) const
inlinevirtual

Gets the center of the specified cell facet.


This method is not pure virtual because it is not used by all extraction classes. The default implementation provided computes the average of the coordinates of each facet's node.

Parameters
[in]faceta facet id of this cell. It must be < getNumFacets().
[in]geometryThe geometry of the mesh. Used to retrieve the node coordinates of this cell.
Returns
The center of the specified facet.

Definition at line 271 of file MiVolumeCell.h.

◆ getIsosurfTopology()

virtual void MiVolumeCell::getIsosurfTopology ( unsigned char  caseId,
std::vector< std::pair< size_t, size_t > > &  edgeList 
) const
pure virtual

Gets the list of topological polygons defining the part of the isosurface topology in this cell.


This method is used during isosurface and slice extraction on an unstructured mesh (for instance MoMeshPlaneSlice, MoMeshIsosurface, MiIsosurfExtractUnstructured). Static implementations are provided for the most common basic volume cells:

For polyhedral cells and non linear cells (for which no static implementation is available), returning an empty list can produce a hole in the isosurface. To avoid such a hole, this kind of cell must provide a decomposition into sub tetrahedra by the method getSubTetrahedronNodesIndex(). In case of polyhedral cells, one can also simply provide a polyhedral tessellator (

See also
MiTessellator::getNewTessellatorPolyhedron()) to the isosurface extractor. To summarize:
  • For basic cell shape (hexahedron, tetrahedron, wedge, pyramid), implement this method for example by calling MxXXXXCellExtract::getIsosurfTopology() and do not override getSubTetrahedronNodesIndex().
  • Otherwise, implement this method by giving an empty edgeList and either implement getSubTetrahedronNodesIndex() to provide a sub tetrahedra decomposition or for polyhedral cells only, provide a polyhedral tessellator to the isosurface extractor.
Parameters
caseIdthe isosurf "marching cube" entry for this cell. This is the value returned by getMarchingCaseId
edgeListthe list of pairs of nodes defining the isosurface topology in this cell. The given vector should not be cleared by this method. New pairs of node ids are appended to this vector. Each pair of nodes must correspond to an edge of the cell which is cut by the isosurface. An edge is cut by the isosurface when the two nodes of the edge have different signs. The pair of nodes must be correctly ordered to define a non manifold polygon. When the isosurface part is made up of several polygons, extra polygons must be separated by specific pairs (for instance <-1,-1> for mandatory polygons and <-1,0> for optional polygons).

◆ getMarchingCaseId()

unsigned char MiVolumeCell::getMarchingCaseId ( std::vector< bool > &  nodesSign,
size_t  beginNodeId = 0 
) const
inlinevirtual

Gets the isosurface "marching cube" entry according to the sign of each node in the cell.

The return entry corresponds to the first argument of getIsosurfTopology(). This method is used during isosurface and slice extraction on an unstructured mesh (for instance MoMeshPlaneSlice, MoMeshIsosurface, MiIsosurfExtractUnstructured).

Parameters
nodesSignA vector containing as many booleans as the number of nodes in the mesh. nodesSign[i] is relative to the sign of the (isovalue-i-th node's value) .
beginNodeIdis the first node id used by the mesh topology.
See also
MiVolumeTopologyExplicitI::getBeginNodeId.
Returns
a binary word containing as many bits as the number of nodes in the cell. the i-th bit in the returned word equals nodesSign[getNodeIndex(i)].
Note
MeshViz XLM assumes that the cell does not contain any part of an isosurf if and only if the "marching cube" entry equals 0. Thus if all the bits in this word are 1, the method returns 0.

Definition at line 254 of file MiVolumeCell.h.

◆ getNumFacets()

virtual size_t MiVolumeCell::getNumFacets ( ) const
pure virtual

Gets the number of facets.

◆ getSubTetrahedronNodesIndex()

virtual size_t MiVolumeCell::getSubTetrahedronNodesIndex ( std::vector< size_t > &  tetrahedronNodeIds) const
inlinevirtual

Get a decomposition in sub-tetrahedra of this volume cell.


This method must be overridden to correctly handle
non-linear cells. By default it returns 0 and the argument tetrahedronNodeIds is not modified. This method must not be overridden for linear cells.

Parameters
[out]tetrahedronNodeIdssub tetrahedra node id (where: 0 <= tetrahedronNodeIds[i] < getNumNodes() for each i). If the cell is not linear, tetrahedronNodeIds must contain 4 times the number of sub-tetrahedra.
Returns
the number of sub-tetrahedra in this cell. 0 by default.

Definition at line 148 of file MiVolumeCell.h.

◆ getSubTriangleNodesIndex()

virtual size_t MiVolumeCell::getSubTriangleNodesIndex ( size_t  facet,
std::vector< size_t > &  triangleNodeIds 
) const
inlinevirtual

Get a triangulation of the given facet of a non linear volume cell.


This method must be overridden to correctly handle non-linear cells. For instance an implementation of this method for a quadratic tetrahedron like the following one

Triangulation of the pink face of this quadratic tetrahedron.

should return 4, and triangleNodeIds = {3,7,9, 7,0,6, 9,7,6, 9,6,2}. (provided that getNodeIndex() follows this tetrahedron node numbering).

By default the method returns 0 and the argument triangleNodeIds is not modified. It must not be overridden for linear cell.

Parameters
[in]facetnumber of the given facet. (where: 0 <= face < getNumFacets() ).
[out]triangleNodeIdssub triangle node id (where: 0 <= triangleNodeIds[i] < getNumNodes() for each i).
Returns
the number of sub triangles in the facet of the cell.

Definition at line 133 of file MiVolumeCell.h.

◆ toStream()

std::ostream & MiVolumeCell::toStream ( std::ostream &  s) const
inlineprotectedvirtual

Performs an output operation on a stream which is returned afterward.

This method is protected since only called by the output operator <<. This method is not pure virtual and output by default the geometry and topology of a mesh. Whenever a different output is needed, this method can be implemented in the subclass to get a different output format. No std::ostream& operator << needs to be defined in any subclass. This allows you to benefit from the virtual inheritance when using the output operator on an abstract class.

Reimplemented from MiCell.

Definition at line 283 of file MiVolumeCell.h.


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