|
GridFormat 0.6.0
I/O-Library for grid-like data structures
|
Common functionality for writing VTK HDF files.
#include <vector>#include <cstddef>#include <numeric>#include <string>#include <optional>#include <ranges>#include <array>#include <gridformat/common/hdf5.hpp>#include <gridformat/common/field.hpp>#include <gridformat/common/precision.hpp>#include <gridformat/common/lazy_field.hpp>#include <gridformat/common/range_field.hpp>#include <gridformat/common/field_transformations.hpp>#include <gridformat/common/multi_string.hpp>#include <gridformat/common/string_conversion.hpp>#include <gridformat/common/exceptions.hpp>#include <gridformat/parallel/communication.hpp>#include <gridformat/parallel/helpers.hpp>Go to the source code of this file.
Classes | |
| struct | GridFormat::VTK::HDFTransientOptions |
| Options for transient vtk-hdf file formats. More... | |
| struct | GridFormat::VTKHDF::IOContext |
| Helper class to store processor offsets in parallel writes. More... | |
| class | GridFormat::VTKHDF::DataSetField< C > |
| Field implementation that draws values from an open HDF5 file upon request. More... | |
Functions | |
| void | GridFormat::VTKHDF::check_array_name (const std::string &name) |
| Throw if the given name cannot be used as a vtk-hdf array name. | |
| bool | GridFormat::VTKHDF::is_string_field (const Field &field) |
| Return true if the given field holds strings (i.e. is a flat array of characters, see MultiString). | |
| std::vector< std::string > | GridFormat::VTKHDF::extract_strings (const Field &field) |
| Return the strings stored in the given character field (see MultiString). | |
| template<typename C> | |
| GridFormat::VTKHDF::DataSetField (const HDF5::File< C > &, std::string) -> DataSetField< C > | |
| template<typename C, typename CB> | |
| GridFormat::VTKHDF::DataSetField (const HDF5::File< C > &, MDLayout, DynamicPrecision, CB &&) -> DataSetField< C > | |
| template<typename C> | |
| std::string | GridFormat::VTKHDF::get_file_type (const HDF5::File< C > &file) |
| Read the vtk-hdf file type from an hdf5 file. | |
| template<typename C> | |
| void | GridFormat::VTKHDF::check_version_compatibility (const HDF5::File< C > &file, const std::array< std::size_t, 2 > &supported) |
| FieldPtr | GridFormat::VTKHDF::as_field_data_tuples (FieldPtr field) |
| Return the given field data in the shape of tuples, i.e. (tuples) or (tuples, components). | |
| void | GridFormat::VTKHDF::write_field_data (HDF5::File<> &file, const std::string &name, FieldPtr field) |
| Write a field data array into a file that is not transient. | |
| void | GridFormat::VTKHDF::write_field_data_step (HDF5::File<> &file, const std::string &name, FieldPtr field) |
| Append a time step to a field data array of a transient file. | |
| void | GridFormat::VTKHDF::write_field_data_step_referencing (std::size_t step_index, HDF5::File<> &file, const std::string &name) |
| Append a time step to a field data array of a transient file, referring to the data of an earlier step. | |
| template<typename C> | |
| FieldPtr | GridFormat::VTKHDF::read_field_data (const HDF5::File< C > &file, const std::string &name, std::optional< std::size_t > step) |
| Read the field data array with the given name, at the given step for transient files. | |
| template<Concepts::Communicator C, std::invocable< HDF5::File<> & > Write> | |
| void | GridFormat::VTKHDF::write_on_root (const std::string &filename, const C &comm, int root, Write &&write) |
| Open the given file with the default (non-MPI) driver on the root rank and pass it to write. | |
| void GridFormat::VTKHDF::check_version_compatibility | ( | const HDF5::File< C > & | file, |
| const std::array< std::size_t, 2 > & | supported ) |
Check that the version stated in the file is supported
|
inline |
Uses the layout written by VTK: the tuples of all steps are concatenated, and the offset (in tuples) and the sizes (number of components and tuples) of each step are stored in the "Steps" group. Strings are stored as one tuple per string.
| void GridFormat::VTKHDF::write_on_root | ( | const std::string & | filename, |
| const C & | comm, | ||
| int | root, | ||
| Write && | write ) |
Must be called collectively once all ranks have closed the file. If write throws, the exception is rethrown on the root rank, and an IOError is thrown on all other ranks.