NGen
Loading...
Searching...
No Matches
realization::config Namespace Reference

Classes

struct  Config
 Structure representing the configuration for a general Formulation. More...
 
struct  Forcing
 Structure for holding forcing configuration information. More...
 
struct  Formulation
 
struct  Layer
 Layer configuration information. More...
 
struct  Output
 Parsed representation of a realization config's output settings. More...
 
struct  OutputDomain
 Settings for one output domain (catchment or nexus). More...
 
struct  Routing
 
struct  Time
 Simple structure for holding time bounds and output interval (seconds) More...
 

Enumerations

enum class  OutputFormat {
  csv ,
  netcdf
}
 Serialization format for an output domain. More...
 
enum class  OutputGrouping {
  per_feature ,
  per_formulation
}
 How a domain's records are distributed across files (the file-*granularity* axis): per_feature - one file per feature (one CSV per catchment / per nexus) per_formulation - the features of a formulation aggregate into one file (a feature-id column distinguishes their rows). More...
 

Functions

std::shared_ptr< utils::CatchmentOutputsMgrmake_catchment_output_mgr (const Output &output_config, std::vector< utils::FeatureDescriptor > descriptors, const std::string &aggregated_filename=DEFAULT_AGGREGATED_FILENAME)
 Build the catchment output manager from the parsed output configuration.
 
OutputFormat parse_output_format (const std::string &s)
 
OutputGrouping parse_output_grouping (const std::string &s)
 
std::string rank_output_root (const std::string &base_root, const OutputDomain &domain, int mpi_rank, int mpi_num_procs)
 The output root for a rank's files in this domain: appends "rank_<N>/" to base_root when the domain requests per-rank subdirectories, or when it aggregates per formulation (which requires per-rank separation so ranks don't write the same file).
 

Variables

static const std::string DEFAULT_AGGREGATED_FILENAME = "cat_output.csv"
 Default file name for an aggregated (per_formulation) catchment file.
 
static const std::string OUTPUT_CONFIG_KEY = "output"
 Key for the dedicated output configuration block in a realization config.
 
static const std::string LEGACY_OUTPUT_ROOT_KEY = "output_root"
 Deprecated top-level keys this block replaces.
 
static const std::string LEGACY_DISABLE_CATCHMENT_KEY = "disable_catchment_output"
 
static const std::string LEGACY_PER_FORMULATION_KEY = "per_formulation_nexus_files"
 
static const std::string ROUTING_CONFIG_KEY = "t_route_config_file_with_path"
 

Enumeration Type Documentation

◆ OutputFormat

Serialization format for an output domain.

Enumerator
csv 
netcdf 

◆ OutputGrouping

How a domain's records are distributed across files (the file-*granularity* axis): per_feature - one file per feature (one CSV per catchment / per nexus) per_formulation - the features of a formulation aggregate into one file (a feature-id column distinguishes their rows).

Fewer, larger files; columns are uniform within a file by construction. Orthogonal to this is OutputDomain::rank_subdir, the filesystem-*layout* axis.

Enumerator
per_feature 
per_formulation 

Function Documentation

◆ make_catchment_output_mgr()

std::shared_ptr< utils::CatchmentOutputsMgr > realization::config::make_catchment_output_mgr ( const Output & output_config,
std::vector< utils::FeatureDescriptor > descriptors,
const std::string & aggregated_filename = DEFAULT_AGGREGATED_FILENAME )
inline

Build the catchment output manager from the parsed output configuration.

Grouping and precision come from output_config; the resolved root comes from output_config.root, which the caller is expected to have already adjusted for rank layout (see rank_output_root) so any rank_<N>/ subdirectory is baked into the root.

The manager is constructed with the full set of descriptors (every catchment and its columns), so the backend lays out its files up front and is ready to receive data on return.

Side effect: constructing the manager creates the output directory tree it writes into (config parsing only normalizes the root – it does not touch the filesystem). Each output manager owns creating what it writes, so no caller need pre-create the directory.

Only the CSV format is implemented today; any other configured format is rejected here (the branch on output_config.catchment.format is where an added format would slot in). Layout follows the grouping: per_formulation aggregates each formulation's catchments into one file (leading catchment_id column) named aggregated_filename; per_feature writes one file per catchment.

Exceptions
std::runtime_errorif a catchment output format other than CSV is configured.

References realization::config::Output::catchment, csv, realization::config::OutputDomain::format, realization::config::OutputDomain::grouping, per_formulation, realization::config::Output::precision, and realization::config::Output::root.

◆ parse_output_format()

OutputFormat realization::config::parse_output_format ( const std::string & s)
inline

◆ parse_output_grouping()

OutputGrouping realization::config::parse_output_grouping ( const std::string & s)
inline

◆ rank_output_root()

std::string realization::config::rank_output_root ( const std::string & base_root,
const OutputDomain & domain,
int mpi_rank,
int mpi_num_procs )
inline

The output root for a rank's files in this domain: appends "rank_<N>/" to base_root when the domain requests per-rank subdirectories, or when it aggregates per formulation (which requires per-rank separation so ranks don't write the same file).

Only distributed (mpi_num_procs > 1) runs are affected; in serial base_root is returned unchanged. The directory is created lazily by the backend when it opens files.

References realization::config::OutputDomain::grouping, per_formulation, and realization::config::OutputDomain::rank_subdir.

Variable Documentation

◆ DEFAULT_AGGREGATED_FILENAME

const std::string realization::config::DEFAULT_AGGREGATED_FILENAME = "cat_output.csv"
static

Default file name for an aggregated (per_formulation) catchment file.

The rank, when applicable, is carried in the resolved root (a rank_<N>/ subdirectory), not the file name.

◆ LEGACY_DISABLE_CATCHMENT_KEY

const std::string realization::config::LEGACY_DISABLE_CATCHMENT_KEY = "disable_catchment_output"
static

◆ LEGACY_OUTPUT_ROOT_KEY

const std::string realization::config::LEGACY_OUTPUT_ROOT_KEY = "output_root"
static

Deprecated top-level keys this block replaces.

Referenced by realization::config::Output::parse_legacy().

◆ LEGACY_PER_FORMULATION_KEY

const std::string realization::config::LEGACY_PER_FORMULATION_KEY = "per_formulation_nexus_files"
static

◆ OUTPUT_CONFIG_KEY

const std::string realization::config::OUTPUT_CONFIG_KEY = "output"
static

Key for the dedicated output configuration block in a realization config.

Referenced by realization::config::Output::from_realization().

◆ ROUTING_CONFIG_KEY

const std::string realization::config::ROUTING_CONFIG_KEY = "t_route_config_file_with_path"
static