From 7aca56da5e9f212e122e7bafea12ba42ae7aaf4c Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Mon, 4 Aug 2003 23:10:57 +0000 Subject: [PATCH] Fixed up a couple of issues with the stringstream block. That block works for reading transport databases with comments in them. The other block seems to get hung up. --- Cantera/src/converters/ck2ct.cpp | 37 +++++++++++++++++++----------- Cantera/src/converters/ck2ctml.cpp | 10 +++++++- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Cantera/src/converters/ck2ct.cpp b/Cantera/src/converters/ck2ct.cpp index 4d479a511..c7a4b17f6 100644 --- a/Cantera/src/converters/ck2ct.cpp +++ b/Cantera/src/converters/ck2ct.cpp @@ -11,6 +11,9 @@ #include #include +#ifdef USE_STRINGSTREAM +#include +#endif using namespace std; #include "CKReader.h" @@ -48,6 +51,12 @@ namespace pip { */ string rest; while (! s.eof()) { + /* + * HKM Note: the USE_STRINGSTREAM block works for files + * with comments in them. The other block gets hung up + * somehow. Should probably default to the USE_STRINGSTREAM + * option. + */ #ifdef USE_STRINGSTREAM /* * Read a line from the file @@ -75,25 +84,25 @@ namespace pip { * copy of it, and index it by the species name. */ if (nm != "") { - _trmap[nm] = t; // t.name] = t; + _trmap[nm] = t; // t.name] = t; } } #else - trdata t; - string nm; - s >> nm; - if (nm[0] != '!' && !s.eof()) { - s >> t.geom >> t.welldepth >> t.diam - >> t.dipole >> t.polar >> t.rot; + trdata t; + string nm; + s >> nm; + if (nm[0] != '!' && !s.eof()) { + s >> t.geom >> t.welldepth >> t.diam + >> t.dipole >> t.polar >> t.rot; - // get the rest of the line, in case there are comments - getline(s, rest); - if (nm != "") { - _trmap[nm] = t; // t.name] = t; - } - } - } + // get the rest of the line, in case there are comments + getline(s, rest); + if (nm != "") { + _trmap[nm] = t; // t.name] = t; + } + } #endif + } } diff --git a/Cantera/src/converters/ck2ctml.cpp b/Cantera/src/converters/ck2ctml.cpp index a57d66b01..072a8a97f 100755 --- a/Cantera/src/converters/ck2ctml.cpp +++ b/Cantera/src/converters/ck2ctml.cpp @@ -11,7 +11,9 @@ #include #include -//#include +#ifdef USE_STRINGSTREAM +#include +#endif using namespace std; #include "CKReader.h" @@ -378,6 +380,12 @@ namespace ctml { map indx; string rest; while (! s.eof()) { + /* + * HKM Note: the USE_STRINGSTREAM block works for files + * with comments in them. The other block gets hung up + * somehow. Should probably default to the USE_STRINGSTREAM + * option. + */ #ifdef USE_STRINGSTREAM /* * Read a line from the file