2016-10-11 07:39:15 -05:00
|
|
|
/*
|
|
|
|
Copyright 2016 Statoil ASA.
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define BOOST_TEST_MODULE RegionCache
|
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
|
|
|
|
#include <stdexcept>
|
2020-11-20 02:57:37 -06:00
|
|
|
#include <unordered_set>
|
2016-10-11 07:39:15 -05:00
|
|
|
|
2020-03-26 09:31:21 -05:00
|
|
|
#include <opm/parser/eclipse/Python/Python.hpp>
|
2016-10-11 07:39:15 -05:00
|
|
|
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
|
|
|
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
|
2017-10-02 05:40:28 -05:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
|
2016-10-11 07:39:15 -05:00
|
|
|
#include <opm/output/eclipse/RegionCache.hpp>
|
|
|
|
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
|
|
|
#include <opm/parser/eclipse/Parser/Parser.hpp>
|
|
|
|
|
|
|
|
#include <opm/output/eclipse/RegionCache.hpp>
|
|
|
|
|
|
|
|
using namespace Opm;
|
|
|
|
|
|
|
|
const char* path = "summary_deck.DATA";
|
|
|
|
|
2020-11-20 02:57:37 -06:00
|
|
|
bool cmp_list(const std::vector<std::string>& l1, const std::vector<std::string>& l2) {
|
|
|
|
std::unordered_set<std::string> s1(l1.begin(), l1.end());
|
|
|
|
std::unordered_set<std::string> s2(l2.begin(), l2.end());
|
|
|
|
return s1 == s2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-10-11 07:39:15 -05:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(create) {
|
2020-03-31 03:26:55 -05:00
|
|
|
auto python = std::make_shared<Python>();
|
2016-10-11 07:39:15 -05:00
|
|
|
Parser parser;
|
2019-01-03 11:05:19 -06:00
|
|
|
Deck deck( parser.parseFile( path ));
|
|
|
|
EclipseState es(deck);
|
2016-10-12 04:36:48 -05:00
|
|
|
const EclipseGrid& grid = es.getInputGrid();
|
2020-03-26 09:31:21 -05:00
|
|
|
Schedule schedule( deck, es, python);
|
2020-08-27 00:59:50 -05:00
|
|
|
out::RegionCache rc({"FIPNUM"}, es.fieldProps(), grid, schedule);
|
2016-10-11 07:39:15 -05:00
|
|
|
{
|
2020-08-27 00:59:50 -05:00
|
|
|
const auto& empty = rc.connections( "FIPNUM", 4 );
|
2020-09-29 06:54:21 -05:00
|
|
|
BOOST_CHECK_EQUAL( empty.size() , 0U );
|
2016-10-11 07:39:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2020-08-27 00:59:50 -05:00
|
|
|
const auto& top_layer = rc.connections( "FIPNUM", 1 );
|
2020-11-20 02:57:37 -06:00
|
|
|
BOOST_CHECK_EQUAL( top_layer.size() , 4U );
|
2016-10-11 07:39:15 -05:00
|
|
|
{
|
|
|
|
auto pair = top_layer[0];
|
|
|
|
BOOST_CHECK_EQUAL( pair.first , "W_1");
|
|
|
|
BOOST_CHECK_EQUAL( pair.second , grid.activeIndex( 0,0,0));
|
|
|
|
}
|
|
|
|
}
|
2020-11-20 02:57:37 -06:00
|
|
|
|
|
|
|
BOOST_CHECK( rc.wells("FIPXYZ", 100).empty() );
|
|
|
|
BOOST_CHECK( rc.wells("FIPXYZ", 1).empty() );
|
|
|
|
BOOST_CHECK( rc.wells("FIPNUM", 100).empty() );
|
|
|
|
BOOST_CHECK( cmp_list(rc.wells("FIPNUM", 1), {"W_1", "W_2", "W_3", "W_4"}));
|
|
|
|
BOOST_CHECK( cmp_list(rc.wells("FIPNUM", 11), {"W_6"}));
|
2016-10-11 07:39:15 -05:00
|
|
|
}
|