From acf4b8f6fb3dcdf9f9de625348785cf8368156b4 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Tue, 19 Oct 2004 10:43:53 +0000 Subject: [PATCH] changed reading of transport data from XML tree so that species with no transport data (e.g. surface species) do not cause an exception to be thrown because the have no 'transport' child element. --- Cantera/src/transport/TransportFactory.cpp | 66 ++++++++++++---------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/Cantera/src/transport/TransportFactory.cpp b/Cantera/src/transport/TransportFactory.cpp index dd7827778..0045a01ec 100755 --- a/Cantera/src/transport/TransportFactory.cpp +++ b/Cantera/src/transport/TransportFactory.cpp @@ -579,41 +579,49 @@ namespace Cantera { for (i = 0; i < nsp; i++) { const XML_Node& sp = *xspecies[i]; name = sp["name"]; - XML_Node& tr = sp.child("transport"); - getString(tr, "geometry", val, type); - geom = gindx[val] - 100; - map fv; - welldepth = getFloat(tr, "LJ_welldepth"); - diam = getFloat(tr, "LJ_diameter"); - dipole = getFloat(tr, "dipoleMoment"); - polar = getFloat(tr, "polarizability"); - rot = getFloat(tr, "rotRelax"); + // put in a try block so that species with no 'transport' + // child are skipped, instead of throwing an exception. + try { + XML_Node& tr = sp.child("transport"); + getString(tr, "geometry", val, type); + geom = gindx[val] - 100; + map fv; - GasTransportData data; - data.speciesName = name; - data.geometry = geom; - if (welldepth >= 0.0) data.wellDepth = welldepth; - else throw TransportDBError(linenum, - "negative well depth"); + welldepth = getFloat(tr, "LJ_welldepth"); + diam = getFloat(tr, "LJ_diameter"); + dipole = getFloat(tr, "dipoleMoment"); + polar = getFloat(tr, "polarizability"); + rot = getFloat(tr, "rotRelax"); - if (diam > 0.0) data.diameter = diam; - else throw TransportDBError(linenum, - "negative or zero diameter"); + GasTransportData data; + data.speciesName = name; + data.geometry = geom; + if (welldepth >= 0.0) data.wellDepth = welldepth; + else throw TransportDBError(linenum, + "negative well depth"); - if (dipole >= 0.0) data.dipoleMoment = dipole; - else throw TransportDBError(linenum, - "negative dipole moment"); - - if (polar >= 0.0) data.polarizability = polar; - else throw TransportDBError(linenum, - "negative polarizability"); + if (diam > 0.0) data.diameter = diam; + else throw TransportDBError(linenum, + "negative or zero diameter"); - if (rot >= 0.0) data.rotRelaxNumber = rot; - else throw TransportDBError(linenum, - "negative rotation relaxation number"); + if (dipole >= 0.0) data.dipoleMoment = dipole; + else throw TransportDBError(linenum, + "negative dipole moment"); + + if (polar >= 0.0) data.polarizability = polar; + else throw TransportDBError(linenum, + "negative polarizability"); - datatable[name] = data; + if (rot >= 0.0) data.rotRelaxNumber = rot; + else throw TransportDBError(linenum, + "negative rotation relaxation number"); + + datatable[name] = data; + } + catch(CanteraError) { + ; + } } for (i = 0; i < tr.nsp; i++) {