Add WList manager

This commit is contained in:
Joakim Hove
2019-01-14 11:26:47 +01:00
parent eb5454aeaf
commit eae4a080cd
4 changed files with 124 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WList.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/WListManager.hpp>
BOOST_AUTO_TEST_CASE(CreateWLIST) {
Opm::WList wlist;
@@ -57,5 +58,39 @@ BOOST_AUTO_TEST_CASE(CreateWLIST) {
BOOST_CHECK( std::find(wells2.begin(), wells2.end(), "W1") != wells2.end());
BOOST_CHECK( std::find(wells2.begin(), wells2.end(), "W2") != wells2.end());
BOOST_CHECK( std::find(wells2.begin(), wells2.end(), "W3") != wells2.end());
}
BOOST_AUTO_TEST_CASE(WLISTManager) {
Opm::WListManager wlm;
BOOST_CHECK(!wlm.hasList("NO_SUCH_LIST"));
{
auto& wlist1 = wlm.newList("LIST1");
wlist1.add("A");
wlist1.add("B");
wlist1.add("C");
}
// If a new list is added with the same name as an existing list the old
// list is dropped and a new list is created.
{
auto& wlist1 = wlm.newList("LIST1");
BOOST_CHECK_EQUAL(wlist1.size(), 0);
}
auto& wlist1 = wlm.newList("LIST1");
auto& wlist2 = wlm.newList("LIST2");
wlist1.add("W1");
wlist1.add("W2");
wlist1.add("W3");
wlist2.add("W1");
wlist2.add("W2");
wlist2.add("W3");
// The delWell operation will work across all well lists.
wlm.delWell("W1");
BOOST_CHECK( std::find(wlist1.begin(), wlist1.end(), "W1") == wlist1.end());
BOOST_CHECK( std::find(wlist2.begin(), wlist2.end(), "W1") == wlist2.end());
}