changed: put partially supported keywords in separate compile unit

avoid triggering full simulator rebuilds when updating
this list
This commit is contained in:
Arne Morten Kvarving 2021-05-12 13:22:09 +02:00
parent 306593af3b
commit ca1a799e95
4 changed files with 78 additions and 38 deletions

View File

@ -37,6 +37,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/linalg/FlexibleSolver3.cpp
opm/simulators/linalg/FlexibleSolver4.cpp
opm/simulators/linalg/setupPropertyTree.cpp
opm/simulators/utils/PartiallySupportedFlowKeywords.cpp
opm/simulators/utils/readDeck.cpp
opm/simulators/utils/UnsupportedFlowKeywords.cpp
opm/simulators/timestepping/TimeStepControl.cpp

View File

@ -0,0 +1,71 @@
/*
Copyright 2021 Equinor.
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 <http://www.gnu.org/licenses/>.
*/
#include <opm/simulators/utils/PartiallySupportedFlowKeywords.hpp>
namespace Opm::FlowKeywordValidation
{
template<>
const KeywordValidation::PartiallySupportedKeywords<std::string>&
partiallySupported()
{
static const KeywordValidation::PartiallySupportedKeywords<std::string> partially_supported_keywords_strings = {
{
"COMPORD",
{
{2, {false, {"INPUT"}, std::nullopt}}, // ORDER_TYPE
},
},
{
"ENDSCALE",
{
{1, {false, {"NODIR"}, std::nullopt}}, // DIRECT
{2, {false, {"REVERS"}, std::nullopt}}, // IRREVERS
},
},
{
"PINCH",
{
{2, {false, {"GAP"}, std::nullopt}}, // GAP
{4, {false, {"TOPBOT"}, std::nullopt}}, // PINCHOUT_OPTION
},
},
};
return partially_supported_keywords_strings;
}
template<>
const KeywordValidation::PartiallySupportedKeywords<int>&
partiallySupported()
{
static const KeywordValidation::PartiallySupportedKeywords<int> partially_supported_keywords_int = {
{
"EHYSTR",
{
{2, {false, {0}, std::nullopt}}, //relative_perm_hyst
},
},
};
return partially_supported_keywords_int;
}
} // namespace Opm::FlowKeywordValidation

View File

@ -21,11 +21,10 @@
#define OPM_PARTIALLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED
#include <map>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/simulators/flow/KeywordValidation.hpp>
#include <string>
/*
Here keywords are defined that are supported by flow, but have items that
are only partially supported.
@ -46,39 +45,8 @@
namespace Opm::FlowKeywordValidation
{
const Opm::KeywordValidation::PartiallySupportedKeywords<std::string> partially_supported_keywords_strings = {
{
"COMPORD",
{
{2, {false, {"INPUT"}, std::nullopt}}, // ORDER_TYPE
},
},
{
"ENDSCALE",
{
{1, {false, {"NODIR"}, std::nullopt}}, // DIRECT
{2, {false, {"REVERS"}, std::nullopt}}, // IRREVERS
},
},
{
"PINCH",
{
{2, {false, {"GAP"}, std::nullopt}}, // GAP
{4, {false, {"TOPBOT"}, std::nullopt}}, // PINCHOUT_OPTION
},
},
};
const Opm::KeywordValidation::PartiallySupportedKeywords<int> partially_supported_keywords_int = {
{
"EHYSTR",
{
{2, {false, {0}, std::nullopt}}, //relative_perm_hyst
},
},
};
template<typename T>
const KeywordValidation::PartiallySupportedKeywords<T>& partiallySupported();
} // namespace Opm::FlowKeywordValidation

View File

@ -206,8 +206,8 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr<Opm::Deck>& d
Opm::KeywordValidation::KeywordValidator keyword_validator(
Opm::FlowKeywordValidation::unsupportedKeywords(),
Opm::FlowKeywordValidation::partially_supported_keywords_strings,
Opm::FlowKeywordValidation::partially_supported_keywords_int);
Opm::FlowKeywordValidation::partiallySupported<std::string>(),
Opm::FlowKeywordValidation::partiallySupported<int>());
keyword_validator.validateDeck(*deck, *parseContext, *errorGuard);
if ( checkDeck )