GemaMesh
The GeMA Mesh Plugin
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
UibhmGemaCellMeshDataGeometry< Hybrid, Vector > Class Template Reference

A class used to provide all the geometric information needed by the topology and query Uibhm classes. It is implemented as a thin wrapper over the GmpGemaMeshData and GmpGemaCellMeshData structures. By using this lower level abstraction than a GmCellMesh, we can avoid some virtual method calls and do some optimizations. More...

#include <uibhmGeometry.h>

Collaboration diagram for UibhmGemaCellMeshDataGeometry< Hybrid, Vector >:
Collaboration graph
[legend]

Public Types

enum  { IsHybrid = Hybrid }
 Saves the used Hybrid template parameter for query by other classes.
 
template<typename U >
using VectorType = Vector< U >
 The vector type used by the mesh.
 
using RealCell = GmpGemaCell< GmCell, GmLuaCell, GmpGemaCellMeshData< Vector >, GM_BAR2, 2, 2 >
 
using ElemMeshBase = GmpMeshBaseDataInterface< GmElementMesh, GmpGemaMeshData< Vector >, GmpGemaCellMeshData< Vector > >
 
using CellMeshBase = GmpMeshBaseDataInterface< GmCellMesh, GmpGemaMeshData< Vector >, GmpGemaCellMeshData< Vector > >
 

Public Member Functions

 UibhmGemaCellMeshDataGeometry (GmCellMesh *mesh)
 
 UibhmGemaCellMeshDataGeometry (GmpGemaMeshData< Vector > *nodeData, GmpGemaCellMeshData< Vector > *cellData)
 Constructor. Receives as parameters the Gema node and cell data structures for this mesh.
 
bool updateCellTypes (int numAddedCells)
 Updates the set of mesh cell templates (types) along with other metadata information assuming that numCells where added to the mesh after the topological structure was built. Assumes that the added cells are the cells with the highest id numbers in the mesh. Returns false on errors, true on success. It is considered an error to add solid elements to a not empty surface mesh. It is also an error to attempt to add elements of a different type to a not Hybrid mesh.
 
int numNodes () const
 Return the number of mesh nodes.
 
int numCells () const
 Return the number of mesh cells (including any 'strange' elements)
 
GmCellcell (int cellId)
 Returns the cell object from its id.
 
bool solid () const
 Returns true if the mesh includes any solid cell (a cell with more than one face)
 
bool hybrid () const
 Returns true if this mesh contains (or supports) hybrid cell types. It will always return true if the mesh includes 'strange' cells, even if all the other common cells are of the same type.
 
bool strange () const
 Returns true if the mesh includes "strange" cells. A surface mesh has strange cells if it includes bar cells while a solid mesh has stange elements if it includes bar or surface cells. Those 'strange' elements make the mesh non-manifold, and are ignored by the topology module.
 
const UibhmGemaTemplate *const * typeTemplates () const
 Returns a vector with GM_NUM_CELL_TYPES entries storing the templates for the used cell types. A vector entry will be NULL it the associated type is not present on the mesh or if it is a strange cell type.
 
void faceVertices (int cellId, int face, QVarLengthArray< int, 10 > &nodeList) const
 Fills nodeList with the set of vertices for the given element's face, where the face is defined by its local index in the element definition. The pre-alloc size of 10 should be enough for any common element type. More...
 
void faceNodes (int cellId, int face, bool mid, QVarLengthArray< int, 10 > &nodeList) const
 Fills nodeList with the set of nodes for the given element's face, where the face is defined by its local index in the element definition. If mid is true, that includes an eventual quadratic mid surface node. If false it will not be accounted. The pre-alloc size of 10 should be enough for any common element type. More...
 
void faceEdgeVertices (int cellId, int face, int edge, int *first, int *last) const
 Returns the pair of vertices for the given element's face edge, where the face is defined by its local index in the element definition and the edge by its local index in the face definition. More...
 
void faceEdgeNodes (int cellId, int face, int edge, QVarLengthArray< int, 4 > &nodeList) const
 Returns the list of nodes for the given element's face edge, where the face is defined by its local index in the element definition and the edge by its local index in the face definition. The list endpoints are the edge vertices. More...
 
