NeoPZ
TPZGmshReader.h
Go to the documentation of this file.
1 //
2 // TPZGmshReader.h
3 // PZ
4 //
5 // Created by Omar on 2/7/16.
6 //
7 //
8 
9 #ifndef TPZGmshReader_h
10 #define TPZGmshReader_h
11 
12 #include <stdio.h>
13 #include <iostream>
14 #include <fstream>
15 #include <string>
16 #include <map>
17 #include "pzgmesh.h"
18 
19 
20 class TPZGeoMesh;
21 
22 
23 struct MaterialDataS {
24 
27 
28  MaterialDataS() : fMatID(), fMaterial(){
29 
30  }
31 
32  MaterialDataS(int num) : fMatID(), fMaterial(){
33 
34  }
35 
36  MaterialDataS(const MaterialDataS &copy) : fMatID(copy.fMatID),
37  fMaterial(copy.fMaterial) {
38  }
39 
41  fMatID = copy.fMatID;
42  fMaterial = copy.fMaterial;
43  return *this;
44  }
45 
46 };
47 
48 
67 
69  std::string m_format_version;
70 
73 
76 
79 
82 
85 
88 
91 
94 
97 
100 
102 
105 
107 
110 
113 
116 
119 
121  int m_n_hexahedron_els = 0;
122 
124  int m_n_tetrahedron_els = 0;
125 
127  int m_n_prism_els = 0;
128 
130  int m_n_pyramid_els = 0;
131 
133  int m_n_quadrilateral_els = 0;
134 
136  int m_n_triangle_els = 0;
137 
139  int m_n_line_els = 0;
140 
142  int m_n_point_els = 0;
143 
144 public:
145 
147  TPZGmshReader();
148 
150  ~TPZGmshReader();
151 
153  TPZGmshReader(const TPZGmshReader & other);
154 
156  const TPZGmshReader & operator=(const TPZGmshReader & other);
157 
159  TPZGeoMesh * GeometricGmshMesh(std::string file_name, TPZGeoMesh *gmesh = NULL);
160 
162  void SetCharacteristiclength(REAL length);
163 
165  void SetFormatVersion(std::string format_version);
166 
168  void PrintPartitionSummary(std::ostream & out);
169 
171 
173  TPZGeoMesh * GeometricGmshMesh4(std::string file_name, TPZGeoMesh *gmesh = NULL);
174 
175  void InsertElement(TPZGeoMesh * gmesh, int & physical_identifier, int & el_type, int & el_identifier, std::vector<int> & node_identifiers);
176 
177  int GetNumberofNodes(int & el_type);
178 
180 
182  TPZGeoMesh * GeometricGmshMesh3(std::string file_name, TPZGeoMesh *gmesh = NULL);
183 
185  bool InsertElement(TPZGeoMesh * gmesh, std::ifstream & line);
186 
189  return m_dim_physical_tag_and_name;
190  }
191 
193  void SetDimPhysicalTagName(TPZManVector<std::map<int,std::string>,4> & dim_physical_tag_and_name){
194  m_dim_physical_tag_and_name = dim_physical_tag_and_name;
195  }
196 
198  void SetDimNamePhysical(TPZManVector<std::map<std::string,int>,4> & dim_name_and_physical_tag){
199  m_dim_name_and_physical_tag = dim_name_and_physical_tag;
200  }
201 
203 
205  return m_dim_name_and_physical_tag;
206  }
207 
209  void GetDimNamePhysical(TPZVec<std::map<std::string,int>> & dim_name_and_physical_tag){
210  m_dim_name_and_physical_tag = dim_name_and_physical_tag;
211  }
212 
214  {
215  return m_entity_index;
216  }
217 
219  int NHexahedra(){
220  return m_n_hexahedron_els;
221  }
222 
224  int NTetrahera(){
225  return m_n_tetrahedron_els;
226  }
227 
229  int NPrisms(){
230  return m_n_prism_els;
231  }
232 
234  int NPyramids(){
235  return m_n_pyramid_els;
236  }
237 
240  return m_n_quadrilateral_els;
241  }
242 
244  int NTriangles(){
245  return m_n_triangle_els;
246  }
247 
249  int NLines(){
250  return m_n_line_els;
251  }
252 
254  int NPoints(){
255  return m_n_point_els;
256  }
257 
259  int Dimension() {
260  return m_dimension;
261  }
262 };
263 
264 #endif /* TPZGmshReader_h */
int m_n_physical_curves
Number of curves with physical tag.
Definition: TPZGmshReader.h:90
TPZManVector< std::map< int, std::vector< int > >, 4 > m_dim_entity_tag_and_physical_tag
Data structure of both: physical entities and names indexed by dimension.
int NQuadrilaterals()
Return the number of quadrilaterals created.
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
MaterialDataS(int num)
Definition: TPZGmshReader.h:32
MaterialDataS & operator=(const MaterialDataS &copy)
Definition: TPZGmshReader.h:40
int NPrisms()
Return the number of prisms created.
MaterialDataS(const MaterialDataS &copy)
Definition: TPZGmshReader.h:36
int m_n_curves
Number of curves.
Definition: TPZGmshReader.h:78
void SetDimNamePhysical(TPZManVector< std::map< std::string, int >, 4 > &dim_name_and_physical_tag)
Get the structure dim - name - physical tag.
TPZManVector< std::map< int, std::string >, 4 > m_dim_physical_tag_and_name
Structure of both: physical entities and names indexed by dimension.
TPZManVector< std::map< std::string, int >, 4 > & GetDimNamePhysical()
Get the structure dim - name - physical tag.
TPZVec< int64_t > m_entity_index
Entity index to which the element belongs.
int m_n_volumes
Number of volumes.
Definition: TPZGmshReader.h:72
TPZManVector< std::map< int, std::string >, 4 > & GetDimPhysicalTagName()
Get the structure dim - physical tag - name.
int NTriangles()
Return the number of triangles created.
int m_n_physical_points
Number of points with physical tag.
Definition: TPZGmshReader.h:93
int NHexahedra()
Return the number of hexahedra created.
TPZManVector< std::map< std::string, int >, 4 > m_dim_name_and_physical_tag
Structure of both: names and physical id indexed by dimension.
int NPoints()
Return the number of line created.
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
int m_dimension
Geometry dimension.
Definition: TPZGmshReader.h:96
int NLines()
Return the number of line created.
void GetDimNamePhysical(TPZVec< std::map< std::string, int >> &dim_name_and_physical_tag)
Get the structure dim - name - physical tag.
int m_n_physical_surfaces
Number of surfaces with physical tag.
Definition: TPZGmshReader.h:87
int m_n_surfaces
Number of surfaces.
Definition: TPZGmshReader.h:75
std::string m_format_version
gmsh file format version (supported versions = {3,4})
Definition: TPZGmshReader.h:69
REAL m_characteristic_lentgh
Characteristic length to apply a Scale affine transformation.
Definition: TPZGmshReader.h:99
Implement the interface between TPZGeoMesh and the files produced by Gmsh (version 3...
Definition: TPZGmshReader.h:66
void SetDimPhysicalTagName(TPZManVector< std::map< int, std::string >, 4 > &dim_physical_tag_and_name)
Set the structure dim - physical tag - name.
TPZStack< int > fMatID
Definition: TPZGmshReader.h:25
int m_n_points
Number of points.
Definition: TPZGmshReader.h:81
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
TPZManVector< std::map< int, int >, 4 > m_dim_physical_tag_and_physical_tag
Structure of both: physical id and user defined physical tag indexed by dimension.
int NPyramids()
Return the number of pyramids created.
int Dimension()
Return the dimension of the mesh.
TPZVec< int64_t > & EntityIndex()
int NTetrahera()
Return the number of tetrahedra created.
int m_n_physical_volumes
Number of volumes with physical tag.
Definition: TPZGmshReader.h:84
TPZStack< std::pair< int,std::string > > fMaterial
Definition: TPZGmshReader.h:26