![]() |
GemaCoreLib
The GeMA Core library
|
Auxiliar class used to store the complete set of simulation data. More...
#include <gmSimulationData.h>
Public Member Functions | |
GmSimulationData (GmPluginLoader *loader, const GmPath *paths, const QVariantMap &configConstants, const QVariantMap &configOptions) | |
Constructor. Must be followed by a calls to setSimulationGlobalInfo() and init(). | |
~GmSimulationData () | |
Destructor. | |
void | init () |
Initializes the simulation data. Must be called AFTER the initialization of _options by a call to setSimulationGlobalInfo() More... | |
void | clearData () |
Calls clear for the objects returned by modelData(), solutionData() and resultsData() | |
QString | name () const |
Returns the simulation name. | |
QString | description () const |
Returns the simulation description. | |
const QStringList & | loadedFiles () const |
Returns the list of loaded files for this simulation. | |
void | setSimulationGlobalInfo (QString name, QString description, QVariantMap &constants, QVariantMap &options) |
Updates the simulation global attributes: name & description. | |
void | setLoadedFiles (const QStringList &loadedFiles) |
Updates the list of loaded files for this simulation. | |
void | setSharedCode (QString sharedCode) |
Updates the shared code. | |
GmModelData * | modelData () const |
Returns the model data associated to this simulation. | |
GmSolutionData * | solutionData () const |
Returns the solution definition associated to this simulation. | |
GmResultsData * | resultsData () const |
Returns the results configuration associated to this simulation. | |
QString | sharedCode () const |
Returns the shared code associated to this simulation. | |
GmPluginLoader * | loader () const |
Returns the plugin loader to allow for plugins to load other plugins. | |
const GmPath * | paths () const |
Returns the object storing information for path macro susbstitution. | |
void | printInfo () |
Prints information about the simulation. More... | |
bool | cancelRequested () const |
Do we have a pending request to cancel the simulation? More... | |
GmThreadManager * | threadManager () const |
Returns a pointer to the configured thread manager. | |
GmTaskManager * | taskManager () const |
Returns a pointer to the configured task manager. | |
QtHardwareInfo * | hwInfo () const |
Returns some usefull information about the execution hardware. | |
double | currentTime () const |
Returns the current simulation time in the current time unit. | |
double | previousTime () const |
Returns the previous simulation time in the current time unit. | |
double | currentTime (const Unit &desiredUnit) const |
Returns the current time, optionally converted to the desired unit (if different from Unit()). More... | |
double | previousTime (const Unit &desiredUnit) const |
Returns the previous time, optionally converted to the desired unit (if different from Unit()). More... | |
const Unit & | timeUnit () const |
Returns the unit in which the current time is stored. | |
void | setCurrentTime (double time, bool updatePrev=true) |
Updates the current time. More... | |
void | setPreviousTime (double time) |
Updates the previous time. | |
void | setCurrentTimeUnit (const Unit &unit) |
Updates the current time unit. | |
const QVariant & | optionValue (const QString &name) const |
Returns a reference to the given option value. Looks for the given name first in the data set read from the Simulation model. Next tries the configuration file. If not found in either, returns a reference to an empty (static) QVariant. | |
QVariant | optionValue (const QString &name, const QVariant &defValue) const |
Returns the given option value. Looks for the given name first in the data set read from the Simulation model. Next tries the configuration file. If not found in either, returns the given default value. | |
const QVariant & | constantValue (const QString &name) const |
Returns a reference to the given constant value. Looks for the given name first in the data set read from the Simulation model. Next tries the configuration file. If not found in either, returns a reference to an empty (static) QVariant. | |
QVariant | constantValue (const QString &name, const QVariant &defValue) const |
Returns the given constant value. Looks for the given name first in the data set read from the Simulation model. Next tries the configuration file. If not found in either, returns the given default value. | |
const QVariantMap & | simulationOptions () const |
Returns the map with options read from the simulation. More... | |
const QVariantMap & | simulationConstants () const |
Returns the map with constants read from the simulation. More... | |
const QVariantMap & | configOptions () const |
Returns the map with options read from the config file. More... | |
const QVariantMap & | configConstants () const |
Returns the map with constants read from the config file. More... | |
Private Member Functions | |
QString | variantToString (const QVariant &v) |
Returns a string representing the given variant. | |
void | printMapValues (const GmLogCategory &logger, const QVariantMap &map, const QVariantMap &configMap) |
Prints the set of values stored on the given maps to the logger. | |
const QVariant & | mapValue (const QString &name, const QVariantMap &map, const QVariantMap &configMap) const |
Returns a reference to the given map value. Looks for the given name first in the data set read from the first map. Next tries the configuration map. If not found in either, returns a reference to an empty (static) QVariant. | |
QVariant | mapValue (const QString &name, const QVariantMap &map, const QVariantMap &configMap, const QVariant &defValue) const |
Returns the given map value. Looks for the given name first in the data set read from the first map. Next tries the configuration map. If not found in either, returns the given default value. | |
Private Attributes | |
QString | _name |
Simulation name. | |
QString | _description |
Simulation description. | |
QStringList | _loadedFiles |
The set of Lua files that where loaded for this simulation. | |
QVariantMap | _constants |
The map with constants defined in the simulation section. | |
QVariantMap | _options |
The map with options defined in the simulation section. | |
const QVariantMap & | _configConstants |
The map with constants defined in the configuration file. | |
const QVariantMap & | _configOptions |
The map with options defined in the configuration file. | |
GmModelData * | _model |
Model data. | |
GmSolutionData * | _solution |
Solution method data. | |
GmResultsData * | _results |
Results configuration data. | |
QString | _sharedCode |
The shared code for setting the Lua environment for worker threads. | |
QtHardwareInfo * | _hwInfo |
Some usefull information about the execution hardware. | |
QtGlobalMemUsage * | _initMemoryInfo |
The global memory usage pattern before loading the simulation data. | |
GmThreadManager * | _threadManager |
The configured thread manager. | |
GmTaskManager * | _taskManager |
The configured task manager. | |
GmPluginLoader * | _loader |
The application plugin manager. | |
const GmPath * | _paths |
Object storing the set of important paths for path macro substitution. | |
double | _currentTime |
The current simulation time. | |
double | _prevTime |
The previous simulation time. | |
Unit | _timeUnit |
The current simulation time unit. | |
Auxiliar class used to store the complete set of simulation data.
|
inline |
Do we have a pending request to cancel the simulation?
Returns the information stored on the thread manager, and so, can only be called after init() has been called. Effective only AFTER the simulation started running. Also check the GmSimulationDataCheckForCancelation() macro at gmSimulationDataCancelCheck.h.
|
inline |
Returns the map with constants read from the config file.
Not for general use (used by the loader only). Use the constantValue() method instead.
|
inline |
Returns the map with options read from the config file.
Not for general use (used by the loader only). Use the optionValue() method instead.
double GmSimulationData::currentTime | ( | const Unit & | desiredUnit | ) | const |
Returns the current time, optionally converted to the desired unit (if different from Unit()).
Returns -1.0 if there is no conversion between the current time unit and the desired unit
void GmSimulationData::init | ( | ) |
Initializes the simulation data. Must be called AFTER the initialization of _options by a call to setSimulationGlobalInfo()
Creates the thread & task managers. Also sets config options for the shape functions module.
double GmSimulationData::previousTime | ( | const Unit & | desiredUnit | ) | const |
Returns the previous time, optionally converted to the desired unit (if different from Unit()).
Returns -1.0 if there is no conversion between the previous time unit and the desired unit
void GmSimulationData::printInfo | ( | ) |
Prints information about the simulation.
For allowing the user to decide which information should be printed, four different loggers are used: gema.simInfo gema.modelInfo, gema.solutionInfo and gema.resultsInfo
|
inline |
Updates the current time.
If updatePrev is set to true, the previous time will be updated to the current time (before the current time update), unless time is equal to 0.0 when the previous time will also be set to 0.0. When set to false, the previous time is not changed.
|
inline |
Returns the map with constants read from the simulation.
Not for general use (used by the loader only). Use the constantValue() method instead.
|
inline |
Returns the map with options read from the simulation.
Not for general use (used by the loader only). Use the optionValue() method instead.