/* Copyright 2016 Statoil ASA. This file is part of the Open Porous Media project (OPM). OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OPM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OPM. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Opm { namespace MissingFeatures { template void addSupported(std::multimap >& map, T itemValue) { std::pair > pair({Keyword::keywordName, PartiallySupported{Item::itemName , itemValue}}); map.insert(pair); } template void checkOptions(const DeckKeyword& keyword, std::multimap >& map, const ParseContext& parseContext, ErrorGuard& errorGuard) { // check for partially supported keywords. typename std::multimap >::iterator it, itlow, itup; itlow = map.lower_bound(keyword.name()); itup = map.upper_bound(keyword.name()); for (it = itlow; it != itup; ++it) { const auto& record = keyword.getRecord(0); if (record.getItem(it->second.item).template get(0) != it->second.item_value) { std::string msg = "For keyword '" + it->first + "' only value " + boost::lexical_cast(it->second.item_value) + " in item " + it->second.item + " is supported by flow.\n" + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; parseContext.handleError(ParseContext::SIMULATOR_KEYWORD_ITEM_NOT_SUPPORTED, msg, errorGuard); } } } template void checkKeywords(const Deck& deck, const ParseContext& parseContext, T&& errorGuard) { checkKeywords(deck, parseContext, errorGuard); } void checkKeywords(const Deck& deck) { checkKeywords(deck, ParseContext(), ErrorGuard()); } void checkKeywords(const Deck& deck, const ParseContext& parseContext, ErrorGuard& errorGuard) { // These keywords are supported by opm-parser, but are not supported // by flow. For some of them, only part of the options are supported. // The list is used to output messages only. std::unordered_set unsupported_keywords = { "ACTION", "ACTIONG", "ACTIONR", "ACTIONW", "ACTIONX", "ACTPARAM", "ADSALNOD", "ADDZCORN", "AITSOFF", "ALKADS", "ALKALINE", "ALKROCK", "API", "ALPOLADS", "ALSURFAD", "ALSURFST", "APIGROUP", "AQUCON", "AQUNUM", "BRANPROP", "CARFIN", "COMPDATL", "CONNECTION", "CPR", "DATE", "ENDACTIO", "ENDFIN" "ENDNUM", "ENDSKIP", "ENKSRVD", "ENPTVD", "EQLNUM", "EQUALREG", "EXCEL", "EXTRAPMS", "FLUXTYPE", "FULLIMP", "GCONSALE", "GCONSUMP", "GDORIENT", "GECON", "GLIFTOPT", "GNETINJE", "GPMAINT", "GRIDUNIT", "GRUPNET", "GSATPROD", "GUIDERAT", "IMKRVD", "IMPES", "IMPTVD", "LGR", "LIFTOPT", "MAPUNITS", "MAXVALUE", "MESSAGES", "MINVALUE", "MONITOR", "MSGFILE", "MULT_XYZ", "NETBALAN", "NEXTSTEP", "NOCASC", "NODEPROP", "NOGGF", "NOINSPEC", "NOMONITO", "NONNC", "NORSSPEC", "NOWARN", "NSTACK", "NUMRES", "NUPCOL", "OILVISCT", "OLDTRAN", "OPERATER", "OPTIONS", "PARALLEL", "PBVD", "PCG", "PERMR", "PERMTHT", "PERMXY", "PERMYZ", "PERMZX", "PIMULTAB", "PLYADSS", "PLYDHFLF", "PPCWMAX", "REFINE", "RADFIN4", "RHO", "RKTRMDIR", "ROCKCOMP", "ROCKOPTS", "ROCKTAB", "RPTGRID", "RPTONLY", "RPTONLYO", "RPTPROS", "PRTRST", "RPTRUNSP", "RPTSMRY", "RPTSOL", "RSCONST", "RSCONSTT", "RTEMP", "RTEMPA", "RTEMPVD", "RUNSUM", "SATOPTS", "SAVE", "SEPARATE", "SKIP", "SKIP100", "SKIP300", "SKIPREST", "SPECGRID", "SUMTHIN", "TEMP", "THCONR", "TRACER", "TRACERS", "VAPPARS", "VISCREF", "WARN", "WATVISCT", "WELPI", "WELSPECL", "WGASPROD", "WINJMULT", "WLIMTOL", "WORKTHP", "WPAVE", "WPITAB", "WTEMP", "WTRACER", "ZIPPY2" }; std::multimap > string_options; std::multimap > int_options; addSupported(string_options , "INPUT"); addSupported(string_options, "NODIR"); addSupported(string_options, "REVER"); addSupported(string_options, "GAP"); addSupported(string_options, "TOPBOT"); addSupported(int_options , 0); // check deck and keyword for flow and parser. for (size_t idx = 0; idx < deck.size(); ++idx) { const auto& keyword = deck.getKeyword(idx); std::unordered_set::const_iterator it; it = unsupported_keywords.find(keyword.name()); if (it != unsupported_keywords.end()) { std::string msg = "Keyword '" + keyword.name() + "' is not supported by flow.\n" + "In file " + keyword.getFileName() + ", line " + std::to_string(keyword.getLineNumber()) + "\n"; parseContext.handleError(ParseContext::SIMULATOR_KEYWORD_NOT_SUPPORTED, msg, errorGuard); } checkOptions(keyword, string_options, parseContext, errorGuard); checkOptions(keyword, int_options, parseContext, errorGuard); } } } // namespace MissingFeatures } // namespace Opm