Hermes2D  3.0
mesh_data.h
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 # ifndef __MESH2D_CPP_PARSER
17 # define __MESH2D_CPP_PARSER
18 
19 # include <iostream>
20 # include <string>
21 # include <fstream>
22 # include <sstream>
23 # include <vector>
24 # include <cstdlib>
25 # include <cassert>
26 # include <map>
27 
28 namespace Hermes
29 {
30  namespace Hermes2D
31  {
40  class MeshData
41  {
43  std::string mesh_file_;
44 
47  void strip(std::string &str);
48 
50  std::string restore(std::string &str);
51 
52  public:
54  std::map< std::string, std::vector< std::string > > vars_;
55 
57  int n_vert;
59  int n_el;
61  int n_bdy;
63  int n_curv;
65  int n_ref;
66 
68  std::vector<double> x_vertex;
70  std::vector<double> y_vertex;
71 
73  std::vector<int> en1;
75  std::vector<int> en2;
77  std::vector<int> en3;
79  std::vector<int> en4;
80 
82  std::vector<std::string> e_mtl;
83 
85  std::vector<int> bdy_first;
87  std::vector<int> bdy_second;
89  std::vector<std::string> bdy_type;
90 
92  std::vector<int> curv_first;
94  std::vector<int> curv_second;
95 
97  std::vector<double> curv_third;
98 
100  std::vector<std::string> curv_inner_pts;
102  std::vector<std::string> curv_knots;
104  std::vector<bool> curv_nurbs;
105 
107  std::vector<int> ref_elt;
109  std::vector<int> ref_type;
110 
112  void parse_mesh(void);
113 
115  MeshData(const std::string &mesh_file);
116 
118  MeshData(const MeshData &m);
119 
121  MeshData& operator = (const MeshData &m);
122 
124  ~MeshData();
125  };
126  }
127 }
128 # endif
std::vector< std::string > e_mtl
Element markers – single word strings.
Definition: mesh_data.h:82
void parse_mesh(void)
This function parses a given input mesh file line by line and extracts the necessary information into...
Definition: mesh_data.cpp:152
Definition: adapt.h:24
std::vector< int > ref_elt
List of elements to be refined.
Definition: mesh_data.h:107
int n_ref
Number of elements with specified refinements.
Definition: mesh_data.h:65
std::map< std::string, std::vector< std::string > > vars_
Map for storing variables in input mesh file.
Definition: mesh_data.h:54
MeshData & operator=(const MeshData &m)
MeshData Assignment Operator.
Definition: mesh_data.cpp:51
std::vector< int > curv_second
Second node of a curved edge.
Definition: mesh_data.h:94
int n_vert
Number of vertices.
Definition: mesh_data.h:57
std::vector< bool > curv_nurbs
Nurbs Indicator. True if curve is modeled with NURBS. False if it is a circular arc.
Definition: mesh_data.h:104
int n_el
Number of elements.
Definition: mesh_data.h:59
std::vector< std::string > bdy_type
Boundary name.
Definition: mesh_data.h:89
Class to stored 2d mesh parameters. The MeshData class organizes all the necessary data structures re...
Definition: mesh_data.h:40
std::vector< int > en4
Nodes with local node number 4. Only for quadrilateral elements. For triangular elements it is set to...
Definition: mesh_data.h:79
int n_curv
Number of curved edges (including NURBS curves)
Definition: mesh_data.h:63
std::vector< int > en3
Nodes with local node number 3.
Definition: mesh_data.h:77
std::vector< int > en2
Nodes with local node number 2.
Definition: mesh_data.h:75
std::vector< int > ref_type
List of element refinement type.
Definition: mesh_data.h:109
MeshData(const std::string &mesh_file)
MeshData Constructor.
Definition: mesh_data.cpp:22
int n_bdy
Number of boundary edges.
Definition: mesh_data.h:61
std::vector< std::string > curv_inner_pts
Name of the list of the control points and weights of a NURBS curve. Set to "none" for a circular arc...
Definition: mesh_data.h:100
std::vector< std::string > curv_knots
Name of the list of knot vectors of a NURBS curve. Set to "none" for a circular arc.
Definition: mesh_data.h:102
std::vector< int > bdy_first
First node of a boundary edge.
Definition: mesh_data.h:85
std::vector< int > en1
Nodes with local node number 1.
Definition: mesh_data.h:73
std::vector< double > y_vertex
y-coordinate of the vertices
Definition: mesh_data.h:70
std::vector< double > x_vertex
x-coordinate of the vertices
Definition: mesh_data.h:68
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
std::vector< int > bdy_second
Second node of a boundary edge.
Definition: mesh_data.h:87
~MeshData()
MeshData Destructor.
Definition: mesh_data.cpp:26
std::vector< int > curv_first
First node of a curved edge.
Definition: mesh_data.h:92
std::vector< double > curv_third
Third entry of a curve specification. Angle for a circular arc and degree for a NURBS curve...
Definition: mesh_data.h:97