OGS
FEFLOWMeshInterface.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <iosfwd>
7#include <string>
8#include <vector>
9
11
12namespace GeoLib
13{
14class Point;
15class Polyline;
16}
17
18namespace MeshLib
19{
20class Mesh;
21class Element;
22class Node;
23enum class MeshElemType;
24}
25
26namespace FileIO
27{
33{
34public:
44 MeshLib::Mesh* readFEFLOWFile(const std::string& filename);
45
46private:
47 // CLASS
48 struct FEM_CLASS
49 {
50 unsigned problem_class = 0;
51 unsigned time_mode = 0;
52 unsigned orientation = 0;
53 unsigned dimension = 0;
54 unsigned n_layers3d = 0;
55 unsigned saturation_flag = 0;
56 unsigned save_fsize_rreal = 0;
57 unsigned save_fsize_creal = 0;
58 };
59
60 // DIMENSION
61 struct FEM_DIM
62 {
63 std::size_t n_nodes = 0;
64 std::size_t n_elements = 0;
65 std::size_t obs = 0;
66 std::size_t np_cor = 0;
67 unsigned n_nodes_of_element = 0;
68 unsigned n_steps = 0;
69 unsigned icrank = 0;
70 unsigned upwind = 0;
71 unsigned optim = 0;
72 unsigned aquifer_type = 0;
73 unsigned nwca = 0;
74 unsigned adaptive_mesh = 0;
75 unsigned sp_fem_pcs_id = 0;
76 unsigned sorption_type = 0;
77 unsigned reaction_type = 0;
78 unsigned dispersion_type = 0;
79 };
80
82 MeshLib::Element* readElement(std::string const& line,
83 std::vector<MeshLib::Node*> const& nodes);
84
86 MeshLib::Element* readElement(const FEM_DIM& fem_dim,
87 const MeshLib::MeshElemType elem_type,
88 const std::string& line,
89 const std::vector<MeshLib::Node*>& nodes);
90
92 void readNodeCoordinates(std::ifstream& in,
93 std::vector<MeshLib::Node*>& nodes);
94
96 void readNodeCoordinates(std::ifstream& in,
97 const FEM_CLASS& fem_class,
98 const FEM_DIM& fem_dim,
99 std::vector<MeshLib::Node*> const& nodes);
100
102 void readElevation(std::ifstream& in,
103 const FEM_CLASS& fem_class,
104 const FEM_DIM& fem_dim,
105 std::vector<MeshLib::Node*>& vec_nodes);
106
108 std::vector<std::size_t> getIndexList(const std::string& str_ranges);
109
112 std::ifstream& in,
113 std::vector<std::vector<std::size_t>>& vec_elementsets);
114
116 void readMAT_I_FLOW(
117 std::ifstream& in,
118 const FEM_DIM& fem_dim,
119 std::vector<std::string>& vec_element_property_names,
120 std::vector<std::vector<double>>& vec_element_property_values);
121
123 std::vector<double> readMaterialPropertyValues(std::ifstream& in,
124 std::size_t n_elements);
125
126 void setMaterialIDs(
127 FEM_CLASS const& fem_class,
128 FEM_DIM const& fem_dim,
129 std::vector<GeoLib::Polyline*> const& lines,
130 std::vector<std::vector<std::size_t>> const& vec_elementsets,
131 std::vector<MeshLib::Element*> const& vec_elements,
132 MeshLib::PropertyVector<int>& material_ids);
133};
134} // namespace FileIO
std::vector< double > readMaterialPropertyValues(std::ifstream &in, std::size_t n_elements)
read element values of a material property in MAT_I_FLOW data
void readMAT_I_FLOW(std::ifstream &in, const FEM_DIM &fem_dim, std::vector< std::string > &vec_element_property_names, std::vector< std::vector< double > > &vec_element_property_values)
read MAT_I_FLOW data (material properties of flow problem)
std::vector< std::size_t > getIndexList(const std::string &str_ranges)
void readNodeCoordinates(std::ifstream &in, std::vector< MeshLib::Node * > &nodes)
read node coordinates given in the XYZCOOR section
MeshLib::Mesh * readFEFLOWFile(const std::string &filename)
void readElevation(std::ifstream &in, const FEM_CLASS &fem_class, const FEM_DIM &fem_dim, std::vector< MeshLib::Node * > &vec_nodes)
read elevation data
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, MeshLib::PropertyVector< int > &material_ids)
MeshLib::Element * readElement(std::string const &line, std::vector< MeshLib::Node * > const &nodes)
Read element type and node indices according to the element type.
void readELEMENTALSETS(std::ifstream &in, std::vector< std::vector< std::size_t > > &vec_elementsets)
parse ELEMENTALSETS
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:29
MeshElemType
Types of mesh elements supported by OpenGeoSys. Values are from VTKCellType enum.
Definition MeshEnums.h:37