Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
DataWriter Class Reference

Writes snapshots either every interval steps or every time_interval units of simulation time. Time-based writers also constrain the time step so that snapshots land exactly on output times. More...

#include <data_writer.h>

Classes

struct  Field
 An output array: one scalar, or the N_DIM components of a vector (written as 3 components, zero-padded in 2D). More...
 

Public Member Functions

void init (const toml::value &input, std::vector< Data > &data, std::shared_ptr< Mesh > mesh, const std::vector< std::string > &restart_variables={})
 Set up from a [[write_data]] entry.
 
bool due (uint64_t step, rtype t) const
 Whether a snapshot is due at this step/time.
 
void write (uint64_t step, rtype t, bool force=false, const RestartAttributes &attributes={}, const RestartFaces &faces={})
 Write a snapshot if due (or forced); restart files also store the attributes and the faces (of the owned cells; collective).
 
rtype next_time () const
 Next simulation time at which a snapshot is due (infinity for step-based writers).
 
void resume (uint64_t step, rtype t)
 Continue numbering and the .pvd (.xmf) series of a previous run that stopped at (step, t), whose snapshot at t was already written.
 
std::pair< std::string, std::string > summary () const
 Format and the output key-value line for the run log.
 
DataFormat get_format () const
 
const std::string & get_prefix () const
 
uint64_t files_written () const
 

Protected Member Functions

void write_vtu (const std::string &filename, rtype t) const
 
void write_vtu_faces (const std::string &filename, rtype t) const
 
void write_restart (const std::string &filename, uint64_t step, rtype t, const RestartAttributes &attributes, const RestartFaces &faces) const
 
void write_pvd () const
 
void write_hdf5_mesh ()
 HDF5 output: the mesh once (<prefix>_mesh.h5), then per snapshot a file of cell fields, every array in global-id order, and the XDMF indexes that let ParaView read them.
 
void write_hdf5 (const std::string &stem, uint64_t step, rtype t) const
 
void write_xdmf (const std::string &stem) const
 
std::string xdmf_grid (const std::string &stem, double t, const std::string &indent) const
 
void resume_xdmf (rtype t)
 
void write_pvtu (const std::string &filename, const std::string &stem) const
 
void write_restart_distributed (const std::string &filename, uint64_t step, rtype t, const RestartAttributes &attributes, const RestartFaces &faces) const
 

Protected Attributes

std::string prefix
 
uint64_t interval = 0
 
rtype time_interval = 0.0
 
uint64_t n_written = 0
 
rtype t_last = -std::numeric_limits<rtype>::infinity()
 
uint64_t step_last = std::numeric_limits<uint64_t>::max()
 
DataFormat format
 
std::vector< Field > fields
 
std::shared_ptr< Mesh > mesh
 
std::vector< std::pair< rtype, std::string > > history
 
bool surface = false
 
std::string geometry = "all"
 
uint64_t n_files = 0
 
std::vector< uint32_t > geometry_faces
 
GlobalOrder cell_order
 
bool hdf5_mesh_written = false
 
uint64_t hdf5_n_nodes = 0
 
uint64_t hdf5_topology_size = 0
 

Detailed Description

Writes snapshots either every interval steps or every time_interval units of simulation time. Time-based writers also constrain the time step so that snapshots land exactly on output times.

Member Function Documentation

◆ due()

bool DataWriter::due ( uint64_t  step,
rtype  t 
) const

Whether a snapshot is due at this step/time.

◆ files_written()

uint64_t DataWriter::files_written ( ) const
inline

◆ get_format()

DataFormat DataWriter::get_format ( ) const
inline

◆ get_prefix()

const std::string & DataWriter::get_prefix ( ) const
inline

◆ init()

void DataWriter::init ( const toml::value &  input,
std::vector< Data > &  data,
std::shared_ptr< Mesh >  mesh,
const std::vector< std::string > &  restart_variables = {} 
)

Set up from a [[write_data]] entry.

