Expose 'OrderSegments' Sorting Predicate
In preparation of defining branches for SEG-type RFT file output.
This commit is contained in:
parent
8d24dd9d1e
commit
a592c05766
@ -725,6 +725,54 @@ namespace {
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
class OrderSegments
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit OrderSegments(const ::Opm::WellSegments& wellSegs)
|
||||||
|
: wellSegs_{ std::cref(wellSegs) }
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool operator()(const int i1, const int i2) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::reference_wrapper<const ::Opm::WellSegments> wellSegs_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// i1 < i2 if one of the following relations hold
|
||||||
|
//
|
||||||
|
// 1) i1's branch number is smaller than i2's branch number
|
||||||
|
// 2) i1 and i2 are on the same branch, but i1 is i2's outlet segment
|
||||||
|
// 3) Neither are each other's outlet segments, but i1 is closer to the
|
||||||
|
// well head along the tubing.
|
||||||
|
bool OrderSegments::operator()(const int i1, const int i2) const
|
||||||
|
{
|
||||||
|
const auto& s1 = this->wellSegs_.get()[i1];
|
||||||
|
const auto& s2 = this->wellSegs_.get()[i2];
|
||||||
|
|
||||||
|
const auto b1 = s1.branchNumber();
|
||||||
|
const auto b2 = s2.branchNumber();
|
||||||
|
|
||||||
|
if (b1 != b2) {
|
||||||
|
// i1 not on same branch as i2. Order by branch number.
|
||||||
|
return b1 < b2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s2.outletSegment() == s1.segmentNumber()) {
|
||||||
|
// i1 is i2's outlet
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s1.outletSegment() == s2.segmentNumber()) {
|
||||||
|
// i2 is i1's outlet
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Neither is each other's outlet. Order by distance along tubing.
|
||||||
|
return s1.totalLength() < s2.totalLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
class PLTRecordMSW : public PLTRecord
|
class PLTRecordMSW : public PLTRecord
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -733,19 +781,6 @@ namespace {
|
|||||||
void write(::Opm::EclIO::OutputStream::RFT& rftFile) const override;
|
void write(::Opm::EclIO::OutputStream::RFT& rftFile) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class OrderSegments
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit OrderSegments(const ::Opm::WellSegments& wellSegs)
|
|
||||||
: wellSegs_{ std::cref(wellSegs) }
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool operator()(const int i1, const int i2) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::reference_wrapper<const ::Opm::WellSegments> wellSegs_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class OrderSegConns
|
class OrderSegConns
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -926,41 +961,6 @@ namespace {
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
// i1 < i2 if one of the following relations hold
|
|
||||||
//
|
|
||||||
// 1) i1's branch number is smaller than i2's branch number
|
|
||||||
// 2) i1 and i2 are on the same branch, but i1 is i2's outlet segment
|
|
||||||
// 3) Neither are each other's outlet segments, but i1 is closer to the
|
|
||||||
// well head along the tubing.
|
|
||||||
bool PLTRecordMSW::OrderSegments::operator()(const int i1, const int i2) const
|
|
||||||
{
|
|
||||||
const auto& s1 = this->wellSegs_.get()[i1];
|
|
||||||
const auto& s2 = this->wellSegs_.get()[i2];
|
|
||||||
|
|
||||||
const auto b1 = s1.branchNumber();
|
|
||||||
const auto b2 = s2.branchNumber();
|
|
||||||
|
|
||||||
if (b1 != b2) {
|
|
||||||
// i1 not on same branch as i2. Order by branch number.
|
|
||||||
return b1 < b2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s2.outletSegment() == s1.segmentNumber()) {
|
|
||||||
// i1 is i2's outlet
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s1.outletSegment() == s2.segmentNumber()) {
|
|
||||||
// i2 is i1's outlet
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Neither is each other's outlet. Order by distance along tubing.
|
|
||||||
return s1.totalLength() < s2.totalLength();
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// i1 < i2 if one of the following relations hold
|
// i1 < i2 if one of the following relations hold
|
||||||
//
|
//
|
||||||
// 1) i1's branch number is smaller than i2's branch number
|
// 1) i1's branch number is smaller than i2's branch number
|
||||||
|
Loading…
Reference in New Issue
Block a user