From 89f1b6399f09d422b11a5cd965642a28bc21263a Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Wed, 28 Mar 2012 09:35:49 +0200 Subject: [PATCH] Fixed gruptree reading --- opm/core/eclipse/SpecialEclipseFields.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/opm/core/eclipse/SpecialEclipseFields.hpp b/opm/core/eclipse/SpecialEclipseFields.hpp index 2526d21f..703474dc 100644 --- a/opm/core/eclipse/SpecialEclipseFields.hpp +++ b/opm/core/eclipse/SpecialEclipseFields.hpp @@ -294,27 +294,27 @@ struct GRUPTREE : public SpecialBase { } virtual void read(std::istream & is) { - // Not done: - return; while (!is.eof()) { std::string child = readString(is); + is >> ignoreWhitespace; std::string parent = readString(is); std::cout << "CHILD = " << child << std::endl << "PARENT = " << parent << std::endl; tree[child] = parent; - - int action = next_action(is); // 0:continue 1:return 2:throw - if (action == 1) { - return; // Alphabetic char. Read next keyword. - } else if (action == 2) { - THROW("Error reading GRUPTREE. Next character is " - << (char) is.peek()); + + is >> ignoreSlashLine; + is >> ignoreWhitespace; + if(is.peek() == int('/')) { + is >> ignoreSlashLine; + return; } } } virtual void write(std::ostream & os) { - //os << name() << '\n' << tree << '\n'; + for(std::map::iterator it = tree.begin(); it != tree.end(); ++it) { + os << it->first << " "<< it->second<< std::endl; + } } virtual void convertToSI(const EclipseUnits&) {