mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-19 05:53:28 -06:00
Added setWellsPointer, changed the interface of leaf_nodes_ slightly
This commit is contained in:
parent
81cf6e3b32
commit
ea0df38468
@ -57,7 +57,7 @@ namespace Opm
|
||||
parent_as_group->addChild(child);
|
||||
|
||||
if(child->isLeafNode()) {
|
||||
leaf_nodes_.push_back(child);
|
||||
leaf_nodes_.push_back(static_cast<WellNode*>(child.get()));
|
||||
}
|
||||
|
||||
child->setParent(parent);
|
||||
@ -65,7 +65,7 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& WellCollection::getLeafNodes() const {
|
||||
const std::vector<WellNode*>& WellCollection::getLeafNodes() const {
|
||||
return leaf_nodes_;
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ namespace Opm
|
||||
double epsilon) const
|
||||
{
|
||||
for (size_t i = 0; i < leaf_nodes_.size(); i++) {
|
||||
static_cast<WellNode*>(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, result, epsilon);
|
||||
leaf_nodes_[i]->conditionsMet(well_bhp, well_rate, grid, result, epsilon);
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,4 +110,10 @@ namespace Opm
|
||||
roots_[i]->calculateGuideRates();
|
||||
}
|
||||
}
|
||||
|
||||
void WellCollection::setWellsPointer(const Wells* wells) {
|
||||
for(size_t i = 0; i < leaf_nodes_.size(); i++) {
|
||||
leaf_nodes_[i]->setWellsPointer(wells, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,19 +49,22 @@ namespace Opm
|
||||
const UnstructuredGrid& grid,
|
||||
WellControlResult& result,
|
||||
const double epsilon=1e-8) const;
|
||||
/// Adds the well pointer to each leaf node (does not take ownership).
|
||||
void setWellsPointer(const Wells* wells);
|
||||
|
||||
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;
|
||||
const std::vector<WellNode*>& getLeafNodes() const;
|
||||
|
||||
void calculateGuideRates();
|
||||
|
||||
WellsGroupInterface* findNode(std::string name);
|
||||
const WellsGroupInterface* findNode(std::string name) 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_;
|
||||
std::vector<WellNode*> leaf_nodes_;
|
||||
|
||||
|
||||
};
|
||||
|
@ -610,12 +610,7 @@ namespace Opm
|
||||
}
|
||||
|
||||
std::cout << "Made well struct" << std::endl;
|
||||
// \TODO comment this.
|
||||
for (size_t i = 0; i < well_collection_.getLeafNodes().size(); i++) {
|
||||
WellNode* node = static_cast<WellNode*>(well_collection_.getLeafNodes()[i].get());
|
||||
// We know that getLeafNodes() is ordered the same way as they're indexed in w_
|
||||
node->setWellsPointer(w_, i);
|
||||
}
|
||||
well_collection_.setWellsPointer(w_);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user