Interface to the writers for all supported file formats. Depending on the chosen format, this exposes the interface of grid file or time series writers.
More...
template<Concepts::Grid G>
class GridFormat::Writer< G >
Typically you would construct this class with one of the predefined file format instances. For example, with the .vtu file format:
- Note
- The constructor checks that the grid you are passing in is actually an lvalue-reference. If not, compilation will fail. This is because all writers take the grid per reference and their lifetime is bound to the lifetime of the given grid.
- Template Parameters
-
Grid | The type of grid which should be written out. |
|
template<typename FileFormat , WriterDetail::Compatible< Grid > _Grid>
requires (WriterDetail::has_sequential_factory<FileFormat, Grid>) |
| Writer (const FileFormat &f, _Grid &&grid) |
| Construct a sequential grid file writer.
|
|
template<typename FileFormat , WriterDetail::Compatible< Grid > _Grid>
requires (WriterDetail::has_sequential_time_series_factory<FileFormat, Grid>) |
| Writer (const FileFormat &f, _Grid &&grid, const std::string &base_filename) |
| Construct a sequential time series writer.
|
|
template<typename FileFormat , WriterDetail::Compatible< Grid > _Grid, Concepts::Communicator Comm>
requires (WriterDetail::has_parallel_factory<FileFormat, Grid, Comm>) |
| Writer (const FileFormat &f, _Grid &&grid, const Comm &comm) |
| Construct a parallel grid file writer.
|
|
template<typename FileFormat , WriterDetail::Compatible< Grid > _Grid, Concepts::Communicator Comm>
requires (WriterDetail::has_parallel_time_series_factory<FileFormat, Grid, Comm>) |
| Writer (const FileFormat &f, _Grid &&grid, const Comm &comm, const std::string &base_filename) |
| Construct a parallel time series file writer.
|
|
template<std::derived_from< GridWriter< Grid > > W>
requires (!std::is_lvalue_reference_v<W>) |
| Writer (W &&writer) |
| Construct a grid file writer from a writer implementation.
|
|
template<std::derived_from< TimeSeriesGridWriter< Grid > > W>
requires (!std::is_lvalue_reference_v<W>) |
| Writer (W &&writer) |
| Construct a time series file writer from a writer implementation.
|
|
std::string | write (const std::string &filename) const |
| Write the grid and data to a file.
|
|
template<Concepts::Scalar T> |
std::string | write (const T &time_value) const |
| Write a time step in a time series.
|
|
template<typename Field > |
void | set_meta_data (const std::string &name, Field &&field) |
| Set a meta data field to be added to the output.
|
|
template<typename Field > |
void | set_point_field (const std::string &name, Field &&field) |
| Set a point data field to be added to the output.
|
|
template<typename Field , typename T > |
void | set_point_field (const std::string &name, Field &&field, const Precision< T > &prec) |
| Overload with custom precision with which to write the field.
|
|
template<typename Field > |
void | set_cell_field (const std::string &name, Field &&field) |
| Set a cell data field to be added to the output.
|
|
template<typename Field , typename T > |
void | set_cell_field (const std::string &name, Field &&field, const Precision< T > &prec) |
| Overload with custom precision with which to write the field.
|
|
FieldPtr | remove_meta_data (const std::string &name) |
| Remove a meta data field from the output.
|
|
FieldPtr | remove_point_field (const std::string &name) |
| Remove a point field from the output.
|
|
FieldPtr | remove_cell_field (const std::string &name) |
| Remove a cell field from the output.
|
|
void | clear () |
| Remove all data inserted to the writer.
|
|
void | set_ignore_warnings (bool value) |
| Ignore/consider warnings (default: true)
|
|
template<typename Writer > |
void | copy_fields (Writer &out) const |
| Copy all inserted fields into another writer.
|
|
const std::optional< WriterOptions > & | writer_options () const |
| Return the basic options used by this writer.
|
|
const Grid & | grid () const |
| Return a reference to the underlying grid.
|
|