24 #ifndef _GEMA_XDMF_FILE_WRITER_H_ 25 #define _GEMA_XDMF_FILE_WRITER_H_ 44 const QVariantMap& options,
bool multipleResults,
bool gaussValues,
bool discValues,
52 const UnitConverter* conv,
const double* scaleFactor,
const double* offset);
59 virtual bool closeFiles(
bool deleteFiles =
false);
75 QString path (
const char* baseName,
int rule,
int iter)
const;
126 void addTopologyEntry (
QString tableName,
int cellType,
int numElem,
int dataSize,
bool forDiscontinuity =
false);
const char * tab() const
Helper function returning the current identation as space string.
Definition: gmXdmfFileWriter.h:71
QString adjustSequenceInName(QString path, int seq) const
Replaces in path the placeholder for the file sequence number. If seq != -1, that value is used inste...
Definition: gmXdmfFileWriter.h:95
virtual GmFileFormat * fileFormat()
Returns the file format of the serializer.
Definition: gmXdmfFileWriter.h:63
virtual bool saveData(const QVector< GmResultNodeDataSrc * > &nodeData, const QVector< GmResultCellDataSrc * > &cellData, const QVector< GmResultGaussDataSrc * > &gaussData, int extraColumns, const QVector< int > &propertySets)
Saves the current result set to the file for the node, cells and Gauss points as defined by the filte...
Definition: gmXdmfFileWriter.cpp:454
void addNodeTopologyEntry(QString tableName, int numNodes)
Add to the output Xdmf file a topology entry for a mesh that has no cells. If tableName is empty,...
Definition: gmXdmfFileWriter.cpp:1354
bool _openGrid
Is there an open grid section in the XDMF file?
Definition: gmXdmfFileWriter.h:141
double _sequenceStartTime
The simulation time at the moment that the current sequence was opened.
Definition: gmXdmfFileWriter.h:157
bool _singlePrecision
Should we force real data to be saved in single precision (floats instead of doubles)?
Definition: gmXdmfFileWriter.h:169
FILE * _xdmfh
The handle for the xdmf control file.
Definition: gmXdmfFileWriter.h:135
void addTimeCollectionSection(bool start)
Add to the output Xdmf file the Grid colletion for a temporal analysis.
Definition: gmXdmfFileWriter.cpp:1188
void addGridDiscontinuitySection(bool start, QString dsName, bool original)
Add to the output Xdmf file a grid section named after the current mesh and the given discontinuity s...
Definition: gmXdmfFileWriter.cpp:1285
QStringList _dsNames
The names of the discontinuity sets.
Definition: gmXdmfFileWriter.h:171
int _splitHDF5Files
0 for a single file. Otherwise, splits the file every _splitHDF5Files iterations
Definition: gmXdmfFileWriter.h:147
Declaration of the GmFileWriter class (old GmFileResultsSerializer)
GmFileIO::DiscontinuityDataMode _dsMode
The saving mode for the discontinuity sets.
Definition: gmXdmfFileWriter.h:172
int _lastDiscontinuityIter
The last iteration number where discontinuity data was saved. -1 if not saved yet....
Definition: gmXdmfFileWriter.h:162
bool _newHDF5File
A flag set to true whenever a new HDF5 is created and reset after node, cell and gauss data groups wh...
Definition: gmXdmfFileWriter.h:158
void addDataAttributeEntry(QString tableName, QString name, QString unit, bool node, int nlin, int ncol1, int ncol2, GmStorageType storage)
Add to the output Xdmf file an attribute data entry. The node attribute defines if the attribute is t...
Definition: gmXdmfFileWriter.cpp:1368
Declaration of the GmValueInfo class.
GmXdmfFileWriter(const GmLogCategory &logger)
Default constructor.
Definition: gmXdmfFileWriter.cpp:52
QString discontinuityGeometryPath(QString dsName, bool original, int iter=0) const
Returns the HDF5 geometry path for the given discontinuity set for the iteration group or for the sin...
Definition: gmXdmfFileWriter.cpp:1120
A support class for saving data to a HDF5 file. Hdf5 files are self-describing but do not have a fixe...
Definition: gmHdf5.h:65
virtual bool addSavedItemsToMap(QVariantMap &map)
This function should add to map any internal serializer state that must be saved on a dump operation,...
Definition: gmXdmfFileWriter.cpp:983
QString _timeUnit
The unit in which time values are expressed.
Definition: gmXdmfFileWriter.h:155
QString _hdf5Prefix
The Hdf5 file name without path (mask included, if any), as used on the xml file to reference an hdf5...
Definition: gmXdmfFileWriter.h:137
GmStorageType
The desired storage type for the data.
Definition: gmValueInfo.h:53
Interface class for accessing and setting values from an "indexable" collection of values.
Definition: gmValueAccessor.h:59
QString geometryPath(int iter=0) const
Returns the HDF5 geometry path for the given iteration group or for the single iteration group if ite...
Definition: gmXdmfFileWriter.h:78
Auxiliar class used to store the complete set of simulation data.
Definition: gmSimulationData.h:51
void partialFileNames(QString &writingName, QString &partialName) const
Fills writingName and partialName with the apropriate file names depending on the _lastPartialSuffix ...
Definition: gmXdmfFileWriter.cpp:697
QString meshPath(int rule=-1) const
Returns the root mesh path. The mesh name is the mesh id with an added suffix if rule >= 0.
Definition: gmXdmfFileWriter.cpp:1093
QString gaussDataPath(int rule, int iter=0) const
Returns the HDF5 gauss data path for the given integration rule and iteration group or for the single...
Definition: gmXdmfFileWriter.h:92
bool _multiTime
Will this file be used for saving multiple time steps?
Definition: gmXdmfFileWriter.h:143
void addTopologyEntry(QString tableName, int cellType, int numElem, int dataSize, bool forDiscontinuity=false)
Add to the output Xdmf file a topology entry. If cellType is -1, a mixed topology is generated and da...
Definition: gmXdmfFileWriter.cpp:1320
QString discontinuityPath(QString dsName, bool original) const
Returns the root discontinuity set path.
Definition: gmXdmfFileWriter.cpp:1103
int _currSequence
The current HDF5 file sequence if _splitHDF5Files > 0. Starts with 1. Set to 0 otherwise.
Definition: gmXdmfFileWriter.h:156
const char * constData() const const
GmStorageType _geometryStorage
The storage type for node coordinates.
Definition: gmXdmfFileWriter.h:167
QVector< int > _dsSizes
The last number of nodes/cells for the original / intersection data when the discontinuity data was l...
Definition: gmXdmfFileWriter.h:178
GmHdf5 * _hdf5
The hdf5 helper object.
Definition: gmXdmfFileWriter.h:138
void addMainSection(bool start, const GmSimulationData *simData)
Add to the output Xdmf file the file header / trailler. simData is needed only when start is true.
Definition: gmXdmfFileWriter.cpp:1157
virtual bool saveGeometry(GmValueAccessor *nodeAc, const double *scaleFactor, const double *offset)
Save mesh node coordinates, cell geometry and gauss rule set coordinates (if needed) to the file,...
Definition: gmXdmfFileWriter.cpp:249
virtual bool closeFiles(bool deleteFiles=false)
Closes the set of files opened by a call to createFiles(). Will be called automatically by the destru...
Definition: gmXdmfFileWriter.cpp:896
int _lastDiscontinuitySequence
The last sequence file where discontinuity data was saved. -1 if not saved yet. 0 for single sequence...
Definition: gmXdmfFileWriter.h:163
A file serializer for saving data in the "Xdmf (Hdf5)" file format.
Definition: gmXdmfFileWriter.h:36
virtual bool dumpSupport() const
This function should return true if this serializer supports saving dump files.
Definition: gmXdmfFileWriter.cpp:977
QString path(const char *baseName, int rule, int iter) const
Returns tha group path for the given base name. The name is composed by the mesh name,...
Definition: gmXdmfFileWriter.cpp:1113
int _savePartialXdmfFile
0 if no partial files are created. When > 0, must be a multiple of _splitHDF5Files
Definition: gmXdmfFileWriter.h:148
void addDataItemEntry(QString tableName, int d1, int d2, int d3, GmStorageType storage, int seq)
Add to the output Xdmf file a data item entry.
Definition: gmXdmfFileWriter.cpp:1391
void addMeshGeometryEntries(QString basePath, bool pointCloud, int ruleIndex=-1)
Add to the output XDMF file the required geometry and topology entries whose data is stored at the gi...
Definition: gmXdmfFileWriter.cpp:1129
void closeCurrentHdf5File(bool onError=false)
Closes the current HDF5 file.
Definition: gmXdmfFileWriter.cpp:202
bool _saveCloudPointTopology
Should we save a "cell topology" vector for point clouds?
Definition: gmXdmfFileWriter.h:150
Basic interface for file serializers.
Definition: gmFileWriter.h:36
virtual bool setCurrentTime(int iter, double time)
Sets the current time step, valid for the next calls to saveGeometry() and/or saveData()....
Definition: gmXdmfFileWriter.cpp:216
double _currTime
The current simulation time or the only time if the simulation has a single time step.
Definition: gmXdmfFileWriter.h:153
QByteArray _ident
The "current identation level" in calls to addXxxxSection()
Definition: gmXdmfFileWriter.h:140
bool _dsMultiGrid
Set to true if we need to save Discontinuity set data.
Definition: gmXdmfFileWriter.h:146
bool savePartialFile()
Saves a "partial" xdmf control file by duplicating the contents of the main xdmf file and closing it ...
Definition: gmXdmfFileWriter.cpp:723
bool _gaussMultiGrid
Set to true if we need to save Gauss data (as a point cloud)
Definition: gmXdmfFileWriter.h:145
Class representing a category with multiple logging levels.
Definition: gmLog.h:58
const GmSimulationData * _simData
The simulation data object.
Definition: gmXdmfFileWriter.h:131
int _lastPartialSuffix
The last suffix number applied to the partial xdmf file name. If 0, no suffix was applied.
Definition: gmXdmfFileWriter.h:165
int _lastGeometrySequence
The last sequence file where the mesh geometry was saved. -1 if not saved yet. 0 for single sequence.
Definition: gmXdmfFileWriter.h:161
DiscontinuityDataMode
The selected mode when saving discontinuity data.
Definition: gmFileIO.h:76
int _lastGeometryIter
The last iteration number where the mesh geometry was saved. -1 if not saved yet. 0 for single time s...
Definition: gmXdmfFileWriter.h:160
QString nodeDataPath(int iter=0) const
Returns the HDF5 node data path for the given iteration group or for the single iteration group if it...
Definition: gmXdmfFileWriter.h:83
virtual bool saveDiscontinuities(const QVector< GmDiscontinuitySet * > &sets, GmFileIO::DiscontinuityDataMode mode, const UnitConverter *conv, const double *scaleFactor, const double *offset)
Save discontinuity geometry data to the file. THe mode parameter defines which data should be saved....
Definition: gmXdmfFileWriter.cpp:369
QString cellDataPath(int iter=0) const
Returns the HDF5 cell data path for the given iteration group or for the single iteration group if it...
Definition: gmXdmfFileWriter.h:86
bool _multiGrid
Do we need to save multiple grids (per time step)? True when allso saving Gauss data or discontinuity...
Definition: gmXdmfFileWriter.h:144
void addGridCollectionSection(bool start)
Add to the output Xdmf file a grid section named after the current mesh. If the saved data includes G...
Definition: gmXdmfFileWriter.cpp:1223
void addSpatialCollectionSection(bool start)
Add to the output Xdmf file a spatial colletion for grouping several meshes.
Definition: gmXdmfFileWriter.cpp:1204
QString _geometryUnit
The unit for node coordinates.
Definition: gmXdmfFileWriter.h:168
DumpMode
The dump mode when creating the file.
Definition: gmFileIO.h:68
int _geometryDim
The geometry node dimension.
Definition: gmXdmfFileWriter.h:166
const GmFileFilter * _filter
The filter object specifying which nodes and elements should be saved.
Definition: gmXdmfFileWriter.h:132
double _startTime
The simulation start time or the only time if the simulation has a single time step.
Definition: gmXdmfFileWriter.h:152
void addGeometryEntry(QString tableName, int nlin, int ncol, QString unit, GmStorageType storage, bool forDiscontinuity=false)
Add to the output Xdmf file a geometry entry.
Definition: gmXdmfFileWriter.cpp:1304
bool removeOldFiles(bool partialOnly)
Removes old hdf5 files and partial xdmf files, returning true if they do not exist or where successfu...
Definition: gmXdmfFileWriter.cpp:859
virtual void flushFiles()
Flush opened files.
Definition: gmXdmfFileWriter.cpp:971
void addGridGaussSection(bool start, int rule=-1)
Add to the output Xdmf file a grid section named after the current mesh and rule set (if different fr...
Definition: gmXdmfFileWriter.cpp:1263
bool createCurrentHdf5File()
Create the current HDF5 file. When saving in multiple sequence files, expects that _currSequence is a...
Definition: gmXdmfFileWriter.cpp:162
QString _fileName
The Xdmf file name.
Definition: gmXdmfFileWriter.h:134
virtual bool loadSavedItemsFromMap(QVariantMap &map)
This function should retrieve from the given map any internal writer state that was saved on a dump o...
Definition: gmXdmfFileWriter.cpp:1021
GmFileIO::DumpMode _dumpMode
The dump mode with wich the file was created.
Definition: gmXdmfFileWriter.h:139
QString hdf5Prefix(int seq=-1) const
Returns the Hdf5 file name without path, with sequence mask replaced, if any. If seq !...
Definition: gmXdmfFileWriter.h:107
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QString gaussGeometryPath(int rule, int iter=0) const
Returns the HDF5 gauss geometry path for the given integration rule and iteration group or for the si...
Definition: gmXdmfFileWriter.h:89
int _currIter
The current save iteration number (0 if the simulation has a single time step)
Definition: gmXdmfFileWriter.h:154
QString hdf5Name(int seq=-1) const
Returns the Hdf5 file name, with sequence mask replaced, if any. If seq != -1, that value is used ins...
Definition: gmXdmfFileWriter.h:104
QString _hdf5Name
The Hdf5 file name, possibly including a "%1" mask to be replaced by the file sequence number if _spl...
Definition: gmXdmfFileWriter.h:136
int _lastPartialXdmfOffset
The offset of the last "regular" byte from the main xdmf file that was saved to the partial file.
Definition: gmXdmfFileWriter.h:164
virtual ~GmXdmfFileWriter()
Destructor.
Definition: gmXdmfFileWriter.cpp:65
A generic auxilliary class for managing the various options that can be used to define the set of nod...
Definition: gmFileFilter.h:45