![]() |
GemaLuaCoreLib
The GeMA Lua Core library
|
A proxy class to export GmGaussAccessor methods to the Lua environment. More...
#include <gmLuaValueAccessor.h>
Public Member Functions | |
GmLuaGaussAccessor (GmGaussAccessor *ac, GmElementMesh *mesh, const GmLogCategory &logger, bool ownership=true) | |
Constructor. Receives the GaussAccessor to be wrapped. More... | |
virtual const char * | typeName () const |
Returns the object type as will be stored in the object metatable. | |
virtual void * | getClassMetatableID () |
Returns an unique identifier to identify an user object as a GmGaussAccessor object. | |
virtual void | fillMetatable (lua_State *L, int index) |
Prepares the object metatable for calling methods. | |
![]() | |
virtual | ~GmLuaAccessorBase () |
Destructor. | |
virtual QString | toString () const |
Default method used by the __tostring metamethod to capture the result of tostring() over an object. | |
GmGaussAccessor * | accessor () const |
Returns the wrapped accessor. | |
![]() | |
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. | |
Private Types | |
typedef QPair< const GmCell *, int > | I |
Type for an object index. Makes the implementation follow closer the one in GmLuaAccessorIndex. | |
Private Member Functions | |
I | parseIndex (lua_State *L, int stackPos, QString fname) const |
Parses and checks an index based on a cell object + an IP number. | |
int | numPoints (lua_State *L) |
Returns the number of integration points of the specified cell. | |
int | isDefValue (lua_State *L) |
Returns true if the value at the specified index is equal to the default value. More... | |
int | isFunction (lua_State *L) |
Returns true if the value at the specified index is a function. More... | |
int | value (lua_State *L) |
Returns the scalar, vector or matrix value at the specified index, calculated at the specified coordinate, if available and the value is a function that requires an element coordinate. More... | |
int | setValue (lua_State *L) |
Updates the value at the specified position. The given value can be a scalar, a vector or a matrix. Vectors and matrices can be represented by lua Tables or by vector/matrix objectes. If the accessor supports functions, the value can also be a function name. It can also be a string if the accessor supports a constant map. More... | |
int | setValueAsDef (lua_State *L) |
Updates the value at the specified position with the default value. More... | |
int | valueStr (lua_State *L) |
Returns the value at the given index converted to a string (even for multivalued values). More... | |
int | functionId (lua_State *L) |
Returns the name of the function in the given index or an empty string if this is not a function. | |
Private Attributes | |
GmElementMesh * | _mesh |
The associated mesh. Used by parseIndex to validate integration points. | |
Additional Inherited Members | |
![]() | |
GmLuaAccessorBase (GmGaussAccessor *ac, const GmLogCategory &logger, bool ownership) | |
Constructor. Receives the ValueAccessor to be wrapped. More... | |
void | parseCoord (lua_State *L, int stackPos, QString fname, GmVector &coord) |
An auxiliary function used to parse a coordinate table / object from the lua stack. More... | |
void | parseOptions (lua_State *L, int stackPos, Options &opt) |
Aux function to parse print options for the valueStr() call if the object at stackPos is a table. | |
void | pushResult (lua_State *L, const double *val) |
Pushes an accessor result on the stack. Value can be pushed as a number (scalar) or as a matrix. | |
![]() | |
GmLuaObject (const GmLogCategory &logger) | |
Construtor protegido. Somente classes derivadas devem ser instanciadas. | |
![]() | |
GmGaussAccessor * | _ac |
The wrapped value accessor object. | |
bool | _owner |
Do we own the accessor? | |
![]() | |
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. | |
A proxy class to export GmGaussAccessor methods to the Lua environment.
GmLuaGaussAccessor::GmLuaGaussAccessor | ( | GmGaussAccessor * | ac, |
GmElementMesh * | mesh, | ||
const GmLogCategory & | logger, | ||
bool | ownership = true |
||
) |
Constructor. Receives the GaussAccessor to be wrapped.
Due to its nature, wrapped accessors WILL be DELETED together with the proxy. THIS IS A DIFFERENT BEHAVIOUR from other kinds of proxy Lua objects
|
private |
Returns true if the value at the specified index is equal to the default value.
IMPORTANT: Following Lua spirit, the integration point index is ONE based (and not zero based as in C)
|
private |
Returns true if the value at the specified index is a function.
IMPORTANT: Following Lua spirit, the integration point index is ONE based (and not zero based as in C)
|
private |
Updates the value at the specified position. The given value can be a scalar, a vector or a matrix. Vectors and matrices can be represented by lua Tables or by vector/matrix objectes. If the accessor supports functions, the value can also be a function name. It can also be a string if the accessor supports a constant map.
Stack parameters: index (cell + ip), [dim], value (either a scalar, a table, an object or a function/constant name). IMPORTANT: Following Lua spirit, the integration point index is ONE based (and not zero based as in C). If a dimension is given, it is also ONE based.
|
private |
Updates the value at the specified position with the default value.
Stack parameters: index(cell + ip) IMPORTANT: Following Lua spirit, the integration point index is ONE based (and not zero based as in C)
|
private |
Returns the scalar, vector or matrix value at the specified index, calculated at the specified coordinate, if available and the value is a function that requires an element coordinate.
Stack parameters: index (cell + ip), optional coordinate (either a table or an object).
IMPORTANT: Following Lua spirit, the integration point index is ONE based (and not zero based as in C)
The coordinate value is optional. If present it can be a lua table or a vector object.
The returned value can be a single number for scalar values or a vector/matrix object for other value types.
|
private |
Returns the value at the given index converted to a string (even for multivalued values).
Stack parameters: index(cell + ip), optional coord (either a table or an object), optional options table. IMPORTANT: Following Lua spirit, the integration point index is ONE based (and not zero based as in C)
The options table can have the following optional fields: evalFunctions – Should we evaluate functions or do we print its name? Default = false defNil – Should we print default values as 'nil'? Default = false format – Printf like format string (ex: '12.4f')