From d5d4bacdd7ae5445e0faf827216f2e5fcdbe0877 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Fri, 23 Apr 2004 19:05:41 +0000 Subject: [PATCH] Strictly formatting- broke up long lines added a few comments. --- Cantera/src/importCTML.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Cantera/src/importCTML.cpp b/Cantera/src/importCTML.cpp index 9eef8e953..6d443d4ff 100755 --- a/Cantera/src/importCTML.cpp +++ b/Cantera/src/importCTML.cpp @@ -422,7 +422,8 @@ namespace Cantera { * This function will check a specific reaction to see if it the * elements balance. */ - static void checkRxnElementBalance(Kinetics& kin, const ReactionData &rdata) { + static void checkRxnElementBalance(Kinetics& kin, + const ReactionData &rdata) { int index, klocal, n, kp, kr, m, nel; double kstoich; map bal, balr, balp; @@ -1148,7 +1149,8 @@ namespace Cantera { * stoichiometric coefficients have the same ratio for all * species. */ - doublereal isDuplicateReaction(map& r1, map& r2) { + doublereal isDuplicateReaction(map& r1, + map& r2) { map::const_iterator b = r1.begin(), e = r1.end(); int k1 = b->first; @@ -1192,7 +1194,8 @@ next: * which involve missing species. */ static bool installReaction(int i, const XML_Node& r, Kinetics* k, - string default_phase, int rule, bool check_for_duplicates) { + string default_phase, int rule, + bool check_for_duplicates) { Kinetics& kin = *k; /* @@ -1218,8 +1221,8 @@ next: * This seemingly simple expression goes and finds the child element, * "equation". Then it treats all of the contents of the "equation" * as a string, and returns it the variable eqn. We post process - * the string to convert [ and ] characters into < and >, which cannot be - * stored in an XML file. + * the string to convert [ and ] characters into < and >, which + * cannot be stored in an XML file. */ if (r.hasChild("equation")) eqn = r("equation"); @@ -1351,12 +1354,16 @@ next: getRateCoefficient(r.child("rateCoeff"), kin, rdata, negA); + /* + * Check to see that the elements balance in the reaction. + * Throw an error if they don't + */ + checkRxnElementBalance(kin, rdata); /* * Ok we have read everything in about the reaction. Add it * to the kinetics object by calling the Kinetics member function, * addReaction() */ - checkRxnElementBalance(kin, rdata); kin.addReaction(rdata); return true; }