GemaCoreLib
The GeMA Core library
gmMeditFileWriter.h
Go to the documentation of this file.
1 /************************************************************************
2 **
3 ** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4 ** All rights reserved.
5 **
6 ** This file is part of the "GeMA" software. It's use should respect
7 ** the terms in the license agreement that can be found together
8 ** with this source code.
9 ** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10 ** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11 ** A PARTICULAR PURPOSE.
12 **
13 ************************************************************************/
14 
24 #ifndef _GEMA_MEDIT_FILE_WRITER_H_
25 #define _GEMA_MEDIT_FILE_WRITER_H_
26 
27 #include "gmFileWriter.h"
28 #include "gmMeditFileFormat.h"
29 
31 
34 {
35 public:
36  GmMeditFileWriter(const GmLogCategory& logger);
37 
38  virtual ~GmMeditFileWriter();
39 
40  virtual bool createFiles(QString fileName, const GmSimulationData* simData, const GmFileFilter* filter,
41  const QVariantMap& options, bool multipleResults, bool gaussValues, bool discValues,
42  GmFileIO::DumpMode dumpMode, QString timeUnit)
43  {
44  Q_UNUSED(fileName); Q_UNUSED(simData); Q_UNUSED(options); Q_UNUSED(filter);
45  Q_UNUSED(multipleResults); Q_UNUSED(gaussValues); Q_UNUSED(discValues);
46  Q_UNUSED(dumpMode); Q_UNUSED(timeUnit);
47  return false;
48  }
49 
50  virtual bool setCurrentTime(int iter, double time)
51  {
52  Q_UNUSED(iter); Q_UNUSED(time); return true;
53  }
54 
55  virtual bool saveGeometry(GmValueAccessor* nodeAc, const double* scaleFactor, const double* offset)
56  {
57  Q_UNUSED(nodeAc); Q_UNUSED(scaleFactor); Q_UNUSED(offset);
58  return false;
59  }
60 
62  const UnitConverter* conv, const double* scaleFactor, const double* offset)
63  {
64  Q_UNUSED(sets); Q_UNUSED(mode); Q_UNUSED(conv); Q_UNUSED(scaleFactor); Q_UNUSED(offset);
65  return false;
66  }
67 
68  virtual bool saveData(const QVector<GmResultNodeDataSrc*>& nodeData,
69  const QVector<GmResultCellDataSrc*>& cellData,
70  const QVector<GmResultGaussDataSrc*>& gaussData,
71  int extraColumns, const QVector<int>& propertySets)
72  {
73  Q_UNUSED(nodeData); Q_UNUSED(cellData); Q_UNUSED(gaussData); Q_UNUSED(extraColumns); Q_UNUSED(propertySets);
74  return false;
75  }
76 
77 #if 1
78  //--------------------------------------------------------------------------------------------------------------------
79  // DEPRECTADE FUNCTIONS - Will be removed when the old nf and medit writers are migrated to the new structure
80  //--------------------------------------------------------------------------------------------------------------------
81 
82  virtual bool createFiles(QString fileName, const GmSimulationData* simData, const GmMesh* mesh,
83  const QVariantMap& options, int numNodeValues, int numElemValues,
84  int intRuleSet, bool multipleResults);
85 
86  virtual bool saveNodeCoordinates(const GmMesh* mesh, GmValueAccessor* nodeAcc, QList<double>& scaleFactor, QList<double>& offset);
87  virtual bool saveCellGeometry(const GmCellMesh* mesh);
88 
89  virtual bool saveNodeData (const GmMesh* mesh, const QList<GmValueAccessor*>& accList, int iter, double currentTime, bool split);
90  virtual bool saveElementData(const GmCellMesh* mesh, const QList<GmCellAccessor*>& elemAccList,
91  const QList<GmGaussAccessor*>& gaussAccList, int iter, double currentTime, bool split);
92  //--------------------------------------------------------------------------------------------------------------------
93  // END DEPRECTADE FUNCTIONS
94  //--------------------------------------------------------------------------------------------------------------------
95 #endif
96 
97  virtual bool closeFiles(bool deleteFiles = false);
98 
99  virtual void flushFiles();
100 
101  virtual GmFileFormat* fileFormat() { return this; }
102 
103 private:
106  FILE* _meshFile;
107  FILE* _solFile;
109  bool _activeOnly;
111 };
112 
113 
114 #endif
115 
virtual GmFileFormat * fileFormat()
Returns the file format of the serializer.
Definition: gmMeditFileWriter.h:101
FILE * _meshFile
The mesh file handle.
Definition: gmMeditFileWriter.h:106
Declaration of the GmMeditFileFormat class (old GmMeditFileData class)
Declaration of the GmFileWriter class (old GmFileResultsSerializer)
File format specifications for the "Medit" file format.
Definition: gmMeditFileFormat.h:30
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: gmMeditFileWriter.cpp:350
QString _solFileName
The sol file name or empty if not needed.
Definition: gmMeditFileWriter.h:105
virtual bool setCurrentTime(int iter, double time)
Sets the current time step, valid for the next calls to saveGeometry() and/or saveData()....
Definition: gmMeditFileWriter.h:50
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: gmMeditFileWriter.h:55
int _materialGroup
The material group used to identify cell materials.
Definition: gmMeditFileWriter.h:108
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 multiplie...
Definition: gmMeditFileWriter.cpp:132
Interface class for accessing and setting values from an "indexable" collection of values.
Definition: gmValueAccessor.h:59
GmMeditFileWriter(const GmLogCategory &logger)
Default constructor.
Definition: gmMeditFileWriter.cpp:35
Auxiliar class used to store the complete set of simulation data.
Definition: gmSimulationData.h:51
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: gmMeditFileWriter.h:61
GmFileNodeRenumbering * _nodeMap
An object to perform node renumbering when _activeOnly & requested by the user options.
Definition: gmMeditFileWriter.h:110
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: gmMeditFileWriter.h:68
FILE * _solFile
The sol file handle or NULL if not needed.
Definition: gmMeditFileWriter.h:107
virtual bool saveCellGeometry(const GmCellMesh *mesh)
Saves cell geometry to the file. Returns false on errors.
Definition: gmMeditFileWriter.cpp:157
Base interface class for CellMesh type plugins.
Definition: gmCellMesh.h:39
Basic interface for file serializers.
Definition: gmFileWriter.h:36
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....
Definition: gmMeditFileWriter.cpp:215
Class representing a category with multiple logging levels.
Definition: gmLog.h:58
QString _meshFileName
The mesh file name.
Definition: gmMeditFileWriter.h:104
DiscontinuityDataMode
The selected mode when saving discontinuity data.
Definition: gmFileIO.h:76
DumpMode
The dump mode when creating the file.
Definition: gmFileIO.h:68
A file serializer for saving data in the "Medit" file format.
Definition: gmMeditFileWriter.h:33
virtual ~GmMeditFileWriter()
Destructor.
Definition: gmMeditFileWriter.cpp:45
virtual void flushFiles()
Flush opened files.
Definition: gmMeditFileWriter.cpp:385
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...
Definition: gmMeditFileWriter.cpp:269
Basic interface for describing high level file format capabilities.
Definition: gmFileFormat.h:34
Base interface class for Mesh type plugins.
Definition: gmMesh.h:44
An auxilliary class for renumbering nodes when filtering cells from an output mesh....
Definition: gmFileNodeRenumbering.h:42
bool _activeOnly
Should we save only active cells?
Definition: gmMeditFileWriter.h:109
A generic auxilliary class for managing the various options that can be used to define the set of nod...
Definition: gmFileFilter.h:45