-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFEFLOWInterface.h
More file actions
166 lines (143 loc) · 4 KB
/
Copy pathFEFLOWInterface.h
File metadata and controls
166 lines (143 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/**
* \copyright
* Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#ifndef FEFLOWINTERFACE_H_
#define FEFLOWINTERFACE_H_
#include <iosfwd>
#include <memory>
#include <string>
#include <vector>
//#include "MeshLib/MeshEnums.h"
class QDomElement;
class QString;
namespace GeoLib
{
class GEOObjects;
class Point;
class Polyline;
}
namespace MeshLib
{
class Mesh;
class Element;
class Node;
enum class MeshElemType;
}
namespace FileIO
{
/**
* Read FEFLOW model files (*.fem) into OGS data structure. Currently this class supports
* only import of mesh data and some geometry given in Supermesh section.
*/
class FEFLOWInterface
{
public:
/// Constructor
explicit FEFLOWInterface(GeoLib::GEOObjects* obj = nullptr)
: _geoObjects(obj)
{
}
/**
* read a FEFLOW Model file (*.fem) in ASCII format (Version 5.4)
*
* This function reads mesh data in addition to geometry data given in Supermesh.
*
* @param filename FEFLOW file name
* @return a pointer to a created OGS mesh
*/
MeshLib::Mesh* readFEFLOWFile(const std::string &filename);
private:
// CLASS
struct FEM_CLASS
{
unsigned problem_class;
unsigned time_mode;
unsigned orientation;
unsigned dimension;
unsigned n_layers3d;
unsigned saturation_flag;
unsigned save_fsize_rreal;
unsigned save_fsize_creal;
FEM_CLASS()
{
problem_class = 0;
time_mode = 0;
orientation = 0;
dimension = 0;
n_layers3d = 0;
saturation_flag = 0;
save_fsize_rreal = 0;
save_fsize_creal = 0;
}
};
// DIMENSION
struct FEM_DIM
{
std::size_t n_nodes;
std::size_t n_elements;
std::size_t obs;
std::size_t np_cor;
unsigned n_nodes_of_element;
unsigned n_steps;
unsigned icrank;
unsigned upwind;
unsigned optim;
unsigned aquifer_type;
unsigned nwca;
unsigned adaptive_mesh;
unsigned sp_fem_pcs_id;
unsigned sorption_type;
unsigned reaction_type;
unsigned dispersion_type;
FEM_DIM()
{
n_nodes = 0;
n_elements = 0;
n_nodes_of_element = 0;
n_steps = 0;
icrank = 0;
upwind = 0;
obs = 0;
optim = 0;
aquifer_type = 0;
nwca = 0;
np_cor = 0;
adaptive_mesh = 0;
sp_fem_pcs_id = 0;
sorption_type = 0;
reaction_type = 0;
dispersion_type = 0;
}
};
/// read node indices and create a mesh element
MeshLib::Element* readElement(const FEM_DIM &fem_dim, const MeshLib::MeshElemType elem_type, const std::string& line, const std::vector<MeshLib::Node*> &nodes);
/// read node coordinates
void readNodeCoordinates(std::ifstream &in, const FEM_CLASS &fem_class, const FEM_DIM &fem_dim, std::vector<MeshLib::Node*> &nodes);
/// read elevation data
void readElevation(std::ifstream &in, const FEM_CLASS &fem_class, const FEM_DIM &fem_dim, std::vector<MeshLib::Node*> &vec_nodes);
//// parse node lists
std::vector<std::size_t> getIndexList(const std::string &str_ranges);
/// parse ELEMENTALSETS
void readELEMENTALSETS(std::ifstream &in, std::vector<std::vector<std::size_t>> &vec_elementsets);
/// read Supermesh data
///
/// A super mesh is a collection of polygons, lines and points in the 2D plane
/// and will be used for mesh generation and to define the modeling region
void readSuperMesh(std::ifstream &feflow_file, const FEM_CLASS &fem_class, std::vector<GeoLib::Point*>** points, std::vector<GeoLib::Polyline*>** lines);
//// read point data in Supermesh
void readPoints(QDomElement &nodesEle, const std::string &tag, int dim, std::vector<GeoLib::Point*> &points);
void setMaterialIDs(FEM_CLASS const& fem_class,
FEM_DIM const& fem_dim,
std::vector<GeoLib::Polyline*>* const& lines,
std::vector<std::vector<std::size_t>> const& vec_elementsets,
std::vector<MeshLib::Element*> const& vec_elements,
std::vector<int> & material_ids);
//// Geometric objects
GeoLib::GEOObjects* _geoObjects;
};
} // end namespace FileIO
#endif /* FEFLOWINTERFACE_H_ */