GemaCoreLib
The GeMA Core library
gmNfFileReader.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_NF_FILE_READER_H_
25 #define _GEMA_NF_FILE_READER_H_
26 
27 #include "gmFileReader.h"
28 #include "gmNfFileFormat.h"
29 
30 #include "gmValueInfo.h"
31 
32 class GmValueAccessor;
33 class GmGaussAccessor;
34 
35 struct NfrImport;
36 struct NfrFile;
37 
38 
41 {
42 public:
43  GmNfFileReader(const GmLogCategory& logger);
44 
45  virtual ~GmNfFileReader();
46 
47  virtual bool openFiles(QString fileName, int numNodeValues, int numElemValues);
48  virtual bool initializeMesh(GmMesh* mesh, const QStringList& nodeValues, const QList<Unit>& nodeUnits,
49  const QStringList& elementValues, const QList<Unit>& elementUnits);
50  virtual bool readNodeCoordinates(GmMesh* mesh, Unit coordUnit);
51  virtual bool readCellGeometry(GmCellMesh* cellmesh);
52  virtual bool readNodeData(GmMesh* mesh, const QStringList& nodeValues, const QList<Unit>& nodeUnits);
53  virtual bool readCellData(GmCellMesh* cellmesh, const QStringList& elementValues, const QList<Unit>& elementUnits);
54  virtual bool closeFiles();
55 
56  virtual GmFileFormat* fileFormat() { return this; }
57 
58 private:
59  void updateNfStepIds();
60  void updateNfValueIds();
61  void updateNfElementIds(GmCellMesh* cellmesh);
62  void buildGemaMatrix(double* val, GmVector& vec);
63  void buildFielIdsMap(NfrResultType resType, int stepId, QMap<QString, int>& fieldIdsMap);
64 
65  int nlin(GmDimType t, int ndim) const { return (t == GM_SCALAR_VALUE ? 1 : ndim); }
66  int ncol(GmDimType t, int ndim) const { return (t != GM_MATRIX_VALUE ? 1 : ndim); }
67 
70  int _ndim;
71  int _ruleSet;
72  bool _dataOnly;
73 
74  NfrImport* _imp;
75  NfrFile* _nf;
76  QMap< NfrResultType, QStringList > _nfValuesMap; // Enable value in neutral file
77 
78  int _caseId;
79  int _nSteps;
80  QVector<int> _stepIds;
81 
84 };
85 
86 #endif
int _ndim
Input mesh dimension.
Definition: gmNfFileReader.h:70
Basic interface for file deserializers.
Definition: gmFileReader.h:40
GmDimType
Value dimension type.
Definition: gmValueInfo.h:66
The GmGaussAccessor class is a proxy object to a value accesor implementing a more convenient interfa...
Definition: gmGaussAccessor.h:38
Declaration of the GmValueInfo class.
Interface class for accessing and setting values from an "indexable" collection of values.
Definition: gmValueAccessor.h:59
virtual GmFileFormat * fileFormat()
Returns the file format of the deserializer.
Definition: gmNfFileReader.h:56
virtual bool openFiles(QString fileName, int numNodeValues, int numElemValues)
See comments on the base class.
Definition: gmNfFileReader.cpp:57
QString _nfFileName
The neutral file name.
Definition: gmNfFileReader.h:68
A file deserializer for reading data in the "Neutral File" file format.
Definition: gmNfFileReader.h:40
GmNfFileReader(const GmLogCategory &logger)
Default constructor.
Definition: gmNfFileReader.cpp:37
virtual bool readCellGeometry(GmCellMesh *cellmesh)
See comments on the base class.
Definition: gmNfFileReader.cpp:376
QVector< int > _elementIds
Correspondence table between nfr and gema element ids.
Definition: gmNfFileReader.h:69
Base interface class for CellMesh type plugins.
Definition: gmCellMesh.h:39
virtual bool readCellData(GmCellMesh *cellmesh, const QStringList &elementValues, const QList< Unit > &elementUnits)
See comments on the base class.
Definition: gmNfFileReader.cpp:546
virtual ~GmNfFileReader()
Destructor.
Definition: gmNfFileReader.cpp:45
void buildGemaMatrix(double *val, GmVector &vec)
Transform symetrical NF tensor [6 (3D) values] to Gema matrix [9 (3D) or 4 (2D) values].
Definition: gmNfFileReader.cpp:790
virtual bool initializeMesh(GmMesh *mesh, const QStringList &nodeValues, const QList< Unit > &nodeUnits, const QStringList &elementValues, const QList< Unit > &elementUnits)
See comments on the base class.
Definition: gmNfFileReader.cpp:98
Declaration of the GmNfFileFormat class (old GmNeutralFileData class)
virtual bool closeFiles()
See comments on the base class.
Definition: gmNfFileReader.cpp:696
void updateNfStepIds()
Obtain step ids from NF file.
Definition: gmNfFileReader.cpp:713
void updateNfValueIds()
Obtain value ids from NF file.
Definition: gmNfFileReader.cpp:730
Class representing a category with multiple logging levels.
Definition: gmLog.h:58
Means that the value is a 2D matrix of numbers.
Definition: gmValueInfo.h:70
int _ruleSet
Input mesh rule set.
Definition: gmNfFileReader.h:71
void updateNfElementIds(GmCellMesh *cellmesh)
Fill correspondence table between nfr and gema element ids.
Definition: gmNfFileReader.cpp:754
bool _dataOnly
True, if the GeMA mesh to fill already has nodes and cells.
Definition: gmNfFileReader.h:72
File format specifications for the "Neutral File" file format.
Definition: gmNfFileFormat.h:33
Declaration of the GmFileReader class (old GmFileDataDeserializer class)
virtual bool readNodeCoordinates(GmMesh *mesh, Unit coordUnit)
See comments on the base class.
Definition: gmNfFileReader.cpp:339
virtual bool readNodeData(GmMesh *mesh, const QStringList &nodeValues, const QList< Unit > &nodeUnits)
See comments on the base class.
Definition: gmNfFileReader.cpp:420
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
Basic interface for describing high level file format capabilities.
Definition: gmFileFormat.h:34
Base interface class for Mesh type plugins.
Definition: gmMesh.h:44
Means that the value is a scalar number.
Definition: gmValueInfo.h:68