Defines an hexahedron cell of a volume mesh. More...
#include <MeshVizXLM/mesh/cell/MbHexahedronCell.h>
Public Member Functions | |
MbHexahedronCell (size_t n0, size_t n1, size_t n2, size_t n3, size_t n4, size_t n5, size_t n6, size_t n7) | |
virtual double | getVolume (const MiGeometryI *meshGeometry) const |
virtual size_t | getNumFacets () const |
virtual size_t | getNumEdges () const |
virtual size_t | getNumNodes () const |
virtual size_t | getNodeIndex (size_t nod) const |
virtual size_t | appendNodesIndexOfFacet (size_t facet, std::vector< size_t > &facetNodes) const |
virtual size_t | appendLocalNodesIndexOfFacet (size_t facet, std::vector< size_t > &facetNodes) const |
virtual void | getIsosurfTopology (unsigned char caseId, std::vector< std::pair< size_t, size_t > > &edgeList) const |
virtual unsigned char | getMarchingCaseId (std::vector< bool > &nodesSign, size_t beginNodeId=0) const |
virtual MbVec3d | getIsoParametricCoord (size_t indexNode) const |
virtual double | getRelativeSize (const MiGeometryI *meshGeometry) const |
virtual bool | isPointInsideCell (const MiGeometryI &meshGeometry, const MbVec3d &point, std::vector< double > &weights) const |
An hexahedron cell has 6 faces which can be in anywhere in the 3D space. Each face is a quadrangle not necessarily a square. The 4 first indices defines the polygon of a face of the hexahedron. The 4 last indices defines the polygon of the opposite face.
Facets and nodes are numbered as following :
n3----------n2 facet 0 = 0123 /| /| facet 1 = 4765 / | / | facet 2 = 0374 / | / | facet 3 = 1562 n7---------n6 | facet 4 = 0451 | | | | facet 5 = 3267 | n0----|-----n1 | / | / | / | / |/ | / n4---------n5
Thus, appendNodesIndexOfFacet(0,faceNodes) appends the first 4 nodes of the cell in the array faceNodes, and appendNodesIndexOfFacet(1,faceNodes) appends the 4 last nodes of the cell in the array faceNodes.
MbHexahedronCell::MbHexahedronCell | ( | size_t | n0, | |
size_t | n1, | |||
size_t | n2, | |||
size_t | n3, | |||
size_t | n4, | |||
size_t | n5, | |||
size_t | n6, | |||
size_t | n7 | |||
) | [inline] |
Construct an hexahedron.
size_t MbHexahedronCell::appendLocalNodesIndexOfFacet | ( | size_t | facet, | |
std::vector< size_t > & | facetNodes | |||
) | const [inline, virtual] |
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.)
[in] | facet | The index of the facet (where 0 <= facet < getNumFacets()). |
facetNodes | A 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. |
Reimplemented from MiVolumeCell.
size_t MbHexahedronCell::appendNodesIndexOfFacet | ( | size_t | facet, | |
std::vector< size_t > & | facetNodes | |||
) | const [inline, virtual] |
Gets the node ids of the given face.
For instance appendNodesIndexOfFacet(0,facetNodes) append in the array facetNodes the node ids of the first face of this cell. the first node id of this cell.
facet | must be in the interval [0-5] because an hexahedrons contains 6 faces. | |
facetNodes | the returned list of facet nodes indices |
Implements MiVolumeCell.
virtual MbVec3d MbHexahedronCell::getIsoParametricCoord | ( | size_t | nodeIndex | ) | const [inline, virtual] |
Gets the iso parametric coordinates of a cell's node.
Only classes defining non linear cells must implement this method.
The interval value of parametric coordinates are usually [0,1] or [-1,+1]. If the application uses interval [0,1], the parametric coordinates returned by this method for linear cell must be either 0 or 1. For quadratic cell, the parametric coordinates must be either 0, 0.5 or 1. (0.5 for intermediate nodes).
See the following image as example of parametric coordinates values for linear and quadratic quadrangle.
parametric coordinates in [-1,+1]
parametric coordinates in [0,1]
This method is not pure virtual because it is not used by all extraction classes. However using an extraction class that uses this method will generate an exception. An application does not need to override this method if no such extraction class is used.
[in] | nodeIndex | The index of the node. |
Reimplemented from MiCell.
virtual void MbHexahedronCell::getIsosurfTopology | ( | unsigned char | caseId, | |
std::vector< std::pair< size_t, size_t > > & | edgeList | |||
) | const [inline, 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 (
caseId | the isosurf "marching cube" entry for this cell. This is the value returned by getMarchingCaseId | |
edgeList | the 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). |
Implements MiVolumeCell.
virtual unsigned char MbHexahedronCell::getMarchingCaseId | ( | std::vector< bool > & | nodesSign, | |
size_t | beginNodeId = 0 | |||
) | const [virtual] |
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).
nodesSign | A 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) . | |
beginNodeId | is the first node id used by the mesh topology. |
Reimplemented from MiVolumeCell.
virtual size_t MbHexahedronCell::getNodeIndex | ( | size_t | nod | ) | const [inline, virtual] |
Gets a node id of this cell.
For instance getNodeIndex(0) returns the first node id of this cell.
nod | must be in the interval [0-7] |
Implements MiCell.
virtual size_t MbHexahedronCell::getNumEdges | ( | ) | const [inline, virtual] |
Gets the number of edges.
virtual size_t MbHexahedronCell::getNumFacets | ( | ) | const [inline, virtual] |
Gets the number of facets.
Implements MiVolumeCell.
virtual size_t MbHexahedronCell::getNumNodes | ( | ) | const [inline, virtual] |
Gets the number of nodes.
Implements MiCell.
virtual double MbHexahedronCell::getRelativeSize | ( | const MiGeometryI * | meshGeometry | ) | const [inline, virtual] |
Gets the relative size of the cell.
This method is used only by the MoMeshCellShape to display node names if using the relative offset feature and the streamline extraction to adapt the step integration to the size of the cell. getRelativeSize() should return a value depending on the size of the cell even if the default implementation returns 1. For instance, getRelativeSize() can return the length of the longest edge of this cell, or the length of its diagonal.
If getRelativeSize() returns a constant value for any cell, the stream line extraction uses a constant number of step integration anywhere in the mesh. Returning a constant implies that all the cells are supposed to have the same size. getRelativeSize() must not return 0.
[in] | meshGeometry | the geometry of the mesh. Used to retrieve the node coordinates of this cell. |
Reimplemented from MiCell.
Reimplemented in MbVoxelCell.
virtual double MbHexahedronCell::getVolume | ( | const MiGeometryI * | meshGeometry | ) | const [inline, virtual] |
Gets the volume of the cell.
Reimplemented in MbVoxelCell.
virtual bool MbHexahedronCell::isPointInsideCell | ( | const MiGeometryI & | meshGeometry, | |
const MbVec3d & | point, | |||
std::vector< double > & | weights | |||
) | const [inline, virtual] |
Checks if a point is inside or outside a cell.
This method is not pure virtual because it is not used by all extraction classes. However using an extraction class that uses this method (i.e. streamline) will generate an exception. An application does not need to override this method if no such extraction class is used.
[in] | meshGeometry | The geometry of the mesh. Used to retrieve the node coordinates of this cell. |
[in] | point | The point to be checked. |
[out] | weights | Must contain at least as many elements as the number of nodes in this cell (see getWeight()). |
weight[i] = wi
Reimplemented from MiCell.