From b959de1ba0cbd205f21e670239feeb20e182ea86 Mon Sep 17 00:00:00 2001 From: Kjetil Olsen Lye Date: Fri, 30 Mar 2012 10:51:31 +0200 Subject: [PATCH] Some comments --- opm/core/WellCollection.cpp | 8 +++++++- opm/core/WellCollection.hpp | 5 +++++ opm/core/WellsGroup.cpp | 8 ++++++++ opm/core/WellsGroup.hpp | 10 ++++++++++ opm/core/WellsManager.cpp | 6 +++--- opm/core/WellsManager.hpp | 4 +++- 6 files changed, 36 insertions(+), 5 deletions(-) diff --git a/opm/core/WellCollection.cpp b/opm/core/WellCollection.cpp index e2568f551..0ad9d983a 100644 --- a/opm/core/WellCollection.cpp +++ b/opm/core/WellCollection.cpp @@ -63,7 +63,13 @@ namespace Opm } parent_as_group->addChild(child); - + if(child->isLeafNode()) { + leaf_nodes_.push_back(child); + } + } + + const std::vector >& WellCollection::getLeafNodes() const { + return leaf_nodes_; } WellsGroupInterface* WellCollection::findNode(std::string name) diff --git a/opm/core/WellCollection.hpp b/opm/core/WellCollection.hpp index 53ef008ef..a4cd782c6 100644 --- a/opm/core/WellCollection.hpp +++ b/opm/core/WellCollection.hpp @@ -38,9 +38,14 @@ namespace Opm void addChild(std::string child, std::string parent, const EclipseGridParser& deck); + const std::vector >& getLeafNodes() const; private: // To account for the possibility of a forest std::vector > roots_; + + // This will be used to traverse the bottom nodes. + std::vector > leaf_nodes_; + WellsGroupInterface* findNode(std::string name); }; diff --git a/opm/core/WellsGroup.cpp b/opm/core/WellsGroup.cpp index 4b36acf81..b3bf193ad 100644 --- a/opm/core/WellsGroup.cpp +++ b/opm/core/WellsGroup.cpp @@ -31,6 +31,10 @@ namespace Opm : WellsGroupInterface(name, prod_spec, inj_spec) { } + + bool WellsGroupInterface::isLeafNode() const { + return false; + } WellsGroupInterface* WellsGroup::findGroup(std::string name_of_node) { @@ -68,6 +72,10 @@ namespace Opm } } + + bool WellNode::isLeafNode() const { + return true; + } surface_component toSurfaceComponent(std::string type) { diff --git a/opm/core/WellsGroup.hpp b/opm/core/WellsGroup.hpp index 9d5131cea..7a9ad14d5 100644 --- a/opm/core/WellsGroup.hpp +++ b/opm/core/WellsGroup.hpp @@ -17,9 +17,17 @@ namespace Opm InjectionSpecification inj_spec); virtual ~WellsGroupInterface(); + /// The unique identifier for the well or well group. const std::string& name(); + + /// Production specifications for the well or well group. const ProductionSpecification& prodSpec() const; + + /// Injection specifications for the well or well group. const InjectionSpecification& injSpec() const; + + /// \returns true if the object is a leaf node (WellNode), false otherwise. + virtual bool isLeafNode() const; /// \returns the pointer to the WellsGroupInterface with the given name. NULL if /// the name is not found.a @@ -51,6 +59,8 @@ namespace Opm InjectionSpecification inj_spec); virtual WellsGroupInterface* findGroup(std::string name_of_node); + + virtual bool isLeafNode() const; }; diff --git a/opm/core/WellsManager.cpp b/opm/core/WellsManager.cpp index 36bc12b55..c339d22f8 100644 --- a/opm/core/WellsManager.cpp +++ b/opm/core/WellsManager.cpp @@ -505,14 +505,14 @@ namespace Opm } } - WellCollection well_collection; + WellCollection wells_; if (deck.hasField("GRUPTREE")) { std::cout << "Found gruptree" << std::endl; const GRUPTREE& gruptree = deck.getGRUPTREE(); std::map::const_iterator it = gruptree.tree.begin(); for( ; it != gruptree.tree.end(); ++it) { - well_collection.addChild(it->first, it->second, deck); + wells_.addChild(it->first, it->second, deck); } } @@ -520,7 +520,7 @@ namespace Opm WELSPECS welspecs = deck.getWELSPECS(); for(int i = 0; i < welspecs.welspecs.size(); ++i) { WelspecsLine line = welspecs.welspecs[i]; - well_collection.addChild(line.name_, line.group_, deck); + wells_.addChild(line.name_, line.group_, deck); } } diff --git a/opm/core/WellsManager.hpp b/opm/core/WellsManager.hpp index e17eaeb79..36070dd6b 100644 --- a/opm/core/WellsManager.hpp +++ b/opm/core/WellsManager.hpp @@ -19,7 +19,7 @@ #ifndef OPM_WELLSMANAGER_HEADER_INCLUDED #define OPM_WELLSMANAGER_HEADER_INCLUDED - +#include struct Wells; struct UnstructuredGrid; @@ -61,6 +61,8 @@ namespace Opm WellsManager& operator=(const WellsManager& other); // The managed Wells. Wells* w_; + + WellCollection well_collection_; };