24#ifndef _GEMA_PLUGIN_NODE_MESH_H_
25#define _GEMA_PLUGIN_NODE_MESH_H_
69template <
class Mesh,
template <
class>
class Vector>
75 : Mesh(simulation, id, description, logger),
_pcr(NULL),
_ownPcr(false)
86 simulationData()->modelData()->removePcrObject(
_pcr->
id(),
true);
91 virtual const char* pluginName()
const {
return "GemaMesh"; }
94 virtual const char* pluginType()
const {
if constexpr(std::is_same<Vector<int>,
GmSingleVector<int>>::value)
return "nodes";
else return "nodesd"; }
97 virtual bool hasCapability(
QString capabilityName)
const
102 return (capabilityName ==
"addNodes" || (capabilityName ==
"ghostNodes" &&
_nd._ghostEnabled) ||
103 capabilityName ==
"clear" || capabilityName ==
"stateDump");
107 virtual bool useDualVectors()
const {
if constexpr(std::is_same<Vector<int>,
GmSingleVector<int>>::value)
return false;
else return true; }
130 _nd._ghostEnabled = ghostSupport;
136 return loader->loadMeshData(table,
this, &
_nd, cd, &
_pcr, &
_ownPcr);
140 virtual GmValueInfo* nodeCoordInfo()
const {
return _nd._coordInfo; }
145 bool compatibleUnits;
149 gmInfoMsg(logger,
QObject::tr(
"Could not create an accessor for mesh coordinates due to incompatible units.\n"
150 "Data unit = '%1'. Requested unit = '%2'.")
151 .arg(
_nd._coordInfo->unit().name(), desiredUnit.
name()));
155 if(
_nd._ghostEnabled)
168 virtual int numNodes()
const { assert(
_nd._numNodes >= 0);
return _nd._numNodes; }
171 virtual int numGhostNodes()
const { assert(
_nd._numGhostNodes >= 0);
return _nd._numGhostNodes; }
177 virtual int addNodes(
int numNodes) {
return _nd.addNodes(
this,
false, numNodes,
true,
_pcr); }
180 virtual int addGhostNodes(
int numNodes) {
return _nd._ghostEnabled ?
_nd.addNodes(
this,
true, numNodes,
true,
_pcr) : -1; }
186 virtual size_t nodeMemory()
const {
return _nd.nodeMemory(); }
189 virtual size_t nodeSetsMemory()
const {
return _nd.nodeSetsMemory(); }
192 virtual GmPCR* pcrObject()
const {
return _pcr; }
207 Q_UNUSED(table); Q_UNUSED(ghostSupport);
223 virtual bool addStateGeometryData(
GmStateDump* state,
int groupId)
225 return Mesh::addStateGeometryData(state, groupId) &&
226 _nd._dumper->addStateGeometryData(state, groupId) &&
227 _pcr->addStateGeometryData(state, groupId);
231 virtual bool fillDumpControlMapData(QVariantMap* map,
const GmLogCategory& logger)
233 return Mesh::fillDumpControlMapData(map, logger) &&
234 _nd._dumper->fillDumpControlMapData(
this, map, logger) &&
235 _pcr->fillDumpControlMapData(map, logger);
239 virtual bool dumpControlMapDataLoaded(QVariantMap* map,
const GmLogCategory& logger)
241 return Mesh::dumpControlMapDataLoaded(map, logger) &&
242 _nd._dumper->dumpControlMapDataLoaded(
this, map, logger) &&
243 _pcr->dumpControlMapDataLoaded(map, logger);
Auxiliar structure used to share data between GmpCellMesh and GmpMeshLoader. All fields are public si...
Definition gmpCellMeshData.h:121
Auxiliary class used to load mesh data from a Lua file.
Definition gmpMeshLoader.h:58
Auxiliar interface used to share node data between the mesh implementation and GmpMeshLoader....
Definition gmpNodeMeshData.h:53
Basic class for a plugin mesh. Implements the needed functions for a GmMesh interface,...
Definition gmpNodeMesh.h:71
GmPCR * _pcr
PCR object. Not stored inside _nd since that class does not have access to the model data for correct...
Definition gmpNodeMesh.h:248
GmpNodeMesh(GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
Constructor. Will be called by the plugin loading code.
Definition gmpNodeMesh.h:74
virtual GmpCellMeshData< Vector > * initCellData(LuaTable &table, bool *ghostSupport, bool *ok)
Virtual function that should be overridden for derived classes that need to load cells....
Definition gmpNodeMesh.h:205
GmpNodeMeshData< Vector > _nd
The complete node data.
Definition gmpNodeMesh.h:246
virtual ~GmpNodeMesh()
Destructor.
Definition gmpNodeMesh.h:80
virtual bool loadPrivateData(LuaTable &table)
See behaviour comments on the base class. When inheriting from this class, the idea is that this func...
Definition gmpNodeMesh.h:117
bool _ownPcr
Do we own the PCR object? (will be true if the object was instanced internally)
Definition gmpNodeMesh.h:249
virtual GmpMeshLoader< Vector > * meshLoader()
Returns the mesh loader used to load mesh data. This function should be replaced for using a custom m...
Definition gmpNodeMesh.h:213
static void pushObject(lua_State *L, Base *obj)
QVariant getField(const char *name, LuaEnv::StackOption opt=LuaEnv::STACK_AUTO)
static UnitConverter * converter(const Unit &srcUnit, const Unit &dstUnit, bool *compatible=NULL)
Declaration of the GmpCellMeshData structure.
Declaration of the GmpDataDump interface class.
@ GMP_GEMA_MESH_DUMP_ITEM
Node mesh dump type.
Definition gmpDataDump.h:34
Declaration of the GmpMeshLoader class.
Implementation of the GmpNodeDataDump class.
Declaration of the GmpNodeMeshData class.
QString tr(const char *sourceText, const char *disambiguation, int n)
bool toBool() const const