Parameters
restart_variablesVariables of a restart file, in order (default: CONSERVATIVE_NAMES); ignored for other formats.

◆ next_time()

rtype DataWriter::next_time ( ) const

Next simulation time at which a snapshot is due (infinity for step-based writers).

◆ resume()

void DataWriter::resume ( uint64_t  step,
rtype  t 
)

Continue numbering and the .pvd (.xmf) series of a previous run that stopped at (step, t), whose snapshot at t was already written.

◆ resume_xdmf()

void DataWriter::resume_xdmf ( rtype  t)
protected

◆ summary()

std::pair< std::string, std::string > DataWriter::summary ( ) const

Format and the output key-value line for the run log.

◆ write()

void DataWriter::write ( uint64_t  step,
rtype  t,
bool  force = false,
const RestartAttributes &  attributes = {},
const RestartFaces &  faces = {} 
)

Write a snapshot if due (or forced); restart files also store the attributes and the faces (of the owned cells; collective).

◆ write_hdf5()

void DataWriter::write_hdf5 ( const std::string &  stem,
uint64_t  step,
rtype  t 
) const
protected

◆ write_hdf5_mesh()

void DataWriter::write_hdf5_mesh ( )
protected

HDF5 output: the mesh once (<prefix>_mesh.h5), then per snapshot a file of cell fields, every array in global-id order, and the XDMF indexes that let ParaView read them.

◆ write_pvd()

void DataWriter::write_pvd ( ) const
protected

◆ write_pvtu()

void DataWriter::write_pvtu ( const std::string &  filename,
const std::string &  stem 
) const
protected

◆ write_restart()

void DataWriter::write_restart ( const std::string &  filename,
uint64_t  step,
rtype  t,
const RestartAttributes &  attributes,
const RestartFaces &  faces 
) const
protected

◆ write_restart_distributed()

void DataWriter::write_restart_distributed ( const std::string &  filename,
uint64_t  step,
rtype  t,
const RestartAttributes &  attributes,
const RestartFaces &  faces 
) const
protected

◆ write_vtu()

void DataWriter::write_vtu ( const std::string &  filename,
rtype  t 
) const
protected

◆ write_vtu_faces()

void DataWriter::write_vtu_faces ( const std::string &  filename,
rtype  t 
) const
protected

◆ write_xdmf()

void DataWriter::write_xdmf ( const std::string &  stem) const
protected

◆ xdmf_grid()

std::string DataWriter::xdmf_grid ( const std::string &  stem,
double  t,
const std::string &  indent 
) const
protected

Member Data Documentation

◆ cell_order

GlobalOrder DataWriter::cell_order
protected

◆ fields

std::vector<Field> DataWriter::fields
protected

◆ format

DataFormat DataWriter::format
protected

◆ geometry

std::string DataWriter::geometry = "all"
protected

◆ geometry_faces

std::vector<uint32_t> DataWriter::geometry_faces
protected

◆ hdf5_mesh_written

bool DataWriter::hdf5_mesh_written = false
protected

◆ hdf5_n_nodes

uint64_t DataWriter::hdf5_n_nodes = 0
protected

◆ hdf5_topology_size

uint64_t DataWriter::hdf5_topology_size = 0
protected

◆ history

std::vector<std::pair<rtype, std::string> > DataWriter::history
protected

◆ interval

uint64_t DataWriter::interval = 0
protected

◆ mesh

std::shared_ptr<Mesh> DataWriter::mesh
protected

◆ n_files

uint64_t DataWriter::n_files = 0
protected

◆ n_written

uint64_t DataWriter::n_written = 0
protected

◆ prefix

std::string DataWriter::prefix
protected

◆ step_last

uint64_t DataWriter::step_last = std::numeric_limits<uint64_t>::max()
protected

◆ surface

bool DataWriter::surface = false
protected

◆ t_last

rtype DataWriter::t_last = -std::numeric_limits<rtype>::infinity()
protected

◆ time_interval

rtype DataWriter::time_interval = 0.0
protected

The documentation for this class was generated from the following files: