Merge pull request #2063 from joakim-hove/completion-util
Add function bool Well::hasCompletion( int )
This commit is contained in:
commit
78b544afdf
@ -509,6 +509,7 @@ public:
|
|||||||
Status getStatus() const;
|
Status getStatus() const;
|
||||||
const std::string& groupName() const;
|
const std::string& groupName() const;
|
||||||
Phase getPreferredPhase() const;
|
Phase getPreferredPhase() const;
|
||||||
|
|
||||||
const WellConnections& getConnections() const;
|
const WellConnections& getConnections() const;
|
||||||
const WellSegments& getSegments() const;
|
const WellSegments& getSegments() const;
|
||||||
|
|
||||||
@ -546,6 +547,14 @@ public:
|
|||||||
keyword.
|
keyword.
|
||||||
*/
|
*/
|
||||||
std::map<int, std::vector<Connection>> getCompletions() const;
|
std::map<int, std::vector<Connection>> getCompletions() const;
|
||||||
|
/*
|
||||||
|
For hasCompletion(int completion) and getConnections(int completion) the
|
||||||
|
completion argument is an integer ID used to denote a collection of
|
||||||
|
connections. The integer ID is assigned with the COMPLUMP keyword.
|
||||||
|
*/
|
||||||
|
bool hasCompletion(int completion) const;
|
||||||
|
const std::vector<const Connection *> getConnections(int completion) const;
|
||||||
|
|
||||||
|
|
||||||
bool updatePrediction(bool prediction_mode);
|
bool updatePrediction(bool prediction_mode);
|
||||||
bool updateAutoShutin(bool auto_shutin);
|
bool updateAutoShutin(bool auto_shutin);
|
||||||
|
@ -873,6 +873,15 @@ const WellConnections& Well::getConnections() const {
|
|||||||
return *this->connections;
|
return *this->connections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<const Connection *> Well::getConnections(int completion) const {
|
||||||
|
std::vector<const Connection *> connvector;
|
||||||
|
for (const auto& conn : this->getConnections()) {
|
||||||
|
if (conn.complnum() == completion)
|
||||||
|
connvector.push_back( &conn );
|
||||||
|
}
|
||||||
|
return connvector;
|
||||||
|
}
|
||||||
|
|
||||||
const WellFoamProperties& Well::getFoamProperties() const {
|
const WellFoamProperties& Well::getFoamProperties() const {
|
||||||
return *this->foam_properties;
|
return *this->foam_properties;
|
||||||
}
|
}
|
||||||
@ -938,6 +947,16 @@ std::map<int, std::vector<Connection>> Well::getCompletions() const {
|
|||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Well::hasCompletion(int completion) const {
|
||||||
|
for (const auto& conn : *this->connections) {
|
||||||
|
if (conn.complnum() == completion)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Phase Well::getPreferredPhase() const {
|
Phase Well::getPreferredPhase() const {
|
||||||
return this->wtype.preferred_phase();
|
return this->wtype.preferred_phase();
|
||||||
}
|
}
|
||||||
|
@ -2261,6 +2261,26 @@ BOOST_AUTO_TEST_CASE( complump ) {
|
|||||||
else
|
else
|
||||||
BOOST_CHECK_EQUAL(pair.second.size(), 1U);
|
BOOST_CHECK_EQUAL(pair.second.size(), 1U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto& w0 = schedule.getWell("W1", 0);
|
||||||
|
BOOST_CHECK(w0.hasCompletion(1));
|
||||||
|
BOOST_CHECK(!w0.hasCompletion(2));
|
||||||
|
|
||||||
|
const auto& conn0 = w0.getConnections(100);
|
||||||
|
BOOST_CHECK(conn0.empty());
|
||||||
|
|
||||||
|
const auto& conn_all = w0.getConnections();
|
||||||
|
const auto& conn1 = w0.getConnections(1);
|
||||||
|
BOOST_CHECK_EQUAL( conn1.size(), 3);
|
||||||
|
for (const auto& conn : conn_all) {
|
||||||
|
if (conn.complnum() == 1) {
|
||||||
|
auto conn_iter = std::find_if(conn1.begin(), conn1.end(), [&conn](const Connection * cptr)
|
||||||
|
{
|
||||||
|
return *cptr == conn;
|
||||||
|
});
|
||||||
|
BOOST_CHECK( conn_iter != conn1.end() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user