mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add method WellState::name()
This commit is contained in:
@@ -166,6 +166,14 @@ public:
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const std::string& well_name(std::size_t well_index) const {
|
||||
for (const auto& [wname, windex] : this->index_map) {
|
||||
if (windex == well_index)
|
||||
return wname;
|
||||
}
|
||||
throw std::logic_error("No such well");
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void update_if(std::size_t index, const std::string& name, const WellContainer<T>& other) {
|
||||
|
@@ -339,6 +339,10 @@ public:
|
||||
return this->perfdata[well_index];
|
||||
}
|
||||
|
||||
const std::string& name(std::size_t well_index) const {
|
||||
return this->status_.well_name(well_index);
|
||||
}
|
||||
|
||||
private:
|
||||
WellMapType wellMap_;
|
||||
// Use of std::optional<> here is a technical crutch, the
|
||||
|
@@ -432,6 +432,10 @@ BOOST_AUTO_TEST_CASE(TESTWellContainer) {
|
||||
BOOST_CHECK_THROW(wc["INVALID_WELL"], std::exception);
|
||||
BOOST_CHECK_EQUAL(wc["W1"], 1);
|
||||
BOOST_CHECK_EQUAL(wc["W2"], 2);
|
||||
BOOST_CHECK_EQUAL(wc.well_name(0), "W1");
|
||||
BOOST_CHECK_EQUAL(wc.well_name(1), "W2");
|
||||
BOOST_CHECK_THROW(wc.well_name(10), std::exception);
|
||||
|
||||
|
||||
Opm::WellContainer<int> wc2;
|
||||
wc2.copy_welldata(wc);
|
||||
|
Reference in New Issue
Block a user