diff --git a/opm/core/wells/WellCollection.cpp b/opm/core/wells/WellCollection.cpp index 8be2dd09a..9218db06e 100644 --- a/opm/core/wells/WellCollection.cpp +++ b/opm/core/wells/WellCollection.cpp @@ -90,7 +90,20 @@ namespace Opm parent = roots_[roots_.size() - 1].get(); } - std::shared_ptr child = getAndUnRootChild(child_name); + std::shared_ptr child; + + for (size_t i = 0; i < roots_.size(); ++i) { + if (roots_[i]->name() == child_name) { + child = roots_[i]; + // We've found a new parent to the previously thought root, need to remove it + for(size_t j = i; j < roots_.size() - 1; ++j) { + roots_[j] = roots_[j+1]; + } + + roots_.resize(roots_.size()-1); + break; + } + } if (!child.get()) { child = createWellsGroup(child_name, deck); @@ -110,24 +123,6 @@ namespace Opm } - std::shared_ptr WellCollection::getAndUnRootChild(std::string child_name) { - std::shared_ptr child; - - for (size_t i = 0; i < roots_.size(); ++i) { - if (roots_[i]->name() == child_name) { - child = roots_[i]; - // We've found a new parent to the previously thought root, need to remove it - for(size_t j = i; j < roots_.size() - 1; ++j) { - roots_[j] = roots_[j+1]; - } - - roots_.resize(roots_.size()-1); - break; - } - } - return child; - } - const std::vector& WellCollection::getLeafNodes() const { return leaf_nodes_; } diff --git a/opm/core/wells/WellCollection.hpp b/opm/core/wells/WellCollection.hpp index a0e36562e..f084a04d8 100644 --- a/opm/core/wells/WellCollection.hpp +++ b/opm/core/wells/WellCollection.hpp @@ -125,7 +125,6 @@ namespace Opm const std::vector& well_surfacerates_phase); private: - std::shared_ptr getAndUnRootChild(std::string child_name); // To account for the possibility of a forest std::vector > roots_;