ug4
file_io_ugx.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Sebastian Reiter
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__LIB_GRID__FILE_IO_UGX__
34 #define __H__LIB_GRID__FILE_IO_UGX__
35 
36 
37 #include <errno.h>
38 #include <cstdlib>
39 #include <iostream>
40 #include <vector>
41 #include <utility>
42 #include "common/parser/rapidxml/rapidxml.hpp"
43 #include "lib_grid/grid/grid.h"
44 #include "lib_grid/multi_grid.h"
50 #include "common/math/misc/shapes.h" // AABox
51 
52 namespace ug
53 {
54 
55 class ProjectionHandler;
56 
59 
64 template <class TAPosition>
65 bool SaveGridToUGX(Grid& grid, ISubsetHandler& sh,
66  const char* filename, TAPosition& aPos);
67 
69 
74 bool SaveGridToUGX(Grid& grid, ISubsetHandler& sh,
75  const char* filename);
76 
79 
84 template <class TAPosition>
86  const char* filename, APosition& aPos);
87 
89 
96 bool LoadGridFromUGX(Grid& grid, ISubsetHandler& sh,
97  const char* filename);
98 
99 
100 
104 
108 {
109  public:
110  GridWriterUGX();
111  virtual ~GridWriterUGX();
112 
115  template <class TPositionAttachment>
116  bool add_grid(Grid& grid, const char* name,
117  TPositionAttachment& aPos);
118 
119 // template <class TPositionAttachment>
120 // void add_grid(MultiGrid& mg, const char* name,
121 // TPositionAttachment& aPos);
122 
123  void add_subset_handler(ISubsetHandler& sh, const char* name,
124  size_t refGridIndex);
125 
126  void add_selector(ISelector& sel, const char* name,
127  size_t refGridIndex);
128 
129  void add_projection_handler(ProjectionHandler& ph, const char* name,
130  size_t refGridIndex);
131 
132  template <class TElem, class TAttachment>
133  void add_attachment(TAttachment attachment,
134  const char* name,
135  size_t refGridIndex);
136 
137  virtual bool write_to_stream(std::ostream& out);
138 
139  bool write_to_file(const char* filename);
140 
141  protected:
146 
147  protected:
148  void init_grid_attachments(Grid& grid);
149 
150  // VERTICES
151  template <class TAAPos>
152  rapidxml::xml_node<>*
154  RegularVertexIterator vrtsEnd,
155  TAAPos& aaPos);
156 
157  template <class TAAPos>
158  rapidxml::xml_node<>*
161  TAAPos& aaPos,
162  AAEdgeIndex aaIndEDGE,
163  AAFaceIndex aaIndFACE);
164 
165 
167  void add_elements_to_node(rapidxml::xml_node<>* node,
168  Grid& grid);
169 
170  // EDGES
171  rapidxml::xml_node<>*
173  RegularEdgeIterator edgesEnd,
174  AAVrtIndex aaIndVRT);
175 
176  rapidxml::xml_node<>*
178  ConstrainingEdgeIterator edgesEnd,
179  AAVrtIndex aaIndVRT);
180 
181  rapidxml::xml_node<>*
183  ConstrainedEdgeIterator edgesEnd,
184  AAVrtIndex aaIndVRT,
185  AAEdgeIndex aaIndEDGE,
186  AAFaceIndex aaIndFACE);
187 
188  // FACES
189  rapidxml::xml_node<>*
191  TriangleIterator trisEnd,
192  AAVrtIndex aaIndVRT);
193 
194  rapidxml::xml_node<>*
197  AAVrtIndex aaIndVRT);
198 
199  rapidxml::xml_node<>*
202  AAVrtIndex aaIndVRT,
203  AAFaceIndex aaIndFACE);
204 
205  rapidxml::xml_node<>*
207  QuadrilateralIterator quadsEnd,
208  AAVrtIndex aaIndVRT);
209 
210  rapidxml::xml_node<>*
213  AAVrtIndex aaIndVRT);
214 
215  rapidxml::xml_node<>*
218  AAVrtIndex aaIndVRT,
219  AAFaceIndex aaIndFACE);
220  // VOLUMES
221  rapidxml::xml_node<>*
223  TetrahedronIterator tetsEnd,
224  AAVrtIndex aaIndVRT);
225 
226  rapidxml::xml_node<>*
228  HexahedronIterator hexasEnd,
229  AAVrtIndex aaIndVRT);
230 
231  rapidxml::xml_node<>*
232  create_prism_node(PrismIterator prismsBegin,
233  PrismIterator prismsEnd,
234  AAVrtIndex aaIndVRT);
235 
236  rapidxml::xml_node<>*
238  PyramidIterator pyrasEnd,
239  AAVrtIndex aaIndVRT);
240 
241  rapidxml::xml_node<>*
243  OctahedronIterator octsEnd,
244  AAVrtIndex aaIndVRT);
245 
246  void add_subset_attributes(rapidxml::xml_node<>* targetNode,
247  ISubsetHandler& sh, size_t subsetIndex);
248 
249  template <class TGeomObj>
250  rapidxml::xml_node<>*
251  create_subset_element_node(const char* name,
252  const ISubsetHandler& sh,
253  size_t si);
254 
255  template <class TGeomObj>
256  rapidxml::xml_node<>*
257  create_selector_element_node(const char* name, const ISelector& sel);
258 
259 
260  rapidxml::xml_node<>*
261  create_projector_node(RefinementProjector& proj, const char* nodeName);
262 
263  template <class TElem>
264  void process_global_attachments(Grid& grid, rapidxml::xml_node<>* gridNode);
265 
266  template <class TElem>
267  const char* attachment_node_name();
268 
269  protected:
271 
272  struct Entry{
273  Entry() {}
274  Entry(Grid* g, rapidxml::xml_node<>* n) :
275  grid(g), node(n) {}
276 
278  std::vector<const ISubsetHandler*> subsetHandlers;
279  rapidxml::xml_node<>* node;
280  };
281 
283  rapidxml::xml_document<> m_doc;
284 
286  std::vector<Entry> m_vEntries;
287 
290 };
291 
292 
295 
301 {
302  public:
303  GridReaderUGX();
304  virtual ~GridReaderUGX();
305 
307  bool parse_file(const char* filename);
308 
310  inline size_t num_grids() const {return m_entries.size();}
311 
313 
315  template <class TPositionAttachment>
316  bool grid(Grid& gridOut, size_t index,
317  TPositionAttachment& aPos);
318 
320  const char* get_grid_name(size_t index) const;
321 
323  size_t num_subset_handlers(size_t refGridIndex) const;
324 
326  const char* get_subset_handler_name(size_t refGridIndex,
327  size_t subsetHandlerIndex) const;
328 
330  bool subset_handler(ISubsetHandler& shOut,
331  size_t subsetHandlerIndex,
332  size_t refGridIndex);
333 
335  size_t num_selectors(size_t refGridIndex) const;
336 
338  const char* get_selector_name(size_t refGridIndex, size_t selectorIndex) const;
339 
341  bool selector(ISelector& selOut, size_t selectorIndex, size_t refGridIndex);
342 
344  size_t num_projection_handlers(size_t refGridIndex) const;
345 
347  const char* get_projection_handler_name(size_t refGridIndex, size_t phIndex) const;
348 
350  size_t get_projection_handler_subset_handler_index(size_t phIndex, size_t refGridIndex);
351 
353  bool projection_handler(ProjectionHandler& phOut, size_t phIndex, size_t refGridIndex);
354 
355  protected:
357  {
358  SubsetHandlerEntry(rapidxml::xml_node<>* n) : node(n), sh(NULL) {}
359 
360  rapidxml::xml_node<>* node;
362  };
363 
365  {
366  SelectorEntry(rapidxml::xml_node<>* n) : node(n), sel(NULL) {}
367 
368  rapidxml::xml_node<>* node;
370  };
371 
372  struct GridEntry
373  {
374  GridEntry(rapidxml::xml_node<>* n) : node(n), grid(NULL), mg(NULL) {}
375 
376  rapidxml::xml_node<>* node;
379  std::vector<SubsetHandlerEntry> subsetHandlerEntries;
380  std::vector<SelectorEntry> selectorEntries;
381  std::vector<rapidxml::xml_node<>*> projectionHandlerEntries;
382  std::vector<Vertex*> vertices;
383  std::vector<Edge*> edges;
384  std::vector<Face*> faces;
385  std::vector<Volume*> volumes;
386  };
387 
388  protected:
390 
395  virtual bool new_document_parsed();
396 
398 
401  template <class TAAPos>
402  bool create_vertices(std::vector<Vertex*>& vrtsOut, Grid& grid,
403  rapidxml::xml_node<>* vrtNode, TAAPos aaPos);
404 
405  template <class TAAPos>
406  bool create_constrained_vertices(std::vector<Vertex*>& vrtsOut,
407  std::vector<std::pair<int, int> >& constrainingObjsOut,
408  Grid& grid, rapidxml::xml_node<>* vrtNode, TAAPos aaPos);
409 
410  bool create_edges(std::vector<Edge*>& edgesOut,
411  Grid& grid, rapidxml::xml_node<>* node,
412  std::vector<Vertex*>& vrts);
413 
414  bool create_constraining_edges(std::vector<Edge*>& edgesOut,
415  Grid& grid, rapidxml::xml_node<>* node,
416  std::vector<Vertex*>& vrts);
417 
418  bool create_constrained_edges(std::vector<Edge*>& edgesOut,
419  std::vector<std::pair<int, int> >& constrainingObjsOut,
420  Grid& grid, rapidxml::xml_node<>* node,
421  std::vector<Vertex*>& vrts);
422 
423  bool create_triangles(std::vector<Face*>& facesOut,
424  Grid& grid, rapidxml::xml_node<>* node,
425  std::vector<Vertex*>& vrts);
426 
427  bool create_constraining_triangles(std::vector<Face*>& facesOut,
428  Grid& grid, rapidxml::xml_node<>* node,
429  std::vector<Vertex*>& vrts);
430 
431  bool create_constrained_triangles(std::vector<Face*>& facesOut,
432  std::vector<std::pair<int, int> >& constrainingObjsOut,
433  Grid& grid, rapidxml::xml_node<>* node,
434  std::vector<Vertex*>& vrts);
435 
436  bool create_quadrilaterals(std::vector<Face*>& facesOut,
437  Grid& grid, rapidxml::xml_node<>* node,
438  std::vector<Vertex*>& vrts);
439 
440  bool create_constraining_quadrilaterals(std::vector<Face*>& facesOut,
441  Grid& grid, rapidxml::xml_node<>* node,
442  std::vector<Vertex*>& vrts);
443 
444  bool create_constrained_quadrilaterals(std::vector<Face*>& facesOut,
445  std::vector<std::pair<int, int> >& constrainingObjsOut,
446  Grid& grid, rapidxml::xml_node<>* node,
447  std::vector<Vertex*>& vrts);
448 
449  bool create_tetrahedrons(std::vector<Volume*>& volsOut,
450  Grid& grid, rapidxml::xml_node<>* node,
451  std::vector<Vertex*>& vrts);
452 
453  bool create_hexahedrons(std::vector<Volume*>& volsOut,
454  Grid& grid, rapidxml::xml_node<>* node,
455  std::vector<Vertex*>& vrts);
456 
457  bool create_prisms(std::vector<Volume*>& volsOut,
458  Grid& grid, rapidxml::xml_node<>* node,
459  std::vector<Vertex*>& vrts);
460 
461  bool create_pyramids(std::vector<Volume*>& volsOut,
462  Grid& grid, rapidxml::xml_node<>* node,
463  std::vector<Vertex*>& vrts);
464 
465  bool create_octahedrons(std::vector<Volume*>& volsOut,
466  Grid& grid, rapidxml::xml_node<>* node,
467  std::vector<Vertex*>& vrts);
468 
469  template <class TGeomObj>
471  const char* elemNodeName,
472  rapidxml::xml_node<>* subsetNode,
473  int subsetIndex,
474  std::vector<TGeomObj*>& vElems);
475 
476  template <class TGeomObj>
477  bool read_selector_elements(ISelector& selOut,
478  const char* elemNodeName,
479  rapidxml::xml_node<>* selNode,
480  std::vector<TGeomObj*>& vElems);
481 
482  template <class TElem>
483  bool read_attachment(Grid& grid, rapidxml::xml_node<>* node);
484 
486  read_projector(rapidxml::xml_node<>* projNode);
487 
488  protected:
490  rapidxml::xml_document<> m_doc;
491 
493  std::vector<GridEntry> m_entries;
494 };
495 
496 
498  public:
499  UGXFileInfo();
500 
501  bool parse_file(const char* filename);
502 
503  size_t num_grids() const;
504  size_t num_subset_handlers(size_t gridInd) const;
505  size_t num_subsets(size_t gridInd, size_t shInd) const;
506 
507  std::string grid_name(size_t gridInd) const;
508  std::string subset_handler_name(size_t gridInd, size_t shInd) const;
509  std::string subset_name(size_t gridInd, size_t shInd, size_t subsetInd) const;
510 
511  bool grid_has_vertices(size_t gridInd) const;
512  bool grid_has_edges(size_t gridInd) const;
513  bool grid_has_faces(size_t gridInd) const;
514  bool grid_has_volumes(size_t gridInd) const;
515 
517 
527  size_t physical_grid_dimension(size_t gridInd) const;
528 
530 
532  size_t topological_grid_dimension(size_t gridInd) const;
533 
535 
554  size_t grid_world_dimension(size_t gridInd) const;
555 
556 
557  private:
558  struct SubsetInfo{
559  std::string m_name;
560  };
561 
563  std::string m_name;
564  std::vector<SubsetInfo> m_subsets;
565  };
566 
567  struct GridInfo{
568  std::string m_name;
573  std::vector<SubsetHandlerInfo> m_subsetHandlers;
575  };
576 
577  std::vector<GridInfo> m_grids;
579 
580 
581  private:
583  std::string node_name(rapidxml::xml_node<>* n) const;
584 
586  void check_file_parsed() const;
587 
589 
590  const GridInfo& grid_info(size_t index) const;
591 
593 
594  const SubsetHandlerInfo& subset_handler_info(size_t gridInd, size_t shInd) const;
595 
597 
598  const SubsetInfo& subset_info(size_t gridInd, size_t shInd, size_t subsetInd) const;
599 
601 
608  bool calculate_vertex_node_bbox(rapidxml::xml_node<>* vrtNode, AABox<vector3>& bb) const;
609 };
610 
611 }// end of namespace
612 
614 // include implementation
615 #include "file_io_ugx_impl.hpp"
616 
617 #endif
location name
Definition: checkpoint_util.lua:128
A generic specialization of IAttachment.
Definition: attachment_pipe.h:263
Definition: grid.h:211
Definition: grid.h:221
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
Grants read access to ugx files.
Definition: file_io_ugx.h:301
rapidxml::xml_document m_doc
the xml_document which stores the data
Definition: file_io_ugx.h:490
bool create_hexahedrons(std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1782
bool parse_file(const char *filename)
parses an xml file
Definition: file_io_ugx.cpp:1304
bool read_selector_elements(ISelector &selOut, const char *elemNodeName, rapidxml::xml_node<> *selNode, std::vector< TGeomObj * > &vElems)
Definition: file_io_ugx.cpp:1155
bool projection_handler(ProjectionHandler &phOut, size_t phIndex, size_t refGridIndex)
fills the given projection-handler
Definition: file_io_ugx.cpp:1266
size_t num_projection_handlers(size_t refGridIndex) const
returns the number of projection-handlers for the given grid
Definition: file_io_ugx.cpp:1196
bool read_subset_handler_elements(ISubsetHandler &shOut, const char *elemNodeName, rapidxml::xml_node<> *subsetNode, int subsetIndex, std::vector< TGeomObj * > &vElems)
Definition: file_io_ugx.cpp:1047
const char * get_projection_handler_name(size_t refGridIndex, size_t phIndex) const
returns the name of the given projection-handler
Definition: file_io_ugx.cpp:1205
bool create_vertices(std::vector< Vertex * > &vrtsOut, Grid &grid, rapidxml::xml_node<> *vrtNode, TAAPos aaPos)
creates vertices from a vertex-node.
Definition: file_io_ugx_impl.hpp:737
size_t num_selectors(size_t refGridIndex) const
returns the number of selectors for the given grid
Definition: file_io_ugx.cpp:1086
bool create_constrained_vertices(std::vector< Vertex * > &vrtsOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *vrtNode, TAAPos aaPos)
Definition: file_io_ugx_impl.hpp:821
size_t num_grids() const
returns the number of grids
Definition: file_io_ugx.h:310
bool create_constraining_edges(std::vector< Edge * > &edgesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1408
bool read_attachment(Grid &grid, rapidxml::xml_node<> *node)
Definition: file_io_ugx_impl.hpp:912
virtual bool new_document_parsed()
initializes internal arrays
Definition: file_io_ugx.cpp:1333
bool create_constrained_edges(std::vector< Edge * > &edgesOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1443
bool create_tetrahedrons(std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1743
bool create_constrained_quadrilaterals(std::vector< Face * > &facesOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1691
SPRefinementProjector read_projector(rapidxml::xml_node<> *projNode)
Definition: file_io_ugx.cpp:1241
const char * get_selector_name(size_t refGridIndex, size_t selectorIndex) const
returns the name of the given selector
Definition: file_io_ugx.cpp:1096
bool create_octahedrons(std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1906
GridReaderUGX()
Definition: file_io_ugx.cpp:927
bool create_edges(std::vector< Edge * > &edgesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1372
const char * get_grid_name(size_t index) const
returns the name of the i-th grid
Definition: file_io_ugx.cpp:936
bool create_constraining_triangles(std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1527
size_t get_projection_handler_subset_handler_index(size_t phIndex, size_t refGridIndex)
returns the subset handler index for a projection handler
Definition: file_io_ugx.cpp:1221
bool create_constrained_triangles(std::vector< Face * > &facesOut, std::vector< std::pair< int, int > > &constrainingObjsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1564
bool create_pyramids(std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1866
const char * get_subset_handler_name(size_t refGridIndex, size_t subsetHandlerIndex) const
returns the name of the given subset handler
Definition: file_io_ugx.cpp:957
bool subset_handler(ISubsetHandler &shOut, size_t subsetHandlerIndex, size_t refGridIndex)
fills the given subset-handler
Definition: file_io_ugx.cpp:970
bool create_constraining_quadrilaterals(std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1651
bool create_prisms(std::vector< Volume * > &volsOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1825
bool create_quadrilaterals(std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1612
virtual ~GridReaderUGX()
Definition: file_io_ugx.cpp:931
size_t num_subset_handlers(size_t refGridIndex) const
returns the number of subset handlers for the given grid
Definition: file_io_ugx.cpp:945
bool grid(Grid &gridOut, size_t index, TPositionAttachment &aPos)
returns the i-th grid.
Definition: file_io_ugx_impl.hpp:429
bool create_triangles(std::vector< Face * > &facesOut, Grid &grid, rapidxml::xml_node<> *node, std::vector< Vertex * > &vrts)
Definition: file_io_ugx.cpp:1490
std::vector< GridEntry > m_entries
holds grids which already have been created
Definition: file_io_ugx.h:493
bool selector(ISelector &selOut, size_t selectorIndex, size_t refGridIndex)
fills the given selector
Definition: file_io_ugx.cpp:1111
Grants write access to ugx files.
Definition: file_io_ugx.h:108
rapidxml::xml_node * create_projector_node(RefinementProjector &proj, const char *nodeName)
Definition: file_io_ugx.cpp:303
rapidxml::xml_node * create_subset_element_node(const char *name, const ISubsetHandler &sh, size_t si)
Definition: file_io_ugx.cpp:197
Grid::VolumeAttachmentAccessor< AInt > AAVolIndex
Definition: file_io_ugx.h:145
void add_selector(ISelector &sel, const char *name, size_t refGridIndex)
Definition: file_io_ugx.cpp:274
rapidxml::xml_node * create_quadrilateral_node(QuadrilateralIterator quadsBegin, QuadrilateralIterator quadsEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:699
rapidxml::xml_node * create_tetrahedron_node(TetrahedronIterator tetsBegin, TetrahedronIterator tetsEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:789
void add_subset_attributes(rapidxml::xml_node<> *targetNode, ISubsetHandler &sh, size_t subsetIndex)
Definition: file_io_ugx.cpp:121
Grid::FaceAttachmentAccessor< AInt > AAFaceIndex
Definition: file_io_ugx.h:144
rapidxml::xml_node * create_hexahedron_node(HexahedronIterator hexasBegin, HexahedronIterator hexasEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:815
rapidxml::xml_node * create_edge_node(RegularEdgeIterator edgesBegin, RegularEdgeIterator edgesEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:514
rapidxml::xml_node * create_constrained_triangle_node(ConstrainedTriangleIterator trisBegin, ConstrainedTriangleIterator trisEnd, AAVrtIndex aaIndVRT, AAFaceIndex aaIndFACE)
Definition: file_io_ugx.cpp:659
rapidxml::xml_document m_doc
the xml_document which stores the data
Definition: file_io_ugx.h:283
rapidxml::xml_node * create_prism_node(PrismIterator prismsBegin, PrismIterator prismsEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:843
void add_elements_to_node(rapidxml::xml_node<> *node, Grid &grid)
adds grid elements (edges, faces, volumes) to the given node.
Definition: file_io_ugx.cpp:424
GridWriterUGX()
Definition: file_io_ugx.cpp:88
Grid::VertexAttachmentAccessor< AInt > AAVrtIndex
Definition: file_io_ugx.h:142
virtual bool write_to_stream(std::ostream &out)
Definition: file_io_ugx.cpp:104
void add_attachment(TAttachment attachment, const char *name, size_t refGridIndex)
Definition: file_io_ugx_impl.hpp:209
Grid::EdgeAttachmentAccessor< AInt > AAEdgeIndex
Definition: file_io_ugx.h:143
rapidxml::xml_node * create_octahedron_node(OctahedronIterator octsBegin, OctahedronIterator octsEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:897
rapidxml::xml_node * create_constraining_quadrilateral_node(ConstrainingQuadrilateralIterator quadsBegin, ConstrainingQuadrilateralIterator quadsEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:725
rapidxml::xml_node * create_pyramid_node(PyramidIterator pyrasBegin, PyramidIterator pyrasEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:870
void add_projection_handler(ProjectionHandler &ph, const char *name, size_t refGridIndex)
Definition: file_io_ugx.cpp:322
rapidxml::xml_node * create_constrained_quadrilateral_node(ConstrainedQuadrilateralIterator quadsBegin, ConstrainedQuadrilateralIterator quadsEnd, AAVrtIndex aaIndVRT, AAFaceIndex aaIndFACE)
Definition: file_io_ugx.cpp:751
rapidxml::xml_node * create_constraining_edge_node(ConstrainingEdgeIterator edgesBegin, ConstrainingEdgeIterator edgesEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:539
rapidxml::xml_node * create_constraining_triangle_node(ConstrainingTriangleIterator trisBegin, ConstrainingTriangleIterator trisEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:633
virtual ~GridWriterUGX()
Definition: file_io_ugx.cpp:96
void process_global_attachments(Grid &grid, rapidxml::xml_node<> *gridNode)
Definition: file_io_ugx_impl.hpp:376
std::vector< Entry > m_vEntries
List of accessible grids.
Definition: file_io_ugx.h:286
rapidxml::xml_node * create_constrained_vertex_node(ConstrainedVertexIterator vrtsBegin, ConstrainedVertexIterator vrtsEnd, TAAPos &aaPos, AAEdgeIndex aaIndEDGE, AAFaceIndex aaIndFACE)
Definition: file_io_ugx_impl.hpp:314
rapidxml::xml_node * create_selector_element_node(const char *name, const ISelector &sel)
Definition: file_io_ugx.cpp:237
const char * attachment_node_name()
Definition: file_io_ugx_impl.hpp:197
rapidxml::xml_node * create_triangle_node(TriangleIterator trisBegin, TriangleIterator trisEnd, AAVrtIndex aaIndVRT)
Definition: file_io_ugx.cpp:607
AInt m_aInt
attached to vertices of each grid during add_grid.
Definition: file_io_ugx.h:289
rapidxml::xml_node * create_constrained_edge_node(ConstrainedEdgeIterator edgesBegin, ConstrainedEdgeIterator edgesEnd, AAVrtIndex aaIndVRT, AAEdgeIndex aaIndEDGE, AAFaceIndex aaIndFACE)
Definition: file_io_ugx.cpp:564
rapidxml::xml_node * create_vertex_node(RegularVertexIterator vrtsBegin, RegularVertexIterator vrtsEnd, TAAPos &aaPos)
Definition: file_io_ugx_impl.hpp:270
bool write_to_file(const char *filename)
Definition: file_io_ugx.cpp:111
void init_grid_attachments(Grid &grid)
Definition: file_io_ugx.cpp:376
bool add_grid(Grid &grid, const char *name, TPositionAttachment &aPos)
Definition: file_io_ugx_impl.hpp:135
void add_subset_handler(ISubsetHandler &sh, const char *name, size_t refGridIndex)
Definition: file_io_ugx.cpp:152
base-implementation of a selector
Definition: selector_interface.h:126
Definition: subset_handler_interface.h:223
Definition: multi_grid.h:72
Associates different projectors with individual subsets.
Definition: projection_handler.h:53
Adjusts vertex coordinates during refinement.
Definition: refinement_projector.h:55
Definition: file_io_ugx.h:497
void check_file_parsed() const
throws an error if no file has been parsed yet
Definition: file_io_ugx.cpp:2141
size_t grid_world_dimension(size_t gridInd) const
Returns the dimension of the world-coordinates required for the given grid.
Definition: file_io_ugx.cpp:2128
std::vector< GridInfo > m_grids
Definition: file_io_ugx.h:577
bool grid_has_edges(size_t gridInd) const
Definition: file_io_ugx.cpp:2085
bool grid_has_volumes(size_t gridInd) const
Definition: file_io_ugx.cpp:2095
size_t num_subsets(size_t gridInd, size_t shInd) const
Definition: file_io_ugx.cpp:2060
std::string node_name(rapidxml::xml_node<> *n) const
returns the name-attribute of the node or "" if none exists
Definition: file_io_ugx.cpp:2133
bool calculate_vertex_node_bbox(rapidxml::xml_node<> *vrtNode, AABox< vector3 > &bb) const
calculates the bounding box of a group of vertices
Definition: file_io_ugx.cpp:2187
std::string subset_handler_name(size_t gridInd, size_t shInd) const
Definition: file_io_ugx.cpp:2070
size_t num_grids() const
Definition: file_io_ugx.cpp:2049
const SubsetInfo & subset_info(size_t gridInd, size_t shInd, size_t subsetInd) const
throws an error if the subset index is out of range.
Definition: file_io_ugx.cpp:2174
std::string subset_name(size_t gridInd, size_t shInd, size_t subsetInd) const
Definition: file_io_ugx.cpp:2075
std::string grid_name(size_t gridInd) const
Definition: file_io_ugx.cpp:2065
bool grid_has_faces(size_t gridInd) const
Definition: file_io_ugx.cpp:2090
UGXFileInfo()
Definition: file_io_ugx.cpp:1947
bool parse_file(const char *filename)
Definition: file_io_ugx.cpp:1952
bool m_fileParsed
Definition: file_io_ugx.h:578
bool grid_has_vertices(size_t gridInd) const
Definition: file_io_ugx.cpp:2080
const SubsetHandlerInfo & subset_handler_info(size_t gridInd, size_t shInd) const
throws an error if the subset handler index is out of range
Definition: file_io_ugx.cpp:2161
size_t topological_grid_dimension(size_t gridInd) const
Returns the topological dimension of the given grid.
Definition: file_io_ugx.cpp:2114
size_t physical_grid_dimension(size_t gridInd) const
Returns the physical dimension of the given grid.
Definition: file_io_ugx.cpp:2100
const GridInfo & grid_info(size_t index) const
return the queried grid info and throws an error if the grid index is out of range
Definition: file_io_ugx.cpp:2149
size_t num_subset_handlers(size_t gridInd) const
Definition: file_io_ugx.cpp:2055
the ug namespace
geometry_traits< ConstrainingQuadrilateral >::iterator ConstrainingQuadrilateralIterator
Definition: grid_objects_2d.h:850
geometry_traits< Octahedron >::iterator OctahedronIterator
Definition: grid_objects_3d.h:721
geometry_traits< Quadrilateral >::iterator QuadrilateralIterator
Definition: grid_objects_2d.h:366
geometry_traits< Prism >::iterator PrismIterator
Definition: grid_objects_3d.h:456
geometry_traits< ConstrainedTriangle >::iterator ConstrainedTriangleIterator
Definition: grid_objects_2d.h:487
geometry_traits< ConstrainedQuadrilateral >::iterator ConstrainedQuadrilateralIterator
Definition: grid_objects_2d.h:545
bool LoadGridFromUGX(Grid &grid, ISubsetHandler &sh, const char *filename)
Reads a grid to an ugx file.
Definition: file_io_ugx.cpp:69
bool SaveGridToUGX(Grid &grid, ISubsetHandler &sh, const char *filename)
Writes a grid to a ugx file.
Definition: file_io_ugx.cpp:55
geometry_traits< Triangle >::iterator TriangleIterator
Definition: grid_objects_2d.h:211
geometry_traits< RegularEdge >::iterator RegularEdgeIterator
Definition: grid_objects_1d.h:130
geometry_traits< RegularVertex >::iterator RegularVertexIterator
Definition: grid_objects_0d.h:94
geometry_traits< ConstrainedVertex >::iterator ConstrainedVertexIterator
Definition: grid_objects_0d.h:196
geometry_traits< Hexahedron >::iterator HexahedronIterator
Definition: grid_objects_3d.h:323
geometry_traits< ConstrainingEdge >::iterator ConstrainingEdgeIterator
Definition: grid_objects_1d.h:449
geometry_traits< ConstrainedEdge >::iterator ConstrainedEdgeIterator
Definition: grid_objects_1d.h:264
geometry_traits< Tetrahedron >::iterator TetrahedronIterator
Definition: grid_objects_3d.h:189
geometry_traits< ConstrainingTriangle >::iterator ConstrainingTriangleIterator
Definition: grid_objects_2d.h:780
geometry_traits< Pyramid >::iterator PyramidIterator
Definition: grid_objects_3d.h:587
Definition: shapes.h:60
Definition: file_io_ugx.h:373
MultiGrid * mg
Definition: file_io_ugx.h:378
std::vector< SubsetHandlerEntry > subsetHandlerEntries
Definition: file_io_ugx.h:379
std::vector< Vertex * > vertices
Definition: file_io_ugx.h:382
std::vector< SelectorEntry > selectorEntries
Definition: file_io_ugx.h:380
Grid * grid
Definition: file_io_ugx.h:377
std::vector< rapidxml::xml_node<> * > projectionHandlerEntries
Definition: file_io_ugx.h:381
rapidxml::xml_node * node
Definition: file_io_ugx.h:376
std::vector< Face * > faces
Definition: file_io_ugx.h:384
GridEntry(rapidxml::xml_node<> *n)
Definition: file_io_ugx.h:374
std::vector< Volume * > volumes
Definition: file_io_ugx.h:385
std::vector< Edge * > edges
Definition: file_io_ugx.h:383
Definition: file_io_ugx.h:365
SelectorEntry(rapidxml::xml_node<> *n)
Definition: file_io_ugx.h:366
rapidxml::xml_node * node
Definition: file_io_ugx.h:368
ISelector * sel
Definition: file_io_ugx.h:369
Definition: file_io_ugx.h:357
ISubsetHandler * sh
Definition: file_io_ugx.h:361
SubsetHandlerEntry(rapidxml::xml_node<> *n)
Definition: file_io_ugx.h:358
rapidxml::xml_node * node
Definition: file_io_ugx.h:360
entries are stored for each grid.
Definition: file_io_ugx.h:272
Entry()
Definition: file_io_ugx.h:273
Entry(Grid *g, rapidxml::xml_node<> *n)
Definition: file_io_ugx.h:274
std::vector< const ISubsetHandler * > subsetHandlers
Definition: file_io_ugx.h:278
rapidxml::xml_node * node
Definition: file_io_ugx.h:279
Grid * grid
Definition: file_io_ugx.h:277
Definition: file_io_ugx.h:567
std::string m_name
Definition: file_io_ugx.h:568
std::vector< SubsetHandlerInfo > m_subsetHandlers
Definition: file_io_ugx.h:573
bool m_hasVertices
Definition: file_io_ugx.h:569
bool m_hasVolumes
Definition: file_io_ugx.h:572
bool m_hasFaces
Definition: file_io_ugx.h:571
bool m_hasEdges
Definition: file_io_ugx.h:570
vector3 m_extension
Definition: file_io_ugx.h:574
Definition: file_io_ugx.h:562
std::string m_name
Definition: file_io_ugx.h:563
std::vector< SubsetInfo > m_subsets
Definition: file_io_ugx.h:564
Definition: file_io_ugx.h:558
std::string m_name
Definition: file_io_ugx.h:559