Some comments

This commit is contained in:
Kjetil Olsen Lye 2012-03-30 10:51:31 +02:00
parent abdae7073e
commit b959de1ba0
6 changed files with 36 additions and 5 deletions

View File

@ -63,7 +63,13 @@ namespace Opm
}
parent_as_group->addChild(child);
if(child->isLeafNode()) {
leaf_nodes_.push_back(child);
}
}
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& WellCollection::getLeafNodes() const {
return leaf_nodes_;
}
WellsGroupInterface* WellCollection::findNode(std::string name)

View File

@ -38,9 +38,14 @@ namespace Opm
void addChild(std::string child, std::string parent,
const EclipseGridParser& deck);
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;
private:
// To account for the possibility of a forest
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > roots_;
// This will be used to traverse the bottom nodes.
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > leaf_nodes_;
WellsGroupInterface* findNode(std::string name);
};

View File

@ -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)
{

View File

@ -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;
};

View File

@ -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<std::string, std::string>::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);
}
}

View File

@ -19,7 +19,7 @@
#ifndef OPM_WELLSMANAGER_HEADER_INCLUDED
#define OPM_WELLSMANAGER_HEADER_INCLUDED
#include <opm/core/WellCollection.hpp>
struct Wells;
struct UnstructuredGrid;
@ -61,6 +61,8 @@ namespace Opm
WellsManager& operator=(const WellsManager& other);
// The managed Wells.
Wells* w_;
WellCollection well_collection_;
};