GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmPhysics.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_PHYSICS_H_
25#define _GEMA_PHYSICS_H_
26
27#include "gmPluginObject.h"
28#include "gmPluginCategory.h"
29#include "gmUserFunction.h"
30
31class GmCellMesh;
32class GmCellAccessor;
39
42{
43public:
44 GmPhysics(GmSimulationData* simulation, QString id, QString description, const GmLogCategory& logger);
45 virtual ~GmPhysics();
46
47 // Comments on the base class
48 virtual const char* pluginCategory() const { return GM_PLUGIN_PHYSICS; }
49
50 virtual void printParameters(const GmLogCategory& logger);
51
72 GmCellAccessor* propertyAccessor(GmCellMesh* mesh, QString stdPropertyName, QString msgDescription,
73 LuaTable& table, Unit desiredUnit, bool required,
74 int type = -1, int nlin = -1, int ncol = -1,
75 bool canBeFunction = true, bool ignoreWarnings = false)
76 {
77 return propertyAccessorAux(mesh, stdPropertyName, msgDescription, table, desiredUnit, false,
78 required, type, nlin, ncol, canBeFunction, ignoreWarnings);
79 }
80
82 GmCellAccessor* extPropertyAccessor(GmCellMesh* mesh, QString stdPropertyName, QString msgDescription,
83 LuaTable& table, Unit desiredUnit, bool required,
84 int type = -1, int nlin = -1, int ncol = -1,
85 bool canBeFunction = true, bool ignoreWarnings = false)
86 {
87 return propertyAccessorAux(mesh, stdPropertyName, msgDescription, table, desiredUnit, true,
88 required, type, nlin, ncol, canBeFunction, ignoreWarnings);
89 }
90
93 QString msgDescription, LuaTable& table, Unit desiredUnit,
94 bool required, int type = -1, int nlin = -1, int ncol = -1,
95 bool ignoreWarnings = false)
96 {
97 return discontinuityPropertyAccessorAux(discSet, stdPropertyName, msgDescription, table, desiredUnit,
98 false, required, type, nlin, ncol, ignoreWarnings);
99 }
100
103 QString msgDescription, LuaTable& table, Unit desiredUnit,
104 bool required, int type = -1, int nlin = -1, int ncol = -1,
105 bool ignoreWarnings = false)
106 {
107 return discontinuityPropertyAccessorAux(discSet, stdPropertyName, msgDescription, table, desiredUnit,
108 true, required, type, nlin, ncol, ignoreWarnings);
109 }
110
111protected:
112
113 GmCellAccessor* cellAttributeAccessor(GmCellMesh* mesh, QString stdAttributeName, QString msgDescription,
114 LuaTable& table, Unit desiredUnit, bool required, int type = -1,
115 int nlin = -1, int ncol = -1, int history = -1, bool canBeFunction = true,
116 bool create = false, QString createFormat = "", int createHistory = -1,
117 bool ignoreWarnings = false);
118
119 GmCellAccessor* cellDataAccessor(GmCellMesh* mesh, QString stdAttributeName, QString msgDescription,
120 LuaTable& table, Unit desiredUnit, bool required, int type = -1,
121 int nlin = -1, int ncol = -1, int history = -1, bool canBeFunction = true,
122 bool ignoreWarnings = false);
123
124 GmValueAccessor* nodeAttributeAccessor(GmCellMesh* mesh, QString stdAttributeName, QString msgDescription,
125 LuaTable& table, Unit desiredUnit, bool required, int type = -1,
126 int nlin = -1, int ncol = -1, int history = -1, bool canBeFunction = true,
127 bool create = false, QString createFormat = "", int createHistory = -1,
128 bool ignoreWarnings = false);
129
130 GmValueAccessor* nodeDataAccessor(GmCellMesh* mesh, QString stdAttributeName, QString msgDescription,
131 LuaTable& table, Unit desiredUnit, bool required, int type = -1,
132 int nlin = -1, int ncol = -1, int history = -1, bool canBeFunction = true,
133 bool ignoreWarnings = false);
134
135 GmBoundaryConditionAccessor* boundaryAccessor(const GmBoundaryCondition* bc, QString stdPropertyName, QString msgDescription,
136 Unit desiredUnit, bool required, int type = -1,
137 int nlin = -1, int ncol = -1, bool canBeFunction = true, bool ignoreWarnings = false);
138
139 GmContactBoundaryConditionAccessor* contactAccessor(const GmContactBoundaryCondition* bc, QString stdPropertyName, QString msgDescription,
140 Unit desiredUnit, bool required, int type = -1,
141 int nlin = -1, int ncol = -1, bool canBeFunction = true, bool ignoreWarnings = false);
142
143 QString dofFromStateVar(const GmCellMesh* mesh, QString stdStateVarName, QString msgDescription,
144 LuaTable& table, QVector<int>& dofList, Unit resultUnit, bool required,
145 GmValueSetKind svType, int type = -1, int nlin = -1, int ncol = -1,
146 bool ignoreWarnings = false);
147
148 QString translateId(QString stdName, LuaTable& table) const;
149
150 bool checkType (GmValueInfo* info, int type, int nlin, int ncol, bool required, bool ignoreWarnings,
151 QString dataTypeMsg, QString msgDescription) const;
152 bool checkFunction(GmValueInfo* info, bool canBeFunction, bool required, bool ignoreWarnings,
153 QString dataTypeMsg, QString msgDescription) const;
154 bool checkHistory (GmValueInfo* info, int history, bool required, bool ignoreWarnings,
155 QString dataTypeMsg, QString msgDescription) const;
156
157 GmValueInfo* createValueInfo(QString id, QString description, Unit desiredUnit, GmValueSetKind kind,
158 int type, int nlin, int ncol, QString createFormat, int createHistory) const;
159
160private:
161 GmCellAccessor* propertyAccessorAux(GmCellMesh* mesh, QString stdPropertyName, QString msgDescription,
162 LuaTable& table, Unit desiredUnit, bool acceptsCellAttributes,
163 bool required, int type, int nlin, int ncol, bool canBeFunction,
164 bool ignoreWarnings);
165
166 GmDiscontinuityAccessor* discontinuityPropertyAccessorAux(GmDiscontinuitySet* discSet, QString stdPropertyName,
167 QString msgDescription, LuaTable& table, Unit desiredUnit,
168 bool acceptsCellAttributes, bool required,
169 int type, int nlin, int ncol, bool ignoreWarnings);
170};
171
172
177{
178public:
179 GmPhysicsUserFunctions(GmSimulationData* simulation, QString id, QString description, const GmLogCategory& logger);
180 virtual ~GmPhysicsUserFunctions();
181
182 // Comments on the base class
183 virtual const char* pluginCategory() const { return GM_PLUGIN_PHYSICS; }
184
185 // Comments on the base class
186 virtual const char* pluginType() const { return "userFunctions"; }
187
188 virtual bool loadPrivateData(LuaTable& table);
189 virtual void printParameters(const GmLogCategory& logger);
190
192 void setMesh(const GmMesh* mesh) { _mesh = mesh; }
193
195 virtual QStringList functionList() const = 0;
196
198 virtual GmCUserMethod function(QString funcName) const = 0;
199
200protected:
202 const GmMesh* mesh() const { return _mesh; }
203
204private:
205 const GmMesh* _mesh;
206};
207
208
209#endif
210
The GmBoundaryConditionAccessor class is a proxy object to a value accesor implementing a more conven...
Definition gmBoundaryConditionAccessor.h:74
A class used to represent a set of boundary conditions of the same type, tied to the same mesh.
Definition gmBoundaryCondition.h:287
The GmCellAccessor class is a proxy object to a value accesor implementing a more convenient interfac...
Definition gmCellAccessor.h:67
Base interface class for CellMesh type plugins.
Definition gmCellMesh.h:40
The GmContactBoundaryConditionAccessor class is a proxy object to a value accesor implementing a more...
Definition gmContactBoundaryConditionAccessor.h:35
A class used to represent a set of contact boundary conditions of the same type, tied to the same mes...
Definition gmContactBoundaryCondition.h:33
The GmDiscontinuityAccessor class is a proxy object to a value accesor implementing a more convenient...
Definition gmDiscontinuityAccessor.h:48
Base interface for providing discontinuity geometry information for spatial indices.
Definition gmDiscontinuitySet.h:59
Class representing a category with multiple logging levels.
Definition gmLog.h:58
Base interface class for Mesh type plugins.
Definition gmMesh.h:48
Base interface class for Physics type plugins.
Definition gmPhysics.h:42
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.
Definition gmPhysics.h:102
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 auxiliary function that given a property name, retrieves the accessor for that property.
Definition gmPhysics.h:72
virtual const char * pluginCategory() const
Returns the plugin category.
Definition gmPhysics.h:48
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.
Definition gmPhysics.h:92
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...
Definition gmPhysics.h:82
Base interface class for Physics type plugins to export user functions that can be used to provide at...
Definition gmPhysics.h:177
const GmMesh * mesh() const
Returns the mesh that this object is bound to.
Definition gmPhysics.h:202
void setMesh(const GmMesh *mesh)
Sets the mesh that this object is bound to.
Definition gmPhysics.h:192
const GmMesh * _mesh
The mesh that this object is bound to.
Definition gmPhysics.h:205
virtual QStringList functionList() const =0
Returns the set of function names exported by this process object.
virtual const char * pluginCategory() const
Returns the plugin category.
Definition gmPhysics.h:183
virtual const char * pluginType() const
Returns the string identifying the plugin object type. Should return the SAME string as the one read ...
Definition gmPhysics.h:186
virtual GmCUserMethod function(QString funcName) const =0
Returns the method named funcName or NULL if it doesn't exists.
Base interface class for all object plugins.
Definition gmPluginObject.h:37
virtual void printParameters(const GmLogCategory &logger)=0
Asks the object to print all of its parameters using the provided logger.
Definition gmPluginObject.cpp:62
virtual bool loadPrivateData(LuaTable &table)=0
Function called by the model loader to give the object acess to it's private parameters....
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
Auxiliar class used to store the definition of a value. It can be used to store informations about st...
Definition gmValueInfo.h:132
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
Declaration of macros for standard plugin categories.
#define GM_PLUGIN_PHYSICS
Plugin implements physical methods.
Definition gmPluginCategory.h:29
Declaration of the GmPluginObject base class.
Declaration of the GmUserFunction and GmUserFunctionEvaluator classes.
bool(GmPhysicsUserFunctions::* GmCUserMethod)(const GmUserFunctionContext *context, double *out)
A pointer to a C function exported from a physics plugin to evaluate the value of some attribute / pr...
Definition gmUserFunction.h:78
GmValueSetKind
Type describing what kind of information is stored by a values set.
Definition gmValueInfo.h:37