Hermes2D  2.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  {
42  std::string mesh_file_;
43 
46  void strip(std::string &str);
47 
49  std::string restore(std::string &str);
50 
51  public:
52  std::map< std::string, std::vector< std::string > > vars_;
53 
54  int n_vert;
55  int n_el;
56  int n_bdy;
57  int n_curv;
58  int n_ref;
59 
60  std::vector<double> x_vertex;
61  std::vector<double> y_vertex;
62 
63  std::vector<int> en1;
64  std::vector<int> en2;
65  std::vector<int> en3;
66  std::vector<int> en4;
67 
68  std::vector<std::string> e_mtl;
69 
70  std::vector<int> bdy_first;
71  std::vector<int> bdy_second;
72  std::vector<std::string> bdy_type;
73 
74  std::vector<int> curv_first;
75  std::vector<int> curv_second;
76 
77  std::vector<double> curv_third;
78 
79  std::vector<std::string> curv_inner_pts;
80  std::vector<std::string> curv_knots;
81  std::vector<bool> curv_nurbs;
82 
83  std::vector<int> ref_elt;
84  std::vector<int> ref_type;
85 
87  void parse_mesh(void);
88 
90  MeshData(const std::string &mesh_file);
91 
93  MeshData(const MeshData &m);
94 
96  MeshData& operator = (const MeshData &m);
97 
99  ~MeshData();
100  };
101  }
102 }
103 # endif