Add mutable WellConnections::getFromIJK()

This commit is contained in:
Joakim Hove
2018-06-22 14:04:37 +02:00
parent 08994de897
commit 2cb5f62591
2 changed files with 11 additions and 4 deletions

View File

@@ -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);
};
}

View File

@@ -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 );