GemaMesh
The GeMA Mesh Plugin
Classes | Macros | Functions
gmpCellBase.h File Reference

Declaration of the GmpCellBase class. More...

#include <gmElement.h>
#include <gmMesh.h>
#include <assert.h>
#include <gmPropertySet.h>
#include <gmCellMesh.h>
#include <gmLuaCell.h>
#include <luaProxy.h>
#include <QVarLengthArray>
#include "gmpCellMeshData.h"
Include dependency graph for gmpCellBase.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  GmpCellBase< Base, Proxy, CellMeshData, T, N, VN >
 Class for storing cell data, implementing the virtual functions needed to store per cell type data, number of nodes and properties. The cell id and active information is NOT stored by this class (it is stored by GmpCellBaseWithId). More...
 
class  GmpCellBaseWithId< Base, Proxy, CellMeshData, T, N, VN >
 Adds cell id and active information to a GmpCellBase class. More...
 
class  GmpGhostCellBase< CellBase, Base, Proxy, CellMeshData, T, N, VN >
 Template class used to add ghost node support to template class CellBase. More...
 
class  GmpHElementBase< H >
 An auxiliar class that can be used as the base class for GmpCellBase for Hierarchical elements. The template parameter is the index used by GmpCellMeshData to retrieve the element order information without the need to store that information in a per-element basis. More...
 

Macros

#define GM_CELLBASE_ACTIVE_MASK   (~(~0u >> 1))
 Mask with 1 on the MSB to tell if the cell is active (MSB = 0) or not (MSB = 1) More...
 
#define GM_CELLBASE_MESH_MASK   ((~(~0u >> GMP_GEMAMESH_CELL_MESH_BITS)) >> 1)
 Mask with 1 on bits 29, 30 and 31. Used to extract the mesh index from the top id bits (taking into account that bit 32 is used for marking the cell as active or not)
 
#define GM_CELLBASE_CELL_MASK   (~(GM_CELLBASE_ACTIVE_MASK | GM_CELLBASE_MESH_MASK))
 Mask with 1 on bits representing the cell id part (least significant bits up to the mesh mask).
 
#define CREATE_CELL(type, nn, nv)   new T<Base, Proxy, CellMeshData, type, nn, nv>(mesh, meshId, id, offset)
 
#define CREATE_CELL(i, type, nn, nv)   new T<GmpHElementBase<i>, GmLuaHElement, CellMeshData, type, nn, nv>(mesh, meshId, id, offset)
 

Functions

static bool GmpCellIsActive (int cellId)
 Returns true if the given index is an active cell index, false if not. Inactive cells have their most significant bit set to 1.
 
static int GmpCellMakeActive (int cellId)
 Returns the encoded cell id with the flag set to represent an active cell.
 
static int GmpCellMakeInactive (int cellId)
 Returns the encoded cell id with the flag set to represent an inactive cell.
 
static int GmpCellSetActiveFlag (int cellId, bool active)
 Returns the encoded cell id to represent an active/inactive cell dep3ending on the second parameter.
 
static int GmpCellMeshIndex (int cellId)
 Returns the mesh index encoded in a cell id.
 
static int GmpCellIndex (int cellId)
 Returns the cell index encoded in a cell id.
 
static int GmpCellUpdateMeshIndex (int id, int oldId)
 Returns the value of id with the mesh bits updated with the mesh from oldId.
 
static int GmpCellEncodeId (int cellIndex, int meshIndex, bool active)
 Encodes the given cell index, mesh index and active flag into a cell id.
 
template<template< class, class, class, GmCellType, int, int > class T, class Base , class Proxy , class CellMeshData >
GmCellGmpCellFactory (GmCellMesh *mesh, int meshId, GmCellType type, int hindex, int id, int offset)
 A factory function for allocating cell objects. More...
 
template<template< class, class, class, GmCellType, int, int > class T, class CellMeshData >
GmCellGmpHElementFactory (GmCellMesh *mesh, int meshId, GmCellType type, int hindex, int id, int offset)
 An alternative version to GmpCellFactory() for creating hierarchical elements.
 

Detailed Description

Declaration of the GmpCellBase class.

Author
Carlos Augusto Teixeira Mendes
Date
may, 2015

Macro Definition Documentation

◆ GM_CELLBASE_ACTIVE_MASK

#define GM_CELLBASE_ACTIVE_MASK   (~(~0u >> 1))

Mask with 1 on the MSB to tell if the cell is active (MSB = 0) or not (MSB = 1)

  Originally, GeMA used MSB = 1 to mark active cells but that was bad for debugging
  since active cells (much more common than inactive ones) would appear at the 
  debugger with a "negative" id and the user had to perfrom calculations to retrieve 
  the cell id. In order to make the common case simpler for debugging, this was inverted
  as of april 20224.

Function Documentation

◆ GmpCellFactory()

template<template< class, class, class, GmCellType, int, int > class T, class Base , class Proxy , class CellMeshData >
GmCell* GmpCellFactory ( GmCellMesh mesh,
int  meshId,
GmCellType  type,
int  hindex,
int  id,
int  offset 
)

A factory function for allocating cell objects.

By using a template template parameter T for the allocated class, instead of GmpCellBase directlly, we allow for classes inheriting from this plugin implementation to provide a new specialized cell type while still using the GmpCellFactory code for creating the cell.