Hermes2D  2.0
mesh_reader_h2d_xml.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.prg/licenses/>.
15 
16 #ifndef _MESH_READER_H2D_XML_H_
17 #define _MESH_READER_H2D_XML_H_
18 
19 #include "mesh_reader.h"
20 
21 // This is here mainly because XSD uses its own error, therefore it has to be undefined here.
22 #ifdef error
23 #undef error
24 #endif
25 
26 #include "mesh_h2d_xml.h"
27 #include "subdomains_h2d_xml.h"
28 
29 // This is here mainly because XSD uses its own error, therefore it had to be undefined previously.
30 #ifndef error
31 #define error(...) hermes_exit_if(hermes_log_message_if(true, HERMES_BUILD_LOG_INFO(HERMES_EC_ERROR), __VA_ARGS__))
32 #endif
33 
34 namespace Hermes
35 {
36  namespace Hermes2D
37  {
56  {
57  public:
59  virtual ~MeshReaderH2DXML();
60 
62  virtual bool load(const char *filename, Mesh *mesh);
63 
65  bool save(const char *filename, Mesh *mesh);
66 
70  bool load(const char *filename, Hermes::vector<Mesh *> meshes);
71 
73  bool save(const char *filename, Hermes::vector<Mesh *> meshes);
74 
75  protected:
77  bool load(std::auto_ptr<XMLMesh::mesh> & parsed_xml_mesh, Mesh *mesh, std::map<unsigned int, unsigned int>& vertex_is);
78 
80  bool load(std::auto_ptr<XMLSubdomains::domain> & parsed_xml_domain, Mesh *mesh, int* vertex_is, int* element_is, int* edge_is);
81 
85  template<typename T>
86  Nurbs* load_arc(Mesh *mesh, std::auto_ptr<T> & parsed_xml_entity, int id, Node** en, int p1, int p2, bool skip_check = false);
87 
91  template<typename T>
92  Nurbs* load_nurbs(Mesh *mesh, std::auto_ptr<T> & parsed_xml_entity, int id, Node** en, int p1, int p2, bool skip_check = false);
93 
95  void save_arc(Mesh *mesh, int p1, int p2, Nurbs* nurbs, XMLMesh::curves_type & curves);
96 
98  void save_nurbs(Mesh *mesh, int p1, int p2, Nurbs* nurbs, XMLMesh::curves_type & curves);
99  };
100  }
101 }
102 #endif