GemaMesh
The GeMA Mesh Plugin
Loading...
Searching...
No Matches
GmpCellMeshData< Vector > Class Template Reference

Auxiliar structure used to share data between GmpCellMesh and GmpMeshLoader. All fields are public since this is meant to be a sharing mechanism. See also the comments on GmpNodeMeshData. More...

#include <gmpCellMeshData.h>

Inheritance diagram for GmpCellMeshData< Vector >:
Collaboration diagram for GmpCellMeshData< Vector >:

Public Types

using CellPrototype = GmpCell <GmCell, GmLuaCell, GmpCellMeshData<Vector>, GM_BAR2, 2>
 
using GhostCellPrototype = GmpGhostCell<GmCell, GmLuaCell, GmpCellMeshData<Vector>, GM_BAR2, 2>
 

Public Member Functions

 GmpCellMeshData (GmCellMesh *mesh)
 Constructor.
 
 ~GmpCellMeshData ()
 Virtual destructor.
 
void clear (GmCellMesh *mesh)
 Removes all mesh cells + removes all values from cell based value sets, preserving object state so that future cell addition can be made.
 
void releaseMemory (bool clearBoundaryData=true)
 Releases all the memory DIRECTLY owned by the object.
 
GmCellcell (int cellId) const
 Returns a pointer to the given cell object.
 
int * cellPropertiesPtr (int cellId)
 Returns a pointer to the vector region where the property indices for the given cell are stored. Assumes that there are property sets associated with the mesh!
 
int * cellNodesPtr (int offset)
 Returns a pointer to the vector region where the node indices for the given cell are stored.
 
int addCells (GmCellMesh *mesh, int *addedCellsByType, bool allocCells, bool updateValueSets, GmPCR *pcr, const GmLogCategory &logger)
 See comments on addCellsImpl()
 
int addCells (GmCellMesh *mesh, int numCells, int numCellNodes, GmPCR *pcr, const GmLogCategory &logger)
 See comments on addCellsImpl()
 
bool reorderCells (GmPCR *pcr, const QMap< int, int > &partOrigToLocOrder, const QVector< int > &partLocToOrigOrder)
 Reorders cells on the cells vector, nodes on the node incidence vector, properties on the cell properties vector and any pre-loaded cell groups and mesh group sets, according to the renumbering given by the pcr object. If partOrigToLocOrder is not empty (the mesh was partitioned), it gives the mapping from the original model to the partitioned index in the local cell vectors, and partLocToOrigOrder gives the inverse transformation. See further comments on the GmPCR::initCellMapping() documentation.
 
void adjustCellIncidences (GmPCR *pcr, bool ghostSupport)
 Updates cell incidences, translating node indices with the PCR object.
 
bool checkAndCollectStatistics (GmCellMesh *mesh, int *addedCellsByType, int *nAddedCells, int *nAddedNodes, int *maxNumCellNodes, bool *hasSolidElements, const GmLogCategory &logger)
 Helper function to collect statistics about the types in the addedCellsByType vector. It also makes consistency checks about single cell type, hierarchical elements on the mesh and expected coordinate dimension. In case of errors, returns false and logs the error. When checking for single cell type, assumes that _numCells and _cellsByType are consistent.
 
void destroyCellsInRange (int first)
 Calls the cell destructor for any cells in _cells at the range given by first to _numConstructed. If first is equal to _numConstructed, nothing will be done. Adjusts _numConstructed accordingly.
 
void updateCellNodeOffset (GmCell *c, int offset)
 Updates a cell node offset on behalf of the state dumping code.
 
int addCellGroup (QString groupName)
 Add a new cell group.
 
bool addCellsToGroup (int groupId, const QVector< int > &cellIds)
 Add unique cells to the given cell group.
 
bool addCellsToGroup (int groupId, const QVector< QPair< int, int > > &cellIds)
 Add cells to the given cell group from cell ranges.
 
bool cellIsTopologyIndexed (int cellId) const
 Returns true if the mesh has a topology structure and the cell has already been added to that structure.
 
bool buildTopologyStructure (const GmCellMesh *mesh, GmpNodeMeshData< Vector > *nodeData, GmSimulationData *simData, const GmLogCategory &logger)
 Builds the necessary topological structure to allow for topological queries to be performed.
 
void clearTopology ()
 Clears the topology structure.
 
