![]() |
GemaMesh
The GeMA Mesh Plugin
|
Class for storing cell data, without ghost nodes support. More...
#include <gmpCell.h>


Public Member Functions | |
| GmpCell (int meshId, int cellId, int offset) | |
| Constructs a cell given its id, associated mesh id and node offset in the mesh data structure. | |
| virtual int | cellId () const |
| virtual GmCellMesh * | mesh () const |
| virtual bool | active () const |
| virtual void | setActive (bool active) |
| virtual void | pushProxy (lua_State *L, const GmLogCategory &logger) |
| virtual GmCellType | type () const |
| virtual int | numNodes () const |
| virtual int | nodeIndex (int localIndex) const |
| virtual void | nodes (int *nodeList, bool ghost) const |
| virtual bool | setNodes (const int *nodeList) |
| virtual int | propertyIndex (int propertySet) const |
| virtual bool | setProperties (const int *propList, int nprop) |
| void | replaceCellId (int id, bool keepActiveFlag) |
| Updates the cell id. For those who really know what they are doing. This function is a very specific function that should not be called lightly. It exists on behalf of the state dumping code and for helping other mesh implementations wishing to encode extra information on the cell id, like the XFem plugin that uses it to mark a cell as enriched or not. | |
| int | offset () const |
| Returns the offset in the global mesh cell nodes vector for this cell. Not part of the GmCell API and should NOT be marked as virtual. | |
| void | setOffset (int offset) |
| Updates the cell offset. Not part of the GmCell API and should NOT be marked as virtual. | |
Protected Member Functions | |
| CellMeshData * | meshData () const |
| Returns the mesh data object associated with this cell's mesh. | |
Protected Attributes | |
| int | _cellId |
| The cell index inside the mesh. MSB is used to control if the cell is active or not. | |
| int | _nodeOffset |
| Index in the mesh data for the first node for this cell. | |
Class for storing cell data, without ghost nodes support.
This is a template class so that we can have instances inheriting from different base classes, such as GmCell or GmElement and also to provide static implementations to type() and numNodes() avoiding the need to store more information then needed inside the cell.
For such an effect, Base should be the base class we are inheriting, Proxy the associated Lua proxy type and CellMeshData the concrete type of the GmpCellMeshData template that is being used for this mesh (depending on the vector type in use). Also, T should be the cell type and N the number of nodes for this cell type.
The cell id, mesh id and active bits are encoded in a single integer. Cell properties are stored in the cell mesh data object. Since the number of properties is constant for a mesh, we can get the cells properties by the cell id.
Cell nodes are also stored in the cell mesh data object. Since the mesh can be heterogeneous, an offset into the "global" vector is stored in the cell. If the mesh is homogeneous, the offset could be replaced by a simple calculation based on the cell id but due to structure alignment needs, the size of a cell would NOT be reduced, so we don't bother to try that distinction.
All in all this is a very "thin" structure with only 16 bytes: 8 for the vtable pointer
IMPORTANT: If you ever inherit from this class or from GmpGhostCell, please make sure to COMPLY with the additional considerations detailed on the comments found under the "VERY IMPORTANT considerations:" title, just above the GmpCellFactory() function below.
|
inline |
Updates the cell id. For those who really know what they are doing. This function is a very specific function that should not be called lightly. It exists on behalf of the state dumping code and for helping other mesh implementations wishing to encode extra information on the cell id, like the XFem plugin that uses it to mark a cell as enriched or not.
This function can preserve the current active bit depending on the keepActiveFlag parameter. Should be used to code other information on the id high bits. The "base id", coinciding with the cell vector location, should be the same.
Not part of the GmCell API and should NOT be marked as virtual.