GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmXdmfFileFormat.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 _GM_XDMF_FILE_FORMAT_H_
25#define _GM_XDMF_FILE_FORMAT_H_
26
27#include "gmFileFormat.h"
28
30#define XDMF_POLYLINE_TYPE 2
31
33#define XDMF_POLYLINE_TYPENAME "Polyline"
34
35
38{
39public:
40
59 {
61 const char* _xdmfName;
63 int _accept;
64
65 SupportedTypesT() : _xdmfType(-1), _xdmfName(""), _accept(0) {}
66 SupportedTypesT(int type, const char* name, QVector<int> nodes)
67 : _xdmfType(type), _xdmfName(name), _nodeNumbering(nodes), _accept(1)
68 {
69 assert(type >= 0);
70 foreach(int n, nodes)
71 {
72 if(n < 0) { _accept = 2; break; }
73 }
74 }
75 };
76
77 // See comments on the base class
78 virtual const char* formatName() const { return "XDMF3"; }
79
80 // See comments on the base class
81 virtual bool supportsMultipleIterations() const { return true; }
82
83 // See comments on the base class
84 virtual bool acceptsNodeDimension(int ndim) const { return ndim == 2 || ndim == 3; }
85
86 // See comments on the base class
87 virtual int acceptsCellType(GmCellType type) const { return supportedTypesList()[type]._accept; }
88
89 // See comments on the base class
90 virtual const QVector<int>& cellNumbering(GmCellType type) const { return supportedTypesList()[type]._nodeNumbering; }
91
92 virtual const QVector<int>& gaussNumbering(GmCellType type, int numIp) const { Q_UNUSED(type); Q_UNUSED(numIp); static QVector<int> empty; return empty; }
93
94 // See comments on the base class
95 virtual int fileCellType(GmCellType type) const { return supportedTypesList()[type]._xdmfType; }
96
97 // See comments on the base class
98 virtual const char* fileCellTypeName(GmCellType type) const { return supportedTypesList()[type]._xdmfName; }
99
100 // See comments on the base class
101 virtual bool acceptsDataType(const GmValueInfo* info, int nodeDim, int dimFilter = -1) const
102 {
103 Q_UNUSED(info); Q_UNUSED(nodeDim); Q_UNUSED(dimFilter);
104 return true; // All data types are accepted!
105 }
106
107 // See comments on the base class
108 virtual bool acceptsMultipleGaussProfiles() const { return true; }
109
110 // See comments on the base class
111 virtual bool acceptsGaussRuleForElement(GmCellType type, const GmIntegrationRule* ir) const
112 {
113 Q_UNUSED(type); Q_UNUSED(ir);
114 return true; // All rules are accepted since Gauss data is exported as a point cloud in HDF5
115 }
116
117 // See comments on the base class
118 virtual bool acceptsDiscontinuitySet(GmDiscontinuitySet::DiscontinuityType type) const
119 {
122
123 }
124
125 // See comments on the base class
126 virtual bool supportsSplitVectors() const { return false; /* Let the file IO module do the work for us. */ }
127
128 // See comments on the base class
129 virtual bool supportsMeshChanges() const { return true; }
130
143 {
144 assert(supportedTypesList()[type]._accept == 0); // types should be registered only once
145
146 if(cellData._accept && cellData._nodeNumbering.isEmpty())
147 {
148 GmCellGeometry g(type);
149 for(int i=0, n=g.numNodes(); i<n; i++)
150 cellData._nodeNumbering.append(i);
151 }
152
153 supportedTypesList()[type] = std::move(cellData);
154 }
155
156private:
157
166 {
167 static SupportedTypesT supportedTypes[GM_NUM_CELL_TYPES];
168 return supportedTypes;
169 }
170
171};
172
173
174#endif // _GM_XDMF_FILE_FORMAT_H_
A class used to return static metadata information about a cell geometry, along with some methods for...
Definition gmCellGeometry.h:55
int numNodes() const
Returns the total number of nodes of this cell type.
Definition gmCellGeometry.h:92
DiscontinuityType
Discontinuity type (defining how the disc. geometry is defined)
Definition gmDiscontinuitySet.h:63
@ GM_DISC_POLYLINE
The disc. geometry is given by a polyline. Inserted elements are bars.
Definition gmDiscontinuitySet.h:64
@ GM_DISC_TRISURFACE
The disc. geometry is given by a trinagulated surface. Inserted elements are triangles or quads.
Definition gmDiscontinuitySet.h:65
Basic interface for describing high level file format capabilities.
Definition gmFileFormat.h:35
Integration rule base classe.
Definition gmIntegrationRule.h:89
Auxiliar class used to store the definition of a value. It can be used to store informations about st...
Definition gmValueInfo.h:132
File format specifications for the Xdmf file format.
Definition gmXdmfFileFormat.h:38
virtual const char * fileCellTypeName(GmCellType type) const
Returns the cell type name as seen by the exported file format.
Definition gmXdmfFileFormat.h:98
virtual int acceptsCellType(GmCellType type) const
Does the file format accepts this cell type? Returns 0 if the cell type is not accepted,...
Definition gmXdmfFileFormat.h:87
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...
Definition gmXdmfFileFormat.h:90
virtual bool supportsMeshChanges() const
Returns true if this writer can cope with mesh changes during the simulation.
Definition gmXdmfFileFormat.h:129
virtual bool supportsMultipleIterations() const
Returns true if this file type supports multiple iterations (result sets)
Definition gmXdmfFileFormat.h:81
static void registerSupportedCellType(GmCellType type, SupportedTypesT &&cellData)
Registers the information needed about each element type to save it on the Xdmf file....
Definition gmXdmfFileFormat.h:142
virtual bool acceptsMultipleGaussProfiles() const
Does the file supports multiple Gauss points per element type?
Definition gmXdmfFileFormat.h:108
virtual int fileCellType(GmCellType type) const
Returns the cell type code as seen by the file format. Currently used only by HDF5 based formats.
Definition gmXdmfFileFormat.h:95
virtual const char * formatName() const
Returns the file format name.
Definition gmXdmfFileFormat.h:78
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 in...
Definition gmXdmfFileFormat.h:111
virtual bool acceptsNodeDimension(int ndim) const
Returns true if this file format accepts meshes with nodes of the given dimension.
Definition gmXdmfFileFormat.h:84
virtual const QVector< int > & gaussNumbering(GmCellType type, int numIp) const
Returns the Gauss point numbering order for a given cell type and number of integration points....
Definition gmXdmfFileFormat.h:92
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 d...
Definition gmXdmfFileFormat.h:101
virtual bool supportsSplitVectors() const
Returns true if this writer prefers to split vector values into scalar values by itself.
Definition gmXdmfFileFormat.h:126
static SupportedTypesT * supportedTypesList()
Returns the vector with the definition of the GeMA supported types and their mapping to xdmf types....
Definition gmXdmfFileFormat.h:165
GmCellType
Mesh Cell types. Don't change type orders or add types without reading comments below.
Definition gmCellType.h:31
@ GM_NUM_CELL_TYPES
NOT a cell type. Stores the number of available types.
Definition gmCellType.h:77
Declaration of the GmFileFormat class (old GmFileDataclass)
Registered information about each element type. Needed to export said type in Xdmf format....
Definition gmXdmfFileFormat.h:59
QVector< int > _nodeNumbering
The cell node numbering. Empty if the type is not supported.
Definition gmXdmfFileFormat.h:62
const char * _xdmfName
The cell type name for Xdmf.
Definition gmXdmfFileFormat.h:61
int _accept
The precomputed result for the acceptsCellType() query: 0 for unsupported, 1 for native supported and...
Definition gmXdmfFileFormat.h:63
int _xdmfType
The cell type number for Xdmf, -1 for unsupported types.
Definition gmXdmfFileFormat.h:60