Skip to content

Commit

Permalink
Check for close cells
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Jan 24, 2025
1 parent 9300fa4 commit 4679471
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ApplicationLibCode/UserInterface/RiuCellSelectionTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,25 @@ RiuEclipseSelectionItem* RiuCellSelectionTool::createSelectionItemFromInput()
source + cvf::Vec3d( 0.0, -distance, 0.0 ),
source + cvf::Vec3d( 0.0, 0.0, -distance ) };

// Check if the point is inside a cell
for ( const auto& p : points )
{
auto candidate = mainGrid->findReservoirCellIndexFromPoint( source );
if ( candidate != cvf::UNDEFINED_SIZE_T ) return candidate;
}

// If the point is not inside a cell, check if it is close to a cell
size_t cellContainingPoint = cvf::UNDEFINED_SIZE_T;

cvf::BoundingBox pointBBox;
pointBBox.add( source );

std::vector<size_t> cellIndices = mainGrid->findIntersectingCells( pointBBox );
if ( !cellIndices.empty() )
{
return cellIndices.front();
}

return cvf::UNDEFINED_SIZE_T;
};

Expand Down

0 comments on commit 4679471

Please sign in to comment.