From b627f9cba9250ba9f533aa2e6f0fb8a93e8ae1ea Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Thu, 30 May 2024 10:35:59 -0700 Subject: [PATCH] #570: Remove 'uses_forcing_file' and 'forcing_file'(_path) --- include/bmi/AbstractCLibBmiAdapter.hpp | 6 ++-- include/bmi/Bmi_Adapter.hpp | 5 +-- include/bmi/Bmi_C_Adapter.hpp | 12 ++----- include/bmi/Bmi_Cpp_Adapter.hpp | 12 ++----- include/bmi/Bmi_Fortran_Adapter.hpp | 6 ++-- include/bmi/Bmi_Py_Adapter.hpp | 4 --- .../catchment/Bmi_Formulation.hpp | 9 ------ .../catchment/Bmi_Module_Formulation.hpp | 25 +-------------- .../catchment/Bmi_Multi_Formulation.hpp | 4 --- src/bmi/AbstractCLibBmiAdapter.cpp | 2 -- src/bmi/Bmi_Adapter.cpp | 3 -- src/bmi/Bmi_C_Adapter.cpp | 20 ++++-------- src/bmi/Bmi_Cpp_Adapter.cpp | 14 ++++----- src/bmi/Bmi_Py_Adapter.cpp | 9 ++---- .../catchment/Bmi_C_Formulation.cpp | 1 - .../catchment/Bmi_Cpp_Formulation.cpp | 1 - .../catchment/Bmi_Fortran_Formulation.cpp | 1 - .../catchment/Bmi_Module_Formulation.cpp | 31 ++++++------------- .../catchment/Bmi_Multi_Formulation.cpp | 10 ------ test/bmi/Bmi_C_Adapter_Test.cpp | 6 +--- test/bmi/Bmi_Cpp_Adapter_Test.cpp | 6 +--- test/bmi/Bmi_Fortran_Adapter_Test.cpp | 6 +--- test/bmi/Bmi_Py_Adapter_Test.cpp | 3 -- .../catchments/Bmi_C_Formulation_Test.cpp | 11 ------- test/realizations/catchments/Bmi_C_Pet_IT.cpp | 15 ++------- .../catchments/Bmi_Cpp_Formulation_Test.cpp | 11 ------- .../catchments/Bmi_Cpp_Multi_Array_Test.cpp | 9 ------ .../Bmi_Fortran_Formulation_Test.cpp | 11 ------- .../catchments/Bmi_Multi_Formulation_Test.cpp | 11 ------- .../catchments/Bmi_Py_Formulation_Test.cpp | 11 ------- 30 files changed, 40 insertions(+), 235 deletions(-) diff --git a/include/bmi/AbstractCLibBmiAdapter.hpp b/include/bmi/AbstractCLibBmiAdapter.hpp index a4d3a67baa..9d583d62d2 100644 --- a/include/bmi/AbstractCLibBmiAdapter.hpp +++ b/include/bmi/AbstractCLibBmiAdapter.hpp @@ -15,16 +15,14 @@ namespace models { * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. * @param output The output stream handler. */ AbstractCLibBmiAdapter(const std::string &type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, - std::string registration_func, utils::StreamHandler output); + bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, + utils::StreamHandler output); /** * Class destructor. diff --git a/include/bmi/Bmi_Adapter.hpp b/include/bmi/Bmi_Adapter.hpp index 5313d22921..1b8c1a14de 100644 --- a/include/bmi/Bmi_Adapter.hpp +++ b/include/bmi/Bmi_Adapter.hpp @@ -19,7 +19,7 @@ namespace models { class Bmi_Adapter : public ::bmi::Bmi { public: - Bmi_Adapter(std::string model_name, std::string bmi_init_config, std::string forcing_file_path, bool allow_exceed_end, + Bmi_Adapter(std::string model_name, std::string bmi_init_config, bool allow_exceed_end, bool has_fixed_time_step, utils::StreamHandler output); Bmi_Adapter(Bmi_Adapter const&) = delete; @@ -156,9 +156,6 @@ namespace models { double bmi_model_time_convert_factor; /** Pointer to stored time step size value of backing model, if it is fixed and has been retrieved. */ std::shared_ptr bmi_model_time_step_size = nullptr; - /** Whether this particular model implementation directly reads input data from the forcing file. */ - bool bmi_model_uses_forcing_file; - std::string forcing_file_path; /** Message from an exception (if encountered) on the first attempt to initialize the backing model. */ std::string init_exception_msg; /** Pointer to collection of input variable names for backing model, used by ``GetInputVarNames()``. */ diff --git a/include/bmi/Bmi_C_Adapter.hpp b/include/bmi/Bmi_C_Adapter.hpp index bb15c40164..486f42bf5e 100755 --- a/include/bmi/Bmi_C_Adapter.hpp +++ b/include/bmi/Bmi_C_Adapter.hpp @@ -32,14 +32,12 @@ namespace models { * * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. * @param output The output stream handler. */ - explicit Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, std::string forcing_file_path, + explicit Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, bool allow_exceed_end, bool has_fixed_time_step, const std::string& registration_func, utils::StreamHandler output); @@ -49,15 +47,13 @@ namespace models { * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. * @param output The output stream handler. */ Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, utils::StreamHandler output); protected: @@ -76,8 +72,6 @@ namespace models { * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. @@ -85,7 +79,7 @@ namespace models { * @param do_initialization Whether initialization should be performed during construction or deferred. */ Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, utils::StreamHandler output, bool do_initialization); public: diff --git a/include/bmi/Bmi_Cpp_Adapter.hpp b/include/bmi/Bmi_Cpp_Adapter.hpp index 5ab3a60aca..bcca650280 100644 --- a/include/bmi/Bmi_Cpp_Adapter.hpp +++ b/include/bmi/Bmi_Cpp_Adapter.hpp @@ -35,15 +35,13 @@ namespace models { * * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param creator_func The name for the @see creator_function . * @param destoryer_func The name for the @see destroyer_function . * @param output The output stream handler. */ - explicit Bmi_Cpp_Adapter(const std::string &type_name, std::string library_file_path, std::string forcing_file_path, + explicit Bmi_Cpp_Adapter(const std::string &type_name, std::string library_file_path, bool allow_exceed_end, bool has_fixed_time_step, std::string creator_func, std::string destroyer_func, utils::StreamHandler output); @@ -54,8 +52,6 @@ namespace models { * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param creator_func The name for the @see creator_function . @@ -63,7 +59,7 @@ namespace models { * @param output The output stream handler. */ Bmi_Cpp_Adapter(const std::string& type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string creator_func, std::string destroyer_func, utils::StreamHandler output); @@ -83,8 +79,6 @@ namespace models { * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param creator_func The name for the @see creator_function . @@ -93,7 +87,7 @@ namespace models { * @param do_initialization Whether initialization should be performed during construction or deferred. */ Bmi_Cpp_Adapter(const std::string& type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string creator_func, std::string destroyer_func, utils::StreamHandler output, bool do_initialization); diff --git a/include/bmi/Bmi_Fortran_Adapter.hpp b/include/bmi/Bmi_Fortran_Adapter.hpp index af7095c6af..ba3febb711 100644 --- a/include/bmi/Bmi_Fortran_Adapter.hpp +++ b/include/bmi/Bmi_Fortran_Adapter.hpp @@ -30,20 +30,18 @@ namespace models { public: explicit Bmi_Fortran_Adapter(const std::string &type_name, std::string library_file_path, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, const std::string ®istration_func, utils::StreamHandler output) - : Bmi_Fortran_Adapter(type_name, library_file_path, "", forcing_file_path, allow_exceed_end, + : Bmi_Fortran_Adapter(type_name, library_file_path, "", allow_exceed_end, has_fixed_time_step, registration_func, output) {} Bmi_Fortran_Adapter(const std::string &type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, utils::StreamHandler output) : AbstractCLibBmiAdapter(type_name, library_file_path, bmi_init_config, - forcing_file_path, allow_exceed_end, has_fixed_time_step, registration_func, diff --git a/include/bmi/Bmi_Py_Adapter.hpp b/include/bmi/Bmi_Py_Adapter.hpp index fd31c32750..8d26e5fecb 100644 --- a/include/bmi/Bmi_Py_Adapter.hpp +++ b/include/bmi/Bmi_Py_Adapter.hpp @@ -42,10 +42,6 @@ namespace models { Bmi_Py_Adapter(const std::string &type_name, std::string bmi_init_config, const std::string &bmi_python_type, bool allow_exceed_end, bool has_fixed_time_step, utils::StreamHandler output); - Bmi_Py_Adapter(const std::string &type_name, std::string bmi_init_config, const std::string &bmi_python_type, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, - utils::StreamHandler output); - Bmi_Py_Adapter(Bmi_Py_Adapter const&) = delete; Bmi_Py_Adapter(Bmi_Py_Adapter&&) = delete; diff --git a/include/realizations/catchment/Bmi_Formulation.hpp b/include/realizations/catchment/Bmi_Formulation.hpp index e5c2017406..c864535a00 100644 --- a/include/realizations/catchment/Bmi_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Formulation.hpp @@ -129,8 +129,6 @@ namespace realization { */ virtual const double get_model_end_time() = 0; - virtual const std::string &get_forcing_file_path() const = 0; - /** * Get the name of the specific type of the backing model object. * @@ -189,13 +187,6 @@ namespace realization { virtual bool is_bmi_output_variable(const std::string &var_name) = 0; - /** - * Whether the backing model uses/reads the forcing file directly for getting input data. - * - * @return Whether the backing model uses/reads the forcing file directly for getting input data. - */ - virtual bool is_bmi_using_forcing_file() const = 0; - /** * Test whether the backing model has been initialize using the BMI standard ``Initialize`` function. * diff --git a/include/realizations/catchment/Bmi_Module_Formulation.hpp b/include/realizations/catchment/Bmi_Module_Formulation.hpp index 90e9c8b56d..d939e27734 100644 --- a/include/realizations/catchment/Bmi_Module_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Module_Formulation.hpp @@ -308,8 +308,6 @@ namespace realization { */ std::shared_ptr get_bmi_model(); - const std::string &get_forcing_file_path() const override; - const time_t &get_bmi_model_start_time_forcing_offset_s() override; /** @@ -345,13 +343,6 @@ namespace realization { */ bool is_bmi_model_time_step_fixed() override; - /** - * Whether the backing model uses/reads the forcing file directly for getting input data. - * - * @return Whether the backing model uses/reads the forcing file directly for getting input data. - */ - bool is_bmi_using_forcing_file() const override; - /** * Test whether the backing model object has been initialize using the BMI standard ``Initialize`` function. * @@ -374,15 +365,6 @@ namespace realization { void set_bmi_model_time_step_fixed(bool is_fix_time_step); - /** - * Set whether the backing model uses/reads the forcing file directly for getting input data. - * - * @param uses_forcing_file Whether the backing model uses/reads forcing file directly for getting input data. - */ - void set_bmi_using_forcing_file(bool uses_forcing_file); - - void set_forcing_file_path(const std::string &forcing_path); - /** * Set whether the backing model object has been initialize using the BMI standard ``Initialize`` function. * @@ -455,12 +437,10 @@ namespace realization { time_t bmi_model_start_time_forcing_offset_s; /** A configured mapping of BMI model variable names to standard names for use inside the framework. */ std::map bmi_var_names_map; - /** Whether the backing model uses/reads the forcing file directly for getting input data. */ - bool bmi_using_forcing_file; - std::string forcing_file_path; bool model_initialized = false; std::vector OPTIONAL_PARAMETERS = { + BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE, BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES, BMI_REALIZATION_CFG_PARAM_OPT__OUT_VARS, @@ -474,7 +454,6 @@ namespace realization { BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG, BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR, BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE, - BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS }; }; @@ -498,9 +477,7 @@ namespace realization { // Required parameters first set_bmi_init_config(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG).as_string()); set_bmi_main_output_var(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR).as_string()); - set_forcing_file_path(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__FORCING_FILE).as_string()); set_model_type_name(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE).as_string()); - set_bmi_using_forcing_file(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS).as_boolean()); // Then optional ... diff --git a/include/realizations/catchment/Bmi_Multi_Formulation.hpp b/include/realizations/catchment/Bmi_Multi_Formulation.hpp index 70f4c7d007..d068f0e312 100644 --- a/include/realizations/catchment/Bmi_Multi_Formulation.hpp +++ b/include/realizations/catchment/Bmi_Multi_Formulation.hpp @@ -208,8 +208,6 @@ namespace realization { const std::shared_ptr& out_module, const std::shared_ptr& in_module); - const std::string &get_forcing_file_path() const override; - /** * Get the inclusive beginning of the period of time over which this instance can provide data for this forcing. * @@ -425,8 +423,6 @@ namespace realization { bool is_bmi_output_variable(const std::string &var_name) override; - bool is_bmi_using_forcing_file() const override; - /** * Test whether all backing models have been initialize using the BMI standard ``Initialize`` function. * diff --git a/src/bmi/AbstractCLibBmiAdapter.cpp b/src/bmi/AbstractCLibBmiAdapter.cpp index 81d7caee1e..544eb368a1 100644 --- a/src/bmi/AbstractCLibBmiAdapter.cpp +++ b/src/bmi/AbstractCLibBmiAdapter.cpp @@ -12,7 +12,6 @@ AbstractCLibBmiAdapter::AbstractCLibBmiAdapter( const std::string& type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, @@ -21,7 +20,6 @@ AbstractCLibBmiAdapter::AbstractCLibBmiAdapter( : Bmi_Adapter( type_name, std::move(bmi_init_config), - std::move(forcing_file_path), allow_exceed_end, has_fixed_time_step, output diff --git a/src/bmi/Bmi_Adapter.cpp b/src/bmi/Bmi_Adapter.cpp index a0f6185d28..353529c019 100644 --- a/src/bmi/Bmi_Adapter.cpp +++ b/src/bmi/Bmi_Adapter.cpp @@ -8,15 +8,12 @@ namespace bmi { Bmi_Adapter::Bmi_Adapter( std::string model_name, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, utils::StreamHandler output ) : model_name(std::move(model_name)) , bmi_init_config(std::move(bmi_init_config)) - , bmi_model_uses_forcing_file(!forcing_file_path.empty()) - , forcing_file_path(std::move(forcing_file_path)) , bmi_model_has_fixed_time_step(has_fixed_time_step) , allow_model_exceed_end_time(allow_exceed_end) , output(std::move(output)) diff --git a/src/bmi/Bmi_C_Adapter.cpp b/src/bmi/Bmi_C_Adapter.cpp index 9687918aa0..1a8a11babe 100755 --- a/src/bmi/Bmi_C_Adapter.cpp +++ b/src/bmi/Bmi_C_Adapter.cpp @@ -10,17 +10,15 @@ using namespace models::bmi; * * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. * @param output The output stream handler. */ -Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, std::string forcing_file_path, +Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, bool allow_exceed_end, bool has_fixed_time_step, const std::string& registration_func, utils::StreamHandler output) - : Bmi_C_Adapter(type_name, std::move(library_file_path), "", std::move(forcing_file_path), + : Bmi_C_Adapter(type_name, std::move(library_file_path), "", allow_exceed_end, has_fixed_time_step, registration_func, output) { } /** @@ -29,18 +27,16 @@ Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_f * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. * @param output The output stream handler. */ Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, utils::StreamHandler output) : Bmi_C_Adapter(type_name, std::move(library_file_path), std::move(bmi_init_config), - std::move(forcing_file_path), allow_exceed_end, has_fixed_time_step, + allow_exceed_end, has_fixed_time_step, std::move(registration_func), output, true) { } /** @@ -57,8 +53,6 @@ Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_f * @param type_name The name of the backing BMI module/model type. * @param library_file_path The string path to the shared library file for external module. * @param bmi_init_config The string path to the BMI initialization config file for the module. - * @param forcing_file_path The string path for the forcing file the module should use, empty if it does not - * use one directly. * @param allow_exceed_end Whether the backing model is allowed to execute beyond its advertised end_time. * @param has_fixed_time_step Whether the model has a fixed time step size. * @param registration_func The name for the @see bmi_registration_function. @@ -66,9 +60,9 @@ Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_f * @param do_initialization Whether initialization should be performed during construction or deferred. */ Bmi_C_Adapter::Bmi_C_Adapter(const std::string &type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string registration_func, utils::StreamHandler output, bool do_initialization) - : AbstractCLibBmiAdapter(type_name, library_file_path, std::move(bmi_init_config), std::move(forcing_file_path), allow_exceed_end, + : AbstractCLibBmiAdapter(type_name, library_file_path, std::move(bmi_init_config), allow_exceed_end, has_fixed_time_step, registration_func, output) { if (do_initialization) { @@ -115,9 +109,7 @@ Bmi_C_Adapter::Bmi_C_Adapter(Bmi_C_Adapter &adapter) : model_name(adapter.model_ adapter.bmi_model_has_fixed_time_step), bmi_model_time_convert_factor( adapter.bmi_model_time_convert_factor), - bmi_model_uses_forcing_file(adapter.bmi_model_uses_forcing_file), bmi_registration_function(adapter.bmi_registration_function), - forcing_file_path(adapter.forcing_file_path), init_exception_msg(adapter.init_exception_msg), input_var_names(adapter.input_var_names), model_initialized(adapter.model_initialized), diff --git a/src/bmi/Bmi_Cpp_Adapter.cpp b/src/bmi/Bmi_Cpp_Adapter.cpp index 7dc776cfca..95cd4e1e55 100644 --- a/src/bmi/Bmi_Cpp_Adapter.cpp +++ b/src/bmi/Bmi_Cpp_Adapter.cpp @@ -6,26 +6,26 @@ using namespace models::bmi; -Bmi_Cpp_Adapter::Bmi_Cpp_Adapter(const std::string& type_name, std::string library_file_path, std::string forcing_file_path, +Bmi_Cpp_Adapter::Bmi_Cpp_Adapter(const std::string& type_name, std::string library_file_path, bool allow_exceed_end, bool has_fixed_time_step, std::string creator_func, std::string destroyer_func, utils::StreamHandler output) - : Bmi_Cpp_Adapter(type_name, std::move(library_file_path), "", std::move(forcing_file_path), + : Bmi_Cpp_Adapter(type_name, std::move(library_file_path), "", allow_exceed_end, has_fixed_time_step, creator_func, destroyer_func, output) { } Bmi_Cpp_Adapter::Bmi_Cpp_Adapter(const std::string& type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string creator_func, std::string destroyer_func, utils::StreamHandler output) : Bmi_Cpp_Adapter(type_name, std::move(library_file_path), std::move(bmi_init_config), - std::move(forcing_file_path), allow_exceed_end, has_fixed_time_step, + allow_exceed_end, has_fixed_time_step, std::move(creator_func), std::move(destroyer_func), output, true) { } Bmi_Cpp_Adapter::Bmi_Cpp_Adapter(const std::string& type_name, std::string library_file_path, std::string bmi_init_config, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, std::string creator_func, std::string destroyer_func, utils::StreamHandler output, bool do_initialization) - : AbstractCLibBmiAdapter(type_name, library_file_path, std::move(bmi_init_config), std::move(forcing_file_path), allow_exceed_end, + : AbstractCLibBmiAdapter(type_name, library_file_path, std::move(bmi_init_config), allow_exceed_end, has_fixed_time_step, creator_func, output), model_create_fname(std::move(creator_func)), model_destroy_fname(std::move(destroyer_func)) @@ -67,9 +67,7 @@ Bmi_Cpp_Adapter::Bmi_Cpp_Adapter(Bmi_Cpp_Adapter &adapter) : adapter.bmi_model_has_fixed_time_step), bmi_model_time_convert_factor( adapter.bmi_model_time_convert_factor), - bmi_model_uses_forcing_file(adapter.bmi_model_uses_forcing_file), bmi_registration_function(adapter.bmi_registration_function), - forcing_file_path(adapter.forcing_file_path), init_exception_msg(adapter.init_exception_msg), input_var_names(adapter.input_var_names), model_initialized(adapter.model_initialized), diff --git a/src/bmi/Bmi_Py_Adapter.cpp b/src/bmi/Bmi_Py_Adapter.cpp index c6cc7c38c8..2d60c7fff4 100644 --- a/src/bmi/Bmi_Py_Adapter.cpp +++ b/src/bmi/Bmi_Py_Adapter.cpp @@ -11,15 +11,10 @@ using namespace models::bmi; using namespace pybind11::literals; // to bring in the `_a` literal for pybind11 keyword args functionality Bmi_Py_Adapter::Bmi_Py_Adapter(const std::string &type_name, std::string bmi_init_config, const std::string &bmi_python_type, - bool allow_exceed_end, bool has_fixed_time_step, utils::StreamHandler output) - : Bmi_Py_Adapter(type_name, std::move(bmi_init_config), bmi_python_type, "", allow_exceed_end, has_fixed_time_step, - std::move(output)) {} - -Bmi_Py_Adapter::Bmi_Py_Adapter(const std::string &type_name, std::string bmi_init_config, const std::string &bmi_python_type, - std::string forcing_file_path, bool allow_exceed_end, bool has_fixed_time_step, + bool allow_exceed_end, bool has_fixed_time_step, utils::StreamHandler output) : Bmi_Adapter(type_name + " (BMI Py)", std::move(bmi_init_config), - std::move(forcing_file_path), allow_exceed_end, has_fixed_time_step, + allow_exceed_end, has_fixed_time_step, output), bmi_type_py_full_name(bmi_python_type), np(utils::ngenPy::InterpreterUtil::getPyModule("numpy")) /* like 'import numpy as np' */ diff --git a/src/realizations/catchment/Bmi_C_Formulation.cpp b/src/realizations/catchment/Bmi_C_Formulation.cpp index 5bc411770f..aaeb66266d 100644 --- a/src/realizations/catchment/Bmi_C_Formulation.cpp +++ b/src/realizations/catchment/Bmi_C_Formulation.cpp @@ -28,7 +28,6 @@ std::shared_ptr Bmi_C_Formulation::construct_model(const geojson::P get_model_type_name(), lib_file, get_bmi_init_config(), - (is_bmi_using_forcing_file() ? get_forcing_file_path() : ""), get_allow_model_exceed_end_time(), is_bmi_model_time_step_fixed(), reg_func, diff --git a/src/realizations/catchment/Bmi_Cpp_Formulation.cpp b/src/realizations/catchment/Bmi_Cpp_Formulation.cpp index dc18926577..4016cd802a 100644 --- a/src/realizations/catchment/Bmi_Cpp_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Cpp_Formulation.cpp @@ -37,7 +37,6 @@ std::shared_ptr Bmi_Cpp_Formulation::construct_model(const geojson: get_model_type_name(), lib_file, get_bmi_init_config(), - (is_bmi_using_forcing_file() ? get_forcing_file_path() : ""), get_allow_model_exceed_end_time(), is_bmi_model_time_step_fixed(), model_create_fname, diff --git a/src/realizations/catchment/Bmi_Fortran_Formulation.cpp b/src/realizations/catchment/Bmi_Fortran_Formulation.cpp index 301c828f96..f81f02b53d 100644 --- a/src/realizations/catchment/Bmi_Fortran_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Fortran_Formulation.cpp @@ -36,7 +36,6 @@ std::shared_ptr Bmi_Fortran_Formulation::construct_model(const geoj get_model_type_name(), lib_file, get_bmi_init_config(), - (is_bmi_using_forcing_file() ? get_forcing_file_path() : ""), get_allow_model_exceed_end_time(), is_bmi_model_time_step_fixed(), reg_func, diff --git a/src/realizations/catchment/Bmi_Module_Formulation.cpp b/src/realizations/catchment/Bmi_Module_Formulation.cpp index 57ce360a83..ac52f8f4db 100644 --- a/src/realizations/catchment/Bmi_Module_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Module_Formulation.cpp @@ -289,10 +289,6 @@ namespace realization { return bmi_model; } - const std::string& Bmi_Module_Formulation::get_forcing_file_path() const { - return forcing_file_path; - } - const time_t& Bmi_Module_Formulation::get_bmi_model_start_time_forcing_offset_s() { return bmi_model_start_time_forcing_offset_s; } @@ -305,15 +301,18 @@ namespace realization { set_bmi_init_config(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__INIT_CONFIG).as_string()); set_bmi_main_output_var(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MAIN_OUT_VAR).as_string()); set_model_type_name(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__MODEL_TYPE).as_string()); - set_bmi_using_forcing_file(properties.at(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS).as_boolean()); // Then optional ... - // Note that this must be present if bmi_using_forcing_file is true - if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE) != properties.end()) - set_forcing_file_path(properties.at(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE).as_string()); - else if (is_bmi_using_forcing_file()) - throw std::runtime_error("Can't create BMI formulation: using_forcing_file true but no file path set"); + auto uses_forcings_it = properties.find(BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS); + if (uses_forcings_it != properties.end() && uses_forcings_it->second.as_boolean()) { + throw std::runtime_error("The '" BMI_REALIZATION_CFG_PARAM_REQ__USES_FORCINGS "' parameter was removed and cannot be set"); + } + + auto forcing_file_it = properties.find(BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE); + if (forcing_file_it != properties.end() && forcing_file_it->second.as_string() != "") { + throw std::runtime_error("The '" BMI_REALIZATION_CFG_PARAM_OPT__FORCING_FILE "' parameter was removed and cannot be set " + forcing_file_it->second.as_string()); + } if (properties.find(BMI_REALIZATION_CFG_PARAM_OPT__ALLOW_EXCEED_END) != properties.end()) { set_allow_model_exceed_end_time( @@ -556,10 +555,6 @@ namespace realization { return bmi_model_time_step_fixed; } - bool Bmi_Module_Formulation::is_bmi_using_forcing_file() const { - return bmi_using_forcing_file; - } - bool Bmi_Module_Formulation::is_model_initialized() { return model_initialized; } @@ -583,14 +578,6 @@ namespace realization { bmi_model_time_step_fixed = is_fix_time_step; } - void Bmi_Module_Formulation::set_bmi_using_forcing_file(bool uses_forcing_file) { - bmi_using_forcing_file = uses_forcing_file; - } - - void Bmi_Module_Formulation::set_forcing_file_path(const std::string &forcing_path) { - forcing_file_path = forcing_path; - } - void Bmi_Module_Formulation::set_model_initialized(bool is_initialized) { model_initialized = is_initialized; } diff --git a/src/realizations/catchment/Bmi_Multi_Formulation.cpp b/src/realizations/catchment/Bmi_Multi_Formulation.cpp index eb06de2ab7..961ea6e20d 100644 --- a/src/realizations/catchment/Bmi_Multi_Formulation.cpp +++ b/src/realizations/catchment/Bmi_Multi_Formulation.cpp @@ -286,11 +286,6 @@ const std::string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const return output_var_name; } -// TODO: remove from this level - it belongs (perhaps) as part of the ForcingProvider interface, but is general to it -const std::string &Bmi_Multi_Formulation::get_forcing_file_path() const { - return modules[0]->get_forcing_file_path(); -} - std::string Bmi_Multi_Formulation::get_output_line_for_timestep(int timestep, std::string delimiter) { // TODO: have to do some figuring out to make sure this isn't ambiguous (i.e., same output var name from two modules) // TODO: need to verify that output variable names are valid, or else warn and return default @@ -407,11 +402,6 @@ bool Bmi_Multi_Formulation::is_bmi_output_variable(const std::string &var_name) return modules.back()->is_bmi_output_variable(var_name); } -bool Bmi_Multi_Formulation::is_bmi_using_forcing_file() const { - return std::any_of(modules.cbegin(), modules.cend(), - [](const std::shared_ptr& m) { return m->is_bmi_using_forcing_file(); }); -} - bool Bmi_Multi_Formulation::is_model_initialized() { return std::all_of(modules.cbegin(), modules.cend(), [](const std::shared_ptr& m) { return m->is_model_initialized(); }); diff --git a/test/bmi/Bmi_C_Adapter_Test.cpp b/test/bmi/Bmi_C_Adapter_Test.cpp index 1b3661f375..ca233d94d9 100755 --- a/test/bmi/Bmi_C_Adapter_Test.cpp +++ b/test/bmi/Bmi_C_Adapter_Test.cpp @@ -55,7 +55,6 @@ class Bmi_C_Adapter_Test : public ::testing::Test { std::string config_file_name_0; std::string lib_file_name_0; - std::string forcing_file_name_0; std::string bmi_module_type_name_0; std::unique_ptr adapter; @@ -81,9 +80,6 @@ void Bmi_C_Adapter_Test::SetUp() { std::string config_basename_0 = "test_bmi_c_config_0.txt"; config_file_name_0 = file_search(config_path_options, config_basename_0); - std::vector forcing_dir_opts = {"./data/forcing/", "../data/forcing/", "../../data/forcing/"}; - forcing_file_name_0 = file_search(forcing_dir_opts, "cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"); - std::vector lib_dir_opts = { "./extern/test_bmi_c/cmake_build/", "../extern/test_bmi_c/cmake_build/", @@ -92,7 +88,7 @@ void Bmi_C_Adapter_Test::SetUp() { lib_file_name_0 = file_search(lib_dir_opts, BMI_TEST_C_LOCAL_LIB_NAME); bmi_module_type_name_0 = "test_bmi_c"; adapter = std::make_unique(bmi_module_type_name_0, lib_file_name_0, config_file_name_0, - forcing_file_name_0, false, true, REGISTRATION_FUNC, + false, true, REGISTRATION_FUNC, utils::StreamHandler()); } diff --git a/test/bmi/Bmi_Cpp_Adapter_Test.cpp b/test/bmi/Bmi_Cpp_Adapter_Test.cpp index e944e0cc46..eea77d7861 100644 --- a/test/bmi/Bmi_Cpp_Adapter_Test.cpp +++ b/test/bmi/Bmi_Cpp_Adapter_Test.cpp @@ -45,7 +45,6 @@ class Bmi_Cpp_Adapter_Test : public ::testing::Test { std::string config_file_name_0; std::string lib_file_name_0; - std::string forcing_file_name_0; std::string bmi_module_type_name_0; std::unique_ptr adapter; @@ -72,9 +71,6 @@ void Bmi_Cpp_Adapter_Test::SetUp() { std::string config_basename_0 = "test_bmi_c_config_0.txt"; config_file_name_0 = file_search(config_path_options, config_basename_0); - std::vector forcing_dir_opts = {"./data/forcing/", "../data/forcing/", "../../data/forcing/"}; - forcing_file_name_0 = file_search(forcing_dir_opts, "cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"); - std::vector lib_dir_opts = { "./extern/test_bmi_cpp/cmake_build/", "../extern/test_bmi_cpp/cmake_build/", @@ -84,7 +80,7 @@ void Bmi_Cpp_Adapter_Test::SetUp() { bmi_module_type_name_0 = "test_bmi_cpp"; try { adapter = std::make_unique(bmi_module_type_name_0, lib_file_name_0, config_file_name_0, - forcing_file_name_0, false, true, CREATOR_FUNC, DESTROYER_FUNC, + false, true, CREATOR_FUNC, DESTROYER_FUNC, utils::StreamHandler()); } catch (const std::exception &e) { diff --git a/test/bmi/Bmi_Fortran_Adapter_Test.cpp b/test/bmi/Bmi_Fortran_Adapter_Test.cpp index 59e781b4c1..800d672822 100755 --- a/test/bmi/Bmi_Fortran_Adapter_Test.cpp +++ b/test/bmi/Bmi_Fortran_Adapter_Test.cpp @@ -43,7 +43,6 @@ class Bmi_Fortran_Adapter_Test : public ::testing::Test { std::string config_file_name_0; std::string lib_file_name_0; - std::string forcing_file_name_0; std::string bmi_module_type_name_0; std::unique_ptr adapter; @@ -88,9 +87,6 @@ void Bmi_Fortran_Adapter_Test::SetUp() { std::string config_basename_0 = "test_bmi_fortran_config_0.txt"; config_file_name_0 = file_search(config_path_options, config_basename_0); - std::vector forcing_dir_opts = {"./data/forcing/", "../data/forcing/", "../../data/forcing/"}; - forcing_file_name_0 = file_search(forcing_dir_opts, "cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"); - std::vector lib_dir_opts = { "./extern/test_bmi_fortran/cmake_build/", "../extern/test_bmi_fortran/cmake_build/", @@ -99,7 +95,7 @@ void Bmi_Fortran_Adapter_Test::SetUp() { lib_file_name_0 = file_search(lib_dir_opts, BMI_TEST_FORTRAN_LOCAL_LIB_NAME); bmi_module_type_name_0 = "test_bmi_fortran"; adapter = std::make_unique(bmi_module_type_name_0, lib_file_name_0, config_file_name_0, - forcing_file_name_0, false, true, REGISTRATION_FUNC, + false, true, REGISTRATION_FUNC, utils::StreamHandler()); } diff --git a/test/bmi/Bmi_Py_Adapter_Test.cpp b/test/bmi/Bmi_Py_Adapter_Test.cpp index c9804a9e98..64681c8059 100644 --- a/test/bmi/Bmi_Py_Adapter_Test.cpp +++ b/test/bmi/Bmi_Py_Adapter_Test.cpp @@ -20,7 +20,6 @@ typedef struct example_scenario { std::string bmi_init_config; // TODO: probably need to change to package name std::string module_directory; - std::string forcing_file; std::string module_name; std::shared_ptr adapter; } example_scenario; @@ -133,8 +132,6 @@ void Bmi_Py_Adapter_Test::SetUp() { examples[i] = template_ex_struct; } - examples[0].forcing_file = "./data/forcing/cat-27_2015-12-01 00_00_00_2015-12-30 23_00_00.csv"; - // We can handle setting the right init config and initializing the adapter in a loop for (int i = 0; i < examples.size(); ++i) { examples[i].bmi_init_config = "./test/data/bmi/test_bmi_python/test_bmi_python_config_" diff --git a/test/realizations/catchments/Bmi_C_Formulation_Test.cpp b/test/realizations/catchments/Bmi_C_Formulation_Test.cpp index 162bde0e94..3b46c648b4 100644 --- a/test/realizations/catchments/Bmi_C_Formulation_Test.cpp +++ b/test/realizations/catchments/Bmi_C_Formulation_Test.cpp @@ -57,18 +57,10 @@ class Bmi_C_Formulation_Test : public ::testing::Test { return formulation.get_bmi_model_start_time_forcing_offset_s(); } - static std::string get_friend_forcing_file_path(const Bmi_C_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - static time_t get_friend_forcing_start_time(Bmi_C_Formulation& formulation) { return formulation.forcing->get_data_start_time(); } - static bool get_friend_is_bmi_using_forcing_file(const Bmi_C_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_model_type_name(Bmi_C_Formulation& formulation) { return formulation.get_model_type_name(); } @@ -195,7 +187,6 @@ void Bmi_C_Formulation_Test::SetUp() { " \"bmi_c\": {" " \"model_type_name\": \"" + model_type_name[i] + "\"," " \"library_file\": \"" + lib_file[i] + "\"," - " \"forcing_file\": \"" + forcing_file[i] + "\"," " \"init_config\": \"" + init_config[i] + "\"," " \"main_output_variable\": \"" + main_output_variable[i] + "\"," " \"" + BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION + "\": 6, " @@ -234,10 +225,8 @@ TEST_F(Bmi_C_Formulation_Test, Initialize_0_a) { formulation.create_formulation(config_prop_ptree[ex_index]); ASSERT_EQ(get_friend_model_type_name(formulation), model_type_name[ex_index]); - ASSERT_EQ(get_friend_forcing_file_path(formulation), forcing_file[ex_index]); ASSERT_EQ(get_friend_bmi_init_config(formulation), init_config[ex_index]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variable[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure we can initialize multiple model instances with dynamic loading. */ diff --git a/test/realizations/catchments/Bmi_C_Pet_IT.cpp b/test/realizations/catchments/Bmi_C_Pet_IT.cpp index 70568781f9..903bbf1adc 100644 --- a/test/realizations/catchments/Bmi_C_Pet_IT.cpp +++ b/test/realizations/catchments/Bmi_C_Pet_IT.cpp @@ -43,14 +43,6 @@ class Bmi_C_Pet_IT : public ::testing::Test { return formulation.get_bmi_main_output_var(); } - static std::string get_friend_forcing_file_path(const Bmi_C_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - - static bool get_friend_is_bmi_using_forcing_file(const Bmi_C_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_model_type_name(Bmi_C_Formulation& formulation) { return formulation.get_model_type_name(); } @@ -113,7 +105,7 @@ void Bmi_C_Pet_IT::SetUp() { registration_functions[0] = "register_bmi_pet"; init_config[0] = find_file(bmi_init_cfg_dir_opts, "cat-27_bmi_config.ini"); main_output_variable[0] = "water_potential_evaporation_flux"; - uses_forcing_file[0] = true; + uses_forcing_file[0] = false; catchment_ids[1] = "cat-67"; model_type_name[1] = "bmi_c_pet"; @@ -122,7 +114,7 @@ void Bmi_C_Pet_IT::SetUp() { registration_functions[1] = "register_bmi_pet"; init_config[1] = find_file(bmi_init_cfg_dir_opts, "cat-67_bmi_config.ini"); main_output_variable[1] = "water_potential_evaporation_flux"; - uses_forcing_file[1] = true; + uses_forcing_file[1] = false; std::string output_variables = " \"output_variables\": [\"water_potential_evaporation_flux\"],\n"; @@ -140,7 +132,6 @@ void Bmi_C_Pet_IT::SetUp() { " \"bmi_c\": {" " \"model_type_name\": \"" + model_type_name[i] + "\"," " \"library_file\": \"" + lib_file[i] + "\"," - " \"forcing_file\": \"" + forcing_file[i] + "\"," " \"init_config\": \"" + init_config[i] + "\"," " \"main_output_variable\": \"" + main_output_variable[i] + "\"," " \"" + BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION + "\": 9, " @@ -181,10 +172,8 @@ TEST_F(Bmi_C_Pet_IT, Test_InitModel) { formulation.create_formulation(config_prop_ptree[ex_index]); ASSERT_EQ(get_friend_model_type_name(formulation), model_type_name[ex_index]); - ASSERT_EQ(get_friend_forcing_file_path(formulation), forcing_file[ex_index]); ASSERT_EQ(get_friend_bmi_init_config(formulation), init_config[ex_index]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variable[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test of get response. */ diff --git a/test/realizations/catchments/Bmi_Cpp_Formulation_Test.cpp b/test/realizations/catchments/Bmi_Cpp_Formulation_Test.cpp index 9898fd6f0c..0adaf86517 100644 --- a/test/realizations/catchments/Bmi_Cpp_Formulation_Test.cpp +++ b/test/realizations/catchments/Bmi_Cpp_Formulation_Test.cpp @@ -55,18 +55,10 @@ class Bmi_Cpp_Formulation_Test : public ::testing::Test { return formulation.get_bmi_model_start_time_forcing_offset_s(); } - static std::string get_friend_forcing_file_path(const Bmi_Cpp_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - static time_t get_friend_forcing_start_time(Bmi_Cpp_Formulation& formulation) { return formulation.forcing->get_data_start_time(); } - static bool get_friend_is_bmi_using_forcing_file(const Bmi_Cpp_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_model_type_name(Bmi_Cpp_Formulation& formulation) { return formulation.get_model_type_name(); } @@ -194,7 +186,6 @@ void Bmi_Cpp_Formulation_Test::SetUp() { " \"bmi_c++\": {" " \"model_type_name\": \"" + model_type_name[i] + "\"," " \"library_file\": \"" + lib_file[i] + "\"," - " \"forcing_file\": \"" + forcing_file[i] + "\"," " \"init_config\": \"" + init_config[i] + "\"," " \"main_output_variable\": \"" + main_output_variable[i] + "\"," " \"" + BMI_REALIZATION_CFG_PARAM_OPT__VAR_STD_NAMES + "\": { " @@ -230,10 +221,8 @@ TEST_F(Bmi_Cpp_Formulation_Test, Initialize_0_a) { formulation.create_formulation(config_prop_ptree[ex_index]); ASSERT_EQ(get_friend_model_type_name(formulation), model_type_name[ex_index]); - ASSERT_EQ(get_friend_forcing_file_path(formulation), forcing_file[ex_index]); ASSERT_EQ(get_friend_bmi_init_config(formulation), init_config[ex_index]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variable[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure we can initialize multiple model instances with dynamic loading. */ diff --git a/test/realizations/catchments/Bmi_Cpp_Multi_Array_Test.cpp b/test/realizations/catchments/Bmi_Cpp_Multi_Array_Test.cpp index 36aa2b783f..1a81b8abeb 100644 --- a/test/realizations/catchments/Bmi_Cpp_Multi_Array_Test.cpp +++ b/test/realizations/catchments/Bmi_Cpp_Multi_Array_Test.cpp @@ -74,14 +74,6 @@ class Bmi_Cpp_Multi_Array_Test : public ::testing::Test { return formulation.get_bmi_model_start_time_forcing_offset_s(); } - static std::string get_friend_forcing_file_path(const Bmi_Multi_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - - static bool get_friend_is_bmi_using_forcing_file(const Bmi_Multi_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_nested_module_model_type_name(Bmi_Multi_Formulation& formulation, const int nested_index) { return formulation.modules[nested_index]->get_model_type_name(); @@ -319,7 +311,6 @@ TEST_F(Bmi_Cpp_Multi_Array_Test, Initialize_0_a) { ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 0), nested_module_main_output_variables[ex_index][0]); ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 1), nested_module_main_output_variables[ex_index][1]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variables[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure the model config from example 0 initializes no deferred providers. */ diff --git a/test/realizations/catchments/Bmi_Fortran_Formulation_Test.cpp b/test/realizations/catchments/Bmi_Fortran_Formulation_Test.cpp index 7b4b4eeb73..9aac71ea2c 100644 --- a/test/realizations/catchments/Bmi_Fortran_Formulation_Test.cpp +++ b/test/realizations/catchments/Bmi_Fortran_Formulation_Test.cpp @@ -55,18 +55,10 @@ class Bmi_Fortran_Formulation_Test : public ::testing::Test { return formulation.get_bmi_model_start_time_forcing_offset_s(); } - static std::string get_friend_forcing_file_path(const Bmi_Fortran_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - static time_t get_friend_forcing_start_time(Bmi_Fortran_Formulation& formulation) { return formulation.forcing->get_data_start_time(); } - static bool get_friend_is_bmi_using_forcing_file(const Bmi_Fortran_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_model_type_name(Bmi_Fortran_Formulation& formulation) { return formulation.get_model_type_name(); } @@ -201,7 +193,6 @@ void Bmi_Fortran_Formulation_Test::SetUp() { " \"bmi_fortran\": {" " \"model_type_name\": \"" + model_type_name[i] + "\"," " \"library_file\": \"" + lib_file[i] + "\"," - " \"forcing_file\": \"" + forcing_file[i] + "\"," " \"init_config\": \"" + init_config[i] + "\"," " \"main_output_variable\": \"" + main_output_variable[i] + "\"," " \"" + BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION + "\": 6, " @@ -243,10 +234,8 @@ TEST_F(Bmi_Fortran_Formulation_Test, Initialize_0_a) { formulation.create_formulation(config_prop_ptree[ex_index]); ASSERT_EQ(get_friend_model_type_name(formulation), model_type_name[ex_index]); - ASSERT_EQ(get_friend_forcing_file_path(formulation), forcing_file[ex_index]); ASSERT_EQ(get_friend_bmi_init_config(formulation), init_config[ex_index]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variable[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure we can initialize multiple model instances with dynamic loading. */ diff --git a/test/realizations/catchments/Bmi_Multi_Formulation_Test.cpp b/test/realizations/catchments/Bmi_Multi_Formulation_Test.cpp index 19241eb8fd..9deb6d8de4 100644 --- a/test/realizations/catchments/Bmi_Multi_Formulation_Test.cpp +++ b/test/realizations/catchments/Bmi_Multi_Formulation_Test.cpp @@ -100,20 +100,12 @@ class Bmi_Multi_Formulation_Test : public ::testing::Test { return formulation.get_bmi_model_start_time_forcing_offset_s(); } - static std::string get_friend_forcing_file_path(const Bmi_Multi_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - /* static time_t get_friend_forcing_start_time(Bmi_Multi_Formulation& formulation) { return formulation.forcing->get_forcing_output_time_begin(""); } */ - static bool get_friend_is_bmi_using_forcing_file(const Bmi_Multi_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_nested_module_model_type_name(Bmi_Multi_Formulation& formulation, const int nested_index) { return formulation.modules[nested_index]->get_model_type_name(); @@ -514,7 +506,6 @@ TEST_F(Bmi_Multi_Formulation_Test, Initialize_0_a) { ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 0), nested_module_main_output_variables[ex_index][0]); ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 1), nested_module_main_output_variables[ex_index][1]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variables[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure the model config from example 0 initializes no deferred providers. */ @@ -539,7 +530,6 @@ TEST_F(Bmi_Multi_Formulation_Test, Initialize_1_a) { ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 0), nested_module_main_output_variables[ex_index][0]); ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 1), nested_module_main_output_variables[ex_index][1]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variables[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure the model config from example 1 initializes no deferred providers. */ @@ -571,7 +561,6 @@ TEST_F(Bmi_Multi_Formulation_Test, Initialize_3_a) { ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 0), nested_module_main_output_variables[ex_index][0]); ASSERT_EQ(get_friend_nested_module_main_output_variable(formulation, 1), nested_module_main_output_variables[ex_index][1]); ASSERT_EQ(get_friend_bmi_main_output_var(formulation), main_output_variables[ex_index]); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(formulation), uses_forcing_file[ex_index]); } /** Test to make sure the model config from example 3 initializes expected number of deferred providers. */ diff --git a/test/realizations/catchments/Bmi_Py_Formulation_Test.cpp b/test/realizations/catchments/Bmi_Py_Formulation_Test.cpp index 90b0545b61..313a96ad57 100644 --- a/test/realizations/catchments/Bmi_Py_Formulation_Test.cpp +++ b/test/realizations/catchments/Bmi_Py_Formulation_Test.cpp @@ -62,18 +62,10 @@ class Bmi_Py_Formulation_Test : public ::testing::Test { // return formulation.forcing.get_value_for_param_name(param_name); //} - static std::string get_friend_forcing_file_path(const Bmi_Py_Formulation& formulation) { - return formulation.get_forcing_file_path(); - } - static time_t get_friend_forcing_start_time(Bmi_Py_Formulation& formulation) { return formulation.forcing->get_data_start_time(); } - static bool get_friend_is_bmi_using_forcing_file(const Bmi_Py_Formulation& formulation) { - return formulation.is_bmi_using_forcing_file(); - } - static std::string get_friend_model_type_name(Bmi_Py_Formulation& formulation) { return formulation.get_model_type_name(); } @@ -250,7 +242,6 @@ void Bmi_Py_Formulation_Test::generate_realization_config(int ex_idx) { " \"bmi_python\": {" " \"model_type_name\": \"" + examples[ex_idx].module_name + "\"," " \"" + BMI_REALIZATION_CFG_PARAM_OPT__PYTHON_TYPE_NAME + "\": \"" + examples[ex_idx].module_name + "\"," - " \"forcing_file\": \"" + examples[ex_idx].forcing_params->path + "\"," " \"init_config\": \"" + examples[ex_idx].bmi_init_config + "\"," " \"main_output_variable\": \"" + examples[ex_idx].main_output_variable + "\"," " \"" + BMI_REALIZATION_CFG_PARAM_OPT__OUTPUT_PRECISION + "\": 6, " @@ -356,10 +347,8 @@ TEST_F(Bmi_Py_Formulation_Test, Initialize_0_a) { int ex_index = 0; ASSERT_EQ(get_friend_model_type_name(*examples[ex_index].formulation), examples[ex_index].module_name); - ASSERT_EQ(get_friend_forcing_file_path(*examples[ex_index].formulation), examples[ex_index].forcing_params->path); ASSERT_EQ(get_friend_bmi_init_config(*examples[ex_index].formulation), examples[ex_index].bmi_init_config); ASSERT_EQ(get_friend_bmi_main_output_var(*examples[ex_index].formulation), examples[ex_index].main_output_variable); - ASSERT_EQ(get_friend_is_bmi_using_forcing_file(*examples[ex_index].formulation), examples[ex_index].uses_forcing_file); } /**