Add exception handlers to all tutorials and examples

This commit is contained in:
Andreas Lauser
2013-09-05 12:49:15 +02:00
parent 8638ccc604
commit 4b841fa9ec
13 changed files with 76 additions and 3 deletions
+6
View File
@@ -54,6 +54,7 @@ typedef SimulatorTraits<Anisotropic, ImplicitCap> SimTraits;
typedef SimulatorTesterFlexibleBC<SimTraits> Simulator;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -65,4 +66,9 @@ int main(int argc, char** argv)
sim.init(param);
sim.run();
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+5 -1
View File
@@ -54,6 +54,7 @@ typedef SimulatorTraits<Anisotropic, Explicit> SimTraits;
typedef SimulatorTesterFlexibleBC<SimTraits> Simulator;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -65,4 +66,7 @@ int main(int argc, char** argv)
sim.init(param);
sim.run();
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+5
View File
@@ -25,6 +25,7 @@
#include <opm/porsol/blackoil/co2fluid/BlackoilCo2PVT.hpp>
int main(int argc, char** argv)
try
{
double temperature = 300.;
if (argc == 2) temperature = std::atof(argv[1]);
@@ -39,4 +40,8 @@ int main(int argc, char** argv)
clock.stop();
std::cout << "\n\nInitialisation and table generation - clock time (secs): " << clock.secsSinceStart() << std::endl;
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+6
View File
@@ -54,6 +54,7 @@ typedef SimulatorTraits<Isotropic, ImplicitCap> SimTraits;
typedef SimulatorTesterFlexibleBC<SimTraits> Simulator;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -65,4 +66,9 @@ int main(int argc, char** argv)
sim.init(param);
sim.run();
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+6
View File
@@ -291,6 +291,7 @@ void test_flowsolver(const GI& g, const RI& r, double tol, int kind)
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -330,3 +331,8 @@ int main(int argc, char** argv)
param.getDefault("tolerance", 1e-8),
param.getDefault("linear_solver_type", 1));
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+12 -1
View File
@@ -213,6 +213,7 @@ void test_flowsolver(const GI& g, const RI& r)
using namespace Opm;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -272,10 +273,15 @@ int main(int argc, char** argv)
transport_solver.transportSolve(sat, time, gravity, flow_solution);
#endif
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
#if 0
int main (int argc , char **argv) {
int main (int argc , char **argv) try {
try {
#if HAVE_MPI
// initialize MPI
@@ -304,4 +310,9 @@ int main (int argc , char **argv) {
return 0;
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
#endif
+5
View File
@@ -55,6 +55,7 @@
using namespace Opm;
int main(int argc, char** argv)
try
{
typedef Opm::GridInterfaceEuler<Dune::CpGrid> GI;
typedef GI ::CellIterator CI;
@@ -116,4 +117,8 @@ int main(int argc, char** argv)
return 0;
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+5
View File
@@ -162,6 +162,7 @@ void test_flowsolver(const GI& g, const RI& r)
using namespace Opm;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -186,3 +187,7 @@ int main(int argc, char** argv)
test_flowsolver<3>(g, res_prop);
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+6
View File
@@ -49,6 +49,7 @@ typedef Opm::BlackoilSimulator<Grid, Rock, Fluid, Wells, FlowSolver, TransportSo
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -64,4 +65,9 @@ int main(int argc, char** argv)
clock.stop();
std::cout << "\n\nSimulation clock time (secs): " << clock.secsSinceStart() << std::endl;
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+6
View File
@@ -51,6 +51,7 @@ typedef Opm::BlackoilSimulator<Grid, Rock, Fluid, Wells, FlowSolver, TransportSo
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -66,4 +67,9 @@ int main(int argc, char** argv)
clock.stop();
std::cout << "\n\nSimulation clock time (secs): " << clock.secsSinceStart() << std::endl;
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+5 -1
View File
@@ -39,6 +39,7 @@ typedef SimulatorTraits<Isotropic, Explicit> SimTraits;
typedef SimulatorTesterFlexibleBC<SimTraits> Simulator;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -50,4 +51,7 @@ int main(int argc, char** argv)
sim.init(param);
sim.run();
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+6
View File
@@ -54,6 +54,7 @@ typedef SimulatorTraits<Isotropic, Implicit> SimTraits;
typedef SimulatorTesterFlexibleBC<SimTraits> Simulator;
int main(int argc, char** argv)
try
{
Opm::parameter::ParameterGroup param(argc, argv);
Dune::MPIHelper::instance(argc,argv);
@@ -61,4 +62,9 @@ int main(int argc, char** argv)
sim.init(param);
sim.run();
}
catch (const std::exception &e) {
std::cerr << "Program threw an exception: " << e.what() << "\n";
throw;
}
+3
View File
@@ -101,6 +101,7 @@ BOOST_AUTO_TEST_CASE(saturationboundarycondition)
BOOST_CHECK(bc2.saturation() == 0.3);
}
BOOST_AUTO_TEST_CASE(saturationboundaryconditions)
{
BasicBoundaryConditions<false, true> bc1;
@@ -115,6 +116,7 @@ BOOST_AUTO_TEST_CASE(saturationboundaryconditions)
BOOST_CHECK(bc2.satCond(1).saturation() == 0.8);
}
BOOST_AUTO_TEST_CASE(surfvolboundaryconditions)
{
enum { Nc = 3 };
@@ -134,3 +136,4 @@ BOOST_AUTO_TEST_CASE(surfvolboundaryconditions)
BOOST_CHECK(bc2.surfvolCond(1).isDirichlet());
BOOST_CHECK(bc2.surfvolCond(1).surfvol() == z);
}