/usr/include/dolfin/io/XDMFFile.h is in libdolfin-dev 1.4.0+dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | // Copyright (C) 2012 Chris N. Richardson and Garth N. Wells
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Modified by Garth N. Wells, 2012
#ifndef __DOLFIN_XDMFFILE_H
#define __DOLFIN_XDMFFILE_H
#ifdef HAS_HDF5
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <dolfin/common/MPI.h>
#include <dolfin/common/Variable.h>
#include "GenericFile.h"
namespace pugi
{
class xml_node;
}
namespace dolfin
{
// Forward declarations
class Function;
class HDF5File;
class Mesh;
template<typename T> class MeshFunction;
class Point;
/// This class supports the output of meshes and functions in XDMF
/// (http://www.xdmf.org) format. It creates an XML file that describes
/// the data and points to a HDF5 file that stores the actual problem
/// data. Output of data in parallel is supported.
///
/// XDMF is not suitable for checkpointing as it may decimate
/// some data.
class XDMFFile : public GenericFile, public Variable
{
public:
/// Constructor
XDMFFile(MPI_Comm comm, const std::string filename);
/// Destructor
~XDMFFile();
/// Save a mesh for visualisation, with e.g. ParaView. Creates a HDF5
/// file to store the mesh, and a related XDMF file with metadata.
void operator<< (const Mesh& mesh);
/// Read in a mesh from the associated HDF5 file,
/// optionally using stored partitioning, if possible
/// when the same number of processes are being used.
void read(Mesh& mesh, bool use_partition_from_file);
/// Read in a mesh from the associated HDF5 file
void operator>> (Mesh& mesh);
/// Save a Function to XDMF/HDF5 files for visualisation.
void operator<< (const Function& u);
/// Save Function + time stamp to file
void operator<< (const std::pair<const Function*, double> ut);
/// Save MeshFunction to file
void operator<< (const MeshFunction<bool>& meshfunction);
void operator<< (const MeshFunction<int>& meshfunction);
void operator<< (const MeshFunction<std::size_t>& meshfunction);
void operator<< (const MeshFunction<double>& meshfunction);
/// Save a cloud of points to file
void write(const std::vector<Point>& points);
/// Save a cloud of points, with scalar values
void write(const std::vector<Point>& points,
const std::vector<double>& values);
using GenericFile::write;
/// Read first MeshFunction from file
void operator>> (MeshFunction<bool>& meshfunction);
void operator>> (MeshFunction<int>& meshfunction);
void operator>> (MeshFunction<std::size_t>& meshfunction);
void operator>> (MeshFunction<double>& meshfunction);
private:
// MPI communicator
MPI_Comm _mpi_comm;
// HDF5 data file
std::unique_ptr<HDF5File> hdf5_file;
// HDF5 filename
std::string hdf5_filename;
// HDF5 file mode (r/w)
std::string hdf5_filemode;
// Generic MeshFunction writer
template<typename T>
void write_mesh_function(const MeshFunction<T>& meshfunction);
// Generic MeshFunction reader
template<typename T>
void read_mesh_function(MeshFunction<T>& meshfunction);
// Write XML description of point clouds, with value_size = 0, 1 or 3
// (for either no point data, scalar, or vector)
void write_point_xml(const std::string dataset_name,
const std::size_t num_global_points,
const unsigned int value_size);
// Write XML description for Function and MeshFunction output
// updating time-series if need be
void output_xml(const double time_step, const bool vertex_data,
const std::size_t cell_dim,
const std::size_t num_global_cells,
const std::size_t gdim,
const std::size_t num_total_vertices,
const std::size_t value_rank,
const std::size_t padded_value_size,
const std::string name,
const std::string dataset_name) const;
// Helper function to add topology reference to XDMF XML file
void xml_mesh_topology(pugi::xml_node& xdmf_topology,
const std::size_t cell_dim,
const std::size_t num_global_cells,
const std::string topology_dataset_name) const;
// Helper function to add geometry section to XDMF XML file
void xml_mesh_geometry(pugi::xml_node& xdmf_geometry,
const std::size_t num_all_local_cells,
const std::size_t gdim,
const std::string geometry_dataset_name) const;
// Most recent mesh name
std::string current_mesh_name;
};
}
#endif
#endif
|