GemaLuaCoreLib
The GeMA Lua Core library
Macros | Functions
gmLuaEnv.h File Reference

Declaration of the function used to prepare an environment with the core Lua functions. More...

#include <QtCore/QtGlobal>
Include dependency graph for gmLuaEnv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GML_API_EXPORT   Q_DECL_IMPORT
 

Functions

GML_API_EXPORT void GmLuaPrepareEnvironment (LuaEnv *env, GmSimulationData *simData, const GmLogCategory &logger, bool mainEnv)
 Adds to the environment env the set of global definitions that allows us to use Gema core objects in the Lua environment during a call to ProcessScript(). More...
 
GML_API_EXPORT void GmLuaPrepareMathEnvironment (LuaEnv *env, const GmLogCategory &logger)
 Adds to the environment env the set of global definitions that allows us to use Gema core Matrix and conversion objects in the Lua environment. More...
 
GML_API_EXPORT void GmLuaRegisterSimulationFunctions (LuaEnv *env, GmSimulationData *simData, const GmLogCategory &logger)
 Registers simulation functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterResultFunctions (LuaEnv *env, GmSimulationData *simData, const GmLogCategory &logger)
 Registers result related functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterMatrixFunctions (LuaEnv *env, const GmLogCategory &logger)
 Registers matrix handling functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterInterpolatorFunctions (LuaEnv *env, GmSimulationData *simData, const GmLogCategory &logger)
 Registers interpolation handling functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterPathFunctions (LuaEnv *env, GmSimulationData *simData)
 Registers path handling functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterLoggerFunctions (LuaEnv *env, const GmLogCategory &logger)
 Registers logger handling functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterConvFunctions (LuaEnv *env)
 Registers unit handling functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterTimeFunctions (LuaEnv *env)
 Registers time measuring functions in the Lua Environment. More...
 
GML_API_EXPORT void GmLuaRegisterCancelationFunctions (LuaEnv *env, GmSimulationData *simData=NULL)
 Registers the script cancelation check funtion. If simData is NULL, the registered function can only be called from the main thread. More...
 
GML_API_EXPORT void GmLuaRegisterThreadFunctions (LuaEnv *env, GmSimulationData *simData, const GmLogCategory &logger)
 Registers parallel execution and thread handling functions in the Lua Environment. More...
 

Detailed Description

Declaration of the function used to prepare an environment with the core Lua functions.

Author
Carlos Augusto Teixeira Mendes
Date
september, 2015

Function Documentation

◆ GmLuaPrepareEnvironment()

GML_API_EXPORT void GmLuaPrepareEnvironment ( LuaEnv env,
GmSimulationData simData,
const GmLogCategory logger,
bool  mainEnv 
)

Adds to the environment env the set of global definitions that allows us to use Gema core objects in the Lua environment during a call to ProcessScript().

Creates the following global variables:

  • modelData with type GmLuaModelData
  • Matrix(), a function to create matrices
  • Vector(), a function to create matrices with a single column
  • NodeToCellPointInterpolator(), NodeToElementPointInterpolator(), GaussToElementPointInterpolator(), GaussToElementNodeInterpolator(), GaussNeighborsToNodeInterpolator(), NodeCloudToPointInterpolator() and GaussCloudToPointInterpolator() functions to create several kinds of interpolators
  • nodeBasedMeshGaussToNodes() and elementBasedMeshGaussToNodes() functions to interpolate mesh node values from Gauss point values
  • splineMeshNodesToMeshNodes(), splineMeshNodesToMeshGauss(), splineMeshGaussToMeshNodes() and splineMeshGaussToMeshGauss() functions to interpolate mesh values based on a global spline interpolation of the values in another mesh
  • meshNodesToMeshNodes(), meshNodesToMeshGauss(), meshGaussToMeshNodes() and meshGaussToMeshGauss() functions to interpolate mesh values based on a global interpolation with CDR of the values in another mesh
  • ValueInfo(), a function to create a new valueInfo object
  • ShapeFunction(), a function to retrieve a shape function object;
  • CellGeometry(), a function to retrieve a cell geometry object;
  • convert(), a function to convert values between units
  • checkUnit(), a function to verify if an unit is known or not
  • startTimer(), a function that inits & returns a timer object
  • resetTimer(), a function to reset a timer object
  • elapsedTime(), a function to return the amount of elapsed time for the given timer
  • logMsg(), a function to log messages using the logger infrastructure
  • logMemory(), a function to log memory usage
  • currentTime(), previousTime(), setCurrentTime(), setPreviousTime() and setCurrentTimeUnit()
  • translatePath(), cleanPath()
  • isMeshGhostNode(), setMeshGhostFlag() and clearMeshGhostFlag() to work with mesh ghost nodes;
  • CellGroupSet(), a function to create new cell group sets
  • StateDump(), a function to create a new state dump object;
  • evalResults() a function to force the evaluation of results;
  • registerResultAttribute() a function ta add a new result attribute
  • resultAttributeId() a function to retrieve a result id from the attribute name
  • setResultAttribute() a function to set the value of a result attribute
  • resultAttribute() a function to retrieve the value of a result attribute
  • checkForCancelation(), a function to abort on pending cancelation requests If called for the main Lua environment, also registers:
  • maxWorkerThreads, the maximum configured number of threads for parallel execution
  • maxProcThreads, the maximum number of threads supported by the processor for parallel execution
  • numProcCores, the number of processor cores in the current machine
  • parallelCall(), a function to parallel execute a function
  • nodeParallelCall() and cellParallelCall() to parallel execute a function over sets of nodes / cells
  • lastParallelCallAffinity(), a function to recover the task affinity for the last call to parallelCall(), nodeParallelCall() or cellParallelCall()
  • threadGlobal() and setThreadGlobal() to set / get global variable names in each thread

