Merge pull request #1104 from GitPaean/fixing_findWellNode

rewriting the findWellNode function
This commit is contained in:
Atgeirr Flø Rasmussen 2016-11-16 15:00:13 +01:00 committed by GitHub
commit 054fa92e61
2 changed files with 7 additions and 6 deletions

View File

@ -117,18 +117,19 @@ namespace Opm
}
WellNode* WellCollection::findWellNode(const std::string& name) const
WellNode& WellCollection::findWellNode(const std::string& name) const
{
auto well_node = std::find_if(leaf_nodes_.begin(), leaf_nodes_.end(),
[&] ( WellNode* w) {
return w->name() == name;
});
if (well_node != leaf_nodes_.end()) {
return *well_node;
} else {
return nullptr;
// Does not find the well
if (well_node == leaf_nodes_.end()) {
OPM_THROW(std::runtime_error, "Could not find well " << name << " in the well collection!\n");
}
return *(*well_node);
}
/// Adds the child to the collection

View File

@ -96,7 +96,7 @@ namespace Opm
const WellsGroupInterface* findNode(const std::string& name) const;
WellNode* findWellNode(const std::string& name) const;
WellNode& findWellNode(const std::string& name) const;
/// Applies all group controls (injection and production)