Skip to content

Class emulator::EmulatorOutputStream

ClassList > emulator > EmulatorOutputStream

Manages a single diagnostic output stream. More...

  • #include <emulator_output_stream.hpp>

Public Functions

Type Name
EmulatorOutputStream () = default
const OutputStreamConfig & config () const
Get the stream configuration.
void finalize ()
Finalize and close any open files.
void init_timestep (int current_step, double dt)
Called at the start of each timestep.
void initialize (const OutputStreamConfig & config, MPI_Comm comm, const std::vector< int > & col_gids, int nlat, int nlon, Logger & logger)
Initialize the output stream.
bool is_write_step () const
Check if this step is a write step.
bool needs_history_restart () const
Check if stream needs history restart (non-instant averaging).
bool read_history_restart (const std::string & filename)
Read averaging state from history restart file.
void run (int current_step, const FieldDataProvider & fields, const std::string & case_name)
Process fields at current timestep.
bool write_history_restart (const std::string & filename)
Write averaging state to history restart file.
~EmulatorOutputStream () = default

Detailed Description

Handles:

  • NetCDF file creation and management
  • Accumulation buffer for averaging (AVERAGE, MIN, MAX, STD, SUM)
  • Write timing based on configured frequency
  • Field stacking for sliced variables

Public Functions Documentation

function EmulatorOutputStream

emulator::EmulatorOutputStream::EmulatorOutputStream () = default

function config

Get the stream configuration.

inline const OutputStreamConfig & emulator::EmulatorOutputStream::config () const


function finalize

Finalize and close any open files.

void emulator::EmulatorOutputStream::finalize () 


function init_timestep

Called at the start of each timestep.

void emulator::EmulatorOutputStream::init_timestep (
    int current_step,
    double dt
) 

Parameters:

  • current_step Current model step number
  • dt Timestep in seconds

function initialize

Initialize the output stream.

void emulator::EmulatorOutputStream::initialize (
    const OutputStreamConfig & config,
    MPI_Comm comm,
    const std::vector< int > & col_gids,
    int nlat,
    int nlon,
    Logger & logger
) 

Parameters:

  • config Stream configuration
  • comm MPI communicator
  • col_gids Global IDs of local columns
  • nlat Number of latitudes (for global grid)
  • nlon Number of longitudes
  • logger Logger reference

function is_write_step

Check if this step is a write step.

inline bool emulator::EmulatorOutputStream::is_write_step () const


function needs_history_restart

Check if stream needs history restart (non-instant averaging).

inline bool emulator::EmulatorOutputStream::needs_history_restart () const


function read_history_restart

Read averaging state from history restart file.

bool emulator::EmulatorOutputStream::read_history_restart (
    const std::string & filename
) 

Parameters:

  • filename Input filename

Returns:

true if successful


function run

Process fields at current timestep.

void emulator::EmulatorOutputStream::run (
    int current_step,
    const FieldDataProvider & fields,
    const std::string & case_name
) 

Updates averaging buffers if not an instant stream. Writes output if this is a write step.

Parameters:

  • current_step Current step number
  • fields Field data provider
  • case_name Case name for filename generation

function write_history_restart

Write averaging state to history restart file.

bool emulator::EmulatorOutputStream::write_history_restart (
    const std::string & filename
) 

Parameters:

  • filename Output filename

Returns:

true if successful


function ~EmulatorOutputStream

emulator::EmulatorOutputStream::~EmulatorOutputStream () = default


The documentation for this class was generated from the following file components/emulator_comps/common/src/emulator_output_stream.hpp