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 endWrite() {
return true; }
61 virtual bool closeFiles(
bool deleteFiles =
false);
77 QString path (
const char* baseName,
int rule,
int iter)
const;
128 void addTopologyEntry (
QString tableName,
int cellType,
int numElem,
int dataSize,
bool forDiscontinuity =
false);
176 QVector < QPair<int, int>> _dsCellType;
A generic auxiliary class for managing the various options that can be used to define the set of node...
Definition gmFileFilter.h:47
DumpMode
The dump mode when creating the file.
Definition gmFileIO.h:72
DiscontinuityDataMode
The selected mode when saving discontinuity data.
Definition gmFileIO.h:80
Basic interface for file serializers.
Definition gmFileWriter.h:37
Class representing a category with multiple logging levels.
Definition gmLog.h:58
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
Interface class for accessing and setting values from an "indexable" collection of values.
Definition gmValueAccessor.h:60
A file serializer for saving data in the "Xdmf (Hdf5)" file format.
Definition gmXdmfFileWriter.h:37
bool createCurrentHdf5File()
Create the current HDF5 file. When saving in multiple sequence files, expects that _currSequence is a...
Definition gmXdmfFileWriter.cpp:162
bool _openGrid
Is there an open grid section in the XDMF file?
Definition gmXdmfFileWriter.h:143
QString hdf5Prefix(int seq=-1) const
Returns the Hdf5 file name without path, with sequence mask replaced, if any. If seq !...
Definition gmXdmfFileWriter.h:109
virtual void flushFiles()
Flush opened files.
Definition gmXdmfFileWriter.cpp:1033
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:1382
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:1366
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:1325
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:91
int _lastGeometrySequence
The last sequence file where the mesh geometry was saved. -1 if not saved yet. 0 for single sequence.
Definition gmXdmfFileWriter.h:163
GmXdmfHdf5 * _hdf5
The hdf5 helper object.
Definition gmXdmfFileWriter.h:140
QString _timeUnit
The unit in which time values are expressed.
Definition gmXdmfFileWriter.h:157
bool _multiTime
Will this file be used for saving multiple time steps?
Definition gmXdmfFileWriter.h:145
bool _multiGrid
Do we need to save multiple grids (per time step)? True when allso saving Gauss data or discontinuity...
Definition gmXdmfFileWriter.h:146
int _currIter
The current save iteration number (0 if the simulation has a single time step)
Definition gmXdmfFileWriter.h:156
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:1347
FILE * _xdmfh
The handle for the xdmf control file.
Definition gmXdmfFileWriter.h:137
void addTimeCollectionSection(bool start)
Add to the output Xdmf file the Grid colletion for a temporal analysis.
Definition gmXdmfFileWriter.cpp:1250
bool _gaussMultiGrid
Set to true if we need to save Gauss data (as a point cloud)
Definition gmXdmfFileWriter.h:147
int _lastDiscontinuityIter
The last iteration number where discontinuity data was saved. -1 if not saved yet....
Definition gmXdmfFileWriter.h:164
void closeCurrentHdf5File(bool onError=false)
Closes the current HDF5 file.
Definition gmXdmfFileWriter.cpp:202
QString _geometryUnit
The unit for node coordinates.
Definition gmXdmfFileWriter.h:170
bool _dsMultiGrid
Set to true if we need to save Discontinuity set data.
Definition gmXdmfFileWriter.h:148
double _sequenceStartTime
The simulation time at the moment that the current sequence was opened.
Definition gmXdmfFileWriter.h:159
int _lastPartialXdmfOffset
The offset of the last "regular" byte from the main xdmf file that was saved to the partial file.
Definition gmXdmfFileWriter.h:166
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:80
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:88
void addSpatialCollectionSection(bool start)
Add to the output Xdmf file a spatial colletion for grouping several meshes.
Definition gmXdmfFileWriter.cpp:1266
double _currTime
The current simulation time or the only time if the simulation has a single time step.
Definition gmXdmfFileWriter.h:155
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:1430
GmXdmfFileWriter(const GmLogCategory &logger)
Default constructor.
Definition gmXdmfFileWriter.cpp:51
int _geometryDim
The geometry node dimension.
Definition gmXdmfFileWriter.h:168
QString _hdf5Name
The Hdf5 file name, possibly including a "%1" mask to be replaced by the file sequence number if _spl...
Definition gmXdmfFileWriter.h:138
QVector< GmXdmfHdf5::DsSizeInfo > _dsSizes
Per-discontinuity struct holding original and intersection data sizes.
Definition gmXdmfFileWriter.h:178
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:958
bool _saveMinMaxAttrib
Shoulde we save min/max accessor value attribute.
Definition gmXdmfFileWriter.h:172
bool _saveCloudPointTopology
Should we save a "cell topology" vector for point clouds?
Definition gmXdmfFileWriter.h:152
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
QString discontinuityPath(QString dsName, bool original) const
Returns the root discontinuity set path.
Definition gmXdmfFileWriter.cpp:1165
QString _fileName
The Xdmf file name.
Definition gmXdmfFileWriter.h:136
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:85
bool savePartialFile()
Saves a "partial" xdmf control file by duplicating the contents of the main xdmf file and closing it ...
Definition gmXdmfFileWriter.cpp:785
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:1175
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:160
const GmFileFilter * _filter
The filter object specifying which nodes and elements should be saved.
Definition gmXdmfFileWriter.h:134
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 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:97
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:1045
QStringList _dsNames
The names of the discontinuity sets.
Definition gmXdmfFileWriter.h:174
void partialFileNames(QString &writingName, QString &partialName) const
Fills writingName and partialName with the apropriate file names depending on the _lastPartialSuffix ...
Definition gmXdmfFileWriter.cpp:759
int _currSequence
The current HDF5 file sequence if _splitHDF5Files > 0. Starts with 1. Set to 0 otherwise.
Definition gmXdmfFileWriter.h:158
GmFileIO::DiscontinuityDataMode _dsMode
The saving mode for the discontinuity sets.
Definition gmXdmfFileWriter.h:175
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:162
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:1083
int _lastDiscontinuitySequence
The last sequence file where discontinuity data was saved. -1 if not saved yet. 0 for single sequence...
Definition gmXdmfFileWriter.h:165
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:94
const GmSimulationData * _simData
The simulation data object.
Definition gmXdmfFileWriter.h:133
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:1182
virtual bool saveData(const QVector< GmNodeAcResultsDataSrc * > &nodeData, const QVector< GmCellAcResultsDataSrc * > &cellData, const QVector< GmGaussAcResultsDataSrc * > &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:466
int _savePartialXdmfFile
0 if no partial files are created. When > 0, must be a multiple of _splitHDF5Files
Definition gmXdmfFileWriter.h:150
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:1453
double _startTime
The simulation start time or the only time if the simulation has a single time step.
Definition gmXdmfFileWriter.h:154
virtual GmFileFormat * fileFormat()
Returns the file format of the serializer.
Definition gmXdmfFileWriter.h:65
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:139
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:1155
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:1416
bool _singlePrecision
Should we force real data to be saved in single precision (floats instead of doubles)?
Definition gmXdmfFileWriter.h:171
int _splitHDF5Files
0 for a single file. Otherwise, splits the file every _splitHDF5Files iterations
Definition gmXdmfFileWriter.h:149
const char * tab() const
Helper function returning the current identation as space string.
Definition gmXdmfFileWriter.h:73
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:1219
GmFileIO::DumpMode _dumpMode
The dump mode with wich the file was created.
Definition gmXdmfFileWriter.h:141
GmStorageType _geometryStorage
The storage type for node coordinates.
Definition gmXdmfFileWriter.h:169
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:921
QByteArray _ident
The "current identation level" in calls to addXxxxSection()
Definition gmXdmfFileWriter.h:142
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 dumpSupport() const
This function should return true if this serializer supports saving dump files.
Definition gmXdmfFileWriter.cpp:1039
virtual ~GmXdmfFileWriter()
Destructor.
Definition gmXdmfFileWriter.cpp:64
int _lastPartialSuffix
The last suffix number applied to the partial xdmf file name. If 0, no suffix was applied.
Definition gmXdmfFileWriter.h:167
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:1191
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:1285
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:106
A support class for saving data to a HDF5 file. Hdf5 files are self-describing but do not have a fixe...
Definition gmXdmfHdf5.h:71
Declaration of the GmFileWriter class (old GmFileResultsSerializer)
Declaration of the GmValueInfo class.
GmStorageType
The desired storage type for the data.
Definition gmValueInfo.h:55
Declaration of the GmXdmfHdf5 class.
const char * constData() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const