NGen
Loading...
Searching...
No Matches
catchment_output.hpp
1#ifndef NGEN_REALIZATION_CONFIG_CATCHMENT_OUTPUT_HPP
2#define NGEN_REALIZATION_CONFIG_CATCHMENT_OUTPUT_HPP
3
4#include <memory>
5#include <optional>
6#include <stdexcept>
7#include <string>
8#include <utility>
9#include <vector>
10
11#include "realizations/config/output.hpp"
12#include "utilities/output/CatchmentOutputsMgr.hpp"
13#include "utilities/output/CatchmentCsvOutputMgr.hpp"
14
15namespace realization
16{
17 namespace config
18 {
21 static const std::string DEFAULT_AGGREGATED_FILENAME = "cat_output.csv";
22
44 inline std::shared_ptr<utils::CatchmentOutputsMgr> make_catchment_output_mgr(
45 const Output& output_config,
46 std::vector<utils::FeatureDescriptor> descriptors,
47 const std::string& aggregated_filename = DEFAULT_AGGREGATED_FILENAME)
48 {
49 if (output_config.catchment.format == OutputFormat::csv) {
50 const bool aggregate = output_config.catchment.grouping == OutputGrouping::per_formulation;
51 return std::make_shared<utils::CatchmentCsvOutputMgr>(
52 output_config.root,
53 aggregate ? std::optional<std::string>(aggregated_filename) : std::nullopt,
54 output_config.precision, std::move(descriptors));
55 } else {
56 throw std::runtime_error("Catchment output: only the CSV format is currently supported.");
57 }
58 }
59 } // namespace config
60} // namespace realization
61
62#endif // NGEN_REALIZATION_CONFIG_CATCHMENT_OUTPUT_HPP
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.
Definition catchment_output.hpp:44
static const std::string DEFAULT_AGGREGATED_FILENAME
Default file name for an aggregated (per_formulation) catchment file.
Definition catchment_output.hpp:21
Definition HY_Features.hpp:13
OutputGrouping grouping
Definition output.hpp:50
OutputFormat format
Definition output.hpp:49
Parsed representation of a realization config's output settings.
Definition output.hpp:102
std::string root
Output directory.
Definition output.hpp:111
OutputDomain catchment
Definition output.hpp:112
int precision
Global value precision for text output backends.
Definition output.hpp:115