diff --git a/include/realizations/catchment/Bmi_C_Formulation.hpp b/include/realizations/catchment/Bmi_C_Formulation.hpp index 2d59e3f703..64823cff19 100644 --- a/include/realizations/catchment/Bmi_C_Formulation.hpp +++ b/include/realizations/catchment/Bmi_C_Formulation.hpp @@ -68,18 +68,6 @@ namespace realization { return (T) outputs[t_index]; } - /** - * Get value for some BMI model variable. - * - * This function assumes that the given variable, while returned by the model within an array per the BMI spec, - * is actual a single, scalar value. Thus, it returns what is at index 0 of the array reference. - * - * @param index - * @param var_name - * @return - */ - double get_var_value_as_double(const std::string& var_name) override; - /** * Get value for some BMI model variable at a specific index. * @@ -99,6 +87,7 @@ namespace realization { * @return */ double get_var_value_as_double(const int& index, const std::string& var_name) override; + using Bmi_Formulation::get_var_value_as_double; /** * Test whether backing model has run BMI ``Initialize``. diff --git a/include/realizations/catchment/Bmi_Cpp_Formulation.hpp b/include/realizations/catchment/Bmi_Cpp_Formulation.hpp index 0848c26950..42c951e6b0 100644 --- a/include/realizations/catchment/Bmi_Cpp_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Cpp_Formulation.hpp @@ -36,9 +36,8 @@ namespace realization { return (T) outputs[t_index]; } - double get_var_value_as_double(const std::string& var_name) override; - double get_var_value_as_double(const int& index, const std::string& var_name) override; + using Bmi_Formulation::get_var_value_as_double; bool is_model_initialized() override; diff --git a/include/realizations/catchment/Bmi_Formulation.hpp b/include/realizations/catchment/Bmi_Formulation.hpp index a1172c39d8..56fb1a0e85 100644 --- a/include/realizations/catchment/Bmi_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Formulation.hpp @@ -225,7 +225,7 @@ namespace realization { * @param var_name * @return */ - virtual double get_var_value_as_double(const std::string& var_name) = 0; + double get_var_value_as_double(const std::string& var_name); /** * Get value for some BMI model variable at a specific index. diff --git a/include/realizations/catchment/Bmi_Fortran_Formulation.hpp b/include/realizations/catchment/Bmi_Fortran_Formulation.hpp index da91040dac..7c72004e8a 100644 --- a/include/realizations/catchment/Bmi_Fortran_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Fortran_Formulation.hpp @@ -46,9 +46,8 @@ namespace realization { return (time_t) (get_bmi_model()->convert_model_time_to_seconds(model_time)); } - double get_var_value_as_double(const std::string &var_name) override; - double get_var_value_as_double(const int &index, const std::string &var_name) override; + using Bmi_Formulation::get_var_value_as_double; friend class Bmi_Multi_Formulation; diff --git a/include/realizations/catchment/Bmi_Multi_Formulation.hpp b/include/realizations/catchment/Bmi_Multi_Formulation.hpp index accac74703..5f6d9cb594 100644 --- a/include/realizations/catchment/Bmi_Multi_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Multi_Formulation.hpp @@ -531,20 +531,6 @@ namespace realization { */ void create_multi_formulation(geojson::PropertyMap properties, bool needs_param_validation); - /** - * Get value for some BMI model variable. - * - * This function assumes that the given variable, while returned by the model within an array per the BMI spec, - * is actual a single, scalar value. Thus, it returns what is at index 0 of the array reference. - * - * @param index - * @param var_name - * @return - */ - double get_var_value_as_double(const std::string &var_name) override { - return get_var_value_as_double(0, var_name); - } - /** * Get value for some BMI model variable at a specific index. * @@ -590,6 +576,7 @@ namespace realization { // TODO: look at adjusting defs to move this function up in class hierarchy (or at least add TODO there) } } + using Bmi_Formulation::get_var_value_as_double; /** * Initialize the deferred associations with the providers in @ref deferredProviders. diff --git a/include/realizations/catchment/Bmi_Py_Formulation.hpp b/include/realizations/catchment/Bmi_Py_Formulation.hpp index 530fc144d3..501a97e5d7 100644 --- a/include/realizations/catchment/Bmi_Py_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Py_Formulation.hpp @@ -41,9 +41,8 @@ namespace realization { time_t convert_model_time(const double &model_time) override; - double get_var_value_as_double(const std::string &var_name) override; - double get_var_value_as_double(const int &index, const std::string &var_name) override; + using Bmi_Formulation::get_var_value_as_double; /** * Test whether backing model has run BMI ``Initialize``. diff --git a/src/realizations/catchment/Bmi_C_Formulation.cpp b/src/realizations/catchment/Bmi_C_Formulation.cpp index 966a1abe89..5bc411770f 100644 --- a/src/realizations/catchment/Bmi_C_Formulation.cpp +++ b/src/realizations/catchment/Bmi_C_Formulation.cpp @@ -35,10 +35,6 @@ std::shared_ptr Bmi_C_Formulation::construct_model(const geojson::P output); } -double Bmi_C_Formulation::get_var_value_as_double(const std::string& var_name) { - return get_var_value_as_double(0, var_name); -} - double Bmi_C_Formulation::get_var_value_as_double(const int& index, const std::string& var_name) { // TODO: consider different way of handling (and how to document) cases like long double or unsigned long long that // don't fit or might convert inappropriately diff --git a/src/realizations/catchment/Bmi_Cpp_Formulation.cpp b/src/realizations/catchment/Bmi_Cpp_Formulation.cpp index b9c4cf0a88..dc18926577 100644 --- a/src/realizations/catchment/Bmi_Cpp_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Cpp_Formulation.cpp @@ -45,10 +45,6 @@ std::shared_ptr Bmi_Cpp_Formulation::construct_model(const geojson: output); } -double Bmi_Cpp_Formulation::get_var_value_as_double(const std::string& var_name) { - return get_var_value_as_double(0, var_name); -} - double Bmi_Cpp_Formulation::get_var_value_as_double(const int& index, const std::string& var_name) { // TODO: consider different way of handling (and how to document) cases like long double or unsigned long long that // don't fit or might convert inappropriately diff --git a/src/realizations/catchment/Bmi_Formulation.cpp b/src/realizations/catchment/Bmi_Formulation.cpp index 008add30a1..015d3810c4 100644 --- a/src/realizations/catchment/Bmi_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Formulation.cpp @@ -2,6 +2,10 @@ namespace realization { + double Bmi_Formulation::get_var_value_as_double(const std::string& var_name) { + return this->get_var_value_as_double(0, var_name); + } + const std::vector Bmi_Formulation::OPTIONAL_PARAMETERS = { BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE, BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES, diff --git a/src/realizations/catchment/Bmi_Fortran_Formulation.cpp b/src/realizations/catchment/Bmi_Fortran_Formulation.cpp index 54ad150dcb..301c828f96 100644 --- a/src/realizations/catchment/Bmi_Fortran_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Fortran_Formulation.cpp @@ -47,10 +47,6 @@ std::string Bmi_Fortran_Formulation::get_formulation_type() { return "bmi_fortran"; } -double Bmi_Fortran_Formulation::get_var_value_as_double(const std::string &var_name) { - return get_var_value_as_double(0, var_name); -} - double Bmi_Fortran_Formulation::get_var_value_as_double(const int &index, const std::string &var_name) { auto model = std::dynamic_pointer_cast(get_bmi_model()); diff --git a/src/realizations/catchment/Bmi_Py_Formulation.cpp b/src/realizations/catchment/Bmi_Py_Formulation.cpp index a119a26717..5cbb43a969 100644 --- a/src/realizations/catchment/Bmi_Py_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Py_Formulation.cpp @@ -49,10 +49,6 @@ std::string Bmi_Py_Formulation::get_formulation_type() { return "bmi_py"; } -double Bmi_Py_Formulation::get_var_value_as_double(const std::string &var_name) { - return get_var_value_as_double(0, var_name); -} - double Bmi_Py_Formulation::get_var_value_as_double(const int &index, const std::string &var_name) { auto model = std::dynamic_pointer_cast(get_bmi_model());