mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add method WellContainer<T>::wells()
This commit is contained in:
@@ -157,6 +157,15 @@ public:
|
||||
throw std::logic_error("No such well");
|
||||
}
|
||||
|
||||
std::vector<std::string> wells() const {
|
||||
std::vector<std::string> wlist;
|
||||
for (const auto& [wname, _] : this->index_map) {
|
||||
(void)_;
|
||||
wlist.push_back(wname);
|
||||
}
|
||||
return wlist;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void update_if(std::size_t index, const std::string& name, const WellContainer<T>& other) {
|
||||
|
@@ -73,6 +73,10 @@ public:
|
||||
return this->wells_.size();
|
||||
}
|
||||
|
||||
std::vector<std::string> wells() const {
|
||||
return this->wells_.wells();
|
||||
}
|
||||
|
||||
|
||||
int numWells() const
|
||||
{
|
||||
|
@@ -17,8 +17,10 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <config.h>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#define BOOST_TEST_MODULE WellStateFIBOTest
|
||||
|
||||
@@ -440,6 +442,9 @@ BOOST_AUTO_TEST_CASE(TESTWellContainer) {
|
||||
BOOST_CHECK_EQUAL(wc.well_name(1), "W2");
|
||||
BOOST_CHECK_THROW(wc.well_name(10), std::exception);
|
||||
|
||||
const auto& wells = wc.wells();
|
||||
std::vector<std::string> expected = {"W1", "W2"};
|
||||
BOOST_CHECK( std::is_permutation( wells.begin(), wells.end(), expected.begin(), expected.end()) );
|
||||
|
||||
Opm::WellContainer<int> wc2;
|
||||
wc2.copy_welldata(wc);
|
||||
|
Reference in New Issue
Block a user