Added templated generic exception handler for clib functions

This commit is contained in:
Ray Speth 2012-03-05 20:46:34 +00:00
parent 54efbaa320
commit 9cdf079d2d
11 changed files with 473 additions and 664 deletions

View file

@ -9,8 +9,9 @@
#ifndef CT_CTEXCEPTIONS_H
#define CT_CTEXCEPTIONS_H
#include <string>
#include <exception>
#include <iostream>
#include <string>
namespace Cantera
{

View file

@ -7,6 +7,7 @@
#include <vector>
#include "cantera/base/stringUtils.h"
#include "cantera/base/config.h"
#include "cantera/base/ctexceptions.h"
/**
* Template for classes to hold pointers to objects. The Cabinet<M>
@ -91,11 +92,8 @@ public:
M* old = data[i];
data.push_back(new M(*old));
return static_cast<int>(data.size()) - 1;
} catch (Cantera::CanteraError& err) {
err.save();
return -1;
} catch (...) {
return -999;
return Cantera::handleAllExceptions(-1, -999);
}
}
@ -111,11 +109,8 @@ public:
M* dest = data[i];
*dest = *src;
return 0;
} catch (Cantera::CanteraError& err) {
err.save();
return -1;
} catch (...) {
return -999;
return Cantera::handleAllExceptions(-1, -999);
}
}

View file

@ -5,6 +5,8 @@
#define CTC_DEFS_H
#include "cantera/base/ct_defs.h"
#include "cantera/base/global.h"
#include "cantera/base/ctexceptions.h"
#ifdef _WIN32
// Windows (MSVC or MinGW)
@ -31,4 +33,40 @@
# define DERR -999.999
#endif
namespace Cantera {
//! Exception handler used at language interface boundaries.
/*!
* When called from a "catch (...)" block, this function will attempt to save
* an error message in global error and return a value indicating the type of
* exception caught.
*
* @param ctErrorCode Value to return if a CanteraError is caught
* @param otherErrorCode Value to return if a different exception is caught
*/
template <typename T>
T handleAllExceptions(T ctErrorCode, T otherErrorCode)
{
// Rethrow the previous exception, then catch a more
// specific exception type if possible.
try {
throw;
} catch (CanteraError& cterr) {
cterr.save();
return ctErrorCode;
} catch (std::exception& err) {
std::cerr << "Cantera: caught an instance of "
<< err.what() << std::endl;
setError("handleAllExceptions", err.what());
return otherErrorCode;
} catch (...) {
std::cerr << "Cantera: caught an instance of "
"an unknown exception type" << std::endl;
setError("handleAllExceptions", "unknown exception");
return otherErrorCode;
}
}
}
#endif

View file