It also overloads some Lua functions to extend their funcionality by the way of the basicDefinitions.lua resource script, which also defines the following functions:

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaPrepareMathEnvironment()

GML_API_EXPORT void GmLuaPrepareMathEnvironment ( LuaEnv env,
const GmLogCategory logger 
)

Adds to the environment env the set of global definitions that allows us to use Gema core Matrix and conversion objects in the Lua environment.

Creates the following global variables:

  • Matrix(), a function to create matrices
  • Vector(), a function to create matrices with a single column
  • convert() a function to convert values between units
  • checkUnit() a function to verify if an unit is known or not

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaRegisterCancelationFunctions()

GML_API_EXPORT void GmLuaRegisterCancelationFunctions ( LuaEnv env,
GmSimulationData simData 
)

Registers the script cancelation check funtion. If simData is NULL, the registered function can only be called from the main thread.

Creates the following global variables:

  • checkForCancelation(), a function to abort on pending cancelation requests

◆ GmLuaRegisterConvFunctions()

GML_API_EXPORT void GmLuaRegisterConvFunctions ( LuaEnv env)

Registers unit handling functions in the Lua Environment.

Creates the following global variables:

  • convert() a function to convert values between units
  • checkUnit() a function to verify if an unit is known or not

◆ GmLuaRegisterInterpolatorFunctions()

GML_API_EXPORT void GmLuaRegisterInterpolatorFunctions ( LuaEnv env,
GmSimulationData simData,
const GmLogCategory logger 
)

Registers interpolation handling functions in the Lua Environment.

Creates the following global variables:

  • NodeToCellPointInterpolator(), a function to create interpolators to calc cell point data from node data
  • NodeToElementPointInterpolator(), a function to create interpolators to calc element point data from node data
  • GaussToElementPointInterpolator(), a function to create interpolators to calc element point data from Gauss data
  • GaussToElementNodeInterpolator(), a function to create interpolators to calc element node data from Gauss data
  • GaussNeighborsToNodeInterpolator(), a function to create interpolators to calc element node data from Gauss data from neighbor elements
  • NodeCloudToPointInterpolator(), a function to create interpolators to calc an arbitrary point data from a cloud of node data
  • GaussCloudToPointInterpolator(), a function to create interpolators to calc an arbitrary point data from a cloud of Gauss point data
  • nodeBasedMeshGaussToNodes() and elementBasedMeshGaussToNodes(), functions to interpolate mesh node values from Gauss point values
  • splineMeshNodesToMeshNodes(), a function to interpolate mesh node values based on a global spline interpolation over another mesh set of node values
  • splineMeshNodesToMeshGauss(), a function to interpolate mesh Gauss point values based on a global spline interpolation over another mesh set of node values
  • splineMeshGaussToMeshNodes(), a function to interpolate mesh node values based on a global spline interpolation over another mesh set of Gauss values
  • splineMeshGaussToMeshGauss(), a function to interpolate mesh Gauss point values based on a global spline interpolation over another mesh set of Gauss point values
  • meshNodesToMeshNodes(), a function to interpolate mesh node values based on a global interpolation with CDR over another mesh set of node values
  • meshNodesToMeshGauss(), a function to interpolate mesh Gauss point values based on a global interpolation with CDR over another mesh set of node values
  • meshGaussToMeshNodes(), a function to interpolate mesh node values based on a global interpolation with CDR over another mesh set of Gauss values
  • meshGaussToMeshGauss(), a function to interpolate mesh Gauss point values based on a global interpolation with CDR over another mesh set of Gauss point values

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaRegisterLoggerFunctions()

