Skip to content

Commit

Permalink
Bmi_Fortran_Adapter: drop 'using namespace std'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilMiller committed Aug 4, 2023
1 parent b28150a commit f733af6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/realizations/catchment/Bmi_Fortran_Adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ namespace models {

public:

explicit Bmi_Fortran_Adapter(const string &type_name, std::string library_file_path,
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 &registration_func, utils::StreamHandler output)
: Bmi_Fortran_Adapter(type_name, library_file_path, "", forcing_file_path, allow_exceed_end,
has_fixed_time_step,
registration_func, output) {}

Bmi_Fortran_Adapter(const string &type_name, std::string library_file_path, std::string bmi_init_config,
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,
std::string registration_func,
utils::StreamHandler output) : AbstractCLibBmiAdapter(type_name,
Expand Down Expand Up @@ -67,7 +67,7 @@ namespace models {
model_initialized = true;
throw e;
}
catch (exception &e) {
catch (std::exception &e) {
//This will catch any other exception, but the it will be cast to this base type.
//This means it looses it any specific type/message information. So if construct_and_init_backing_model_for_fortran
//throws an exception besides runtime_error, catch that type explicitly.
Expand All @@ -76,7 +76,7 @@ namespace models {
}
}

string GetComponentName() override;
std::string GetComponentName() override;

/**
* Get the backing model's current time.
Expand Down
8 changes: 4 additions & 4 deletions src/realizations/catchment/Bmi_Fortran_Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using namespace models::bmi;

string Bmi_Fortran_Adapter::GetComponentName() {
std::string Bmi_Fortran_Adapter::GetComponentName() {
char component_name[BMI_MAX_COMPONENT_NAME];
if (get_component_name(&bmi_model->handle, component_name) != BMI_SUCCESS) {
throw std::runtime_error(model_name + " failed to get model component name.");
Expand Down Expand Up @@ -126,23 +126,23 @@ int Bmi_Fortran_Adapter::GetVarGrid(std::string name) {
std::string Bmi_Fortran_Adapter::GetGridType(int grid_id) {
char gridtype_c_str[BMI_MAX_TYPE_NAME];
if (get_grid_type(&bmi_model->handle, &grid_id, gridtype_c_str) != BMI_SUCCESS) {
throw std::runtime_error(model_name + " failed to get grid type for grid ID " + to_string(grid_id) + ".");
throw std::runtime_error(model_name + " failed to get grid type for grid ID " + std::to_string(grid_id) + ".");
}
return std::string(gridtype_c_str);
}

int Bmi_Fortran_Adapter::GetGridRank(int grid_id) {
int gridrank;
if (get_grid_rank(&bmi_model->handle, &grid_id, &gridrank) != BMI_SUCCESS) {
throw std::runtime_error(model_name + " failed to get grid rank for grid ID " + to_string(grid_id) + ".");
throw std::runtime_error(model_name + " failed to get grid rank for grid ID " + std::to_string(grid_id) + ".");
}
return gridrank;
}

int Bmi_Fortran_Adapter::GetGridSize(int grid_id) {
int gridsize;
if (get_grid_size(&bmi_model->handle, &grid_id, &gridsize) != BMI_SUCCESS) {
throw std::runtime_error(model_name + " failed to get grid size for grid ID " + to_string(grid_id) + ".");
throw std::runtime_error(model_name + " failed to get grid size for grid ID " + std::to_string(grid_id) + ".");
}
return gridsize;
}
Expand Down

0 comments on commit f733af6

Please sign in to comment.