GemaCoreLib
The GeMA Core library
Public Member Functions | Private Attributes | List of all members
GmMeditFileWriter Class Reference

A file serializer for saving data in the "Medit" file format. More...

#include <gmMeditFileWriter.h>

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

Public Member Functions

 GmMeditFileWriter (const GmLogCategory &logger)
 Default constructor.
 
virtual ~GmMeditFileWriter ()
 Destructor.
 
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)
 
virtual bool setCurrentTime (int iter, double time)
 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)
 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)
 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)
 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)
 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 void flushFiles ()
 Flush opened files.
 
virtual GmFileFormatfileFormat ()
 Returns the file format of the serializer.
 
- Public Member Functions inherited from GmFileWriter
 GmFileWriter (const GmLogCategory &logger)
 Constructor. Receives as parameter the logger used to report errors.
 
virtual ~GmFileWriter ()
 Destructor. Should call closeFiles() on derived classes.
 
virtual QString tempFile ()
 Returns, if any, the name of the temp file used for the operation started with createFiles()
 
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.
 
- Public Member Functions inherited from GmMeditFileFormat
virtual const char * formatName () const
 Returns the file format name.
 
virtual bool supportsMultipleIterations () const
 Returns true if this file type supports multiple iterations (result sets)
 
virtual bool supportsSplitVectors () const
 Returns true if this writer prefers to split vector values into scalar values by itself.
 
virtual bool acceptsNodeDimension (int ndim) const
 Returns true if this file format accepts meshes with nodes of the given dimension.
 
virtual bool acceptsDataType (const GmValueInfo *info, int nodeDim, int dimFilter=-1) const
 Returns true if this file format can save node/element data with the specified type (especially its dimension and value set kind). The nodeDim parameter provides the mesh node dimension since some file formats only accept vectors and matrices with the same size as the mesh dimension. The dimFilter parameter specifies if a dimension filter will be applied to the data or not (dimFilter == -1)
 
virtual bool acceptsMultipleGaussProfiles () const
 Does the file supports multiple Gauss points per element type?
 
virtual bool acceptsGaussRuleForElement (GmCellType type, const GmIntegrationRule *ir) const
 Does the file support exporting data at Gauss points for an element of type type with the supplied integration rule?
 
virtual bool acceptsDiscontinuitySet (GmDiscontinuitySet::DiscontinuityType type) const
 
virtual int acceptsCellType (GmCellType type) const
 Does the file format accepts this cell type? Returns 0 if the cell type is not accepted, 1 if it is natively accepted or 2 if it is accepted requiring standard Gema transformations for adjusting interface elements that need extra interpolated nodes to be exported.
 
virtual const QVector< int > & cellNumbering (GmCellType type) const
 Returns the node cell type numbering order in the file format view or an empty vector for unsupported types. More...
 
virtual int fileCellType (GmCellType type) const
 Returns the cell type code as seen by the file format. Currently used only by HDF5 based formats.
 
virtual const char * fileCellTypeName (GmCellType type) const
 Returns the cell type name as seen by the exported file format.
 
virtual bool supportsMeshChanges () const
 Returns true if this writer can cope with mesh changes during the simulation.
 

Private Attributes

QString _meshFileName
 The mesh file name.
 
QString _solFileName
 The sol file name or empty if not needed.
 
FILE * _meshFile
 The mesh file handle.
 
FILE * _solFile
 The sol file handle or NULL if not needed.
 
int _materialGroup
 The material group used to identify cell materials.
 
bool _activeOnly
 Should we save only active cells?
 
GmFileNodeRenumbering_nodeMap
 An object to perform node renumbering when _activeOnly & requested by the user options.
 

Additional Inherited Members

- Protected Attributes inherited from GmFileWriter
const GmLogCategory_logger
 The logger used to report errors.
 
- Static Protected Attributes inherited from GmMeditFileFormat
static const SupportedTypesT supportedTypes []
 
static const int supportedTypesSize
 

Detailed Description

A file serializer for saving data in the "Medit" file format.


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