![]() |
GemaCoreLib
The GeMA Core library
|
Declaration of the GmUserFunction and GmUserFunctionEvaluator classes. More...
#include "gmCoreConfig.h"
#include "gmValueInfo.h"
#include "gmCell.h"
#include "gmInterpolator.h"
#include "gmThreadLocalBuffer.h"
#include <QString>
#include <unit.h>
Go to the source code of this file.
Classes | |
class | GmUserFunction |
Class used to store the definition of a user function and its parameters. More... | |
struct | GmUserFunction::GmUserFunctionParameter |
Auxiliar structure for storing function parameter information. More... | |
class | GmUserFunctionEvaluator |
Class responsible for evaluating a UserFunction over a node / cell. More... | |
class | GmUserFunctionEvaluator::ParamContext |
Auxiliar class storing the information needed to collect a parameter value. More... | |
class | GmUserFunctionContext |
The context received by C methods giving access to parameters data and metadata. More... | |
Typedefs | |
typedef bool(GmPhysicsUserFunctions::* | GmCUserMethod) (const GmUserFunctionContext *context, double *out) |
A pointer to a C function exported from a physics plugin to evaluate the value of some attribute / property. More... | |
Enumerations | |
enum | GmUserFunctionType { GM_NODE_USER_FUNCTION, GM_CELL_USER_FUNCTION } |
Type of a user function. More... | |
Declaration of the GmUserFunction and GmUserFunctionEvaluator classes.
typedef bool(GmPhysicsUserFunctions::* GmCUserMethod) (const GmUserFunctionContext *context, double *out) |
A pointer to a C function exported from a physics plugin to evaluate the value of some attribute / property.
The function can use the received context argument to access function parameters, as requested by the Lua function descriptor, and metadata specification, both for the parameters and for the result type. Calculated result values should be stored in the "out" vector, wich is an allocated array with "n" entries, n given by context->resultSize().
Also, the function can use values stored in the GmPhysicsUserFunctions object to further help its work. Among those informations that are always present in the object are a pointer to the complete simulation data, a pointer to the mesh and a logger object. Also, the 'context' argument stores the id of the node / cell that this function is acting upon.
If the function wishes to report an error, it should return false and emmit a message using the configured plugin logger. If false is returned, the value accessor will return to its caller the default value for the attribute / property.
enum GmUserFunctionType |