GemaLuaCoreLib
The GeMA Lua Core library
Loading...
Searching...
No Matches
GmLuaCellMesh Class Reference

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

#include <gmLuaMesh.h>

Inheritance diagram for GmLuaCellMesh:
Collaboration diagram for GmLuaCellMesh:

Public Member Functions

 GmLuaCellMesh (GmCellMesh *mesh, const GmLogCategory &logger)
 Constructor.
 
virtual const char * typeName () const
 Returns the object type as will be stored in the object metatable.
 
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.
 
- Public Member Functions inherited from GmLuaMesh
 GmLuaMesh (GmMesh *mesh, const GmLogCategory &logger)
 Constructor. Receives the mesh to be wrapped.
 
virtual ~GmLuaMesh ()
 Destructor.
 
virtual QString toString () const
 Default method used by the __tostring metamethod to capture the result of tostring() over an object.
 
GmMeshmesh () const
 Returns the wrapped mesh.
 
- 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.
 
- Public Member Functions inherited from LuaProxy::Base

Private Member Functions

int numCells (lua_State *L)
 Returns the number of cells in this mesh.
 
int numActiveCells (lua_State *L)
 Returns the number of active cells in this mesh.
 
int cell (lua_State *L)
 Returns a cell object given the cell index inside the mesh.
 
int hasElementsWithoutTopology (lua_State *L)
 Returns true if the mesh includes elements without topology support (non-manifold elements like bars for a surface mesh and bars, quads and triangles for solid meshes), false otherwise.
 
int hasSolidElements (lua_State *L)
 Returns true if the mesh includes solid lements.
 
int adjacentCell (lua_State *L)
 Returns a cell object that is adjacent to a given cell through a given side (edge for surface meshes, face for solid meshes). Also returns as a second value the side from the adjacent cell.
 
int nodeAdjacentNodes (lua_State *L)
 Returns the list of adjacent nodes that neigbours the given node. A second string parameter defines the query options and can be either "star" or "qstar". If not given, the "star" default is used.
 
int nodeAdjacentCells (lua_State *L)
 Returns the list of adjacent cells that shares the given node.
 
int edgeAdjacentCells (lua_State *L)
 Returns the list of adjacent cells that shares the given edge, identified by a cell and a local edge index. The returned list includes the original input cell.
 
int edgeAdjacentCellsFromNodes (lua_State *L)
 Returns the list of adjacent cells that shares the given edge, identified by a node pair.
 
int isBorderNode (lua_State *L)
 Returns true if the given node belongs to the mesh border.
 
int numBorders (lua_State *L)
 Returns the number of border curves / surfaces for a mesh.
 
int borderIndex (lua_State *L)
 Returns the border index for the given border side, identified by a cell and a local side (edge or face) index. The returned value is the associated border index (a value between 1 and numBorders()) for border sides, 0 for a border side that belongs to a topological "hole" in the mesh created by the intersection of multiple interface elements, -1 for non border sides and -2 for strange elements.
 
int firstBorderCurveEdge (lua_State *L)
 Given a border curve index from a surface mesh, returns a mesh edge belonging to that border. The edge is specified by the returned cell object and the local edge index inside the cell.
 
int nextBorderCurveEdge (lua_State *L)
 Given a cell edge belonging to a border from a surface mesh, returns the next edge in the border. The current edge is specified by a cell object (or id) and the local edge index inside the cell, and should be the values returned by firstBorderCurveEdge() or by the last call to nextBorderCurveEdge(). The next edge is given by a cell object and the local edge index inside the cell.
 
int borderTraverseStart (lua_State *L)
 Initializes a border traversal from the border index. Returns the traversal context.
 
int borderTraverseNext (lua_State *L)
 Returns the next cell, side pair. Returns nil when done. Gets as parameter the context from borderTraverseStart()
 
int borderTraverseEnd (lua_State *L)
 Ends the border traversal.
 
int clearTopology (lua_State *L)
 Gives a hint to the mesh that the topology information will not be needed anymore and can be removed, if at all possible.
 
int numCellTypes (lua_State *L)
 Returns a table specifying the number of cells in the mesh for each cell type.
The tabled is keyed by the cell type (string). Only the types used in the mesh have entries set in the result table.
 
