diff --git a/_2github_2workspace_2include_2utilities_2mdarray_2mdarray_8hpp-example.html b/_2github_2workspace_2include_2utilities_2mdarray_2mdarray_8hpp-example.html index 7dbee7a595..5a439bcc59 100644 --- a/_2github_2workspace_2include_2utilities_2mdarray_2mdarray_8hpp-example.html +++ b/_2github_2workspace_2include_2utilities_2mdarray_2mdarray_8hpp-example.html @@ -294,7 +294,7 @@ diff --git a/_abstract_c_lib_bmi_adapter_8hpp_source.html b/_abstract_c_lib_bmi_adapter_8hpp_source.html index 09de600227..8c28542067 100644 --- a/_abstract_c_lib_bmi_adapter_8hpp_source.html +++ b/_abstract_c_lib_bmi_adapter_8hpp_source.html @@ -278,7 +278,7 @@ diff --git a/_aorc_forcing_8hpp_source.html b/_aorc_forcing_8hpp_source.html index f24dcb39fd..49564f86cb 100644 --- a/_aorc_forcing_8hpp_source.html +++ b/_aorc_forcing_8hpp_source.html @@ -213,7 +213,7 @@ diff --git a/_async_data_provider_8hpp_source.html b/_async_data_provider_8hpp_source.html index 5095bcdcab..da8db257e2 100644 --- a/_async_data_provider_8hpp_source.html +++ b/_async_data_provider_8hpp_source.html @@ -113,17 +113,17 @@
data_access::AsyncDataProvider
Definition: AsyncDataProvider.hpp:9
data_access::AsyncDataProvider::value_ready
virtual bool value_ready(selection_type selector, const std::string &variable_name, const time_t &init_time, const long &duration_s, const std::string &output_units, ReSampleMethod m=SUM)=0
data_access::AsyncDataProvider::request_value
virtual void request_value(selection_type selector, const std::string &variable_name, const time_t &init_time, const long &duration_s, const std::string &output_units, ReSampleMethod m=SUM)=0
-
data_access::DataProvider
Definition: DataProvider.hpp:24
+
data_access::DataProvider
Definition: DataProvider.hpp:25
data_access
Definition: AorcForcing.hpp:75
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
-
data_access::SUM
@ SUM
Definition: DataProvider.hpp:18
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
+
data_access::SUM
@ SUM
Definition: DataProvider.hpp:19
diff --git a/_bmi___adapter_8hpp_source.html b/_bmi___adapter_8hpp_source.html index 4fd2cf558a..7797ad3bde 100644 --- a/_bmi___adapter_8hpp_source.html +++ b/_bmi___adapter_8hpp_source.html @@ -308,7 +308,7 @@ diff --git a/_bmi___c___adapter_8hpp_source.html b/_bmi___c___adapter_8hpp_source.html index 01af888745..ad2e9ef2b7 100644 --- a/_bmi___c___adapter_8hpp_source.html +++ b/_bmi___c___adapter_8hpp_source.html @@ -483,7 +483,7 @@ diff --git a/_bmi___c___formulation_8hpp_source.html b/_bmi___c___formulation_8hpp_source.html index 7eedd4a2f7..54320264f6 100644 --- a/_bmi___c___formulation_8hpp_source.html +++ b/_bmi___c___formulation_8hpp_source.html @@ -172,7 +172,7 @@
realization::Bmi_C_Formulation::is_model_initialized
bool is_model_initialized() override
Test whether backing model has run BMI Initialize.
Definition: Bmi_C_Formulation.cpp:196
realization::Bmi_C_Formulation::is_bmi_output_variable
bool is_bmi_output_variable(const std::string &var_name) override
Definition: Bmi_C_Formulation.cpp:191
realization::Bmi_Module_Formulation
Abstraction of a formulation with a single backing model object that implements the BMI.
Definition: Bmi_Module_Formulation.hpp:34
-
realization::Bmi_Module_Formulation< models::bmi::Bmi_C_Adapter >::get_bmi_model
std::shared_ptr< models::bmi::Bmi_C_Adapter > get_bmi_model()
Get the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:461
+
realization::Bmi_Module_Formulation< models::bmi::Bmi_C_Adapter >::get_bmi_model
std::shared_ptr< models::bmi::Bmi_C_Adapter > get_bmi_model()
Get the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:454
realization::Bmi_Multi_Formulation
Abstraction of a formulation with multiple backing model object that implements the BMI.
Definition: Bmi_Multi_Formulation.hpp:24
utils::StreamHandler
This class provides a copyable interface to a std::ostream or std::ostream like object that may not s...
Definition: StreamHandler.hpp:14
geojson::PropertyMap
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition: JSONProperty.hpp:21
@@ -183,7 +183,7 @@ diff --git a/_bmi___cpp___adapter_8hpp_source.html b/_bmi___cpp___adapter_8hpp_source.html index 3f429c0e32..594f41880e 100644 --- a/_bmi___cpp___adapter_8hpp_source.html +++ b/_bmi___cpp___adapter_8hpp_source.html @@ -452,7 +452,7 @@ diff --git a/_bmi___cpp___formulation_8hpp_source.html b/_bmi___cpp___formulation_8hpp_source.html index 24471b3aad..3917a7da8f 100644 --- a/_bmi___cpp___formulation_8hpp_source.html +++ b/_bmi___cpp___formulation_8hpp_source.html @@ -169,7 +169,7 @@
realization::Bmi_Cpp_Formulation::get_output_header_line
std::string get_output_header_line(std::string delimiter) override
Get a header line appropriate for a file made up of entries from this type's implementation of get_ou...
Definition: Bmi_Cpp_Formulation.cpp:49
realization::Bmi_Cpp_Formulation::is_model_initialized
bool is_model_initialized() override
Test whether the backing model has been initialize using the BMI standard Initialize function.
Definition: Bmi_Cpp_Formulation.cpp:195
realization::Bmi_Module_Formulation
Abstraction of a formulation with a single backing model object that implements the BMI.
Definition: Bmi_Module_Formulation.hpp:34
-
realization::Bmi_Module_Formulation< models::bmi::Bmi_Cpp_Adapter >::get_bmi_model
std::shared_ptr< models::bmi::Bmi_Cpp_Adapter > get_bmi_model()
Get the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:461
+
realization::Bmi_Module_Formulation< models::bmi::Bmi_Cpp_Adapter >::get_bmi_model
std::shared_ptr< models::bmi::Bmi_Cpp_Adapter > get_bmi_model()
Get the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:454
realization::Bmi_Multi_Formulation
Abstraction of a formulation with multiple backing model object that implements the BMI.
Definition: Bmi_Multi_Formulation.hpp:24
utils::StreamHandler
This class provides a copyable interface to a std::ostream or std::ostream like object that may not s...
Definition: StreamHandler.hpp:14
geojson::PropertyMap
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition: JSONProperty.hpp:21
@@ -180,7 +180,7 @@ diff --git a/_bmi___formulation_8hpp_source.html b/_bmi___formulation_8hpp_source.html index 760d6d6d81..8202c4355f 100644 --- a/_bmi___formulation_8hpp_source.html +++ b/_bmi___formulation_8hpp_source.html @@ -315,7 +315,7 @@ diff --git a/_bmi___fortran___adapter_8hpp_source.html b/_bmi___fortran___adapter_8hpp_source.html index d3e9caa2b5..2368909b21 100644 --- a/_bmi___fortran___adapter_8hpp_source.html +++ b/_bmi___fortran___adapter_8hpp_source.html @@ -540,7 +540,7 @@ diff --git a/_bmi___fortran___common_8h_source.html b/_bmi___fortran___common_8h_source.html index ced2f2a58a..7e74090b4d 100644 --- a/_bmi___fortran___common_8h_source.html +++ b/_bmi___fortran___common_8h_source.html @@ -219,7 +219,7 @@ diff --git a/_bmi___fortran___formulation_8hpp_source.html b/_bmi___fortran___formulation_8hpp_source.html index 3d6502c036..aa3b36934b 100644 --- a/_bmi___fortran___formulation_8hpp_source.html +++ b/_bmi___fortran___formulation_8hpp_source.html @@ -160,7 +160,7 @@ diff --git a/_bmi___module___formulation_8hpp_source.html b/_bmi___module___formulation_8hpp_source.html index 6ea2edf84b..64627c4d9e 100644 --- a/_bmi___module___formulation_8hpp_source.html +++ b/_bmi___module___formulation_8hpp_source.html @@ -138,744 +138,737 @@
57 inner_create_formulation(properties, true);
58 }
59
-
73 //const vector<std::string> &get_available_forcing_outputs() {
-
74 const std::vector<std::string> &get_available_variable_names() override {
-
75 if (is_model_initialized() && available_forcings.empty()) {
-
76 for (const std::string &output_var_name : get_bmi_model()->GetOutputVarNames()) {
-
77 available_forcings.push_back(output_var_name);
-
78 if (bmi_var_names_map.find(output_var_name) != bmi_var_names_map.end())
-
79 available_forcings.push_back(bmi_var_names_map[output_var_name]);
-
80 }
-
81 }
-
82 return available_forcings;
-
83 }
-
84
-
85 //inline const vector<std::string> &get_available_variable_names() override {
-
86 // return get_available_forcing_outputs();
-
87 //}
-
88
-
98 time_t get_variable_time_begin(const std::string &variable_name) {
-
99 // TODO: come back and implement if actually necessary for this type; for now don't use
-
100 throw std::runtime_error("Bmi_Modular_Formulation does not yet implement get_variable_time_begin");
-
101 }
-
102
-
112 long get_data_start_time() override
-
113 {
-
114 return this->get_bmi_model()->GetStartTime();
-
115 }
-
116
-
126 //time_t get_forcing_output_time_end(const std::string &output_name) {
-
127 time_t get_variable_time_end(const std::string &varibale_name) {
+
73 boost::span<const std::string> get_available_variable_names() override {
+
74 if (is_model_initialized() && available_forcings.empty()) {
+
75 for (const std::string &output_var_name : get_bmi_model()->GetOutputVarNames()) {
+
76 available_forcings.push_back(output_var_name);
+
77 if (bmi_var_names_map.find(output_var_name) != bmi_var_names_map.end())
+
78 available_forcings.push_back(bmi_var_names_map[output_var_name]);
+
79 }
+
80 }
+
81 return available_forcings;
+
82 }
+
83
+
93 time_t get_variable_time_begin(const std::string &variable_name) {
+
94 // TODO: come back and implement if actually necessary for this type; for now don't use
+
95 throw std::runtime_error("Bmi_Modular_Formulation does not yet implement get_variable_time_begin");
+
96 }
+
97
+
107 long get_data_start_time() override
+
108 {
+
109 return this->get_bmi_model()->GetStartTime();
+
110 }
+
111
+
121 //time_t get_forcing_output_time_end(const std::string &output_name) {
+
122 time_t get_variable_time_end(const std::string &varibale_name) {
+
123 // TODO: come back and implement if actually necessary for this type; for now don't use
+
124 throw std::runtime_error("Bmi_Module_Formulation does not yet implement get_variable_time_end");
+
125 }
+
126
+
127 long get_data_stop_time() override {
128 // TODO: come back and implement if actually necessary for this type; for now don't use
-
129 throw std::runtime_error("Bmi_Module_Formulation does not yet implement get_variable_time_end");
+
129 throw std::runtime_error("Bmi_Module_Formulation does not yet implement get_data_stop_time");
130 }
131
-
132 long get_data_stop_time() override {
-
133 // TODO: come back and implement if actually necessary for this type; for now don't use
-
134 throw std::runtime_error("Bmi_Module_Formulation does not yet implement get_data_stop_time");
-
135 }
-
136
-
137 long record_duration() override {
-
138 throw std::runtime_error("Bmi_Module_Formulation does not yet implement record_duration");
-
139 }
-
140
-
146 const double get_model_current_time() override {
-
147 return get_bmi_model()->GetCurrentTime();
-
148 }
-
149
-
155 const double get_model_end_time() override {
-
156 return get_bmi_model()->GetEndTime();
-
157 }
-
158
-
159 const std::vector<std::string> &get_required_parameters() override {
-
160 return REQUIRED_PARAMETERS;
-
161 }
-
162
-
177 const std::string &get_config_mapped_variable_name(const std::string &model_var_name) override {
-
178 // TODO: need to introduce validation elsewhere that all mapped names are valid AORC field constants.
-
179 if (bmi_var_names_map.find(model_var_name) != bmi_var_names_map.end())
-
180 return bmi_var_names_map[model_var_name];
-
181 else
-
182 return model_var_name;
-
183 }
-
184
-
198 size_t get_ts_index_for_time(const time_t &epoch_time) override {
-
199 // TODO: come back and implement if actually necessary for this type; for now don't use
-
200 throw std::runtime_error("Bmi_Singular_Formulation does not yet implement get_ts_index_for_time");
-
201 }
-
202
-
214 std::vector<double> get_values(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m=SUM) override
-
215 {
-
216 std::string output_name = selector.get_variable_name();
-
217 time_t init_time = selector.get_init_time();
-
218 long duration_s = selector.get_duration_secs();
-
219 std::string output_units = selector.get_output_units();
-
220
-
221 // First make sure this is an available output
-
222 //const std::vector<std::string> forcing_outputs = get_available_forcing_outputs();
-
223 const std::vector<std::string> forcing_outputs = get_available_variable_names();
-
224 if (std::find(forcing_outputs.begin(), forcing_outputs.end(), output_name) == forcing_outputs.end()) {
-
225 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
-
226 }
-
227 // TODO: do this, or something better, later; right now, just assume anything using this as a provider is
-
228 // consistent with times
-
229 /*
-
230 if (last_model_response_delta == 0 && last_model_response_start_time == 0) {
-
231 throw runtime_error(get_formulation_type() + " does not properly set output time validity ranges "
-
232 "needed to provide outputs as forcings");
-
233 }
-
234 */
-
235
-
236 // check if output is available from BMI
-
237 std::string bmi_var_name;
-
238 get_bmi_output_var_name(output_name, bmi_var_name);
-
239
-
240 if( !bmi_var_name.empty() )
-
241 {
-
242 auto model = get_bmi_model().get();
-
243 //Get vector of double values for variable
-
244 //The return type of the vector here dependent on what
-
245 //needs to use it. For other BMI moudles, that is runtime dependent
-
246 //on the type of the requesting module
-
247 auto values = models::bmi::GetValue<double>(*model, bmi_var_name);
-
248
-
249 // Convert units
-
250 std::string native_units = get_bmi_model()->GetVarUnits(bmi_var_name);
-
251 try {
-
252 UnitsHelper::convert_values(native_units, values.data(), output_units, values.data(), values.size());
+
132 long record_duration() override {
+
133 throw std::runtime_error("Bmi_Module_Formulation does not yet implement record_duration");
+
134 }
+
135
+
141 const double get_model_current_time() override {
+
142 return get_bmi_model()->GetCurrentTime();
+
143 }
+
144
+
150 const double get_model_end_time() override {
+
151 return get_bmi_model()->GetEndTime();
+
152 }
+
153
+
154 const std::vector<std::string> &get_required_parameters() override {
+
155 return REQUIRED_PARAMETERS;
+
156 }
+
157
+
172 const std::string &get_config_mapped_variable_name(const std::string &model_var_name) override {
+
173 // TODO: need to introduce validation elsewhere that all mapped names are valid AORC field constants.
+
174 if (bmi_var_names_map.find(model_var_name) != bmi_var_names_map.end())
+
175 return bmi_var_names_map[model_var_name];
+
176 else
+
177 return model_var_name;
+
178 }
+
179
+
193 size_t get_ts_index_for_time(const time_t &epoch_time) override {
+
194 // TODO: come back and implement if actually necessary for this type; for now don't use
+
195 throw std::runtime_error("Bmi_Singular_Formulation does not yet implement get_ts_index_for_time");
+
196 }
+
197
+
209 std::vector<double> get_values(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m=SUM) override
+
210 {
+
211 std::string output_name = selector.get_variable_name();
+
212 time_t init_time = selector.get_init_time();
+
213 long duration_s = selector.get_duration_secs();
+
214 std::string output_units = selector.get_output_units();
+
215
+
216 // First make sure this is an available output
+
217 auto forcing_outputs = get_available_variable_names();
+
218 if (std::find(forcing_outputs.begin(), forcing_outputs.end(), output_name) == forcing_outputs.end()) {
+
219 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
+
220 }
+
221 // TODO: do this, or something better, later; right now, just assume anything using this as a provider is
+
222 // consistent with times
+
223 /*
+
224 if (last_model_response_delta == 0 && last_model_response_start_time == 0) {
+
225 throw runtime_error(get_formulation_type() + " does not properly set output time validity ranges "
+
226 "needed to provide outputs as forcings");
+
227 }
+
228 */
+
229
+
230 // check if output is available from BMI
+
231 std::string bmi_var_name;
+
232 get_bmi_output_var_name(output_name, bmi_var_name);
+
233
+
234 if( !bmi_var_name.empty() )
+
235 {
+
236 auto model = get_bmi_model().get();
+
237 //Get vector of double values for variable
+
238 //The return type of the vector here dependent on what
+
239 //needs to use it. For other BMI moudles, that is runtime dependent
+
240 //on the type of the requesting module
+
241 auto values = models::bmi::GetValue<double>(*model, bmi_var_name);
+
242
+
243 // Convert units
+
244 std::string native_units = get_bmi_model()->GetVarUnits(bmi_var_name);
+
245 try {
+
246 UnitsHelper::convert_values(native_units, values.data(), output_units, values.data(), values.size());
+
247 return values;
+
248 }
+
249 catch (const std::runtime_error& e){
+
250 #ifndef UDUNITS_QUIET
+
251 std::cerr<<"WARN: Unit conversion unsuccessful - Returning unconverted value! (\""<<e.what()<<"\")"<<std::endl;
+
252 #endif
253 return values;
254 }
-
255 catch (const std::runtime_error& e){
-
256 #ifndef UDUNITS_QUIET
-
257 std::cerr<<"WARN: Unit conversion unsuccessful - Returning unconverted value! (\""<<e.what()<<"\")"<<std::endl;
-
258 #endif
-
259 return values;
-
260 }
-
261 }
-
262 //This is unlikely (impossible?) to throw since a pre-check on available names is done above. Assert instead?
-
263 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
-
264 }
-
265
-
283 double get_value(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override
-
284 {
-
285 std::string output_name = selector.get_variable_name();
-
286 time_t init_time = selector.get_init_time();
-
287 long duration_s = selector.get_duration_secs();
-
288 std::string output_units = selector.get_output_units();
-
289
-
290 // First make sure this is an available output
-
291 //const std::vector<std::string> forcing_outputs = get_available_forcing_outputs();
-
292 const std::vector<std::string> forcing_outputs = get_available_variable_names();
-
293 if (std::find(forcing_outputs.begin(), forcing_outputs.end(), output_name) == forcing_outputs.end()) {
-
294 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
-
295 }
-
296 // TODO: do this, or something better, later; right now, just assume anything using this as a provider is
-
297 // consistent with times
-
298 /*
-
299 if (last_model_response_delta == 0 && last_model_response_start_time == 0) {
-
300 throw runtime_error(get_formulation_type() + " does not properly set output time validity ranges "
-
301 "needed to provide outputs as forcings");
-
302 }
-
303 */
-
304
-
305 // check if output is available from BMI
-
306 std::string bmi_var_name;
-
307 get_bmi_output_var_name(output_name, bmi_var_name);
-
308
-
309 if( !bmi_var_name.empty() )
-
310 {
-
311 //Get forcing value from BMI variable
-
312 double value = get_var_value_as_double(bmi_var_name);
-
313
-
314 // Convert units
-
315 std::string native_units = get_bmi_model()->GetVarUnits(bmi_var_name);
-
316 try {
-
317 return UnitsHelper::get_converted_value(native_units, value, output_units);
-
318 }
-
319 catch (const std::runtime_error& e){
-
320 #ifndef UDUNITS_QUIET
-
321 std::cerr<<"WARN: Unit conversion unsuccessful - Returning unconverted value! (\""<<e.what()<<"\")"<<std::endl;
-
322 #endif
-
323 return value;
-
324 }
-
325 }
-
326
-
327 //This is unlikely (impossible?) to throw since a pre-check on available names is done above. Assert instead?
-
328 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
-
329 }
-
330
-
331 bool is_bmi_input_variable(const std::string &var_name) override {
-
332 return is_var_name_in_collection(get_bmi_input_variables(), var_name);
-
333 }
-
334
-
335 bool is_bmi_output_variable(const std::string &var_name) override {
-
336 return is_var_name_in_collection(get_bmi_output_variables(), var_name);
-
337 }
-
338
-
339 inline bool is_var_name_in_collection(const std::vector<std::string> &all_names, const std::string &var_name) {
-
340 return std::count(all_names.begin(), all_names.end(), var_name) > 0;
-
341 }
-
342
-
361 bool is_property_sum_over_time_step(const std::string& name) override {
-
362 // TODO: verify with some kind of proof that "always true" is appropriate
-
363 return true;
-
364 }
-
365
-
366 const std::vector<std::string> get_bmi_input_variables() override {
-
367 return get_bmi_model()->GetInputVarNames();
-
368 }
-
369
-
370 const std::vector<std::string> get_bmi_output_variables() override {
-
371 return get_bmi_model()->GetOutputVarNames();
-
372 }
-
373
-
374 protected:
-
375
-
382 inline void get_bmi_output_var_name(const std::string &name, std::string &bmi_var_name)
-
383 {
-
384 //check standard output names first
-
385 std::vector<std::string> output_names = get_bmi_model()->GetOutputVarNames();
-
386 if (std::find(output_names.begin(), output_names.end(), name) != output_names.end()) {
-
387 bmi_var_name = name;
-
388 }
-
389 else
-
390 {
-
391 //check mapped names
-
392 std::string mapped_name;
-
393 for (auto & iter : bmi_var_names_map) {
-
394 if (iter.second == name) {
-
395 mapped_name = iter.first;
-
396 break;
-
397 }
-
398 }
-
399 //ensure mapped name maps to an output variable, see GH #393 =)
-
400 if (std::find(output_names.begin(), output_names.end(), mapped_name) != output_names.end()){
-
401 bmi_var_name = mapped_name;
-
402 }
-
403 //else not an output variable
-
404 }
-
405 }
-
406
-
417 virtual std::shared_ptr<M> construct_model(const geojson::PropertyMap& properties) = 0;
-
418
-
427 void determine_model_time_offset() {
-
428 set_bmi_model_start_time_forcing_offset_s(
-
429 // TODO: Look at making this epoch start configurable instead of from forcing
-
430 forcing->get_data_start_time() - convert_model_time(get_bmi_model()->GetStartTime()));
-
431 }
-
432
-
448 const bool &get_allow_model_exceed_end_time() const override {
-
449 return allow_model_exceed_end_time;
-
450 }
-
451
-
452 const std::string &get_bmi_init_config() const {
-
453 return bmi_init_config;
-
454 }
-
455
-
461 std::shared_ptr<M> get_bmi_model() {
-
462 return bmi_model;
-
463 }
-
464
-
465 const std::string &get_forcing_file_path() const override {
-
466 return forcing_file_path;
-
467 }
-
468
-
469 const time_t &get_bmi_model_start_time_forcing_offset_s() override {
-
470 return bmi_model_start_time_forcing_offset_s;
-
471 }
-
472
-
483 virtual double get_var_value_as_double(const std::string& var_name) = 0;
-
484
-
503 virtual double get_var_value_as_double(const int& index, const std::string& var_name) = 0;
-
504
-
516 void inner_create_formulation(geojson::PropertyMap properties, bool needs_param_validation) {
-
517 if (needs_param_validation) {
-
518 validate_parameters(properties);
-
519 }
-
520 // Required parameters first
-
521 set_bmi_init_config(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG).as_string());
-
522 set_bmi_main_output_var(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR).as_string());
-
523 set_model_type_name(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE).as_string());
-
524 set_bmi_using_forcing_file(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS).as_boolean());
-
525
-
526 // Then optional ...
-
527
-
528 // Note that this must be present if bmi_using_forcing_file is true
-
529 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE) != properties.end())
-
530 set_forcing_file_path(properties.at(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE).as_string());
-
531 else if (is_bmi_using_forcing_file())
-
532 throw std::runtime_error("Can't create BMI formulation: using_forcing_file true but no file path set");
-
533
-
534 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END) != properties.end()) {
-
535 set_allow_model_exceed_end_time(
-
536 properties.at(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END).as_boolean());
-
537 }
-
538 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__FIXED_TIME_STEP) != properties.end()) {
-
539 set_bmi_model_time_step_fixed(
-
540 properties.at(BMI_REALIZATION_CFG_PARAM_OPT__FIXED_TIME_STEP).as_boolean());
-
541 }
-
542
-
543 auto std_names_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES);
-
544 if (std_names_it != properties.end()) {
-
545 geojson::PropertyMap names_map = std_names_it->second.get_values();
-
546 for (auto& names_it : names_map) {
-
547 bmi_var_names_map.insert(
-
548 std::pair<std::string, std::string>(names_it.first, names_it.second.as_string()));
-
549 }
-
550 }
-
551
-
552 // Do this next, since after checking whether other input variables are present in the properties, we can
-
553 // now construct the adapter and init the model
-
554 set_bmi_model(construct_model(properties));
-
555
-
556 //Check if any parameter values need to be set on the BMI model,
-
557 //and set them before it is run
-
558 set_initial_bmi_parameters(properties);
-
559
-
560 // Make sure that this is able to interpret model time and convert to real time, since BMI model time is
-
561 // usually starting at 0 and just counting up
-
562 determine_model_time_offset();
-
563
-
564 // Output variable subset and order, if present
-
565 auto out_var_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS);
-
566 if (out_var_it != properties.end()) {
-
567 std::vector<geojson::JSONProperty> out_vars_json_list = out_var_it->second.as_list();
-
568 std::vector<std::string> out_vars(out_vars_json_list.size());
-
569 for (int i = 0; i < out_vars_json_list.size(); ++i) {
-
570 out_vars[i] = out_vars_json_list[i].as_string();
-
571 }
-
572 set_output_variable_names(out_vars);
-
573 }
-
574 // Otherwise, just take what literally is provided by the model
-
575 else {
-
576 set_output_variable_names(get_bmi_model()->GetOutputVarNames());
-
577 }
-
578
-
579 // Output header fields, if present
-
580 auto out_headers_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_HEADER_FIELDS);
-
581 if (out_headers_it != properties.end()) {
-
582 std::vector<geojson::JSONProperty> out_headers_json_list = out_var_it->second.as_list();
-
583 std::vector<std::string> out_headers(out_headers_json_list.size());
-
584 for (int i = 0; i < out_headers_json_list.size(); ++i) {
-
585 out_headers[i] = out_headers_json_list[i].as_string();
-
586 }
-
587 set_output_header_fields(out_headers);
-
588 }
-
589 else {
-
590 set_output_header_fields(get_output_variable_names());
-
591 }
-
592
-
593 // Output precision, if present
-
594 auto out_precision_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION);
-
595 if (out_precision_it != properties.end()) {
-
596 set_output_precision(properties.at(BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION).as_natural_number());
-
597 }
-
598
-
599 // Finally, make sure this is set
-
600 model_initialized = get_bmi_model()->is_model_initialized();
-
601 }
-
602
-
614 void set_initial_bmi_parameters(geojson::PropertyMap properties){
-
615 auto model = get_bmi_model();
-
616 if( model == nullptr ) return;
-
617 //Now that the model is ready, we can set some intial parameters passed in the config
-
618 auto model_params = properties.find("model_params");
-
619
-
620 if (model_params != properties.end() ){
-
621
-
622 geojson::PropertyMap params = model_params->second.get_values();
-
623 //Declare/init the possible vectors here
-
624 //reuse them for each loop iteration, make sure to clear them
-
625 std::vector<long> long_vec;
-
626 std::vector<double> double_vec;
-
627 //not_supported
-
628 //std::vector<std::string> str_vec;
-
629 //std::vector<bool> bool_vec;
-
630 std::shared_ptr<void> value_ptr;
-
631 for (auto& param : params) {
-
632 //Get some basic BMI info for this param
-
633 int varItemSize = get_bmi_model()->GetVarItemsize(param.first);
-
634 int totalBytes = get_bmi_model()->GetVarNbytes(param.first);
-
635
-
636 //Figure out the c++ type to convert data to
-
637 std::string type = get_bmi_model()->get_analogous_cxx_type(get_bmi_model()->GetVarType(param.first),
-
638 varItemSize);
-
639 //TODO might consider refactoring as_vector and get_values_as_type
-
640 //(and by extension, as_c_array) into the JSONProperty class
-
641 //then instead of the PropertyVariant visitor filling vectors
-
642 //it could fill the c-like array and avoid another copy.
-
643 switch( param.second.get_type() ){
-
644 case geojson::PropertyType::Natural:
-
645 param.second.as_vector(long_vec);
-
646 value_ptr = get_values_as_type(type, long_vec.begin(), long_vec.end());
-
647 break;
-
648 case geojson::PropertyType::Real:
-
649 param.second.as_vector(double_vec);
-
650 value_ptr = get_values_as_type(type, double_vec.begin(), double_vec.end());
-
651 break;
-
652 /* Not currently supporting string parameter values
-
653 case geojson::PropertyType::String:
-
654 param.second.as_vector(str_vec);
-
655 value_ptr = get_values_as_type(type, long_vec.begin(), long_vec.end());
-
656 */
-
657 /* Not currently supporting native bool (true/false) parameter values (use int 0/1)
-
658 case geojson::PropertyType::Boolean:
-
659 param.second.as_vector(bool_vec);
-
660 //data_ptr = bool_vec.data();
-
661 */
-
662 case geojson::PropertyType::List:
-
663 //In this case, only supporting numeric lists
-
664 //will retrieve as double (longs will get casted)
-
665 //TODO consider some additional introspection/optimization for this?
-
666 param.second.as_vector(double_vec);
-
667 if(double_vec.size() == 0){
-
668 std::cout<<"Cannot pass non-numeric lists as a BMI parameter, skipping "<<param.first<<std::endl;
-
669 continue;
-
670 }
-
671 value_ptr = get_values_as_type(type, double_vec.begin(), double_vec.end());
-
672 break;
-
673 default:
-
674 std::cout<<"Cannot pass parameter of type "<<geojson::get_propertytype_name(param.second.get_type())<<" as a BMI parameter, skipping "<<param.first<<std::endl;
-
675 continue;
-
676 }
-
677 try{
-
678
-
679 // Finally, use the value obtained to set the model param
-
680 get_bmi_model()->SetValue(param.first, value_ptr.get());
-
681 }
-
682 catch (const std::exception &e)
-
683 {
-
684 std::cout<<"Exception setting parameter value: "<< e.what()<<std::endl;
-
685 std::cout<<"Skipping parameter: "<<param.first<<std::endl;
-
686 }
-
687 catch (...)
-
688 {
-
689 std::cout<<"Unknown Exception setting parameter value: "<<std::endl;
-
690 std::cout<<"Skipping parameter: "<<param.first<<std::endl;
-
691 }
-
692 long_vec.clear();
-
693 double_vec.clear();
-
694 //Not supported
-
695 //str_vec.clear();
-
696 //bool_vec.clear();
-
697 }
-
698
-
699 }
-
700 //TODO use SetValue(name, vector<t>) overloads???
-
701 //implment the overloads in each adapter
-
702 //ensure proper type is prepared before setting value
-
703 }
-
704
-
710 bool is_bmi_model_time_step_fixed() override {
-
711 return bmi_model_time_step_fixed;
-
712 }
-
713
-
719 bool is_bmi_using_forcing_file() const override {
-
720 return bmi_using_forcing_file;
-
721 }
-
722
-
728 bool is_model_initialized() override {
-
729 return model_initialized;
-
730 };
-
731
-
732 void set_allow_model_exceed_end_time(bool allow_exceed_end) {
-
733 allow_model_exceed_end_time = allow_exceed_end;
-
734 }
-
735
-
736 void set_bmi_init_config(const std::string &init_config) {
-
737 bmi_init_config = init_config;
-
738 }
-
739
-
745 void set_bmi_model(std::shared_ptr<M> model) {
-
746 bmi_model = model;
-
747 }
-
748
-
749 void set_bmi_model_start_time_forcing_offset_s(const time_t &offset_s) {
-
750 bmi_model_start_time_forcing_offset_s = offset_s;
-
751 }
-
752
-
753 void set_bmi_model_time_step_fixed(bool is_fix_time_step) {
-
754 bmi_model_time_step_fixed = is_fix_time_step;
-
755 }
-
756
-
762 void set_bmi_using_forcing_file(bool uses_forcing_file) {
-
763 bmi_using_forcing_file = uses_forcing_file;
-
764 }
-
765
-
766 void set_forcing_file_path(const std::string &forcing_path) {
-
767 forcing_file_path = forcing_path;
-
768 }
-
769
-
775 virtual void set_model_initialized(bool is_initialized) {
-
776 model_initialized = is_initialized;
-
777 }
-
778
-
792 template <typename T, typename Iterator>
-
793 std::shared_ptr<T> as_c_array(Iterator begin, Iterator end){
-
794 //Make a shared pointer large enough to hold all elements
-
795 //This is a CONTIGUOUS array of type T
-
796 //Must provide a custom deleter to delete the array
-
797 std::shared_ptr<T> ptr( new T[std::distance(begin, end)], [](T *p) { delete[] p; } );
-
798 Iterator it = begin;
-
799 int i = 0;
-
800 while(it != end){
-
801 //Be safe and cast the input to the desired type
-
802 ptr.get()[i] = static_cast<T>(*it);
-
803 ++it;
-
804 ++i;
-
805 }
-
806 return ptr;
-
807 }
-
808
-
818 template <typename Iterator>
-
819 std::shared_ptr<void> get_values_as_type(std::string type, Iterator begin, Iterator end)
-
820 {
-
821 //Use std::vector range constructor to ensure contiguous storage of values
-
822 //Return the pointer to the contiguous storage
-
823 if (type == "double" || type == "double precision")
-
824 return as_c_array<double>(begin, end);
-
825
-
826 if (type == "float" || type == "real")
-
827 return as_c_array<float>(begin, end);
-
828
-
829 if (type == "short" || type == "short int" || type == "signed short" || type == "signed short int")
-
830 return as_c_array<short>(begin, end);
-
831
-
832 if (type == "unsigned short" || type == "unsigned short int")
-
833 return as_c_array<unsigned short>(begin, end);
-
834
-
835 if (type == "int" || type == "signed" || type == "signed int" || type == "integer")
-
836 return as_c_array<int>(begin, end);
-
837
-
838 if (type == "unsigned" || type == "unsigned int")
-
839 return as_c_array<unsigned int>(begin, end);
-
840
-
841 if (type == "long" || type == "long int" || type == "signed long" || type == "signed long int")
-
842 return as_c_array<long>(begin, end);
-
843
-
844 if (type == "unsigned long" || type == "unsigned long int")
-
845 return as_c_array<unsigned long>(begin, end);
-
846
-
847 if (type == "long long" || type == "long long int" || type == "signed long long" || type == "signed long long int")
-
848 return as_c_array<long long>(begin, end);
+
255 }
+
256 //This is unlikely (impossible?) to throw since a pre-check on available names is done above. Assert instead?
+
257 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
+
258 }
+
259
+
277 double get_value(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override
+
278 {
+
279 std::string output_name = selector.get_variable_name();
+
280 time_t init_time = selector.get_init_time();
+
281 long duration_s = selector.get_duration_secs();
+
282 std::string output_units = selector.get_output_units();
+
283
+
284 // First make sure this is an available output
+
285 auto forcing_outputs = get_available_variable_names();
+
286 if (std::find(forcing_outputs.begin(), forcing_outputs.end(), output_name) == forcing_outputs.end()) {
+
287 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
+
288 }
+
289 // TODO: do this, or something better, later; right now, just assume anything using this as a provider is
+
290 // consistent with times
+
291 /*
+
292 if (last_model_response_delta == 0 && last_model_response_start_time == 0) {
+
293 throw runtime_error(get_formulation_type() + " does not properly set output time validity ranges "
+
294 "needed to provide outputs as forcings");
+
295 }
+
296 */
+
297
+
298 // check if output is available from BMI
+
299 std::string bmi_var_name;
+
300 get_bmi_output_var_name(output_name, bmi_var_name);
+
301
+
302 if( !bmi_var_name.empty() )
+
303 {
+
304 //Get forcing value from BMI variable
+
305 double value = get_var_value_as_double(bmi_var_name);
+
306
+
307 // Convert units
+
308 std::string native_units = get_bmi_model()->GetVarUnits(bmi_var_name);
+
309 try {
+
310 return UnitsHelper::get_converted_value(native_units, value, output_units);
+
311 }
+
312 catch (const std::runtime_error& e){
+
313 #ifndef UDUNITS_QUIET
+
314 std::cerr<<"WARN: Unit conversion unsuccessful - Returning unconverted value! (\""<<e.what()<<"\")"<<std::endl;
+
315 #endif
+
316 return value;
+
317 }
+
318 }
+
319
+
320 //This is unlikely (impossible?) to throw since a pre-check on available names is done above. Assert instead?
+
321 throw std::runtime_error(get_formulation_type() + " received invalid output forcing name " + output_name);
+
322 }
+
323
+
324 bool is_bmi_input_variable(const std::string &var_name) override {
+
325 return is_var_name_in_collection(get_bmi_input_variables(), var_name);
+
326 }
+
327
+
328 bool is_bmi_output_variable(const std::string &var_name) override {
+
329 return is_var_name_in_collection(get_bmi_output_variables(), var_name);
+
330 }
+
331
+
332 inline bool is_var_name_in_collection(const std::vector<std::string> &all_names, const std::string &var_name) {
+
333 return std::count(all_names.begin(), all_names.end(), var_name) > 0;
+
334 }
+
335
+
354 bool is_property_sum_over_time_step(const std::string& name) override {
+
355 // TODO: verify with some kind of proof that "always true" is appropriate
+
356 return true;
+
357 }
+
358
+
359 const std::vector<std::string> get_bmi_input_variables() override {
+
360 return get_bmi_model()->GetInputVarNames();
+
361 }
+
362
+
363 const std::vector<std::string> get_bmi_output_variables() override {
+
364 return get_bmi_model()->GetOutputVarNames();
+
365 }
+
366
+
367 protected:
+
368
+
375 inline void get_bmi_output_var_name(const std::string &name, std::string &bmi_var_name)
+
376 {
+
377 //check standard output names first
+
378 std::vector<std::string> output_names = get_bmi_model()->GetOutputVarNames();
+
379 if (std::find(output_names.begin(), output_names.end(), name) != output_names.end()) {
+
380 bmi_var_name = name;
+
381 }
+
382 else
+
383 {
+
384 //check mapped names
+
385 std::string mapped_name;
+
386 for (auto & iter : bmi_var_names_map) {
+
387 if (iter.second == name) {
+
388 mapped_name = iter.first;
+
389 break;
+
390 }
+
391 }
+
392 //ensure mapped name maps to an output variable, see GH #393 =)
+
393 if (std::find(output_names.begin(), output_names.end(), mapped_name) != output_names.end()){
+
394 bmi_var_name = mapped_name;
+
395 }
+
396 //else not an output variable
+
397 }
+
398 }
+
399
+
410 virtual std::shared_ptr<M> construct_model(const geojson::PropertyMap& properties) = 0;
+
411
+
420 void determine_model_time_offset() {
+
421 set_bmi_model_start_time_forcing_offset_s(
+
422 // TODO: Look at making this epoch start configurable instead of from forcing
+
423 forcing->get_data_start_time() - convert_model_time(get_bmi_model()->GetStartTime()));
+
424 }
+
425
+
441 const bool &get_allow_model_exceed_end_time() const override {
+
442 return allow_model_exceed_end_time;
+
443 }
+
444
+
445 const std::string &get_bmi_init_config() const {
+
446 return bmi_init_config;
+
447 }
+
448
+
454 std::shared_ptr<M> get_bmi_model() {
+
455 return bmi_model;
+
456 }
+
457
+
458 const std::string &get_forcing_file_path() const override {
+
459 return forcing_file_path;
+
460 }
+
461
+
462 const time_t &get_bmi_model_start_time_forcing_offset_s() override {
+
463 return bmi_model_start_time_forcing_offset_s;
+
464 }
+
465
+
476 virtual double get_var_value_as_double(const std::string& var_name) = 0;
+
477
+
496 virtual double get_var_value_as_double(const int& index, const std::string& var_name) = 0;
+
497
+
509 void inner_create_formulation(geojson::PropertyMap properties, bool needs_param_validation) {
+
510 if (needs_param_validation) {
+
511 validate_parameters(properties);
+
512 }
+
513 // Required parameters first
+
514 set_bmi_init_config(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG).as_string());
+
515 set_bmi_main_output_var(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR).as_string());
+
516 set_model_type_name(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE).as_string());
+
517 set_bmi_using_forcing_file(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS).as_boolean());
+
518
+
519 // Then optional ...
+
520
+
521 // Note that this must be present if bmi_using_forcing_file is true
+
522 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE) != properties.end())
+
523 set_forcing_file_path(properties.at(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE).as_string());
+
524 else if (is_bmi_using_forcing_file())
+
525 throw std::runtime_error("Can't create BMI formulation: using_forcing_file true but no file path set");
+
526
+
527 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END) != properties.end()) {
+
528 set_allow_model_exceed_end_time(
+
529 properties.at(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END).as_boolean());
+
530 }
+
531 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__FIXED_TIME_STEP) != properties.end()) {
+
532 set_bmi_model_time_step_fixed(
+
533 properties.at(BMI_REALIZATION_CFG_PARAM_OPT__FIXED_TIME_STEP).as_boolean());
+
534 }
+
535
+
536 auto std_names_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES);
+
537 if (std_names_it != properties.end()) {
+
538 geojson::PropertyMap names_map = std_names_it->second.get_values();
+
539 for (auto& names_it : names_map) {
+
540 bmi_var_names_map.insert(
+
541 std::pair<std::string, std::string>(names_it.first, names_it.second.as_string()));
+
542 }
+
543 }
+
544
+
545 // Do this next, since after checking whether other input variables are present in the properties, we can
+
546 // now construct the adapter and init the model
+
547 set_bmi_model(construct_model(properties));
+
548
+
549 //Check if any parameter values need to be set on the BMI model,
+
550 //and set them before it is run
+
551 set_initial_bmi_parameters(properties);
+
552
+
553 // Make sure that this is able to interpret model time and convert to real time, since BMI model time is
+
554 // usually starting at 0 and just counting up
+
555 determine_model_time_offset();
+
556
+
557 // Output variable subset and order, if present
+
558 auto out_var_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS);
+
559 if (out_var_it != properties.end()) {
+
560 std::vector<geojson::JSONProperty> out_vars_json_list = out_var_it->second.as_list();
+
561 std::vector<std::string> out_vars(out_vars_json_list.size());
+
562 for (int i = 0; i < out_vars_json_list.size(); ++i) {
+
563 out_vars[i] = out_vars_json_list[i].as_string();
+
564 }
+
565 set_output_variable_names(out_vars);
+
566 }
+
567 // Otherwise, just take what literally is provided by the model
+
568 else {
+
569 set_output_variable_names(get_bmi_model()->GetOutputVarNames());
+
570 }
+
571
+
572 // Output header fields, if present
+
573 auto out_headers_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_HEADER_FIELDS);
+
574 if (out_headers_it != properties.end()) {
+
575 std::vector<geojson::JSONProperty> out_headers_json_list = out_var_it->second.as_list();
+
576 std::vector<std::string> out_headers(out_headers_json_list.size());
+
577 for (int i = 0; i < out_headers_json_list.size(); ++i) {
+
578 out_headers[i] = out_headers_json_list[i].as_string();
+
579 }
+
580 set_output_header_fields(out_headers);
+
581 }
+
582 else {
+
583 set_output_header_fields(get_output_variable_names());
+
584 }
+
585
+
586 // Output precision, if present
+
587 auto out_precision_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION);
+
588 if (out_precision_it != properties.end()) {
+
589 set_output_precision(properties.at(BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION).as_natural_number());
+
590 }
+
591
+
592 // Finally, make sure this is set
+
593 model_initialized = get_bmi_model()->is_model_initialized();
+
594 }
+
595
+
607 void set_initial_bmi_parameters(geojson::PropertyMap properties){
+
608 auto model = get_bmi_model();
+
609 if( model == nullptr ) return;
+
610 //Now that the model is ready, we can set some intial parameters passed in the config
+
611 auto model_params = properties.find("model_params");
+
612
+
613 if (model_params != properties.end() ){
+
614
+
615 geojson::PropertyMap params = model_params->second.get_values();
+
616 //Declare/init the possible vectors here
+
617 //reuse them for each loop iteration, make sure to clear them
+
618 std::vector<long> long_vec;
+
619 std::vector<double> double_vec;
+
620 //not_supported
+
621 //std::vector<std::string> str_vec;
+
622 //std::vector<bool> bool_vec;
+
623 std::shared_ptr<void> value_ptr;
+
624 for (auto& param : params) {
+
625 //Get some basic BMI info for this param
+
626 int varItemSize = get_bmi_model()->GetVarItemsize(param.first);
+
627 int totalBytes = get_bmi_model()->GetVarNbytes(param.first);
+
628
+
629 //Figure out the c++ type to convert data to
+
630 std::string type = get_bmi_model()->get_analogous_cxx_type(get_bmi_model()->GetVarType(param.first),
+
631 varItemSize);
+
632 //TODO might consider refactoring as_vector and get_values_as_type
+
633 //(and by extension, as_c_array) into the JSONProperty class
+
634 //then instead of the PropertyVariant visitor filling vectors
+
635 //it could fill the c-like array and avoid another copy.
+
636 switch( param.second.get_type() ){
+
637 case geojson::PropertyType::Natural:
+
638 param.second.as_vector(long_vec);
+
639 value_ptr = get_values_as_type(type, long_vec.begin(), long_vec.end());
+
640 break;
+
641 case geojson::PropertyType::Real:
+
642 param.second.as_vector(double_vec);
+
643 value_ptr = get_values_as_type(type, double_vec.begin(), double_vec.end());
+
644 break;
+
645 /* Not currently supporting string parameter values
+
646 case geojson::PropertyType::String:
+
647 param.second.as_vector(str_vec);
+
648 value_ptr = get_values_as_type(type, long_vec.begin(), long_vec.end());
+
649 */
+
650 /* Not currently supporting native bool (true/false) parameter values (use int 0/1)
+
651 case geojson::PropertyType::Boolean:
+
652 param.second.as_vector(bool_vec);
+
653 //data_ptr = bool_vec.data();
+
654 */
+
655 case geojson::PropertyType::List:
+
656 //In this case, only supporting numeric lists
+
657 //will retrieve as double (longs will get casted)
+
658 //TODO consider some additional introspection/optimization for this?
+
659 param.second.as_vector(double_vec);
+
660 if(double_vec.size() == 0){
+
661 std::cout<<"Cannot pass non-numeric lists as a BMI parameter, skipping "<<param.first<<std::endl;
+
662 continue;
+
663 }
+
664 value_ptr = get_values_as_type(type, double_vec.begin(), double_vec.end());
+
665 break;
+
666 default:
+
667 std::cout<<"Cannot pass parameter of type "<<geojson::get_propertytype_name(param.second.get_type())<<" as a BMI parameter, skipping "<<param.first<<std::endl;
+
668 continue;
+
669 }
+
670 try{
+
671
+
672 // Finally, use the value obtained to set the model param
+
673 get_bmi_model()->SetValue(param.first, value_ptr.get());
+
674 }
+
675 catch (const std::exception &e)
+
676 {
+
677 std::cout<<"Exception setting parameter value: "<< e.what()<<std::endl;
+
678 std::cout<<"Skipping parameter: "<<param.first<<std::endl;
+
679 }
+
680 catch (...)
+
681 {
+
682 std::cout<<"Unknown Exception setting parameter value: "<<std::endl;
+
683 std::cout<<"Skipping parameter: "<<param.first<<std::endl;
+
684 }
+
685 long_vec.clear();
+
686 double_vec.clear();
+
687 //Not supported
+
688 //str_vec.clear();
+
689 //bool_vec.clear();
+
690 }
+
691
+
692 }
+
693 //TODO use SetValue(name, vector<t>) overloads???
+
694 //implment the overloads in each adapter
+
695 //ensure proper type is prepared before setting value
+
696 }
+
697
+
703 bool is_bmi_model_time_step_fixed() override {
+
704 return bmi_model_time_step_fixed;
+
705 }
+
706
+
712 bool is_bmi_using_forcing_file() const override {
+
713 return bmi_using_forcing_file;
+
714 }
+
715
+
721 bool is_model_initialized() override {
+
722 return model_initialized;
+
723 };
+
724
+
725 void set_allow_model_exceed_end_time(bool allow_exceed_end) {
+
726 allow_model_exceed_end_time = allow_exceed_end;
+
727 }
+
728
+
729 void set_bmi_init_config(const std::string &init_config) {
+
730 bmi_init_config = init_config;
+
731 }
+
732
+
738 void set_bmi_model(std::shared_ptr<M> model) {
+
739 bmi_model = model;
+
740 }
+
741
+
742 void set_bmi_model_start_time_forcing_offset_s(const time_t &offset_s) {
+
743 bmi_model_start_time_forcing_offset_s = offset_s;
+
744 }
+
745
+
746 void set_bmi_model_time_step_fixed(bool is_fix_time_step) {
+
747 bmi_model_time_step_fixed = is_fix_time_step;
+
748 }
+
749
+
755 void set_bmi_using_forcing_file(bool uses_forcing_file) {
+
756 bmi_using_forcing_file = uses_forcing_file;
+
757 }
+
758
+
759 void set_forcing_file_path(const std::string &forcing_path) {
+
760 forcing_file_path = forcing_path;
+
761 }
+
762
+
768 virtual void set_model_initialized(bool is_initialized) {
+
769 model_initialized = is_initialized;
+
770 }
+
771
+
785 template <typename T, typename Iterator>
+
786 std::shared_ptr<T> as_c_array(Iterator begin, Iterator end){
+
787 //Make a shared pointer large enough to hold all elements
+
788 //This is a CONTIGUOUS array of type T
+
789 //Must provide a custom deleter to delete the array
+
790 std::shared_ptr<T> ptr( new T[std::distance(begin, end)], [](T *p) { delete[] p; } );
+
791 Iterator it = begin;
+
792 int i = 0;
+
793 while(it != end){
+
794 //Be safe and cast the input to the desired type
+
795 ptr.get()[i] = static_cast<T>(*it);
+
796 ++it;
+
797 ++i;
+
798 }
+
799 return ptr;
+
800 }
+
801
+
811 template <typename Iterator>
+
812 std::shared_ptr<void> get_values_as_type(std::string type, Iterator begin, Iterator end)
+
813 {
+
814 //Use std::vector range constructor to ensure contiguous storage of values
+
815 //Return the pointer to the contiguous storage
+
816 if (type == "double" || type == "double precision")
+
817 return as_c_array<double>(begin, end);
+
818
+
819 if (type == "float" || type == "real")
+
820 return as_c_array<float>(begin, end);
+
821
+
822 if (type == "short" || type == "short int" || type == "signed short" || type == "signed short int")
+
823 return as_c_array<short>(begin, end);
+
824
+
825 if (type == "unsigned short" || type == "unsigned short int")
+
826 return as_c_array<unsigned short>(begin, end);
+
827
+
828 if (type == "int" || type == "signed" || type == "signed int" || type == "integer")
+
829 return as_c_array<int>(begin, end);
+
830
+
831 if (type == "unsigned" || type == "unsigned int")
+
832 return as_c_array<unsigned int>(begin, end);
+
833
+
834 if (type == "long" || type == "long int" || type == "signed long" || type == "signed long int")
+
835 return as_c_array<long>(begin, end);
+
836
+
837 if (type == "unsigned long" || type == "unsigned long int")
+
838 return as_c_array<unsigned long>(begin, end);
+
839
+
840 if (type == "long long" || type == "long long int" || type == "signed long long" || type == "signed long long int")
+
841 return as_c_array<long long>(begin, end);
+
842
+
843 if (type == "unsigned long long" || type == "unsigned long long int")
+
844 return as_c_array<unsigned long long>(begin, end);
+
845
+
846 throw std::runtime_error("Unable to get values of iterable as type" + type + " from " + get_model_type_name() +
+
847 " : no logic for converting values to variable's type.");
+
848 }
849
-
850 if (type == "unsigned long long" || type == "unsigned long long int")
-
851 return as_c_array<unsigned long long>(begin, end);
-
852
-
853 throw std::runtime_error("Unable to get values of iterable as type" + type + " from " + get_model_type_name() +
-
854 " : no logic for converting values to variable's type.");
-
855 }
+
850 // TODO: need to modify this to support arrays properly, since in general that's what BMI modules deal with
+
851 template<typename T>
+
852 std::shared_ptr<void> get_value_as_type(std::string type, T value)
+
853 {
+
854 if (type == "double" || type == "double precision")
+
855 return std::make_shared<double>( static_cast<double>(value) );
856
-
857 // TODO: need to modify this to support arrays properly, since in general that's what BMI modules deal with
-
858 template<typename T>
-
859 std::shared_ptr<void> get_value_as_type(std::string type, T value)
-
860 {
-
861 if (type == "double" || type == "double precision")
-
862 return std::make_shared<double>( static_cast<double>(value) );
-
863
-
864 if (type == "float" || type == "real")
-
865 return std::make_shared<float>( static_cast<float>(value) );
-
866
-
867 if (type == "short" || type == "short int" || type == "signed short" || type == "signed short int")
-
868 return std::make_shared<short>( static_cast<short>(value) );
-
869
-
870 if (type == "unsigned short" || type == "unsigned short int")
-
871 return std::make_shared<unsigned short>( static_cast<unsigned short>(value) );
-
872
-
873 if (type == "int" || type == "signed" || type == "signed int" || type == "integer")
-
874 return std::make_shared<int>( static_cast<int>(value) );
-
875
-
876 if (type == "unsigned" || type == "unsigned int")
-
877 return std::make_shared<unsigned int>( static_cast<unsigned int>(value) );
-
878
-
879 if (type == "long" || type == "long int" || type == "signed long" || type == "signed long int")
-
880 return std::make_shared<long>( static_cast<long>(value) );
-
881
-
882 if (type == "unsigned long" || type == "unsigned long int")
-
883 return std::make_shared<unsigned long>( static_cast<unsigned long>(value) );
-
884
-
885 if (type == "long long" || type == "long long int" || type == "signed long long" || type == "signed long long int")
-
886 return std::make_shared<long long>( static_cast<long long>(value) );
+
857 if (type == "float" || type == "real")
+
858 return std::make_shared<float>( static_cast<float>(value) );
+
859
+
860 if (type == "short" || type == "short int" || type == "signed short" || type == "signed short int")
+
861 return std::make_shared<short>( static_cast<short>(value) );
+
862
+
863 if (type == "unsigned short" || type == "unsigned short int")
+
864 return std::make_shared<unsigned short>( static_cast<unsigned short>(value) );
+
865
+
866 if (type == "int" || type == "signed" || type == "signed int" || type == "integer")
+
867 return std::make_shared<int>( static_cast<int>(value) );
+
868
+
869 if (type == "unsigned" || type == "unsigned int")
+
870 return std::make_shared<unsigned int>( static_cast<unsigned int>(value) );
+
871
+
872 if (type == "long" || type == "long int" || type == "signed long" || type == "signed long int")
+
873 return std::make_shared<long>( static_cast<long>(value) );
+
874
+
875 if (type == "unsigned long" || type == "unsigned long int")
+
876 return std::make_shared<unsigned long>( static_cast<unsigned long>(value) );
+
877
+
878 if (type == "long long" || type == "long long int" || type == "signed long long" || type == "signed long long int")
+
879 return std::make_shared<long long>( static_cast<long long>(value) );
+
880
+
881 if (type == "unsigned long long" || type == "unsigned long long int")
+
882 return std::make_shared<unsigned long long>( static_cast<unsigned long long>(value) );
+
883
+
884 throw std::runtime_error("Unable to get value of variable as type" + type + " from " + get_model_type_name() +
+
885 " : no logic for converting value to variable's type.");
+
886 }
887
-
888 if (type == "unsigned long long" || type == "unsigned long long int")
-
889 return std::make_shared<unsigned long long>( static_cast<unsigned long long>(value) );
-
890
-
891 throw std::runtime_error("Unable to get value of variable as type" + type + " from " + get_model_type_name() +
-
892 " : no logic for converting value to variable's type.");
-
893 }
-
894
-
902 void set_model_inputs_prior_to_update(const double &model_init_time, time_step_t t_delta) {
-
903 std::vector<std::string> in_var_names = get_bmi_model()->GetInputVarNames();
-
904 time_t model_epoch_time = convert_model_time(model_init_time) + get_bmi_model_start_time_forcing_offset_s();
-
905
-
906 for (std::string & var_name : in_var_names) {
-
907 data_access::GenericDataProvider *provider;
-
908 std::string var_map_alias = get_config_mapped_variable_name(var_name);
-
909 if (input_forcing_providers.find(var_map_alias) != input_forcing_providers.end()) {
-
910 provider = input_forcing_providers[var_map_alias].get();
-
911 }
-
912 else if (var_map_alias != var_name && input_forcing_providers.find(var_name) != input_forcing_providers.end()) {
-
913 provider = input_forcing_providers[var_name].get();
-
914 }
-
915 else {
-
916 provider = forcing.get();
-
917 }
-
918
-
919 // TODO: probably need to actually allow this by default and warn, but have config option to activate
-
920 // this type of behavior
-
921 // TODO: account for arrays later
-
922 int nbytes = get_bmi_model()->GetVarNbytes(var_name);
-
923 int varItemSize = get_bmi_model()->GetVarItemsize(var_name);
-
924 int numItems = nbytes / varItemSize;
-
925 assert(nbytes % varItemSize == 0);
-
926
-
927 std::shared_ptr<void> value_ptr;
-
928 // Finally, use the value obtained to set the model input
-
929 std::string type = get_bmi_model()->get_analogous_cxx_type(get_bmi_model()->GetVarType(var_name),
-
930 varItemSize);
-
931 if (numItems != 1) {
-
932 //more than a single value needed for var_name
-
933 auto values = provider->get_values(CatchmentAggrDataSelector(this->get_catchment_id(),var_map_alias, model_epoch_time, t_delta,
-
934 get_bmi_model()->GetVarUnits(var_name)));
-
935 //need to marshal data types to the receiver as well
-
936 //this could be done a little more elegantly if the provider interface were
-
937 //"type aware", but for now, this will do (but requires yet another copy)
-
938 if(values.size() == 1){
-
939 //FIXME this isn't generic broadcasting, but works for scalar implementations
-
940 #ifndef NGEN_QUIET
-
941 std::cerr << "WARN: broadcasting variable '" << var_name << "' from scalar to expected array\n";
-
942 #endif
-
943 values.resize(numItems, values[0]);
-
944 } else if (values.size() != numItems) {
-
945 throw std::runtime_error("Mismatch in item count for variable '" + var_name + "': model expects " +
-
946 std::to_string(numItems) + ", provider returned " + std::to_string(values.size()) +
-
947 " items\n");
-
948 }
-
949 value_ptr = get_values_as_type( type, values.begin(), values.end() );
-
950
-
951 } else {
-
952 //scalar value
-
953 double value = provider->get_value(CatchmentAggrDataSelector(this->get_catchment_id(),var_map_alias, model_epoch_time, t_delta,
-
954 get_bmi_model()->GetVarUnits(var_name)));
-
955 value_ptr = get_value_as_type(type, value);
-
956 }
-
957 get_bmi_model()->SetValue(var_name, value_ptr.get());
-
958 }
-
959 }
-
960
-
962 time_step_t last_model_response_delta = 0;
-
964 time_t last_model_response_start_time = 0;
-
965 std::map<std::string, std::shared_ptr<data_access::GenericDataProvider>> input_forcing_providers;
-
966
-
967 // Access for multi-BMI
-
968 friend class Bmi_Multi_Formulation;
+
895 void set_model_inputs_prior_to_update(const double &model_init_time, time_step_t t_delta) {
+
896 std::vector<std::string> in_var_names = get_bmi_model()->GetInputVarNames();
+
897 time_t model_epoch_time = convert_model_time(model_init_time) + get_bmi_model_start_time_forcing_offset_s();
+
898
+
899 for (std::string & var_name : in_var_names) {
+
900 data_access::GenericDataProvider *provider;
+
901 std::string var_map_alias = get_config_mapped_variable_name(var_name);
+
902 if (input_forcing_providers.find(var_map_alias) != input_forcing_providers.end()) {
+
903 provider = input_forcing_providers[var_map_alias].get();
+
904 }
+
905 else if (var_map_alias != var_name && input_forcing_providers.find(var_name) != input_forcing_providers.end()) {
+
906 provider = input_forcing_providers[var_name].get();
+
907 }
+
908 else {
+
909 provider = forcing.get();
+
910 }
+
911
+
912 // TODO: probably need to actually allow this by default and warn, but have config option to activate
+
913 // this type of behavior
+
914 // TODO: account for arrays later
+
915 int nbytes = get_bmi_model()->GetVarNbytes(var_name);
+
916 int varItemSize = get_bmi_model()->GetVarItemsize(var_name);
+
917 int numItems = nbytes / varItemSize;
+
918 assert(nbytes % varItemSize == 0);
+
919
+
920 std::shared_ptr<void> value_ptr;
+
921 // Finally, use the value obtained to set the model input
+
922 std::string type = get_bmi_model()->get_analogous_cxx_type(get_bmi_model()->GetVarType(var_name),
+
923 varItemSize);
+
924 if (numItems != 1) {
+
925 //more than a single value needed for var_name
+
926 auto values = provider->get_values(CatchmentAggrDataSelector(this->get_catchment_id(),var_map_alias, model_epoch_time, t_delta,
+
927 get_bmi_model()->GetVarUnits(var_name)));
+
928 //need to marshal data types to the receiver as well
+
929 //this could be done a little more elegantly if the provider interface were
+
930 //"type aware", but for now, this will do (but requires yet another copy)
+
931 if(values.size() == 1){
+
932 //FIXME this isn't generic broadcasting, but works for scalar implementations
+
933 #ifndef NGEN_QUIET
+
934 std::cerr << "WARN: broadcasting variable '" << var_name << "' from scalar to expected array\n";
+
935 #endif
+
936 values.resize(numItems, values[0]);
+
937 } else if (values.size() != numItems) {
+
938 throw std::runtime_error("Mismatch in item count for variable '" + var_name + "': model expects " +
+
939 std::to_string(numItems) + ", provider returned " + std::to_string(values.size()) +
+
940 " items\n");
+
941 }
+
942 value_ptr = get_values_as_type( type, values.begin(), values.end() );
+
943
+
944 } else {
+
945 //scalar value
+
946 double value = provider->get_value(CatchmentAggrDataSelector(this->get_catchment_id(),var_map_alias, model_epoch_time, t_delta,
+
947 get_bmi_model()->GetVarUnits(var_name)));
+
948 value_ptr = get_value_as_type(type, value);
+
949 }
+
950 get_bmi_model()->SetValue(var_name, value_ptr.get());
+
951 }
+
952 }
+
953
+
955 time_step_t last_model_response_delta = 0;
+
957 time_t last_model_response_start_time = 0;
+
958 std::map<std::string, std::shared_ptr<data_access::GenericDataProvider>> input_forcing_providers;
+
959
+
960 // Access for multi-BMI
+
961 friend class Bmi_Multi_Formulation;
+
962
+
963 // Unit test access
+
964 friend class ::Bmi_Formulation_Test;
+
965 friend class ::Bmi_C_Formulation_Test;
+
966 friend class ::Bmi_Multi_Formulation_Test;
+
967 friend class ::Bmi_Cpp_Formulation_Test;
+
968 friend class ::Bmi_Cpp_Multi_Array_Test;
969
-
970 // Unit test access
-
971 friend class ::Bmi_Formulation_Test;
-
972 friend class ::Bmi_C_Formulation_Test;
-
973 friend class ::Bmi_Multi_Formulation_Test;
-
974 friend class ::Bmi_Cpp_Formulation_Test;
-
975 friend class ::Bmi_Cpp_Multi_Array_Test;
-
976
-
977 private:
-
982 bool allow_model_exceed_end_time = false;
-
984 std::vector<std::string> available_forcings;
-
985 std::string bmi_init_config;
-
986 std::shared_ptr<M> bmi_model;
-
988 bool bmi_model_time_step_fixed = true;
-
993 time_t bmi_model_start_time_forcing_offset_s;
-
995 std::map<std::string, std::string> bmi_var_names_map;
-
997 bool bmi_using_forcing_file;
-
998 std::string forcing_file_path;
-
999 bool model_initialized = false;
-
1000
-
1001 std::vector<std::string> OPTIONAL_PARAMETERS = {
-
1002 BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE,
-
1003 BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES,
-
1004 BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS,
-
1005 BMI_REALIZATION_CFG_PARAM_OPT__OUT_HEADER_FIELDS,
-
1006 BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION,
-
1007 BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END,
-
1008 BMI_REALIZATION_CFG_PARAM_OPT__FIXED_TIME_STEP,
-
1009 BMI_REALIZATION_CFG_PARAM_OPT__LIB_FILE
-
1010 };
-
1011 std::vector<std::string> REQUIRED_PARAMETERS = {
-
1012 BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG,
-
1013 BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR,
-
1014 BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE,
-
1015 BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS
-
1016 };
-
1017
-
1018 };
-
1019/*
-
1020 template<class M>
-
1021 void Bmi_Formulation<M>::create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global) {
-
1022 geojson::PropertyMap options = this->interpret_parameters(config, global);
-
1023 inner_create_formulation(options, false);
-
1024 }
-
1025
-
1026 template<class M>
-
1027 void Bmi_Formulation<M>::create_formulation(geojson::PropertyMap properties) {
-
1028 inner_create_formulation(properties, true);
-
1029 }
-
1030
-
1031 template<class M>
-
1032 void Bmi_Formulation<M>::inner_create_formulation(geojson::PropertyMap properties, bool needs_param_validation) {
-
1033 if (needs_param_validation) {
-
1034 validate_parameters(properties);
-
1035 }
-
1036 // Required parameters first
-
1037 set_bmi_init_config(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG).as_string());
-
1038 set_bmi_main_output_var(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR).as_string());
-
1039 set_forcing_file_path(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__FORCING_FILE).as_string());
-
1040 set_model_type_name(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE).as_string());
-
1041 set_bmi_using_forcing_file(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS).as_boolean());
+
970 private:
+
975 bool allow_model_exceed_end_time = false;
+
977 std::vector<std::string> available_forcings;
+
978 std::string bmi_init_config;
+
979 std::shared_ptr<M> bmi_model;
+
981 bool bmi_model_time_step_fixed = true;
+
986 time_t bmi_model_start_time_forcing_offset_s;
+
988 std::map<std::string, std::string> bmi_var_names_map;
+
990 bool bmi_using_forcing_file;
+
991 std::string forcing_file_path;
+
992 bool model_initialized = false;
+
993
+
994 std::vector<std::string> OPTIONAL_PARAMETERS = {
+
995 BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE,
+
996 BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES,
+
997 BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS,
+
998 BMI_REALIZATION_CFG_PARAM_OPT__OUT_HEADER_FIELDS,
+
999 BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION,
+
1000 BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END,
+
1001 BMI_REALIZATION_CFG_PARAM_OPT__FIXED_TIME_STEP,
+
1002 BMI_REALIZATION_CFG_PARAM_OPT__LIB_FILE
+
1003 };
+
1004 std::vector<std::string> REQUIRED_PARAMETERS = {
+
1005 BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG,
+
1006 BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR,
+
1007 BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE,
+
1008 BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS
+
1009 };
+
1010
+
1011 };
+
1012/*
+
1013 template<class M>
+
1014 void Bmi_Formulation<M>::create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global) {
+
1015 geojson::PropertyMap options = this->interpret_parameters(config, global);
+
1016 inner_create_formulation(options, false);
+
1017 }
+
1018
+
1019 template<class M>
+
1020 void Bmi_Formulation<M>::create_formulation(geojson::PropertyMap properties) {
+
1021 inner_create_formulation(properties, true);
+
1022 }
+
1023
+
1024 template<class M>
+
1025 void Bmi_Formulation<M>::inner_create_formulation(geojson::PropertyMap properties, bool needs_param_validation) {
+
1026 if (needs_param_validation) {
+
1027 validate_parameters(properties);
+
1028 }
+
1029 // Required parameters first
+
1030 set_bmi_init_config(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG).as_string());
+
1031 set_bmi_main_output_var(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR).as_string());
+
1032 set_forcing_file_path(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__FORCING_FILE).as_string());
+
1033 set_model_type_name(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE).as_string());
+
1034 set_bmi_using_forcing_file(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS).as_boolean());
+
1035
+
1036 // Then optional ...
+
1037
+
1038 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END) != properties.end()) {
+
1039 set_allow_model_exceed_end_time(
+
1040 properties.at(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END).as_boolean());
+
1041 }
1042
-
1043 // Then optional ...
-
1044
-
1045 if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END) != properties.end()) {
-
1046 set_allow_model_exceed_end_time(
-
1047 properties.at(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END).as_boolean());
-
1048 }
-
1049
-
1050 // Do this next, since after checking whether other input variables are present in the properties, we can
-
1051 // now construct the adapter and init the model
-
1052 set_bmi_model(construct_model(properties));
-
1053
-
1054 // Output variable subset and order, if present
-
1055 auto out_var_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS);
-
1056 if (out_var_it != properties.end()) {
-
1057 std::vector<geojson::JSONProperty> out_vars_json_list = out_var_it->second.as_list();
-
1058 std::vector<std::string> out_vars(out_vars_json_list.size());
-
1059 for (int i = 0; i < out_vars_json_list.size(); ++i) {
-
1060 out_vars[i] = out_vars_json_list[i].as_string();
-
1061 }
-
1062 set_output_variable_names(out_vars);
-
1063 }
-
1064 // Otherwise, just take what literally is provided by the model
-
1065 else {
-
1066 set_output_variable_names(get_bmi_model()->GetOutputVarNames());
-
1067 }
-
1068
-
1069 // Output header fields, if present
-
1070 auto out_headers_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_HEADER_FIELDS);
-
1071 if (out_headers_it != properties.end()) {
-
1072 std::vector<geojson::JSONProperty> out_headers_json_list = out_var_it->second.as_list();
-
1073 std::vector<std::string> out_headers(out_headers_json_list.size());
-
1074 for (int i = 0; i < out_headers_json_list.size(); ++i) {
-
1075 out_headers[i] = out_headers_json_list[i].as_string();
-
1076 }
-
1077 set_output_header_fields(out_headers);
-
1078 }
-
1079 else {
-
1080 set_output_header_fields(get_output_variable_names());
-
1081 }
-
1082 }
-
1083 */
-
1084
-
1085}
-
1086
-
1087#endif //NGEN_BMI_MODULE_FORMULATION_H
+
1043 // Do this next, since after checking whether other input variables are present in the properties, we can
+
1044 // now construct the adapter and init the model
+
1045 set_bmi_model(construct_model(properties));
+
1046
+
1047 // Output variable subset and order, if present
+
1048 auto out_var_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS);
+
1049 if (out_var_it != properties.end()) {
+
1050 std::vector<geojson::JSONProperty> out_vars_json_list = out_var_it->second.as_list();
+
1051 std::vector<std::string> out_vars(out_vars_json_list.size());
+
1052 for (int i = 0; i < out_vars_json_list.size(); ++i) {
+
1053 out_vars[i] = out_vars_json_list[i].as_string();
+
1054 }
+
1055 set_output_variable_names(out_vars);
+
1056 }
+
1057 // Otherwise, just take what literally is provided by the model
+
1058 else {
+
1059 set_output_variable_names(get_bmi_model()->GetOutputVarNames());
+
1060 }
+
1061
+
1062 // Output header fields, if present
+
1063 auto out_headers_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__OUT_HEADER_FIELDS);
+
1064 if (out_headers_it != properties.end()) {
+
1065 std::vector<geojson::JSONProperty> out_headers_json_list = out_var_it->second.as_list();
+
1066 std::vector<std::string> out_headers(out_headers_json_list.size());
+
1067 for (int i = 0; i < out_headers_json_list.size(); ++i) {
+
1068 out_headers[i] = out_headers_json_list[i].as_string();
+
1069 }
+
1070 set_output_header_fields(out_headers);
+
1071 }
+
1072 else {
+
1073 set_output_header_fields(get_output_variable_names());
+
1074 }
+
1075 }
+
1076 */
+
1077
+
1078}
+
1079
+
1080#endif //NGEN_BMI_MODULE_FORMULATION_H
CatchmentAggrDataSelector
This class is intended to be the virtual base for all data selectors used with the DataProvider API.
Definition: DataProviderSelectors.hpp:13
CatchmentAggrDataSelector::get_variable_name
std::string get_variable_name() const
Get the variable name for this selector.
Definition: DataProviderSelectors.hpp:50
CatchmentAggrDataSelector::get_duration_secs
long get_duration_secs() const
Get the duration in seconds that is requested by this selector.
Definition: DataProviderSelectors.hpp:64
@@ -884,6 +877,7 @@
HY_CatchmentRealization::forcing
std::shared_ptr< data_access::GenericDataProvider > forcing
Definition: HY_CatchmentRealization.hpp:54
UnitsHelper::get_converted_value
static double get_converted_value(const std::string &in_units, const double &value, const std::string &out_units)
Definition: UnitsHelper.cpp:58
UnitsHelper::convert_values
static double * convert_values(const std::string &in_units, double *values, const std::string &out_units, double *out_values, const size_t &count)
Definition: UnitsHelper.cpp:71
+
boost::span
Definition: span.hpp:169
data_access::DataProvider::get_value
virtual data_type get_value(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the value of a forcing property for an arbitrary time period, converting units if needed.
data_access::DataProvider::get_values
virtual std::vector< data_type > get_values(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the values of a forcing property for an arbitrary time period, converting units if needed.
data_access::GenericDataProvider
Definition: GenericDataProvider.hpp:10
@@ -897,71 +891,71 @@
realization::Bmi_Formulation::set_output_variable_names
void set_output_variable_names(const std::vector< std::string > &out_var_names)
Set the names of variables in formulation output.
Definition: Bmi_Formulation.hpp:252
realization::Bmi_Formulation::set_output_header_fields
void set_output_header_fields(const std::vector< std::string > &output_headers)
Definition: Bmi_Formulation.hpp:240
realization::Bmi_Module_Formulation
Abstraction of a formulation with a single backing model object that implements the BMI.
Definition: Bmi_Module_Formulation.hpp:34
-
realization::Bmi_Module_Formulation::get_bmi_model
std::shared_ptr< M > get_bmi_model()
Get the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:461
-
realization::Bmi_Module_Formulation::record_duration
long record_duration() override
Return the stride in the time dimension.
Definition: Bmi_Module_Formulation.hpp:137
-
realization::Bmi_Module_Formulation::get_config_mapped_variable_name
const std::string & get_config_mapped_variable_name(const std::string &model_var_name) override
When possible, translate a variable name for a BMI model to an internally recognized name.
Definition: Bmi_Module_Formulation.hpp:177
-
realization::Bmi_Module_Formulation::bmi_model_start_time_forcing_offset_s
time_t bmi_model_start_time_forcing_offset_s
The offset, converted to seconds, from the model's start time to the start time of the initial forcin...
Definition: Bmi_Module_Formulation.hpp:993
-
realization::Bmi_Module_Formulation::inner_create_formulation
void inner_create_formulation(geojson::PropertyMap properties, bool needs_param_validation)
Universal logic applied when creating a BMI-backed formulation from NGen config.
Definition: Bmi_Module_Formulation.hpp:516
-
realization::Bmi_Module_Formulation::get_value_as_type
std::shared_ptr< void > get_value_as_type(std::string type, T value)
Definition: Bmi_Module_Formulation.hpp:859
-
realization::Bmi_Module_Formulation::get_variable_time_end
time_t get_variable_time_end(const std::string &varibale_name)
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: Bmi_Module_Formulation.hpp:127
-
realization::Bmi_Module_Formulation::set_bmi_using_forcing_file
void set_bmi_using_forcing_file(bool uses_forcing_file)
Set whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Module_Formulation.hpp:762
-
realization::Bmi_Module_Formulation::get_data_start_time
long get_data_start_time() override
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Module_Formulation.hpp:112
-
realization::Bmi_Module_Formulation::OPTIONAL_PARAMETERS
std::vector< std::string > OPTIONAL_PARAMETERS
Definition: Bmi_Module_Formulation.hpp:1001
-
realization::Bmi_Module_Formulation::bmi_using_forcing_file
bool bmi_using_forcing_file
Whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Module_Formulation.hpp:997
-
realization::Bmi_Module_Formulation::REQUIRED_PARAMETERS
std::vector< std::string > REQUIRED_PARAMETERS
Definition: Bmi_Module_Formulation.hpp:1011
-
realization::Bmi_Module_Formulation::as_c_array
std::shared_ptr< T > as_c_array(Iterator begin, Iterator end)
Template function for copying iterator range into contiguous array.
Definition: Bmi_Module_Formulation.hpp:793
-
realization::Bmi_Module_Formulation::set_allow_model_exceed_end_time
void set_allow_model_exceed_end_time(bool allow_exceed_end)
Definition: Bmi_Module_Formulation.hpp:732
+
realization::Bmi_Module_Formulation::get_bmi_model
std::shared_ptr< M > get_bmi_model()
Get the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:454
+
realization::Bmi_Module_Formulation::record_duration
long record_duration() override
Return the stride in the time dimension.
Definition: Bmi_Module_Formulation.hpp:132
+
realization::Bmi_Module_Formulation::get_config_mapped_variable_name
const std::string & get_config_mapped_variable_name(const std::string &model_var_name) override
When possible, translate a variable name for a BMI model to an internally recognized name.
Definition: Bmi_Module_Formulation.hpp:172
+
realization::Bmi_Module_Formulation::bmi_model_start_time_forcing_offset_s
time_t bmi_model_start_time_forcing_offset_s
The offset, converted to seconds, from the model's start time to the start time of the initial forcin...
Definition: Bmi_Module_Formulation.hpp:986
+
realization::Bmi_Module_Formulation::inner_create_formulation
void inner_create_formulation(geojson::PropertyMap properties, bool needs_param_validation)
Universal logic applied when creating a BMI-backed formulation from NGen config.
Definition: Bmi_Module_Formulation.hpp:509
+
realization::Bmi_Module_Formulation::get_value_as_type
std::shared_ptr< void > get_value_as_type(std::string type, T value)
Definition: Bmi_Module_Formulation.hpp:852
+
realization::Bmi_Module_Formulation::get_variable_time_end
time_t get_variable_time_end(const std::string &varibale_name)
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: Bmi_Module_Formulation.hpp:122
+
realization::Bmi_Module_Formulation::set_bmi_using_forcing_file
void set_bmi_using_forcing_file(bool uses_forcing_file)
Set whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Module_Formulation.hpp:755
+
realization::Bmi_Module_Formulation::get_data_start_time
long get_data_start_time() override
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Module_Formulation.hpp:107
+
realization::Bmi_Module_Formulation::OPTIONAL_PARAMETERS
std::vector< std::string > OPTIONAL_PARAMETERS
Definition: Bmi_Module_Formulation.hpp:994
+
realization::Bmi_Module_Formulation::bmi_using_forcing_file
bool bmi_using_forcing_file
Whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Module_Formulation.hpp:990
+
realization::Bmi_Module_Formulation::REQUIRED_PARAMETERS
std::vector< std::string > REQUIRED_PARAMETERS
Definition: Bmi_Module_Formulation.hpp:1004
+
realization::Bmi_Module_Formulation::as_c_array
std::shared_ptr< T > as_c_array(Iterator begin, Iterator end)
Template function for copying iterator range into contiguous array.
Definition: Bmi_Module_Formulation.hpp:786
+
realization::Bmi_Module_Formulation::set_allow_model_exceed_end_time
void set_allow_model_exceed_end_time(bool allow_exceed_end)
Definition: Bmi_Module_Formulation.hpp:725
realization::Bmi_Module_Formulation::get_var_value_as_double
virtual double get_var_value_as_double(const std::string &var_name)=0
Get value for some BMI model variable.
-
realization::Bmi_Module_Formulation::determine_model_time_offset
void determine_model_time_offset()
Determine and set the offset time of the model in seconds, compared to forcing data.
Definition: Bmi_Module_Formulation.hpp:427
-
realization::Bmi_Module_Formulation::available_forcings
std::vector< std::string > available_forcings
The set of available "forcings" (output variables, plus their mapped aliases) that the model can prov...
Definition: Bmi_Module_Formulation.hpp:984
-
realization::Bmi_Module_Formulation::get_values_as_type
std::shared_ptr< void > get_values_as_type(std::string type, Iterator begin, Iterator end)
Gets values in iterator range, casted based on type then returned as typeless (void) pointer.
Definition: Bmi_Module_Formulation.hpp:819
-
realization::Bmi_Module_Formulation::allow_model_exceed_end_time
bool allow_model_exceed_end_time
Whether model Update calls are allowed and handled in some way by the backing model for time steps af...
Definition: Bmi_Module_Formulation.hpp:982
-
realization::Bmi_Module_Formulation::is_bmi_model_time_step_fixed
bool is_bmi_model_time_step_fixed() override
Test whether backing model has fixed time step size.
Definition: Bmi_Module_Formulation.hpp:710
-
realization::Bmi_Module_Formulation::bmi_model_time_step_fixed
bool bmi_model_time_step_fixed
Whether backing model has fixed time step size.
Definition: Bmi_Module_Formulation.hpp:988
-
realization::Bmi_Module_Formulation::get_data_stop_time
long get_data_stop_time() override
Return the last valid time for which data from the requested variable can be requested.
Definition: Bmi_Module_Formulation.hpp:132
-
realization::Bmi_Module_Formulation::is_model_initialized
bool is_model_initialized() override
Test whether the backing model object has been initialize using the BMI standard Initialize function.
Definition: Bmi_Module_Formulation.hpp:728
+
realization::Bmi_Module_Formulation::determine_model_time_offset
void determine_model_time_offset()
Determine and set the offset time of the model in seconds, compared to forcing data.
Definition: Bmi_Module_Formulation.hpp:420
+
realization::Bmi_Module_Formulation::available_forcings
std::vector< std::string > available_forcings
The set of available "forcings" (output variables, plus their mapped aliases) that the model can prov...
Definition: Bmi_Module_Formulation.hpp:977
+
realization::Bmi_Module_Formulation::get_values_as_type
std::shared_ptr< void > get_values_as_type(std::string type, Iterator begin, Iterator end)
Gets values in iterator range, casted based on type then returned as typeless (void) pointer.
Definition: Bmi_Module_Formulation.hpp:812
+
realization::Bmi_Module_Formulation::allow_model_exceed_end_time
bool allow_model_exceed_end_time
Whether model Update calls are allowed and handled in some way by the backing model for time steps af...
Definition: Bmi_Module_Formulation.hpp:975
+
realization::Bmi_Module_Formulation::is_bmi_model_time_step_fixed
bool is_bmi_model_time_step_fixed() override
Test whether backing model has fixed time step size.
Definition: Bmi_Module_Formulation.hpp:703
+
realization::Bmi_Module_Formulation::bmi_model_time_step_fixed
bool bmi_model_time_step_fixed
Whether backing model has fixed time step size.
Definition: Bmi_Module_Formulation.hpp:981
+
realization::Bmi_Module_Formulation::get_data_stop_time
long get_data_stop_time() override
Return the last valid time for which data from the requested variable can be requested.
Definition: Bmi_Module_Formulation.hpp:127
+
realization::Bmi_Module_Formulation::is_model_initialized
bool is_model_initialized() override
Test whether the backing model object has been initialize using the BMI standard Initialize function.
Definition: Bmi_Module_Formulation.hpp:721
realization::Bmi_Module_Formulation::~Bmi_Module_Formulation
virtual ~Bmi_Module_Formulation()
Definition: Bmi_Module_Formulation.hpp:49
-
realization::Bmi_Module_Formulation::bmi_var_names_map
std::map< std::string, std::string > bmi_var_names_map
A configured mapping of BMI model variable names to standard names for use inside the framework.
Definition: Bmi_Module_Formulation.hpp:995
-
realization::Bmi_Module_Formulation::get_bmi_init_config
const std::string & get_bmi_init_config() const
Definition: Bmi_Module_Formulation.hpp:452
-
realization::Bmi_Module_Formulation::set_bmi_model
void set_bmi_model(std::shared_ptr< M > model)
Set the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:745
-
realization::Bmi_Module_Formulation::is_bmi_input_variable
bool is_bmi_input_variable(const std::string &var_name) override
Definition: Bmi_Module_Formulation.hpp:331
-
realization::Bmi_Module_Formulation::get_forcing_file_path
const std::string & get_forcing_file_path() const override
Definition: Bmi_Module_Formulation.hpp:465
-
realization::Bmi_Module_Formulation::is_var_name_in_collection
bool is_var_name_in_collection(const std::vector< std::string > &all_names, const std::string &var_name)
Definition: Bmi_Module_Formulation.hpp:339
-
realization::Bmi_Module_Formulation::get_value
double get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the value of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Module_Formulation.hpp:283
-
realization::Bmi_Module_Formulation::is_bmi_output_variable
bool is_bmi_output_variable(const std::string &var_name) override
Definition: Bmi_Module_Formulation.hpp:335
-
realization::Bmi_Module_Formulation::set_bmi_model_time_step_fixed
void set_bmi_model_time_step_fixed(bool is_fix_time_step)
Definition: Bmi_Module_Formulation.hpp:753
-
realization::Bmi_Module_Formulation::get_bmi_model_start_time_forcing_offset_s
const time_t & get_bmi_model_start_time_forcing_offset_s() override
Definition: Bmi_Module_Formulation.hpp:469
-
realization::Bmi_Module_Formulation::set_initial_bmi_parameters
void set_initial_bmi_parameters(geojson::PropertyMap properties)
Check configuration properties for model_params and attempt to set them in the bmi model.
Definition: Bmi_Module_Formulation.hpp:614
-
realization::Bmi_Module_Formulation::get_available_variable_names
const std::vector< std::string > & get_available_variable_names() override
Get the collection of forcing output property names this instance can provide.
Definition: Bmi_Module_Formulation.hpp:74
-
realization::Bmi_Module_Formulation::get_model_end_time
const double get_model_end_time() override
Get the end time for the backing BMI model in its native format and units.
Definition: Bmi_Module_Formulation.hpp:155
-
realization::Bmi_Module_Formulation::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Definition: Bmi_Module_Formulation.hpp:361
-
realization::Bmi_Module_Formulation::last_model_response_delta
time_step_t last_model_response_delta
The delta of the last model update execution (typically, this is time step size).
Definition: Bmi_Module_Formulation.hpp:962
-
realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update
void set_model_inputs_prior_to_update(const double &model_init_time, time_step_t t_delta)
Set BMI input variable values for the model appropriately prior to calling its BMIupdate()``.
Definition: Bmi_Module_Formulation.hpp:902
-
realization::Bmi_Module_Formulation::get_bmi_input_variables
const std::vector< std::string > get_bmi_input_variables() override
Definition: Bmi_Module_Formulation.hpp:366
-
realization::Bmi_Module_Formulation::bmi_model
std::shared_ptr< M > bmi_model
Definition: Bmi_Module_Formulation.hpp:986
-
realization::Bmi_Module_Formulation::last_model_response_start_time
time_t last_model_response_start_time
The epoch time of the model at the beginning of its last update.
Definition: Bmi_Module_Formulation.hpp:964
-
realization::Bmi_Module_Formulation::get_model_current_time
const double get_model_current_time() override
Get the current time for the backing BMI model in its native format and units.
Definition: Bmi_Module_Formulation.hpp:146
-
realization::Bmi_Module_Formulation::set_forcing_file_path
void set_forcing_file_path(const std::string &forcing_path)
Definition: Bmi_Module_Formulation.hpp:766
-
realization::Bmi_Module_Formulation::get_variable_time_begin
time_t get_variable_time_begin(const std::string &variable_name)
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Module_Formulation.hpp:98
+
realization::Bmi_Module_Formulation::bmi_var_names_map
std::map< std::string, std::string > bmi_var_names_map
A configured mapping of BMI model variable names to standard names for use inside the framework.
Definition: Bmi_Module_Formulation.hpp:988
+
realization::Bmi_Module_Formulation::get_bmi_init_config
const std::string & get_bmi_init_config() const
Definition: Bmi_Module_Formulation.hpp:445
+
realization::Bmi_Module_Formulation::set_bmi_model
void set_bmi_model(std::shared_ptr< M > model)
Set the backing model object implementing the BMI.
Definition: Bmi_Module_Formulation.hpp:738
+
realization::Bmi_Module_Formulation::is_bmi_input_variable
bool is_bmi_input_variable(const std::string &var_name) override
Definition: Bmi_Module_Formulation.hpp:324
+
realization::Bmi_Module_Formulation::get_forcing_file_path
const std::string & get_forcing_file_path() const override
Definition: Bmi_Module_Formulation.hpp:458
+
realization::Bmi_Module_Formulation::is_var_name_in_collection
bool is_var_name_in_collection(const std::vector< std::string > &all_names, const std::string &var_name)
Definition: Bmi_Module_Formulation.hpp:332
+
realization::Bmi_Module_Formulation::get_value
double get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the value of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Module_Formulation.hpp:277
+
realization::Bmi_Module_Formulation::is_bmi_output_variable
bool is_bmi_output_variable(const std::string &var_name) override
Definition: Bmi_Module_Formulation.hpp:328
+
realization::Bmi_Module_Formulation::set_bmi_model_time_step_fixed
void set_bmi_model_time_step_fixed(bool is_fix_time_step)
Definition: Bmi_Module_Formulation.hpp:746
+
realization::Bmi_Module_Formulation::get_bmi_model_start_time_forcing_offset_s
const time_t & get_bmi_model_start_time_forcing_offset_s() override
Definition: Bmi_Module_Formulation.hpp:462
+
realization::Bmi_Module_Formulation::get_available_variable_names
boost::span< const std::string > get_available_variable_names() override
Get the collection of forcing output property names this instance can provide.
Definition: Bmi_Module_Formulation.hpp:73
+
realization::Bmi_Module_Formulation::set_initial_bmi_parameters
void set_initial_bmi_parameters(geojson::PropertyMap properties)
Check configuration properties for model_params and attempt to set them in the bmi model.
Definition: Bmi_Module_Formulation.hpp:607
+
realization::Bmi_Module_Formulation::get_model_end_time
const double get_model_end_time() override
Get the end time for the backing BMI model in its native format and units.
Definition: Bmi_Module_Formulation.hpp:150
+
realization::Bmi_Module_Formulation::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Definition: Bmi_Module_Formulation.hpp:354
+
realization::Bmi_Module_Formulation::last_model_response_delta
time_step_t last_model_response_delta
The delta of the last model update execution (typically, this is time step size).
Definition: Bmi_Module_Formulation.hpp:955
+
realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update
void set_model_inputs_prior_to_update(const double &model_init_time, time_step_t t_delta)
Set BMI input variable values for the model appropriately prior to calling its BMIupdate()``.
Definition: Bmi_Module_Formulation.hpp:895
+
realization::Bmi_Module_Formulation::get_bmi_input_variables
const std::vector< std::string > get_bmi_input_variables() override
Definition: Bmi_Module_Formulation.hpp:359
+
realization::Bmi_Module_Formulation::bmi_model
std::shared_ptr< M > bmi_model
Definition: Bmi_Module_Formulation.hpp:979
+
realization::Bmi_Module_Formulation::last_model_response_start_time
time_t last_model_response_start_time
The epoch time of the model at the beginning of its last update.
Definition: Bmi_Module_Formulation.hpp:957
+
realization::Bmi_Module_Formulation::get_model_current_time
const double get_model_current_time() override
Get the current time for the backing BMI model in its native format and units.
Definition: Bmi_Module_Formulation.hpp:141
+
realization::Bmi_Module_Formulation::set_forcing_file_path
void set_forcing_file_path(const std::string &forcing_path)
Definition: Bmi_Module_Formulation.hpp:759
+
realization::Bmi_Module_Formulation::get_variable_time_begin
time_t get_variable_time_begin(const std::string &variable_name)
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Module_Formulation.hpp:93
realization::Bmi_Module_Formulation::create_formulation
void create_formulation(geojson::PropertyMap properties) override
Definition: Bmi_Module_Formulation.hpp:56
-
realization::Bmi_Module_Formulation::get_bmi_output_var_name
void get_bmi_output_var_name(const std::string &name, std::string &bmi_var_name)
Get correct BMI variable name, which may be the output or something mapped to this output.
Definition: Bmi_Module_Formulation.hpp:382
-
realization::Bmi_Module_Formulation::get_allow_model_exceed_end_time
const bool & get_allow_model_exceed_end_time() const override
Get whether a model may perform updates beyond its end_time.
Definition: Bmi_Module_Formulation.hpp:448
-
realization::Bmi_Module_Formulation::get_ts_index_for_time
size_t get_ts_index_for_time(const time_t &epoch_time) override
Get the index of the forcing time step that contains the given point in time.
Definition: Bmi_Module_Formulation.hpp:198
-
realization::Bmi_Module_Formulation::is_bmi_using_forcing_file
bool is_bmi_using_forcing_file() const override
Whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Module_Formulation.hpp:719
-
realization::Bmi_Module_Formulation::get_required_parameters
const std::vector< std::string > & get_required_parameters() override
Definition: Bmi_Module_Formulation.hpp:159
+
realization::Bmi_Module_Formulation::get_bmi_output_var_name
void get_bmi_output_var_name(const std::string &name, std::string &bmi_var_name)
Get correct BMI variable name, which may be the output or something mapped to this output.
Definition: Bmi_Module_Formulation.hpp:375
+
realization::Bmi_Module_Formulation::get_allow_model_exceed_end_time
const bool & get_allow_model_exceed_end_time() const override
Get whether a model may perform updates beyond its end_time.
Definition: Bmi_Module_Formulation.hpp:441
+
realization::Bmi_Module_Formulation::get_ts_index_for_time
size_t get_ts_index_for_time(const time_t &epoch_time) override
Get the index of the forcing time step that contains the given point in time.
Definition: Bmi_Module_Formulation.hpp:193
+
realization::Bmi_Module_Formulation::is_bmi_using_forcing_file
bool is_bmi_using_forcing_file() const override
Whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Module_Formulation.hpp:712
+
realization::Bmi_Module_Formulation::get_required_parameters
const std::vector< std::string > & get_required_parameters() override
Definition: Bmi_Module_Formulation.hpp:154
realization::Bmi_Module_Formulation::create_formulation
void create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr) override
Definition: Bmi_Module_Formulation.hpp:51
-
realization::Bmi_Module_Formulation::get_bmi_output_variables
const std::vector< std::string > get_bmi_output_variables() override
Definition: Bmi_Module_Formulation.hpp:370
-
realization::Bmi_Module_Formulation::set_model_initialized
virtual void set_model_initialized(bool is_initialized)
Set whether the backing model object has been initialize using the BMI standard Initialize function.
Definition: Bmi_Module_Formulation.hpp:775
+
realization::Bmi_Module_Formulation::get_bmi_output_variables
const std::vector< std::string > get_bmi_output_variables() override
Definition: Bmi_Module_Formulation.hpp:363
+
realization::Bmi_Module_Formulation::set_model_initialized
virtual void set_model_initialized(bool is_initialized)
Set whether the backing model object has been initialize using the BMI standard Initialize function.
Definition: Bmi_Module_Formulation.hpp:768
realization::Bmi_Module_Formulation::get_var_value_as_double
virtual double get_var_value_as_double(const int &index, const std::string &var_name)=0
Get value for some BMI model variable at a specific index.
-
realization::Bmi_Module_Formulation::forcing_file_path
std::string forcing_file_path
Definition: Bmi_Module_Formulation.hpp:998
+
realization::Bmi_Module_Formulation::forcing_file_path
std::string forcing_file_path
Definition: Bmi_Module_Formulation.hpp:991
realization::Bmi_Module_Formulation::Bmi_Module_Formulation
Bmi_Module_Formulation(std::string id, std::shared_ptr< data_access::GenericDataProvider > forcing_provider, utils::StreamHandler output_stream)
Minimal constructor for objects initialize using the Formulation_Manager and subsequent calls to crea...
Definition: Bmi_Module_Formulation.hpp:46
-
realization::Bmi_Module_Formulation::model_initialized
bool model_initialized
Definition: Bmi_Module_Formulation.hpp:999
-
realization::Bmi_Module_Formulation::bmi_init_config
std::string bmi_init_config
Definition: Bmi_Module_Formulation.hpp:985
-
realization::Bmi_Module_Formulation::input_forcing_providers
std::map< std::string, std::shared_ptr< data_access::GenericDataProvider > > input_forcing_providers
Definition: Bmi_Module_Formulation.hpp:965
-
realization::Bmi_Module_Formulation::set_bmi_init_config
void set_bmi_init_config(const std::string &init_config)
Definition: Bmi_Module_Formulation.hpp:736
-
realization::Bmi_Module_Formulation::get_values
std::vector< double > get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m=SUM) override
Get the 1D values of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Module_Formulation.hpp:214
+
realization::Bmi_Module_Formulation::model_initialized
bool model_initialized
Definition: Bmi_Module_Formulation.hpp:992
+
realization::Bmi_Module_Formulation::bmi_init_config
std::string bmi_init_config
Definition: Bmi_Module_Formulation.hpp:978
+
realization::Bmi_Module_Formulation::input_forcing_providers
std::map< std::string, std::shared_ptr< data_access::GenericDataProvider > > input_forcing_providers
Definition: Bmi_Module_Formulation.hpp:958
+
realization::Bmi_Module_Formulation::set_bmi_init_config
void set_bmi_init_config(const std::string &init_config)
Definition: Bmi_Module_Formulation.hpp:729
+
realization::Bmi_Module_Formulation::get_values
std::vector< double > get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m=SUM) override
Get the 1D values of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Module_Formulation.hpp:209
realization::Bmi_Module_Formulation::construct_model
virtual std::shared_ptr< M > construct_model(const geojson::PropertyMap &properties)=0
Construct model and its shared pointer, potentially supplying input variable values from config.
-
realization::Bmi_Module_Formulation::set_bmi_model_start_time_forcing_offset_s
void set_bmi_model_start_time_forcing_offset_s(const time_t &offset_s)
Definition: Bmi_Module_Formulation.hpp:749
+
realization::Bmi_Module_Formulation::set_bmi_model_start_time_forcing_offset_s
void set_bmi_model_start_time_forcing_offset_s(const time_t &offset_s)
Definition: Bmi_Module_Formulation.hpp:742
realization::Bmi_Multi_Formulation
Abstraction of a formulation with multiple backing model object that implements the BMI.
Definition: Bmi_Multi_Formulation.hpp:24
realization::Catchment_Formulation::get_catchment_id
std::string get_catchment_id() override
Definition: Catchment_Formulation.hpp:95
realization::Formulation::get_formulation_type
virtual std::string get_formulation_type()=0
@@ -970,9 +964,9 @@
realization::Formulation::validate_parameters
virtual void validate_parameters(geojson::PropertyMap options)
Definition: Formulation.hpp:122
realization::Formulation::time_step_t
long time_step_t
Definition: Formulation.hpp:21
utils::StreamHandler
This class provides a copyable interface to a std::ostream or std::ostream like object that may not s...
Definition: StreamHandler.hpp:14
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
-
data_access::SUM
@ SUM
Definition: DataProvider.hpp:18
-
data_access::MEAN
@ MEAN
Definition: DataProvider.hpp:17
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
+
data_access::SUM
@ SUM
Definition: DataProvider.hpp:19
+
data_access::MEAN
@ MEAN
Definition: DataProvider.hpp:18
geojson::get_propertytype_name
static std::string get_propertytype_name(PropertyType &&property_type)
Definition: JSONProperty.hpp:144
geojson::PropertyMap
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition: JSONProperty.hpp:21
geojson::PropertyType::Natural
@ Natural
@@ -985,7 +979,7 @@ diff --git a/_bmi___multi___formulation_8hpp_source.html b/_bmi___multi___formulation_8hpp_source.html index d8effa1cbd..56d3df37f6 100644 --- a/_bmi___multi___formulation_8hpp_source.html +++ b/_bmi___multi___formulation_8hpp_source.html @@ -143,372 +143,370 @@
87
103 const bool &get_allow_model_exceed_end_time() const override;
104
-
119 //const vector<std::string> &get_available_forcing_outputs();
-
120 //const vector<std::string> &get_available_variable_names() override { return get_available_forcing_outputs(); }
-
121 const std::vector<std::string> &get_available_variable_names() override;
-
122
-
129 const std::vector<std::string> get_bmi_input_variables() override {
-
130 return modules[0]->get_bmi_input_variables();
-
131 }
+
119 boost::span <const std::string> get_available_variable_names() override;
+
120
+
127 const std::vector<std::string> get_bmi_input_variables() override {
+
128 return modules[0]->get_bmi_input_variables();
+
129 }
+
130
+
131 const time_t &get_bmi_model_start_time_forcing_offset_s() override;
132
-
133 const time_t &get_bmi_model_start_time_forcing_offset_s() override;
-
134
-
140 const std::vector<std::string> get_bmi_output_variables() override {
-
141 return modules.back()->get_bmi_output_variables();
-
142 }
-
143
-
164 const std::string &get_config_mapped_variable_name(const std::string &model_var_name) override;
-
165
-
182 const std::string &get_config_mapped_variable_name(const std::string &model_var_name, bool check_first, bool check_last);
-
183
-
208 const std::string &get_config_mapped_variable_name(const std::string &output_var_name,
-
209 const shared_ptr<Bmi_Formulation>& out_module,
-
210 const shared_ptr<Bmi_Formulation>& in_module);
+
138 const std::vector<std::string> get_bmi_output_variables() override {
+
139 return modules.back()->get_bmi_output_variables();
+
140 }
+
141
+
162 const std::string &get_config_mapped_variable_name(const std::string &model_var_name) override;
+
163
+
180 const std::string &get_config_mapped_variable_name(const std::string &model_var_name, bool check_first, bool check_last);
+
181
+
206 const std::string &get_config_mapped_variable_name(const std::string &output_var_name,
+
207 const shared_ptr<Bmi_Formulation>& out_module,
+
208 const shared_ptr<Bmi_Formulation>& in_module);
+
209
+
210 const std::string &get_forcing_file_path() const override;
211
-
212 const std::string &get_forcing_file_path() const override;
-
213
-
225 long get_data_start_time() override
-
226 {
-
227 return get_variable_time_begin("");
-
228 }
-
229
-
240 time_t get_variable_time_begin(const std::string &variable_name) {
-
241 std::string var_name = variable_name;
-
242 // when unspecified, assume all data is available for the same range.
-
243 // If no var_name, use forcing ...
-
244 if(var_name == "*" || var_name == ""){
-
245 return forcing->get_data_start_time();
-
246 }
-
247 // If not found ...
-
248 if (availableData.empty() || availableData.find(var_name) == availableData.end()) {
-
249 throw std::runtime_error(get_formulation_type() + " cannot get output time for unknown \"" + variable_name + "\"");
-
250 }
-
251 return availableData[var_name]->get_data_start_time();
-
252 }
-
253
-
264 long get_data_stop_time() override
-
265 {
-
266 return get_variable_time_end("");
-
267 }
-
268
-
278 //time_t get_forcing_output_time_end(const std::string &forcing_name) {
-
279 time_t get_variable_time_end(const std::string &variable_name) {
-
280 // when unspecified, assume all data is available for the same range.
-
281 // If no var_name, use forcing ...
-
282 std::string var_name = variable_name;
-
283 if(var_name == "*" || var_name == ""){
-
284 return forcing->get_data_stop_time();
-
285 }
-
286 // If not found ...
-
287 if (availableData.empty() || availableData.find(var_name) == availableData.end()) {
-
288 throw std::runtime_error(get_formulation_type() + " cannot get output time for unknown \"" + variable_name + "\"");
-
289 }
-
290 return availableData[var_name]->get_data_stop_time();
-
291 }
-
292
-
293 long record_duration() override
-
294 {
-
295 std::string var_name;
-
296 for(std::map<std::string,std::shared_ptr<data_access::GenericDataProvider>>::iterator iter = availableData.begin(); iter != availableData.end(); ++iter)
-
297 {
-
298 var_name = iter->first;
-
299 //TODO: Find a probably more performant way than trial and exception here.
-
300 try {
-
301 time_t rv = availableData[var_name]->record_duration();
-
302 return rv;
-
303 }
-
304 catch (...){
-
305 continue;
-
306 }
-
307 break;
-
308 }
-
309
-
310 // If not found ...
-
311 if (availableData.empty() || availableData.find(var_name) == availableData.end()) {
-
312 throw std::runtime_error(get_formulation_type() + " cannot get output record duration for unknown \"" + var_name + "\"");
-
313 }
-
314 return availableData[var_name]->record_duration();
-
315 }
-
316
-
317 std::string get_formulation_type() override {
-
318 return "bmi_multi";
-
319 }
-
320
-
326 const double get_model_current_time() override {
-
327 return modules[get_index_for_primary_module()]->get_model_current_time();
-
328 }
-
329
-
335 const double get_model_end_time() override {
-
336 return modules[get_index_for_primary_module()]->get_model_end_time();
-
337 }
-
338
-
344 const double get_model_start_time() {
-
345 return modules[get_index_for_primary_module()]->get_data_start_time();
-
346 }
+
223 long get_data_start_time() override
+
224 {
+
225 return get_variable_time_begin("");
+
226 }
+
227
+
238 time_t get_variable_time_begin(const std::string &variable_name) {
+
239 std::string var_name = variable_name;
+
240 // when unspecified, assume all data is available for the same range.
+
241 // If no var_name, use forcing ...
+
242 if(var_name == "*" || var_name == ""){
+
243 return forcing->get_data_start_time();
+
244 }
+
245 // If not found ...
+
246 if (availableData.empty() || availableData.find(var_name) == availableData.end()) {
+
247 throw std::runtime_error(get_formulation_type() + " cannot get output time for unknown \"" + variable_name + "\"");
+
248 }
+
249 return availableData[var_name]->get_data_start_time();
+
250 }
+
251
+
262 long get_data_stop_time() override
+
263 {
+
264 return get_variable_time_end("");
+
265 }
+
266
+
276 //time_t get_forcing_output_time_end(const std::string &forcing_name) {
+
277 time_t get_variable_time_end(const std::string &variable_name) {
+
278 // when unspecified, assume all data is available for the same range.
+
279 // If no var_name, use forcing ...
+
280 std::string var_name = variable_name;
+
281 if(var_name == "*" || var_name == ""){
+
282 return forcing->get_data_stop_time();
+
283 }
+
284 // If not found ...
+
285 if (availableData.empty() || availableData.find(var_name) == availableData.end()) {
+
286 throw std::runtime_error(get_formulation_type() + " cannot get output time for unknown \"" + variable_name + "\"");
+
287 }
+
288 return availableData[var_name]->get_data_stop_time();
+
289 }
+
290
+
291 long record_duration() override
+
292 {
+
293 std::string var_name;
+
294 for(std::map<std::string,std::shared_ptr<data_access::GenericDataProvider>>::iterator iter = availableData.begin(); iter != availableData.end(); ++iter)
+
295 {
+
296 var_name = iter->first;
+
297 //TODO: Find a probably more performant way than trial and exception here.
+
298 try {
+
299 time_t rv = availableData[var_name]->record_duration();
+
300 return rv;
+
301 }
+
302 catch (...){
+
303 continue;
+
304 }
+
305 break;
+
306 }
+
307
+
308 // If not found ...
+
309 if (availableData.empty() || availableData.find(var_name) == availableData.end()) {
+
310 throw std::runtime_error(get_formulation_type() + " cannot get output record duration for unknown \"" + var_name + "\"");
+
311 }
+
312 return availableData[var_name]->record_duration();
+
313 }
+
314
+
315 std::string get_formulation_type() override {
+
316 return "bmi_multi";
+
317 }
+
318
+
324 const double get_model_current_time() override {
+
325 return modules[get_index_for_primary_module()]->get_model_current_time();
+
326 }
+
327
+
333 const double get_model_end_time() override {
+
334 return modules[get_index_for_primary_module()]->get_model_end_time();
+
335 }
+
336
+
342 const double get_model_start_time() {
+
343 return modules[get_index_for_primary_module()]->get_data_start_time();
+
344 }
+
345
+
346 std::string get_output_line_for_timestep(int timestep, std::string delimiter) override;
347
-
348 std::string get_output_line_for_timestep(int timestep, std::string delimiter) override;
+
348 double get_response(time_step_t t_index, time_step_t t_delta) override;
349
-
350 double get_response(time_step_t t_index, time_step_t t_delta) override;
-
351
-
365 size_t get_ts_index_for_time(const time_t &epoch_time) override {
-
366 // TODO: come back and implement if actually necessary for this type; for now don't use
-
367 throw std::runtime_error("Bmi_Multi_Formulation does not yet implement get_ts_index_for_time");
-
368 }
-
369
-
391 double get_value(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override
-
392 {
-
393 std::string output_name = selector.get_variable_name();
-
394 time_t init_time = selector.get_init_time();
-
395 long duration_s = selector.get_duration_secs();
-
396 std::string output_units = selector.get_output_units();
-
397
-
398 // If not found ...
-
399 if (availableData.empty() || availableData.find(output_name) == availableData.end()) {
-
400 throw std::runtime_error(get_formulation_type() + " cannot get output value for unknown " + output_name + SOURCE_LOC);
-
401 }
-
402 return availableData[output_name]->get_value(CatchmentAggrDataSelector(this->get_catchment_id(),output_name, init_time, duration_s, output_units), m);
-
403 }
-
404
-
405 std::vector<double> get_values(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override
-
406 {
-
407 std::string output_name = selector.get_variable_name();
-
408 time_t init_time = selector.get_init_time();
-
409 long duration_s = selector.get_duration_secs();
-
410 std::string output_units = selector.get_output_units();
-
411
-
412 if (availableData.empty() || availableData.find(output_name) == availableData.end()) {
-
413 throw std::runtime_error(get_formulation_type() + " cannot get output values for unknown " + output_name + SOURCE_LOC);
-
414 }
-
415 return availableData[output_name]->get_values(CatchmentAggrDataSelector(this->get_catchment_id(),output_name, init_time, duration_s, output_units), m);
-
416 }
+
363 size_t get_ts_index_for_time(const time_t &epoch_time) override {
+
364 // TODO: come back and implement if actually necessary for this type; for now don't use
+
365 throw std::runtime_error("Bmi_Multi_Formulation does not yet implement get_ts_index_for_time");
+
366 }
+
367
+
389 double get_value(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override
+
390 {
+
391 std::string output_name = selector.get_variable_name();
+
392 time_t init_time = selector.get_init_time();
+
393 long duration_s = selector.get_duration_secs();
+
394 std::string output_units = selector.get_output_units();
+
395
+
396 // If not found ...
+
397 if (availableData.empty() || availableData.find(output_name) == availableData.end()) {
+
398 throw std::runtime_error(get_formulation_type() + " cannot get output value for unknown " + output_name + SOURCE_LOC);
+
399 }
+
400 return availableData[output_name]->get_value(CatchmentAggrDataSelector(this->get_catchment_id(),output_name, init_time, duration_s, output_units), m);
+
401 }
+
402
+
403 std::vector<double> get_values(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override
+
404 {
+
405 std::string output_name = selector.get_variable_name();
+
406 time_t init_time = selector.get_init_time();
+
407 long duration_s = selector.get_duration_secs();
+
408 std::string output_units = selector.get_output_units();
+
409
+
410 if (availableData.empty() || availableData.find(output_name) == availableData.end()) {
+
411 throw std::runtime_error(get_formulation_type() + " cannot get output values for unknown " + output_name + SOURCE_LOC);
+
412 }
+
413 return availableData[output_name]->get_values(CatchmentAggrDataSelector(this->get_catchment_id(),output_name, init_time, duration_s, output_units), m);
+
414 }
+
415
+
416 bool is_bmi_input_variable(const std::string &var_name) override;
417
-
418 bool is_bmi_input_variable(const std::string &var_name) override;
-
419
-
425 bool is_bmi_model_time_step_fixed() override;
+
423 bool is_bmi_model_time_step_fixed() override;
+
424
+
425 bool is_bmi_output_variable(const std::string &var_name) override;
426
-
427 bool is_bmi_output_variable(const std::string &var_name) override;
+
427 bool is_bmi_using_forcing_file() const override;
428
-
429 bool is_bmi_using_forcing_file() const override;
-
430
-
436 bool is_model_initialized() override;
-
437
-
456 bool is_property_sum_over_time_step(const std::string &name) override {
-
457 if (availableData.empty() || availableData.find(name) == availableData.end()) {
-
458 throw std::runtime_error(
-
459 get_formulation_type() + " cannot get whether unknown property " + name + " is summation");
-
460 }
-
461 return availableData[name]->is_property_sum_over_time_step(name);
-
462 }
-
463
-
470 bool is_time_step_beyond_end_time(time_step_t t_index);
-
471
-
477 inline int get_index_for_primary_module() {
-
478 return primary_module_index;
-
479 }
-
480
-
489 inline void set_index_for_primary_module(int index) {
-
490 if (index < modules.size()) {
-
491 primary_module_index = index;
-
492 }
-
493 }
-
494
-
498 void check_output_var_names() {
-
499 // variable already checked
-
500 if (is_out_vars_from_last_mod) {
-
501 return;
-
502 }
-
503
-
504 // get bmi_multi global output variable names
-
505 const std::vector<std::string> &output_var_names = get_output_variable_names();
-
506
-
507 // store variable names in avaialbleData in the valid output variable name list
-
508 std::vector<std::string> available_var_names;
-
509 std::string var_name;
-
510 for(std::map<std::string,std::shared_ptr<data_access::GenericDataProvider>>::iterator iter = availableData.begin(); iter != availableData.end(); ++iter)
-
511 {
-
512 var_name = iter->first;
-
513 available_var_names.push_back(var_name);
-
514 }
-
515
-
516 // check if an output variable listed in the bmi_multi global is a valid variable
-
517 for (int i = 0; i < output_var_names.size(); ++i) {
-
518 auto it = std::find(available_var_names.begin(), available_var_names.end(), output_var_names[i]);
-
519 if (it == available_var_names.end()) {
-
520 throw std::runtime_error(output_var_names[i] + " does not exist in the output name list" + SOURCE_LOC);
-
521 }
-
522 }
-
523 }
+
434 bool is_model_initialized() override;
+
435
+
454 bool is_property_sum_over_time_step(const std::string &name) override {
+
455 if (availableData.empty() || availableData.find(name) == availableData.end()) {
+
456 throw std::runtime_error(
+
457 get_formulation_type() + " cannot get whether unknown property " + name + " is summation");
+
458 }
+
459 return availableData[name]->is_property_sum_over_time_step(name);
+
460 }
+
461
+
468 bool is_time_step_beyond_end_time(time_step_t t_index);
+
469
+
475 inline int get_index_for_primary_module() {
+
476 return primary_module_index;
+
477 }
+
478
+
487 inline void set_index_for_primary_module(int index) {
+
488 if (index < modules.size()) {
+
489 primary_module_index = index;
+
490 }
+
491 }
+
492
+
496 void check_output_var_names() {
+
497 // variable already checked
+
498 if (is_out_vars_from_last_mod) {
+
499 return;
+
500 }
+
501
+
502 // get bmi_multi global output variable names
+
503 const std::vector<std::string> &output_var_names = get_output_variable_names();
+
504
+
505 // store variable names in avaialbleData in the valid output variable name list
+
506 std::vector<std::string> available_var_names;
+
507 std::string var_name;
+
508 for(std::map<std::string,std::shared_ptr<data_access::GenericDataProvider>>::iterator iter = availableData.begin(); iter != availableData.end(); ++iter)
+
509 {
+
510 var_name = iter->first;
+
511 available_var_names.push_back(var_name);
+
512 }
+
513
+
514 // check if an output variable listed in the bmi_multi global is a valid variable
+
515 for (int i = 0; i < output_var_names.size(); ++i) {
+
516 auto it = std::find(available_var_names.begin(), available_var_names.end(), output_var_names[i]);
+
517 if (it == available_var_names.end()) {
+
518 throw std::runtime_error(output_var_names[i] + " does not exist in the output name list" + SOURCE_LOC);
+
519 }
+
520 }
+
521 }
+
522
+
523 protected:
524
-
525 protected:
-
526
-
533 void create_multi_formulation(geojson::PropertyMap properties, bool needs_param_validation);
-
534
-
535 template<class T>
-
536 double get_module_var_value_as_double(const std::string &var_name, std::shared_ptr<Bmi_Formulation> mod) {
-
537 std::shared_ptr<T> module = std::static_pointer_cast<T>(mod);
-
538 return module->get_var_value_as_double(var_name);
-
539 }
-
540
-
551 double get_var_value_as_double(const std::string &var_name) {
-
552 return get_var_value_as_double(0, var_name);
-
553 }
-
554
-
579 double get_var_value_as_double(const int& index, const std::string& var_name) {
-
580 auto data_provider_iter = availableData.find(var_name);
-
581 if (data_provider_iter == availableData.end()) {
-
582 throw external::ExternalIntegrationException(
-
583 "Multi BMI formulation can't find correct nested module for BMI variable " + var_name + SOURCE_LOC);
-
584 }
-
585 // Otherwise, we have a provider, and we can cast it based on the documented assumptions
-
586 try {
-
587 std::shared_ptr <data_access::GenericDataProvider> nested_module =
-
588 std::dynamic_pointer_cast<data_access::GenericDataProvider>(data_provider_iter->second);
-
589 long nested_module_time = nested_module->get_data_start_time() + ( this->get_model_current_time() - this->get_model_start_time() );
-
590 auto selector = CatchmentAggrDataSelector(this->get_catchment_id(),var_name,nested_module_time,this->record_duration(),"1");
-
591 //TODO: After merge PR#405, try re-adding support for index
-
592 return nested_module->get_value(selector);
-
593 }
-
594 // If there was any problem with the cast and extraction of the value, throw runtime error
-
595 catch (std::exception &e) {
-
596 throw std::runtime_error("Multi BMI formulation can't use associated data provider as a nested module"
-
597 " when attempting to get values of BMI variable " + var_name + SOURCE_LOC);
-
598 // TODO: look at adjusting defs to move this function up in class hierarchy (or at least add TODO there)
-
599 }
-
600 }
-
601
-
611 inline void init_deferred_associations() {
-
612 for (int d = 0; d < deferredProviders.size(); ++d) {
-
613 std::shared_ptr<data_access::OptionalWrappedDataProvider> &deferredProvider = deferredProviders[d];
-
614 // Skip doing anything for any deferred provider that already has its backing provider set
-
615 if (deferredProvider->isWrappedProviderSet())
-
616 continue;
-
617
-
618 // TODO: improve this later; since defaults can be used, it is technically possible to grab something
-
619 // valid when something more appropriate would later be available
-
620 // Iterate through available data providers and set association once a sufficient one is found
-
621 std::map<std::string, std::shared_ptr<data_access::GenericDataProvider>>::iterator avail_it;
-
622 for (avail_it = availableData.begin(); avail_it != availableData.end(); avail_it++) {
-
623 // If this satisfies everything this deferred provider needs to provide, and thus can be/was set ...
-
624 if (deferredProvider->setWrappedProvider(avail_it->second.get())) {
-
625 break;
-
626 }
-
627 }
-
628
-
629 // If none of the available data providers could be used for this deferred one, throw exception
-
630 if (!deferredProvider->isWrappedProviderSet()) {
-
631 // TODO: this probably needs to be some kind of custom configuration exception
-
632 std::string msg = "Multi BMI formulation cannot be created from config: cannot find available data "
-
633 "provider to satisfy set of deferred provisions for nested module at index "
-
634 + std::to_string(deferredProviderModuleIndices[d]) + ": {";
-
635 // There must always be at least 1; get manually to help with formatting
-
636 msg += deferredProvider->get_available_variable_names()[0];
-
637 // And here make sure to start at 1 instead of 0
-
638 for (int i = 1; i < deferredProvider->get_available_variable_names().size(); ++i)
-
639 msg += ", " + deferredProvider->get_available_variable_names()[i];
-
640 msg += "}";
-
641 throw realization::ConfigurationException(msg);
-
642 }
-
643 }
-
644 }
-
645
-
661 template<class T>
-
662 std::shared_ptr<T> init_nested_module(int mod_index, std::string identifier, geojson::PropertyMap properties) {
-
663 std::shared_ptr<data_access::GenericDataProvider> wfp = std::make_shared<data_access::WrappedDataProvider>(this);
-
664 std::shared_ptr<T> mod = std::make_shared<T>(identifier, wfp, output);
-
665
-
666 // Since this is a nested formulation, support usage of the '{{id}}' syntax for init config file paths.
-
667 Catchment_Formulation::config_pattern_substitution(properties, BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG,
-
668 "{{id}}", id);
-
669
-
670 // Call create_formulation to perform the rest of the typical initialization steps for the formulation.
-
671 mod->create_formulation(properties);
-
672
-
673 // Set this up for placing in the module_variable_maps member variable
-
674 std::shared_ptr<std::map<std::string, std::string>> var_aliases;
-
675 var_aliases = std::make_shared<std::map<std::string, std::string>>(std::map<std::string, std::string>());
-
676 for (const std::string &var_name : mod->get_bmi_input_variables()) {
-
677 std::string framework_alias = mod->get_config_mapped_variable_name(var_name);
-
678 (*var_aliases)[framework_alias] = var_name;
-
679 // If framework_name is not yet in collection from which we have available data sources ...
-
680 if (availableData.count(framework_alias) != 1) {
-
681 setup_nested_deferred_provider(var_name, framework_alias, mod, mod_index);
-
682 }
-
683 else {
-
684 mod->input_forcing_providers[var_name] = availableData[framework_alias];
-
685 mod->input_forcing_providers[framework_alias] = availableData[framework_alias];
-
686 }
-
687 }
-
688
-
689 // Also add the output variable aliases
-
690 for (const std::string &var_name : mod->get_bmi_output_variables()) {
-
691 std::string framework_alias = mod->get_config_mapped_variable_name(var_name);
-
692 (*var_aliases)[framework_alias] = var_name;
-
693 if (availableData.count(framework_alias) > 0) {
-
694 throw std::runtime_error(
-
695 "Multi BMI cannot be created with module " + mod->get_model_type_name() +
-
696 " with output variable " + framework_alias +
-
697 (var_name == framework_alias ? "" : " (an alias of BMI variable " + var_name + ")") +
-
698 " because a previous module is using this output variable name/alias.");
-
699 }
-
700 availableData[framework_alias] = mod;
-
701 }
-
702 module_variable_maps[mod_index] = var_aliases;
-
703 return mod;
-
704 }
-
705
-
714 std::map<std::string, std::shared_ptr<data_access::GenericDataProvider>> availableData;
+
531 void create_multi_formulation(geojson::PropertyMap properties, bool needs_param_validation);
+
532
+
533 template<class T>
+
534 double get_module_var_value_as_double(const std::string &var_name, std::shared_ptr<Bmi_Formulation> mod) {
+
535 std::shared_ptr<T> module = std::static_pointer_cast<T>(mod);
+
536 return module->get_var_value_as_double(var_name);
+
537 }
+
538
+
549 double get_var_value_as_double(const std::string &var_name) {
+
550 return get_var_value_as_double(0, var_name);
+
551 }
+
552
+
577 double get_var_value_as_double(const int& index, const std::string& var_name) {
+
578 auto data_provider_iter = availableData.find(var_name);
+
579 if (data_provider_iter == availableData.end()) {
+
580 throw external::ExternalIntegrationException(
+
581 "Multi BMI formulation can't find correct nested module for BMI variable " + var_name + SOURCE_LOC);
+
582 }
+
583 // Otherwise, we have a provider, and we can cast it based on the documented assumptions
+
584 try {
+
585 std::shared_ptr <data_access::GenericDataProvider> nested_module =
+
586 std::dynamic_pointer_cast<data_access::GenericDataProvider>(data_provider_iter->second);
+
587 long nested_module_time = nested_module->get_data_start_time() + ( this->get_model_current_time() - this->get_model_start_time() );
+
588 auto selector = CatchmentAggrDataSelector(this->get_catchment_id(),var_name,nested_module_time,this->record_duration(),"1");
+
589 //TODO: After merge PR#405, try re-adding support for index
+
590 return nested_module->get_value(selector);
+
591 }
+
592 // If there was any problem with the cast and extraction of the value, throw runtime error
+
593 catch (std::exception &e) {
+
594 throw std::runtime_error("Multi BMI formulation can't use associated data provider as a nested module"
+
595 " when attempting to get values of BMI variable " + var_name + SOURCE_LOC);
+
596 // TODO: look at adjusting defs to move this function up in class hierarchy (or at least add TODO there)
+
597 }
+
598 }
+
599
+
609 inline void init_deferred_associations() {
+
610 for (int d = 0; d < deferredProviders.size(); ++d) {
+
611 std::shared_ptr<data_access::OptionalWrappedDataProvider> &deferredProvider = deferredProviders[d];
+
612 // Skip doing anything for any deferred provider that already has its backing provider set
+
613 if (deferredProvider->isWrappedProviderSet())
+
614 continue;
+
615
+
616 // TODO: improve this later; since defaults can be used, it is technically possible to grab something
+
617 // valid when something more appropriate would later be available
+
618 // Iterate through available data providers and set association once a sufficient one is found
+
619 std::map<std::string, std::shared_ptr<data_access::GenericDataProvider>>::iterator avail_it;
+
620 for (avail_it = availableData.begin(); avail_it != availableData.end(); avail_it++) {
+
621 // If this satisfies everything this deferred provider needs to provide, and thus can be/was set ...
+
622 if (deferredProvider->setWrappedProvider(avail_it->second.get())) {
+
623 break;
+
624 }
+
625 }
+
626
+
627 // If none of the available data providers could be used for this deferred one, throw exception
+
628 if (!deferredProvider->isWrappedProviderSet()) {
+
629 // TODO: this probably needs to be some kind of custom configuration exception
+
630 std::string msg = "Multi BMI formulation cannot be created from config: cannot find available data "
+
631 "provider to satisfy set of deferred provisions for nested module at index "
+
632 + std::to_string(deferredProviderModuleIndices[d]) + ": {";
+
633 // There must always be at least 1; get manually to help with formatting
+
634 msg += deferredProvider->get_available_variable_names()[0];
+
635 // And here make sure to start at 1 instead of 0
+
636 for (int i = 1; i < deferredProvider->get_available_variable_names().size(); ++i)
+
637 msg += ", " + deferredProvider->get_available_variable_names()[i];
+
638 msg += "}";
+
639 throw realization::ConfigurationException(msg);
+
640 }
+
641 }
+
642 }
+
643
+
659 template<class T>
+
660 std::shared_ptr<T> init_nested_module(int mod_index, std::string identifier, geojson::PropertyMap properties) {
+
661 std::shared_ptr<data_access::GenericDataProvider> wfp = std::make_shared<data_access::WrappedDataProvider>(this);
+
662 std::shared_ptr<T> mod = std::make_shared<T>(identifier, wfp, output);
+
663
+
664 // Since this is a nested formulation, support usage of the '{{id}}' syntax for init config file paths.
+
665 Catchment_Formulation::config_pattern_substitution(properties, BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG,
+
666 "{{id}}", id);
+
667
+
668 // Call create_formulation to perform the rest of the typical initialization steps for the formulation.
+
669 mod->create_formulation(properties);
+
670
+
671 // Set this up for placing in the module_variable_maps member variable
+
672 std::shared_ptr<std::map<std::string, std::string>> var_aliases;
+
673 var_aliases = std::make_shared<std::map<std::string, std::string>>(std::map<std::string, std::string>());
+
674 for (const std::string &var_name : mod->get_bmi_input_variables()) {
+
675 std::string framework_alias = mod->get_config_mapped_variable_name(var_name);
+
676 (*var_aliases)[framework_alias] = var_name;
+
677 // If framework_name is not yet in collection from which we have available data sources ...
+
678 if (availableData.count(framework_alias) != 1) {
+
679 setup_nested_deferred_provider(var_name, framework_alias, mod, mod_index);
+
680 }
+
681 else {
+
682 mod->input_forcing_providers[var_name] = availableData[framework_alias];
+
683 mod->input_forcing_providers[framework_alias] = availableData[framework_alias];
+
684 }
+
685 }
+
686
+
687 // Also add the output variable aliases
+
688 for (const std::string &var_name : mod->get_bmi_output_variables()) {
+
689 std::string framework_alias = mod->get_config_mapped_variable_name(var_name);
+
690 (*var_aliases)[framework_alias] = var_name;
+
691 if (availableData.count(framework_alias) > 0) {
+
692 throw std::runtime_error(
+
693 "Multi BMI cannot be created with module " + mod->get_model_type_name() +
+
694 " with output variable " + framework_alias +
+
695 (var_name == framework_alias ? "" : " (an alias of BMI variable " + var_name + ")") +
+
696 " because a previous module is using this output variable name/alias.");
+
697 }
+
698 availableData[framework_alias] = mod;
+
699 }
+
700 module_variable_maps[mod_index] = var_aliases;
+
701 return mod;
+
702 }
+
703
+
712 std::map<std::string, std::shared_ptr<data_access::GenericDataProvider>> availableData;
+
713
+
714 private:
715
-
716 private:
-
717
-
733 template<class T>
-
734 void setup_nested_deferred_provider(const std::string &bmi_input_var_name,
-
735 const std::string &framework_output_name,
-
736 std::shared_ptr<T> mod,
-
737 int mod_index) {
-
738 // TODO: probably don't actually need bmi_input_var_name, and just can deal with framework_output_name
-
739 // Create deferred, optional provider for providing this
-
740 // Only include BMI variable name, as that's what'll be visible when associating to backing provider
-
741 // It's "deferred" in that we'll set the backing later.
-
742 // It's "optional" in that it waits to use backing provider, using the default some number of times
-
743 std::shared_ptr<data_access::OptionalWrappedDataProvider> provider;
-
744 // TODO: make sure only alias is needed
-
745 auto defs_it = default_output_values.find(framework_output_name);
-
746 if (defs_it != default_output_values.end()) {
-
747 // TODO: consider also reading wait count from config
-
748 provider = std::make_shared<data_access::OptionalWrappedDataProvider>(framework_output_name, defs_it->second, 1);
-
749 }
-
750 else {
-
751 provider = std::make_shared<data_access::OptionalWrappedDataProvider>(framework_output_name);
-
752 }
-
753
-
754 // Add deferred to collection and module index to collection
-
755 deferredProviders.push_back(provider);
-
756 deferredProviderModuleIndices.push_back(mod_index);
-
757 // Assign as provider within module
-
758 // TODO: per TODO at top, probably can replace bmi_input_var_name here with framework_output_name
-
759 mod->input_forcing_providers[bmi_input_var_name] = provider;
-
760 }
-
761
-
763 std::vector<std::string> available_forcings;
-
767 std::map<std::string, double> default_output_values;
-
776 std::vector<std::shared_ptr<data_access::OptionalWrappedDataProvider>> deferredProviders;
-
777
-
784 std::vector<int> deferredProviderModuleIndices;
-
789 bool is_out_vars_from_last_mod = false;
-
791 std::vector<nested_module_ptr> modules;
-
792 std::vector<std::string> module_types;
-
796 // TODO: confirm that we actually need this for something
-
797 std::vector<std::shared_ptr<std::map<std::string, std::string>>> module_variable_maps;
-
799 int next_time_step_index = 0;
-
801 int primary_module_index = -1;
-
802
-
803 friend Bmi_Multi_Formulation_Test;
-
804 friend class ::Bmi_Cpp_Multi_Array_Test;
-
805
-
806 };
-
807}
-
808
-
809#endif //NGEN_BMI_MULTI_FORMULATION_HPP
+
731 template<class T>
+
732 void setup_nested_deferred_provider(const std::string &bmi_input_var_name,
+
733 const std::string &framework_output_name,
+
734 std::shared_ptr<T> mod,
+
735 int mod_index) {
+
736 // TODO: probably don't actually need bmi_input_var_name, and just can deal with framework_output_name
+
737 // Create deferred, optional provider for providing this
+
738 // Only include BMI variable name, as that's what'll be visible when associating to backing provider
+
739 // It's "deferred" in that we'll set the backing later.
+
740 // It's "optional" in that it waits to use backing provider, using the default some number of times
+
741 std::shared_ptr<data_access::OptionalWrappedDataProvider> provider;
+
742 // TODO: make sure only alias is needed
+
743 auto defs_it = default_output_values.find(framework_output_name);
+
744 if (defs_it != default_output_values.end()) {
+
745 // TODO: consider also reading wait count from config
+
746 provider = std::make_shared<data_access::OptionalWrappedDataProvider>(framework_output_name, defs_it->second, 1);
+
747 }
+
748 else {
+
749 provider = std::make_shared<data_access::OptionalWrappedDataProvider>(framework_output_name);
+
750 }
+
751
+
752 // Add deferred to collection and module index to collection
+
753 deferredProviders.push_back(provider);
+
754 deferredProviderModuleIndices.push_back(mod_index);
+
755 // Assign as provider within module
+
756 // TODO: per TODO at top, probably can replace bmi_input_var_name here with framework_output_name
+
757 mod->input_forcing_providers[bmi_input_var_name] = provider;
+
758 }
+
759
+
761 std::vector<std::string> available_forcings;
+
765 std::map<std::string, double> default_output_values;
+
774 std::vector<std::shared_ptr<data_access::OptionalWrappedDataProvider>> deferredProviders;
+
775
+
782 std::vector<int> deferredProviderModuleIndices;
+
787 bool is_out_vars_from_last_mod = false;
+
789 std::vector<nested_module_ptr> modules;
+
790 std::vector<std::string> module_types;
+
794 // TODO: confirm that we actually need this for something
+
795 std::vector<std::shared_ptr<std::map<std::string, std::string>>> module_variable_maps;
+
797 int next_time_step_index = 0;
+
799 int primary_module_index = -1;
+
800
+
801 friend Bmi_Multi_Formulation_Test;
+
802 friend class ::Bmi_Cpp_Multi_Array_Test;
+
803
+
804 };
+
805}
+
806
+
807#endif //NGEN_BMI_MULTI_FORMULATION_HPP
CatchmentAggrDataSelector
This class is intended to be the virtual base for all data selectors used with the DataProvider API.
Definition: DataProviderSelectors.hpp:13
CatchmentAggrDataSelector::get_variable_name
std::string get_variable_name() const
Get the variable name for this selector.
Definition: DataProviderSelectors.hpp:50
CatchmentAggrDataSelector::get_duration_secs
long get_duration_secs() const
Get the duration in seconds that is requested by this selector.
Definition: DataProviderSelectors.hpp:64
@@ -520,71 +518,71 @@
realization::Bmi_Formulation
Abstraction of formulation with backing model object(s) that implements the BMI.
Definition: Bmi_Formulation.hpp:49
realization::Bmi_Formulation::get_output_variable_names
const std::vector< std::string > & get_output_variable_names() const
Get the names of variables in formulation output.
Definition: Bmi_Formulation.hpp:173
realization::Bmi_Multi_Formulation
Abstraction of a formulation with multiple backing model object that implements the BMI.
Definition: Bmi_Multi_Formulation.hpp:24
-
realization::Bmi_Multi_Formulation::is_time_step_beyond_end_time
bool is_time_step_beyond_end_time(time_step_t t_index)
Get whether this time step goes beyond this formulations (i.e., any of it's modules') end time.
Definition: Bmi_Multi_Formulation.cpp:439
-
realization::Bmi_Multi_Formulation::is_bmi_input_variable
bool is_bmi_input_variable(const std::string &var_name) override
Definition: Bmi_Multi_Formulation.cpp:410
-
realization::Bmi_Multi_Formulation::init_nested_module
std::shared_ptr< T > init_nested_module(int mod_index, std::string identifier, geojson::PropertyMap properties)
Initialize a nested formulation from the given properties and update multi formulation metadata.
Definition: Bmi_Multi_Formulation.hpp:662
-
realization::Bmi_Multi_Formulation::get_response
double get_response(time_step_t t_index, time_step_t t_delta) override
Execute the backing model formulation for the given time step, where it is of the specified size,...
Definition: Bmi_Multi_Formulation.cpp:324
-
realization::Bmi_Multi_Formulation::modules
std::vector< nested_module_ptr > modules
The nested BMI modules composing this multi-module formulation, in their order of execution.
Definition: Bmi_Multi_Formulation.hpp:791
-
realization::Bmi_Multi_Formulation::get_output_line_for_timestep
std::string get_output_line_for_timestep(int timestep, std::string delimiter) override
Get a formatted line of output values for the given time step as a delimited string.
Definition: Bmi_Multi_Formulation.cpp:288
-
realization::Bmi_Multi_Formulation::next_time_step_index
int next_time_step_index
Index value (0-based) of the time step that will be processed by the next update of the model.
Definition: Bmi_Multi_Formulation.hpp:799
-
realization::Bmi_Multi_Formulation::get_config_mapped_variable_name
const std::string & get_config_mapped_variable_name(const std::string &model_var_name) override
When possible, translate a variable name for a BMI model to an internally recognized name.
Definition: Bmi_Multi_Formulation.cpp:216
+
realization::Bmi_Multi_Formulation::is_time_step_beyond_end_time
bool is_time_step_beyond_end_time(time_step_t t_index)
Get whether this time step goes beyond this formulations (i.e., any of it's modules') end time.
Definition: Bmi_Multi_Formulation.cpp:438
+
realization::Bmi_Multi_Formulation::is_bmi_input_variable
bool is_bmi_input_variable(const std::string &var_name) override
Definition: Bmi_Multi_Formulation.cpp:409
+
realization::Bmi_Multi_Formulation::init_nested_module
std::shared_ptr< T > init_nested_module(int mod_index, std::string identifier, geojson::PropertyMap properties)
Initialize a nested formulation from the given properties and update multi formulation metadata.
Definition: Bmi_Multi_Formulation.hpp:660
+
realization::Bmi_Multi_Formulation::get_response
double get_response(time_step_t t_index, time_step_t t_delta) override
Execute the backing model formulation for the given time step, where it is of the specified size,...
Definition: Bmi_Multi_Formulation.cpp:323
+
realization::Bmi_Multi_Formulation::modules
std::vector< nested_module_ptr > modules
The nested BMI modules composing this multi-module formulation, in their order of execution.
Definition: Bmi_Multi_Formulation.hpp:789
+
realization::Bmi_Multi_Formulation::get_output_line_for_timestep
std::string get_output_line_for_timestep(int timestep, std::string delimiter) override
Get a formatted line of output values for the given time step as a delimited string.
Definition: Bmi_Multi_Formulation.cpp:287
+
realization::Bmi_Multi_Formulation::next_time_step_index
int next_time_step_index
Index value (0-based) of the time step that will be processed by the next update of the model.
Definition: Bmi_Multi_Formulation.hpp:797
+
realization::Bmi_Multi_Formulation::get_config_mapped_variable_name
const std::string & get_config_mapped_variable_name(const std::string &model_var_name) override
When possible, translate a variable name for a BMI model to an internally recognized name.
Definition: Bmi_Multi_Formulation.cpp:215
realization::Bmi_Multi_Formulation::nested_module_type
Bmi_Formulation nested_module_type
Definition: Bmi_Multi_Formulation.hpp:28
-
realization::Bmi_Multi_Formulation::get_bmi_model_start_time_forcing_offset_s
const time_t & get_bmi_model_start_time_forcing_offset_s() override
Definition: Bmi_Multi_Formulation.cpp:194
-
realization::Bmi_Multi_Formulation::is_out_vars_from_last_mod
bool is_out_vars_from_last_mod
Whether the Bmi_Formulation::output_variable_names value is just the analogous value from this instan...
Definition: Bmi_Multi_Formulation.hpp:789
-
realization::Bmi_Multi_Formulation::get_var_value_as_double
double get_var_value_as_double(const int &index, const std::string &var_name)
Get value for some BMI model variable at a specific index.
Definition: Bmi_Multi_Formulation.hpp:579
-
realization::Bmi_Multi_Formulation::get_values
std::vector< double > get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the values of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Multi_Formulation.hpp:405
-
realization::Bmi_Multi_Formulation::set_index_for_primary_module
void set_index_for_primary_module(int index)
Set the index of the primary module.
Definition: Bmi_Multi_Formulation.hpp:489
-
realization::Bmi_Multi_Formulation::get_variable_time_end
time_t get_variable_time_end(const std::string &variable_name)
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: Bmi_Multi_Formulation.hpp:279
-
realization::Bmi_Multi_Formulation::get_data_stop_time
long get_data_stop_time() override
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: Bmi_Multi_Formulation.hpp:264
-
realization::Bmi_Multi_Formulation::is_bmi_using_forcing_file
bool is_bmi_using_forcing_file() const override
Whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Multi_Formulation.cpp:423
-
realization::Bmi_Multi_Formulation::get_bmi_output_variables
const std::vector< std::string > get_bmi_output_variables() override
Get the output variables of the last nested BMI model.
Definition: Bmi_Multi_Formulation.hpp:140
-
realization::Bmi_Multi_Formulation::check_output_var_names
void check_output_var_names()
Check that the output variable names in the global bmi_multi are valid names.
Definition: Bmi_Multi_Formulation.hpp:498
+
realization::Bmi_Multi_Formulation::get_bmi_model_start_time_forcing_offset_s
const time_t & get_bmi_model_start_time_forcing_offset_s() override
Definition: Bmi_Multi_Formulation.cpp:193
+
realization::Bmi_Multi_Formulation::is_out_vars_from_last_mod
bool is_out_vars_from_last_mod
Whether the Bmi_Formulation::output_variable_names value is just the analogous value from this instan...
Definition: Bmi_Multi_Formulation.hpp:787
+
realization::Bmi_Multi_Formulation::get_var_value_as_double
double get_var_value_as_double(const int &index, const std::string &var_name)
Get value for some BMI model variable at a specific index.
Definition: Bmi_Multi_Formulation.hpp:577
+
realization::Bmi_Multi_Formulation::get_values
std::vector< double > get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the values of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Multi_Formulation.hpp:403
+
realization::Bmi_Multi_Formulation::set_index_for_primary_module
void set_index_for_primary_module(int index)
Set the index of the primary module.
Definition: Bmi_Multi_Formulation.hpp:487
+
realization::Bmi_Multi_Formulation::get_variable_time_end
time_t get_variable_time_end(const std::string &variable_name)
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: Bmi_Multi_Formulation.hpp:277
+
realization::Bmi_Multi_Formulation::get_data_stop_time
long get_data_stop_time() override
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: Bmi_Multi_Formulation.hpp:262
+
realization::Bmi_Multi_Formulation::is_bmi_using_forcing_file
bool is_bmi_using_forcing_file() const override
Whether the backing model uses/reads the forcing file directly for getting input data.
Definition: Bmi_Multi_Formulation.cpp:422
+
realization::Bmi_Multi_Formulation::get_bmi_output_variables
const std::vector< std::string > get_bmi_output_variables() override
Get the output variables of the last nested BMI model.
Definition: Bmi_Multi_Formulation.hpp:138
+
realization::Bmi_Multi_Formulation::check_output_var_names
void check_output_var_names()
Check that the output variable names in the global bmi_multi are valid names.
Definition: Bmi_Multi_Formulation.hpp:496
realization::Bmi_Multi_Formulation::convert_model_time
time_t convert_model_time(const double &model_time) override
Convert a time value from the model to an epoch time in seconds.
Definition: Bmi_Multi_Formulation.hpp:58
-
realization::Bmi_Multi_Formulation::init_deferred_associations
void init_deferred_associations()
Initialize the deferred associations with the providers in deferredProviders.
Definition: Bmi_Multi_Formulation.hpp:611
-
realization::Bmi_Multi_Formulation::is_bmi_output_variable
bool is_bmi_output_variable(const std::string &var_name) override
Definition: Bmi_Multi_Formulation.cpp:419
+
realization::Bmi_Multi_Formulation::init_deferred_associations
void init_deferred_associations()
Initialize the deferred associations with the providers in deferredProviders.
Definition: Bmi_Multi_Formulation.hpp:609
+
realization::Bmi_Multi_Formulation::is_bmi_output_variable
bool is_bmi_output_variable(const std::string &var_name) override
Definition: Bmi_Multi_Formulation.cpp:418
realization::Bmi_Multi_Formulation::~Bmi_Multi_Formulation
virtual ~Bmi_Multi_Formulation()
Definition: Bmi_Multi_Formulation.hpp:42
-
realization::Bmi_Multi_Formulation::module_types
std::vector< std::string > module_types
Definition: Bmi_Multi_Formulation.hpp:792
-
realization::Bmi_Multi_Formulation::get_forcing_file_path
const std::string & get_forcing_file_path() const override
Definition: Bmi_Multi_Formulation.cpp:284
-
realization::Bmi_Multi_Formulation::deferredProviders
std::vector< std::shared_ptr< data_access::OptionalWrappedDataProvider > > deferredProviders
A collection of wrappers to nested formulations providing some output to an earlier nested formulatio...
Definition: Bmi_Multi_Formulation.hpp:776
-
realization::Bmi_Multi_Formulation::get_available_variable_names
const std::vector< std::string > & get_available_variable_names() override
Get the collection of forcing output property names this instance can provide.
Definition: Bmi_Multi_Formulation.cpp:183
-
realization::Bmi_Multi_Formulation::record_duration
long record_duration() override
Return the stride in the time dimension.
Definition: Bmi_Multi_Formulation.hpp:293
+
realization::Bmi_Multi_Formulation::module_types
std::vector< std::string > module_types
Definition: Bmi_Multi_Formulation.hpp:790
+
realization::Bmi_Multi_Formulation::get_forcing_file_path
const std::string & get_forcing_file_path() const override
Definition: Bmi_Multi_Formulation.cpp:283
+
realization::Bmi_Multi_Formulation::deferredProviders
std::vector< std::shared_ptr< data_access::OptionalWrappedDataProvider > > deferredProviders
A collection of wrappers to nested formulations providing some output to an earlier nested formulatio...
Definition: Bmi_Multi_Formulation.hpp:774
+
realization::Bmi_Multi_Formulation::record_duration
long record_duration() override
Return the stride in the time dimension.
Definition: Bmi_Multi_Formulation.hpp:291
realization::Bmi_Multi_Formulation::create_multi_formulation
void create_multi_formulation(geojson::PropertyMap properties, bool needs_param_validation)
Creating a multi-BMI-module formulation from NGen config.
Definition: Bmi_Multi_Formulation.cpp:10
realization::Bmi_Multi_Formulation::create_formulation
void create_formulation(geojson::PropertyMap properties) override
Definition: Bmi_Multi_Formulation.hpp:84
-
realization::Bmi_Multi_Formulation::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Definition: Bmi_Multi_Formulation.hpp:456
-
realization::Bmi_Multi_Formulation::is_bmi_model_time_step_fixed
bool is_bmi_model_time_step_fixed() override
Test whether all backing models have fixed time step size.
Definition: Bmi_Multi_Formulation.cpp:414
-
realization::Bmi_Multi_Formulation::get_var_value_as_double
double get_var_value_as_double(const std::string &var_name)
Get value for some BMI model variable.
Definition: Bmi_Multi_Formulation.hpp:551
-
realization::Bmi_Multi_Formulation::setup_nested_deferred_provider
void setup_nested_deferred_provider(const std::string &bmi_input_var_name, const std::string &framework_output_name, std::shared_ptr< T > mod, int mod_index)
Setup a deferred provider for a nested module, tracking the class as needed.
Definition: Bmi_Multi_Formulation.hpp:734
-
realization::Bmi_Multi_Formulation::get_bmi_input_variables
const std::vector< std::string > get_bmi_input_variables() override
Get the input variables of the first nested BMI model.
Definition: Bmi_Multi_Formulation.hpp:129
-
realization::Bmi_Multi_Formulation::Bmi_Multi_Formulation_Test
friend Bmi_Multi_Formulation_Test
Definition: Bmi_Multi_Formulation.hpp:803
-
realization::Bmi_Multi_Formulation::module_variable_maps
std::vector< std::shared_ptr< std::map< std::string, std::string > > > module_variable_maps
Per-module maps (ordered as in modules) of configuration-mapped names to BMI variable names.
Definition: Bmi_Multi_Formulation.hpp:797
-
realization::Bmi_Multi_Formulation::available_forcings
std::vector< std::string > available_forcings
The set of available "forcings" (output variables, plus their mapped aliases) this instance can provi...
Definition: Bmi_Multi_Formulation.hpp:763
-
realization::Bmi_Multi_Formulation::is_model_initialized
bool is_model_initialized() override
Test whether all backing models have been initialize using the BMI standard Initialize function.
Definition: Bmi_Multi_Formulation.cpp:428
-
realization::Bmi_Multi_Formulation::availableData
std::map< std::string, std::shared_ptr< data_access::GenericDataProvider > > availableData
A mapping of data properties to their providers.
Definition: Bmi_Multi_Formulation.hpp:714
-
realization::Bmi_Multi_Formulation::deferredProviderModuleIndices
std::vector< int > deferredProviderModuleIndices
The module indices for the modules associated with each item in deferredProviders.
Definition: Bmi_Multi_Formulation.hpp:784
-
realization::Bmi_Multi_Formulation::get_model_start_time
const double get_model_start_time()
Get the end time for the primary nested BMI model in its native format and units.
Definition: Bmi_Multi_Formulation.hpp:344
-
realization::Bmi_Multi_Formulation::get_model_end_time
const double get_model_end_time() override
Get the end time for the primary nested BMI model in its native format and units.
Definition: Bmi_Multi_Formulation.hpp:335
-
realization::Bmi_Multi_Formulation::primary_module_index
int primary_module_index
The index of the "primary" nested module, used when functionality is deferred to a particular module'...
Definition: Bmi_Multi_Formulation.hpp:801
-
realization::Bmi_Multi_Formulation::get_index_for_primary_module
int get_index_for_primary_module()
Get the index of the primary module.
Definition: Bmi_Multi_Formulation.hpp:477
+
realization::Bmi_Multi_Formulation::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Definition: Bmi_Multi_Formulation.hpp:454
+
realization::Bmi_Multi_Formulation::is_bmi_model_time_step_fixed
bool is_bmi_model_time_step_fixed() override
Test whether all backing models have fixed time step size.
Definition: Bmi_Multi_Formulation.cpp:413
+
realization::Bmi_Multi_Formulation::get_var_value_as_double
double get_var_value_as_double(const std::string &var_name)
Get value for some BMI model variable.
Definition: Bmi_Multi_Formulation.hpp:549
+
realization::Bmi_Multi_Formulation::setup_nested_deferred_provider
void setup_nested_deferred_provider(const std::string &bmi_input_var_name, const std::string &framework_output_name, std::shared_ptr< T > mod, int mod_index)
Setup a deferred provider for a nested module, tracking the class as needed.
Definition: Bmi_Multi_Formulation.hpp:732
+
realization::Bmi_Multi_Formulation::get_bmi_input_variables
const std::vector< std::string > get_bmi_input_variables() override
Get the input variables of the first nested BMI model.
Definition: Bmi_Multi_Formulation.hpp:127
+
realization::Bmi_Multi_Formulation::Bmi_Multi_Formulation_Test
friend Bmi_Multi_Formulation_Test
Definition: Bmi_Multi_Formulation.hpp:801
+
realization::Bmi_Multi_Formulation::module_variable_maps
std::vector< std::shared_ptr< std::map< std::string, std::string > > > module_variable_maps
Per-module maps (ordered as in modules) of configuration-mapped names to BMI variable names.
Definition: Bmi_Multi_Formulation.hpp:795
+
realization::Bmi_Multi_Formulation::available_forcings
std::vector< std::string > available_forcings
The set of available "forcings" (output variables, plus their mapped aliases) this instance can provi...
Definition: Bmi_Multi_Formulation.hpp:761
+
realization::Bmi_Multi_Formulation::is_model_initialized
bool is_model_initialized() override
Test whether all backing models have been initialize using the BMI standard Initialize function.
Definition: Bmi_Multi_Formulation.cpp:427
+
realization::Bmi_Multi_Formulation::availableData
std::map< std::string, std::shared_ptr< data_access::GenericDataProvider > > availableData
A mapping of data properties to their providers.
Definition: Bmi_Multi_Formulation.hpp:712
+
realization::Bmi_Multi_Formulation::deferredProviderModuleIndices
std::vector< int > deferredProviderModuleIndices
The module indices for the modules associated with each item in deferredProviders.
Definition: Bmi_Multi_Formulation.hpp:782
+
realization::Bmi_Multi_Formulation::get_model_start_time
const double get_model_start_time()
Get the end time for the primary nested BMI model in its native format and units.
Definition: Bmi_Multi_Formulation.hpp:342
+
realization::Bmi_Multi_Formulation::get_model_end_time
const double get_model_end_time() override
Get the end time for the primary nested BMI model in its native format and units.
Definition: Bmi_Multi_Formulation.hpp:333
+
realization::Bmi_Multi_Formulation::primary_module_index
int primary_module_index
The index of the "primary" nested module, used when functionality is deferred to a particular module'...
Definition: Bmi_Multi_Formulation.hpp:799
+
realization::Bmi_Multi_Formulation::get_index_for_primary_module
int get_index_for_primary_module()
Get the index of the primary module.
Definition: Bmi_Multi_Formulation.hpp:475
realization::Bmi_Multi_Formulation::convert_model_time
time_t convert_model_time(const double &model_time, int module_index)
Convert a time value from the model to an epoch time in seconds.
Definition: Bmi_Multi_Formulation.hpp:75
-
realization::Bmi_Multi_Formulation::get_model_current_time
const double get_model_current_time() override
Get the current time for the primary nested BMI model in its native format and units.
Definition: Bmi_Multi_Formulation.hpp:326
+
realization::Bmi_Multi_Formulation::get_model_current_time
const double get_model_current_time() override
Get the current time for the primary nested BMI model in its native format and units.
Definition: Bmi_Multi_Formulation.hpp:324
realization::Bmi_Multi_Formulation::Bmi_Multi_Formulation
Bmi_Multi_Formulation(std::string id, std::shared_ptr< data_access::GenericDataProvider > forcing_provider, utils::StreamHandler output_stream)
Minimal constructor for objects initialize using the Formulation_Manager and subsequent calls to crea...
Definition: Bmi_Multi_Formulation.hpp:39
realization::Bmi_Multi_Formulation::get_allow_model_exceed_end_time
const bool & get_allow_model_exceed_end_time() const override
Get whether a model may perform updates beyond its end_time.
Definition: Bmi_Multi_Formulation.cpp:160
realization::Bmi_Multi_Formulation::create_formulation
void create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr) override
Definition: Bmi_Multi_Formulation.hpp:79
-
realization::Bmi_Multi_Formulation::get_ts_index_for_time
size_t get_ts_index_for_time(const time_t &epoch_time) override
Get the index of the forcing time step that contains the given point in time.
Definition: Bmi_Multi_Formulation.hpp:365
-
realization::Bmi_Multi_Formulation::get_data_start_time
long get_data_start_time() override
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Multi_Formulation.hpp:225
-
realization::Bmi_Multi_Formulation::get_formulation_type
std::string get_formulation_type() override
Definition: Bmi_Multi_Formulation.hpp:317
-
realization::Bmi_Multi_Formulation::get_variable_time_begin
time_t get_variable_time_begin(const std::string &variable_name)
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Multi_Formulation.hpp:240
+
realization::Bmi_Multi_Formulation::get_ts_index_for_time
size_t get_ts_index_for_time(const time_t &epoch_time) override
Get the index of the forcing time step that contains the given point in time.
Definition: Bmi_Multi_Formulation.hpp:363
+
realization::Bmi_Multi_Formulation::get_data_start_time
long get_data_start_time() override
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Multi_Formulation.hpp:223
+
realization::Bmi_Multi_Formulation::get_available_variable_names
boost::span< const std::string > get_available_variable_names() override
Get the collection of forcing output property names this instance can provide.
Definition: Bmi_Multi_Formulation.cpp:182
+
realization::Bmi_Multi_Formulation::get_formulation_type
std::string get_formulation_type() override
Definition: Bmi_Multi_Formulation.hpp:315
+
realization::Bmi_Multi_Formulation::get_variable_time_begin
time_t get_variable_time_begin(const std::string &variable_name)
Get the inclusive beginning of the period of time over which this instance can provide data for this ...
Definition: Bmi_Multi_Formulation.hpp:238
realization::Bmi_Multi_Formulation::nested_module_ptr
std::shared_ptr< nested_module_type > nested_module_ptr
Definition: Bmi_Multi_Formulation.hpp:29
-
realization::Bmi_Multi_Formulation::get_module_var_value_as_double
double get_module_var_value_as_double(const std::string &var_name, std::shared_ptr< Bmi_Formulation > mod)
Definition: Bmi_Multi_Formulation.hpp:536
-
realization::Bmi_Multi_Formulation::default_output_values
std::map< std::string, double > default_output_values
Any configured default values for outputs, keyed by framework alias (or var name if this is globally ...
Definition: Bmi_Multi_Formulation.hpp:767
-
realization::Bmi_Multi_Formulation::get_value
double get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the value of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Multi_Formulation.hpp:391
+
realization::Bmi_Multi_Formulation::get_module_var_value_as_double
double get_module_var_value_as_double(const std::string &var_name, std::shared_ptr< Bmi_Formulation > mod)
Definition: Bmi_Multi_Formulation.hpp:534
+
realization::Bmi_Multi_Formulation::default_output_values
std::map< std::string, double > default_output_values
Any configured default values for outputs, keyed by framework alias (or var name if this is globally ...
Definition: Bmi_Multi_Formulation.hpp:765
+
realization::Bmi_Multi_Formulation::get_value
double get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the value of a forcing property for an arbitrary time period, converting units if needed.
Definition: Bmi_Multi_Formulation.hpp:389
realization::Catchment_Formulation::config_pattern_substitution
static void config_pattern_substitution(geojson::PropertyMap &properties, const std::string &key, const std::string &pattern, const std::string &replacement)
Perform in-place substitution on the given config property item, if the item and the pattern are pres...
Definition: Catchment_Formulation.hpp:38
realization::Catchment_Formulation::get_catchment_id
std::string get_catchment_id() override
Definition: Catchment_Formulation.hpp:95
realization::ConfigurationException
Custom exception indicating a problem when integrating with the provided realization configuration.
Definition: ConfigurationException.hpp:13
realization::Formulation::interpret_parameters
virtual geojson::PropertyMap interpret_parameters(boost::property_tree::ptree &config, geojson::PropertyMap *global=nullptr)
Definition: Formulation.hpp:102
realization::Formulation::id
std::string id
Definition: Formulation.hpp:147
utils::StreamHandler
This class provides a copyable interface to a std::ostream or std::ostream like object that may not s...
Definition: StreamHandler.hpp:14
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
geojson::PropertyMap
std::map< std::string, JSONProperty > PropertyMap
Shorthand for a mapping between strings and properties.
Definition: JSONProperty.hpp:21
realization
Definition: Bmi_C_Formulation.hpp:11
@@ -593,7 +591,7 @@ diff --git a/_bmi___py___adapter_8hpp_source.html b/_bmi___py___adapter_8hpp_source.html index d98964c655..f0a8e4508d 100644 --- a/_bmi___py___adapter_8hpp_source.html +++ b/_bmi___py___adapter_8hpp_source.html @@ -651,7 +651,7 @@ diff --git a/_bmi___py___formulation_8hpp_source.html b/_bmi___py___formulation_8hpp_source.html index 6edaa2a355..7d74c1eb13 100644 --- a/_bmi___py___formulation_8hpp_source.html +++ b/_bmi___py___formulation_8hpp_source.html @@ -170,7 +170,7 @@ diff --git a/_c_s_v___reader_8h_source.html b/_c_s_v___reader_8h_source.html index c9cb87e799..1a55cf9dba 100644 --- a/_c_s_v___reader_8h_source.html +++ b/_c_s_v___reader_8h_source.html @@ -166,7 +166,7 @@ diff --git a/_catchment___formulation_8hpp_source.html b/_catchment___formulation_8hpp_source.html index 2a6ac230a3..9069d9cd53 100644 --- a/_catchment___formulation_8hpp_source.html +++ b/_catchment___formulation_8hpp_source.html @@ -195,7 +195,7 @@ diff --git a/_collection_feature_8hpp_source.html b/_collection_feature_8hpp_source.html index 3c7285a56a..ddd67de585 100644 --- a/_collection_feature_8hpp_source.html +++ b/_collection_feature_8hpp_source.html @@ -352,7 +352,7 @@ diff --git a/_configuration_exception_8hpp_source.html b/_configuration_exception_8hpp_source.html index d80b4040ed..e52e58b26f 100644 --- a/_configuration_exception_8hpp_source.html +++ b/_configuration_exception_8hpp_source.html @@ -139,7 +139,7 @@ diff --git a/_constants_8h_source.html b/_constants_8h_source.html index e6c00a802b..63b448a919 100644 --- a/_constants_8h_source.html +++ b/_constants_8h_source.html @@ -110,7 +110,7 @@ diff --git a/_csv_per_feature_forcing_provider_8hpp_source.html b/_csv_per_feature_forcing_provider_8hpp_source.html index 2162be3c33..4b420eb4cc 100644 --- a/_csv_per_feature_forcing_provider_8hpp_source.html +++ b/_csv_per_feature_forcing_provider_8hpp_source.html @@ -254,7 +254,7 @@
222 return is_param_sum_over_time_step(name);
223 }
224
-
225 const std::vector<std::string> &get_available_variable_names() override {
+
225 boost::span<const std::string> get_available_variable_names() override {
226 return available_forcings;
227 }
228
@@ -450,7 +450,6 @@
CsvPerFeatureForcingProvider::time_epoch_vector
std::vector< time_t > time_epoch_vector
Definition: CsvPerFeatureForcingProvider.hpp:405
CsvPerFeatureForcingProvider::available_forcings
std::vector< std::string > available_forcings
Definition: CsvPerFeatureForcingProvider.hpp:398
CsvPerFeatureForcingProvider::start_date_time
std::shared_ptr< time_type > start_date_time
Definition: CsvPerFeatureForcingProvider.hpp:418
-
CsvPerFeatureForcingProvider::get_available_variable_names
const std::vector< std::string > & get_available_variable_names() override
Return the variables that are accessable by this data provider.
Definition: CsvPerFeatureForcingProvider.hpp:225
CsvPerFeatureForcingProvider::start_date_time_epoch
time_t start_date_time_epoch
Definition: CsvPerFeatureForcingProvider.hpp:421
CsvPerFeatureForcingProvider::current_date_time_epoch
time_t current_date_time_epoch
Definition: CsvPerFeatureForcingProvider.hpp:423
CsvPerFeatureForcingProvider::check_forcing_vector_index_bounds
void check_forcing_vector_index_bounds()
Checks forcing vector index bounds and adjusts index if out of vector bounds ///.
Definition: CsvPerFeatureForcingProvider.hpp:235
@@ -472,12 +471,14 @@
CsvPerFeatureForcingProvider::forcing_vector_index
int forcing_vector_index
Definition: CsvPerFeatureForcingProvider.hpp:406
CsvPerFeatureForcingProvider::get_ts_index_for_time
size_t get_ts_index_for_time(const time_t &epoch_time) override
Get the index of the forcing time step that contains the given point in time.
Definition: CsvPerFeatureForcingProvider.hpp:82
CsvPerFeatureForcingProvider::get_data_start_time
long get_data_start_time() override
the inclusive beginning of the period of time over which this instance can provide data for this forc...
Definition: CsvPerFeatureForcingProvider.hpp:49
+
CsvPerFeatureForcingProvider::get_available_variable_names
boost::span< const std::string > get_available_variable_names() override
Return the variables that are accessable by this data provider.
Definition: CsvPerFeatureForcingProvider.hpp:225
CsvPerFeatureForcingProvider::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Definition: CsvPerFeatureForcingProvider.hpp:221
CsvPerFeatureForcingProvider::precipitation_rate_meters_per_second
double precipitation_rate_meters_per_second
Definition: CsvPerFeatureForcingProvider.hpp:409
UnitsHelper::get_converted_value
static double get_converted_value(const std::string &in_units, const double &value, const std::string &out_units)
Definition: UnitsHelper.cpp:58
+
boost::span
Definition: span.hpp:169
data_access::GenericDataProvider
Definition: GenericDataProvider.hpp:10
data_access::WellKnownFields
const std::map< std::string, std::tuple< std::string, std::string > > WellKnownFields
Definition: AorcForcing.hpp:77
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
forcing_params
forcing_params providing configuration information for forcing time period and source.
Definition: AorcForcing.hpp:35
forcing_params::path
std::string path
Definition: AorcForcing.hpp:36
@@ -486,7 +487,7 @@ diff --git a/_data_provider_8hpp_source.html b/_data_provider_8hpp_source.html index 81ac61798f..4f8821ff11 100644 --- a/_data_provider_8hpp_source.html +++ b/_data_provider_8hpp_source.html @@ -97,70 +97,72 @@
3
4#include <string>
5#include <vector>
-
6
-
7namespace data_access
-
8{
-
15 enum ReSampleMethod
-
16 {
-
17 MEAN,
-
18 SUM,
-
19 FRONT_FILL,
-
20 BACK_FILL
-
21 };
-
22
-
23 template <class data_type, class selection_type> class DataProvider
-
24 {
-
29 public:
-
30
-
31 virtual ~DataProvider() = default;
-
32
-
35 virtual const std::vector<std::string>& get_available_variable_names() = 0;
-
36
-
39 virtual long get_data_start_time() = 0;
-
40
-
43 virtual long get_data_stop_time() = 0;
-
44
-
46 virtual long record_duration() = 0;
-
47
-
57 virtual size_t get_ts_index_for_time(const time_t &epoch_time) = 0;
-
58
-
69 virtual data_type get_value(const selection_type& selector, ReSampleMethod m=SUM) = 0;
-
70
-
86 virtual std::vector<data_type> get_values(const selection_type& selector, ReSampleMethod m=SUM) = 0;
-
87
-
88 virtual bool is_property_sum_over_time_step(const std::string& name) {return false; }
-
89
-
90 private:
-
91 };
-
92
-
93}
-
94
+
6#include <span.hpp>
+
7
+
8namespace data_access
+
9{
+
16 enum ReSampleMethod
+
17 {
+
18 MEAN,
+
19 SUM,
+
20 FRONT_FILL,
+
21 BACK_FILL
+
22 };
+
23
+
24 template <class data_type, class selection_type> class DataProvider
+
25 {
+
30 public:
+
31
+
32 virtual ~DataProvider() = default;
+
33
+
36 virtual boost::span<const std::string> get_available_variable_names() = 0;
+
37
+
40 virtual long get_data_start_time() = 0;
+
41
+
44 virtual long get_data_stop_time() = 0;
+
45
+
47 virtual long record_duration() = 0;
+
48
+
58 virtual size_t get_ts_index_for_time(const time_t &epoch_time) = 0;
+
59
+
70 virtual data_type get_value(const selection_type& selector, ReSampleMethod m=SUM) = 0;
+
71
+
87 virtual std::vector<data_type> get_values(const selection_type& selector, ReSampleMethod m=SUM) = 0;
+
88
+
89 virtual bool is_property_sum_over_time_step(const std::string& name) {return false; }
+
90
+
91 private:
+
92 };
+
93
+
94}
95
96
-
97#endif // NGEN_DATAPROVIDER_HPP
-
data_access::DataProvider
Definition: DataProvider.hpp:24
-
data_access::DataProvider::get_available_variable_names
virtual const std::vector< std::string > & get_available_variable_names()=0
Return the variables that are accessable by this data provider.
+
97
+
98#endif // NGEN_DATAPROVIDER_HPP
+
boost::span
Definition: span.hpp:169
+
data_access::DataProvider
Definition: DataProvider.hpp:25
+
data_access::DataProvider::get_available_variable_names
virtual boost::span< const std::string > get_available_variable_names()=0
Return the variables that are accessable by this data provider.
data_access::DataProvider::get_value
virtual data_type get_value(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the value of a forcing property for an arbitrary time period, converting units if needed.
data_access::DataProvider::record_duration
virtual long record_duration()=0
Return the stride in the time dimension.
data_access::DataProvider::~DataProvider
virtual ~DataProvider()=default
This class provides a generic interface to data services.
-
data_access::DataProvider::is_property_sum_over_time_step
virtual bool is_property_sum_over_time_step(const std::string &name)
Definition: DataProvider.hpp:88
+
data_access::DataProvider::is_property_sum_over_time_step
virtual bool is_property_sum_over_time_step(const std::string &name)
Definition: DataProvider.hpp:89
data_access::DataProvider::get_data_start_time
virtual long get_data_start_time()=0
Return the first valid time for which data from the request variable can be requested.
data_access::DataProvider::get_ts_index_for_time
virtual size_t get_ts_index_for_time(const time_t &epoch_time)=0
Get the index of the data time step that contains the given point in time.
data_access::DataProvider::get_values
virtual std::vector< data_type > get_values(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the values of a forcing property for an arbitrary time period, converting units if needed.
data_access::DataProvider::get_data_stop_time
virtual long get_data_stop_time()=0
Return the last valid time for which data from the requested variable can be requested.
data_access
Definition: AorcForcing.hpp:75
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
-
data_access::FRONT_FILL
@ FRONT_FILL
Definition: DataProvider.hpp:19
-
data_access::SUM
@ SUM
Definition: DataProvider.hpp:18
-
data_access::BACK_FILL
@ BACK_FILL
Definition: DataProvider.hpp:20
-
data_access::MEAN
@ MEAN
Definition: DataProvider.hpp:17
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
+
data_access::FRONT_FILL
@ FRONT_FILL
Definition: DataProvider.hpp:20
+
data_access::SUM
@ SUM
Definition: DataProvider.hpp:19
+
data_access::BACK_FILL
@ BACK_FILL
Definition: DataProvider.hpp:21
+
data_access::MEAN
@ MEAN
Definition: DataProvider.hpp:18
diff --git a/_data_provider_selectors_8hpp_source.html b/_data_provider_selectors_8hpp_source.html index bcdc69e71d..2e895b185e 100644 --- a/_data_provider_selectors_8hpp_source.html +++ b/_data_provider_selectors_8hpp_source.html @@ -234,7 +234,7 @@ diff --git a/_deferred_wrapped_provider_8hpp_source.html b/_deferred_wrapped_provider_8hpp_source.html index 0aaec88724..f519d10ed8 100644 --- a/_deferred_wrapped_provider_8hpp_source.html +++ b/_deferred_wrapped_provider_8hpp_source.html @@ -120,7 +120,7 @@
62 provider_to_move.wrapped_provider = nullptr;
63 }
64
-
73 const std::vector<std::string> &get_available_variable_names() {
+
73 boost::span<const std::string> get_available_variable_names() override {
74 return providedOutputs;
75 }
76
@@ -150,7 +150,7 @@
137 }
138
139 // Confirm this will provide everything needed
-
140 const std::vector<std::string> &available = provider->get_available_variable_names();
+
140 const auto available = provider->get_available_variable_names();
141 for (const std::string &requiredName : providedOutputs) {
142 if (std::find(available.begin(), available.end(), requiredName) == available.end()) {
143 setMessage = "Given provider does not provide the required " + requiredName;
@@ -173,9 +173,9 @@
167}
168
169#endif //NGEN_DEFERREDWRAPPEDPROVIDER_HPP
-
data_access::DataProvider::get_available_variable_names
virtual const std::vector< std::string > & get_available_variable_names()=0
Return the variables that are accessable by this data provider.
+
boost::span
Definition: span.hpp:169
+
data_access::DataProvider::get_available_variable_names
virtual boost::span< const std::string > get_available_variable_names()=0
Return the variables that are accessable by this data provider.
data_access::DeferredWrappedProvider
A specialized @WrappedDataProvider that is created without first knowing the backing source it wraps.
Definition: DeferredWrappedProvider.hpp:34
-
data_access::DeferredWrappedProvider::get_available_variable_names
const std::vector< std::string > & get_available_variable_names()
Get the names of the outputs that this instance is (or will be) able to provide.
Definition: DeferredWrappedProvider.hpp:73
data_access::DeferredWrappedProvider::isWrappedProviderSet
bool isWrappedProviderSet()
Get whether the backing provider this instance wraps has been set yet.
Definition: DeferredWrappedProvider.hpp:106
data_access::DeferredWrappedProvider::providedOutputs
std::vector< std::string > providedOutputs
The collection of names of the outputs this type can/will be able to provide from its wrapped source.
Definition: DeferredWrappedProvider.hpp:156
data_access::DeferredWrappedProvider::setWrappedProvider
virtual bool setWrappedProvider(GenericDataProvider *provider)
Set the wrapped provider, if the given arg is valid for doing so.
Definition: DeferredWrappedProvider.hpp:126
@@ -185,6 +185,7 @@
data_access::DeferredWrappedProvider::DeferredWrappedProvider
DeferredWrappedProvider(std::vector< std::string > providedOutputs)
Constructor for instance.
Definition: DeferredWrappedProvider.hpp:42
data_access::DeferredWrappedProvider::getSetMessage
const std::string & getSetMessage()
Get the message string for the last call to setWrappedProvider.
Definition: DeferredWrappedProvider.hpp:86
data_access::DeferredWrappedProvider::DeferredWrappedProvider
DeferredWrappedProvider(const std::string &outputName)
Convenience constructor for when there is only one provided output name.
Definition: DeferredWrappedProvider.hpp:49
+
data_access::DeferredWrappedProvider::get_available_variable_names
boost::span< const std::string > get_available_variable_names() override
Get the names of the outputs that this instance is (or will be) able to provide.
Definition: DeferredWrappedProvider.hpp:73
data_access::GenericDataProvider
Definition: GenericDataProvider.hpp:10
data_access::WrappedDataProvider
Simple implementation that basically wraps another instance.
Definition: WrappedDataProvider.hpp:18
data_access::WrappedDataProvider::wrapped_provider
GenericDataProvider * wrapped_provider
Definition: WrappedDataProvider.hpp:132
@@ -195,7 +196,7 @@ diff --git a/_endian_copy_8hpp_source.html b/_endian_copy_8hpp_source.html index 96cf870669..1a4f4555fb 100644 --- a/_endian_copy_8hpp_source.html +++ b/_endian_copy_8hpp_source.html @@ -147,7 +147,7 @@ diff --git a/_external_integration_exception_8hpp_source.html b/_external_integration_exception_8hpp_source.html index d54b3cfd0e..903a0bf63f 100644 --- a/_external_integration_exception_8hpp_source.html +++ b/_external_integration_exception_8hpp_source.html @@ -137,7 +137,7 @@ diff --git a/_feature_base_8hpp_source.html b/_feature_base_8hpp_source.html index 32e21c8dbe..d1ec18fd9c 100644 --- a/_feature_base_8hpp_source.html +++ b/_feature_base_8hpp_source.html @@ -749,7 +749,7 @@ diff --git a/_feature_builder_8hpp_source.html b/_feature_builder_8hpp_source.html index 6ce22dbfe5..b3a147e9c4 100644 --- a/_feature_builder_8hpp_source.html +++ b/_feature_builder_8hpp_source.html @@ -571,7 +571,7 @@ diff --git a/_feature_collection_8hpp_source.html b/_feature_collection_8hpp_source.html index cae46a5a40..de63c28043 100644 --- a/_feature_collection_8hpp_source.html +++ b/_feature_collection_8hpp_source.html @@ -282,7 +282,7 @@ diff --git a/_feature_visitor_8hpp_source.html b/_feature_visitor_8hpp_source.html index 5667a7ac0d..a609c10192 100644 --- a/_feature_visitor_8hpp_source.html +++ b/_feature_visitor_8hpp_source.html @@ -138,7 +138,7 @@ diff --git a/_features_8hpp_source.html b/_features_8hpp_source.html index 516a8bd3dd..bc6d707dca 100644 --- a/_features_8hpp_source.html +++ b/_features_8hpp_source.html @@ -111,7 +111,7 @@ diff --git a/_file_checker_8h_source.html b/_file_checker_8h_source.html index 6f83487725..9ce7540edc 100644 --- a/_file_checker_8h_source.html +++ b/_file_checker_8h_source.html @@ -217,7 +217,7 @@ diff --git a/_file_stream_handler_8hpp_source.html b/_file_stream_handler_8hpp_source.html index 82b7aab747..58f4c08c48 100644 --- a/_file_stream_handler_8hpp_source.html +++ b/_file_stream_handler_8hpp_source.html @@ -128,7 +128,7 @@ diff --git a/_formulation_8hpp_source.html b/_formulation_8hpp_source.html index e253db34c6..c2daebe8b2 100644 --- a/_formulation_8hpp_source.html +++ b/_formulation_8hpp_source.html @@ -231,7 +231,7 @@ diff --git a/_formulation___constructors_8hpp_source.html b/_formulation___constructors_8hpp_source.html index 11dc2398ef..7e200bec59 100644 --- a/_formulation___constructors_8hpp_source.html +++ b/_formulation___constructors_8hpp_source.html @@ -206,7 +206,7 @@ diff --git a/_formulation___manager_8hpp_source.html b/_formulation___manager_8hpp_source.html index d2654aaf84..aaf5928eac 100644 --- a/_formulation___manager_8hpp_source.html +++ b/_formulation___manager_8hpp_source.html @@ -787,7 +787,7 @@ diff --git a/_g_m___object_8hpp_source.html b/_g_m___object_8hpp_source.html index 565514468e..4b86658424 100644 --- a/_g_m___object_8hpp_source.html +++ b/_g_m___object_8hpp_source.html @@ -122,7 +122,7 @@ diff --git a/_generic_data_provider_8hpp_source.html b/_generic_data_provider_8hpp_source.html index d69979ac36..d525183256 100644 --- a/_generic_data_provider_8hpp_source.html +++ b/_generic_data_provider_8hpp_source.html @@ -109,7 +109,7 @@
15}
16
17#endif
-
data_access::DataProvider
Definition: DataProvider.hpp:24
+
data_access::DataProvider
Definition: DataProvider.hpp:25
data_access::GenericDataProvider
Definition: GenericDataProvider.hpp:10
data_access
Definition: AorcForcing.hpp:75
@@ -118,7 +118,7 @@ diff --git a/_geo_package_8hpp_source.html b/_geo_package_8hpp_source.html index d6eebfaf74..9aaa33fcc4 100644 --- a/_geo_package_8hpp_source.html +++ b/_geo_package_8hpp_source.html @@ -140,7 +140,7 @@ diff --git a/_grid_polygon_8hpp_source.html b/_grid_polygon_8hpp_source.html index 08ace937f5..2d4227dd3c 100644 --- a/_grid_polygon_8hpp_source.html +++ b/_grid_polygon_8hpp_source.html @@ -194,7 +194,7 @@ diff --git a/_h_y___cartographic_realization_8hpp_source.html b/_h_y___cartographic_realization_8hpp_source.html index 04f7c660b0..d63b655958 100644 --- a/_h_y___cartographic_realization_8hpp_source.html +++ b/_h_y___cartographic_realization_8hpp_source.html @@ -120,7 +120,7 @@ diff --git a/_h_y___catchment_8hpp_source.html b/_h_y___catchment_8hpp_source.html index f94532f48d..16f247839a 100644 --- a/_h_y___catchment_8hpp_source.html +++ b/_h_y___catchment_8hpp_source.html @@ -171,7 +171,7 @@ diff --git a/_h_y___catchment_aggregate_8hpp_source.html b/_h_y___catchment_aggregate_8hpp_source.html index d3969dcf32..357060d5ae 100644 --- a/_h_y___catchment_aggregate_8hpp_source.html +++ b/_h_y___catchment_aggregate_8hpp_source.html @@ -120,7 +120,7 @@ diff --git a/_h_y___catchment_area_8hpp_source.html b/_h_y___catchment_area_8hpp_source.html index a3429e78ea..44007bcfa5 100644 --- a/_h_y___catchment_area_8hpp_source.html +++ b/_h_y___catchment_area_8hpp_source.html @@ -143,7 +143,7 @@ diff --git a/_h_y___catchment_divide_8hpp_source.html b/_h_y___catchment_divide_8hpp_source.html index c75305bc67..0cfeb8b885 100644 --- a/_h_y___catchment_divide_8hpp_source.html +++ b/_h_y___catchment_divide_8hpp_source.html @@ -142,7 +142,7 @@ diff --git a/_h_y___catchment_realization_8hpp_source.html b/_h_y___catchment_realization_8hpp_source.html index 0a5ffe0e51..112a0804ac 100644 --- a/_h_y___catchment_realization_8hpp_source.html +++ b/_h_y___catchment_realization_8hpp_source.html @@ -156,7 +156,7 @@ diff --git a/_h_y___dendritic_catchment_8hpp_source.html b/_h_y___dendritic_catchment_8hpp_source.html index 2df9645d8f..69bb81a112 100644 --- a/_h_y___dendritic_catchment_8hpp_source.html +++ b/_h_y___dendritic_catchment_8hpp_source.html @@ -120,7 +120,7 @@ diff --git a/_h_y___distance_discription_8hpp_source.html b/_h_y___distance_discription_8hpp_source.html index 9eb4942762..2ff1401c5c 100644 --- a/_h_y___distance_discription_8hpp_source.html +++ b/_h_y___distance_discription_8hpp_source.html @@ -114,7 +114,7 @@ diff --git a/_h_y___features_8hpp_source.html b/_h_y___features_8hpp_source.html index e6d14a9d13..28e6b8eec9 100644 --- a/_h_y___features_8hpp_source.html +++ b/_h_y___features_8hpp_source.html @@ -210,7 +210,7 @@ diff --git a/_h_y___features___m_p_i_8hpp_source.html b/_h_y___features___m_p_i_8hpp_source.html index c2acde3506..ba85871871 100644 --- a/_h_y___features___m_p_i_8hpp_source.html +++ b/_h_y___features___m_p_i_8hpp_source.html @@ -189,7 +189,7 @@ diff --git a/_h_y___flow_path_8hpp_source.html b/_h_y___flow_path_8hpp_source.html index 36c4e562ef..34743d4528 100644 --- a/_h_y___flow_path_8hpp_source.html +++ b/_h_y___flow_path_8hpp_source.html @@ -141,7 +141,7 @@ diff --git a/_h_y___hydro_feature_8hpp_source.html b/_h_y___hydro_feature_8hpp_source.html index 4dd1eb892d..699edd1a6e 100644 --- a/_h_y___hydro_feature_8hpp_source.html +++ b/_h_y___hydro_feature_8hpp_source.html @@ -117,7 +117,7 @@ diff --git a/_h_y___hydro_location_8hpp_source.html b/_h_y___hydro_location_8hpp_source.html index b54328f9dd..0f4b341f55 100644 --- a/_h_y___hydro_location_8hpp_source.html +++ b/_h_y___hydro_location_8hpp_source.html @@ -169,7 +169,7 @@ diff --git a/_h_y___hydro_location_type_8hpp_source.html b/_h_y___hydro_location_type_8hpp_source.html index 0bea7a13a9..6b1a318f49 100644 --- a/_h_y___hydro_location_type_8hpp_source.html +++ b/_h_y___hydro_location_type_8hpp_source.html @@ -159,7 +159,7 @@ diff --git a/_h_y___hydro_network_8hpp_source.html b/_h_y___hydro_network_8hpp_source.html index 1b229d335e..e1f7eb1f52 100644 --- a/_h_y___hydro_network_8hpp_source.html +++ b/_h_y___hydro_network_8hpp_source.html @@ -156,7 +156,7 @@ diff --git a/_h_y___hydro_nexus_8hpp_source.html b/_h_y___hydro_nexus_8hpp_source.html index 15a3558df8..b20ba0de90 100644 --- a/_h_y___hydro_nexus_8hpp_source.html +++ b/_h_y___hydro_nexus_8hpp_source.html @@ -202,7 +202,7 @@ diff --git a/_h_y___indirect_position_8hpp_source.html b/_h_y___indirect_position_8hpp_source.html index df768cf635..8e4e483aeb 100644 --- a/_h_y___indirect_position_8hpp_source.html +++ b/_h_y___indirect_position_8hpp_source.html @@ -176,7 +176,7 @@ diff --git a/_h_y___interior_catchment_8hpp_source.html b/_h_y___interior_catchment_8hpp_source.html index 21ca79c40e..512034e08e 100644 --- a/_h_y___interior_catchment_8hpp_source.html +++ b/_h_y___interior_catchment_8hpp_source.html @@ -120,7 +120,7 @@ diff --git a/_h_y___point_hydro_nexus_8hpp_source.html b/_h_y___point_hydro_nexus_8hpp_source.html index 96183bb786..d1087bb14b 100644 --- a/_h_y___point_hydro_nexus_8hpp_source.html +++ b/_h_y___point_hydro_nexus_8hpp_source.html @@ -161,7 +161,7 @@ diff --git a/_h_y___point_hydro_nexus_remote_8hpp_source.html b/_h_y___point_hydro_nexus_remote_8hpp_source.html index 595f7a75b0..11c8c71efc 100644 --- a/_h_y___point_hydro_nexus_remote_8hpp_source.html +++ b/_h_y___point_hydro_nexus_remote_8hpp_source.html @@ -225,7 +225,7 @@ diff --git a/_hydrofabric_subsetter_8hpp_source.html b/_hydrofabric_subsetter_8hpp_source.html index 2e85e14d3f..f44e43dbc6 100644 --- a/_hydrofabric_subsetter_8hpp_source.html +++ b/_hydrofabric_subsetter_8hpp_source.html @@ -219,7 +219,7 @@ diff --git a/_interpreter_util_8hpp_source.html b/_interpreter_util_8hpp_source.html index 2919e30f0f..a207e403f4 100644 --- a/_interpreter_util_8hpp_source.html +++ b/_interpreter_util_8hpp_source.html @@ -308,7 +308,7 @@ diff --git a/_j_s_o_n_geometry_8hpp_source.html b/_j_s_o_n_geometry_8hpp_source.html index c358b4166c..6505724752 100644 --- a/_j_s_o_n_geometry_8hpp_source.html +++ b/_j_s_o_n_geometry_8hpp_source.html @@ -277,7 +277,7 @@ diff --git a/_j_s_o_n_property_8hpp_source.html b/_j_s_o_n_property_8hpp_source.html index a84aa4366a..db4f464a30 100644 --- a/_j_s_o_n_property_8hpp_source.html +++ b/_j_s_o_n_property_8hpp_source.html @@ -574,7 +574,7 @@ diff --git a/_line_string_feature_8hpp_source.html b/_line_string_feature_8hpp_source.html index aa71d5dca7..b0468f0b24 100644 --- a/_line_string_feature_8hpp_source.html +++ b/_line_string_feature_8hpp_source.html @@ -160,7 +160,7 @@ diff --git a/_multi_line_string_feature_8hpp_source.html b/_multi_line_string_feature_8hpp_source.html index cec531bc98..6d51240356 100644 --- a/_multi_line_string_feature_8hpp_source.html +++ b/_multi_line_string_feature_8hpp_source.html @@ -160,7 +160,7 @@ diff --git a/_multi_point_feature_8hpp_source.html b/_multi_point_feature_8hpp_source.html index 7d45fcfb30..9e280c229f 100644 --- a/_multi_point_feature_8hpp_source.html +++ b/_multi_point_feature_8hpp_source.html @@ -160,7 +160,7 @@ diff --git a/_multi_polygon_feature_8hpp_source.html b/_multi_polygon_feature_8hpp_source.html index f0fe1c4da2..5e677f6209 100644 --- a/_multi_polygon_feature_8hpp_source.html +++ b/_multi_polygon_feature_8hpp_source.html @@ -159,7 +159,7 @@ diff --git a/_n_gen___s_q_lite_8hpp_source.html b/_n_gen___s_q_lite_8hpp_source.html index 478de53939..9ebe25cc77 100644 --- a/_n_gen___s_q_lite_8hpp_source.html +++ b/_n_gen___s_q_lite_8hpp_source.html @@ -239,7 +239,7 @@ diff --git a/_net_c_d_f_per_feature_data_provider_8hpp_source.html b/_net_c_d_f_per_feature_data_provider_8hpp_source.html index 4a009e46dd..cb9b603f85 100644 --- a/_net_c_d_f_per_feature_data_provider_8hpp_source.html +++ b/_net_c_d_f_per_feature_data_provider_8hpp_source.html @@ -151,7 +151,7 @@
66 // for every file that uses this class
67 ~NetCDFPerFeatureDataProvider();
68
-
70 const std::vector<std::string>& get_available_variable_names() override;
+
70 boost::span<const std::string> get_available_variable_names() override;
71
73 const std::vector<std::string>& get_ids() const;
74
@@ -206,16 +206,17 @@
144#endif // NGEN_NETCDF_PER_FEATURE_DATAPROVIDER_HPP
145#endif
CatchmentAggrDataSelector
This class is intended to be the virtual base for all data selectors used with the DataProvider API.
Definition: DataProviderSelectors.hpp:13
+
boost::span
Definition: span.hpp:169
utils::StreamHandler
This class provides a copyable interface to a std::ostream or std::ostream like object that may not s...
Definition: StreamHandler.hpp:14
data_access
Definition: AorcForcing.hpp:75
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
diff --git a/_nexus___manager_8hpp_source.html b/_nexus___manager_8hpp_source.html index 99b9244dff..2e54163ced 100644 --- a/_nexus___manager_8hpp_source.html +++ b/_nexus___manager_8hpp_source.html @@ -251,7 +251,7 @@ diff --git a/_null_forcing_provider_8hpp_source.html b/_null_forcing_provider_8hpp_source.html index ba131e8dcd..e6fc9bf16c 100644 --- a/_null_forcing_provider_8hpp_source.html +++ b/_null_forcing_provider_8hpp_source.html @@ -139,38 +139,33 @@
48 throw std::runtime_error("Got request for variable " + name + " but no such variable is provided by NullForcingProvider." + SOURCE_LOC);
49 }
50
-
51 const std::vector<std::string> &get_available_variable_names() override {
-
52 return available_forcings;
+
51 boost::span<const std::string> get_available_variable_names() override {
+
52 return {};
53 }
-
54
-
55 private:
-
56
-
57 std::vector<std::string> available_forcings;
-
58
-
59};
-
60
-
61#endif // NGEN_NULLFORCING_H
+
54};
+
55
+
56#endif // NGEN_NULLFORCING_H
CatchmentAggrDataSelector
This class is intended to be the virtual base for all data selectors used with the DataProvider API.
Definition: DataProviderSelectors.hpp:13
NullForcingProvider
Forcing class that returns no variables to the simulation–use this e.g.
Definition: NullForcingProvider.hpp:14
NullForcingProvider::get_data_start_time
long get_data_start_time() override
Return the first valid time for which data from the request variable can be requested.
Definition: NullForcingProvider.hpp:21
NullForcingProvider::get_value
double get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the value of a forcing property for an arbitrary time period, converting units if needed.
Definition: NullForcingProvider.hpp:37
+
NullForcingProvider::get_available_variable_names
boost::span< const std::string > get_available_variable_names() override
Return the variables that are accessable by this data provider.
Definition: NullForcingProvider.hpp:51
NullForcingProvider::NullForcingProvider
NullForcingProvider()
Definition: NullForcingProvider.hpp:17
-
NullForcingProvider::get_available_variable_names
const std::vector< std::string > & get_available_variable_names() override
Return the variables that are accessable by this data provider.
Definition: NullForcingProvider.hpp:51
NullForcingProvider::get_ts_index_for_time
size_t get_ts_index_for_time(const time_t &epoch_time) override
Get the index of the data time step that contains the given point in time.
Definition: NullForcingProvider.hpp:33
NullForcingProvider::get_data_stop_time
long get_data_stop_time() override
Return the last valid time for which data from the requested variable can be requested.
Definition: NullForcingProvider.hpp:25
NullForcingProvider::get_values
virtual std::vector< double > get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the values of a forcing property for an arbitrary time period, converting units if needed.
Definition: NullForcingProvider.hpp:42
NullForcingProvider::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Definition: NullForcingProvider.hpp:47
NullForcingProvider::record_duration
long record_duration() override
Return the stride in the time dimension.
Definition: NullForcingProvider.hpp:29
-
NullForcingProvider::available_forcings
std::vector< std::string > available_forcings
Definition: NullForcingProvider.hpp:57
+
boost::span
Definition: span.hpp:169
data_access::GenericDataProvider
Definition: GenericDataProvider.hpp:10
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
diff --git a/_optional_wrapped_data_provider_8hpp_source.html b/_optional_wrapped_data_provider_8hpp_source.html index 99a08a7597..2e0e6faee5 100644 --- a/_optional_wrapped_data_provider_8hpp_source.html +++ b/_optional_wrapped_data_provider_8hpp_source.html @@ -310,7 +310,7 @@
397 std::map<std::string, int> defaultUsageWaits;
398
399 static bool isSuppliedByProvider(const std::string &outputName, GenericDataProvider *provider) {
-
400 const std::vector<std::string> &available = provider->get_available_variable_names();
+
400 auto available = provider->get_available_variable_names();
401 return find(available.begin(), available.end(), outputName) != available.end();
402 }
403
@@ -328,7 +328,7 @@
CatchmentAggrDataSelector::get_duration_secs
long get_duration_secs() const
Get the duration in seconds that is requested by this selector.
Definition: DataProviderSelectors.hpp:64
CatchmentAggrDataSelector::get_output_units
std::string get_output_units() const
Get the output units that is requested by this selector.
Definition: DataProviderSelectors.hpp:71
CatchmentAggrDataSelector::get_init_time
time_t get_init_time() const
Get the initial time for this selector.
Definition: DataProviderSelectors.hpp:57
-
data_access::DataProvider::get_available_variable_names
virtual const std::vector< std::string > & get_available_variable_names()=0
Return the variables that are accessable by this data provider.
+
data_access::DataProvider::get_available_variable_names
virtual boost::span< const std::string > get_available_variable_names()=0
Return the variables that are accessable by this data provider.
data_access::DataProvider::get_value
virtual data_type get_value(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the value of a forcing property for an arbitrary time period, converting units if needed.
data_access::DeferredWrappedProvider
A specialized @WrappedDataProvider that is created without first knowing the backing source it wraps.
Definition: DeferredWrappedProvider.hpp:34
data_access::DeferredWrappedProvider::isWrappedProviderSet
bool isWrappedProviderSet()
Get whether the backing provider this instance wraps has been set yet.
Definition: DeferredWrappedProvider.hpp:106
@@ -355,14 +355,14 @@
data_access::OptionalWrappedDataProvider::get_value
double get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override
Get the value of a forcing property for an arbitrary time period, converting units if needed.
Definition: OptionalWrappedDataProvider.hpp:193
data_access::WrappedDataProvider::wrapped_provider
GenericDataProvider * wrapped_provider
Definition: WrappedDataProvider.hpp:132
data_access
Definition: AorcForcing.hpp:75
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
diff --git a/_partition___parser_8hpp_source.html b/_partition___parser_8hpp_source.html index a90e5204ea..c2a9719592 100644 --- a/_partition___parser_8hpp_source.html +++ b/_partition___parser_8hpp_source.html @@ -292,7 +292,7 @@ diff --git a/_point_feature_8hpp_source.html b/_point_feature_8hpp_source.html index 8b86e92ca5..d7bf8517dd 100644 --- a/_point_feature_8hpp_source.html +++ b/_point_feature_8hpp_source.html @@ -161,7 +161,7 @@ diff --git a/_polygon_feature_8hpp_source.html b/_polygon_feature_8hpp_source.html index f349ca3994..faf46bdf6d 100644 --- a/_polygon_feature_8hpp_source.html +++ b/_polygon_feature_8hpp_source.html @@ -153,7 +153,7 @@ diff --git a/_routing___params_8h_source.html b/_routing___params_8h_source.html index 5da90e317c..b52389464c 100644 --- a/_routing___params_8h_source.html +++ b/_routing___params_8h_source.html @@ -127,7 +127,7 @@ diff --git a/_routing___py___adapter_8hpp_source.html b/_routing___py___adapter_8hpp_source.html index c4d7545601..9c529fcc1d 100644 --- a/_routing___py___adapter_8hpp_source.html +++ b/_routing___py___adapter_8hpp_source.html @@ -166,7 +166,7 @@ diff --git a/_simulation___time_8h_source.html b/_simulation___time_8h_source.html index 3334594b3c..536fc4af1e 100644 --- a/_simulation___time_8h_source.html +++ b/_simulation___time_8h_source.html @@ -210,7 +210,7 @@ diff --git a/_state___exception_8hpp_source.html b/_state___exception_8hpp_source.html index 594df96b63..a39a7763b1 100644 --- a/_state___exception_8hpp_source.html +++ b/_state___exception_8hpp_source.html @@ -142,7 +142,7 @@ diff --git a/_stream_handler_8hpp_source.html b/_stream_handler_8hpp_source.html index 0725ee66ab..bc83afc791 100644 --- a/_stream_handler_8hpp_source.html +++ b/_stream_handler_8hpp_source.html @@ -208,7 +208,7 @@ diff --git a/_units_helper_8hpp_source.html b/_units_helper_8hpp_source.html index ba94ac78f9..2f16845513 100644 --- a/_units_helper_8hpp_source.html +++ b/_units_helper_8hpp_source.html @@ -154,7 +154,7 @@ diff --git a/_w_k_b_8hpp_source.html b/_w_k_b_8hpp_source.html index a9df390b2d..f835e06923 100644 --- a/_w_k_b_8hpp_source.html +++ b/_w_k_b_8hpp_source.html @@ -200,7 +200,7 @@ diff --git a/_wrapped_data_provider_8hpp_source.html b/_wrapped_data_provider_8hpp_source.html index 93062acf2f..d732abc428 100644 --- a/_wrapped_data_provider_8hpp_source.html +++ b/_wrapped_data_provider_8hpp_source.html @@ -115,8 +115,8 @@
45 provider_to_move.wrapped_provider = nullptr;
46 }
47
-
54 const std::vector<std::string> &get_available_variable_names() override {
-
55 return wrapped_provider->get_available_variable_names();
+
54 boost::span<const std::string> get_available_variable_names() override {
+
55 return wrapped_provider->get_available_variable_names();
56 }
57
63 long get_data_start_time() override {
@@ -157,10 +157,11 @@
136
137#endif //NGEN_WRAPPEDFORCINGPROVIDER_HPP
CatchmentAggrDataSelector
This class is intended to be the virtual base for all data selectors used with the DataProvider API.
Definition: DataProviderSelectors.hpp:13
-
data_access::DataProvider::get_available_variable_names
virtual const std::vector< std::string > & get_available_variable_names()=0
Return the variables that are accessable by this data provider.
+
boost::span
Definition: span.hpp:169
+
data_access::DataProvider::get_available_variable_names
virtual boost::span< const std::string > get_available_variable_names()=0
Return the variables that are accessable by this data provider.
data_access::DataProvider::get_value
virtual data_type get_value(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the value of a forcing property for an arbitrary time period, converting units if needed.
data_access::DataProvider::record_duration
virtual long record_duration()=0
Return the stride in the time dimension.
-
data_access::DataProvider::is_property_sum_over_time_step
virtual bool is_property_sum_over_time_step(const std::string &name)
Definition: DataProvider.hpp:88
+
data_access::DataProvider::is_property_sum_over_time_step
virtual bool is_property_sum_over_time_step(const std::string &name)
Definition: DataProvider.hpp:89
data_access::DataProvider::get_data_start_time
virtual long get_data_start_time()=0
Return the first valid time for which data from the request variable can be requested.
data_access::DataProvider::get_ts_index_for_time
virtual size_t get_ts_index_for_time(const time_t &epoch_time)=0
Get the index of the data time step that contains the given point in time.
data_access::DataProvider::get_values
virtual std::vector< data_type > get_values(const selection_type &selector, ReSampleMethod m=SUM)=0
Get the values of a forcing property for an arbitrary time period, converting units if needed.
@@ -177,17 +178,17 @@
data_access::WrappedDataProvider::get_data_stop_time
long get_data_stop_time() override
Get the exclusive ending of the period of time over which this instance can provide data for this for...
Definition: WrappedDataProvider.hpp:72
data_access::WrappedDataProvider::record_duration
long record_duration() override
Return the stride in the time dimension.
Definition: WrappedDataProvider.hpp:76
data_access::WrappedDataProvider::WrappedDataProvider
WrappedDataProvider(WrappedDataProvider &&provider_to_move)
Move constructor.
Definition: WrappedDataProvider.hpp:42
-
data_access::WrappedDataProvider::get_available_variable_names
const std::vector< std::string > & get_available_variable_names() override
Get the available variable names object.
Definition: WrappedDataProvider.hpp:54
data_access::WrappedDataProvider::is_property_sum_over_time_step
bool is_property_sum_over_time_step(const std::string &name) override
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Definition: WrappedDataProvider.hpp:127
+
data_access::WrappedDataProvider::get_available_variable_names
boost::span< const std::string > get_available_variable_names() override
Get the available variable names object.
Definition: WrappedDataProvider.hpp:54
data_access
Definition: AorcForcing.hpp:75
-
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:16
+
data_access::ReSampleMethod
ReSampleMethod
An abstraction for classes that provides access to data.
Definition: DataProvider.hpp:17
diff --git a/all_8h_source.html b/all_8h_source.html index 6857c74471..39afdabed3 100644 --- a/all_8h_source.html +++ b/all_8h_source.html @@ -104,7 +104,7 @@ diff --git a/annotated.html b/annotated.html index f2c4448158..322fb63891 100644 --- a/annotated.html +++ b/annotated.html @@ -256,7 +256,7 @@ diff --git a/bmi_8h_source.html b/bmi_8h_source.html index 8e539cafb3..92b8048949 100644 --- a/bmi_8h_source.html +++ b/bmi_8h_source.html @@ -264,7 +264,7 @@ diff --git a/bmi_8hpp_source.html b/bmi_8hpp_source.html index 86b96ca5ac..b2dc1d6092 100644 --- a/bmi_8hpp_source.html +++ b/bmi_8hpp_source.html @@ -241,7 +241,7 @@ diff --git a/bmi__utilities_8hpp_source.html b/bmi__utilities_8hpp_source.html index a0a65adc39..066377d757 100644 --- a/bmi__utilities_8hpp_source.html +++ b/bmi__utilities_8hpp_source.html @@ -214,7 +214,7 @@ diff --git a/boostcore__data_8hpp_source.html b/boostcore__data_8hpp_source.html index bd2c85934a..14ed760b04 100644 --- a/boostcore__data_8hpp_source.html +++ b/boostcore__data_8hpp_source.html @@ -148,7 +148,7 @@ diff --git a/class_b_m_i_data_selector-members.html b/class_b_m_i_data_selector-members.html index ee6f571c96..1ecda3573d 100644 --- a/class_b_m_i_data_selector-members.html +++ b/class_b_m_i_data_selector-members.html @@ -118,7 +118,7 @@ diff --git a/class_b_m_i_data_selector.html b/class_b_m_i_data_selector.html index 11b0b80b76..67d0ca85b0 100644 --- a/class_b_m_i_data_selector.html +++ b/class_b_m_i_data_selector.html @@ -693,7 +693,7 @@

diff --git a/class_c_s_v_data_selector-members.html b/class_c_s_v_data_selector-members.html index d973b8bd0e..11a3922d3b 100644 --- a/class_c_s_v_data_selector-members.html +++ b/class_c_s_v_data_selector-members.html @@ -118,7 +118,7 @@ diff --git a/class_c_s_v_data_selector.html b/class_c_s_v_data_selector.html index 9709e250bf..acf9dc8f7e 100644 --- a/class_c_s_v_data_selector.html +++ b/class_c_s_v_data_selector.html @@ -698,7 +698,7 @@

    - +
diff --git a/class_c_s_v_reader-members.html b/class_c_s_v_reader-members.html index c5111fb210..0f3ab1efeb 100644 --- a/class_c_s_v_reader-members.html +++ b/class_c_s_v_reader-members.html @@ -104,7 +104,7 @@ diff --git a/class_c_s_v_reader.html b/class_c_s_v_reader.html index f331084867..b295903c45 100644 --- a/class_c_s_v_reader.html +++ b/class_c_s_v_reader.html @@ -249,7 +249,7 @@

    - +
diff --git a/class_catchment_aggr_data_selector-members.html b/class_catchment_aggr_data_selector-members.html index 6b781b175a..ebc9d26506 100644 --- a/class_catchment_aggr_data_selector-members.html +++ b/class_catchment_aggr_data_selector-members.html @@ -117,7 +117,7 @@ diff --git a/class_catchment_aggr_data_selector.html b/class_catchment_aggr_data_selector.html index dc81068125..10ce797e56 100644 --- a/class_catchment_aggr_data_selector.html +++ b/class_catchment_aggr_data_selector.html @@ -749,7 +749,7 @@

    - +
diff --git a/class_csv_per_feature_forcing_provider-members.html b/class_csv_per_feature_forcing_provider-members.html index 5bd2414f8d..2fa6e370e9 100644 --- a/class_csv_per_feature_forcing_provider-members.html +++ b/class_csv_per_feature_forcing_provider-members.html @@ -108,7 +108,7 @@ forcing_file_nameCsvPerFeatureForcingProviderprivate forcing_vector_indexCsvPerFeatureForcingProviderprivate forcing_vectorsCsvPerFeatureForcingProviderprivate - get_available_variable_names() overrideCsvPerFeatureForcingProviderinlinevirtual + get_available_variable_names() overrideCsvPerFeatureForcingProviderinlinevirtual get_data_start_time() overrideCsvPerFeatureForcingProviderinlinevirtual get_data_stop_time() overrideCsvPerFeatureForcingProviderinlinevirtual get_ts_index_for_time(const time_t &epoch_time) overrideCsvPerFeatureForcingProviderinlinevirtual @@ -132,7 +132,7 @@ diff --git a/class_csv_per_feature_forcing_provider.html b/class_csv_per_feature_forcing_provider.html index 5f6fdeed48..769a5f00eb 100644 --- a/class_csv_per_feature_forcing_provider.html +++ b/class_csv_per_feature_forcing_provider.html @@ -153,9 +153,9 @@ bool is_property_sum_over_time_step (const std::string &name) override  Get whether a property's per-time-step values are each an aggregate sum over the entire time step. More...
  -const std::vector< std::string > & get_available_variable_names () override - Return the variables that are accessable by this data provider. More...
-  +boost::span< const std::string > get_available_variable_names () override + Return the variables that are accessable by this data provider. More...
+  @@ -285,8 +285,8 @@

-

◆ get_available_variable_names()

+ +

◆ get_available_variable_names()

@@ -295,7 +295,7 @@

Private Member Functions

- + @@ -310,7 +310,7 @@

data_access::DataProvider< double, CatchmentAggrDataSelector >.

+

Implements data_access::DataProvider< double, CatchmentAggrDataSelector >.

References available_forcings.

@@ -791,7 +791,7 @@

-

Referenced by get_available_variable_names(), and read_csv().

+

Referenced by get_available_variable_names(), and read_csv().

@@ -1149,7 +1149,7 @@

    - +
diff --git a/class_csv_per_feature_forcing_provider.js b/class_csv_per_feature_forcing_provider.js index e21d832e4e..88a86785cb 100644 --- a/class_csv_per_feature_forcing_provider.js +++ b/class_csv_per_feature_forcing_provider.js @@ -3,7 +3,7 @@ var class_csv_per_feature_forcing_provider = [ "time_type", "class_csv_per_feature_forcing_provider.html#aa40e6c7ba39854c2a69c2656376c95f0", null ], [ "CsvPerFeatureForcingProvider", "class_csv_per_feature_forcing_provider.html#a7034f120d89f39c83b61903669c2e435", null ], [ "check_forcing_vector_index_bounds", "class_csv_per_feature_forcing_provider.html#a64d117949c5c1b9cfed33017ed388119", null ], - [ "get_available_variable_names", "class_csv_per_feature_forcing_provider.html#a513db9f07155777f21ca0554639e4489", null ], + [ "get_available_variable_names", "class_csv_per_feature_forcing_provider.html#adc16fbddbb172454efb9cf28a21260ef", null ], [ "get_data_start_time", "class_csv_per_feature_forcing_provider.html#ad96c3f70785165d98d3a3f13e5256e6c", null ], [ "get_data_stop_time", "class_csv_per_feature_forcing_provider.html#a88f3732ea7088e8f2b582302f7b2fee6", null ], [ "get_ts_index_for_time", "class_csv_per_feature_forcing_provider.html#ad1f87f13f0bc6c5d616158d90eac9fc3", null ], diff --git a/class_feature___test-members.html b/class_feature___test-members.html index b4a583da0d..0fc66935c4 100644 --- a/class_feature___test-members.html +++ b/class_feature___test-members.html @@ -104,7 +104,7 @@ diff --git a/class_feature___test.html b/class_feature___test.html index 99bd2c9b8a..e90f488eb3 100644 --- a/class_feature___test.html +++ b/class_feature___test.html @@ -234,7 +234,7 @@

    - +
diff --git a/class_feature_collection___test-members.html b/class_feature_collection___test-members.html index cdad5a85b5..29f1a4b5f8 100644 --- a/class_feature_collection___test-members.html +++ b/class_feature_collection___test-members.html @@ -104,7 +104,7 @@ diff --git a/class_feature_collection___test.html b/class_feature_collection___test.html index bd37764fc0..3c4faa8ce8 100644 --- a/class_feature_collection___test.html +++ b/class_feature_collection___test.html @@ -234,7 +234,7 @@

    - +
diff --git a/class_g_m___object-members.html b/class_g_m___object-members.html index 5568c96bea..a0d39650eb 100644 --- a/class_g_m___object-members.html +++ b/class_g_m___object-members.html @@ -102,7 +102,7 @@ diff --git a/class_g_m___object.html b/class_g_m___object.html index 211ed59353..38c8b08426 100644 --- a/class_g_m___object.html +++ b/class_g_m___object.html @@ -174,7 +174,7 @@

    - +
diff --git a/class_h_y___cartographic_realization-members.html b/class_h_y___cartographic_realization-members.html index 6d13ddfcb8..4300bb2a08 100644 --- a/class_h_y___cartographic_realization-members.html +++ b/class_h_y___cartographic_realization-members.html @@ -111,7 +111,7 @@ diff --git a/class_h_y___cartographic_realization.html b/class_h_y___cartographic_realization.html index 68ec6f1b50..16b58ccc96 100644 --- a/class_h_y___cartographic_realization.html +++ b/class_h_y___cartographic_realization.html @@ -370,7 +370,7 @@

    - +
diff --git a/class_h_y___catchment-members.html b/class_h_y___catchment-members.html index cf2595ad46..1a79156857 100644 --- a/class_h_y___catchment-members.html +++ b/class_h_y___catchment-members.html @@ -119,7 +119,7 @@ diff --git a/class_h_y___catchment.html b/class_h_y___catchment.html index 9dbd70c672..089791e4d5 100644 --- a/class_h_y___catchment.html +++ b/class_h_y___catchment.html @@ -574,7 +574,7 @@

    - +
diff --git a/class_h_y___catchment_aggregate-members.html b/class_h_y___catchment_aggregate-members.html index aa44c792d3..357564e0ba 100644 --- a/class_h_y___catchment_aggregate-members.html +++ b/class_h_y___catchment_aggregate-members.html @@ -121,7 +121,7 @@ diff --git a/class_h_y___catchment_aggregate.html b/class_h_y___catchment_aggregate.html index 42fc071c36..f04c1903c3 100644 --- a/class_h_y___catchment_aggregate.html +++ b/class_h_y___catchment_aggregate.html @@ -532,7 +532,7 @@

    - +
diff --git a/class_h_y___catchment_area-members.html b/class_h_y___catchment_area-members.html index b5d401ed19..0de2b9e6b1 100644 --- a/class_h_y___catchment_area-members.html +++ b/class_h_y___catchment_area-members.html @@ -118,7 +118,7 @@ diff --git a/class_h_y___catchment_area.html b/class_h_y___catchment_area.html index 22ff1a7d3d..9877b4cff0 100644 --- a/class_h_y___catchment_area.html +++ b/class_h_y___catchment_area.html @@ -510,7 +510,7 @@

    - +
diff --git a/class_h_y___catchment_divide-members.html b/class_h_y___catchment_divide-members.html index 3de4f65efd..6d28c546db 100644 --- a/class_h_y___catchment_divide-members.html +++ b/class_h_y___catchment_divide-members.html @@ -117,7 +117,7 @@ diff --git a/class_h_y___catchment_divide.html b/class_h_y___catchment_divide.html index 587dad74ec..8a4a2445af 100644 --- a/class_h_y___catchment_divide.html +++ b/class_h_y___catchment_divide.html @@ -459,7 +459,7 @@

    - +
diff --git a/class_h_y___catchment_realization-members.html b/class_h_y___catchment_realization-members.html index 4a7fe8326a..96cd33bfd3 100644 --- a/class_h_y___catchment_realization-members.html +++ b/class_h_y___catchment_realization-members.html @@ -109,7 +109,7 @@ diff --git a/class_h_y___catchment_realization.html b/class_h_y___catchment_realization.html index 967563d201..c8d322dcc3 100644 --- a/class_h_y___catchment_realization.html +++ b/class_h_y___catchment_realization.html @@ -390,7 +390,7 @@

    - +
diff --git a/class_h_y___dendritic_catchment-members.html b/class_h_y___dendritic_catchment-members.html index b6c3c78cf7..4495485d93 100644 --- a/class_h_y___dendritic_catchment-members.html +++ b/class_h_y___dendritic_catchment-members.html @@ -121,7 +121,7 @@ diff --git a/class_h_y___dendritic_catchment.html b/class_h_y___dendritic_catchment.html index 883541394f..337180fa0c 100644 --- a/class_h_y___dendritic_catchment.html +++ b/class_h_y___dendritic_catchment.html @@ -532,7 +532,7 @@

    - +
diff --git a/class_h_y___flow_path-members.html b/class_h_y___flow_path-members.html index 018dac1adc..077fdd1f36 100644 --- a/class_h_y___flow_path-members.html +++ b/class_h_y___flow_path-members.html @@ -116,7 +116,7 @@ diff --git a/class_h_y___flow_path.html b/class_h_y___flow_path.html index e7cfd14f64..5ff1a1cc05 100644 --- a/class_h_y___flow_path.html +++ b/class_h_y___flow_path.html @@ -435,7 +435,7 @@

    - +
diff --git a/class_h_y___hydro_feature-members.html b/class_h_y___hydro_feature-members.html index f090ec5be3..561b3eeace 100644 --- a/class_h_y___hydro_feature-members.html +++ b/class_h_y___hydro_feature-members.html @@ -102,7 +102,7 @@ diff --git a/class_h_y___hydro_feature.html b/class_h_y___hydro_feature.html index d8aee4281a..53655b3e26 100644 --- a/class_h_y___hydro_feature.html +++ b/class_h_y___hydro_feature.html @@ -174,7 +174,7 @@

    - +
diff --git a/class_h_y___hydro_network-members.html b/class_h_y___hydro_network-members.html index 0422854bc0..9f2d59aeaa 100644 --- a/class_h_y___hydro_network-members.html +++ b/class_h_y___hydro_network-members.html @@ -117,7 +117,7 @@ diff --git a/class_h_y___hydro_network.html b/class_h_y___hydro_network.html index 53a3e1d8bc..35d5af7852 100644 --- a/class_h_y___hydro_network.html +++ b/class_h_y___hydro_network.html @@ -470,7 +470,7 @@

    - +
diff --git a/class_h_y___hydro_nexus-members.html b/class_h_y___hydro_nexus-members.html index 5899cbb205..bfedbef968 100644 --- a/class_h_y___hydro_nexus-members.html +++ b/class_h_y___hydro_nexus-members.html @@ -120,7 +120,7 @@ diff --git a/class_h_y___hydro_nexus.html b/class_h_y___hydro_nexus.html index 6cf610686c..689565b280 100644 --- a/class_h_y___hydro_nexus.html +++ b/class_h_y___hydro_nexus.html @@ -734,7 +734,7 @@

    - +
diff --git a/class_h_y___interior_catchment-members.html b/class_h_y___interior_catchment-members.html index bb163fe88f..d9b2b02b31 100644 --- a/class_h_y___interior_catchment-members.html +++ b/class_h_y___interior_catchment-members.html @@ -121,7 +121,7 @@ diff --git a/class_h_y___interior_catchment.html b/class_h_y___interior_catchment.html index 8e47ec3bb9..5027adcf67 100644 --- a/class_h_y___interior_catchment.html +++ b/class_h_y___interior_catchment.html @@ -532,7 +532,7 @@

    - +
diff --git a/class_h_y___point_hydro_nexus-members.html b/class_h_y___point_hydro_nexus-members.html index 4514c34acc..1f245126de 100644 --- a/class_h_y___point_hydro_nexus-members.html +++ b/class_h_y___point_hydro_nexus-members.html @@ -132,7 +132,7 @@ diff --git a/class_h_y___point_hydro_nexus.html b/class_h_y___point_hydro_nexus.html index 36bc1c4098..fc70ff0fbe 100644 --- a/class_h_y___point_hydro_nexus.html +++ b/class_h_y___point_hydro_nexus.html @@ -960,7 +960,7 @@

    - +
diff --git a/class_j_s_o_n_geometry___test-members.html b/class_j_s_o_n_geometry___test-members.html index 8d2eb3ffdd..514dcfbb4c 100644 --- a/class_j_s_o_n_geometry___test-members.html +++ b/class_j_s_o_n_geometry___test-members.html @@ -104,7 +104,7 @@ diff --git a/class_j_s_o_n_geometry___test.html b/class_j_s_o_n_geometry___test.html index 234b458387..4a0364c962 100644 --- a/class_j_s_o_n_geometry___test.html +++ b/class_j_s_o_n_geometry___test.html @@ -234,7 +234,7 @@

    - +
diff --git a/class_j_s_o_n_property___test-members.html b/class_j_s_o_n_property___test-members.html index f953761c77..c32c491166 100644 --- a/class_j_s_o_n_property___test-members.html +++ b/class_j_s_o_n_property___test-members.html @@ -104,7 +104,7 @@ diff --git a/class_j_s_o_n_property___test.html b/class_j_s_o_n_property___test.html index 37a61d24c4..107b18bf47 100644 --- a/class_j_s_o_n_property___test.html +++ b/class_j_s_o_n_property___test.html @@ -234,7 +234,7 @@

    - +
diff --git a/class_network___test-members.html b/class_network___test-members.html index fe571adecd..f6de1b1e4d 100644 --- a/class_network___test-members.html +++ b/class_network___test-members.html @@ -109,7 +109,7 @@ diff --git a/class_network___test.html b/class_network___test.html index fd10bed05a..3c5af6a177 100644 --- a/class_network___test.html +++ b/class_network___test.html @@ -402,7 +402,7 @@

    - +
diff --git a/class_network___test1-members.html b/class_network___test1-members.html index 0bef6e65f0..0c349e13ad 100644 --- a/class_network___test1-members.html +++ b/class_network___test1-members.html @@ -112,7 +112,7 @@ diff --git a/class_network___test1.html b/class_network___test1.html index 4a71480cc0..0736d8613b 100644 --- a/class_network___test1.html +++ b/class_network___test1.html @@ -435,7 +435,7 @@

    - +
diff --git a/class_network___test2-members.html b/class_network___test2-members.html index 26694d1457..a482be53a3 100644 --- a/class_network___test2-members.html +++ b/class_network___test2-members.html @@ -111,7 +111,7 @@ diff --git a/class_network___test2.html b/class_network___test2.html index f692e10641..89a3a518df 100644 --- a/class_network___test2.html +++ b/class_network___test2.html @@ -408,7 +408,7 @@

    - +
diff --git a/class_nexus___remote___test-members.html b/class_nexus___remote___test-members.html index 55360833df..d2b935acfa 100644 --- a/class_nexus___remote___test-members.html +++ b/class_nexus___remote___test-members.html @@ -109,7 +109,7 @@ diff --git a/class_nexus___remote___test.html b/class_nexus___remote___test.html index 245e09c5e5..33a8d98d99 100644 --- a/class_nexus___remote___test.html +++ b/class_nexus___remote___test.html @@ -385,7 +385,7 @@

    - +
diff --git a/class_nexus___test-members.html b/class_nexus___test-members.html index 2bdc3c7cad..2ee7430ce2 100644 --- a/class_nexus___test-members.html +++ b/class_nexus___test-members.html @@ -107,7 +107,7 @@ diff --git a/class_nexus___test.html b/class_nexus___test.html index c57cc09aab..5ac01ac3c2 100644 --- a/class_nexus___test.html +++ b/class_nexus___test.html @@ -311,7 +311,7 @@

    - +
diff --git a/class_null_forcing_provider-members.html b/class_null_forcing_provider-members.html index 23e71f22eb..7ba626b416 100644 --- a/class_null_forcing_provider-members.html +++ b/class_null_forcing_provider-members.html @@ -95,23 +95,22 @@

This is the complete list of members for NullForcingProvider, including all inherited members.

const std::vector< std::string > & CsvPerFeatureForcingProvider::get_available_variable_names boost::span< const std::string > CsvPerFeatureForcingProvider::get_available_variable_names ( )
- - - - - - - - - - - + + + + + + + + + +
available_forcingsNullForcingProviderprivate
get_available_variable_names() overrideNullForcingProviderinlinevirtual
get_data_start_time() overrideNullForcingProviderinlinevirtual
get_data_stop_time() overrideNullForcingProviderinlinevirtual
get_ts_index_for_time(const time_t &epoch_time) overrideNullForcingProviderinlinevirtual
get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) overrideNullForcingProviderinlinevirtual
get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) overrideNullForcingProviderinlinevirtual
is_property_sum_over_time_step(const std::string &name) overrideNullForcingProviderinlinevirtual
NullForcingProvider()NullForcingProviderinline
record_duration() overrideNullForcingProviderinlinevirtual
~DataProvider()=defaultdata_access::DataProvider< double, CatchmentAggrDataSelector >virtual
get_available_variable_names() overrideNullForcingProviderinlinevirtual
get_data_start_time() overrideNullForcingProviderinlinevirtual
get_data_stop_time() overrideNullForcingProviderinlinevirtual
get_ts_index_for_time(const time_t &epoch_time) overrideNullForcingProviderinlinevirtual
get_value(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) overrideNullForcingProviderinlinevirtual
get_values(const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) overrideNullForcingProviderinlinevirtual
is_property_sum_over_time_step(const std::string &name) overrideNullForcingProviderinlinevirtual
NullForcingProvider()NullForcingProviderinline
record_duration() overrideNullForcingProviderinlinevirtual
~DataProvider()=defaultdata_access::DataProvider< double, CatchmentAggrDataSelector >virtual
diff --git a/class_null_forcing_provider.html b/class_null_forcing_provider.html index 7917a8bbac..c18e384bd6 100644 --- a/class_null_forcing_provider.html +++ b/class_null_forcing_provider.html @@ -91,7 +91,6 @@
NullForcingProvider Class Reference
@@ -142,14 +141,9 @@   bool is_property_sum_over_time_step (const std::string &name) override   -const std::vector< std::string > & get_available_variable_names () override - Return the variables that are accessable by this data provider. More...
-  - - - - + + +

-Private Attributes

std::vector< std::string > available_forcings
 
boost::span< const std::string > get_available_variable_names () override
 Return the variables that are accessable by this data provider. More...
 

Detailed Description

diff --git a/class_null_forcing_provider.js b/class_null_forcing_provider.js index cb21203e9b..cf3aedc734 100644 --- a/class_null_forcing_provider.js +++ b/class_null_forcing_provider.js @@ -1,13 +1,12 @@ var class_null_forcing_provider = [ [ "NullForcingProvider", "class_null_forcing_provider.html#a586f4876aa823dee3c07963f49b2423b", null ], - [ "get_available_variable_names", "class_null_forcing_provider.html#a67a849ceb6d377dc95fd5d9edb350267", null ], + [ "get_available_variable_names", "class_null_forcing_provider.html#a4487421e46fcf87995144873402a2d57", null ], [ "get_data_start_time", "class_null_forcing_provider.html#a25565dbc5856f7f79858c7b0e641659e", null ], [ "get_data_stop_time", "class_null_forcing_provider.html#a7f50953a40f8d1c4911b91d35e52efda", null ], [ "get_ts_index_for_time", "class_null_forcing_provider.html#a6fe63dfccf5fc86d2d4f730df4a806ab", null ], [ "get_value", "class_null_forcing_provider.html#a28350a9c2d92fd90578212ce3f8574c8", null ], [ "get_values", "class_null_forcing_provider.html#a86b93fe9449bcbe7c321952308217fca", null ], [ "is_property_sum_over_time_step", "class_null_forcing_provider.html#a9350efc0423d384f5b5207f9fa46d2f8", null ], - [ "record_duration", "class_null_forcing_provider.html#ace80c5c208f3bb23005126f011c5ecf9", null ], - [ "available_forcings", "class_null_forcing_provider.html#aeda33805248363c36f52e07d202f6d7b", null ] + [ "record_duration", "class_null_forcing_provider.html#ace80c5c208f3bb23005126f011c5ecf9", null ] ]; \ No newline at end of file diff --git a/class_null_forcing_provider__coll__graph.map b/class_null_forcing_provider__coll__graph.map index b0d4affb4f..9ce39ee0af 100644 --- a/class_null_forcing_provider__coll__graph.map +++ b/class_null_forcing_provider__coll__graph.map @@ -1,11 +1,6 @@ - - + + - - - - - diff --git a/class_null_forcing_provider__coll__graph.md5 b/class_null_forcing_provider__coll__graph.md5 index c4a7b65290..a3ebb90979 100644 --- a/class_null_forcing_provider__coll__graph.md5 +++ b/class_null_forcing_provider__coll__graph.md5 @@ -1 +1 @@ -c0238264a91de0b7196fe521a914883c \ No newline at end of file +df3323cf76f5254789b906f761ec0fe6 \ No newline at end of file diff --git a/class_null_forcing_provider__coll__graph.svg b/class_null_forcing_provider__coll__graph.svg index 07bac2b0ca..5cae04fda4 100644 --- a/class_null_forcing_provider__coll__graph.svg +++ b/class_null_forcing_provider__coll__graph.svg @@ -4,7 +4,7 @@ - +