DOLFIN
DOLFIN C++ interface
XMLMesh.h
1// Copyright (C) 2011 Garth N. Wells
2//
3// This file is part of DOLFIN.
4//
5// DOLFIN is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// DOLFIN is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
17//
18// Modified by Anders Logg 2011
19//
20// First added: 2003-07-15
21// Last changed: 2011-09-02
22
23#ifndef __XML_MESH_H
24#define __XML_MESH_H
25
26#include <ostream>
27#include <string>
28#include <vector>
29
30namespace pugi
31{
32 class xml_node;
33}
34
35namespace dolfin
36{
37
38 class LocalMeshData;
39 class Mesh;
40 class MeshData;
41 class MeshDomains;
42
44
45 class XMLMesh
46 {
47 public:
48
50 static void read(Mesh& mesh, const pugi::xml_node mesh_node);
51
53 static void write(const Mesh& mesh, pugi::xml_node mesh_node);
54
55 private:
56
57 // Read mesh
58 static void read_mesh(Mesh& mesh,
59 const pugi::xml_node mesh_node);
60
61 // Read mesh data
62 static void read_data(MeshData& data,
63 const Mesh& mesh,
64 const pugi::xml_node mesh_node);
65
66 // Read mesh domains
67 static void read_domains(MeshDomains& domains,
68 const Mesh& mesh,
69 const pugi::xml_node mesh_node);
70
71 public:
72
73 // FIXME: This is hack for domain data support via XML in
74 // parallel.
76 static void read_domain_data(LocalMeshData& mesh_data,
77 const pugi::xml_node mesh_node);
78
79 private:
80
81 // Read array
82 static void read_array_uint(std::vector<std::size_t>& array,
83 const pugi::xml_node xml_array);
84
85 // Write mesh
86 static void write_mesh(const Mesh& mesh,
87 pugi::xml_node mesh_node);
88
89 // Write mesh data
90 static void write_data(const Mesh& mesh, const MeshData& data,
91 pugi::xml_node mesh_node);
92
93 // Write mesh markers
94 static void write_domains(const Mesh& mesh,
95 const MeshDomains& domains,
96 pugi::xml_node mesh_node);
97
98 };
99
100}
101
102#endif
This class stores mesh data on a local processor corresponding to a portion of a (larger) global mesh...
Definition: LocalMeshData.h:59
Definition: MeshData.h:59
Definition: MeshDomains.h:42
Definition: Mesh.h:84
I/O of XML representation of a Mesh.
Definition: XMLMesh.h:46
static void read(Mesh &mesh, const pugi::xml_node mesh_node)
Read mesh from XML.
Definition: XMLMesh.cpp:52
static void write(const Mesh &mesh, pugi::xml_node mesh_node)
Write mesh to XML.
Definition: XMLMesh.cpp:73
static void read_domain_data(LocalMeshData &mesh_data, const pugi::xml_node mesh_node)
Read domain data in LocalMeshData.
Definition: XMLMesh.cpp:322
Definition: adapt.h:30