GemaCoreLib
The GeMA Core library
gmFileReader.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_FILE_READER_H_
25 #define _GEMA_FILE_READER_H_
26 
27 
28 #include <QString>
29 #include <QList>
30 
31 class GmFileFormat;
32 
33 class GmLogCategory;
34 class GmMesh;
35 class GmCellMesh;
36 class Unit;
37 
38 
41 {
42 public:
43  GmFileReader();
44 
46  GmFileReader(const GmLogCategory& logger)
47  : _logger(logger) {}
48 
50  virtual ~GmFileReader() { }
51 
52  /* \brief Opens files in preperation for later calls to readXxxx() functions.
53  After those calls, the opened state will be closed by a call to closeFiles().
54  On errors this function should return false.
55 
56  \param fileName The name of the file that will be opened
57  \param numNodeValues The number of node variables (state vars/attributes) that will be read
58  \param numElemValues The number of element variables (attributes/properties) that will be read
59  \returns Returns true on success, false on errors
60  */
61  virtual bool openFiles(QString fileName, int numNodeValues, int numElemValues) = 0;
62 
65  virtual bool initializeMesh(GmMesh* mesh, const QStringList& nodeValues, const QList<Unit>& nodeUnits,
66  const QStringList& elementValues, const QList<Unit>& elementUnits) = 0;
67 
69  virtual bool readNodeCoordinates(GmMesh* mesh, Unit coordUnit) = 0;
70 
72  virtual bool readCellGeometry(GmCellMesh* cellmesh) = 0;
73 
75  virtual bool readNodeData(GmMesh* mesh, const QStringList& nodeValues, const QList<Unit>& nodeUnits) = 0;
76 
78  virtual bool readCellData(GmCellMesh* cellmesh, const QStringList& elementValues, const QList<Unit>& elementUnits) = 0;
79 
83  virtual bool closeFiles() = 0;
84 
86  virtual GmFileFormat* fileFormat() = 0;
87 
88 protected:
90 };
91 
92 #endif
virtual bool readNodeData(GmMesh *mesh, const QStringList &nodeValues, const QList< Unit > &nodeUnits)=0
Reads node data from the file. Returns false on errors.
Basic interface for file deserializers.
Definition: gmFileReader.h:40
virtual bool initializeMesh(GmMesh *mesh, const QStringList &nodeValues, const QList< Unit > &nodeUnits, const QStringList &elementValues, const QList< Unit > &elementUnits)=0
Initialize the mesh structure.
virtual bool readNodeCoordinates(GmMesh *mesh, Unit coordUnit)=0
Reads mesh node coordinates in the file and fill the mesh structure. Returns false on errors.
GmFileReader(const GmLogCategory &logger)
Constructor. Receives as parameter the logger used to report errors.
Definition: gmFileReader.h:46
const GmLogCategory & _logger
The logger used to report errors.
Definition: gmFileReader.h:89
virtual bool readCellData(GmCellMesh *cellmesh, const QStringList &elementValues, const QList< Unit > &elementUnits)=0
Reads cell data from the file. Returns false on errors.
virtual bool readCellGeometry(GmCellMesh *cellmesh)=0
Reads cell geometry in the file and fill the mesh structure. Returns false on errors.
virtual GmFileFormat * fileFormat()=0
Returns the file format of the deserializer.
Base interface class for CellMesh type plugins.
Definition: gmCellMesh.h:39
virtual ~GmFileReader()
Destructor. Should call closeFiles() on derived classes.
Definition: gmFileReader.h:50
virtual bool closeFiles()=0
Closes the set of files opened by a call to openFiles(). Will be called automatically by the destruct...
Class representing a category with multiple logging levels.
Definition: gmLog.h:58
Basic interface for describing high level file format capabilities.
Definition: gmFileFormat.h:34
Base interface class for Mesh type plugins.
Definition: gmMesh.h:44