bool topologyMeshChanged ()
 Informs the topological structure that new cells where appended to the mesh.
 
size_t cellMemory () const
 Returns the approximate memory used for storing mesh cells.
 
size_t cellGroupsMemory () const
 Returns the approximate memory used for storing cell groups.
 
size_t cellBoundariesMemory () const
 Returns the approximate memory used for storing cell boundaries.
 
- Public Member Functions inherited from GmpCellMeshDataBase
 GmpCellMeshDataBase (GmCellMesh *mesh)
 Constructor.
 
 ~GmpCellMeshDataBase ()
 Destructor. Clears our entry in the global _meshTable and _meshDataTable.
 
bool hierarchicalElements () const
 Returns true if the mesh uses hierarchical elements, false otherwise.
 
bool setHierarchicalIndex (int p, int q)
 Sets the hierarchical index for this mesh from the given P & Q element orders. Returns false if not possible.
 

Public Attributes

int _numCells
 The total number of cells.
 
int _numActiveCells
 The total number of active cells in the mesh.
 
GmpCellAllocator _cellAllocator
 
int _cellSize
 The allocator function used to instance cell object in-place on the _cells vector.
 
Vector< char > _cells
 The cell vector. Size equal to _numCells * _cellSize. Since the type and size of a cell is only known at runtime, we can't have a Vector of a structured type. Should be accessed through the cell() function.
 
int _numConstructed
 The number of cells in _cells that where effectively in-place constructed (by a call to _cellAllocator). It is different from _numCells only on error situations, but is necessary for the class destructor to correctly destroy the constructed cells on those situations. Its usage implies that all code allocating cells should operate sequentially, leaving no "holes" in the vector.
 
Vector< int > _cellNodeIndices
 The list of cell nodes storing, in order, the set of all cell nodes. Its size is equal to the sum of the products of the number of cells of each type present in the mesh times the number of nodes of each type. The offset stored per cell gives the starting index in this list for the nodes of that cell.
 
QList< GmPropertySet * > _propertySets
 The list of property sets "indexed" by every cell. The order of property sets in this list is the same as the one used in calls to GmCell::propertyIndex()
 
Vector< int > _cellPropertyIndices
 A vector with size equal to _numCells * _propertySets.size() continuously storing the cell's property indices.
 
int _cellsByType [GM_NUM_CELL_TYPES]
 A vector storing the number of cells per cell type.
 
int _activeCellsByType [GM_NUM_CELL_TYPES]
 A vector storing the number of active cells per cell type.
 
bool _singleCellType
 If set to true, the mesh has only one cell type and other types can NOT be added to it.
 
bool _hasSolidElements
 Set to true if there is at least one solid element in _cellsByType.
 
int _maxNumNodes
 The maximum number of nodes among mesh cell types in use by the mesh.
 
int _maxNumGhostNodes
 The maximum number of ghost nodes among mesh cells.
 
int _maxTotalNumNodes
 The maximum number of nodes (common + ghost) among mesh cells.
 
QStringList _cellGroupIds
 A list with available cell group names.
 
QList< int > _numCellsInGroup
 A list with the number of cells in each cell group. Its size should be equal to _cellGroupIds.size()
 
QList< int * > _cellGroupCells
 A list with a vector of cell Ids for each cell group. Its size should be equal to _cellGroupIds.size()
 
QMap< QString, GmCellBoundary * > _boundaryGroups
 A map with the definition of each boundary group associated with the mesh. Map entries are instances of the GmpGemaCellBoundary class.
 
UibhmTopologyBase_topology
 The topology structure, if already built.
 
GmCellMeshTopology_topoQuery
 The query object, if already built.
 
bool _topoBuildError
 Set to true if we tried, unsuccessfully, to build _topology. Reset when the mesh is changed.
 
bool _topoBuildEdgeMap
 Should we build the edge map when building the topology?
 
UibhmTopologyBase::CheckOptions _topoCheckOptions
 Etxra check options when building the topology.
 
GmpCellDataDump< Vector > * _dumper
 The object responsible for state dump operations.
 
- Public Attributes inherited from GmpCellMeshDataBase
int _meshId
 
int _hierarchicalIndex
 The hierarchical order index in _hTable if this mesh has hierarchical elements or -1 if elements are not hierarchical.
 

Private Member Functions

