convert THROW to OPM_THROW

This commit is contained in:
Andreas Lauser 2013-08-28 13:59:03 +02:00
parent 5bb9053206
commit 1605b88d66
3 changed files with 22 additions and 22 deletions

View File

@ -175,7 +175,7 @@ main(int argc, char** argv)
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
std::string filename = output_dir + "/epoch_timing.param"; std::string filename = output_dir + "/epoch_timing.param";
epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out); epoch_os.open(filename.c_str(), std::fstream::trunc | std::fstream::out);
@ -228,7 +228,7 @@ main(int argc, char** argv)
simtimer.init(*deck); simtimer.init(*deck);
} else { } else {
if (epoch != 0) { 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); simtimer.init(param);
} }

View File

@ -151,12 +151,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { 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"; vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
std::ofstream vtkfile(vtkfilename.str().c_str()); std::ofstream vtkfile(vtkfilename.str().c_str());
if (!vtkfile) { if (!vtkfile) {
THROW("Failed to open " << vtkfilename.str()); OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
} }
Opm::DataMap dm; Opm::DataMap dm;
dm["saturation"] = &state.saturation(); dm["saturation"] = &state.saturation();
@ -190,12 +190,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { if (!file) {
THROW("Failed to open " << fname.str()); OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
} }
file.precision(15); file.precision(15);
const std::vector<double>& d = *(it->second); const std::vector<double>& d = *(it->second);
@ -211,7 +211,7 @@ namespace Opm
std::string fname = output_dir + "/watercut.txt"; std::string fname = output_dir + "/watercut.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
watercut.write(os); watercut.write(os);
} }
@ -224,7 +224,7 @@ namespace Opm
std::string fname = output_dir + "/wellreport.txt"; std::string fname = output_dir + "/wellreport.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
wellreport.write(os); wellreport.write(os);
} }
@ -269,7 +269,7 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
output_interval_ = param.getDefault("output_interval", 1); 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_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
++well_control_iteration; ++well_control_iteration;
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { 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) { if (!well_control_passed) {
std::cout << "Well controls not passed, solving again." << std::endl; std::cout << "Well controls not passed, solving again." << std::endl;

View File

@ -188,12 +188,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { 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"; vtkfilename << "/output-" << std::setw(3) << std::setfill('0') << step << ".vtu";
std::ofstream vtkfile(vtkfilename.str().c_str()); std::ofstream vtkfile(vtkfilename.str().c_str());
if (!vtkfile) { if (!vtkfile) {
THROW("Failed to open " << vtkfilename.str()); OPM_THROW(std::runtime_error, "Failed to open " << vtkfilename.str());
} }
Opm::DataMap dm; Opm::DataMap dm;
dm["saturation"] = &state.saturation(); dm["saturation"] = &state.saturation();
@ -216,12 +216,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { 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<double>(file, "\n")); std::copy(vec.begin(), vec.end(), std::ostream_iterator<double>(file, "\n"));
} }
@ -247,12 +247,12 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt"; fname << "/" << std::setw(3) << std::setfill('0') << step << ".txt";
std::ofstream file(fname.str().c_str()); std::ofstream file(fname.str().c_str());
if (!file) { if (!file) {
THROW("Failed to open " << fname.str()); OPM_THROW(std::runtime_error, "Failed to open " << fname.str());
} }
file.precision(15); file.precision(15);
const std::vector<double>& d = *(it->second); const std::vector<double>& d = *(it->second);
@ -268,7 +268,7 @@ namespace Opm
std::string fname = output_dir + "/watercut.txt"; std::string fname = output_dir + "/watercut.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
watercut.write(os); watercut.write(os);
} }
@ -281,7 +281,7 @@ namespace Opm
std::string fname = output_dir + "/wellreport.txt"; std::string fname = output_dir + "/wellreport.txt";
std::ofstream os(fname.c_str()); std::ofstream os(fname.c_str());
if (!os) { if (!os) {
THROW("Failed to open " << fname); OPM_THROW(std::runtime_error, "Failed to open " << fname);
} }
wellreport.write(os); wellreport.write(os);
} }
@ -353,10 +353,10 @@ namespace Opm
} else { } else {
if (rock_comp_props && rock_comp_props->isActive()) { 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_) { 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<double> porevol; std::vector<double> porevol;
computePorevolume(grid, props.porosity(), porevol); computePorevolume(grid, props.porosity(), porevol);
@ -379,7 +379,7 @@ namespace Opm
create_directories(fpath); create_directories(fpath);
} }
catch (...) { catch (...) {
THROW("Creating directories failed: " << fpath); OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
} }
output_interval_ = param.getDefault("output_interval", 1); 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_passed = wells_manager_.conditionsMet(well_state.bhp(), well_resflows_phase, well_resflows_phase);
++well_control_iteration; ++well_control_iteration;
if (!well_control_passed && well_control_iteration > max_well_control_iterations_) { 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) { if (!well_control_passed) {
std::cout << "Well controls not passed, solving again." << std::endl; std::cout << "Well controls not passed, solving again." << std::endl;