int numActiveCellTypes (lua_State *L)
 Returns a table specifying the number of active cells in the mesh for each cell type.
The tabled is keyed by the cell type (string). Only the types used in the mesh have entries set in the result table.
 
int maxNumCellNodes (lua_State *L)
 Returns the maximum number of nodes among the cell types in use on this mesh.
 
int maxNumCellGhostNodes (lua_State *L)
 Returns the maximum number of ghost nodes among the cells on this mesh.
 
int maxTotalNumCellNodes (lua_State *L)
 Returns the maximum total number of nodes (common + ghost) among the cells on this mesh.
 
int isValid (lua_State *L)
 Returns true if all the mesh cells are valid.
 
int edgeMinLength (lua_State *L)
 Returns the minimum edge length in the mesh.
 
int edgeMaxLength (lua_State *L)
 Returns the maximun edge length in the mesh.
 
int cellBboxMinLength (lua_State *L)
 Returns the minimun length of a cell bounding box diagonal in the mesh.
 
int cellBboxMaxLength (lua_State *L)
 Returns the maximun length of a cell bounding box diagonal in the mesh.
 
int clearCellStatistics (lua_State *L)
 Clear cell statistics, forcing them to be recalculated.
 
int printQualityHistogram (lua_State *L)
 Prints cells quality histogram.
 
int cellGroupIds (lua_State *L)
 Returns a table with cell group names.
 
int cellGroupIndex (lua_State *L)
 Returns the group index for a given group name or nil if not found.
 
int numCellsInGroup (lua_State *L)
 Given a cell group index (position in list returned by cellGroupIds()), returns the number of elements in a group.
 
int cellInGroup (lua_State *L)
 Given a cell group index (position in list returned by cellGroupIds()) and a cell index inside the group (betwwen 1 and numCellsInGroup()), returns a cell object.
 
int cellBoundaryGroups (lua_State *L)
 Returns a table indexed by boundary group names, with cell boundary objects.
 
int numPropertySets (lua_State *L)
 Returns the number of property sets associated to this mesh.
 
int propertySets (lua_State *L)
 Returns a list with property cell objects tied to this mesh.
 
int propertySetIndex (lua_State *L)
 Returns the index in the list returned by propertySets(), of the property set that contains the given property (identified by its id). Returns nil if the requested property does not exist.
 
int cellPropertyInfo (lua_State *L)
 Returns a GmLuaValueInfo object with information about the requested property. Returns nil if the requested value does not exist.
 
int cellPropertyAccessor (lua_State *L)
 Returns an accessor object for querying property values or nil on error.
 
int cellValueIds (lua_State *L)
 Returns a table with a list of cell attribute ids associated to this mesh.
 
int cellValueInfo (lua_State *L)
 Returns a GmLuaValueInfo object with information about the requested cell attribute or state var. Returns nil if the requested value does not exist.
 
int cellValueAccessor (lua_State *L)
 Returns an accessor object for querying cell attributes or nil on error.
 
int addCellValueSet (lua_State *L)
 Adds a new cell value set to the mesh.
 
int removeCellValueSet (lua_State *L)
 Tries to remove a cell attribute set stored in the mesh.
 
int clearCellValueSets (lua_State *L)
 Removes the cell attribute sets stored in the mesh.
 
int saveCellValueState (lua_State *L)
 Saves the state of the given cell value. Receives as parameter the value id and a string describing the save mode ('init', 'noinit' or 'copy'). Returns true if successfull.
 
int numCellValueStates (lua_State *L)
 Returns the number of existing states for the requested id or -1 if the id doesn't exists.
 
int cellValueStateTag (lua_State *L)
 Returns the state tag attached to the requested state of the named value or "" if the id doesn't exists.
 
