From 94f679ec2ccf05c5a1c13ff31ef83bbe13941334 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Tue, 1 Oct 2019 13:51:30 +0200 Subject: [PATCH] Remove functions to filter connections --- .../EclipseState/Schedule/Schedule.hpp | 1 - .../EclipseState/Schedule/Well/Well2.hpp | 1 - .../Schedule/Well/WellConnections.hpp | 1 - .../EclipseState/Schedule/Schedule.cpp | 26 ----------------- .../EclipseState/Schedule/Well/Well2.cpp | 5 ---- .../Schedule/Well/WellConnections.cpp | 8 ----- tests/parser/ScheduleTests.cpp | 29 ------------------- 7 files changed, 71 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 4a4f2434faa..71b3004b138 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -212,7 +212,6 @@ namespace Opm Will remove all completions which are connected to cell which is not active. Will scan through all wells and all timesteps. */ - void filterConnections(const EclipseGrid& grid); size_t size() const; void applyAction(size_t reportStep, const Action::ActionX& action, const Action::Result& result); diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp index 73ae8926e3e..ff7a3f0e847 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp @@ -429,7 +429,6 @@ class Well2 { bool handleCOMPLUMP(const DeckRecord& record); bool handleWPIMULT(const DeckRecord& record); - void filterConnections(const EclipseGrid& grid); void switchToInjector(); void switchToProducer(); ProductionControls productionControls(const SummaryState& st) const; diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp index 17edd8c05d8..9319448d903 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp @@ -61,7 +61,6 @@ namespace Opm { const_iterator begin() const { return this->m_connections.begin(); } const_iterator end() const { return this->m_connections.end(); } - void filter(const EclipseGrid& grid); bool allConnectionsShut() const; /// Order connections irrespective of input order. /// The algorithm used is the following: diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index ac8c42ff876..2b10c9be72c 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -2483,32 +2483,6 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c } - void Schedule::filterConnections(const EclipseGrid& grid) { - for (auto& dynamic_pair : this->wells_static) { - auto& dynamic_state = dynamic_pair.second; - for (auto& well_pair : dynamic_state.unique()) { - if (well_pair.second) - well_pair.second->filterConnections(grid); - } - } - - for (auto& dynamic_pair : this->wells_static) { - auto& dynamic_state = dynamic_pair.second; - for (auto& well_pair : dynamic_state.unique()) { - if (well_pair.second) - well_pair.second->filterConnections(grid); - } - } - - for (auto& dynamic_pair : this->wells_static) { - auto& dynamic_state = dynamic_pair.second; - for (auto& well_pair : dynamic_state.unique()) { - if (well_pair.second) - well_pair.second->filterConnections(grid); - } - } - } - const VFPProdTable& Schedule::getVFPProdTable(int table_id, size_t timeStep) const { const auto pair = vfpprod_tables.find(table_id); if (pair == vfpprod_tables.end()) diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp index 3a45afbf3ea..274b75113c5 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well2.cpp @@ -621,11 +621,6 @@ bool Well2::handleWELSEGS(const DeckKeyword& keyword) { return false; } -void Well2::filterConnections(const EclipseGrid& grid) { - this->connections->filter(grid); -} - - std::size_t Well2::firstTimeStep() const { return this->init_step; } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp index e94ad5120e4..4ffee39823c 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.cpp @@ -465,12 +465,4 @@ inline std::array< size_t, 3> directionIndices(const Opm::Connection::Direction return !( *this == rhs ); } - - void WellConnections::filter(const EclipseGrid& grid) { - auto new_end = std::remove_if(m_connections.begin(), - m_connections.end(), - [&grid](const Connection& c) { return !grid.cellActive(c.getI(), c.getJ(), c.getK()); }); - this->num_removed += std::distance(new_end, m_connections.end()); - m_connections.erase(new_end, m_connections.end()); - } } diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 0418d9e058e..6ac19c1d058 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -2924,35 +2924,6 @@ BOOST_AUTO_TEST_CASE(historic_BHP_and_THP) { } } -BOOST_AUTO_TEST_CASE(FilterCompletions2) { - EclipseGrid grid1(10,10,10); - std::vector actnum(1000,1); - auto deck = createDeckWithWellsAndCompletionData(); - TableManager table ( deck ); - Eclipse3DProperties eclipseProperties ( deck , table, grid1); - Runspec runspec (deck); - Schedule schedule(deck, grid1 , eclipseProperties, runspec); - { - const auto& c1_1 = schedule.getWell2("OP_1", 1).getConnections(); - const auto& c1_3 = schedule.getWell2("OP_1", 3).getConnections(); - BOOST_CHECK_EQUAL(2, c1_1.size()); - BOOST_CHECK_EQUAL(9, c1_3.size()); - } - actnum[grid1.getGlobalIndex(8,8,1)] = 0; - { - EclipseGrid grid2(grid1, actnum); - schedule.filterConnections(grid2); - - const auto& c1_1 = schedule.getWell2("OP_1", 1).getConnections(); - const auto& c1_3 = schedule.getWell2("OP_1", 3).getConnections(); - BOOST_CHECK_EQUAL(1, c1_1.size()); - BOOST_CHECK_EQUAL(8, c1_3.size()); - - BOOST_CHECK_EQUAL(2, c1_1.inputSize()); - BOOST_CHECK_EQUAL(9, c1_3.inputSize()); - } -} -