FemProcess
The GeMA Fem Process Plugin
Loading...
Searching...
No Matches
GmpFemPhysicsCommonLuaMaterialImp Class Reference

The real implementation of the GmpFemPhysicsCommonLuaMaterial class methods. See comments on that class. More...

#include <gmpFemPhysicsCommonLuaMaterial.h>

Collaboration diagram for GmpFemPhysicsCommonLuaMaterialImp:

Classes

class  CallData
 The auxiliar class used to store prepared user method call data. More...
 
struct  CallDataFunctions
 An aux structure storing how to get / set data for input data sub-tables. More...
 

Public Types

enum  CallDataType {
  CDT_PROPERTY , CDT_NODEATTR , CDT_GAUSSATTR , CDT_GEOMETRY ,
  CDT_USER , CDT_NUMTYPES
}
 Stored data type for input data sub-tables. More...
 
enum  GeometryFields {
  GF_ELEMENT_ID , GF_ELEMENT , GF_TYPE , GF_IP ,
  GF_COORD , GF_CLENGTH , GF_CDIM , GF_NODE_AC ,
  GF_NODE_COORD , GF_N
}
 
typedef QVariant(*) GetFieldDataT(QString field, const void *context, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Type for the function used to get derived class values exported to an input data sub-table. Should return an invalid QVariant on invalid fields. If a table of values needs to be reported, the function should return a QVariantList with the set of values.
 
typedef bool(*) SetFieldDataT(QString field, const void *context, const GmElement *e, int ip, const QVariant &v)
 Type for the function used to set derived class values imported from an output data sub-table. Should return false on invalid fields.
 

Public Member Functions

 GmpFemPhysicsCommonLuaMaterialImp (const GmPluginData *pdata, GmpFemPhysicsCommonMaterial *mat)
 Common Lua material constructor. Receives the PluginData object with the material especification plus its type name and index in order for a class to be able to handle multiple types.
 
 ~GmpFemPhysicsCommonLuaMaterialImp ()
 Virtual destructor.
 
const QVariantMap * materialMetaDataMap ()
 Builds the metadata map returned by every GmpFemPhysicsCommonMaterial object based on the plugin data.
 
bool checkLoadedData (const GmElement *e) const
 
CallData * prepareUserMethodCall (QString fname, const GmElement *e, int ip, const GmVector *coord, const char *userSubTable=NULL, GetFieldDataT userGetF=NULL, SetFieldDataT userSetF=NULL, const void *userContext=NULL) const
 Prepares the CallData object for a later call to the given user method, for the given set of element coordinates. If the field does not exist in the plugin data, returns NULL. If an user sub-table name is given, a table with that name will be added to the input data table, having the setter and getter functions used to retrieve / store data. The store function can be NULL if the value can only be queried. The user context parameter is passed through to the given functions.
 
const GmPluginData * pluginData () const
 Returns the associated plugin data object.
 

Static Public Member Functions

static QVariant propertyAccessorValueToVariant (GmCellAccessor *ac, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Retrieves the given accessor value at the given point and converts it to a QVariant, storing either a double value, for scalar accessors, or a pointer to a newly created GmLuaMatrix object for vector or matrix values.
 
static QVariant nodeAccessorValueToVariant (GmValueAccessor *ac, GmValueAccessor *coordAc, const GmElement *e, int ip, const GmVector *coord, GmInterpolatorType interpType, QVariant interpParam, const GmLogCategory &logger)
 Retrieves the element node values from the given accessor, interpolates the value at the given point and converts it to a QVariant, storing either a double value, for scalar accessors, or a pointer to a newly created GmLuaMatrix object for vector or matrix values. If the interpolation method is GM_NO_INTERPOLATOR, the QVariant contains a table with the values for each cell node.
 
static QVariant gaussAccessorValueToVariant (GmGaussAccessor *ac, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Retrieves the given accessor value at the given point and converts it to a QVariant, storing either a double value, for scalar accessors, or a pointer to a newly created GmLuaMatrix object for vector or matrix values.
 
static void setGaussAccessorValueFromVariant (GmGaussAccessor *ac, const GmElement *e, int ip, const QVariant &v)
 Given a QVariant value that can be either a scalar or a pointer to a GmLuaMatrix object, depending on the accessor value type, sets that value on the accessor.
 
static bool fillMatrixFromVariant (GmMatrix &mat, int nlin, int ncol, const QVariant &v, QString &err)
 Fills the given matrix contents with the value of the GmLuaMatrix stored in the given variant value. If the variant is NULL or has a dimension different from the given number of lines and columns, returns false and fills err, keeping mat unchanged.
 

Private Member Functions

void loadTableData (QString field, QMap< QString, int > &fieldMap, QVector< QPair< GmInterpolatorType, QVariant > > *interpData=NULL, bool savedGaussAttr=false)
 Loads the data from the given plugin data field (properties, nodeAttributes or gaussAttributes) into the metadata map.
 
void loadEntryData (int index, const QVariantMap &data, GmpFemPhysicsCommon::ValueList &list, QMap< QString, int > &map)
 Loads a single data entry into list, also filling map with its name x index maping.
 
QList< GmpFemPhysicsCommon::ValueType > parseDimField (const QVariant &v) const
 Parses a dimension field for loadEntryData()
 
GmpFemPhysicsCommon::RequiredIf parseRequiredField (const QVariant &v) const
 Parses a require field for loadEntryData()
 

Static Private Member Functions

static QVariant getPropertyValue (QString field, const void *context, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Returns the property value associated with the given field, at the given coordinate, as a variant. Returns an empty variant if the field is unknown.
 
static QVariant getNodeAttrValue (QString field, const void *context, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Returns the interpolated node attribute value associated with the given field, at the given coordinate, as a variant. Returns an empty variant if the field is unknown.
 
static QVariant getGaussAttrValue (QString field, const void *context, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Returns the gauss attribute value associated with the given field, at the given coordinate, as a variant. Returns an empty variant if the field is unknown.
 
static bool setGaussAttrValue (QString field, const void *context, const GmElement *e, int ip, const QVariant &v)
 Updates the gauss attribute value associeated with the given field, at the given ip. Returns false if the field is unknown.
 
static QVariant getGeometryValue (QString field, const void *context, const GmElement *e, int ip, const GmVector *coord, const GmLogCategory &logger)
 Returns the geometry value associated with the given field, at the given coordinate, as a variant. Returns an empty variant if the field is unknown.
 
static QVariant variantListToOnStackLuaTable (LuaEnv *env, const QVariantList &v)
 Transforms the received QVariant List on a Lua table, stored on the top of the stack. Returns the LuaTable object as a variant.
 

Private Attributes

const GmPluginData * _pdata
 The associated plugin data object.
 
GmpFemPhysicsCommonMaterial * _mat
 The material that is implemented by this object.
 
QVariantMap * _map
 The metadata map built based on _pdata.
 
QMap< QString, int > _propertyIndexMap
 Map associating property names in _map with their accessor indices.
 
QMap< QString, int > _nodeAttrIndexMap
 Map associating node attribute names in _map with their accessor indices.
 
QMap< QString, int > _gaussAttrIndexMap
 Map associating Gauss attribute names in _map with their accessor indices.
 
QVector< QPair< GmInterpolatorType, QVariant > > _nodeAttrInterpMode
 
CallDataFunctions _propertyCallFunctions
 A vector with the interpolation options for each attribute stored in _nodeAttrIndexMap, ordered by index.
 
CallDataFunctions _nodeAttrCallFunctions
 The set of functions for getting node attribute values. Will have a NULL name if _nodeAttrIndexMap is empty.
 
CallDataFunctions _gaussAttrCallFunctions
 The set of functions for getting/setting gauss attribute values. Will have a NULL name if _gaussAttrIndexMap is empty.
 
CallDataFunctions _geometryCallFunctions
 The set of functions for getting geometry values.
 
GmTLS< CallData, true > _callData
 The per thread set of CallData objects.
 
GmTLS< QSet< QString >, true > _fieldCacheData [CDT_NUMTYPES]
 The per thread cache info on referenced input data sub-table fields, per sub-table type.
 

Static Private Attributes

static QMap< QString, int > _geometryFieldsMap
 Map translating geometry field names into the GeometryFields enum.
 

Detailed Description

The real implementation of the GmpFemPhysicsCommonLuaMaterial class methods. See comments on that class.

Member Enumeration Documentation

◆ CallDataType

Stored data type for input data sub-tables.

Enumerator
CDT_PROPERTY 

The data is a cell property.

CDT_NODEATTR 

The data is a node attribute.

CDT_GAUSSATTR 

The data is a Gauss attribute.

CDT_GEOMETRY 

TH edata is the geometry table.

CDT_USER 

The data is a a derivade class data.

CDT_NUMTYPES 

The number of entries in this enum

◆ GeometryFields

Enumerator
GF_ELEMENT_ID 

Field elemId - the element id.

GF_ELEMENT 

Field elem - the element (cell) object.

GF_TYPE 

Field type - the element type string.

GF_IP 

Field ip - the evaluated integration point index.

GF_COORD 

Field coord - the evaluated integration point natural coordinate.

GF_CLENGTH 

Field clength - the element characteristic length.

GF_CDIM 

Field cdim - the element characteristic dimension.

GF_NODE_AC 

Field nodeAccessor - the node coordinate accessor.

GF_NODE_COORD 

Field nodeMatrix - the matrix with element node coordinates.

GF_N 

Field N - the shape function vector N evaluated at the integration point coordinate.

Member Data Documentation

◆ _geometryFieldsMap

QMap< QString, int > GmpFemPhysicsCommonLuaMaterialImp::_geometryFieldsMap
staticprivate
Initial value:
= {
{"elemId", GF_ELEMENT_ID},
{"elem", GF_ELEMENT},
{"type", GF_TYPE},
{"ip", GF_IP},
{"coord", GF_COORD},
{"clength", GF_CLENGTH},
{"cdim", GF_CDIM},
{"nodeAccessor", GF_NODE_AC},
{"nodeMatrix", GF_NODE_COORD},
{"N", GF_N},
}
@ GF_NODE_AC
Field nodeAccessor - the node coordinate accessor.
Definition gmpFemPhysicsCommonLuaMaterial.h:90
@ GF_ELEMENT_ID
Field elemId - the element id.
Definition gmpFemPhysicsCommonLuaMaterial.h:83
@ GF_CDIM
Field cdim - the element characteristic dimension.
Definition gmpFemPhysicsCommonLuaMaterial.h:89
@ GF_TYPE
Field type - the element type string.
Definition gmpFemPhysicsCommonLuaMaterial.h:85
@ GF_CLENGTH
Field clength - the element characteristic length.
Definition gmpFemPhysicsCommonLuaMaterial.h:88
@ GF_NODE_COORD
Field nodeMatrix - the matrix with element node coordinates.
Definition gmpFemPhysicsCommonLuaMaterial.h:91
@ GF_IP
Field ip - the evaluated integration point index.
Definition gmpFemPhysicsCommonLuaMaterial.h:86
@ GF_ELEMENT
Field elem - the element (cell) object.
Definition gmpFemPhysicsCommonLuaMaterial.h:84
@ GF_COORD
Field coord - the evaluated integration point natural coordinate.
Definition gmpFemPhysicsCommonLuaMaterial.h:87
@ GF_N
Field N - the shape function vector N evaluated at the integration point coordinate.
Definition gmpFemPhysicsCommonLuaMaterial.h:92

Map translating geometry field names into the GeometryFields enum.

< Maps geometry field names used in the user functions to their internal GeometryFields id

◆ _propertyCallFunctions

CallDataFunctions GmpFemPhysicsCommonLuaMaterialImp::_propertyCallFunctions
private

A vector with the interpolation options for each attribute stored in _nodeAttrIndexMap, ordered by index.

The set of functions for getting cell property values. Will have a NULL name if _propertyIndexMap is empty


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