GemaCoreLib
The GeMA Core library
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
GmPhysics Class Reference

Base interface class for Physics type plugins. More...

#include <gmPhysics.h>

Inheritance diagram for GmPhysics:
Inheritance graph
[legend]
Collaboration diagram for GmPhysics:
Collaboration graph
[legend]

Public Member Functions

 GmPhysics (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmPhysics ()
 Virtual destructor.
 
virtual const char * pluginCategory () const
 Returns the plugin category.
 
virtual void printParameters (const GmLogCategory &logger)
 Asks the physics to print all of its parameters using the provided logger. More...
 
GmCellAccessorpropertyAccessor (GmCellMesh *mesh, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 An auxilliary function that given a property name, retrieves the accessor for that property. More...
 
GmCellAccessorextPropertyAccessor (GmCellMesh *mesh, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 Simmilar to propertyAccessor() but also looking for the requested property name in the set of element attributes.
 
GmDiscontinuityAccessordiscontinuityPropertyAccessor (GmDiscontinuitySet *discSet, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool ignoreWarnings=false)
 Simmilar to propertyAccessor() but looking for properties in a discontinuity set.
 
GmDiscontinuityAccessorextDiscontinuityPropertyAccessor (GmDiscontinuitySet *discSet, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool ignoreWarnings=false)
 Simmilar to extPropertyAccessor() but looking for properties/attributes in a discontinuity set.
 
- Public Member Functions inherited from GmPluginObject
 GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor. More...
 
virtual ~GmPluginObject ()
 Destructor.
 
QString id () const
 Returns the object id.
 
QString description () const
 Returns the object description.
 
QString pluginTypeName () const
 Returns the hierarchical type name for the plugin object type. See also pluginName() and pluginType().
 
virtual const char * pluginName () const =0
 Returns a string identifying the plugin which implements this object. Should return the SAME string as the one read from the plugin information file in the pluginName field.
 
virtual const char * pluginType () const =0
 Returns the string identifying the plugin object type. Should return the SAME string as the one read from the plugin information file in the objectTypes table. More...
 
virtual bool loadPrivateData (LuaTable &table)=0
 Function called by the model loader to give the object acess to it's private parameters. Should return false only if the received parameter set makes the use of this object impossible.
 

Protected Member Functions

GmCellAccessorelementAttributeAccessor (GmCellMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool create=false, QString createFormat="", int createHistory=-1, bool ignoreWarnings=false)
 Similar to propertyAccessor() returning an element attribute. The history parameter defines a restriction on the attribute history value (a -1 means that any history type is allowed). If the last parameter (create) is true, the attribute is required and if not found in the mesh, it will be created by the function (and its numeric format will be set to the value given by createFormat if not empty, using createHistory states) More...
 
GmValueAccessornodeAttributeAccessor (GmCellMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool create=false, QString createFormat="", int createHistory=-1, bool ignoreWarnings=false)
 Similar to propertyAccessor() returning a node attribute. The history parameter defines a restriction on the attribute history value (a -1 means that any history type is allowed). If the last parameter (create) is true, the attribute is required and if not found in the mesh, it will be created by the function (and its numeric format will be set to the value given by createFormat if not empty, using createHistory states) More...
 
GmValueAccessornodeDataAccessor (GmCellMesh *mesh, QString stdAttributeName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, int history=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 Similar to nodeAttributeAccessor() but returning either a node attribute or a state var. Can't be used to create new values.
 
GmBoundaryConditionAccessorboundaryAccessor (const GmBoundaryCondition *bc, QString stdPropertyName, QString msgDescription, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 An auxilliary function tha given a boundary condition property name, retrieves the accessor for that property, doing consistency checks in a similar way to those in propertyAccessor()
 
GmContactBoundaryConditionAccessorcontactAccessor (const GmContactBoundaryCondition *bc, QString stdPropertyName, QString msgDescription, Unit desiredUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool canBeFunction=true, bool ignoreWarnings=false)
 An auxilliary function tha given a contact boundary condition property name, retrieves the accessor for that property, doing consistency checks in a similar way to those in propertyAccessor()
 
QString dofFromStateVar (const GmCellMesh *mesh, QString stdStateVarName, QString msgDescription, LuaTable &table, QList< int > &dofList, Unit resultUnit, bool required, int type=-1, int nlin=-1, int ncol=-1, bool ignoreWarnings=false)
 An auxilliary function that given a state var name, retrieves its degree of freedom and appends it to a list of degrees of freedom. More...
 
- Protected Member Functions inherited from GmPluginObject
virtual const GmLogCategorylogger () const
 Returns the internal logger used by the plugin to emmit messages.
 
GmSimulationDatasimulationData () const
 Returns a reference to the simulation data object keeping global simulation information.
 

Private Member Functions

GmCellAccessorpropertyAccessorAux (GmCellMesh *mesh, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool acceptsElementAttributes, bool required, int type, int nlin, int ncol, bool canBeFunction, bool ignoreWarnings)
 An auxilliary function that given a property name, retrieves the accessor for that property. Can also search for the accessor on element attributes if acceptsElementAttributes is true. More...
 
GmDiscontinuityAccessordiscontinuityPropertyAccessorAux (GmDiscontinuitySet *discSet, QString stdPropertyName, QString msgDescription, LuaTable &table, Unit desiredUnit, bool acceptsElementAttributes, bool required, int type, int nlin, int ncol, bool ignoreWarnings)
 An auxilliary function simmilar to that propertyAccessorAux() but getting accessors from a discontinuity set. More...
 

Detailed Description

Base interface class for Physics type plugins.

The class also features some utilitary protected functions to help in common tasks usually found in physcs modules

Constructor & Destructor Documentation

◆ GmPhysics()

GmPhysics::GmPhysics ( GmSimulationData simulation,
QString  id,
QString  description,
const GmLogCategory logger 
)

Constructor.

Parameters
simulationReference to the simulation object.
idPhysics id.
descriptionPhysics description.
loggerPlugin logger object used to emmit messages

Member Function Documentation

◆ discontinuityPropertyAccessorAux()

GmDiscontinuityAccessor * GmPhysics::discontinuityPropertyAccessorAux ( GmDiscontinuitySet discSet,
QString  stdPropertyName,
QString  msgDescription,
LuaTable table,
Unit  desiredUnit,
bool  acceptsElementAttributes,
bool  required,
int  type,
int  nlin,
int  ncol,
bool  ignoreWarnings 
)
private

An auxilliary function simmilar to that propertyAccessorAux() but getting accessors from a discontinuity set.

This is the worker function for both discontinuityPropertyAccessor() and extDiscontinuityPropertyAccessor(). See parameter description in GmPhysics::propertyAccessor().

◆ dofFromStateVar()

QString GmPhysics::dofFromStateVar ( const GmCellMesh mesh,
QString  stdStateVarName,
QString  msgDescription,
LuaTable table,
QList< int > &  dofList,
Unit  resultUnit,
bool  required,
int  type = -1,
int  nlin = -1,
int  ncol = -1,
bool  ignoreWarnings = false 
)
protected

An auxilliary function that given a state var name, retrieves its degree of freedom and appends it to a list of degrees of freedom.

If table is a valid Lua table, we look for a field in that table named with the value of stdStateVarName. If found, that name replaces the value of stdStateVarName.

After that, we look for a mesh state var with the requested name matching the specified type and restrictions. If found, all degrees of freedom associated to that state var are appended to the dofList and the function returns the name of the recovered state var. If not found and required is true, a message is written with the standard logger using msgDescription to clarify the missing state var. The function returns an empty string if no matching state var is found.

If required is false and the property is found but it doesn't match the restrictions, a waring message is printed. The available restrictions include specifying the required data type (-1 means any type) and required data size for vectors (through nlin) or matrices (through nlin and ncol) and also that the state var unit can accept values expressed in the give resultUnit (which expresses the unit in which values will be calculated).

When set to true, the ignoreWarnings flag prevents the emission of log messages when an optional state var was not returned by a type problem.

◆ elementAttributeAccessor()

GmCellAccessor * GmPhysics::elementAttributeAccessor ( GmCellMesh mesh,
QString  stdAttributeName,
QString  msgDescription,
LuaTable table,
Unit  desiredUnit,
bool  required,
int  type = -1,
int  nlin = -1,
int  ncol = -1,
int  history = -1,
bool  canBeFunction = true,
bool  create = false,
QString  createFormat = "",
int  createHistory = -1,
bool  ignoreWarnings = false 
)
protected

Similar to propertyAccessor() returning an element attribute. The history parameter defines a restriction on the attribute history value (a -1 means that any history type is allowed). If the last parameter (create) is true, the attribute is required and if not found in the mesh, it will be created by the function (and its numeric format will be set to the value given by createFormat if not empty, using createHistory states)

Keep in mind that the returned accessor will always point to the current state. To create an accessor for other states one can use the info object bound to the returned accessor to get the accessor name and call _mesh->cellAttributeAccessor() to get the accessor for a previous state.

When set to true, the ignoreWarnings flag prevents the emission of log messages when an optional property was not returned by a type problem.

◆ nodeAttributeAccessor()

GmValueAccessor * GmPhysics::nodeAttributeAccessor ( GmCellMesh mesh,
QString  stdAttributeName,
QString  msgDescription,
LuaTable table,
Unit  desiredUnit,
bool  required,
int  type = -1,
int  nlin = -1,
int  ncol = -1,
int  history = -1,
bool  canBeFunction = true,
bool  create = false,
QString  createFormat = "",
int  createHistory = -1,
bool  ignoreWarnings = false 
)
protected

Similar to propertyAccessor() returning a node attribute. The history parameter defines a restriction on the attribute history value (a -1 means that any history type is allowed). If the last parameter (create) is true, the attribute is required and if not found in the mesh, it will be created by the function (and its numeric format will be set to the value given by createFormat if not empty, using createHistory states)

Keep in mind that the returned accessor will always point to the current state. To create an accessor for other states one can use the info object bound to the returned accessor to get the accessor name and call _mesh->nodeValueAccessor() to get the accessor for a previous state.

When set to true, the ignoreWarnings flag prevents the emission of log messages when an optional property was not returned by a type problem.

◆ printParameters()

void GmPhysics::printParameters ( const GmLogCategory logger)
virtual

Asks the physics to print all of its parameters using the provided logger.

The default implementation logs the data, as seen through the access interface;

Implements GmPluginObject.

◆ propertyAccessor()

GmCellAccessor* GmPhysics::propertyAccessor ( GmCellMesh mesh,
QString  stdPropertyName,
QString  msgDescription,
LuaTable table,
Unit  desiredUnit,
bool  required,
int  type = -1,
int  nlin = -1,
int  ncol = -1,
bool  canBeFunction = true,
bool  ignoreWarnings = false 
)
inline

An auxilliary function that given a property name, retrieves the accessor for that property.

If table is a valid Lua table, we look for a field in that table named with the value of stdPropertyName. If found, that name replaces the value of stdPropertyName.

After that, we look for a mesh property with the requested name matching the specified type and function restrictions. If found that accessor is the returned value, otherwise the function returns NULL. If not found and required is true, a message is written with the standard logger using msgDescription to clarify the missing property.

If required is false and the property is found but it doesn't match the restrictions, a warning message is printed. The available restrictions include specifying the required data type (-1 means any type) and required data size for vectors (through nlin) or matrices (through nlin and ncol). The canBeFunction restriction can be used to disallow properties that might be represented by user functions.

When set to true, the ignoreWarnings flag prevents the emission of log messages when an optional property was not returned by a type problem.

◆ propertyAccessorAux()

GmCellAccessor * GmPhysics::propertyAccessorAux ( GmCellMesh mesh,
QString  stdPropertyName,
QString  msgDescription,
LuaTable table,
Unit  desiredUnit,
bool  acceptsElementAttributes,
bool  required,
int  type,
int  nlin,
int  ncol,
bool  canBeFunction,
bool  ignoreWarnings 
)
private

An auxilliary function that given a property name, retrieves the accessor for that property. Can also search for the accessor on element attributes if acceptsElementAttributes is true.

This is the worker function for both propertyAccessor() and extPropertyAccessor(). See parameter description in GmPhysics::propertyAccessor().


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