2023-07-06 06:04:58 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2023 Equinor
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-07-17 10:24:25 -05:00
|
|
|
#define BOOST_TEST_MODULE LgrTests
|
2023-07-06 06:04:58 -05:00
|
|
|
|
|
|
|
#include <boost/test/unit_test.hpp>
|
2023-07-17 10:24:25 -05:00
|
|
|
#include <boost/test/test_tools.hpp>
|
2023-07-06 06:04:58 -05:00
|
|
|
|
2023-07-17 10:24:25 -05:00
|
|
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
|
|
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
|
|
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
2023-07-06 06:04:58 -05:00
|
|
|
#include <opm/input/eclipse/EclipseState/Grid/LgrCollection.hpp>
|
2023-07-17 10:24:25 -05:00
|
|
|
#include <opm/input/eclipse/EclipseState/Grid/Carfin.hpp>
|
|
|
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
|
|
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
using namespace Opm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
std::string prefix() {
|
|
|
|
return boost::unit_test::framework::master_test_suite().argv[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
Deck makeDeck(const std::string& fileName) {
|
|
|
|
Parser parser;
|
|
|
|
std::filesystem::path boxFile(fileName);
|
|
|
|
return parser.parseFile(boxFile.string());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-07-06 06:04:58 -05:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(CreateLgrCollection) {
|
|
|
|
Opm::LgrCollection lgrs;
|
|
|
|
BOOST_CHECK_EQUAL( lgrs.size() , 0U );
|
|
|
|
BOOST_CHECK(! lgrs.hasLgr("NO-NotThisOne"));
|
|
|
|
BOOST_CHECK_THROW( lgrs.getLgr("NO") , std::invalid_argument );
|
|
|
|
}
|
2023-07-11 04:27:45 -05:00
|
|
|
|
2023-07-17 10:24:25 -05:00
|
|
|
BOOST_AUTO_TEST_CASE(ReadLgrCollection) {
|
|
|
|
auto deck = makeDeck( prefix() + "CARFIN/CARFINTEST1" );
|
|
|
|
Opm::EclipseState state(deck);
|
|
|
|
Opm::LgrCollection lgrs = state.getLgrs();
|
2023-07-11 04:27:45 -05:00
|
|
|
|
|
|
|
BOOST_CHECK_EQUAL( lgrs.size() , 2U );
|
2023-07-17 10:24:25 -05:00
|
|
|
BOOST_CHECK(lgrs.hasLgr("LGR1"));
|
2023-07-11 04:27:45 -05:00
|
|
|
BOOST_CHECK(lgrs.hasLgr("LGR2"));
|
2023-07-17 10:24:25 -05:00
|
|
|
|
|
|
|
const auto& lgr1 = state.getLgrs().getLgr("LGR1");
|
|
|
|
BOOST_CHECK_EQUAL(lgr1.NAME(), "LGR1");
|
|
|
|
const auto& lgr2 = lgrs.getLgr("LGR2");
|
|
|
|
BOOST_CHECK_EQUAL( lgr2.NAME() , "LGR2");
|
2023-07-11 04:27:45 -05:00
|
|
|
}
|