int addCellsImpl (GmCellMesh *mesh, int *addedCellsByType, int numCells, int numCellNodes, bool allocCells, bool updateValueSets, GmPCR *pcr, const GmLogCategory &logger)
 
bool resizeGaussValueSets (GmElementMesh *emesh, int *addedCellsByType, int offset=0)
 Resizes the mesh Gauss attributes + Gauss indices, adding to them the specified number of cells per type. If addedCellsByType is NULL, the new cell types will be obtained directly from the mesh, starting at the given offset.
 
void restoreGaussValueSets (GmElementMesh *emesh, int oldNumCells)
 Reverts Gauss value set sizes to the previous number of cells.
 

Additional Inherited Members

- Static Public Member Functions inherited from GmpCellMeshDataBase
static int hierarchicalOrderIndex (int P, int Q)
 Returns the table index that matches the given hierarchical element P & Q orders or -1 if (P, Q) forms a new order and the internal table already includes GmpCellMeshDataMaxHTypes entries.
 
static int hierarchicalPOrder (int index)
 Returns the P order for hierarchical elements associated with the given index (returned by hierarchicalOrderIndex()), or 0 if elements are not hierarchical.
 
static int hierarchicalQOrder (int index)
 Returns the Q order for hierarchical elements associated with the given index (returned by hierarchicalOrderIndex()), or 0 if elements are not hierarchical.
 
static int newMeshId (GmCellMesh *mesh, GmpCellMeshDataBase *data)
 Returns the next available mesh id, storing mesh in the mesh table at the returned index. If no room exists for a new mesh, returns -1.
 
static GmCellMeshmesh (int meshId)
 Returns the mesh pointer associated with the given mesh id.
 
static GmpCellMeshDataBasemeshData (int meshId)
 Returns the mesh data pointer associated with the given mesh id.
 
- Static Public Attributes inherited from GmpCellMeshDataBase
static QPair< int, int > _hTable [GMP_GEMAMESH_MAX_HTYPES]
 Table storing the set of used orders for hierarchical elements.
 
static int _hTableNumUsedSlots = 0
 The number of used entries in _hTable.
 
static GmCellMesh_meshTable [GMP_GEMAMESH_MAX_NUM_MESHES]
 Table storing the set of created cell meshes.
 
static GmpCellMeshDataBase_meshDataTable [GMP_GEMAMESH_MAX_NUM_MESHES]
 Table storing the set of created cell mesh data objects.
 

Detailed Description

template<template< class > class Vector>
class GmpCellMeshData< Vector >

Auxiliar structure used to share data between GmpCellMesh and GmpMeshLoader. All fields are public since this is meant to be a sharing mechanism. See also the comments on GmpNodeMeshData.

The template parameter defines the kind of vector object used to store per cell data. It can be either GmSingleVector or GmDualVector.

Member Function Documentation

◆ clear()

template<template< class > class Vector>
void GmpCellMeshData< Vector >::clear ( GmCellMesh * mesh)

Removes all mesh cells + removes all values from cell based value sets, preserving object state so that future cell addition can be made.

In the current implementation boundary data is NOT removed from the mesh, although its cell list is cleared. Also, if the mesh has a an associated "full mesh" group set, it will be preserved.

◆ reorderCells()

template<template< class > class Vector>
bool GmpCellMeshData< Vector >::reorderCells ( GmPCR * pcr,
const QMap< int, int > & partOrigToLocOrder,
const QVector< int > & partLocToOrigOrder )

Reorders cells on the cells vector, nodes on the node incidence vector, properties on the cell properties vector and any pre-loaded cell groups and mesh group sets, according to the renumbering given by the pcr object. If partOrigToLocOrder is not empty (the mesh was partitioned), it gives the mapping from the original model to the partitioned index in the local cell vectors, and partLocToOrigOrder gives the inverse transformation. See further comments on the GmPCR::initCellMapping() documentation.

IMPORTANT: Notice that the current implementation ASSUMES that this is being called during the mesh loading process and so, there is no stored pointer to a GmCell anywhere.

Member Data Documentation

◆ _cellSize

template<template< class > class Vector>
int GmpCellMeshData< Vector >::_cellSize

The allocator function used to instance cell object in-place on the _cells vector.

The size of a cell object. Depends on the support for ghost cells or not and whether we are being used as a sub-class by an external plugin or not.


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