GemaLuaCoreLib
The GeMA Lua Core library
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
GmLuaCell Class Reference

A proxy class to export GmCell methods to the Lua environment. More...

#include <gmLuaCell.h>

Inheritance diagram for GmLuaCell:
Inheritance graph
[legend]
Collaboration diagram for GmLuaCell:
Collaboration graph
[legend]

Public Member Functions

 GmLuaCell (GmCell *cell, const GmLogCategory &logger)
 Constructor. Receives the cell to be wrapped.
 
virtual ~GmLuaCell ()
 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.
 
GmCellcell () const
 Returns the wrapped cell.
 
- Public Member Functions inherited from GmLuaObject
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 Member Functions

void parseFillMatrixParameters (lua_State *L, GmValueAccessor **nodeAc, GmValueAccessor **uAc, int *index, bool *transposed, GmCellFillMode *mode, const char *fname)
 Helper function to parse and validate parameters for the several fillXxxxMatrix() functions. By passing NULL to uAc and / or index, the caller controls the expected Lua stack parameters. If either uAc or index is NOT NULL, the mode can only be "nodes" or "vertices". In case of errors, this function does not return, calling luaL_error(). The index range (if index is not NULL) is NOT validated.
 
void parseSizeMethodParameters (lua_State *L, GmValueAccessor **nodeAc, GmLuaMatrix **XProxy, int *index, GmCellGeometryMode *mode, const char *fname)
 Helper function to parse and validate parameters for the length(), area(), volume() and characteristicXXX() functions. By passing NULL to index, the caller controls the expected Lua stack parameters. In case of errors, this function does not return, calling luaL_error(). The index range (if index is not NULL) is NOT validated.
 
- Protected Member Functions inherited from GmLuaObject
 GmLuaObject (const GmLogCategory &logger)
 Construtor protegido. Somente classes derivadas devem ser instanciadas.
 

Protected Attributes

GmCell_cell
 The cell 'wrapped' by this proxy object.
 
- Protected Attributes inherited from GmLuaObject
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 cell id (one based)
 
int mesh (lua_State *L)
 Returns the cell mesh.
 
int type (lua_State *L)
 Returns a string decribing the cell type ('quad4', 'quad9', 'tri3', etc)
 
int active (lua_State *L)
 Returns a boolean telling if the cell is active or not.
 
int geometry (lua_State *L)
 Returns an object representing the cell geometry.
 
int numNodes (lua_State *L)
 Returns the number of nodes in the cell.
 
int numGhostNodes (lua_State *L)
 Returns the number of ghost nodes in the cell.
 
int totalNumNodes (lua_State *L)
 Returns the total number of nodes in the cell (numNodes() + numGhostNodes())
 
int nodeIndex (lua_State *L)
 Returns the global node index given its local one (1-based)
 
int nodes (lua_State *L)
 Returns a table fille with cell nodes (1-based). Can include ghost nodes depending on the ghost parameter.
 
int propertyIndex (lua_State *L)
 Returns the property index for a given property set index.
 
int fillNodeMatrix (lua_State *L)
 Given a node accessor, returns a matrix with the coordinates of the cell nodes. More...
 
int fillFaceNodeMatrix (lua_State *L)
 Given a node accessor and a face index, returns a matrix with the coordinates of that face's nodes. More...
 
int fillEdgeNodeMatrix (lua_State *L)
 Given a node accessor and an edge index, returns a matrix with the coordinates of that edge's nodes. More...
 
int fillDeformedNodeMatrix (lua_State *L)
 Given a node accessor and a deformation accessor, returns a matrix with the coordinates of the cell nodes with the applied deformation. More...
 
int fillDeformedFaceNodeMatrix (lua_State *L)
 Given a node accessor, a deformation accessor and a face index, returns a matrix with the coordinates of that face's nodes with the applied deformation. More...
 
int fillDeformedEdgeNodeMatrix (lua_State *L)
 Given a node accessor, a deformation accessor and an edge index, returns a matrix with the coordinates of that Edge's nodes with the applied deformation. More...
 
int setActive (lua_State *L)
 Given a boolean with the new cell state, updates the cell active state.
 
int setNodes (lua_State *L)
 Given a table with node numbers, updates the cell node list.
 
int addGhostNode (lua_State *L)
 Adds a new ghost node to the cell, returning the new node local index. Expects as parameters the ghost node index.
 
int removeGhostNode (lua_State *L)
 Removes a ghost node from the cell given its local index.
 
int setProperties (lua_State *L)
 Given a table with node properties, updates the cell property list.
 
int adjacentCell (lua_State *L)
 Given a side index, returns the adjacent cell by that side. Also returns the side number on the adjacent cell.
 
