Modify return value handling for some examples and tests

This commit is contained in:
Ray Speth 2012-05-24 16:29:59 +00:00
parent 5ef6a024a9
commit dcb7f37a3c
7 changed files with 19 additions and 46 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}