int findNodeIndex (int cellId, int v) const
 Given an element and a node belonging to it, returns the local index of this node in the element. Returns -1 if the node was not found. More...
 
int findFaceEdge (int cellId, int face, int v1, int v2) const
 Given an element's face and the oriented pair of (global) vertices of one of that face's edge, searches for the local number of that edge. Returns the edge number or -1 if not found. This method version only searches for v1-->v2 oriented edges. More...
 
int findFaceEdge (int cellId, int face, int *v1, int *v2) const
 Given an element's face and the pair of (global) vertices of one of that face's edge, searches for the local number of that edge. Returns the edge number or -1 if not found. This method version searches for both v1-->v2 and v2-->v1 oriented edges and will, if necessary, swap v1 and v2 to make sure that on return they are oriented in the face order. More...
 
void edgeVertices (int cellId, int edge, int *first, int *last) const
 Returns the pair of vertices for the given element's edge, where the edge is defined by its local index in the element definition. More...
 
void edgeNodes (int cellId, int edge, QVarLengthArray< int, 4 > &nodeList) const
 Returns the list of nodes for the given element's edge, where the edge is defined by its local index in the element definition. More...
 
int numSides (int cellId) const
 Returns the number of sides(edges or faces) for the given element. Returns 0 for strange elements.
 
void sideVertices (int cellId, int side, QVarLengthArray< int, 10 > &nodeList) const
 Returns the set of vertices for the given element's side, where the side is defined by its local (face or edge) index in the element definition.
 
int midCellNode (int cellId) const
 If the element has a mid surface or a mid volume quadratic node, returns the node index. Otherwise, returns -1.
 
bool quadraticMidEdgeNodeAdjacentVertices (int cellId, int localNode, int *v1, int *v2) const
 Given a mid-edge quadratic node defined by its local cell index, returns the pair of (global) vertices of that edge by filling v1 and v2 and returns true. If the local node is a mid-surface node, returns false. Should not be called for vertex nodes or mid-volume nodes.
 
void vertexAdjacentVertices (int cellId, int localNode, QVarLengthArray< int, 4 > &nodeList) const
 Given a local vertex number (a geometry node, NOT a quadratic node), returns the set of global vertices adjacent to the given one by filling nodeList.
 
void vertexAdjacentNodes (int cellId, int localNode, QVarLengthArray< int, 4 > &nodeList) const
 Given a local vertex number (a geometry node, NOT a quadratic node), returns the set of global nodes adjacent to the given one by filling nodeList. If the element is linear, its result is equal to calling vertexAdjacentVertices(). For quadratic elements, returns the adjacent mid-edge nodes instead of the adjacent corner vertices (ignoring mid-edge nodes)
 
const UibhmGemaTemplatett (int cellId) const
 Returns the template type for the given cell. Will return NULL for "strange" cells.
 
int co (int cellId) const
 Returns the offset of the first node stored by the given cell.
 
const int * cn (int cellId) const
 Returns the cell node list.
 

Static Public Member Functions

static size_t encodeEdge (int v1, int v2)
 Encodes the edge definde by v1, v2 into a 64 bits integer number.
 
static void decodeEdge (size_t edge, int *v1, int *v2)
 Decodes the result of an encodeEdge() operation returning both nodes. Since encoded values are always stored with v1 < v2, the returned value might be the encodeEdge() parameters swapped.
 

Public Attributes

GmpGemaMeshData< Vector > * _nodeData
 The mesh node data object.
 
GmpGemaCellMeshData< Vector > * _cellData
 The mesh cell data object.
 
bool _solid
 Flag set to true if the mesh includes solid cells.
 
bool _strange
 Flag set to true if the mesh includes "strange" cells.
 
const UibhmGemaTemplate_typeTemplate
 The type template if the mesh has a single cell type that is not a strange type (not hybrid, not strange). NULL otherwise.
 
const UibhmGemaTemplate_typeTemplateList [GM_NUM_CELL_TYPES]
 A vector storing the template types in use by the mesh, indexed by cell type. Entries corresponding to cell types not present in the mesh or to strange types are filled with NULL. Filled correctly even if _typeTemplate is not NULL.
 

Detailed Description

template<bool Hybrid, template< class > class Vector>
class UibhmGemaCellMeshDataGeometry< Hybrid, Vector >