@ -49,11 +49,9 @@ static PureFluidPhase* purefluid(int n)
} else {
throw CanteraError("purefluid","object is not a PureFluidPhase object");
}
} catch (CanteraError& err) {
err.save();
return 0;
} catch (...) {
return handleAllExceptions<PureFluidPhase*>(0, 0);
}
return 0;
}
static double pfprop(int n, int i, double v=0.0, double x=0.0)
@ -135,9 +133,8 @@ extern "C" {
{
try {
ThermoCabinet::item(n).setTemperature(t);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -246,11 +243,9 @@ extern "C" {
parseCompString(string(x), xx);
p.setMoleFractionsByName(xx);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
//catch (...) {return ERR;}
}
int phase_setMassFractions(int n, size_t leny,
@ -281,9 +276,8 @@ extern "C" {
parseCompString(string(y), yy);
p.setMassFractionsByName(yy);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -337,11 +331,9 @@ extern "C" {
copy(spnm.c_str(), spnm.c_str() + lout, nm);
nm[lout] = '\0';
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
//catch (...) {return ERR;}
}
int phase_getElementName(int n, size_t m, size_t lennm, char* nm)
@ -352,9 +344,8 @@ extern "C" {
copy(elnm.c_str(), elnm.c_str() + lout, nm);
nm[lout] = '\0';
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -363,9 +354,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).nAtoms(k,m);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -374,9 +364,8 @@ extern "C" {
try {
ThermoCabinet::item(n).addElement(string(name),weight);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -408,9 +397,8 @@ extern "C" {
XML_Node& x = XmlCabinet::item(mxml);
thermo_t* th = newPhase(x);
return ThermoCabinet::add(th);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -428,9 +416,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).enthalpy_mole();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -438,9 +425,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).intEnergy_mole();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -448,9 +434,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).entropy_mole();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -458,9 +443,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).gibbs_mole();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -468,9 +452,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).cp_mole();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -478,9 +461,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).cv_mole();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -488,9 +470,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).pressure();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -498,9 +479,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).enthalpy_mass();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -508,9 +488,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).intEnergy_mass();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -518,9 +497,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).entropy_mass();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -528,9 +506,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).gibbs_mass();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -538,9 +515,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).cp_mass();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -548,9 +524,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).cv_mass();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -558,9 +533,8 @@ extern "C" {
{
try {
return ThermoCabinet::item(n).electricPotential();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -596,9 +570,8 @@ extern "C" {
"pressure cannot be negative");
ThermoCabinet::item(n).setPressure(p);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -613,9 +586,8 @@ extern "C" {
throw CanteraError("th_set_HP",
"temperature cannot be negative");
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -630,9 +602,8 @@ extern "C" {
throw CanteraError("th_set_UV",
"temperature cannot be negative");
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -641,9 +612,8 @@ extern "C" {
try {
ThermoCabinet::item(n).setState_SV(vals[0],vals[1]);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -652,9 +622,8 @@ extern "C" {
try {
ThermoCabinet::item(n).setState_SP(vals[0],vals[1]);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -665,9 +634,8 @@ extern "C" {
equilibrate(ThermoCabinet::item(n), XY, solver, rtol, maxsteps,
maxiter, loglevel);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -698,9 +666,8 @@ extern "C" {
} else {
return -10;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -715,9 +682,8 @@ extern "C" {
} else {
return -10;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -732,9 +698,8 @@ extern "C" {
} else {
return -10;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -771,9 +736,8 @@ extern "C" {
{
try {
return purefluid(n)->satTemperature(p);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -781,9 +745,8 @@ extern "C" {
{
try {
return purefluid(n)->satPressure(t);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -792,9 +755,8 @@ extern "C" {
try {
purefluid(n)->setState_Psat(p, x);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -803,9 +765,8 @@ extern "C" {
try {
purefluid(n)->setState_Tsat(t, x);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
#else
@ -881,9 +842,8 @@ extern "C" {
} else {
return 0;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -896,9 +856,8 @@ extern "C" {
string defphase = string(default_phase);
installReactionArrays(p, k, defphase);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -970,9 +929,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -986,9 +944,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1007,9 +964,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1023,9 +979,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1043,9 +998,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1060,9 +1014,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1097,9 +1050,8 @@ extern "C" {
return ERR;
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1114,9 +1066,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1131,9 +1082,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1147,11 +1097,9 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
//catch (...) {return ERR;}
}
int kin_getNetProductionRates(int n, size_t len, double* wdot)
@ -1164,9 +1112,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1186,9 +1133,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1212,9 +1158,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1227,9 +1172,8 @@ extern "C" {
copy(r.c_str(), r.c_str() + lout, buf);
buf[lout] = '\0';
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1242,9 +1186,8 @@ extern "C" {
} else {
return ERR;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1259,9 +1202,8 @@ extern "C" {
"wrong kinetics manager type");
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1275,9 +1217,8 @@ extern "C" {
try {
Transport* tr = newTransportMgr(mstr, &t, loglevel);
return TransportCabinet::add(tr);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1285,9 +1226,8 @@ extern "C" {
{
try {
return TransportCabinet::item(n).viscosity();
} catch (CanteraError& err) {
err.save();
return -1.0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1295,9 +1235,8 @@ extern "C" {
{
try {
return TransportCabinet::item(n).thermalConductivity();
} catch (CanteraError& err) {
err.save();
return -1.0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1306,9 +1245,8 @@ extern "C" {
try {
TransportCabinet::item(n).getThermalDiffCoeffs(dt);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1317,9 +1255,8 @@ extern "C" {
try {
TransportCabinet::item(n).getMixDiffCoeffs(d);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1328,9 +1265,8 @@ extern "C" {
try {
TransportCabinet::item(n).getBinaryDiffCoeffs(ld,d);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1339,9 +1275,8 @@ extern "C" {
try {
TransportCabinet::item(n).getMultiDiffCoeffs(ld,d);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1350,9 +1285,8 @@ extern "C" {
try {
TransportCabinet::item(n).setParameters(type, k, d);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1362,9 +1296,8 @@ extern "C" {
try {
TransportCabinet::item(n).getMolarFluxes(state1, state2, delta, fluxes);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1374,9 +1307,8 @@ extern "C" {
try {
TransportCabinet::item(n).getMassFluxes(state1, state2, delta, fluxes);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1390,9 +1322,8 @@ extern "C" {
try {
importPhase(node, &thrm);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1409,9 +1340,8 @@ extern "C" {
try {
importKinetics(node, phases, &k);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1428,10 +1358,8 @@ extern "C" {
copy(s.begin(), s.end(), buf);
buf[s.size() - 1] = '\0';
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1441,9 +1369,8 @@ extern "C" {
bool stherm = (show_thermo != 0);
writephase(ThermoCabinet::item(nth), stherm);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1508,9 +1435,8 @@ extern "C" {
KineticsCabinet::clear();
TransportCabinet::clear();
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -1519,9 +1445,8 @@ extern "C" {
try {
ThermoCabinet::del(n);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

View file

@ -56,9 +56,8 @@ extern "C" {
{
try {
BoundaryCabinet::item(i).setTemperature(t);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
@ -67,9 +66,8 @@ extern "C" {
{
try {
return dynamic_cast<Inlet1D*>(&BoundaryCabinet::item(i))->spreadRate();
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
@ -78,9 +76,8 @@ extern "C" {
{
try {
dynamic_cast<Inlet1D*>(&BoundaryCabinet::item(i))->setSpreadRate(v);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
@ -89,9 +86,8 @@ extern "C" {
{
try {
BoundaryCabinet::item(i).setMdot(mdot);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
@ -106,9 +102,8 @@ extern "C" {
{
try {
BoundaryCabinet::item(i).setMoleFractions(xin);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
@ -117,9 +112,8 @@ extern "C" {
{
try {
BoundaryCabinet::item(i).setMoleFractions(string(xin));
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
@ -132,9 +126,8 @@ extern "C" {
InterfaceKinetics* k =
dynamic_cast<InterfaceKinetics*>(&Cabinet<Kinetics>::item(j));
srf->setKineticsMgr(k);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}

View file

@ -87,9 +87,8 @@ extern "C" {
r = new Func1();
}
return FuncCabinet::add(r);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
}
@ -139,9 +138,8 @@ extern "C" {
std::copy(w.c_str(), w.c_str() + lout, nm);
nm[lout] = '\0';
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
}

View file

@ -24,9 +24,8 @@ static bool checkSpecies(int i, size_t k)
throw CanteraError("checkSpecies",
"illegal species index ("+int2str(k)+") ");
return true;
} catch (CanteraError& err) {
err.save();
return false;
} catch (...) {
return Cantera::handleAllExceptions(false, false);
}
}
@ -37,9 +36,8 @@ static bool checkElement(int i, size_t m)
throw CanteraError("checkElement",
"illegal element index ("+int2str(m)+") ");
return true;
} catch (CanteraError& err) {
err.save();
return false;
} catch (...) {
return Cantera::handleAllExceptions(false, false);
}
}
@ -50,9 +48,8 @@ static bool checkPhase(int i, int n)
throw CanteraError("checkPhase",
"illegal phase index ("+int2str(n)+") ");
return true;
} catch (CanteraError& err) {
err.save();
return false;
} catch (...) {
return Cantera::handleAllExceptions(false, false);
}
}
@ -160,9 +157,8 @@ extern "C" {
}
mixCabinet::item(i).setMoles(n);
return 0;
} catch (CanteraError& err) {
err.save();
return ERR;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -172,9 +168,8 @@ extern "C" {
try {
mixCabinet::item(i).setMolesByName(string(n));
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -253,9 +248,8 @@ extern "C" {
try {
return equilibrate(mixCabinet::item(i), XY,
rtol, maxsteps, maxiter, loglevel);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -276,9 +270,8 @@ extern "C" {
" To use this feature add export WITH_VCS_NONIDEAL='y' to the preconfig file");
#endif
return (double) retn;
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -290,9 +283,8 @@ extern "C" {
}
mixCabinet::item(i).getChemPotentials(mu);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -306,9 +298,8 @@ extern "C" {
}
mixCabinet::item(i).getValidChemPotentials(bad_mu, mu, st);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

View file

@ -52,9 +52,8 @@ extern "C" {
try {
DomainCabinet::clear();
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -92,9 +91,8 @@ extern "C" {
copy(nm.c_str(), nm.c_str() + lout, buf);
buf[lout] = '\0';
return static_cast<int>(nm.size());
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -103,9 +101,8 @@ extern "C" {
try {
size_t n = DomainCabinet::item(i).componentIndex(string(name));
return n;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -113,9 +110,8 @@ extern "C" {
{
try {
return DomainCabinet::item(i).grid(n);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -124,9 +120,8 @@ extern "C" {
try {
DomainCabinet::item(i).setBounds(n, lower, upper);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -134,9 +129,8 @@ extern "C" {
{
try {
return DomainCabinet::item(i).upperBound(n);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -144,9 +138,8 @@ extern "C" {
{
try {
return DomainCabinet::item(i).lowerBound(n);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -156,9 +149,8 @@ extern "C" {
try {
DomainCabinet::item(i).setTolerances(n, rtol, atol, itime);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -166,9 +158,8 @@ extern "C" {
{
try {
return DomainCabinet::item(i).rtol(n);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -176,9 +167,8 @@ extern "C" {
{
try {
return DomainCabinet::item(i).atol(n);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -187,9 +177,8 @@ extern "C" {
try {
DomainCabinet::item(i).setupGrid(npts, grid);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -199,9 +188,8 @@ extern "C" {
string s = string(id);
DomainCabinet::item(i).setID(s);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -212,9 +200,8 @@ extern "C" {
string s = string(desc);
DomainCabinet::item(i).setDesc(s);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -224,9 +211,8 @@ extern "C" {
try {
Inlet1D* i = new Inlet1D();
return DomainCabinet::add(i);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -235,9 +221,8 @@ extern "C" {
try {
Surf1D* i = new Surf1D();
return DomainCabinet::add(i);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -247,10 +232,8 @@ extern "C" {
//writelog("in reactingsurf_new\n");
Domain1D* i = new ReactingSurf1D();
return DomainCabinet::add(i);
} catch (CanteraError& err) {
err.save();
writelog("error");
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -259,9 +242,8 @@ extern "C" {
try {
Symm1D* i = new Symm1D();
return DomainCabinet::add(i);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -270,9 +252,8 @@ extern "C" {
try {
Outlet1D* i = new Outlet1D();
return DomainCabinet::add(i);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -281,9 +262,8 @@ extern "C" {
try {
OutletRes1D* i = new OutletRes1D();
return DomainCabinet::add(i);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -292,9 +272,8 @@ extern "C" {
try {
_bdry(i)->setMdot(mdot);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -303,9 +282,8 @@ extern "C" {
try {
_bdry(i)->setTemperature(t);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -314,9 +292,8 @@ extern "C" {
try {
_bdry(i)->setMoleFractions(string(x));
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -324,9 +301,8 @@ extern "C" {
{
try {
return _bdry(i)->temperature();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -334,9 +310,8 @@ extern "C" {
{
try {
return _bdry(i)->massFraction(k);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -344,9 +319,8 @@ extern "C" {
{
try {
return _bdry(i)->mdot();
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -358,9 +332,8 @@ extern "C" {
dynamic_cast<InterfaceKinetics*>(&Cabinet<Kinetics>::item(j));
srf->setKineticsMgr(k);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -370,11 +343,8 @@ extern "C" {
ReactingSurf1D* srf = (ReactingSurf1D*)_bdry(i);
srf->enableCoverageEquations(onoff != 0);
return 0;
}
catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -384,11 +354,8 @@ extern "C" {
Inlet1D* inlt = (Inlet1D*)_bdry(i);
inlt->setSpreadRate(v);
return 0;
}
catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -411,9 +378,8 @@ extern "C" {
} else {
return -2;
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -427,9 +393,8 @@ extern "C" {
try {
_stflow(i)->setTransport(TransportCabinet::item(itr), withSoret);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -442,9 +407,8 @@ extern "C" {
try {
_stflow(i)->enableSoret(withSoret);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -453,9 +417,8 @@ extern "C" {
try {
_stflow(i)->setPressure(p);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -470,9 +433,8 @@ extern "C" {
}
_stflow(i)->setFixedTempProfile(vpos, vtemp);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -486,9 +448,8 @@ extern "C" {
_stflow(i)->fixSpecies(-1);
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -502,9 +463,8 @@ extern "C" {
_stflow(i)->fixTemperature(-1);
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -525,9 +485,8 @@ extern "C" {
Sim1D* s = new Sim1D(d);
//writelog("in sim1D_new, ret Sim1D\n");
return SimCabinet::add(s);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -536,9 +495,8 @@ extern "C" {
try {
SimCabinet::clear();
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -554,9 +512,8 @@ extern "C" {
try {
SimCabinet::item(i).setValue(dom, comp, localPoint, value);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -571,9 +528,8 @@ extern "C" {
}
SimCabinet::item(i).setProfile(dom, comp, pv, vv);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -582,9 +538,8 @@ extern "C" {
try {
SimCabinet::item(i).setFlatProfile(dom, comp, v);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -606,9 +561,8 @@ extern "C" {
try {
SimCabinet::item(i).setTimeStep(stepsize, ns, nsteps);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -617,9 +571,8 @@ extern "C" {
try {
SimCabinet::item(i).getInitialSoln();
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -629,9 +582,8 @@ extern "C" {
bool r = (refine_grid == 0 ? false : true);
SimCabinet::item(i).solve(loglevel, r);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -640,9 +592,8 @@ extern "C" {
try {
SimCabinet::item(i).refine(loglevel);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -652,9 +603,8 @@ extern "C" {
try {
SimCabinet::item(i).setRefineCriteria(dom, ratio, slope, curve, prune);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -667,9 +617,8 @@ extern "C" {
string sdesc = string(desc);
SimCabinet::item(i).save(sname, sid, sdesc);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -680,9 +629,8 @@ extern "C" {
string sid = string(id);
SimCabinet::item(i).restore(sname, sid);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -691,9 +639,8 @@ extern "C" {
try {
SimCabinet::item(i).writeStats(printTime);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -701,9 +648,8 @@ extern "C" {
{
try {
return (int) SimCabinet::item(i).domainIndex(string(name));
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -711,9 +657,8 @@ extern "C" {
{
try {
return SimCabinet::item(i).value(idom, icomp, localPoint);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -721,9 +666,8 @@ extern "C" {
{
try {
return SimCabinet::item(i).workValue(idom, icomp, localPoint);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -732,9 +676,8 @@ extern "C" {
try {
SimCabinet::item(i).eval(rdt, count);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -743,9 +686,8 @@ extern "C" {
try {
SimCabinet::item(i).setJacAge(ss_age, ts_age);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -754,9 +696,8 @@ extern "C" {
try {
SimCabinet::item(i).setTimeStepFactor(tfactor);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -770,9 +711,8 @@ extern "C" {
SimCabinet::item(i).setMaxTimeStep(tsmax);
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -781,9 +721,8 @@ extern "C" {
try {
SimCabinet::item(i).setFixedTemperature(temp);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -792,9 +731,8 @@ extern "C" {
try {
SimCabinet::item(i).evalSSJacobian();
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -802,9 +740,8 @@ extern "C" {
{
try {
return SimCabinet::item(i).jacobian(m,n);
} catch (CanteraError& err) {
err.save();
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -812,9 +749,8 @@ extern "C" {
{
try {
return SimCabinet::item(i).size();
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
}

View file

@ -99,9 +99,8 @@ extern "C" {
try {
ReactorCabinet::item(i).advance(t);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -249,9 +248,8 @@ extern "C" {
try {
NetworkCabinet::item(i).addReactor(&ReactorCabinet::item(n));
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -261,7 +259,7 @@ extern "C" {
NetworkCabinet::item(i).advance(t);
return 0;
} catch (...) {
return -1;
return handleAllExceptions(-1, ERR);
}
}
@ -270,7 +268,7 @@ extern "C" {
try {
return NetworkCabinet::item(i).step(t);
} catch (...) {
return DERR;
return handleAllExceptions(DERR, DERR);
}
}
@ -331,9 +329,8 @@ extern "C" {
throw CanteraError("install","Could not install flow device.");
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}

View file

@ -35,9 +35,8 @@ extern "C" {
try {
XML_Node* x = get_XML_File(std::string(file), debug);
return XmlCabinet::add(x);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -47,9 +46,8 @@ extern "C" {
XmlCabinet::clear();
close_XML_File("all");
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -88,9 +86,8 @@ extern "C" {
XmlCabinet::item(i).build(f);
f.close();
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -99,9 +96,8 @@ extern "C" {
try {
get_CTML_Tree(&XmlCabinet::item(i), string(file), debug);
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -118,9 +114,8 @@ extern "C" {
} else
throw CanteraError("xml_attrib","node "
" has no attribute '"+ky+"'");
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -132,9 +127,8 @@ extern "C" {
string val = string(value);
XML_Node& node = XmlCabinet::item(i);
node.addAttribute(ky, val);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -145,9 +139,8 @@ extern "C" {
string c = string(comment);
XML_Node& node = XmlCabinet::item(i);
node.addComment(c);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -158,9 +151,8 @@ extern "C" {
XML_Node& node = XmlCabinet::item(i);
const string v = node.name();
strncpy(tag, v.c_str(), 80);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -171,9 +163,8 @@ extern "C" {
XML_Node& node = XmlCabinet::item(i);
const string v = node.value();
strncpy(value, v.c_str(), 80);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -184,9 +175,8 @@ extern "C" {
XML_Node& node = XmlCabinet::item(i);
XML_Node& c = node.child(string(loc));
return XmlCabinet::add(&c);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -197,9 +187,8 @@ extern "C" {
XML_Node& node = XmlCabinet::item(i);
XML_Node& c = node.child(m);
return XmlCabinet::add(&c);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -214,9 +203,8 @@ extern "C" {
} else {
throw CanteraError("xml_find_id","id not found: "+string(id));
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -231,9 +219,8 @@ extern "C" {
} else
throw CanteraError("xml_findByName","name "+string(nm)
+" not found");
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -255,9 +242,8 @@ extern "C" {
XML_Node& node = XmlCabinet::item(i);
XML_Node& c = node.addChild(string(name),string(value));
return XmlCabinet::add(&c);
} catch (CanteraError& err) {
cout << err.what() << endl;
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -269,9 +255,8 @@ extern "C" {
XML_Node& chld = XmlCabinet::item(j);
XML_Node& c = node.addChild(chld);
return XmlCabinet::add(&c);
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -288,9 +273,8 @@ extern "C" {
"file "+string(file)+" not found.");
}
return 0;
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
@ -316,9 +300,8 @@ extern "C" {
for (size_t i = 0; i < nv; i++) {
data[i] = v[i];
}
} catch (CanteraError& err) {
err.save();
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}

View file

@ -89,9 +89,8 @@ extern "C" {
std::string sproc = f2string(proc, proclen);
std::string smsg = f2string(msg, msglen);
throw CanteraError(sproc, smsg);
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return -1;
}
@ -109,9 +108,8 @@ extern "C" {
nm[nn] = ' ';
}
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -215,9 +213,8 @@ extern "C" {
parseCompString(f2string(x, lx), xx);
p->setMoleFractionsByName(xx);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -244,9 +241,8 @@ extern "C" {
parseCompString(f2string(y, leny), yy);
p->setMassFractionsByName(yy);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -277,9 +273,8 @@ extern "C" {
nm[nn] = ' ';
}
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -293,9 +288,8 @@ extern "C" {
nm[nn] = ' ';
}
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -304,9 +298,8 @@ extern "C" {
{
try {
return _fph(n)->nAtoms(*k-1,*m-1);
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -321,9 +314,8 @@ extern "C" {
XML_Node* x = _xml(mxml);
thermo_t* th = newPhase(*x);
return ThermoCabinet::add(th);
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -341,9 +333,8 @@ extern "C" {
{
try {
return _fth(n)->enthalpy_mole();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -351,9 +342,8 @@ extern "C" {
{
try {
return _fth(n)->intEnergy_mole();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -361,9 +351,8 @@ extern "C" {
{
try {
return _fth(n)->entropy_mole();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -371,9 +360,8 @@ extern "C" {
{
try {
return _fth(n)->gibbs_mole();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -381,9 +369,8 @@ extern "C" {
{
try {
return _fth(n)->cp_mole();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -391,9 +378,8 @@ extern "C" {
{
try {
return _fth(n)->cv_mole();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -401,9 +387,8 @@ extern "C" {
{
try {
return _fth(n)->pressure();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -411,9 +396,8 @@ extern "C" {
{
try {
return _fth(n)->enthalpy_mass();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -421,9 +405,8 @@ extern "C" {
{
try {
return _fth(n)->intEnergy_mass();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -431,9 +414,8 @@ extern "C" {
{
try {
return _fth(n)->entropy_mass();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -441,9 +423,8 @@ extern "C" {
{
try {
return _fth(n)->gibbs_mass();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -451,9 +432,8 @@ extern "C" {
{
try {
return _fth(n)->cp_mass();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -461,9 +441,8 @@ extern "C" {
{
try {
return _fth(n)->cv_mass();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -479,9 +458,8 @@ extern "C" {
try {
_fth(n)->setPressure(*p);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -490,9 +468,8 @@ extern "C" {
try {
_fth(n)->setState_HP(*v1, *v2);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -501,9 +478,8 @@ extern "C" {
try {
_fth(n)->setState_UV(*v1, *v2);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -512,9 +488,8 @@ extern "C" {
try {
_fth(n)->setState_SV(*v1, *v2);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -523,9 +498,8 @@ extern "C" {
try {
_fth(n)->setState_SP(*v1, *v2);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -534,9 +508,8 @@ extern "C" {
try {
equilibrate(*_fth(n), f2string(XY,lenxy).c_str());
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -607,9 +580,8 @@ extern "C" {
} else {
return 0;
}
} catch (CanteraError& err) {
handleError(err);
return 999;
} catch (...) {
return handleAllExceptions(999, ERR);
}
}
@ -686,9 +658,8 @@ extern "C" {
try {
k->getFwdRatesOfProgress(fwdROP);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -698,9 +669,8 @@ extern "C" {
try {
k->getRevRatesOfProgress(revROP);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -715,9 +685,8 @@ extern "C" {
Kinetics* k = _fkin(n);
k->getNetRatesOfProgress(netROP);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -727,9 +696,8 @@ extern "C" {
Kinetics* k = _fkin(n);
k->getCreationRates(cdot);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -739,9 +707,8 @@ extern "C" {
Kinetics* k = _fkin(n);
k->getDestructionRates(ddot);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -751,9 +718,8 @@ extern "C" {
Kinetics* k = _fkin(n);
k->getNetProductionRates(wdot);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -768,9 +734,8 @@ extern "C" {
Kinetics* k = _fkin(n);
k->getEquilibriumConstants(kc);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -785,9 +750,8 @@ extern "C" {
buf[nn] = ' ';
}
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -796,9 +760,8 @@ extern "C" {
try {
_fkin(n)->setMultiplier(*i-1,*v);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -813,9 +776,8 @@ extern "C" {
"wrong kinetics manager type");
}
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -829,9 +791,8 @@ extern "C" {
try {
Transport* tr = newTransportMgr(mstr, t, *loglevel);
return TransportCabinet::add(tr);
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -839,9 +800,8 @@ extern "C" {
{
try {
return _ftrans(n)->viscosity();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -849,9 +809,8 @@ extern "C" {
{
try {
return _ftrans(n)->thermalConductivity();
} catch (CanteraError& err) {
handleError(err);
return DERR;
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
@ -860,9 +819,8 @@ extern "C" {
try {
_ftrans(n)->getThermalDiffCoeffs(dt);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -871,9 +829,8 @@ extern "C" {
try {
_ftrans(n)->getMixDiffCoeffs(d);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -882,9 +839,8 @@ extern "C" {
try {
_ftrans(n)->getBinaryDiffCoeffs(*ld,d);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -893,9 +849,8 @@ extern "C" {
try {
_ftrans(n)->getMultiDiffCoeffs(*ld,d);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -904,9 +859,8 @@ extern "C" {
try {
_ftrans(n)->setParameters(*type, *k, d);
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
@ -954,10 +908,8 @@ extern "C" {
buf[nn] = ' ';
}
return 0;
} catch (CanteraError& err) {
handleError(err);
return -1;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}