GemaMesh
The GeMA Mesh Plugin
gmpMeshData.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_MESH_DATA_H_
25 #define _GEMA_PLUGIN_MESH_DATA_H_
26 
27 #include "gmpGemaMeshConfig.h"
28 
29 #include <gmMesh.h>
30 #include <gmValueInfo.h>
31 #include <gmTrace.h>
32 #include <QList>
33 #include <QVarLengthArray>
34 
35 class GmStateDump;
36 
42 template <template <class> class Vector>
43 struct GMP_GEMAMESH_API_EXPORT GmpMeshData
44 {
46  template <typename U> using VectorType = Vector<U>;
47 
48  GmpMeshData(GmMesh* mesh);
49 
51  virtual ~GmpMeshData() { releaseMemory(); } // Destructor: will always call our own version of releaseMemory even though virtual ...
52 
53  virtual bool setCoordinateDimension(int ncoord) { return ncoord >= 1 && ncoord <= 3; }
54 
55  virtual void clear(GmMesh* mesh);
56  virtual void releaseMemory();
57 
58  virtual int addFirstNodes(GmMesh* mesh, int numAddedNodes, int numGhostNodes, QList<GmValueInfo*> infoList = QList<GmValueInfo*>()) = 0;
59  virtual int addNewNodes (GmMesh* mesh, int numAddedNodes) = 0;
60  virtual int numNodes() const = 0;
61 
62  int addFirstGhostNodes(GmMesh* mesh, int numAddedNodes, QList<GmValueInfo*> infoList);
63  int addNewGhostNodes (GmMesh* mesh, int numAddedNodes);
64 
65  bool ghostEnabled() { return _ghostEnabled; }
66  void setGhostEnabled(bool state) { _ghostEnabled = state; }
67  int numGhostNodes() const { return _numGhostNodes; }
68 
69  virtual size_t nodeSetsMemory() const;
70 
72  void setGhostCoordinatesData(int nodeIndex, int coordId, double coordVal)
73  {
74  _ghostCoordinates[(nodeIndex*_coordInfo->size()) + coordId] = coordVal;
75  }
76 
77  bool addNodeValueSets(GmMesh* mesh, QList<GmValueInfo*> infoList, int numAddedNodes, int numGhostNodes, bool ghost);
78  bool resizeValueSets (const QList<GmValueSet*>& valueSets, int numAddedNodes);
79 
80  //---------------------------------------
81  // State dump control functions
82  //---------------------------------------
83 
84  virtual bool addStateGeometryData(GmStateDump* state, int groupId);
85 
86  virtual bool fillDumpControlMapData (GmMesh* mesh, QVariantMap* map, const GmLogCategory& logger);
87  virtual bool dumpControlMapDataLoaded(GmMesh* mesh, QVariantMap* map, const GmLogCategory& logger);
88 
89 
91 
94 
96  Vector<double> _ghostCoordinates;
97 
102 
109 
110 private:
111  void releaseGhostNodes();
112 };
113 
114 #endif
115 
int _numGhostNodes
The number of mesh ghost nodes.
Definition: gmpMeshData.h:93
virtual ~GmpMeshData()
Virtual destructor.
Definition: gmpMeshData.h:51
Vector< U > VectorType
A type identifying which vector type we are using.
Definition: gmpMeshData.h:46
void setGhostCoordinatesData(int nodeIndex, int coordId, double coordVal)
Updates a ghost node cooridnate.
Definition: gmpMeshData.h:72
Auxiliar structure used to share data between GmpXxxMeshBase and GmpMeshLoader.
Definition: gmpMeshData.h:43
GmValueInfo * _coordInfo
Information about node coordinates.
Definition: gmpMeshData.h:90
Declaration of usefull configuration definitions for the plugin library.
GmStateDump * _state
Definition: gmpMeshData.h:108
bool _ghostEnabled
Are ghost nodes enabled for this mesh?
Definition: gmpMeshData.h:92
QMap< QString, GmNodeSet * > _nodeSets
A map with the definition of each node set associated with the mesh. Map entries are instances of the...
Definition: gmpMeshData.h:101
Vector< double > _ghostCoordinates
Coordinate vector for ghost nodes. Size = _coordInfo->size() * _numGhostNodes. Values stored by node.
Definition: gmpMeshData.h:96