Move wellIsOwned()

This commit is contained in:
Joakim Hove 2021-05-20 10:51:46 +02:00
parent 7695abfe25
commit a891a44756
4 changed files with 25 additions and 22 deletions

View File

@ -114,24 +114,6 @@ WellState::parallelWellInfo(std::size_t well_index) const
return *parallel_well_info_[well_index];
}
bool WellState::wellIsOwned(std::size_t well_index,
[[maybe_unused]] const std::string& wellName) const
{
const auto& well_info = parallelWellInfo(well_index);
assert(well_info.name() == wellName);
return well_info.isOwner();
}
bool WellState::wellIsOwned(const std::string& wellName) const
{
const auto& it = this->wellMap_.find( wellName );
if (it == this->wellMap_.end()) {
OPM_THROW(std::logic_error, "Could not find well " << wellName << " in well map");
}
const int well_index = it->second[0];
return wellIsOwned(well_index, wellName);
}
void WellState::shutWell(int well_index)
{

View File

@ -111,10 +111,6 @@ public:
const ParallelWellInfo& parallelWellInfo(std::size_t well_index) const;
bool wellIsOwned(std::size_t well_index,
const std::string& wellName) const;
bool wellIsOwned(const std::string& wellName) const;
/// The number of phases present.

View File

@ -975,6 +975,25 @@ WellStateFullyImplicitBlackoil::reportSegmentResults(const PhaseUsage& pu,
return seg_res;
}
bool WellStateFullyImplicitBlackoil::wellIsOwned(std::size_t well_index,
[[maybe_unused]] const std::string& wellName) const
{
const auto& well_info = parallelWellInfo(well_index);
assert(well_info.name() == wellName);
return well_info.isOwner();
}
bool WellStateFullyImplicitBlackoil::wellIsOwned(const std::string& wellName) const
{
const auto& it = this->wellMap_.find( wellName );
if (it == this->wellMap_.end()) {
OPM_THROW(std::logic_error, "Could not find well " << wellName << " in well map");
}
const int well_index = it->second[0];
return wellIsOwned(well_index, wellName);
}
int WellStateFullyImplicitBlackoil::numSegments(const int well_id) const
{
const auto topseg = this->topSegmentIndex(well_id);

View File

@ -377,6 +377,11 @@ public:
return this->global_well_info.value().well_name(index);
}
bool wellIsOwned(std::size_t well_index,
const std::string& wellName) const;
bool wellIsOwned(const std::string& wellName) const;
private:
std::vector<double> perfphaserates_;
WellContainer<int> is_producer_; // Size equal to number of local wells.
@ -492,6 +497,7 @@ private:
// overhead) this is simpler than writing code to delete it.
//
void updateWellsDefaultALQ(const std::vector<Well>& wells_ecl);
};
} // namespace Opm