![]() |
GemaCoreLib
The GeMA Core library
|
Auxiliar class used to store the complete set of model data for a simulation. More...
#include <gmModelData.h>

Public Member Functions | |
| GmModelData () | |
| Constructor. | |
| ~GmModelData () | |
| Destructor. | |
| void | clear () |
| Clears the model data, deleting every model object and restoring the object to its construction state. | |
| const QMap< QString, GmStateVar * > & | stateVars () const |
| Returns a const reference to the state vars map. | |
| const QMap< QString, int > & | stateVarGroupNames () const |
| Returns a const reference to the map assigning sequential group ids to group names. | |
| const QMap< QString, GmPropertySet * > & | propertySets () const |
| Returns a const reference to the property sets map. | |
| const QMap< QString, GmMesh * > & | meshes () const |
| Returns a const reference to the meshes map. | |
| const QMap< QString, GmPCR * > & | pcrObjects () const |
| Returns a const reference to the PCR objects map. | |
| const QMap< QString, GmUserFunction * > & | userFunctions () const |
| Returns a const reference to the user functions map. | |
| const QMap< QString, GmBoundaryCondition * > & | boundaryConditions () const |
| Returns a const reference to the boundary conditions map. | |
| const QMap< QString, GmContactBoundaryCondition * > & | contactBoundaryConditions () const |
| Returns a const reference to the contact boundary conditions map. | |
| const QMap< QString, GmSpatialIndex * > & | spatialIndices () const |
| Returns a const reference to the spatial index map. | |
| const QMap< QString, GmDiscontinuitySet * > & | discontinuitySets () const |
| Returns a const reference to the discontinuity set map. | |
| const QMap< QString, QMap< QString, GmPluginData * > > & | pluginData () const |
| Returns a const reference to the set of per plugin data type maps. | |
| const QMap< QString, GmPluginData * > | pluginData (QString typeName) const |
| Returns the plugin data map storing objects of the given type (remember that in Qt maps are implicitly copied) | |
| bool | addStateVar (GmStateVar *stateVar) |
| Adds a state var to the model. Returns false if an object with the same id already exists or if adding this state var would blow the 'dof' limits. The model takes ownership of the object. | |
| int | numStateVarDofs () const |
| Returns the number of global dof's used by the set of state vars. | |
| bool | addPropertySet (GmPropertySet *propSet) |
| Adds a property set to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| bool | addMesh (GmMesh *mesh) |
| Adds a mesh to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| GmMesh * | addNewEmptyMesh (GmSimulationData *simData, QString id, int dim, QString unit, const QVariantMap &attributes=QVariantMap(), QString pluginType="GemaMesh.elem", bool addToModel=true) |
| Adds a new, empty mesh to the model. Nodes and cells should be added later by calls to the appropriate node and cell adding functions. Gets as parameters the new mesh name (must be unique), the coordinate dimension and unit. An optional attributes map can be provided for additional mesh configurations. Its contents should be made of mesh attribute values in the plugin syntax. The plugin type is optional. If not given, a standard GeMA element mesh will be used. If addToModel is false, the new mesh will be created and returned, but it will NOT be registered in the model mesh map. Returns NULL on errors. | |
| void | removeMesh (QString id, bool deleteMesh=true) |
| Removes a mesh from the model. This is a DANGEROUS function. It can only be called if you are ABSOLUTELY SURE that there is no reference to this mesh lying around (no user functions, physics objects, boundary conditions, interpolator objects, Lua references to the mesh, etc storing a pointer to this mesh). The base scenario where calling this function is safe is to destroy a temporary mesh created by addNewEmptyMesh(), whose resulting mesh was used at a controlled setting, and so you can know that no one else is using the mesh anymore. If deleteMesh is true, the mesh will be deleted after being removed from the model. | |
| bool | addPcrObject (GmPCR *pcr) |
| Adds a PCR object to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| GmPCR * | addNewPcrObject (GmSimulationData *simData, QString id, QString pluginType, GmMesh *mesh, const QVariantMap &attributes, bool addToModel=true) |
| Adds a new, PCR object to the model. The plugin type defines the plugin that will be used for building the object as well as its type. The mesh is the mesh associated with the object (if NULL, the caller is responsible to call GmPCR::setMesh() before using the PCR object). Attributes can be used to pass configuration options to the plugin (the standard "id", "typeName" and "mesh" attributes should not be added to the attributes map). If addToModel is false, the new object will be created and returned, but it will NOT be registered in the model pcr map. Returns NULL on errors. | |
| GmPCR * | newDefaultPcrObject (GmSimulationData *simData, QString meshId, GmMesh *mesh, const GmLogCategory &logger) |
| Creates a new default "empty" PCR object that can be used by meshes that have no associated object. The object is NOT added to the model and is created with a default id composed by a standard suffix + meshId. If mesh is NULL, the caller is responsible to call GmPCR::setMesh() before using the PCR object. The returned object should be destroyed by the mesh owning it. | |
| void | removePcrObject (QString id, bool deletePcr=true) |
| Removes a PCR object from the model. This is a DANGEROUS function. It can only be called if you are ABSOLUTELY SURE that there is no reference to this object lying around (no mesh storing a pointer to this index). The base scenario where calling this function is safe is to destroy a PCR object created by a mesh that could not be correctly created and will be deleted. If deletePcr is true, the object will be deleted after being removed from the model. | |
| bool | addUserFunction (GmUserFunction *ufunc) |
| Adds a user function to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| bool | addBoundaryCondition (GmBoundaryCondition *bc) |
| Adds a boundary condition to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| bool | addContactBoundaryCondition (GmContactBoundaryCondition *bc) |
| Adds a contact boundary condition to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| bool | addSpatialIndex (GmSpatialIndex *index) |
| Adds a spatial index to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| GmSpatialIndex * | addNewSpatialIndex (GmSimulationData *simData, QString id, QString pluginType, GmMesh *mesh, const QVariantMap &attributes, bool addToModel=true) |
| Adds a new, spatial index to the model. The plugin type defines the plugin that will be used for building the index as well as its type. The mesh is the mesh to be indexed and should already be filled with its nodes and cells. Attributes can be used to pass configuration options to the plugin (the standard "id", "typeName" and "mesh" attributes should not be added to the attributes map). If addToModel is false, the new index will be created and returned, but it will NOT be registered in the model index map. Returns NULL on errors. | |
| void | removeSpatialIndex (QString id, bool deleteIndex=true) |
| Removes a spatial index from the model. This is a DANGEROUS function. It can only be called if you are ABSOLUTELY SURE that there is no reference to this index lying around (no interpolator object, discontinuity set, Lua references to the index, etc storing a pointer to this index). The base scenario where calling this function is safe is to destroy a temporary index created by addNewSpatialIndex(), whose resulting index was used at a controlled setting, and so you can know that no one else is using it anymore. If deleteIndex is true, the index will be deleted after being removed from the model. | |
| bool | addDiscontinuitySet (GmDiscontinuitySet *dset) |
| Adds a spatial index to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| GmDiscontinuitySet * | addNewEmptyDiscSet (GmSimulationData *simData, QString id, QString desc, GmCellMesh *mesh, GmSpatialIndex *index, const QVariantMap &options=QVariantMap(), bool addToModel=true) |
| Adds a new, empty discontinuitySet to the model. Adding geometry data and processing happens in a later stage. Attributes, properties and options follows the same model of the discontinuitySet. Options not set are read from config. | |
| void | removeDiscontinuitySet (QString id, bool deleteDisc=true) |
| Removes a discontinuitySet from the model. If deleteDisc is true, the discontinuitySet will be deleted after being removed from the model. | |
| bool | addPluginData (GmPluginData *pdata) |
| Adds a plugin data object to the model. Returns false if an object with the same id already exists. The model takes ownership of the object. | |
| void | setStateVarGroupName (GmStateVar *stateVar, QString name) |
| Updates the state var group name and also its group id based on the group name to id map. | |
| void | printInfo (const GmLogCategory &logger, const GmSimulationData *simData) |
| Prints information about the simulation using the provided logger (Info category). The simData object is used to search for configured print options. | |
Private Member Functions | |
| template<class T > | |
| bool | addObjectToMap (T *obj, QMap< QString, T * > &map) |
| Adds a new object to the list of existing ones. If an object with the same id already exists, does nothing. | |
Private Attributes | |
| QMap< QString, GmStateVar * > | _stateVarMap |
| Map storing state variables information, keyed by state var id. | |
| QMap< QString, GmPropertySet * > | _propertySetMap |
| Map storing property sets, keyed by property set id. | |
| QMap< QString, GmMesh * > | _meshMap |
| Map storing meshes, keyed by mesh id. | |
| QMap< QString, GmPCR * > | _pcrMap |
| Map storing PCR objects, keyed by object id. | |
| QMap< QString, GmUserFunction * > | _userFunctionMap |
| Map storing user defined functions for evaluating attribute / property values. | |
| QMap< QString, GmBoundaryCondition * > | _bcMap |
| Map storing boundary conditions, keyed by boundary condition id. | |
| QMap< QString, GmContactBoundaryCondition * > | _cbcMap |
| Map storing contact boundary conditions, keyed by boundary condition id. | |
| QMap< QString, GmSpatialIndex * > | _spatialIndexMap |
| Map storing spatial indices, keyed by index id. | |
| QMap< QString, GmDiscontinuitySet * > | _discontinuitySetMap |
| Map storing discontinuity sets, keyed by index id. | |
| QMap< QString, QMap< QString, GmPluginData * > > | _pluginDataMap |
| Map storing per plugin data type (alias), a map with the plugin data objects of that type keyed by object id. | |
| QMap< QString, int > | _stateVarGroupNames |
| Map translating state var group names into a sequential group id. | |
| int | _nextDof |
| Next available degree of freedom number. | |
Auxiliar class used to store the complete set of model data for a simulation.
|
private |
Adds a new object to the list of existing ones. If an object with the same id already exists, does nothing.
The model will take the ownership of the added object, which means that it will be deleted by the model data. Returns true if the object was inserted in the list.
| bool GmModelData::addStateVar | ( | GmStateVar * | stateVar | ) |
Adds a state var to the model. Returns false if an object with the same id already exists or if adding this state var would blow the 'dof' limits. The model takes ownership of the object.
When adding the state variable, this function also takes care of attributing a base 'dof' (degree of freedom) number to the state var, if its current value is equal to -1 (the default when creating a new state var), and to assign a group id based on the current state var group name.