int cellValueStateTime (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 setCellValueStateTag (lua_State *L)
 Sets a tag name for the requested state of the named value. Does nothing if the id doesn't exists.
 
int setCellValueStateTime (lua_State *L)
 Sets a time tag for the requested state of the named value. Does nothing if the id doesn't exists.
 
int addCells (lua_State *L)
 Given a map describing the type and quantity of the cells to insert, add them to the mesh. Returns the index of the first new value.
 
int addCellGroup (lua_State *L)
 Adds a new cell group to the mesh if the "editGroups" capability is supported. Receives the group name as parameter. Returns the new group index or nil if it
could not be created.
 
int addCellsToGroup (lua_State *L)
 Adds a list of cells to the given cell group (identified by its index). Added cells can be given as either a table with cell ids or a table with subtables containing id ranges. Requires support for the the "editGroups" capability. Returns true on succes, false on error.
 
int originalToLocalOrderCell (lua_State *L)
 Translates an original model cell index to its local, renumbered, mesh index (but still 1 - based). If the cell is invalid, raises an error. If it is a valid cell index but does not belongs to the current mesh partition, returns 0.
 
int localOrderToOriginalCell (lua_State *L)
 Translates a local, renumbered, mesh cell index (but still 1 - based) to the original model cell index. If the cell is invalid, raises an error. If it is a valid cell but does not have a corresponding Model index, returns 0.
 
int addColoringAsMeshAttribute (lua_State *L)
 Given a group set or a table with groups sets and a new cell attribute id name, adds a new attribute to the mesh with the given name storing the color of each cell. Uncolored group sets are ignored.
 
int printColoringStatistics (lua_State *L)
 Prints coloring statistics.
 
int addPartitionInfoAsMeshAttributes (lua_State *L)
 Adds to the mesh a set of new node and cell attributes with information on node and cell classes plus their associated data. Gets as parameters the cell and node attribute prefixes.
 
int addDebugPartitionInfoAsMeshAttributes (lua_State *L)
 Similar to addPartitionInfoAsMeshAttributes() for a partition created in debug mode. Also adds owner attributes.
 
int printPartitionRankTemplateData (lua_State *L)
 Prints partition rank template data.
 
int printPartitionClassStatistics (lua_State *L)
 
const GmCellMeshTopologyensureTopologySupport (lua_State *L, const char *fname)
 Helper function to check for mesh topology support. If ok, returns the topology object. Otherwise, generates a lua error and does not return. fname should be the name of the called method. Used for the error message.
 
int pushCellList (lua_State *L, const QVector< GmCell * > &cellList)
 Helper function to push on the stack the contents of the given cell list as a new lua table. Returns 1 as a convenience.
 
GmCellgetCellFromObjectOrIndex (lua_State *L, int pos, const char *fname)
 Returns a required cell object from the given stack position. Accepts either a cell object or a cell index. If not found, launches a Lua error using fname on the error message.
 

Additional Inherited Members

- Protected Member Functions inherited from GmLuaObject
 GmLuaObject (const GmLogCategory &logger)
 Construtor protegido. Somente classes derivadas devem ser instanciadas.
 
- Protected Attributes inherited from GmLuaMesh
GmMesh_mesh
 The mesh '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.
 

Detailed Description

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

Member Function Documentation

◆ addCells()

int GmLuaCellMesh::addCells ( lua_State * L)
private

Given a map describing the type and quantity of the cells to insert, add them to the mesh. Returns the index of the first new value.

The map received as parameter should be indexed by type name, having as value the number of cells of that type

◆ addCellValueSet()

int GmLuaCellMesh::addCellValueSet ( lua_State * L)
private

Adds a new cell value set to the mesh.

Receives on the stack a valueInfo object with the description of the new cell 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.

◆ adjacentCell()

int GmLuaCellMesh::adjacentCell ( lua_State * L)
private

Returns a cell object that is adjacent to a given cell through a given side (edge for surface meshes, face for solid meshes). Also returns as a second value the side from the adjacent cell.

The original cell can be specified either by an id or by a cell object Returns nil if there is no adjacent cell, i.e., side is part of the mesh boundary. Also returns nil for "strange" elements that don't have topology information (non-manifold elements like bars for a surface mesh and bars, quads and triangles for solid meshes). Following Lua tradition, the index is one based

◆ cell()

int GmLuaCellMesh::cell ( lua_State * L)
private

Returns a cell object given the cell index inside the mesh.

Following Lua tradition, the index is one based

◆ cellPropertyAccessor()

int GmLuaCellMesh::cellPropertyAccessor ( lua_State * L)
private

Returns an accessor object for querying property values or nil on error.

Receives as stack parameter the name of the desired property and, optionally, the unit in which values should be returned

◆ cellPropertyInfo()

int GmLuaCellMesh::cellPropertyInfo ( lua_State * L)
private

Returns a GmLuaValueInfo object with information about the requested property. Returns nil if the requested value does not exist.

Receives as stack parameter the name of the desired property

◆ cellValueAccessor()

int GmLuaCellMesh::cellValueAccessor ( lua_State * L)
private

Returns an accessor object for querying cell attributes or nil on error.

Receives as stack parameter the name of the desired cell attribute and, optionally, the unit in which values should be returned. A third optional parameter defines the state to be queried

◆ cellValueIds()

int GmLuaCellMesh::cellValueIds ( lua_State * L)
private

Returns a table with a list of cell attribute ids associated to this mesh.

  If called with no parameters, the returned list will contain both
  state variables and cell attributes (in this order). If called with
  the string "sv" as parameter, returns only state variables. If called
  with "attr" as parameter, returns only cell attributes.

◆ cellValueInfo()

int GmLuaCellMesh::cellValueInfo ( lua_State * L)
private

Returns a GmLuaValueInfo object with information about the requested cell attribute or state var. Returns nil if the requested value does not exist.

Receives as stack parameter the name of the desired cell attribute / state var. Can optionaly receive a filter string: "sv" to return only state vars and "attr" to return only cell attributes.

◆ edgeMaxLength()

int GmLuaCellMesh::edgeMaxLength ( lua_State * L)
private

Returns the maximun edge length in the mesh.

IMPORTANT: only works well with linear cells

◆ edgeMinLength()

int GmLuaCellMesh::edgeMinLength ( lua_State * L)
private

Returns the minimum edge length in the mesh.

IMPORTANT: only works well with linear cells

◆ fillMetatable()

void GmLuaCellMesh::fillMetatable ( lua_State * L,
int index )
virtual

Prepares the object metatable for calling methods.

Reimplemented from GmLuaMesh.

Reimplemented in GmLuaElementMesh.

◆ firstBorderCurveEdge()

int GmLuaCellMesh::firstBorderCurveEdge ( lua_State * L)
private

Given a border curve index from a surface mesh, returns a mesh edge belonging to that border. The edge is specified by the returned cell object and the local edge index inside the cell.

IMPORTANT: this function should NOT be called for solid meshes.

◆ getClassMetatableID()

virtual void * GmLuaCellMesh::getClassMetatableID ( )
inlinevirtual

Returns an unique identifier to identify an user object as a GmLuaMesh object.

Reimplemented from GmLuaMesh.

Reimplemented in GmLuaElementMesh.

◆ nextBorderCurveEdge()

int GmLuaCellMesh::nextBorderCurveEdge ( lua_State * L)
private

Given a cell edge belonging to a border from a surface mesh, returns the next edge in the border. The current edge is specified by a cell object (or id) and the local edge index inside the cell, and should be the values returned by firstBorderCurveEdge() or by the last call to nextBorderCurveEdge(). The next edge is given by a cell object and the local edge index inside the cell.

IMPORTANT: this function should NOT be called for solid meshes.

◆ nodeAdjacentCells()

int GmLuaCellMesh::nodeAdjacentCells ( lua_State * L)
private

Returns the list of adjacent cells that shares the given node.

Following Lua tradition, the index is one based

◆ nodeAdjacentNodes()

int GmLuaCellMesh::nodeAdjacentNodes ( lua_State * L)
private

Returns the list of adjacent nodes that neigbours the given node. A second string parameter defines the query options and can be either "star" or "qstar". If not given, the "star" default is used.

Following Lua tradition, the index is one based

◆ propertySetIndex()

int GmLuaCellMesh::propertySetIndex ( lua_State * L)
private

Returns the index in the list returned by propertySets(), of the property set that contains the given property (identified by its id). Returns nil if the requested property does not exist.

Receives as stack parameter the name of the desired property

◆ typeName()

virtual const char * GmLuaCellMesh::typeName ( ) const
inlinevirtual

Returns the object type as will be stored in the object metatable.

Reimplemented from GmLuaMesh.

Reimplemented in GmLuaElementMesh.


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