GML_API_EXPORT void GmLuaRegisterLoggerFunctions ( LuaEnv env,
const GmLogCategory logger 
)

Registers logger handling functions in the Lua Environment.

Creates the following global variables:

  • logMsg() a function to log messages using the logger infrastructure
  • logMemory() a function to log memory usage

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaRegisterMatrixFunctions()

GML_API_EXPORT void GmLuaRegisterMatrixFunctions ( LuaEnv env,
const GmLogCategory logger 
)

Registers matrix handling functions in the Lua Environment.

Creates the following global variables:

  • Matrix(), a function to create matrices
  • Vector(), a function to create matrices with a single column

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaRegisterPathFunctions()

GML_API_EXPORT void GmLuaRegisterPathFunctions ( LuaEnv env,
GmSimulationData simData 
)

Registers path handling functions in the Lua Environment.

Creates the following global variables:

  • translatePath(), cleanPath();

◆ GmLuaRegisterResultFunctions()

GML_API_EXPORT void GmLuaRegisterResultFunctions ( LuaEnv env,
GmSimulationData simData,
const GmLogCategory logger 
)

Registers result related functions in the Lua Environment.

Creates the following global variables:

  • evalResults() a function to force the evaluation of results;
  • registerResultAttribute() a function ta add a new result attribute
  • resultAttributeId() a function to retrieve a result id from the attribute name
  • setResultAttribute() a function to set the value of a result attribute
  • resultAttribute() a function to retrieve the value of a result attribute

◆ GmLuaRegisterSimulationFunctions()

GML_API_EXPORT void GmLuaRegisterSimulationFunctions ( LuaEnv env,
GmSimulationData simData,
const GmLogCategory logger 
)

Registers simulation functions in the Lua Environment.

Creates the following global variables:

  • ValueInfo() a function to create a new valueInfo object;
  • ShapeFunction() a function to retrieve a shape function object;
  • CellGeometry() a function to retrieve a cell geometry object;
  • IntegrationRule(), BorderIntegrationRule(), EdgeIntegrationRule() and FaceIntegrationRule(), functions to create new integration rule objects
  • currentTime(), previousTime(), setCurrentTime(), setPreviousTime() and setCurrentTimeUnit();
  • isMeshGhostNode(), setMeshGhostFlag() and clearMeshGhostFlag() to work with mesh ghost nodes;
  • CellGroupSet(), a function to create new cell group sets;
  • StateDump(), a function to create a new state dump object;

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaRegisterThreadFunctions()

GML_API_EXPORT void GmLuaRegisterThreadFunctions ( LuaEnv env,
GmSimulationData simData,
const GmLogCategory logger 
)

Registers parallel execution and thread handling functions in the Lua Environment.

IMPORTANT: This functions should NOT be made avilable for worker thread environments, only for the main thread.

Creates the following global variables:

  • maxWorkerThreads, the maximum configured number of threads for parallel execution
  • maxProcThreads, the maximum number of threads supported by the processor for parallel execution
  • numProcCores, the number of processor cores in the current machine
  • parallelCall(), a function to parallel execute a function
  • nodeParallelCall() and cellParallelCall() to parallel execute a function over sets of nodes / cells
  • lastParallelCallAffinity(), a function to recover the task affinity for the last call to parallelCall(), nodeParallelCall() or cellParallelCall()
  • threadGlobal() and setThreadGlobal() to set / get global variable names in each thread

IMPORTANT: This function REQUIRES that the supplied logger MUST exist during the whole lifetime of the lua environment.

◆ GmLuaRegisterTimeFunctions()

GML_API_EXPORT void GmLuaRegisterTimeFunctions ( LuaEnv env)

Registers time measuring functions in the Lua Environment.

Creates the following global variables:

  • startTimer() a function that inits & returns a timer object
  • resetTimer() a function to reset a timer object
  • elapsedTime() a function to return the amount of elapsed time for the given timer