GemaCoreLib
The GeMA Core library
Classes | Public Member Functions | Private Attributes | List of all members
GmValueSetEvalContext Class Reference

Auxiliar class used to store the needed information to translate an user function id / user function into an user function evaluator. More...

#include <gmValueSetEvalContext.h>

Collaboration diagram for GmValueSetEvalContext:
Collaboration graph
[legend]

Classes

struct  CacheAlignedData
 A structure to merge cache aligned data since they combined fit inside a cache lign. More...
 

Public Member Functions

 GmValueSetEvalContext (GmSimulationData *simData, const GmMesh *mesh)
 Constructor. Receives as parameters the simulation data object, which gives access to the map used for translating user function ids to their respective objects and the bound mesh (which can be empty – see class documentation).
 
 ~GmValueSetEvalContext ()
 Destructor. Destroys every GmUserFunctionEvaluator kept by the EvalContext.
 
const GmMeshmesh () const
 Returns the mesh bound to this EvalContext. Can be NULL for 'incomplete' evaluators.
 
GmSimulationDatasimulationData () const
 Returns the simulationData object.
 
int dataIndex () const
 Returns the node/cell index over which the calculation will be made (-1 if not set by the accessor)
 
int ipIndex () const
 Returns the integration point index equivalent to the coordinate passed to function evaluation or -1 if that information does not exist.
 
bool ghostData () const
 Returns a flag set to true if this context is tied to a ghost value set.
 
void setCell (const GmCell *cell, int ip)
 Sets the cell / integration point over which values will be calculated. More...
 
void setDataIndex (int dataIndex)
 Saves the node / cell over which values will be calculated. Ghost indices should be linear indices.
 
void setGhostData (bool mode)
 Changes the flag that states if this context is tied to a ghost value set or not.
 
GmUserFunctionuserFunction (QString id)
 Returns the user function object tied to an id or NULL if no object with that name exists.
 
GmUserFunctionEvaluatoruserFunctionEvaluator (QString id, const GmValueInfo *info, const GmLogCategory &logger, QString &err)
 Overload of userFunctionEvaluator(GmUserFunction*, ...) receiving an user function name. See that function comments.
 
GmUserFunctionEvaluatoruserFunctionEvaluator (GmUserFunction *ufunc, const GmValueInfo *info, const GmLogCategory &logger, QString &err)
 Given a user function object, returns an evaluator for this function. More...
 
const QMap< GmUserFunction *, GmUserFunctionEvaluator * > & evaluatorMap () const
 Returns a reference to the evaluator map. Must be called from the main thread only, and the returned map also since access to the map on worker threads must be synchronized.
 

Private Attributes

const GmMesh_mesh
 Bound mesh used to evaluate function params.
 
GmSimulationData_simData
 Simulation data.
 
bool _ghostData
 Is this context tied to a ghost value set?
 
GmTLS< CacheAlignedData, true > _data
 Per thread data.
 
QMutex _mapMutex
 A mutex protecting access to _evalMap. More...
 
QMap< GmUserFunction *, GmUserFunctionEvaluator * > _evalMap
 

Detailed Description

Auxiliar class used to store the needed information to translate an user function id / user function into an user function evaluator.

Member Function Documentation

◆ setCell()

void GmValueSetEvalContext::setCell ( const GmCell cell,
int  ip 
)
inline

Sets the cell / integration point over which values will be calculated.

Needed by property sets to store the evaluation cell. The ip parameter should store the integration point index equivalent to the coordinate passed to the function evaluation or -1 if this is not an integration point or the information is unavailable (in that case the function evaluation will try to find out which integration point is equivalent to a coordinate, if necessary, but that takes some effort)

◆ userFunctionEvaluator()

GmUserFunctionEvaluator * GmValueSetEvalContext::userFunctionEvaluator ( GmUserFunction ufunc,
const GmValueInfo info,
const GmLogCategory logger,
QString err 
)

Given a user function object, returns an evaluator for this function.

This function can only be called if the EvalContext was created with a non NULL mesh, giving an assertion otherwise.

First, the function looks for the evaluator on the internal map. If not found, a new evaluator will be created. If it was not possible to create this evaluator, a NULL value is returned and a message reported through the err parameter.

Its important to notice that errors are NOT reported throgh the logger. This is done to achieve a better error message integration with the caller routines. The logger is only passed through to the UserFunctionEvaluator setup.

Member Data Documentation

◆ _mapMutex

QMutex GmValueSetEvalContext::_mapMutex
private

A mutex protecting access to _evalMap.

Map associating user functions with their evaluators for the bound value set


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