GemaLuaCoreLib
The GeMA Lua Core library
Functions
GmLuaInterpolatorUtils Namespace Reference

Aux functions used by several of the interpolator proxy classes. More...

Functions

int pushResults (lua_State *L, const GmVector &result, const QList< GmVector > &resultList, const GmLogCategory &logger, bool resultsCanBeEmpty=false)
 Auxiliary function that given the results filing either result or resultLIst, pushes in the lua stack either a vector, a number, a table of vectors or a table of numbers. Returns 1. If resultsCanBeEmpty and the vectors have size 0, pushes nil on the stack.
 
template<class T , class P >
void parseValueAccessors (lua_State *L, int vIndex, int cIndex, const T *&valueAc, QList< const T * > &valueAcList, const GmValueAccessor *&coordAc, const char *acType)
 Loads from the Lua stack the set of value accessors and the coordinate accessor, filling either valueAc or valueAcList + coordAc. The vIndex parameter gives the index on the Lua stack of the accessor/accessor table for values while cIndex gives the index for the coordinate accessor. If cIndex is -1, the coordinate accessor won't be fetched. The acType parameter is used only on error messages. Types T and P refer to the accessor type (GmValueAccessor / GmGaussAccessor) and its proxy counterpart (GmLuaValueAccessor / GmLuaGaussAccessor)
 
template<class T , class P , class V >
void parseResultAccessors (lua_State *L, int index, T *&resultAc, QList< T * > &resultAcList, const V *valueAc, const QList< const V * > &valueAcList, const char *acType)
 Loads from the Lua stack the set of result accessors, if any, filling either resultAc or resultAcList. The index parameter gives the index on the Lua stack of the accessor/accessor table. valueAc and valueAcList parameters are used to check if the number of result accessors and their dimension are compatible with value accessors. The acType parameter is used only on error messages. Types T and P refer to the result accessor type (GmValueAccessor / GmGaussAccessor) and its proxy counterpart (GmLuaValueAccessor / GmLuaGaussAccessor). The V type refers to the value accessor type.
 
void parseCommonParams (lua_State *L, bool nodeBased, const char *fname, const GmLogCategory **logger, int *interpType, QVariant *interpParam, int *searchMode, double *searchDomain, GmSpatialIndex **spIndex)
 Parses the set of common parameters used by all types of LuaMeshXxxToMeshXxxInterpolation() implementations. More...
 
void parseCommonSplineParams (lua_State *L, bool nodeBased, int solverIndex, const char *fname, const GmLogCategory **logger, int *searchMode, double *searchDomain, GmSpatialIndex **spIndex, GmNumSolver **solver)
 Parses the set of common parameters used by all types of LuaSplineMeshXxxToMeshXxxInterpolation() implementations. More...
 
void checkRuleSets (lua_State *L, const QList< GmGaussAccessor * > &list, const GmLogCategory &logger, bool warn)
 Overload for non constant accessors.
 
void checkRuleSets (lua_State *L, const QList< const GmGaussAccessor * > &list, const GmLogCategory &logger, bool warn)
 Check that the rule set fo all list entries is the same.
 

Detailed Description

Aux functions used by several of the interpolator proxy classes.

Function Documentation

◆ parseCommonParams()

void GmLuaInterpolatorUtils::parseCommonParams ( lua_State *  L,
bool  nodeBased,
const char *  fname,
const GmLogCategory **  logger,
int *  interpType,
QVariant interpParam,
int *  searchMode,
double *  searchDomain,
GmSpatialIndex **  spIndex 
)

Parses the set of common parameters used by all types of LuaMeshXxxToMeshXxxInterpolation() implementations.

Expects:

  • logger as the first upvalue
  • interpolation type and parameters as the first two stack parameters
  • Compact domain search domain and mode as the third and fourth parameters
  • Spatial index at the fifth stack position

The node based parameter controls if the spatial index should implement a nearest node or Gauss capability. The fname parameter is the name of the called Lua function for use in error messages.

Calss luaL_error() on errors, and so does not return in that case.

◆ parseCommonSplineParams()

void GmLuaInterpolatorUtils::parseCommonSplineParams ( lua_State *  L,
bool  nodeBased,
int  solverIndex,
const char *  fname,
const GmLogCategory **  logger,
int *  searchMode,
double *  searchDomain,
GmSpatialIndex **  spIndex,
GmNumSolver **  solver 
)

Parses the set of common parameters used by all types of LuaSplineMeshXxxToMeshXxxInterpolation() implementations.

Expects:

  • logger and simulation data object as the first and second upvalues
  • Compact domain search domain and mode as the first two stack parameters
  • Spatial index at the third stack position
  • Solver at the solverIndex'th stack position

The node based parameter controls if the spatial index should implement a nearest node or Gauss capability. The fname parameter is the name of the called Lua function for use in error messages.

Calss luaL_error() on errors, and so does not return in that case.