GemaMesh
The GeMA Mesh Plugin
Loading...
Searching...
No Matches
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 GmpCellMeshData structures. By using this lower level abstraction than a GmCellMesh, we can avoid some virtual method calls and do some optimizations. Removing that dependency should be easy enough. More...

#include <uibhmGeometry.h>

Collaboration diagram for UibhmGemaCellMeshDataGeometry< Hybrid, Vector >:

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 NodeData = GmpNodeMeshData<Vector>
 The mesh node data.
 
using CellData = GmpCellMeshData<Vector>
 The mesh cell data.
 

Public Member Functions

 UibhmGemaCellMeshDataGeometry (NodeData *nodeData, CellData *cellData, const GmPCR *pcr)
 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 hasInterface () const
 Returns true if the mesh includes any interface element.
 
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.
 
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.
 
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.
 
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.
 
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. Ignores the possibility of duplicated nodes in the element definition, and in that case, returns the first node ocurrence.
 
int colapsedInterfaceNode (int cellId, int v, int localIndex) const
 Given an element, a node belonging to it and its local index (possibly returned by findNodeIndex()), checks to see if this node is a colapsed node from an interface element (a node whose sibling on an aperture edge is equal to it). If it is, returns the sibling local node. Otherwise, returns -1.
 
int colapsedInterfaceEdge (int cellId, int face, int faceEdge, int refFace) const
 Given an interface element, an aperture face (those shared with other interface elements and not with other regular solid elements) and an edge belonging to that face, checks to see if this face is colapsed into a single edge (the two edges shared by the aperture face with the opposite contact faces are the same). If it is, returns the local edge index (on the given aperture face) for that sibling "twin" edge. Otherwise, returns -1 (this includes returning -1 if the element is not an interface element or if the face is not an aperture face). If refFace is equal to -1, the faceEdge parameter should be the local index of the edge on face. Otherwise, refFace and face should be adjacent faces by faceEdge and faceEdge should be the local index of the edge on refFace.
 
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.
 
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.
 
int findFaceEdgeFromLocalNodes (int cellId, int face, int lv1, int lv2) const
 
int findFaceEdgeFromMidEdgeNode (int cellId, int face, int v) const
 Given a mid edge node from a face edge, finds that edge's index in the face. Returns -1 if not found.
 
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.
 
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.
 
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.
 
void sideNodes (int cellId, int side, QVarLengthArray< int, 10 > &nodeList) const
 Returns the set of nodes for the given element's side, where the side is defined by its local (face or edge) index in the element definition. For faces with mid cell nodes, it will be included and will be the LAST node in the list.
 
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.
 
const GmPCRpcr () const
 Returns the PCR object used for model <--> internal cell and node id conversions.
 

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

NodeData_nodeData
 The mesh node data object.
 
CellData_cellData
 The mesh cell data object.
 
const GmPCR_pcr
 The mesh PCR object to allow for needed model <--> internal cell and node id conversions.
 
bool _solid
 Flag set to true if the mesh includes solid cells.
 
bool _strange
 Flag set to true if the mesh includes "strange" cells.
 
bool _interface
 Flag set to true if the mesh includes interface elements.
 
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 GmpCellMeshData structures. By using this lower level abstraction than a GmCellMesh, we can avoid some virtual method calls and do some optimizations. Removing that dependency should be easy enough.

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

◆ co()

template<bool Hybrid, template< class > class Vector>
int UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::co ( int cellId) const
inline

Returns the offset of the first node stored by the given cell.

Check the documentation on GmpCellMeshData::CellPrototype for an explanation on that cast.

◆ colapsedInterfaceEdge()

template<bool Hybrid, template< class > class Vector>
int UibhmGemaCellMeshDataGeometry< Hybrid, Vector >::colapsedInterfaceEdge ( int cellId,
int face,
int faceEdge,
int refFace ) const

Given an interface element, an aperture face (those shared with other interface elements and not with other regular solid elements) and an edge belonging to that face, checks to see if this face is colapsed into a single edge (the two edges shared by the aperture face with the opposite contact faces are the same). If it is, returns the local edge index (on the given aperture face) for that sibling "twin" edge. Otherwise, returns -1 (this includes returning -1 if the element is not an interface element or if the face is not an aperture face). If refFace is equal to -1, the faceEdge parameter should be the local index of the edge on face. Otherwise, refFace and face should be adjacent faces by faceEdge and faceEdge should be the local index of the edge on refFace.

IMPORTANT: should only be called for non strange elements

◆ colapsedInterfaceNode()

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

Given an element, a node belonging to it and its local index (possibly returned by findNodeIndex()), checks to see if this node is a colapsed node from an interface element (a node whose sibling on an aperture edge is equal to it). If it is, returns the sibling local node. Otherwise, returns -1.

IMPORTANT: should only be called for non strange elements

◆ 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 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

◆ 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 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

◆ 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. Ignores the possibility of duplicated nodes in the element definition, and in that case, returns the first node ocurrence.

A node can appear twice for interface elements with a colapsed aperture edge, or even 3 times if the interface element has extra dof (flow) nodes. If that case needs to be handled, colapsedInterfaceNode() can be of use. IMPORTANT: should only be called for non strange elements


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