Add mutable WellConnections::getFromIJK()
This commit is contained in:
@@ -64,6 +64,7 @@ namespace Opm {
|
||||
private:
|
||||
std::vector< Connection > m_connections;
|
||||
size_t findClosestConnection(int oi, int oj, double oz, size_t start_pos);
|
||||
Connection& getFromIJK(const int i, const int j, const int k);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
WellConnections::WellConnections( std::initializer_list< Connection > cs ) {
|
||||
for( auto&& c : cs ) this->add( c );
|
||||
}
|
||||
|
||||
|
||||
WellConnections::WellConnections(const WellConnections& src, const EclipseGrid& grid) {
|
||||
for (const auto& c : src) {
|
||||
@@ -58,6 +54,16 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
Connection& WellConnections::getFromIJK(const int i, const int j, const int k) {
|
||||
for (size_t ic = 0; ic < size(); ++ic) {
|
||||
if (get(ic).sameCoordinate(i, j, k)) {
|
||||
return this->m_connections[ic];
|
||||
}
|
||||
}
|
||||
throw std::runtime_error(" the connection is not found! \n ");
|
||||
}
|
||||
|
||||
|
||||
void WellConnections::add( Connection connection ) {
|
||||
auto same = [&]( const Connection& c ) {
|
||||
return c.sameCoordinate( connection );
|
||||
|
||||
Reference in New Issue
Block a user