int length (lua_State *L)
 Returns the length of a bar or 2D interface element or the length of the given edge for other element types Gets as parameters a node coordinate accessor or a coordinate matrix, an optional edge index for 2D (non interface) & 3D elements and an access mode string ('element' or 'linear') that can define that the mesh geometry is linear, even if the element is quadratic. A missing value means "auto" mode, when that definition is given by the mesh.
 
int area (lua_State *L)
 Returns the area of a 2D (non interface) element / 3D interface element or the area of the given face for other element types. Gets as parameters a node coordinate accessor or a coordinate matrix, an optional face index for 3D (non interface) elements and an access mode string ('element' or 'linear') that can define that the mesh geometry is linear, even if the element is quadratic. A missing value means "auto" mode, when that definition is given by the mesh.
 
int volume (lua_State *L)
 
int characteristicLength (lua_State *L)
 Returns the cell characteristic length, defined as the length for 1D elements / 2D interface elements, the square root of the area for 2D (non interface) elements / 3D interface elements and the cubic root of the volume for 3D (non interface) elements Gets as parameters a node coordinate accessor or a coordinate matrix and an access mode string ('element' or 'linear') that can define that the mesh geometry is linear, even if the element is quadratic. A missing value means "auto" mode, when that definition is given by the mesh.
 
int characteristicDimension (lua_State *L)
 Returns the cell characteristic dimension, defined as the length for 1D elements / 2D interface elements, the area for 2D (non interface) elements / 3D interface elements and the volume for 3D (non interface) elements. Gets as parameters a node coordinate accessor or a coordinate matrix and an access mode string ('element' or 'linear') that can define that the mesh geometry is linear, even if the element is quadratic. A missing value means "auto" mode, when that definition is given by the mesh.
 
int centroidCartesian (lua_State *L)
 Returns a vector with the cartesian coordinates of the cell centroid. Gets as parameters a node coordinate accessor or a coordinate matrix and an access mode string ('element' or 'linear') that can define that the mesh geometry is linear, even if the element is quadratic. A missing value means "auto" mode, when that definition is given by the mesh.
 
int isValid (lua_State *L)
 Given a node accessor, returns true if the cell is valid according to GeMA standart.
 
int quality (lua_State *L)
 Returns the quality value of the cell.
 

Detailed Description

A proxy class to export GmCell methods to the Lua environment.

Member Function Documentation

◆ fillDeformedEdgeNodeMatrix()

int GmLuaCell::fillDeformedEdgeNodeMatrix ( lua_State *  L)
private

Given a node accessor, a deformation accessor and an edge index, returns a matrix with the coordinates of that Edge's nodes with the applied deformation.

Accepts as parameters the coordinate accessor, the deformation data accessor, the edge index, a boolean for transposing the result and a string with the fill mode ('nodes', 'vertices'). If missing, the default 'nodes' will be used.

◆ fillDeformedFaceNodeMatrix()

int GmLuaCell::fillDeformedFaceNodeMatrix ( lua_State *  L)
private

Given a node accessor, a deformation accessor and a face index, returns a matrix with the coordinates of that face's nodes with the applied deformation.

Accepts as parameters the coordinate accessor, the deformation data accessor, the face index, a boolean for transposing the result and a string with the fill mode ('nodes', 'vertices'). If missing, the default 'nodes' will be used.

◆ fillDeformedNodeMatrix()

int GmLuaCell::fillDeformedNodeMatrix ( lua_State *  L)
private

Given a node accessor and a deformation accessor, returns a matrix with the coordinates of the cell nodes with the applied deformation.

Accepts as parameters the coordinate accessor, the deformation data accessor, a boolean for transposing the result and a string with the fill mode ('nodes', 'vertices', 'ghost' and 'all'). If missing, the default 'nodes' will be used.

◆ fillEdgeNodeMatrix()

int GmLuaCell::fillEdgeNodeMatrix ( lua_State *  L)
private

Given a node accessor and an edge index, returns a matrix with the coordinates of that edge's nodes.

Accepts as parameters the coordinate accessor, an edge index, a boolean for transposing the result and a string with the fill mode ('nodes', 'vertices'). If missing, the default 'nodes' will be used.

◆ fillFaceNodeMatrix()

int GmLuaCell::fillFaceNodeMatrix ( lua_State *  L)
private

Given a node accessor and a face index, returns a matrix with the coordinates of that face's nodes.

Accepts as parameters the coordinate accessor, a face index, a boolean for transposing the result and a string with the fill mode ('nodes', 'vertices'). If missing, the default 'nodes' will be used.

◆ fillNodeMatrix()

int GmLuaCell::fillNodeMatrix ( lua_State *  L)
private

Given a node accessor, returns a matrix with the coordinates of the cell nodes.

Accepts as parameters the coordinate accessor, a boolean for transposing the result and a string with the fill mode ('nodes', 'vertices', 'ghost' and 'all'). If missing, the default 'nodes' will be used.


The documentation for this class was generated from the following files: