From 1605b88d664c58a51723284620e7073c4fc984ce Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Wed, 28 Aug 2013 13:59:03 +0200 Subject: [PATCH] convert THROW to OPM_THROW --- examples/sim_2p_comp_reorder.cpp | 4 ++-- .../SimulatorCompressibleTwophase.cpp | 16 ++++++------- opm/simulators/SimulatorIncompTwophase.cpp | 24 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/sim_2p_comp_reorder.cpp b/examples/sim_2p_comp_reorder.cpp index 8613796fd..9445563ce 100644 --- a/examples/sim_2p_comp_reorder.cpp +++ b/examples/sim_2p_comp_reorder.cpp @@ -175,7 +175,7 @@ main(int argc, char** argv) create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } std::string filename = output_dir + "/epoch_timing.param"; epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out); @@ -228,7 +228,7 @@ main(int argc, char** argv) simtimer.init(*deck); } else { if (epoch != 0) { - THROW("No TSTEP in deck for epoch " << epoch); + OPM_THROW(std::runtime_error, "No TSTEP in deck for epoch " << epoch); } simtimer.init(param); } diff --git a/opm/simulators/SimulatorCompressibleTwophase.cpp b/opm/simulators/SimulatorCompressibleTwophase.cpp index f3e7977c8..a57607164 100644 --- a/opm/simulators/SimulatorCompressibleTwophase.cpp +++ b/opm/simulators/SimulatorCompressibleTwophase.cpp @@ -151,12 +151,12 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu"; std::ofstream vtkfile(vtkfilename.str().c_str()); if (!vtkfile) { - THROW("Failed to open " << vtkfilename.str()); + OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str()); } Opm::DataMap dm; dm["saturation"] = &state.saturation(); @@ -190,12 +190,12 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; std::ofstream file(fname.str().c_str()); if (!file) { - THROW("Failed to open " << fname.str()); + OPM_THROW(std::runtime_error, "Failed to open " << fname.str()); } file.precision(15); const std::vector& d = *(it->second); @@ -211,7 +211,7 @@ namespace Opm std::string fname = output_dir + "/watercut.txt"; std::ofstream os(fname.c_str()); if (!os) { - THROW("Failed to open " << fname); + OPM_THROW(std::runtime_error, "Failed to open " << fname); } watercut.write(os); } @@ -224,7 +224,7 @@ namespace Opm std::string fname = output_dir + "/wellreport.txt"; std::ofstream os(fname.c_str()); if (!os) { - THROW("Failed to open " << fname); + OPM_THROW(std::runtime_error, "Failed to open " << fname); } wellreport.write(os); } @@ -269,7 +269,7 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } output_interval_ = param.getDefault("output_interval", 1); } @@ -416,7 +416,7 @@ namespace Opm well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase); ++well_control_iteration; if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { - THROW("Could not satisfy well conditions in " << max_well_control_iterations_ << " tries."); + OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries."); } if (!well_control_passed) { std::cout << "Well controls not passed, solving again." << std::endl; diff --git a/opm/simulators/SimulatorIncompTwophase.cpp b/opm/simulators/SimulatorIncompTwophase.cpp index 6c388db1b..eb49a7621 100644 --- a/opm/simulators/SimulatorIncompTwophase.cpp +++ b/opm/simulators/SimulatorIncompTwophase.cpp @@ -188,12 +188,12 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu"; std::ofstream vtkfile(vtkfilename.str().c_str()); if (!vtkfile) { - THROW("Failed to open " << vtkfilename.str()); + OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str()); } Opm::DataMap dm; dm["saturation"] = &state.saturation(); @@ -216,12 +216,12 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; std::ofstream file(fname.str().c_str()); if (!file) { - THROW("Failed to open " << fname.str()); + OPM_THROW(std::runtime_error, "Failed to open " << fname.str()); } std::copy(vec.begin(), vec.end(), std::ostream_iterator(file, "\n")); } @@ -247,12 +247,12 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; std::ofstream file(fname.str().c_str()); if (!file) { - THROW("Failed to open " << fname.str()); + OPM_THROW(std::runtime_error, "Failed to open " << fname.str()); } file.precision(15); const std::vector& d = *(it->second); @@ -268,7 +268,7 @@ namespace Opm std::string fname = output_dir + "/watercut.txt"; std::ofstream os(fname.c_str()); if (!os) { - THROW("Failed to open " << fname); + OPM_THROW(std::runtime_error, "Failed to open " << fname); } watercut.write(os); } @@ -281,7 +281,7 @@ namespace Opm std::string fname = output_dir + "/wellreport.txt"; std::ofstream os(fname.c_str()); if (!os) { - THROW("Failed to open " << fname); + OPM_THROW(std::runtime_error, "Failed to open " << fname); } wellreport.write(os); } @@ -353,10 +353,10 @@ namespace Opm } else { if (rock_comp_props && rock_comp_props->isActive()) { - THROW("The implicit pressure solver cannot handle rock compressibility."); + OPM_THROW(std::runtime_error, "The implicit pressure solver cannot handle rock compressibility."); } if (use_segregation_split_) { - THROW("The implicit pressure solver is not set up to use segregation splitting."); + OPM_THROW(std::runtime_error, "The implicit pressure solver is not set up to use segregation splitting."); } std::vector porevol; computePorevolume(grid, props.porosity(), porevol); @@ -379,7 +379,7 @@ namespace Opm create_directories(fpath); } catch (...) { - THROW("Creating directories failed: " << fpath); + OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath); } output_interval_ = param.getDefault("output_interval", 1); } @@ -527,7 +527,7 @@ namespace Opm well_control_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase); ++well_control_iteration; if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { - THROW("Could not satisfy well conditions in " << max_well_control_iterations_ << " tries."); + OPM_THROW(std::runtime_error, "Could not satisfy well conditions in " << max_well_control_iterations_ << " tries."); } if (!well_control_passed) { std::cout << "Well controls not passed, solving again." << std::endl;