Skip to content

Commit

Permalink
Added two dozen more missed std:: qualifiers...
Browse files Browse the repository at this point in the history
..that were missing somehow? Did these get dropped somehow when I rebased on master? Squash these with the `Abominate...` commit??
  • Loading branch information
mattw-nws committed Aug 22, 2023
1 parent 645fda1 commit 84fda2e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
32 changes: 16 additions & 16 deletions src/NGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ int main(int argc, char *argv[]) {
//arg 7 is the partition file path
//arg 8 is an optional flag that driver should, if not already preprocessed this way, subdivided the hydrofabric

std::vector<string> catchment_subset_ids;
std::vector<string> nexus_subset_ids;
std::vector<std::string> catchment_subset_ids;
std::vector<std::string> nexus_subset_ids;

if( argc < 2) {
// Usage
Expand All @@ -91,41 +91,41 @@ int main(int argc, char *argv[]) {
<< "Use \"all\" as explicit argument when no subset is needed." << std::endl;

// Build and environment information
cout<<std::endl<<"Build Info:"<<std::endl;
cout<<" NGen version: " // This is here mainly so that there will be *some* output if somehow no other options are enabled.
std::cout<<std::endl<<"Build Info:"<<std::endl;
std::cout<<" NGen version: " // This is here mainly so that there will be *some* output if somehow no other options are enabled.
<< ngen_VERSION_MAJOR << "."
<< ngen_VERSION_MINOR << "."
<< ngen_VERSION_PATCH << std::endl;
#ifdef NGEN_MPI_ACTIVE
cout<<" Parallel build"<<std::endl;
#endif
#ifdef NETCDF_ACTIVE
cout<<" NetCDF lumped forcing enabled"<<std::endl;
std::cout<<" NetCDF lumped forcing enabled"<<std::endl;
#endif
#ifdef NGEN_BMI_FORTRAN_ACTIVE
cout<<" Fortran BMI enabled"<<std::endl;
std::cout<<" Fortran BMI enabled"<<std::endl;
#endif
#ifdef NGEN_C_LIB_ACTIVE
cout<<" C BMI enabled"<<std::endl;
#endif
#ifdef ACTIVATE_PYTHON
cout<<" Python active"<<std::endl;
cout<<" Embedded interpreter version: "<<PY_MAJOR_VERSION<<"."<<PY_MINOR_VERSION<<"."<<PY_MICRO_VERSION<<std::endl;
std::cout<<" Python active"<<std::endl;
std::cout<<" Embedded interpreter version: "<<PY_MAJOR_VERSION<<"."<<PY_MINOR_VERSION<<"."<<PY_MICRO_VERSION<<std::endl;
#endif
#ifdef NGEN_ROUTING_ACTIVE
cout<<" Routing active"<<std::endl;
std::cout<<" Routing active"<<std::endl;
#endif
#ifdef ACTIVATE_PYTHON
cout<<std::endl<<"Python Environment Info:"<<std::endl;
cout<<" VIRTUAL_ENV environment variable: "<<(std::getenv("VIRTUAL_ENV") == nullptr ? "(not set)" : std::getenv("VIRTUAL_ENV"))<<std::endl;
cout<<" Discovered venv: "<<_interp->getDiscoveredVenvPath()<<std::endl;
std::cout<<std::endl<<"Python Environment Info:"<<std::endl;
std::cout<<" VIRTUAL_ENV environment variable: "<<(std::getenv("VIRTUAL_ENV") == nullptr ? "(not set)" : std::getenv("VIRTUAL_ENV"))<<std::endl;
std::cout<<" Discovered venv: "<<_interp->getDiscoveredVenvPath()<<std::endl;
auto paths = _interp->getSystemPath();
cout<<" System paths:"<<std::endl;
std::cout<<" System paths:"<<std::endl;
for(std::string& path: std::get<1>(paths)){
cout<<" "<<path<<std::endl;
std::cout<<" "<<path<<std::endl;
}
#endif
cout<<std::endl;
std::cout<<std::endl;
exit(0); // Unsure if this path should have a non-zero exit code?
} else if( argc < 6) {
std::cout << "Missing required args:" << std::endl;
Expand Down Expand Up @@ -342,7 +342,7 @@ int main(int argc, char *argv[]) {
//std::cout<<"Running cat "<<id<<std::endl;
auto r = features.catchment_at(id);
//TODO redesign to avoid this cast
auto r_c = dynamic_pointer_cast<realization::Catchment_Formulation>(r);
auto r_c = std::dynamic_pointer_cast<realization::Catchment_Formulation>(r);
double response = r_c->get_response(output_time_index, 3600.0);
std::string output = std::to_string(output_time_index)+","+current_timestamp+","+
r_c->get_output_line_for_timestep(output_time_index)+"\n";
Expand Down
30 changes: 15 additions & 15 deletions src/realizations/catchment/Bmi_Multi_Formulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ void Bmi_Multi_Formulation::create_multi_formulation(geojson::PropertyMap proper
#endif // ACTIVATE_PYTHON
}
if (inactive_type_requested) {
throw runtime_error(
throw std::runtime_error(
get_formulation_type() + " could not initialize sub formulation of type " + type_name +
" due to support for this type not being activated.");
}
if (module == nullptr) {
throw runtime_error(get_formulation_type() + " received unexpected subtype formulation " + type_name);
throw std::runtime_error(get_formulation_type() + " received unexpected subtype formulation " + type_name);
}
modules[i] = module;

Expand Down Expand Up @@ -180,7 +180,7 @@ const bool &Bmi_Multi_Formulation::get_allow_model_exceed_end_time() const {
* @see ForcingProvider
*/
//const vector<std::string> &Bmi_Multi_Formulation::get_available_forcing_outputs() {
const vector<std::string> &Bmi_Multi_Formulation::get_available_variable_names() {
const std::vector<std::string> &Bmi_Multi_Formulation::get_available_variable_names() {
if (is_model_initialized() && available_forcings.empty()) {
for (const nested_module_ptr &module: modules) {
for (const std::string &out_var_name: module->get_bmi_output_variables()) {
Expand Down Expand Up @@ -213,17 +213,17 @@ const time_t &Bmi_Multi_Formulation::get_bmi_model_start_time_forcing_offset_s()
* @return Either the translated equivalent variable name, or the provided name if there is not a mapping entry.
* @see get_config_mapped_variable_name(string, shared_ptr, shared_ptr)
*/
const string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const string &model_var_name) {
const std::string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const std::string &model_var_name) {
return get_config_mapped_variable_name(model_var_name, true, true);
}

const string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const string &model_var_name, bool check_first,
const std::string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const std::string &model_var_name, bool check_first,
bool check_last)
{
if (check_first) {
// If an input var in first module, see if we get back a mapping (i.e., not the same thing), and return if so
if (modules[0]->is_bmi_input_variable(model_var_name)) {
const string &mapped_name = modules[0]->get_config_mapped_variable_name(model_var_name);
const std::string &mapped_name = modules[0]->get_config_mapped_variable_name(model_var_name);
if (mapped_name != model_var_name)
return mapped_name;
}
Expand Down Expand Up @@ -261,31 +261,31 @@ const string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const strin
* @param in_module The module needing a translation of ``output_var_name`` to one of its input variable names.
* @return Either the translated equivalent variable name, or the provided name if there is not a mapping entry.
*/
const string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const string &output_var_name,
const std::string &Bmi_Multi_Formulation::get_config_mapped_variable_name(const std::string &output_var_name,
const shared_ptr<Bmi_Formulation>& out_module,
const shared_ptr<Bmi_Formulation>& in_module)
{
if (!out_module->is_bmi_output_variable(output_var_name))
return output_var_name;

const string &mapped_output = out_module->get_config_mapped_variable_name(output_var_name);
const std::string &mapped_output = out_module->get_config_mapped_variable_name(output_var_name);
if (in_module->is_bmi_input_variable(mapped_output))
return mapped_output;

for (const string &s : in_module->get_bmi_input_variables()) {
const string &mapped_s = in_module->get_config_mapped_variable_name(s);
for (const std::string &s : in_module->get_bmi_input_variables()) {
const std::string &mapped_s = in_module->get_config_mapped_variable_name(s);
if (mapped_s == output_var_name || mapped_s == mapped_output)
return mapped_s;
}
return output_var_name;
}

// TODO: remove from this level - it belongs (perhaps) as part of the ForcingProvider interface, but is general to it
const string &Bmi_Multi_Formulation::get_forcing_file_path() const {
const std::string &Bmi_Multi_Formulation::get_forcing_file_path() const {
return modules[0]->get_forcing_file_path();
}

string Bmi_Multi_Formulation::get_output_line_for_timestep(int timestep, std::string delimiter) {
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

Expand Down Expand Up @@ -412,11 +412,11 @@ double Bmi_Multi_Formulation::get_response(time_step_t t_index, time_step_t t_de
return get_module_var_value_as_double<Bmi_Py_Formulation>(get_bmi_main_output_var(), modules[index]);
}
#endif // ACTIVATE_PYTHON
throw runtime_error(get_formulation_type() + " unimplemented type " + module_types[index] +
throw std::runtime_error(get_formulation_type() + " unimplemented type " + module_types[index] +
" in get_response for main return value");
}

bool Bmi_Multi_Formulation::is_bmi_input_variable(const string &var_name) {
bool Bmi_Multi_Formulation::is_bmi_input_variable(const std::string &var_name) {
return modules[0]->is_bmi_input_variable(var_name);
}

Expand All @@ -425,7 +425,7 @@ bool Bmi_Multi_Formulation::is_bmi_model_time_step_fixed() {
[](const std::shared_ptr<Bmi_Formulation>& m) { return m->is_bmi_model_time_step_fixed(); });
}

bool Bmi_Multi_Formulation::is_bmi_output_variable(const string &var_name) {
bool Bmi_Multi_Formulation::is_bmi_output_variable(const std::string &var_name) {
return modules.back()->is_bmi_output_variable(var_name);
}

Expand Down
2 changes: 1 addition & 1 deletion test/realizations/catchments/Bmi_Cpp_Formulation_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Bmi_Cpp_Formulation_Test : public ::testing::Test {
return formulation.get_model_type_name();
}

static double get_friend_var_value_as_double(Bmi_Cpp_Formulation& formulation, const string& var_name) {
static double get_friend_var_value_as_double(Bmi_Cpp_Formulation& formulation, const std::string& var_name) {
return formulation.get_var_value_as_double(var_name);
}

Expand Down

0 comments on commit 84fda2e

Please sign in to comment.