GeomProcess
The GeMA Geometry Process Plugin
Loading...
Searching...
No Matches
meshCreator.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_PLUGIN_GEOM_MESH_CREATOR_H_
25#define _GEMA_PLUGIN_GEOM_MESH_CREATOR_H_
26
27#include <QString>
28#include <QMap>
29#include <QVector>
30#include <QVariant>
31
32#include <gmCellType.h>
33
35class GmCell;
36class GmMesh;
37class GmCellMesh;
38class GmValueAccessor;
39class GmLogCategory;
40class GmSpatialIndex;
41class LuaTable;
42
45{
46public:
47 MeshCreator(const GmCellMesh* srcMesh, bool projectOnXY, bool saveSrc, const GmLogCategory& logger);
49
50 bool addSide(const GmCell* cell, int side);
51
52 GmCellMesh* createMesh(GmSimulationData* simData, QString id, const QVariantMap& attributes,
53 QString pluginType, bool addToModel);
54
56 const QVariantMap& attributes, QString pluginType,
57 bool addToModel, const GmLogCategory& logger);
58
60 const QVariantMap& attributes, QString pluginType,
61 bool addToModel, const GmLogCategory& logger);
62
63 static GmMesh* createSimpleMesh(GmSimulationData* simData, QString id, LuaTable& nodes,
64 GmCellType singleCellType, LuaTable& cells, const QVariantMap& attributes,
65 QString pluginType, bool addToModel, const GmLogCategory& logger);
66
67 static bool fillEmptyMesh(GmMesh* mesh, LuaTable& nodes, GmCellType singleCellType, LuaTable& cells,
68 const GmLogCategory& logger);
69
70private:
71
72 static bool initializeProjElementVector();
73
76
80 bool _saveSrc;
82 int _d;
83 bool _surface;
90};
91
92#endif
93
Helper class used to create a new GeMA mesh from a set of an existing mesh sides.
Definition meshCreator.h:45
int _d
Coordinate dimension.
Definition meshCreator.h:82
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...
Definition meshCreator.cpp:543
bool _surface
Is the src mesh a surface or a solid mesh?
Definition meshCreator.h:83
bool _projected
Should we project the destination mesh on the XY plane?
Definition meshCreator.h:79
const GmCellMesh * _srcMesh
The source mesh.
Definition meshCreator.h:78
const GmLogCategory & _logger
The logger used for creating accessors.
Definition meshCreator.h:77
static GmCellType _projElement[GM_NUM_CELL_TYPES]
A vector storing the equivalent projected type for 3d surface or bar elements (Ex: QUAD3D4 -> QUAD4)
Definition meshCreator.h:74
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 equiv...
Definition meshCreator.cpp:88
QVector< QVector< int > > _cells
New cell list. For each cell, the first vector entry is the cell type, followed by new nodal incidenc...
Definition meshCreator.h:88
QVector< int > _inv
Inverse table with the original node number for each new node number. Stores -1 if the node is interp...
Definition meshCreator.h:86
static bool initializeProjElementVector()
Static function used to initialize _projElement.
Definition meshCreator.cpp:719
GmValueAccessor * _srcAc
An accessor for the source mesh coordinates.
Definition meshCreator.h:81
~MeshCreator()
Destructor.
Definition meshCreator.cpp:79
bool _saveSrc
Should we add attributes to the new mesh with the src cell and src side?
Definition meshCreator.h:80
QVector< int > _srcInfo
If _saveSrc is true, stores the src cell id + side. Size equal to 2*_cells.size().
Definition meshCreator.h:89
QMap< int, int > _nodeMap
Maps src mesh node numbers to the new mesh node numbering.
Definition meshCreator.h:84
QMap< QPair< int, int >, int > _newMap
Maps pair of vertices (v1, v2 with v1 < v2), representing a new interpolated node,...
Definition meshCreator.h:85
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 (...
Definition meshCreator.cpp:61
static GmSpatialIndex * projectedSpatialIndex(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.
Definition meshCreator.cpp:439
static bool _projElementInitialized
Flag used to force automatic initialization of the _projElement vector.
Definition meshCreator.h:75
static GmMesh * createSimpleMesh(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 c...
Definition meshCreator.cpp:481
GmCellMesh * createMesh(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 ...
Definition meshCreator.cpp:169
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 sh...
Definition meshCreator.h:87
static GmCellMesh * projectedFromSurfaceMesh(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.
Definition meshCreator.cpp:324
GmCellType
GM_NUM_CELL_TYPES