|
NGen
|
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 | GlobalConfigKey { SERIALIZATION } |
| Identifier for a realization-level configuration block that can be inherited down into each formulation's params. More... | |
| 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::CatchmentOutputsMgr > | make_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. | |
| const char * | to_key_string (GlobalConfigKey which) |
| Top-level JSON key string for a given GlobalConfigKey. | |
| void | apply_config (geojson::PropertyMap &child, const geojson::PropertyMap &parent, GlobalConfigKey which) |
Copy a named config block from parent into child, unless the child already declares its own entry for the same key. | |
| 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). | |
| void | apply_serialization_path_token_resolution (boost::property_tree::ptree &block) |
Resolve {{rank}}/{{pid}}/{{host}}/{{date}} tokens in every path field the serialization block may carry. | |
| void | apply_serialization_restore_subset_default (geojson::PropertyMap &global_configs, const std::vector< std::string > &known_ids) |
Auto-populate serialization.restore.id_subset with the set of catchment identifiers that this realization will actually instantiate, when the user hasn't supplied one. | |
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" |
|
strong |
Identifier for a realization-level configuration block that can be inherited down into each formulation's params.
The inheritance convention is: if a realization-level JSON document carries a block under the key identified by this enum, every formulation built by Formulation_Manager receives that block in its params unless the per-formulation config already declares it. Within a multi-BMI formulation, the block is further propagated into each submodule's params on the same "child wins" basis.
Adding a new realization-level inheritable block is a two-step: 1) add an enum entry here; 2) add a matching case in to_key_string() below. The rest of the plumbing (parsing, injection, submodule propagation) is already wired to iterate enum values.
| Enumerator | |
|---|---|
| SERIALIZATION | The |
|
strong |
|
strong |
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 | |
|
inline |
Copy a named config block from parent into child, unless the child already declares its own entry for the same key.
Per-child entries always win; the parent value is a default, not an override. This is the single mechanism for realization-level config inheritance — Formulation_Manager calls it to seed every formulation from parsed top-level blocks, and Bmi_Multi_Formulation calls it during submodule setup to carry the same defaults further down the tree.
No-op if the parent has no entry under which.
References to_key_string().
Referenced by realization::Formulation_Manager::construct_formulation_from_config(), realization::Formulation_Manager::construct_missing_formulation(), and realization::Bmi_Multi_Formulation::create_multi_formulation().
|
inline |
Resolve {{rank}}/{{pid}}/{{host}}/{{date}} tokens in every path field the serialization block may carry.
The serialization block accepts a shared top-level path plus two per-direction overrides — save.path and restore.path. Each may be absent; when present, its value goes through utilities::resolve_path_tokens so consumers see concrete strings.
Absent keys are skipped; ptree's dotted-path put() would otherwise fabricate the intermediate sub-block.
| block | The raw serialization sub-tree (mutated in place). |
References utilities::resolve_path_tokens().
Referenced by realization::Formulation_Manager::read().
|
inline |
Auto-populate serialization.restore.id_subset with the set of catchment identifiers that this realization will actually instantiate, when the user hasn't supplied one.
id_subset is a scoping knob that bounds which records are requested from the serialization backend. This function applies a default policy for creating the subset based on the realization's enumerated features when they are specified.
No-op if any of the following hold (deliberately conservative):
serialization block is present in global_configs;restore sub-block;restore sub-block already declares id_subset — the caller's explicit value always wins, same as the rest of the inheritance system;known_ids is empty (passing an empty list could be read as "restore nothing", which is the wrong default).| global_configs | The realization-level inheritable configs map (mutated in place). |
| known_ids | Catchment ids the caller intends to construct. |
References geojson::Object, SERIALIZATION, and to_key_string().
Referenced by realization::Formulation_Manager::read().
|
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.
| std::runtime_error | if 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.
|
inline |
Referenced by realization::config::OutputDomain::OutputDomain().
|
inline |
References per_feature, and per_formulation.
Referenced by realization::config::OutputDomain::OutputDomain().
|
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.
|
inline |
Top-level JSON key string for a given GlobalConfigKey.
References SERIALIZATION.
Referenced by apply_config(), apply_serialization_restore_subset_default(), and realization::Formulation_Manager::read().
|
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.
|
static |
Referenced by realization::config::Output::parse_legacy().
|
static |
Deprecated top-level keys this block replaces.
Referenced by realization::config::Output::parse_legacy().
|
static |
Referenced by realization::config::Output::parse_legacy().
|
static |
Key for the dedicated output configuration block in a realization config.
Referenced by realization::config::Output::from_realization().
|
static |
Referenced by realization::config::Routing::Routing().