Add method WellSegments::branches()
This commit is contained in:
@@ -20,8 +20,9 @@
|
||||
#ifndef SEGMENTSET_HPP_HEADER_INCLUDED
|
||||
#define SEGMENTSET_HPP_HEADER_INCLUDED
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
|
||||
|
||||
@@ -91,6 +92,7 @@ namespace Opm {
|
||||
double segmentLength(const int segment_number) const;
|
||||
double segmentDepthChange(const int segment_number) const;
|
||||
std::vector<Segment> branchSegments(int branch) const;
|
||||
std::set<int> branches() const;
|
||||
|
||||
// it returns true if there is no error encountered during the update
|
||||
bool updateWSEGSICD(const std::vector<std::pair<int, SpiralICD> >& sicd_pairs);
|
||||
|
||||
@@ -469,6 +469,14 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
std::set<int> WellSegments::branches() const {
|
||||
std::set<int> bset;
|
||||
for (const auto& segment : this->m_segments)
|
||||
bset.insert( segment.branchNumber() );
|
||||
return bset;
|
||||
}
|
||||
|
||||
|
||||
std::vector<Segment> WellSegments::branchSegments(int branch) const {
|
||||
std::vector<Segment> segments;
|
||||
std::unordered_set<int> segment_set;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <set>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
@@ -442,13 +443,16 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MSW_SEGMENT_LENGTH) {
|
||||
Opm::Schedule make_schedule(const std::string& fname) {
|
||||
Opm::Parser parser;
|
||||
Opm::Deck deck = parser.parseFile("MSW.DATA");
|
||||
Opm::Deck deck = parser.parseFile(fname);
|
||||
Opm::EclipseState st(deck);
|
||||
Opm::Schedule sched(deck, st);
|
||||
return Opm::Schedule(deck, st);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MSW_SEGMENT_LENGTH) {
|
||||
const auto& sched = make_schedule("MSW.DATA");
|
||||
const auto& well = sched.getWell("PROD01", 0);
|
||||
const auto& segments = well.getSegments();
|
||||
BOOST_CHECK_CLOSE( segments.segmentLength(1), 2512.50, 1e-5);
|
||||
@@ -463,12 +467,7 @@ BOOST_AUTO_TEST_CASE(MSW_SEGMENT_LENGTH) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MSW_BRANCH_SEGMENTS) {
|
||||
Opm::Parser parser;
|
||||
Opm::Deck deck = parser.parseFile("MSW.DATA");
|
||||
Opm::EclipseState st(deck);
|
||||
Opm::Schedule sched(deck, st);
|
||||
|
||||
|
||||
const auto& sched = make_schedule("MSW.DATA");
|
||||
const auto& well = sched.getWell("PROD01", 0);
|
||||
const auto& segments = well.getSegments();
|
||||
{
|
||||
@@ -499,3 +498,10 @@ BOOST_AUTO_TEST_CASE(MSW_BRANCH_SEGMENTS) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Branches) {
|
||||
const auto& sched = make_schedule("MSW.DATA");
|
||||
const auto& well = sched.getWell("PROD01", 0);
|
||||
const auto& segments = well.getSegments();
|
||||
std::set<int> expected = {1,2,3,4,5};
|
||||
BOOST_CHECK( expected == segments.branches() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user