Read and write mesh::Mesh, fem::Function and other objects in XDMF.
More...
#include <XDMFFile.h>
|
| enum class | Encoding { HDF5
, ASCII
} |
| | File encoding type.
|
| |
|
|
| XDMFFile (MPI_Comm comm, const std::filesystem::path &filename, std::string file_mode, Encoding encoding=default_encoding) |
| | Constructor.
|
| |
|
| ~XDMFFile () |
| | Destructor.
|
| |
| void | close () |
| | Close the file.
|
| |
| void | write_mesh (const mesh::Mesh &mesh, std::string xpath="/Xdmf/Domain") |
| | Save Mesh.
|
| |
| void | write_geometry (const mesh::Geometry &geometry, std::string name, std::string xpath="/Xdmf/Domain") |
| | Save Geometry.
|
| |
| mesh::Mesh | read_mesh (const fem::CoordinateElement &element, mesh::GhostMode mode, std::string name, std::string xpath="/Xdmf/Domain") const |
| | Read in Mesh.
|
| |
| 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.
|
| |
| std::pair< 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.
|
| |
| std::pair< mesh::CellType, int > | read_cell_type (std::string grid_name, std::string xpath="/Xdmf/Domain") |
| | Read information about cell type.
|
| |
| void | write_function (const fem::Function< double > &u, double t, std::string mesh_xpath="/Xdmf/Domain/Grid[@GridType='Uniform'][1]") |
| | Write Function.
|
| |
| void | write_function (const fem::Function< std::complex< double > > &u, double t, std::string mesh_xpath="/Xdmf/Domain/Grid[@GridType='Uniform'][1]") |
| | Write Function.
|
| |
| void | write_meshtags (const mesh::MeshTags< std::int32_t > &meshtags, std::string geometry_xpath, std::string xpath="/Xdmf/Domain") |
| | Write MeshTags.
|
| |
| mesh::MeshTags< std::int32_t > | read_meshtags (std::shared_ptr< const mesh::Mesh > mesh, std::string name, std::string xpath="/Xdmf/Domain") |
| | Read MeshTags.
|
| |
| void | write_information (std::string name, std::string value, std::string xpath="/Xdmf/Domain/") |
| | Write Information.
|
| |
| std::string | read_information (std::string name, std::string xpath="/Xdmf/Domain/") |
| | Read Information.
|
| |
| MPI_Comm | comm () const |
| | Get the MPI communicator.
|
| |
|
|
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.
◆ 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.
◆ comm()
Get the MPI communicator.
- Returns
- The MPI communicator for the file object
◆ read_cell_type()
| std::pair< mesh::CellType, int > read_cell_type |
( |
std::string |
grid_name, |
|
|
std::string |
xpath = "/Xdmf/Domain" |
|
) |
| |
Read information about cell type.
- Parameters
-
| [in] | grid_name | Name of Grid for which cell type is needed |
| [in] | xpath | XPath where Grid is stored |
◆ read_geometry_data()
| std::pair< 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.
- Parameters
-
| [in] | name | Name of the mesh (Grid) |
| [in] | xpath | XPath where Mesh Grid data is located |
- Returns
- points on each process
◆ read_information()
| std::string read_information |
( |
std::string |
name, |
|
|
std::string |
xpath = "/Xdmf/Domain/" |
|
) |
| |
Read Information.
- Parameters
-
| [in] | name | |
| [in] | xpath | XPath where Information is stored in file |
◆ read_mesh()
Read in Mesh.
- Parameters
-
| [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 |
- Returns
- A Mesh distributed on the same communicator as the XDMFFile
◆ read_meshtags()
| mesh::MeshTags< std::int32_t > read_meshtags |
( |
std::shared_ptr< const mesh::Mesh > |
mesh, |
|
|
std::string |
name, |
|
|
std::string |
xpath = "/Xdmf/Domain" |
|
) |
| |
Read MeshTags.
- Parameters
-
| [in] | mesh | The Mesh that the data is defined on |
| [in] | name | |
| [in] | xpath | XPath where MeshTags Grid is stored in file |
◆ read_topology_data()
| 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.
- Parameters
-
| [in] | name | Name of the mesh (Grid) |
| [in] | xpath | XPath where Mesh Grid data is located |
- Returns
- (Cell type, degree), and cells topology (global node indexing)
◆ write_function() [1/2]
| void write_function |
( |
const fem::Function< double > & |
u, |
|
|
double |
t, |
|
|
std::string |
mesh_xpath = "/Xdmf/Domain/Grid[@GridType='Uniform'][1]" |
|
) |
| |
Write Function.
- Parameters
-
| [in] | u | The Function to write to file |
| [in] | t | The time stamp to associate with the Function |
| [in] | mesh_xpath | XPath for a Grid under which Function will be inserted |
◆ write_function() [2/2]
| void write_function |
( |
const fem::Function< std::complex< double > > & |
u, |
|
|
double |
t, |
|
|
std::string |
mesh_xpath = "/Xdmf/Domain/Grid[@GridType='Uniform'][1]" |
|
) |
| |
Write Function.
- Parameters
-
| [in] | u | The Function to write to file |
| [in] | t | The time stamp to associate with the Function |
| [in] | mesh_xpath | XPath for a Grid under which Function will be inserted |
◆ write_geometry()
| void write_geometry |
( |
const mesh::Geometry & |
geometry, |
|
|
std::string |
name, |
|
|
std::string |
xpath = "/Xdmf/Domain" |
|
) |
| |
Save Geometry.
- Parameters
-
| [in] | geometry | |
| [in] | name | |
| [in] | xpath | XPath of a node where Geometry will be inserted |
◆ write_information()
| void write_information |
( |
std::string |
name, |
|
|
std::string |
value, |
|
|
std::string |
xpath = "/Xdmf/Domain/" |
|
) |
| |
Write Information.
- Parameters
-
| [in] | name | |
| [in] | value | String to store into Information tag |
| [in] | xpath | XPath where Information will be inserted |
◆ write_mesh()
| void write_mesh |
( |
const mesh::Mesh & |
mesh, |
|
|
std::string |
xpath = "/Xdmf/Domain" |
|
) |
| |
Save Mesh.
- Parameters
-
| [in] | mesh | |
| [in] | xpath | XPath where Mesh Grid will be written |
◆ write_meshtags()
| void write_meshtags |
( |
const mesh::MeshTags< std::int32_t > & |
meshtags, |
|
|
std::string |
geometry_xpath, |
|
|
std::string |
xpath = "/Xdmf/Domain" |
|
) |
| |
Write MeshTags.
- Parameters
-
| [in] | meshtags | |
| [in] | geometry_xpath | XPath where Geometry is already stored in file |
| [in] | xpath | XPath where MeshTags Grid will be inserted |
The documentation for this class was generated from the following files:
- /build/reproducible-path/fenics-dolfinx-0.6.0/cpp/dolfinx/io/XDMFFile.h
- /build/reproducible-path/fenics-dolfinx-0.6.0/cpp/dolfinx/io/XDMFFile.cpp