Merge pull request #3052 from bska/dont-assume-monotonic-wlist-position-on-restart

Don't Assume Increasing WLIST Position In Restart Files
This commit is contained in:
Markus Blatt 2022-06-23 15:25:31 +02:00 committed by GitHub
commit 00ace58e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -380,13 +380,17 @@ void RstState::add_wlist(const std::vector<std::string>& zwls,
const auto& well_name = this->wells[well_index].name;
for (auto wlist_index = 0*this->header.max_wlist; wlist_index < this->header.max_wlist; wlist_index++) {
int well_order = iwls[iwls_offset + wlist_index];
if (well_order != 0) {
const auto& wlist_name = zwls[zwls_offset + wlist_index];
auto& wlist = this->wlists[wlist_name];
wlist.resize( well_order );
wlist[well_order - 1] = well_name;
const auto well_order = iwls[iwls_offset + wlist_index];
if (well_order < 1) {
continue;
}
auto& wlist = this->wlists[zwls[zwls_offset + wlist_index]];
if (wlist.size() < static_cast<std::vector<std::string>::size_type>(well_order)) {
wlist.resize(well_order);
}
wlist[well_order - 1] = well_name;
}
}
}