GemaLuaCoreLib
The GeMA Lua Core library
gmLuaIntegrationRule.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_INTEGRATION_RULE_H_
25 #define _GEMALUA_INTEGRATION_RULE_H_
26 
27 #include "gmLuaObject.h"
28 #include <gmCell.h>
29 
30 class GmIntegrationRule;
32 
34 class GML_API_EXPORT GmLuaIntegrationRule: public GmLuaObject
35 {
36 public:
37  GmLuaIntegrationRule(const GmIntegrationRule* ir, bool newRule, const GmLogCategory& logger);
38 
39  virtual ~GmLuaIntegrationRule();
40 
41  // See comments on the base class
42  virtual const char* typeName() const { return "integrationRule"; }
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  const GmIntegrationRule* intRule() const { return _ir; }
53 
54 private:
55  int ruleName (lua_State* L);
56  int numPoints (lua_State* L);
57  int integrationPoint(lua_State* L);
58  int numNaturalCoord (lua_State* L);
59  int degree (lua_State* L);
60 
61 protected:
63  bool _newRule;
64 };
65 
66 
68 class GML_API_EXPORT GmLuaBorderIntegrationRule : public GmLuaIntegrationRule
69 {
70 public:
71  GmLuaBorderIntegrationRule(const GmBorderIntegrationRule* ir, bool newRule, GmCellType type, const GmLogCategory& logger);
72 
73  // See comments on the base class
74  virtual const char* typeName() const { return "borderIntegrationRule"; }
75 
76  virtual void fillMetatable(lua_State* L, int index);
77 
79  virtual void* getClassMetatableID() { static int classID = 0; return &classID; }
80 
81 private:
82  int numBorderCoord(lua_State* L);
83  int translatePoint(lua_State* L);
84 
86 };
87 
88 
91 {
92  int parseIntegrationRuleParams(lua_State* L, const char* name, GmCellType* cellType, int* P, int* Q, int* faceType,
93  GmIntegrationRuleType* irType, int* rule1, int* rule2 = NULL, int* rule3 = NULL);
94 
95  int pushIntegrationRule(lua_State* L, GmIntegrationRule* ir, GmCellType cellType, const GmLogCategory& logger);
96 }
97 
98 
99 #endif
GmIntegrationRuleType
Declaration of the GmLuaObject class.
A proxy class to export GmBorderIntegrationRule methods to the Lua environment.
Definition: gmLuaIntegrationRule.h:68
const GmIntegrationRule * intRule() const
Returns the wrapped integration rule.
Definition: gmLuaIntegrationRule.h:52
Aux functions used by integration rule creation functions.
Definition: gmLuaIntegrationRule.h:90
virtual void * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaIntegrationRule.h:79
int parseIntegrationRuleParams(lua_State *L, const char *name, GmCellType *cellType, int *P, int *Q, int *faceType, GmIntegrationRuleType *irType, int *rule1, int *rule2=NULL, int *rule3=NULL)
Parses the set of parameters used when creating a new integration rule.
Definition: gmLuaIntegrationRule.cpp:224
virtual void fillMetatable(lua_State *L, int index)
Prepares the object metatable for calling methods.
Definition: gmLuaIntegrationRule.cpp:62
bool _newRule
Does the object owns the integration rule?
Definition: gmLuaIntegrationRule.h:63
int pushIntegrationRule(lua_State *L, GmIntegrationRule *ir, GmCellType cellType, const GmLogCategory &logger)
Pushes on the Lua stack the given integration rule as either a plain rule or a border rule.
Definition: gmLuaIntegrationRule.cpp:310
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 * getClassMetatableID()
Returns an unique identifier to identify an user object as a GmLuaMesh object.
Definition: gmLuaIntegrationRule.h:49
A proxy class to export GmIntegrationRule methods to the Lua environment.
Definition: gmLuaIntegrationRule.h:34
const GmIntegrationRule * _ir
The integration rule 'wrapped' by this proxy object.
Definition: gmLuaIntegrationRule.h:62
virtual const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaIntegrationRule.h:74
GmCellType
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 const char * typeName() const
Returns the object type as will be stored in the object metatable.
Definition: gmLuaIntegrationRule.h:42
A proxy class to export object methods to the Lua environment.
Definition: gmLuaObject.h:35
GmCellGeometry _geom
The geometry corresponding to this integration rule.
Definition: gmLuaIntegrationRule.h:85