Skip to content

Commit

Permalink
Merge pull request #4308 from vkip/allow_defaulting_jfunc_tables
Browse files Browse the repository at this point in the history
Allow defaulting tables for keywords SWOF/SGOF,SWFN,SGFN and SLGOF
  • Loading branch information
bska authored Nov 5, 2024
2 parents c82b527 + 447f61b commit 9dcad9a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion opm/input/eclipse/EclipseState/Tables/TableManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,19 +1553,31 @@ std::optional<JFunc> make_jfunc(const Deck& deck) {
return;
}

auto lastComplete = 0 * numTables;
const auto& tableKeyword = deck[keywordName].back();
for (size_t tableIdx = 0; tableIdx < tableKeyword.size(); ++tableIdx) {
const auto& dataItem = tableKeyword.getRecord( tableIdx ).getItem("DATA");
if (dataItem.data_size() > 0) {
try {
std::shared_ptr<TableType> table = std::make_shared<TableType>(dataItem, useJFunc(), tableIdx );
std::shared_ptr<TableType> table = std::make_shared<TableType>( dataItem, useJFunc(), tableIdx );
container.addTable( tableIdx , table );
lastComplete = tableIdx;
} catch (const std::runtime_error& err) {
throw OpmInputError(err, tableKeyword.location());
} catch (const std::invalid_argument& err) {
throw OpmInputError(err, tableKeyword.location());
}
}
else if (tableIdx > static_cast<size_t>(0)) {
const auto& item = tableKeyword.getRecord(lastComplete).getItem("DATA");
container.addTable(tableIdx, std::make_shared<TableType>(item, useJFunc(), tableIdx));
}
else {
throw OpmInputError {
fmt::format("Cannot default region {}'s table data", tableIdx + 1),
tableKeyword.location()
};
}
}
}

Expand Down

0 comments on commit 9dcad9a

Please sign in to comment.