|
SpECTRE
v2026.09.05
|
Reads time series of modal coefficients from volume data files. More...
#include <ModalTimeSeriesReader.hpp>
Public Types | |
| using | Series = std::vector<std::vector<std::vector<double>>> |
| Modal coefficient time series of a single element, indexed as series[component][mode][observation]. Modes are ordered by the collapsed index of the element's mesh. | |
Public Member Functions | |
| ModalTimeSeriesReader (const std::variant< std::vector< std::string >, std::string > &volume_files_or_glob, std::string subfile_name, std::vector< std::string > tensor_components, std::optional< double > start_time=std::nullopt, std::optional< double > end_time=std::nullopt) | |
| Construct from one or more volume files. | |
| ModalTimeSeriesReader (ModalTimeSeriesReader &&) | |
| ModalTimeSeriesReader & | operator= (ModalTimeSeriesReader &&) |
| ModalTimeSeriesReader (const ModalTimeSeriesReader &)=delete | |
| ModalTimeSeriesReader & | operator= (const ModalTimeSeriesReader &)=delete |
| double | start_time () const |
| Time of the first observation (after filtering by start_time and end_time) | |
| double | time_step () const |
| Uniform spacing between observation times. | |
| size_t | num_observations () const |
| Number of observations (after filtering by start_time and end_time) | |
| const std::vector< std::string > & | tensor_components () const |
| The tensor components that will be read. | |
| const std::vector< std::pair< ElementId< Dim >, Mesh< Dim > > > & | elements () const |
| All elements in the volume files and their meshes. | |
| Series | modal_time_series (const ElementId< Dim > &element_id) |
| The time series of all modal coefficients of all tensor components of the given element. | |
Reads time series of modal coefficients from volume data files.
This class reads tensor components written by multiple observations of a volume data subfile, transforms the nodal data of each element to modal coefficients, and returns the time series of every modal coefficient one element at a time. Reading element-by-element keeps memory usage low: only a single element's time series is held in memory at once, so the volume data never has to be loaded into memory as a whole.
Request the time series with modal_time_series(), e.g.:
The observation times must be uniformly spaced. Multiple files can be used when the elements of each observation are distributed across files, such as files written by different nodes. All files must contain the same observations in the requested time interval, and each element must reside in the same file with the same mesh for all observations. Files from different simulation segments must be joined first, with overlapping observations removed. Adaptive mesh refinement and element migration between files (e.g. by load balancing) are not supported yet and raise errors.
Only the Legendre basis is supported for now.
| spectre::Exporter::ModalTimeSeriesReader< Dim >::ModalTimeSeriesReader | ( | const std::variant< std::vector< std::string >, std::string > & | volume_files_or_glob, |
| std::string | subfile_name, | ||
| std::vector< std::string > | tensor_components, | ||
| std::optional< double > | start_time = std::nullopt, | ||
| std::optional< double > | end_time = std::nullopt ) |
Construct from one or more volume files.
Reads and validates metadata from all files. The volume data itself is only read when calling modal_time_series().
| volume_files_or_glob | A list of volume H5 files, or a glob string that resolves to volume files. The files can distribute elements of the same observations across nodes, but files from different simulation segments must be joined first. |
| subfile_name | The name of the volume data subfile in the H5 files. |
| tensor_components | Tensor component names to read. Each component must exist in every file at every observation. |
| start_time | Optional lower bound to restrict observations. |
| end_time | Optional upper bound to restrict observations. |
|
inline |
All elements in the volume files and their meshes.
The elements are grouped by the volume file they reside in. Requesting the modal_time_series() in this order avoids re-reading per-file metadata.
| Series spectre::Exporter::ModalTimeSeriesReader< Dim >::modal_time_series | ( | const ElementId< Dim > & | element_id | ) |
The time series of all modal coefficients of all tensor components of the given element.
Metadata of the file in which the element resides is cached between calls, so requesting elements in the order of elements() is most efficient (this is also why this function is not const).
Reading the volume data is currently not optimized: every observation of a tensor component is read from disk once per element residing in the file. Reading only the element's subset of the data would avoid this amplification without changing this interface.