GemaLuaCoreLib
The GeMA Lua Core library
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 
31 class GmLuaMatrix;
32 
34 class GML_API_EXPORT GmLuaCell: public GmLuaObject
35 {
36 public:
37  GmLuaCell(GmCell* cell, const GmLogCategory& logger);
38 
39  virtual ~GmLuaCell();
40 
41  // See comments on the base class
42  virtual const char* typeName() const { return "cell"; }
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  GmCell* cell() const { return _cell; }
53 
54 private:
55  int id (lua_State* L);
56  int mesh (lua_State* L);
57  int type (lua_State* L);
58  int active (lua_State* L);
59  int geometry (lua_State* L);
60  int numNodes (lua_State* L);
61  int numGhostNodes (lua_State* L);
62  int totalNumNodes (lua_State* L);
63  int nodeIndex (lua_State* L);
64  int nodes (lua_State* L);
65  int propertyIndex (lua_State* L);
66  int fillNodeMatrix (lua_State* L);
67  int fillFaceNodeMatrix (lua_State* L);
68  int fillEdgeNodeMatrix (lua_State* L);
69  int fillDeformedNodeMatrix (lua_State* L);
70  int fillDeformedFaceNodeMatrix(lua_State* L);
71  int fillDeformedEdgeNodeMatrix(lua_State* L);
72  int setActive (lua_State* L);
73  int setNodes (lua_State* L);
74  int addGhostNode (lua_State* L);
75  int removeGhostNode (lua_State* L);
76  int setProperties (lua_State* L);
77  int adjacentCell (lua_State* L);
78  int length (lua_State* L);
79  int area (lua_State* L);
80  int volume (lua_State* L);
81  int characteristicLength (lua_State* L);
82  int characteristicDimension (lua_State* L);
83  int centroidCartesian (lua_State* L);
84  int isValid (lua_State* L);
85  int quality (lua_State* L);
86 
87 protected:
88  void parseFillMatrixParameters(lua_State* L, GmValueAccessor** nodeAc, GmValueAccessor** uAc,
89  int* index, bool* transposed, GmCellFillMode* mode, const char* fname);
90 
91  void parseSizeMethodParameters(lua_State* L, GmValueAccessor** nodeAc, GmLuaMatrix** XProxy,
92  int* index, GmCellGeometryMode* mode, const char* fname);
93 
95 };
96 
97 
99 class GML_API_EXPORT GmLuaElement: public GmLuaCell
100 {
101 public:
102  GmLuaElement(GmElement* elem, const GmLogCategory& logger);
103 
104  // See comments on the base class
105  virtual const char* typeName() const { return "element"; }
106 
107  virtual void fillMetatable(lua_State* L, int index);
108 
110  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
111 
112 private:
113  int shape (lua_State* L);
114  int linearShape (lua_State* L);
115  int naturalCenter(lua_State* L);
116 };
117 
119 class GML_API_EXPORT GmLuaHElement : public GmLuaElement
120 {
121 public:
122  GmLuaHElement(GmHElement* elem, const GmLogCategory& logger);
123 
124  // See comments on the base class
125  virtual const char* typeName() const { return "helement"; }
126 
127  virtual void fillMetatable(lua_State* L, int index);
128 
130  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
131 
132 private:
133  int hPOrder(lua_State* L);
134  int hQOrder(lua_State* L);
135 };
136 
137 
138 #endif
Declaration of the GmLuaObject class.
GmCell * _cell
The cell 'wrapped' by this proxy object.
Definition: gmLuaCell.h:94
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaCell.h:105
A proxy class to export GmMatrix and GmVector methods to the Lua environment.
Definition: gmLuaMatrix.h:35
A proxy class to export GmCell methods to the Lua environment.
Definition: gmLuaCell.h:34
Declaration of the function used to prepare an environment with the core Lua functions.
GmCellFillMode
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaCell.h:130
virtual void fillMetatable(lua_State *L, int index)=0
Function called by populateMetatable() to fill the metatable with exported methods by derived classes...
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaCell.h:125
GmCell * cell() const
Returns the wrapped cell.
Definition: gmLuaCell.h:52
A proxy class to export GmHElement methods to the Lua environment.
Definition: gmLuaCell.h:119
virtual void fillMetatable(lua_State *L, int index)
Prepares the object metatable for calling methods.
Definition: gmLuaCell.cpp:62
virtual void fillMetatable(lua_State *L, int index)
Prepares the object metatable for calling methods.
Definition: gmLuaCell.cpp:822
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaCell.h:42
virtual QString toString() const
Default method used by the __tostring metamethod to capture the result of tostring() over an object.
Definition: gmLuaObject.h:55
A proxy class to export object methods to the Lua environment.
Definition: gmLuaObject.h:35
GmCellGeometryMode
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaCell.h:110
A proxy class to export GmElement methods to the Lua environment.
Definition: gmLuaCell.h:99
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaCell.h:49