DOLFIN-X
DOLFIN-X C++ interface
|
Read and write mesh::Mesh, function::Function and other objects in XDMF. More...
#include <XDMFFile.h>
Public Types | |
enum | Encoding { HDF5, ASCII } |
File encoding type. | |
Public Member Functions | |
XDMFFile (MPI_Comm comm, const std::string filename, const std::string file_mode, const Encoding encoding=default_encoding) | |
Constructor. | |
~XDMFFile () | |
Destructor. | |
void | close () |
Close the file. More... | |
void | write_mesh (const mesh::Mesh &mesh, const std::string xpath="/Xdmf/Domain") |
Save Mesh. More... | |
void | write_geometry (const mesh::Geometry &geometry, const std::string name="geometry", const std::string xpath="/Xdmf/Domain") |
Save Geometry. More... | |
mesh::Mesh | read_mesh (const fem::CoordinateElement &element, const std::string name, const std::string xpath="/Xdmf/Domain") const |
Read in Mesh. More... | |
std::tuple< std::pair< mesh::CellType, int >, Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >, Eigen::Array< std::int64_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > | read_mesh_data (const std::string name="mesh", const std::string xpath="/Xdmf/Domain") const |
Read in the data for Mesh. More... | |
void | write_function (const function::Function &function, const double t, const std::string mesh_xpath="/Xdmf/Domain/Grid[@GridType='Uniform'][1]") |
Write Function. More... | |
void | write_meshtags (const mesh::MeshTags< std::int32_t > &meshtags, const std::string geometry_xpath="/Xdmf/Domain/Geometry", const std::string xpath="/Xdmf/Domain") |
Write MeshTags. More... | |
mesh::MeshTags< std::int32_t > | read_meshtags (const std::shared_ptr< const mesh::Mesh > &mesh, const std::string name, const std::string xpath="/Xdmf/Domain") |
Read MeshTags. More... | |
MPI_Comm | comm () const |
Get the MPI communicator. More... | |
Static Public Attributes | |
static const Encoding | default_encoding = Encoding::HDF5 |
Default encoding type. | |
Read and write mesh::Mesh, function::Function and other objects in XDMF.
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 higher order geometries, as their currently only supports 1st and 2nd order geometries.
void XDMFFile::close | ( | ) |
Close the file.
This closes open underlying HDF5 file. In ASCII mode the XML file is closed each time it is written to or read from, so close() has no effect.
MPI_Comm XDMFFile::comm | ( | ) | const |
mesh::Mesh XDMFFile::read_mesh | ( | const fem::CoordinateElement & | element, |
const std::string | name, | ||
const std::string | xpath = "/Xdmf/Domain" |
||
) | const |
Read in Mesh.
[in] | element | Element that describes the geometry of a cell |
[in] | name | |
[in] | xpath | XPath where Mesh Grid is located |
std::tuple< std::pair< mesh::CellType, int >, Eigen::Array< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >, Eigen::Array< std::int64_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > XDMFFile::read_mesh_data | ( | const std::string | name = "mesh" , |
const std::string | xpath = "/Xdmf/Domain" |
||
) | const |
Read in the data for Mesh.
[in] | name | |
[in] | xpath | XPath where Mesh Grid data is located |
mesh::MeshTags< std::int32_t > XDMFFile::read_meshtags | ( | const std::shared_ptr< const mesh::Mesh > & | mesh, |
const std::string | name, | ||
const std::string | xpath = "/Xdmf/Domain" |
||
) |
Read MeshTags.
[in] | mesh | |
[in] | name | |
[in] | xpath | XPath where MeshTags Grid is stored in file |
void XDMFFile::write_function | ( | const function::Function & | function, |
const double | t, | ||
const std::string | mesh_xpath = "/Xdmf/Domain/Grid[@GridType='Uniform'][1]" |
||
) |
Write Function.
[in] | function | |
[in] | t | Time |
[in] | mesh_xpath | XPath for a Grid under which Function will be inserted |
void XDMFFile::write_geometry | ( | const mesh::Geometry & | geometry, |
const std::string | name = "geometry" , |
||
const std::string | xpath = "/Xdmf/Domain" |
||
) |
Save Geometry.
[in] | geometry | |
[in] | name | |
[in] | xpath | XPath of a node where Geometry will be inserted |
void XDMFFile::write_mesh | ( | const mesh::Mesh & | mesh, |
const std::string | xpath = "/Xdmf/Domain" |
||
) |
Save Mesh.
[in] | mesh | |
[in] | xpath | XPath where Mesh Grid will be written |
void XDMFFile::write_meshtags | ( | const mesh::MeshTags< std::int32_t > & | meshtags, |
const std::string | geometry_xpath = "/Xdmf/Domain/Geometry" , |
||
const std::string | xpath = "/Xdmf/Domain" |
||
) |
Write MeshTags.
[in] | meshtags | |
[in] | geometry_xpath | XPath where Geometry is already stored in file |
[in] | xpath | XPath where MeshTags Grid will be inserted |