GemaLuaCoreLib
The GeMA Lua Core library
gmLuaMesh.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 _GEMALUA_MESH_H_
25 #define _GEMALUA_MESH_H_
26 
27 #include "gmLuaObject.h"
28 
29 #include <gmElementMesh.h>
30 #include <gmRegularGridMesh.h>
31 
32 
34 class GML_API_EXPORT GmLuaMesh: public GmLuaObject
35 {
36 public:
37  GmLuaMesh(GmMesh* mesh, const GmLogCategory& logger);
38 
39  virtual ~GmLuaMesh();
40 
41  // See comments on the base class
42  virtual const char* typeName() const { return "mesh"; }
43 
44  virtual QString toString() const;
45 
46  virtual void fillMetatable(lua_State* L, int index);
47 
49  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
50 
52  GmMesh* mesh() const { return _mesh; }
53 
54 private:
55  int id (lua_State* L);
56  int hasCapability (lua_State* L);
57  int nodeCoordInfo (lua_State* L);
58  int nodeCoordAccessor (lua_State* L);
59  int numNodes (lua_State* L);
60  int numGhostNodes (lua_State* L);
61  int totalNumNodes (lua_State* L);
62  int nodeSets (lua_State* L);
63  int nodeAttributeIds (lua_State* L);
64  int nodeStateVarIds (lua_State* L);
65  int nodeValueInfo (lua_State* L);
66  int nodeValueAccessor (lua_State* L);
67  int addNodeValueSet (lua_State* L);
68  int removeNodeValueSet (lua_State* L);
69  int clearNodeValueSets (lua_State* L);
70  int saveState (lua_State* L);
71  int saveNodeValueState (lua_State* L);
72  int numNodeValueStates (lua_State* L);
73  int nodeValueStateTag (lua_State* L);
74  int nodeValueStateTime (lua_State* L);
75  int setNodeValueStateTag (lua_State* L);
76  int setNodeValueStateTime(lua_State* L);
77  int addNodes (lua_State* L);
78  int addGhostNodes (lua_State* L);
79  int toLinearGhostIndex (lua_State* L);
80  int toLocalGhostIndex (lua_State* L);
81  int clear (lua_State* L);
82  int emitMeshChanged (lua_State* L);
83  int print (lua_State* L);
84  int printValues (lua_State* L);
85 
86 protected:
88 };
89 
91 class GML_API_EXPORT GmLuaCellMesh: public GmLuaMesh
92 {
93 public:
94  GmLuaCellMesh(GmCellMesh* mesh, const GmLogCategory& logger);
95 
96  // See comments on the base class
97  virtual const char* typeName() const { return "cellMesh"; }
98 
99  virtual void fillMetatable(lua_State* L, int index);
100 
102  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
103 
104 private:
105  int numCells (lua_State* L);
106  int numActiveCells (lua_State* L);
107  int cell (lua_State* L);
108  int adjacentCell (lua_State* L);
109  int nodeAdjacentNodes (lua_State* L);
110  int nodeAdjacentCells (lua_State* L);
111  int edgeAdjacentCells (lua_State* L);
112  int isBorderNode (lua_State* L);
113  int clearTopology (lua_State* L);
114  int numCellTypes (lua_State* L);
115  int numActiveCellTypes (lua_State* L);
116  int maxNumCellNodes (lua_State* L);
117  int maxNumCellGhostNodes (lua_State* L);
118  int maxTotalNumCellNodes (lua_State* L);
119  int isValid (lua_State* L);
120  int edgeMinLength (lua_State* L);
121  int edgeMaxLength (lua_State* L);
122  int cellBboxMinLength (lua_State* L);
123  int cellBboxMaxLength (lua_State* L);
124  int clearCellStatistics (lua_State* L);
125  int printQualityHistogram (lua_State* L);
126  int cellGroupIds (lua_State* L);
127  int cellGroupIndex (lua_State* L);
128  int numCellsInGroup (lua_State* L);
129  int cellInGroup (lua_State* L);
130  int cellBoundaryGroups (lua_State* L);
131  int numPropertySets (lua_State* L);
132  int propertySets (lua_State* L);
133  int propertySetIndex (lua_State* L);
134  int cellPropertyInfo (lua_State* L);
135  int cellPropertyAccessor (lua_State* L);
136  int cellAttributeIds (lua_State* L);
137  int cellAttributeInfo (lua_State* L);
138  int cellAttributeAccessor (lua_State* L);
139  int addCellAttributeSet (lua_State* L);
140  int removeCellAttributeSet (lua_State* L);
141  int clearCellAttributeSets (lua_State* L);
142  int saveCellAttributeState (lua_State* L);
143  int numCellAttributeStates (lua_State* L);
144  int cellAttributeStateTag (lua_State* L);
145  int cellAttributeStateTime (lua_State* L);
146  int setCellAttributeStateTag (lua_State* L);
147  int setCellAttributeStateTime(lua_State* L);
148  int addCells (lua_State* L);
149  int addCellGroup (lua_State* L);
150  int addCellsToGroup (lua_State* L);
151 };
152 
153 
155 class GML_API_EXPORT GmLuaElementMesh: public GmLuaCellMesh
156 {
157 public:
158  GmLuaElementMesh(GmElementMesh* mesh, const GmLogCategory& logger);
159 
160  // See comments on the base class
161  virtual const char* typeName() const { return "elementMesh"; }
162 
163  virtual void fillMetatable(lua_State* L, int index);
164 
166  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
167 
168 private:
169  int elementIntegrationRule (lua_State* L);
170  int borderIntegrationRule (lua_State* L);
171  int faceIntegrationRule (lua_State* L);
172  int edgeIntegrationRule (lua_State* L);
173  int numIntegrationRuleSets (lua_State* L);
174  int gaussAttributeIds (lua_State* L);
175  int gaussAttributeInfo (lua_State* L);
176  int gaussAttributeAccessor (lua_State* L);
177  int addGaussAttributeSet (lua_State* L);
178  int removeGaussAttributeSet (lua_State* L);
179  int clearGaussAttributeSets (lua_State* L);
180  int saveGaussAttributeState (lua_State* L);
181  int numGaussAttributeStates (lua_State* L);
182  int gaussAttributeStateTag (lua_State* L);
183  int gaussAttributeStateTime (lua_State* L);
184  int setGaussAttributeStateTag (lua_State* L);
185  int setGaussAttributeStateTime(lua_State* L);
186  int hPOrder (lua_State* L);
187  int hQOrder (lua_State* L);
188 };
189 
191 class GML_API_EXPORT GmLuaRegularGridMesh : public GmLuaMesh
192 {
193 public:
195 
196  // See comments on the base class
197  virtual const char* typeName() const { return "regularGridMesh"; }
198 
199  virtual void fillMetatable(lua_State* L, int index);
200 
202  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
203 
204 private:
205  int nodeSpacing (lua_State* L);
206  int nodeCount (lua_State* L);
207  int nodeWrap (lua_State* L);
208  int nodeFromIndex(lua_State* L);
209  int indexFromNode(lua_State* L);
210  int neighbor (lua_State* L);
211 };
212 
213 
214 #endif
virtual void fillMetatable(lua_State *L, int index)
Prepares the object metatable for calling methods.
Definition: gmLuaMesh.cpp:67
Declaration of the GmLuaObject class.
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaMesh.h:197
GmMesh * _mesh
The mesh 'wrapped' by this proxy object.
Definition: gmLuaMesh.h:87
GmMesh * mesh() const
Returns the wrapped mesh.
Definition: gmLuaMesh.h:52
A proxy class to export GmElementMesh methods to the Lua environment.
Definition: gmLuaMesh.h:155
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaMesh.h:49
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaMesh.h:161
A proxy class to export GmRegularGridMesh methods to the Lua environment.
Definition: gmLuaMesh.h:191
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaMesh.h:202
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaMesh.h:97
virtual void fillMetatable(lua_State *L, int index)=0
Function called by populateMetatable() to fill the metatable with exported methods by derived classes...
virtual void fillMetatable(lua_State *L, int index)
Prepares the object metatable for calling methods.
Definition: gmLuaMesh.cpp:576
void print(const GmMatrix &m, const GmLogCategory &logger, GmLogLevel level, int fieldWidth, char format, int precision)
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaMesh.h:166
virtual QString toString() const
Default method used by the __tostring metamethod to capture the result of tostring() over an object.
Definition: gmLuaObject.h:55
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaMesh.h:102
A proxy class to export object methods to the Lua environment.
Definition: gmLuaObject.h:35
A proxy class to export GmMesh methods to the Lua environment.
Definition: gmLuaMesh.h:34
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaMesh.h:42
A proxy class to export GmCellMesh methods to the Lua environment.
Definition: gmLuaMesh.h:91