added: allowEmpty parameter to Schedule::wellNames
allows bypassing exception if there are no matches.
This commit is contained in:
@@ -645,7 +645,9 @@ namespace Opm
|
||||
|
||||
void prefetch_cell_properties(const ScheduleGrid& grid, const DeckKeyword& keyword);
|
||||
void store_wgnames(const DeckKeyword& keyword);
|
||||
std::vector<std::string> wellNames(const std::string& pattern, const HandlerContext& context);
|
||||
std::vector<std::string> wellNames(const std::string& pattern,
|
||||
const HandlerContext& context,
|
||||
bool allowEmpty = false);
|
||||
std::vector<std::string> wellNames(const std::string& pattern, std::size_t timeStep, const std::vector<std::string>& matching_wells, InputErrorAction error_action, ErrorGuard& errors, const KeywordLocation& location) const;
|
||||
void invalidNamePattern( const std::string& namePattern, const HandlerContext& context) const;
|
||||
static std::string formatDate(std::time_t t);
|
||||
|
||||
@@ -1216,11 +1216,14 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
|
||||
|
||||
|
||||
|
||||
std::vector<std::string> Schedule::wellNames(const std::string& pattern, const HandlerContext& context) {
|
||||
std::vector<std::string> Schedule::wellNames(const std::string& pattern,
|
||||
const HandlerContext& context,
|
||||
bool allowEmpty)
|
||||
{
|
||||
std::vector<std::string> valid_names;
|
||||
const auto& report_step = context.currentStep;
|
||||
auto names = this->wellNames(pattern, report_step, context.matching_wells);
|
||||
if (names.empty()) {
|
||||
if (names.empty() && !allowEmpty) {
|
||||
const auto& location = context.keyword.location();
|
||||
if (this->action_wgnames.has_well(pattern)) {
|
||||
std::string msg = fmt::format(R"(Well: {} not yet defined for keyword {}.
|
||||
|
||||
Reference in New Issue
Block a user