-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding 'FullySupportedKeywords' to find easy errors early also in ful…
…ly supported keywords.
- Loading branch information
Showing
8 changed files
with
208 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
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/>. | ||
*/ | ||
|
||
#if HAVE_CONFIG_H | ||
#include "config.h" | ||
#endif // HAVE_CONFIG_H | ||
|
||
#include <opm/simulators/utils/FullySupportedFlowKeywords.hpp> | ||
|
||
using namespace Opm::KeywordValidation; | ||
namespace Opm::FlowKeywordValidation | ||
{ | ||
|
||
template <> | ||
const SupportedKeywords<std::string>& | ||
fullySupported() | ||
{ | ||
static const SupportedKeywords<std::string> fully_supported_keywords_strings = { | ||
{ | ||
"WEFAC", | ||
{ | ||
{3,{true, is_bool_convertible {}, "WEFAC(WELNETWK): String value must be convertible to bool."}}, // USE_WEFAC_IN_NETWORK | ||
}, | ||
}, | ||
{ | ||
"GEFAC", | ||
{ | ||
{3,{true, is_bool_convertible {}, "GEFAC(GRPNETWK): String value must be convertible to bool."}}, // USE_GEFAC_IN_NETWORK | ||
}, | ||
}, | ||
}; | ||
|
||
return fully_supported_keywords_strings; | ||
} | ||
|
||
|
||
|
||
template <> | ||
const SupportedKeywords<int>& | ||
fullySupported() | ||
{ | ||
static const SupportedKeywords<int> fully_supported_keywords_int = { | ||
}; | ||
|
||
return fully_supported_keywords_int; | ||
} | ||
|
||
template <> | ||
const SupportedKeywords<double>& | ||
fullySupported() | ||
{ | ||
static const SupportedKeywords<double> fully_supported_keywords_double = { | ||
{ | ||
"WEFAC", | ||
{ | ||
{2,{true, [](double x) { return x > 0; }, "WEFAC(FACTOR): Well efficiency must be a positive number."}}, // WELL_EFFICIENCY | ||
}, | ||
}, | ||
{ | ||
"GEFAC", | ||
{ | ||
{2,{true, [](double x) { return x > 0; }, "GEFAC(FACTOR): Well efficiency must be a positive number."}}, // WELL_EFFICIENCY | ||
}, | ||
}, | ||
}; | ||
|
||
return fully_supported_keywords_double; | ||
} | ||
|
||
} // namespace Opm::FlowKeywordValidation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
Copyright 2024 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/>. | ||
*/ | ||
|
||
#ifndef OPM_FULLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED | ||
#define OPM_FULLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED | ||
|
||
|
||
#include <opm/simulators/flow/KeywordValidation.hpp> | ||
|
||
#include <string> | ||
|
||
/* | ||
Here keywords are defined that are fully supported by flow, but nevertheless | ||
can benefit from a preliminary high-level non-contextual verification. | ||
The keywords are specified in a mapping with the keyword names as keys, and | ||
values that describe the set of supported items. These are described by a | ||
mapping from the item name to a struct of properties, defined in KeywordValidation.hpp. | ||
This struct has the following fields: | ||
critical (bool) : if this is a critical error. | ||
validator (function wrapper) : A function wrapper object that is used to test values. | ||
message (itemal string): an optional message to add to the error reported by flow. | ||
For convenience there is a small class KeywordValidation::allow_values which | ||
can be initialized with a list of permitted values, and used as a validator. | ||
*/ | ||
|
||
namespace Opm::FlowKeywordValidation | ||
{ | ||
|
||
template <typename T> | ||
const KeywordValidation::SupportedKeywords<T>& fullySupported(); | ||
|
||
} // namespace Opm::FlowKeywordValidation | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.