24 #ifndef _GEMA_STATE_DUMP_H_ 25 #define _GEMA_STATE_DUMP_H_ 69 void setCompression(
int level,
int minSize) { assert(!_md); _compression = level; _compressionMinSize = minSize; }
74 void setGrowFactors(
double a,
int b) { assert(!_md); _growAFactor = a; _growBFactor = b; }
81 int addStateItem(
GmValueAccessor* ac,
const GmMesh* mesh,
bool fixedHint,
bool ownership =
false,
int groupId = -1,
QString prefix =
"");
82 int addStateItem(
GmCellAccessor* ac,
const GmMesh* mesh,
bool fixedHint,
bool ownership =
false,
int groupId = -1,
QString prefix =
"");
83 int addStateItem(
GmGaussAccessor* ac,
const GmMesh* mesh,
bool fixedHint,
bool ownership =
false,
int groupId = -1,
QString prefix =
"");
85 int addStateItem(
GmVector* data,
bool fixedHint,
int groupId = -1,
QString prefix =
"");
86 int addStateItem(
GmMatrix* data,
bool fixedHint,
int groupId = -1,
QString prefix =
"");
87 int addStateItem(QVariantMap* data,
bool fixedHint,
int groupId = -1,
QString prefix =
"");
88 int addStateItem(
char** data,
int* size,
int sizeMultiplier,
bool fixedHint,
int groupId = -1,
QString prefix =
"");
90 int addStateItem(FILE* fhandle,
QString fileName,
QString tempName,
int groupId = -1,
QString prefix =
"");
101 int stateItemGroup(
int itemId)
const { assert(_md);
return _md->itemGroup(itemId); }
112 return _md->findItem(name, typeMask, typeValue, groupId, start);
115 void setGroupActive(
int groupId,
bool active);
122 bool saveItem(
int itemId, qint64 size = 0, qint64 offset = 0);
123 bool loadItem(
int itemId, qint64 size = 0, qint64 offset = 0);
125 bool saveActiveGroups();
126 bool loadActiveGroups();
129 void flush() { assert(_md && _init); _md->flush(); }
132 void clear() { assert(_md && _init); _md->clear(); }
137 int nextIdInGroup(
int groupId);
143 bool ownership,
int groupId,
QString prefix,
bool* added);
146 bool notifyGroupObjects(
bool load,
bool done,
bool activeOnly);
QVector< GmGroupDumpItem * > _ownedGroupItems
A set of group items owned by the state dump object.
Definition: gmStateDump.h:166
QVector< int > _funcItems
The set of function dump item ids.
Definition: gmStateDump.h:162
void flush()
Ensure that the dump file (if any) is flushed. Meaningfull after individual saves.
Definition: gmStateDump.h:129
void setGrowFactors(double a, int b)
Updates the grow factors applied for dump items expected to grow. Must be called before the first cal...
Definition: gmStateDump.h:74
The GmStateDump class presents a higher level of abstraction over GmMemoryDump, storing accessor data...
Definition: gmStateDump.h:52
Declaration of the GmMemoryDump and GmMemoryDumpItem classes.
The GmGaussAccessor class is a proxy object to a value accesor implementing a more convenient interfa...
Definition: gmGaussAccessor.h:38
A class used to represent a set of boundary conditions of the same type, tied to the same mesh.
Definition: gmBoundaryCondition.h:262
bool _init
Has this object been initialized (init() was called?)
Definition: gmStateDump.h:160
Declaration of the GmMatrix class.
int numStateItems() const
Returns the number of dump items added (can be greater than the number of addStateItem() calls)
Definition: gmStateDump.h:104
void setMode(GmMemoryDumpMode mode)
Updates the dump mode. Must be called before the first call to addStateItem().
Definition: gmStateDump.h:59
Interface class for accessing and setting values from an "indexable" collection of values.
Definition: gmValueAccessor.h:59
Auxiliar class used to store the complete set of simulation data.
Definition: gmSimulationData.h:51
int findStateItem(QString name, int typeMask=0, int typeValue=0, int groupId=-1, int start=0)
Finds the index of a state item identified by its name. See the GmMemoryDump::findItem() method docum...
Definition: gmStateDump.h:109
GmMemoryDumpMode _mode
The dump mode.
Definition: gmStateDump.h:148
GmLogCategory _logger
Basic logger object for state dump messages.
Definition: gmStateDump.h:158
bool _saveAndRestoreSupport
Does the state needs to support a saving and later restore pattern?
Definition: gmStateDump.h:149
bool _printStructure
Should the dump items structure be printed on init()?
Definition: gmStateDump.h:155
The GmBoundaryConditionAccessor class is a proxy object to a value accesor implementing a more conven...
Definition: gmBoundaryConditionAccessor.h:73
QMap< int, QPair< GmGroupDumpItem *, bool > > _groupItems
A map, indexed by group index storing the associated group dump item and a flag stating if this group...
Definition: gmStateDump.h:169
QVector< GmValueAccessor * > _ownedValueAccessors
A set of value accessors owned by the state dump object.
Definition: gmStateDump.h:164
The GmCellAccessor class is a proxy object to a value accesor implementing a more convenient interfac...
Definition: gmCellAccessor.h:66
QMap< QString, int > _acMap
Map keeping track of the already added accessors to the state dump.
Definition: gmStateDump.h:163
GmMemoryDumpMode
Supported memory dump modes.
Definition: gmMemoryDump.h:37
QMap< int, int > _currIdInGroup
Map storing, per group id, the index of its last added item.
Definition: gmStateDump.h:161
QString _dumpFile
The dump file.
Definition: gmStateDump.h:150
void setCompression(int level, int minSize)
Updates the compression level and the minimum size for which compression is desirable....
Definition: gmStateDump.h:69
Declaration of the GmVector class.
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
int _growBFactor
'b' grow factor in ax + b
Definition: gmStateDump.h:154
const GmLogCategory & logger() const
Returns the logger used by the state dump object.
Definition: gmStateDump.h:135
QVector< GmAccessorProxy * > _ownedProxyAccessors
A set of cell, Gauss and BC accessors owned by the state dump object.
Definition: gmStateDump.h:165
void setPrintStructure(bool mode)
Updates the print structure mode. Must be called before the first call to addStateItem().
Definition: gmStateDump.h:77
Class representing a category with multiple logging levels.
Definition: gmLog.h:58
void setSaveAndRestoreSupport(bool mode)
Updates whether save and restore support is enabled or not. Must be called before the first call to a...
Definition: gmStateDump.h:62
Ensure that all dump items stored by GmStateDump have an id() and a logger.
Definition: gmStateDumpItem.h:131
GmMemoryDump * _md
The memory dump object responsible for the actual dumping.
Definition: gmStateDump.h:159
GmStateDumpBaseDataItem * stateItem(int itemId) const
Returns the state dump item associated with the given index.
Definition: gmStateDump.h:98
void clear()
Releases dump memory when dumping to memory.
Definition: gmStateDump.h:132
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
A basic interface used for creating dump items for objects that can be dumped by a composition of mul...
Definition: gmStateDumpItem.h:52
Base interface class for Mesh type plugins.
Definition: gmMesh.h:44
int _compression
The desired compression level (0 = no, 9 = maz, -1 = zlib default)
Definition: gmStateDump.h:151
int _compressionMinSize
The minimum size for which compression makes sense (must be > 0)
Definition: gmStateDump.h:152
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition: gmMatrix.h:38
const GmSimulationData * _simulation
The simulation object.
Definition: gmStateDump.h:157
Helper class with common code for several classes that wrap a value accessor, provinding a slitly dif...
Definition: gmAccessorProxy.h:38
int stateItemGroup(int itemId) const
Returns the group id of the given item.
Definition: gmStateDump.h:101
double _growAFactor
'a' grow factor in ax + b
Definition: gmStateDump.h:153
Class storing a memory dump containing several dump items.
Definition: gmMemoryDump.h:221