GeomProcess
The GeMA Geometry Process Plugin
Loading...
Searching...
No Matches
MeshCreator Class Reference

Helper class used to create a new GeMA mesh from a set of an existing mesh sides. More...

#include <meshCreator.h>

Collaboration diagram for MeshCreator:

Public Member Functions

 MeshCreator (const GmCellMesh *srcMesh, bool projectOnXY, bool saveSrc, const GmLogCategory &logger)
 Constructor. If projectOnXY is true, the resulting mesh will be a 2D mesh projected on the XY plane (ignored if the original mesh is already a 2D mesh). If saveSrc is true, two attributes, srcCellId and srcSide, will be added to the new mesh, making a correspondence between each new element with its source side. Stored values are 1-based (Lua values).
 
 ~MeshCreator ()
 Destructor.
 
bool addSide (const GmCell *cell, int side)
 Adds a side to the set of sides that will compose the new mesh. Can return false if there is no equivalent plane element for the given cell side.
 
GmCellMeshcreateMesh (GmSimulationData *simData, QString id, const QVariantMap &attributes, QString pluginType, bool addToModel)
 Creates the new mesh from the set of sides added by call to addSide(). The new mesh will be named id (must be a new mesh name) and will be added to the model only if addToModel is true. If attributes is not empty, it should contain a set of additional clauses / options that will be forwarded to the mesh creation. pluginType gives the name of the mesh plugin to use. See more details on the description for GmModelData::addNewEmptyMesh(). Returns NULL on errors.
 

Static Public Member Functions

static GmCellMeshprojectedFromSurfaceMesh (GmSimulationData *simData, GmCellMesh *srcMesh, QString id, const QVariantMap &attributes, QString pluginType, bool addToModel, const GmLogCategory &logger)
 Static function used to project a 3D surface mesh into a 2D mesh.
 
static GmSpatialIndexprojectedSpatialIndex (GmSimulationData *simData, GmCellMesh *srcMesh, QString id, const QVariantMap &attributes, QString pluginType, bool addToModel, const GmLogCategory &logger)
 Static function used to create a spatial index for a projected mesh.
 
static GmMeshcreateSimpleMesh (GmSimulationData *simData, QString id, LuaTable &nodes, GmCellType singleCellType, LuaTable &cells, const QVariantMap &attributes, QString pluginType, bool addToModel, const GmLogCategory &logger)
 Static function used to create a new mesh filled with the nodes and cells provided by the nodes and cells Lua tables.
 
static bool fillEmptyMesh (GmMesh *mesh, LuaTable &nodes, GmCellType singleCellType, LuaTable &cells, const GmLogCategory &logger)
 Static function used to fill an EMPTY mesh (a mesh with 0 nodes and 0 cells) with the nodes and cells provided by the nodes and cells Lua tables.
 

Static Private Member Functions

static bool initializeProjElementVector ()
 Static function used to initialize _projElement.
 

Private Attributes

const GmLogCategory_logger
 The logger used for creating accessors.
 
const GmCellMesh_srcMesh
 The source mesh.
 
bool _projected
 Should we project the destination mesh on the XY plane?
 
bool _saveSrc
 Should we add attributes to the new mesh with the src cell and src side?
 
GmValueAccessor_srcAc
 An accessor for the source mesh coordinates.
 
int _d
 Coordinate dimension.
 
bool _surface
 Is the src mesh a surface or a solid mesh?
 
QMap< int, int > _nodeMap
 Maps src mesh node numbers to the new mesh node numbering.
 
QMap< QPair< int, int >, int > _newMap
 Maps pair of vertices (v1, v2 with v1 < v2), representing a new interpolated node, to the new mesh node numbering.
 
QVector< int > _inv
 Inverse table with the original node number for each new node number. Stores -1 if the node is interpolated.
 
QMap< int, QPair< int, int > > _newInvMap
 Inverse map from new interpolated nodes (where _inv[i] == -1) to the nodes v1 and v1 from which it should be interpolated.
 
QVector< QVector< int > > _cells
 New cell list. For each cell, the first vector entry is the cell type, followed by new nodal incidence.
 
QVector< int > _srcInfo
 If _saveSrc is true, stores the src cell id + side. Size equal to 2*_cells.size().
 

Static Private Attributes

static GmCellType _projElement [GM_NUM_CELL_TYPES]
 A vector storing the equivalent projected type for 3d surface or bar elements (Ex: QUAD3D4 -> QUAD4)
 
static bool _projElementInitialized = MeshCreator::initializeProjElementVector()
 Flag used to force automatic initialization of the _projElement vector.
 

Detailed Description

Helper class used to create a new GeMA mesh from a set of an existing mesh sides.

Member Function Documentation

◆ createSimpleMesh()

GmMesh * MeshCreator::createSimpleMesh ( GmSimulationData * simData,
QString id,
LuaTable & nodes,
GmCellType singleCellType,
LuaTable & cells,
const QVariantMap & attributes,
QString pluginType,
bool addToModel,
const GmLogCategory & logger )
static

Static function used to create a new mesh filled with the nodes and cells provided by the nodes and cells Lua tables.

The new mesh will be named id (must be a new mesh name) and will be added to the model only if addToModel is true. If attributes is not empty, it should contain a set of additional clauses / options that will be forwarded to the mesh creation. pluginType gives the name of the mesh plugin to use. See more details on the description for GmModelData::addNewEmptyMesh(). Nodes should be a table where each entry is a subtable with its associated node coordinates. The first node coordinate table size defines the mesh dimension. The cells table should be invalid for node meshes (as defined by the given plugin type). Otherwise it should contain subtables with cell incidences (1 based values). If singleCellType is different from GM_INV_CELL_TYPE, assumes that all cells are from that type. Otherwise, each entry from the cells table should start with a string defining that cell's type. Returns NULL on errors (the error message is written with the given logger).

◆ fillEmptyMesh()

bool MeshCreator::fillEmptyMesh ( GmMesh * mesh,
LuaTable & nodes,
GmCellType singleCellType,
LuaTable & cells,
const GmLogCategory & logger )
static

Static function used to fill an EMPTY mesh (a mesh with 0 nodes and 0 cells) with the nodes and cells provided by the nodes and cells Lua tables.

Nodes should be a table where each entry is a subtable with its associated node coordinates. Each subtable table size should be equal to the mesh dimension. If the mesh is a cell mesh, the cells table should contain subtables with cell incidences (1 based values). Otherwise, an invalid LuaTable can be used as parameter. If a cell mesh and singleCellType is different from GM_INV_CELL_TYPE, assumes that all cells are from that type. Otherwise, each entry from the cells table should start with a string defining that cell's type. If the empty mesh is associated with property sets, the property set indices should be present in the subtables after the nodal incidence, in the mesh x property sets association order.

Returns false on errors (the error message is written with the given logger). Notice that in the presence of errors, the mesh contents is indetermined.

Member Data Documentation

◆ _projElement

GmCellType MeshCreator::_projElement
staticprivate

A vector storing the equivalent projected type for 3d surface or bar elements (Ex: QUAD3D4 -> QUAD4)

A vector storing the equivalent projected type for 3d surface or bar elements(Ex: QUAD3D4->QUAD4). Stores GM_INV_CELL_TYPE for non 3d surface elements.

Flag used to force automatic initialization of the _projElement vector by calling initializeProjElementVector()


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