GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
GmSolutionData Class Reference

Auxiliar class used to store the complete set of solution methods data for a simulation. More...

#include <gmSolutionData.h>

Collaboration diagram for GmSolutionData:

Public Member Functions

 GmSolutionData ()
 Constructor.
 
 ~GmSolutionData ()
 Destructor.
 
void clear ()
 Clears the solution data, deleting every solution object and restoring the object to its construction state.
 
const QMap< QString, GmPhysics * > & physics () const
 Returns a const reference to the state vars map.
 
const QMap< QString, GmNumSolver * > & numSolvers () const
 Returns a const reference to the numerical solvers map.
 
bool addPhysics (GmPhysics *phys)
 Adds a physical method to the model. Returns false if an object with the same id already exists. The model takes ownership of the object.
 
bool addNumSolver (GmNumSolver *nsolver)
 Adds a numeric solver to the model. Returns false if an object with the same id already exists. The model takes ownership of the object.
 
GmNumSolveraddNewNumSolver (GmSimulationData *simData, QString id, QString pluginType, const QVariantMap &attributes, bool addToSolution=true)
 Adds a new numeric solver to the solution. The plugin type defines the plugin that will be used for building the solver, as well as its type. Attributes can be used to pass configuration options to the plugin (the standard "id" and "typeName" attributes should not be added to the attributes map). If addToSolution is false, the new solver will be created and returned, but it will NOT be registered in the solution numeric solvers map. Returns NULL on errors.
 
void removeNumSolver (QString id, bool deleteSolver=true)
 Removes a numeric solver object from the solution. 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 process or interpolator storing a pointer to this solver). The base scenario where calling this function is safe is to destroy a numeric solver object created for using an interpolator, after the interpolator destruction (but for that case, a better approach is to not add the solver to the solution at all, and just delete the solver after using). If deleteSolver is true, the object will be deleted after being removed from the solution.
 
LuaFunctionmainScript ()
 Returns a reference for the main lua script.
 
QString pythonScript () const
 Returns a reference for the main python script.
 
const QMap< QString, QString > & processSetMap () const
 Returns the map associating process set names with plugin names.
 
void setMainScript (LuaFunction &f)
 Updates the main Lua script used for the simulation.
 
void setPythonScript (QString script)
 Updates the python script when _mainScript is empty.
 
bool addProcessSet (QString setName, QString pluginName)
 Adds a new entry to the process set map. Returns false if the setName already exists in the map.
 
void printInfo (const GmLogCategory &logger)
 Prints information about the simulation using the provided logger (Info category)
 

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

LuaFunction _mainScript
 Reference for the main script function.
 
QString _pythonScript
 The python script used for the simulation if _mainScript is invalid.
 
QMap< QString, QString_processSetMap
 Map storing for each process function group the name of the plugin that implements it.
 
QMap< QString, GmPhysics * > _physicsMap
 Map storing physics objects, keyed by physics id.
 
QMap< QString, GmNumSolver * > _numSolverMap
 Map storing numeric solvers, keyed by solver id.
 

Detailed Description

Auxiliar class used to store the complete set of solution methods data for a simulation.

Member Function Documentation

◆ addObjectToMap()

template<class T >
template bool GmSolutionData::addObjectToMap< GmNumSolver > ( T * obj,
QMap< QString, T * > & map )
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.


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