mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
rewriting the findWellNode function
with assuming we should always find the well in the well collection.
This commit is contained in:
parent
9739b2167c
commit
37e1fb0043
@ -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(),
|
auto well_node = std::find_if(leaf_nodes_.begin(), leaf_nodes_.end(),
|
||||||
[&] ( WellNode* w) {
|
[&] ( WellNode* w) {
|
||||||
return w->name() == name;
|
return w->name() == name;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (well_node != leaf_nodes_.end()) {
|
// Does not find the well
|
||||||
return *well_node;
|
if (well_node == leaf_nodes_.end()) {
|
||||||
} else {
|
OPM_THROW(std::runtime_error, "Could not find well " << name << " in the well collection!\n");
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return *(*well_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds the child to the collection
|
/// Adds the child to the collection
|
||||||
|
@ -96,7 +96,7 @@ namespace Opm
|
|||||||
const WellsGroupInterface* findNode(const std::string& name) const;
|
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)
|
/// Applies all group controls (injection and production)
|
||||||
|
Loading…
Reference in New Issue
Block a user