![]() |
GemaLuaCoreLib
The GeMA Lua Core library
|
A proxy class to export GmMesh methods to the Lua environment. More...
#include <gmLuaMesh.h>
Public Member Functions | |
GmLuaMesh (GmMesh *mesh, const GmLogCategory &logger) | |
Constructor. Receives the mesh to be wrapped. | |
virtual | ~GmLuaMesh () |
Destructor. | |
virtual const char * | typeName () const |
Returns the object type as will be stored in the object metatable. | |
virtual QString | toString () const |
Default method used by the __tostring metamethod to capture the result of tostring() over an object. | |
virtual void | fillMetatable (lua_State *L, int index) |
Prepares the object metatable for calling methods. | |
virtual void * | getClassMetatableID () |
Returns an unique identifier to identify an user object as a GmLuaMesh object. | |
GmMesh * | mesh () const |
Returns the wrapped mesh. | |
![]() | |
virtual | ~GmLuaObject () |
Destrutor. | |
virtual void | populateMetatable (lua_State *L, int index) |
Fills the object metatable to allow for the proxy to export its methods. | |
QVariant | ptrToVariant () |
Constructs a QVariant storing a POINTER to the current object. | |
void | ref () |
Increments the object reference count. Use with care. | |
Protected Attributes | |
GmMesh * | _mesh |
The mesh 'wrapped' by this proxy object. | |
![]() | |
const GmLogCategory & | _logger |
A logger used by the proxy when needed. | |
QAtomicInteger< int > | _refCount |
Lua objects are reference counted to enable sharing them among different states. This is needed to allow for passing objects as parameters in a parallel call. The garbage collection method releases memory only for the last reference. | |
Private Member Functions | |
int | id (lua_State *L) |
Returns the mesh id. | |
int | hasCapability (lua_State *L) |
Returns true or false indicating whether the mesh supports the requested capability (a string) or not. | |
int | nodeCoordInfo (lua_State *L) |
Returns a GmLuaValueInfo object with information about node coordinates. | |
int | nodeCoordAccessor (lua_State *L) |
Returns an accessor object for querying node coordinates or nil on error. More... | |
int | numNodes (lua_State *L) |
Returns the number of nodes in the mesh. | |
int | numGhostNodes (lua_State *L) |
Returns the number of ghost nodes in the mesh. | |
int | totalNumNodes (lua_State *L) |
Returns the total number of nodes in the mesh (normal nodes + ghost nodes) | |
int | nodeSets (lua_State *L) |
Returns a table indexed by node set names, with node set objects. | |
int | nodeAttributeIds (lua_State *L) |
Returns a table with a list of attribute ids associated to this mesh. | |
int | nodeStateVarIds (lua_State *L) |
Returns a table with a list of state var ids associated to this mesh. | |
int | nodeValueInfo (lua_State *L) |
Returns a GmLuaValueInfo object with information about the requested attribute / state var. Returns nil if the requeste value does not exist. More... | |
int | nodeValueAccessor (lua_State *L) |
Returns an accessor object for querying node values or nil on error. More... | |
int | addNodeValueSet (lua_State *L) |
Adds a new value set to the mesh. More... | |
int | removeNodeValueSet (lua_State *L) |
Tries to remove a node value set stored in the mesh. | |
int | clearNodeValueSets (lua_State *L) |
Removes the node value sets stored in the mesh. | |
int | saveState (lua_State *L) |
Saves the global state. Receives as parameter a string describing the save mode ('init', 'noinit' or 'copy'). Returns true if successfull. | |
int | saveNodeValueState (lua_State *L) |
Saves the state of the given node value. Receives as parameter the value id and a string describing the save mode ('init', 'noinit' or 'copy'). Returns true if successfull. | |
int | numNodeValueStates (lua_State *L) |
Returns the number of existing states for the requested id or -1 if the id doesn't exists. | |
int | nodeValueStateTag (lua_State *L) |
Returns the state tag attached to the requested state of the named value or "" if the id doesn't exists. | |
int | nodeValueStateTime (lua_State *L) |
Returns the time tag attached to the requested state of the named value or -1 if the id doesn't exists. | |
int | setNodeValueStateTag (lua_State *L) |
Sets a tag name for the requested state of the named value. Does nothing if the id doesn't exists. | |
int | setNodeValueStateTime (lua_State *L) |
Sets a time tag for the requested state of the named value. Does nothing if the id doesn't exists. | |
int | addNodes (lua_State *L) |
Adds the specified number of nodes to the mesh node set. Returns the index of the first new value. | |
int | addGhostNodes (lua_State *L) |
Adds the specified number of ghost nodes to the mesh node set. Returns the index of the first new value. | |
int | toLinearGhostIndex (lua_State *L) |
If the given nodeIndex is a value with its high bit set, returns the index + the number of regular mesh nodes. Otherwise, returns nodeIndex. | |
int | toLocalGhostIndex (lua_State *L) |
Given a linear ghost index (a value > numNodes() and <= totalNumNodes()), returns a one based version of the index. If index is a 'geometry index' (nodeIndex <= numNodes()), returns nil. | |
int | clear (lua_State *L) |
Clears the mesh, removing nodes, cells and values associated to their attributes. | |
int | emitMeshChanged (lua_State *L) |
Emit signal declaring that the mesh has changed. | |
int | print (lua_State *L) |
Prints mesh parameters (not values) | |
int | printValues (lua_State *L) |
Prints mesh values. An optional boolean parameter defines if functions are evaluated or not. | |
Additional Inherited Members | |
![]() | |
GmLuaObject (const GmLogCategory &logger) | |
Construtor protegido. Somente classes derivadas devem ser instanciadas. | |
A proxy class to export GmMesh methods to the Lua environment.
|
private |
Adds a new value set to the mesh.
Receives on the stack a valueInfo object with the description of the new attribute / state var. Keep in mind that this should be a NEW valueInfo object since the mesh will take ownership of the info object.
Returns false if the value could not be added.
|
private |
Returns an accessor object for querying node coordinates or nil on error.
Can optionally receive on the stack the unit in which values should be returned
|
private |
Returns an accessor object for querying node values or nil on error.
Receives as stack parameter the name of the desired attribute / state var and, optionally, the unit in which values should be returned
|
private |
Returns a GmLuaValueInfo object with information about the requested attribute / state var. Returns nil if the requeste value does not exist.
Receives as stack parameter the name of the desired attribute / state var