added possibility to add wells to wellcollection without using deck

This commit is contained in:
Kjetil Olsen Lye 2012-05-14 16:10:37 +02:00
parent d4e530eb3c
commit 90f8a780da
2 changed files with 40 additions and 0 deletions

View File

@ -93,6 +93,36 @@ namespace Opm
return NULL;
}
/// Adds the child to the collection
/// and appends it to parent's children.
/// \param[in] child the child node
/// \param[in] parent name of parent node
void WellCollection::addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node,
const std::string& parent_name)
{
WellsGroupInterface* parent = findNode(parent_name);
if (parent == NULL) {
THROW("Parent with name = " << parent_name << " not found.");
}
ASSERT(!parent->isLeafNode());
static_cast<WellsGroup*>(parent)->addChild(child_node);
if (child_node->isLeafNode()) {
leaf_nodes_.push_back(static_cast<WellNode*>(child_node.get()));
}
}
/// Adds the node to the collection (as a root node)
void WellCollection::addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node)
{
roots_.push_back(child_node);
if (child_node->isLeafNode()) {
leaf_nodes_.push_back(static_cast<WellNode*> (child_node.get()));
}
}
bool WellCollection::conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase)

View File

@ -43,6 +43,16 @@ namespace Opm
const std::string& parent,
const EclipseGridParser& deck);
/// Adds the child to the collection
/// and appends it to parent's children.
/// \param[in] child the child node
/// \param[in] parent name of parent node
void addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node,
const std::string& parent);
/// Adds the node to the collection (as a root node)
void addChild(std::tr1::shared_ptr<WellsGroupInterface>& child_node);
/// Checks if each condition is met, applies well controls where needed
/// (that is, it either changes the active control of violating wells, or shuts
/// down wells). Only one change is applied per invocation. Typical use will be