Skip to content

Commit

Permalink
Add functionality to disable filter per dimension for IJK-filter
Browse files Browse the repository at this point in the history
Use min and max = -1 to disable filter (include all cells in dimension)
  • Loading branch information
jorgenherje committed Mar 15, 2024
1 parent 3156953 commit 88ef3a6
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions GrpcInterface/RiaGrpcGridGeometryExtractionService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,43 @@ grpc::Status RiaGrpcGridGeometryExtractionService::applyIJKCellFilterToEclipseVi
const int gridIndex = 0;
RimCellRangeFilter* cellRangeFilter = filtColl->addNewCellRangeFilter( view->eclipseCase(), gridIndex, sliceDirection );

// Eclipse indexing, first index is 1
// Dimension filter is disabled if both min and max is -1 for respective dimension. I.e. all cells for
// respective dimension are included in the filter.
const bool isIDimensionFilterDisabled = filter.imin() == -1 && filter.imax() == -1;
int startIndexI = filter.imin() + 1;
int cellCountI = filter.imax() - filter.imin() + 1;
if ( isIDimensionFilterDisabled )
{
startIndexI = 1;
cellCountI = view->mainGrid()->cellCountI();
}

const bool isJDimensionFilterDisabled = filter.jmin() == -1 && filter.jmax() == -1;
int startIndexJ = filter.jmin() + 1;
int cellCountJ = filter.jmax() - filter.jmin() + 1;
if ( isJDimensionFilterDisabled )
{
startIndexJ = 1;
cellCountJ = view->mainGrid()->cellCountJ();
}

const bool isKDimensionFilterDisabled = filter.kmin() == -1 && filter.kmax() == -1;
int startIndexK = filter.kmin() + 1;
int cellCountK = filter.kmax() - filter.kmin() + 1;
if ( isKDimensionFilterDisabled )
{
startIndexK = 1;
cellCountK = view->mainGrid()->cellCountK();
}

// Apply ijk-filter values to range filter object
cellRangeFilter->startIndexI = filter.imin() + 1; // Eclipse indexing, first index is 1
cellRangeFilter->startIndexJ = filter.jmin() + 1; // Eclipse indexing, first index is 1
cellRangeFilter->startIndexK = filter.kmin() + 1; // Eclipse indexing, first index is 1
cellRangeFilter->cellCountI = filter.imax() - filter.imin() + 1;
cellRangeFilter->cellCountJ = filter.jmax() - filter.jmin() + 1;
cellRangeFilter->cellCountK = filter.kmax() - filter.kmin() + 1;
cellRangeFilter->startIndexI = startIndexI;
cellRangeFilter->startIndexJ = startIndexJ;
cellRangeFilter->startIndexK = startIndexK;
cellRangeFilter->cellCountI = cellCountI;
cellRangeFilter->cellCountJ = cellCountJ;
cellRangeFilter->cellCountK = cellCountK;

return grpc::Status::OK;
}
Expand Down

0 comments on commit 88ef3a6

Please sign in to comment.