Add method out::Well::find_connection(std::size_t global_index)
This commit is contained in:
parent
a61c48521a
commit
02a5501c0b
@ -210,6 +210,30 @@ namespace Opm {
|
|||||||
template <class MessageBufferType>
|
template <class MessageBufferType>
|
||||||
void read(MessageBufferType& buffer);
|
void read(MessageBufferType& buffer);
|
||||||
|
|
||||||
|
const Connection* find_connection(Connection::global_index connection_grid_index) const {
|
||||||
|
const auto connection = std::find_if( this->connections.begin() ,
|
||||||
|
this->connections.end() ,
|
||||||
|
[=]( const Connection& c ) {
|
||||||
|
return c.index == connection_grid_index; });
|
||||||
|
|
||||||
|
if( connection == this->connections.end() )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return &*connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection* find_connection(Connection::global_index connection_grid_index) {
|
||||||
|
auto connection = std::find_if( this->connections.begin() ,
|
||||||
|
this->connections.end() ,
|
||||||
|
[=]( const Connection& c ) {
|
||||||
|
return c.index == connection_grid_index; });
|
||||||
|
|
||||||
|
if( connection == this->connections.end() )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return &*connection;
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(const Well& well2) const
|
bool operator==(const Well& well2) const
|
||||||
{
|
{
|
||||||
return rates == well2.rates &&
|
return rates == well2.rates &&
|
||||||
|
@ -122,4 +122,10 @@ BOOST_AUTO_TEST_CASE(get_completions) {
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL( 0.0, wellRates.get("OP_2" , 10000 , data::Rates::opt::wat) );
|
BOOST_CHECK_EQUAL( 0.0, wellRates.get("OP_2" , 10000 , data::Rates::opt::wat) );
|
||||||
BOOST_CHECK_EQUAL( 26.41 , wellRates.get( "OP_2" , 188 , data::Rates::opt::wat));
|
BOOST_CHECK_EQUAL( 26.41 , wellRates.get( "OP_2" , 188 , data::Rates::opt::wat));
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_CHECK(w1.find_connection(1234567) == nullptr);
|
||||||
|
const auto& conn = w1.find_connection(88);
|
||||||
|
BOOST_CHECK_EQUAL( 20.41, conn->rates.get(data::Rates::opt::wat));
|
||||||
|
BOOST_CHECK_EQUAL( 22.41, conn->rates.get(data::Rates::opt::gas));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user