GemaCoreLib
The GeMA Core library
Public Member Functions | Protected Attributes | List of all members
GmFileWriter Class Referenceabstract

Basic interface for file serializers. More...

#include <gmFileWriter.h>

Inheritance diagram for GmFileWriter:
Inheritance graph
[legend]
Collaboration diagram for GmFileWriter:
Collaboration graph
[legend]

Public Member Functions

 GmFileWriter (const GmLogCategory &logger)
 Constructor. Receives as parameter the logger used to report errors.
 
virtual ~GmFileWriter ()
 Destructor. Should call closeFiles() on derived classes.
 
virtual bool createFiles (QString fileName, const GmSimulationData *simData, const GmFileFilter *filter, const QVariantMap &options, bool multipleResults, bool gaussValues, bool discValues, GmFileIO::DumpMode dumpMode, QString timeUnit)=0
 
virtual bool setCurrentTime (int iter, double time)=0
 Sets the current time step, valid for the next calls to saveGeometry() and/or saveData(). This function IS CALLED even for single time step files in order to allow them to register the information. The first call is done with iter equal to 1, unless this is a single time step file, when iter will have a value of 0. Can return false on errors.
 
virtual bool saveGeometry (GmValueAccessor *nodeAc, const double *scaleFactor, const double *offset)=0
 Save mesh node coordinates, cell geometry and gauss rule set coordinates (if needed) to the file, as defined by the filter object received on createFiles(). Returns false on errors. Node coordinates should be multiplied by the scale factor and sum the provided offset if the pointers are not NULL (they are either both NULL or both valid). When working with multiple time steps, this function is called at the first time step and then when the mesh changed (and the file format supports mesh changes)
 
virtual bool saveDiscontinuities (const QVector< GmDiscontinuitySet * > &sets, GmFileIO::DiscontinuityDataMode mode, const UnitConverter *conv, const double *scaleFactor, const double *offset)=0
 Save discontinuity geometry data to the file. THe mode parameter defines which data should be saved. Returns false on errors. Node coordinates should be converted with the supplied converter (if not NULL) and also multiplied by the scale factor and sum the provided offset if the pointers are not NULL (they are either both NULL or both valid). When working with multiple time steps, this function is called at the first time step and then when the discontinuities changed (and the file format supports mesh changes)
 
virtual bool saveData (const QVector< GmResultNodeDataSrc * > &nodeData, const QVector< GmResultCellDataSrc * > &cellData, const QVector< GmResultGaussDataSrc * > &gaussData, int extraColumns, const QVector< int > &propertySets)=0
 Saves the current result set to the file for the node, cells and Gauss points as defined by the filter object received on createFiles(). Will be called multiple times if multipleResults was true on the call to createFiles(). This function is always called, even if the data lists are empty, since special values defined by save options might need to be handled. The extra columns value is an or of the set of GmFilIO::ExtraColumns that should also be saved. If CELL_MATERIAL_COLUMN is in that set, the propertySets list informs for which property sets the material index should be saved.
 
virtual bool createFiles (QString fileName, const GmSimulationData *simData, const GmMesh *mesh, const QVariantMap &options, int numNodeValues, int numElemValues, int intRuleSet, bool multipleResults)
 
virtual bool saveNodeCoordinates (const GmMesh *mesh, GmValueAccessor *nodeAcc, QList< double > &scaleFactor, QList< double > &offset)
 Save mesh node coordinates to the file. Returns false on errors. Node coordinates should be multiplied by the scale factor and sum the provided offset.
 
virtual bool saveCellGeometry (const GmCellMesh *mesh)
 Saves cell geometry to the file. Returns false on errors.
 
virtual bool saveNodeData (const GmMesh *mesh, const QList< GmValueAccessor * > &accList, int iter, double currentTime, bool split)
 Saves node data to the file. The accList parameter contains accessors for the values to be saved. Returns false on errors. Will be called multiple times if the parameter multipleResults was true on the call to createFiles().
 
virtual bool saveElementData (const GmCellMesh *mesh, const QList< GmCellAccessor * > &elemAccList, const QList< GmGaussAccessor * > &gaussAccList, int iter, double currentTime, bool split)
 Saves element data to the file. The accessor lists parameters contains accessors for the values to be saved. Returns false on errors. Will be called multiple times if the parameter multipleResults was true on the call to createFiles().
 
virtual bool closeFiles (bool deleteFiles=false)=0
 Closes the set of files opened by a call to createFiles(). Will be called automatically by the destructor (so may be called with a closed file). On errors, closeFiles is called with deleteFiles == true and should remove the created files.
 
virtual QString tempFile ()
 Returns, if any, the name of the temp file used for the operation started with createFiles()
 
virtual void flushFiles ()=0
 Flush opened files.
 
virtual GmFileFormatfileFormat ()=0
 Returns the file format of the serializer.
 
virtual bool dumpSupport () const
 This function should return true if this serializer supports saving dump files.
 
virtual bool addSavedItemsToMap (QVariantMap &map)
 This function should add to map any internal serializer state that must be saved on a dump operation, returning false on errors. More...
 
virtual bool loadSavedItemsFromMap (QVariantMap &map)
 This function should retrieve from the given map any internal writer state that was saved on a dump operation and now restored, returning false on errors. It should also be used to make any adjustments needed on the save files when restoring a state.
 

Protected Attributes

const GmLogCategory_logger
 The logger used to report errors.
 

Detailed Description

Basic interface for file serializers.

Member Function Documentation

◆ addSavedItemsToMap()

virtual bool GmFileWriter::addSavedItemsToMap ( QVariantMap &  map)
inlinevirtual

This function should add to map any internal serializer state that must be saved on a dump operation, returning false on errors.

To avoid naming conflicts, each added key should have a prefix unique to this writer.

Reimplemented in GmNfFileWriter, and GmXdmfFileWriter.


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