DOLFINx 0.9.0
DOLFINx C++ interface
|
#include <XDMFFile.h>
Public Types | |
enum class | Encoding { HDF5 , ASCII } |
File encoding type. | |
Public Member Functions | |
XDMFFile (MPI_Comm comm, const std::filesystem::path &filename, std::string file_mode, Encoding encoding=default_encoding) | |
Constructor. | |
XDMFFile (XDMFFile &&)=default | |
Move constructor. | |
~XDMFFile () | |
Destructor. | |
void | close () |
template<std::floating_point U> | |
void | write_mesh (const mesh::Mesh< U > &mesh, std::string xpath="/Xdmf/Domain") |
void | write_geometry (const mesh::Geometry< double > &geometry, std::string name, std::string xpath="/Xdmf/Domain") |
mesh::Mesh< double > | read_mesh (const fem::CoordinateElement< double > &element, mesh::GhostMode mode, std::string name, std::string xpath="/Xdmf/Domain") const |
std::pair< std::vector< std::int64_t >, std::array< std::size_t, 2 > > | read_topology_data (std::string name, std::string xpath="/Xdmf/Domain") const |
std::pair< std::variant< std::vector< float >, std::vector< double > >, std::array< std::size_t, 2 > > | read_geometry_data (std::string name, std::string xpath="/Xdmf/Domain") const |
std::pair< mesh::CellType, int > | read_cell_type (std::string grid_name, std::string xpath="/Xdmf/Domain") |
template<dolfinx::scalar T, std::floating_point U = scalar_value_type_t<T>> | |
void | write_function (const fem::Function< T, U > &u, double t, std::string mesh_xpath="/Xdmf/Domain/Grid[@GridType='Uniform'][1]") |
Write a fem::Function to file. | |
template<std::floating_point T> | |
void | write_meshtags (const mesh::MeshTags< std::int32_t > &meshtags, const mesh::Geometry< T > &x, std::string geometry_xpath, std::string xpath="/Xdmf/Domain") |
mesh::MeshTags< std::int32_t > | read_meshtags (const mesh::Mesh< double > &mesh, std::string name, std::string xpath="/Xdmf/Domain") |
void | write_information (std::string name, std::string value, std::string xpath="/Xdmf/Domain/") |
std::string | read_information (std::string name, std::string xpath="/Xdmf/Domain/") |
MPI_Comm | comm () const |
Static Public Attributes | |
static const Encoding | default_encoding = Encoding::HDF5 |
Default encoding type. | |
Read and write mesh::Mesh, fem::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 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.
std::pair< mesh::CellType, int > read_cell_type | ( | std::string | grid_name, |
std::string | xpath = "/Xdmf/Domain" ) |
Read information about cell type
[in] | grid_name | Name of Grid for which cell type is needed |
[in] | xpath | XPath where Grid is stored |
std::pair< std::variant< std::vector< float >, std::vector< double > >, std::array< std::size_t, 2 > > read_geometry_data | ( | std::string | name, |
std::string | xpath = "/Xdmf/Domain" ) const |
Read Geometry data for Mesh
[in] | name | Name of the mesh (Grid) |
[in] | xpath | XPath where Mesh Grid data is located |
std::string read_information | ( | std::string | name, |
std::string | xpath = "/Xdmf/Domain/" ) |
Read Information
[in] | name | |
[in] | xpath | XPath where Information is stored in file |
mesh::Mesh< double > read_mesh | ( | const fem::CoordinateElement< double > & | element, |
mesh::GhostMode | mode, | ||
std::string | name, | ||
std::string | xpath = "/Xdmf/Domain" ) const |
Read in Mesh
[in] | element | Element that describes the geometry of a cell |
[in] | mode | The type of ghosting/halo to use for the mesh when distributed in parallel |
[in] | name | |
[in] | xpath | XPath where Mesh Grid is located |
mesh::MeshTags< std::int32_t > read_meshtags | ( | const mesh::Mesh< double > & | mesh, |
std::string | name, | ||
std::string | xpath = "/Xdmf/Domain" ) |
Read MeshTags
[in] | mesh | The Mesh that the data is defined on |
[in] | name | |
[in] | xpath | XPath where MeshTags Grid is stored in file |
std::pair< std::vector< std::int64_t >, std::array< std::size_t, 2 > > read_topology_data | ( | std::string | name, |
std::string | xpath = "/Xdmf/Domain" ) const |
Read Topology data for Mesh
[in] | name | Name of the mesh (Grid) |
[in] | xpath | XPath where Mesh Grid data is located |
void write_function | ( | const fem::Function< T, U > & | u, |
double | t, | ||
std::string | mesh_xpath = "/Xdmf/Domain/Grid[@GridType='Uniform'][1]" ) |
Write a fem::Function to file.
u
must be (i) a lowest-order (P0) discontinuous Lagrange element or (ii) a continuous Lagrange element where the element 'nodes' are the same as the nodes of its mesh::Mesh. Otherwise an exception is raised.u
. The VTX output (io::VTXWriter) format is recommended over XDMF for discontinuous and/or high-order spaces.[in] | u | Function to write to file. |
[in] | t | Time stamp to associate with u . |
[in] | mesh_xpath | XPath for a Grid under which u will be inserted. |
void write_geometry | ( | const mesh::Geometry< double > & | geometry, |
std::string | name, | ||
std::string | xpath = "/Xdmf/Domain" ) |
Save Geometry
[in] | geometry | |
[in] | name | |
[in] | xpath | XPath of a node where Geometry will be inserted |
void write_information | ( | std::string | name, |
std::string | value, | ||
std::string | xpath = "/Xdmf/Domain/" ) |
Write Information
[in] | name | |
[in] | value | String to store into Information tag |
[in] | xpath | XPath where Information will be inserted |
void write_mesh | ( | const mesh::Mesh< U > & | mesh, |
std::string | xpath = "/Xdmf/Domain" ) |
Save Mesh
[in] | mesh | |
[in] | xpath | XPath where Mesh Grid will be written |
void write_meshtags | ( | const mesh::MeshTags< std::int32_t > & | meshtags, |
const mesh::Geometry< T > & | x, | ||
std::string | geometry_xpath, | ||
std::string | xpath = "/Xdmf/Domain" ) |
Write MeshTags
[in] | meshtags | |
[in] | x | Mesh geometry |
[in] | geometry_xpath | XPath where Geometry is already stored in file |
[in] | xpath | XPath where MeshTags Grid will be inserted |