From b8f87a1eb15abf4c298b2ae1adad1ece72d832d4 Mon Sep 17 00:00:00 2001 From: Kristian Flikka Date: Fri, 14 Nov 2014 13:27:27 +0100 Subject: [PATCH] Prints a warning if a keyword that has already been added, occurs again. Next step, process keywords from several ordered, top-level folders --- .../eclipse/Parser/createDefaultKeywordList.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp b/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp index 0a28911a2..bf9df3054 100644 --- a/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp +++ b/opm/parser/eclipse/Parser/createDefaultKeywordList.cpp @@ -198,11 +198,21 @@ static void generateKeywordSource(const char * source_file_name , KeywordMapType //----------------------------------------------------------------- static void scanKeyword(const boost::filesystem::path& file , KeywordMapType& keywordMap) { - if (!ParserKeyword::validInternalName(file.filename().string())) { + std::cerr << "Scanning file: " << file.string() << std::endl; + + std::string internalName = file.filename().string(); + if (!ParserKeyword::validInternalName(internalName)) { std::cerr << "Warning: Ignoring incorrectly named file '" << file.string() << "'.\n"; return; } + KeywordMapType::iterator existingEntry = keywordMap.find(internalName); + bool alreadyExists = existingEntry != keywordMap.end(); + if (alreadyExists) { + std::cerr << "Warning: Ignoring the the keyword " << internalName << " in '" << file.string() + << "', it has already been read from '" << existingEntry->second.first << "'" << std::endl; + } + Json::JsonObject * jsonKeyword; try { jsonKeyword = new Json::JsonObject(file); @@ -226,6 +236,7 @@ static void scanKeyword(const boost::filesystem::path& file , KeywordMapType& ke } static void scanAllKeywords(const boost::filesystem::path& directory , KeywordMapType& keywordMap) { + std::cerr << "Scanning path: " << directory.string() << std::endl; boost::filesystem::directory_iterator end; for (boost::filesystem::directory_iterator iter(directory); iter != end; iter++) { if (boost::filesystem::is_directory(*iter))