![]() |
GemaCoreLib
The GeMA Core library
|
Base interface class for Physics type plugins. More...
#include <gmPhysics.h>
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... | |
GmCellAccessor * | 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) |
An auxilliary function that given a property name, retrieves the accessor for that property. More... | |
GmCellAccessor * | extPropertyAccessor (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. | |
GmDiscontinuityAccessor * | discontinuityPropertyAccessor (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. | |
GmDiscontinuityAccessor * | extDiscontinuityPropertyAccessor (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. | |
![]() | |
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 | |
GmCellAccessor * | 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) |
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... | |
GmValueAccessor * | 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) |
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... | |
GmValueAccessor * | nodeDataAccessor (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. | |
GmBoundaryConditionAccessor * | boundaryAccessor (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() | |
GmContactBoundaryConditionAccessor * | contactAccessor (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... | |
![]() | |
virtual const GmLogCategory & | logger () const |
Returns the internal logger used by the plugin to emmit messages. | |
GmSimulationData * | simulationData () const |
Returns a reference to the simulation data object keeping global simulation information. | |
Private Member Functions | |
GmCellAccessor * | 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) |
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... | |
GmDiscontinuityAccessor * | discontinuityPropertyAccessorAux (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... | |
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
GmPhysics::GmPhysics | ( | GmSimulationData * | simulation, |
QString | id, | ||
QString | description, | ||
const GmLogCategory & | logger | ||
) |
Constructor.
simulation | Reference to the simulation object. |
id | Physics id. |
description | Physics description. |
logger | Plugin logger object used to emmit messages |
|
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().
|
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.
|
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.
|
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.
|
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.
|
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.
|
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().