A class used to provide all the geometric information needed by the topology and query Uibhm classes. It is implemented as a thin wrapper over the GmpGemaMeshData and GmpGemaCellMeshData structures. By using this lower level abstraction than a GmCellMesh, we can avoid some virtual method calls and do some optimizations.

Template parameters are a boolean flag defining if the mesh supports cells with multiple types or a single cell type. The second parameter is the Vector type used by the data classes. Keep in mind that a non hybrid class can not support strange elements.

Member Function Documentation

◆ edgeNodes()

template<bool Hybrid, template< class > class Vector>
void UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::edgeNodes ( int  cellId,
int  edge,
QVarLengthArray< int, 4 > &  nodeList 
) const
inline

Returns the list of nodes for the given element's edge, where the edge is defined by its local index in the element definition.

IMPORTANT: should only be called for non strange elements

◆ edgeVertices()

template<bool Hybrid, template< class > class Vector>
void UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::edgeVertices ( int  cellId,
int  edge,
int *  first,
int *  last 
) const
inline

Returns the pair of vertices for the given element's edge, where the edge is defined by its local index in the element definition.

IMPORTANT: should only be called for non strange elements

◆ faceEdgeNodes()

template<bool Hybrid, template< class > class Vector>
void UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::faceEdgeNodes ( int  cellId,
int  face,
int  edge,
QVarLengthArray< int, 4 > &  nodeList 
) const
inline

Returns the list of nodes for the given element's face edge, where the face is defined by its local index in the element definition and the edge by its local index in the face definition. The list endpoints are the edge vertices.

IMPORTANT: should only be called for non strange elements

◆ faceEdgeVertices()

template<bool Hybrid, template< class > class Vector>
void UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::faceEdgeVertices ( int  cellId,
int  face,
int  edge,
int *  first,
int *  last 
) const
inline

Returns the pair of vertices for the given element's face edge, where the face is defined by its local index in the element definition and the edge by its local index in the face definition.

IMPORTANT: should only be called for non strange elements

◆ faceNodes()

template<bool Hybrid, template< class > class Vector>
void UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::faceNodes ( int  cellId,
int  face,
bool  mid,
QVarLengthArray< int, 10 > &  nodeList 
) const

Fills nodeList with the set of nodes for the given element's face, where the face is defined by its local index in the element definition. If mid is true, that includes an eventual quadratic mid surface node. If false it will not be accounted. The pre-alloc size of 10 should be enough for any common element type.

IMPORTANT: should only be called for non strange elements

◆ faceVertices()

template<bool Hybrid, template< class > class Vector>
void UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::faceVertices ( int  cellId,
int  face,
QVarLengthArray< int, 10 > &  nodeList 
) const

Fills nodeList with the set of vertices for the given element's face, where the face is defined by its local index in the element definition. The pre-alloc size of 10 should be enough for any common element type.

IMPORTANT: should only be called for non strange elements

◆ findFaceEdge() [1/2]

template<bool Hybrid, template< class > class Vector>
int UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::findFaceEdge ( int  cellId,
int  face,
int  v1,
int  v2 
) const

Given an element's face and the oriented pair of (global) vertices of one of that face's edge, searches for the local number of that edge. Returns the edge number or -1 if not found. This method version only searches for v1-->v2 oriented edges.

IMPORTANT: should only be called for non strange elements

◆ findFaceEdge() [2/2]

template<bool Hybrid, template< class > class Vector>
int UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::findFaceEdge ( int  cellId,
int  face,
int *  v1,
int *  v2 
) const

Given an element's face and the pair of (global) vertices of one of that face's edge, searches for the local number of that edge. Returns the edge number or -1 if not found. This method version searches for both v1-->v2 and v2-->v1 oriented edges and will, if necessary, swap v1 and v2 to make sure that on return they are oriented in the face order.

IMPORTANT: should only be called for non strange elements

◆ findNodeIndex()

template<bool Hybrid, template< class > class Vector>
int UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::findNodeIndex ( int  cellId,
int  v 
) const

Given an element and a node belonging to it, returns the local index of this node in the element. Returns -1 if the node was not found.

IMPORTANT: should only be called for non strange elements


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