23 #ifndef _GEMA_GHOSTNODE_ACCESSOR_H_ 24 #define _GEMA_GHOSTNODE_ACCESSOR_H_ 117 return (index >= 0 && index <
size()) ? index : -1;
124 index -= firstGhostIndex;
125 return (index >= 0 && index <
size()) ? index : -1;
163 int fieldWidth = 0,
char format =
'g',
int precision = -1,
166 return t(&index)->
valueStr(index, evalFunctions, printDefAsNil, fieldWidth, format, precision, coord);
190 assert(0); Q_UNUSED(context); Q_UNUSED(ownsContext);
virtual bool hasUnitConversion() const =0
Returns true if this accessor perfroms unit conversions, false if not.
virtual double scalarValueAt(int index, const GmVector *coord) const
Similar to valueAt() but returning a single double. Must be used for scalar data sets only.
Definition: gmGhostNodeAccessor.h:144
Auxiliar class used to store the definition of a value. It can be used to store informations about st...
Definition: gmValueInfo.h:126
virtual bool setValueAsDef(int index)
Similar to setValue(), filling the index entry with the default value.
Definition: gmGhostNodeAccessor.h:153
virtual bool isFunction(int index) const
Returns true if the data in index is a reference to a function (in C or Lua). Used by valueStr() to m...
Definition: gmGhostNodeAccessor.h:176
virtual int adjustLinearIndex(int index, int firstGhostIndex)
Simmilar to adjustLinearIndex(int, const GmMesh*), this function overload gets as second parameter th...
Definition: gmGhostNodeAccessor.h:121
virtual GmValueInfo * info() const
Returns the information object describing the values returned by this accessor.
Definition: gmGhostNodeAccessor.h:129
virtual void convertFromAccessorUnit(double val, double *dst) const
Copies the values given by val into the area pointed to by dst, converting units if needed.
Definition: gmGhostNodeAccessor.h:218
int ghostSize() const
Returns the number of 'ghost' nodes in this accessor.
Definition: gmGhostNodeAccessor.h:110
virtual GmValueSetEvalContext * evalContext() const
Returns the internal evaluation context. Needed by GmCellAccessorProxy, GmBcAccessorProxy & state dum...
Definition: gmGhostNodeAccessor.h:198
virtual bool setScalarValue(int index, double value)=0
Similar to setValue() but passing a single double. Must be used for scalar data sets only.
The GmStateDump class presents a higher level of abstraction over GmMemoryDump, storing accessor data...
Definition: gmStateDump.h:52
virtual const double * valueAt(int index, const GmVector *coord) const =0
Returns the value associated with the "index" position of the data set, evaluated at the requested po...
virtual bool setValue(int index, const double *value)
Allows for altering the value associated with entry "index" in the value set. This version of the fun...
Definition: gmGhostNodeAccessor.h:147
Class responsible for evaluating a UserFunction over a node / cell.
Definition: gmUserFunction.h:148
GmValueAccessor * _cAc
The accessor for the data tied to the common, "geometric", nodes.
Definition: gmGhostNodeAccessor.h:257
int nodeSize() const
Returns the number of 'common' (geometric) nodes in this accessor.
Definition: gmGhostNodeAccessor.h:107
virtual bool setValueAsDef(int index)=0
Similar to setValue(), filling the index entry with the default value.
virtual int adjustLinearIndex(int index, const GmMesh *m)
Translates a linear index (from 0 to mesh->totalNumNodes()-1) into a valid index for this accessor or...
Definition: gmGhostNodeAccessor.h:113
const double * value(int index) const
Similar to valueAt(), passing NULL as coordinates.
Definition: gmValueAccessor.h:158
virtual bool setValueFromVariant(int index, const QVariant &v, bool acceptMissingDimension, QString &err)
Sets a value with data read from a QVariant.
Definition: gmGhostNodeAccessor.h:173
virtual double convertToAccessorUnit(double val) const
An utility function that given a value, converts it to the accessor unit. If no conversion is needed,...
Definition: gmGhostNodeAccessor.h:212
virtual Unit unit() const
Returns the unit in which data returned/received by the accessor is expressed.
Definition: gmGhostNodeAccessor.h:135
GmValueAccessor * t(int *index)
Non const version of the homonimous function.
Definition: gmGhostNodeAccessor.h:245
Interface class for accessing and setting values from an "indexable" collection of values.
Definition: gmValueAccessor.h:59
virtual bool isDefValue(int index) const
Returns true if the value at the specified index is equal to the default value defined by info()->def...
Definition: gmGhostNodeAccessor.h:132
int toLocalGhostIndex(int nodeIndex) const
Given a global ghost index (a value >= numNodes() and < totalNumNodes()), returns a zero based versio...
Definition: gmMesh.h:126
virtual void convertFromAccessorUnit(double val, double *dst) const =0
Copies the values given by val into the area pointed to by dst, converting units if needed.
static bool isGhostNode(int nodeIndex)
Returns true if the given index is a ghost node index, false if not.
Definition: gmMesh.h:109
virtual bool setFunctionFromName(int index, QString userFunctionId, QString &err)=0
Sets a function value from the function name.
static int clearGhostFlag(int nodeIndex)
Returns the given index with the ghost node bit cleared.
Definition: gmMesh.h:115
Declaration of the GmMesh interface class.
virtual QString functionId(int index) const
Returns a function id name for a function reference at the index or an empty string for non function ...
Definition: gmGhostNodeAccessor.h:179
void setGhostData(bool mode)
Changes the flag that states if this context is tied to a ghost value set or not.
Definition: gmValueSetEvalContext.h:84
virtual int size() const =0
Returns the number of values in the set refered to by the accessor, meaning that valid indices will f...
virtual bool isFunction(int index) const =0
Returns true if the data in index is a reference to a function (in C or Lua). Used by valueStr() to m...
virtual double scalarValueAt(int index, const GmVector *coord) const =0
Similar to valueAt() but returning a single double. Must be used for scalar data sets only.
virtual bool setScalarValue(int index, double value)
Similar to setValue() but passing a single double. Must be used for scalar data sets only.
Definition: gmGhostNodeAccessor.h:150
virtual GmValueSetEvalContext * evalContext() const =0
Returns the internal evaluation context. Needed by GmCellAccessorProxy, GmBcAccessorProxy & state dum...
Declaration of the GmValueSetEvalContext class.
virtual double convertToAccessorUnit(double val) const =0
An utility function that given a value, converts it to the accessor unit. If no conversion is needed,...
virtual Unit unit() const =0
Returns the unit in which data returned/received by the accessor is expressed.
virtual int size() const
Returns the number of values in the set refered to by the accessor, meaning that valid indices will f...
Definition: gmGhostNodeAccessor.h:104
virtual void convertFromAccessorUnit(const double *val, double *dst) const
Copies the values given by val into the area pointed to by dst, converting units if needed.
Definition: gmGhostNodeAccessor.h:221
Declaration of the GmValueAccessor interface and GmValueAccessorBase class.
Auxiliar class used to store the needed information to translate an user function id / user function ...
Definition: gmValueSetEvalContext.h:45
virtual QString valueStr(int index, bool evalFunctions, bool printDefAsNil, int fieldWidth=0, char format='g', int precision=-1, const GmVector *coord=NULL) const =0
Auxiliary function to return the value of an accessor converted to a string. Works for scalars,...
virtual bool setFunctionValue(int index, GmUserFunctionEvaluator *functionEval)
Overload of setValue() storing a user function evaluation context.
Definition: gmGhostNodeAccessor.h:159
A proxy class that receives as parameters two accessors for the same data, one for the common node da...
Definition: gmGhostNodeAccessor.h:75
virtual bool setValue(int index, const double *value)=0
Allows for altering the value associated with entry "index" in the value set. This version of the fun...
virtual QString valueStr(int index, bool evalFunctions, bool printDefAsNil, int fieldWidth=0, char format='g', int precision=-1, const GmVector *coord=NULL) const
Auxiliary function to return the value of an accessor converted to a string. Works for scalars,...
Definition: gmGhostNodeAccessor.h:162
virtual bool setFunctionFromName(int index, QString userFunctionId, QString &err)
Sets a function value from the function name.
Definition: gmGhostNodeAccessor.h:170
GmGhostNodeAccessor(GmValueAccessor *commonAc, GmValueAccessor *ghostAc)
Constructor receiving as parameters the wrapped accessors.
Definition: gmGhostNodeAccessor.h:85
const GmValueAccessor * t(int *index) const
Given an index, returns the accessor that should be called and also changes the value of the given in...
Definition: gmGhostNodeAccessor.h:234
virtual GmValueInfo * info() const =0
Returns the information object describing the values returned by this accessor.
virtual void setEvalContext(GmValueSetEvalContext *context, bool ownsContext)
Sets the EvalContext object that will be used to translate function names / objects into function eva...
Definition: gmGhostNodeAccessor.h:182
virtual ~GmGhostNodeAccessor()
Virtual destructor.
Definition: gmGhostNodeAccessor.h:97
virtual bool isDefValue(int index) const =0
Returns true if the value at the specified index is equal to the default value defined by info()->def...
virtual const double * valueAt(int index, const GmVector *coord) const
Returns the value associated with the "index" position of the data set, evaluated at the requested po...
Definition: gmGhostNodeAccessor.h:141
virtual bool setValueFromVariant(int index, const QVariant &v, bool acceptMissingDimension, QString &err)=0
Sets a value with data read from a QVariant.
virtual bool setFunctionValue(int index, GmUserFunction *functionDef)=0
Overload of setValue() storing a user function definition.
virtual QString functionId(int index) const =0
Returns a function id name for a function reference at the index or an empty string for non function ...
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
Base interface class for Mesh type plugins.
Definition: gmMesh.h:44
Class used to store the definition of a user function and its parameters.
Definition: gmUserFunction.h:78
virtual bool setFunctionValue(int index, GmUserFunction *functionDef)
Overload of setValue() storing a user function definition.
Definition: gmGhostNodeAccessor.h:156
virtual bool hasUnitConversion() const
Returns true if this accessor perfroms unit conversions, false if not.
Definition: gmGhostNodeAccessor.h:138
GmValueAccessor * _gAc
The accessor for the data tied to ghost nodes.
Definition: gmGhostNodeAccessor.h:258
virtual const double * convertToAccessorUnit(const double *p) const
An utility function that given a pointer to the stored data, converts the value to the accessor unit ...
Definition: gmGhostNodeAccessor.h:215