GemaLuaCoreLib
The GeMA Lua Core library
Loading...
Searching...
No Matches
gmLuaCell.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_CELL_H_
25#define _GEMALUA_CELL_H_
26
27#include "gmLuaObject.h"
28#include "gmLuaEnv.h"
29#include <gmElement.h>
30#include <gmCellMesh.h>
31
32class GmLuaMatrix;
33
34
36class GML_API_EXPORT GmLuaCell: public GmLuaObject
37{
38public:
39 GmLuaCell(GmCell* cell, const GmLogCategory& logger);
40
41 virtual ~GmLuaCell();
42
43 // See comments on the base class
44 virtual const char* typeName() const { return "cell"; }
45
46 virtual QString toString() const;
47
48 virtual void fillMetatable(lua_State* L, int index);
49
51 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
52
54 GmCell* cell() const { return _mesh->cell(_cellId); }
55
56private:
57 int id (lua_State* L);
58 int mesh (lua_State* L);
59 int type (lua_State* L);
60 int active (lua_State* L);
61 int geometry (lua_State* L);
62 int numNodes (lua_State* L);
63 int numGhostNodes (lua_State* L);
64 int totalNumNodes (lua_State* L);
65 int nodeIndex (lua_State* L);
66 int nodes (lua_State* L);
67 int propertyIndex (lua_State* L);
68 int fillNodeMatrix (lua_State* L);
69 int fillFaceNodeMatrix (lua_State* L);
70 int fillEdgeNodeMatrix (lua_State* L);
71 int fillDeformedNodeMatrix (lua_State* L);
72 int fillDeformedFaceNodeMatrix(lua_State* L);
73 int fillDeformedEdgeNodeMatrix(lua_State* L);
74 int setActive (lua_State* L);
75 int setNodes (lua_State* L);
76 int addGhostNode (lua_State* L);
77 int removeGhostNode (lua_State* L);
78 int setProperties (lua_State* L);
79 int adjacentCell (lua_State* L);
80 int length (lua_State* L);
81 int area (lua_State* L);
82 int volume (lua_State* L);
83 int characteristicLength (lua_State* L);
84 int characteristicDimension (lua_State* L);
85 int centroidCartesian (lua_State* L);
86 int isValid (lua_State* L);
87 int quality (lua_State* L);
88
89protected:
90 void parseFillMatrixParameters(lua_State* L, GmValueAccessor** nodeAc, GmValueAccessor** uAc,
91 int* index, bool* transposed, GmCellFillMode* mode, const char* fname);
92
93 void parseSizeMethodParameters(lua_State* L, GmValueAccessor** nodeAc, GmLuaMatrix** XProxy,
94 int* index, GmCellGeometryMode* mode, const char* fname);
95
96 // We can't just store a GmCell* (as we did previouslly) since with the new mesh plugin
97 // implementation we can't make sure that a cell pointer will not change when new cells
98 // are added to the mesh. Since a cell reference stored in Lua can have its life span
99 // crossing mesh change borders, we MUST store the cell index!!!!
100
103};
104
105
107class GML_API_EXPORT GmLuaElement: public GmLuaCell
108{
109public:
110 GmLuaElement(GmElement* elem, const GmLogCategory& logger);
111
112 // See comments on the base class
113 virtual const char* typeName() const { return "element"; }
114
115 virtual void fillMetatable(lua_State* L, int index);
116
118 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
119
120private:
121 int shape (lua_State* L);
122 int linearShape (lua_State* L);
123 int naturalCenter(lua_State* L);
124};
125
127class GML_API_EXPORT GmLuaHElement : public GmLuaElement
128{
129public:
130 GmLuaHElement(GmHElement* elem, const GmLogCategory& logger);
131
132 // See comments on the base class
133 virtual const char* typeName() const { return "helement"; }
134
135 virtual void fillMetatable(lua_State* L, int index);
136
138 virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
139
140private:
141 int hPOrder(lua_State* L);
142 int hQOrder(lua_State* L);
143};
144
145
146#endif
A proxy class to export GmCell methods to the Lua environment.
Definition gmLuaCell.h:37
int _cellId
The id of the cell wrapped by this proxy object.
Definition gmLuaCell.h:101
GmCellMesh * _mesh
The mesh to wich theis cell id belongs.
Definition gmLuaCell.h:102
GmCell * cell() const
Returns the wrapped cell.
Definition gmLuaCell.h:54
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaCell.h:44
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaCell.h:51
A proxy class to export GmElement methods to the Lua environment.
Definition gmLuaCell.h:108
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaCell.h:118
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaCell.h:113
A proxy class to export GmHElement methods to the Lua environment.
Definition gmLuaCell.h:128
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition gmLuaCell.h:138
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition gmLuaCell.h:133
A proxy class to export GmMatrix and GmVector methods to the Lua environment.
Definition gmLuaMatrix.h:36
A proxy class to export object methods to the Lua environment.
Definition gmLuaObject.h:36
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 fillMetatable(lua_State *L, int index)=0
Function called by populateMetatable() to fill the metatable with exported methods by derived classes...
GmCellGeometryMode
GmCellFillMode
Declaration of the function used to prepare an environment with the core Lua functions.
Declaration of the GmLuaObject class.