diff --git a/samples/cxx/flamespeed/flamespeed.cpp b/samples/cxx/flamespeed/flamespeed.cpp index 96b5b3c64..5960ab1cd 100644 --- a/samples/cxx/flamespeed/flamespeed.cpp +++ b/samples/cxx/flamespeed/flamespeed.cpp @@ -258,13 +258,12 @@ int flamespeed(int np, void* p) flow.grid(n), Tvec[n], Uvec[n], COvec[n], CO2vec[n]); } fclose(FP); - - return 0; } catch (CanteraError& err) { std::cerr << err.what() << std::endl; std::cerr << "program terminating." << endl; return -1; } + return 0; } #ifndef CXX_DEMO diff --git a/test_problems/cxx_ex/kinetics_example1.cpp b/test_problems/cxx_ex/kinetics_example1.cpp index 0808bbd1a..551cc2f9d 100644 --- a/test_problems/cxx_ex/kinetics_example1.cpp +++ b/test_problems/cxx_ex/kinetics_example1.cpp @@ -105,14 +105,12 @@ int kinetics_example1(int job) << " kin1.dat (Tecplot data file)" << endl; delete gg; - return 0; - } - - // handle exceptions thrown by Cantera - catch (CanteraError& err) { + } catch (CanteraError& err) { + // handle exceptions thrown by Cantera std::cout << err.what() << std::endl; cout << " terminating... " << endl; appdelete(); return -1; } + return 0; } diff --git a/test_problems/cxx_ex/kinetics_example2.cpp b/test_problems/cxx_ex/kinetics_example2.cpp index 5391803ef..6895447b9 100644 --- a/test_problems/cxx_ex/kinetics_example2.cpp +++ b/test_problems/cxx_ex/kinetics_example2.cpp @@ -21,9 +21,7 @@ using namespace Cantera; int kinetics_example2(int job) { - try { - std::cout << "Ignition simulation using class GRI30." << std::endl; if (job >= 1) { @@ -95,15 +93,12 @@ int kinetics_example2(int job) std::cout << "Output files:" << std::endl << " kin2.csv (Excel CSV file)" << std::endl << " kin2.dat (Tecplot data file)" << std::endl; - - return 0; - } - - // handle exceptions thrown by Cantera - catch (CanteraError& err) { + } catch (CanteraError& err) { + // handle exceptions thrown by Cantera std::cout << err.what() << std::endl; std::cout << " terminating... " << std::endl; appdelete(); return -1; } + return 0; } diff --git a/test_problems/cxx_ex/kinetics_example3.cpp b/test_problems/cxx_ex/kinetics_example3.cpp index 971a7aa02..cf720771e 100644 --- a/test_problems/cxx_ex/kinetics_example3.cpp +++ b/test_problems/cxx_ex/kinetics_example3.cpp @@ -27,7 +27,6 @@ using std::endl; int kinetics_example3(int job) { - try { cout << "Ignition simulation using class IdealGasMix " @@ -104,14 +103,12 @@ int kinetics_example3(int job) << " kin3.dat (Tecplot data file)" << endl; delete gg; - return 0; - } - - // handle exceptions thrown by Cantera - catch (CanteraError& err) { + } catch (CanteraError& err) { + // handle exceptions thrown by Cantera std::cout << err.what() << std::endl; cout << " terminating... " << endl; appdelete(); return -1; } + return 0; } diff --git a/test_problems/cxx_ex/rxnpath_example1.cpp b/test_problems/cxx_ex/rxnpath_example1.cpp index ec6feaf30..2cc0f4616 100644 --- a/test_problems/cxx_ex/rxnpath_example1.cpp +++ b/test_problems/cxx_ex/rxnpath_example1.cpp @@ -75,7 +75,6 @@ void writeRxnPathDiagram(double time, ReactionPathBuilder& b, int rxnpath_example1(int job) { - try { cout << "Reaction path diagram movies with file gri30.cti." << endl; @@ -145,15 +144,12 @@ int rxnpath_example1(int job) cout << "To generate the diagrams in Postscript, execute the command" << endl << endl << "dot -Tps rp1.dot > rp1.ps" << endl << endl << "Get dot for Windows here: http://blue.caltech.edu/dot.exe" << endl; - - return 0; - } - - // handle exceptions thrown by Cantera - catch (CanteraError& err) { + } catch (CanteraError& err) { + // handle exceptions thrown by Cantera std::cout << err.what() << std::endl; cout << " terminating... " << endl; appdelete(); return -1; } + return 0; } diff --git a/test_problems/cxx_ex/transport_example1.cpp b/test_problems/cxx_ex/transport_example1.cpp index a6af34af0..fbdc28352 100644 --- a/test_problems/cxx_ex/transport_example1.cpp +++ b/test_problems/cxx_ex/transport_example1.cpp @@ -40,9 +40,7 @@ void plotTransportSoln(std::string fname, std::string fmt, std::string title, int transport_example1(int job) { - try { - cout << "Mixture-averaged transport properties." << endl; if (job > 0) { cout << "Viscosity, thermal conductivity, and mixture-averaged\n" @@ -92,15 +90,12 @@ int transport_example1(int job) cout << "Output files:" << endl << " tr1.csv (Excel CSV file)" << endl << " tr1.dat (Tecplot data file)" << endl; - - return 0; - } - - // handle exceptions thrown by Cantera - catch (CanteraError& err) { + } catch (CanteraError& err) { + // handle exceptions thrown by Cantera std::cout << err.what() << std::endl; cout << " terminating... " << endl; appdelete(); return -1; } + return 0; } diff --git a/test_problems/cxx_ex/transport_example2.cpp b/test_problems/cxx_ex/transport_example2.cpp index 2cf6700ed..2fb2864dd 100644 --- a/test_problems/cxx_ex/transport_example2.cpp +++ b/test_problems/cxx_ex/transport_example2.cpp @@ -41,9 +41,7 @@ void plotTransportSoln(std::string fname, std::string fmt, std::string title, int transport_example2(int job) { - try { - cout << "Multicomponent transport properties." << endl; if (job > 0) { cout << "Viscosity, thermal conductivity, and thermal diffusion\n" @@ -62,14 +60,12 @@ int transport_example2(int job) gas.setState_TPX(temp, pres, "H2:1.0, O2:0.5, CH4:0.1, N2:0.2"); equilibrate(gas,"TP"); - // create a transport manager that implements // multicomponent transport properties Transport* tr = newTransportMgr("Multi", &gas); int nsp = gas.nSpecies(); - // create a 2D array to hold the outputs int ntemps = 20; Array2D output(nsp+3, ntemps); @@ -94,15 +90,12 @@ int transport_example2(int job) cout << "Output files:" << endl << " tr2.csv (Excel CSV file)" << endl << " tr2.dat (Tecplot data file)" << endl; - - return 0; - } - - // handle exceptions thrown by Cantera - catch (CanteraError& err) { + } catch (CanteraError& err) { + // handle exceptions thrown by Cantera std::cout << err.what() << std::endl; cout << " terminating... " << endl; appdelete(); return -1; } + return 0; }