mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Range Filter: Added option to not propagate rangefilter onto the subgrids
p4#: 21445
This commit is contained in:
parent
4ca363cde5
commit
b14b138dae
@ -571,10 +571,11 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
|
|||||||
{
|
{
|
||||||
if ( (*nativeVisibility)[cellIndex] )
|
if ( (*nativeVisibility)[cellIndex] )
|
||||||
{
|
{
|
||||||
|
const RigCell& cell = grid->cell(cellIndex);
|
||||||
bool visibleDueToParentGrid = false;
|
bool visibleDueToParentGrid = false;
|
||||||
if (lgr)
|
if (lgr)
|
||||||
{
|
{
|
||||||
size_t parentGridCellIndex = grid->cell(cellIndex).parentCellIndex();
|
size_t parentGridCellIndex = cell.parentCellIndex();
|
||||||
visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex);
|
visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,9 +584,10 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
|
|||||||
size_t mainGridJ;
|
size_t mainGridJ;
|
||||||
size_t mainGridK;
|
size_t mainGridK;
|
||||||
|
|
||||||
|
bool isInSubGridArea = cell.subGrid() != NULL;
|
||||||
grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK);
|
grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK);
|
||||||
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK))
|
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea))
|
||||||
&& !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK);
|
&& !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ RimCellRangeFilter::RimCellRangeFilter()
|
|||||||
CAF_PDM_InitObject("Cell Range Filter", ":/CellFilter_Range.png", "", "");
|
CAF_PDM_InitObject("Cell Range Filter", ":/CellFilter_Range.png", "", "");
|
||||||
|
|
||||||
CAF_PDM_InitField(&gridIndex, "GridIndex", 0, "Grid", "", "","");
|
CAF_PDM_InitField(&gridIndex, "GridIndex", 0, "Grid", "", "","");
|
||||||
|
CAF_PDM_InitField(&propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids", "", "","");
|
||||||
|
|
||||||
CAF_PDM_InitField(&startIndexI, "StartIndexI", 1, "Start index I", "", "","");
|
CAF_PDM_InitField(&startIndexI, "StartIndexI", 1, "Start index I", "", "","");
|
||||||
startIndexI.setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
startIndexI.setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
void setDefaultValues();
|
void setDefaultValues();
|
||||||
|
|
||||||
caf::PdmField<int> gridIndex; // The index of the grid that this filter applies to
|
caf::PdmField<int> gridIndex; // The index of the grid that this filter applies to
|
||||||
|
caf::PdmField<bool> propagateToSubGrids; // Do propagate the effects to the sub-grids
|
||||||
|
|
||||||
caf::PdmField<int> startIndexI; // Eclipse indexing, first index is 1
|
caf::PdmField<int> startIndexI; // Eclipse indexing, first index is 1
|
||||||
caf::PdmField<int> startIndexJ; // Eclipse indexing, first index is 1
|
caf::PdmField<int> startIndexJ; // Eclipse indexing, first index is 1
|
||||||
|
@ -83,7 +83,8 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
|||||||
rangeFilter->startIndexK - 1,
|
rangeFilter->startIndexK - 1,
|
||||||
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
||||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK);
|
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||||
|
rangeFilter->propagateToSubGrids());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -93,7 +94,8 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
|||||||
rangeFilter->startIndexK - 1,
|
rangeFilter->startIndexK - 1,
|
||||||
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
||||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK);
|
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||||
|
rangeFilter->propagateToSubGrids());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,31 +54,31 @@ CellRangeFilter::CellRangeFilter()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void CellRangeFilter::addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK)
|
void CellRangeFilter::addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas)
|
||||||
{
|
{
|
||||||
m_includeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK));
|
m_includeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK, applyToSubGridAreas));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void CellRangeFilter::addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK)
|
void CellRangeFilter::addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas)
|
||||||
{
|
{
|
||||||
m_excludeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK));
|
m_excludeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK, applyToSubGridAreas));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void CellRangeFilter::addCellInclude(size_t i, size_t j, size_t k)
|
void CellRangeFilter::addCellInclude(size_t i, size_t j, size_t k, bool applyToSubGridAreas)
|
||||||
{
|
{
|
||||||
m_includeRanges.push_back(CellRange(i, j, k, i, j, k));
|
m_includeRanges.push_back(CellRange(i, j, k, i, j, k, applyToSubGridAreas));
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool CellRangeFilter::isCellVisible(size_t i, size_t j, size_t k) const
|
bool CellRangeFilter::isCellVisible(size_t i, size_t j, size_t k, bool isInSubGridArea) const
|
||||||
{
|
{
|
||||||
if (m_includeRanges.size() == 0)
|
if (m_includeRanges.size() == 0)
|
||||||
{
|
{
|
||||||
@ -88,7 +88,7 @@ bool CellRangeFilter::isCellVisible(size_t i, size_t j, size_t k) const
|
|||||||
size_t idx;
|
size_t idx;
|
||||||
for (idx = 0; idx < m_excludeRanges.size(); idx++)
|
for (idx = 0; idx < m_excludeRanges.size(); idx++)
|
||||||
{
|
{
|
||||||
if (m_excludeRanges[idx].isInRange(i, j, k))
|
if (m_excludeRanges[idx].isInRange(i, j, k, isInSubGridArea))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ bool CellRangeFilter::isCellVisible(size_t i, size_t j, size_t k) const
|
|||||||
|
|
||||||
for (idx = 0; idx < m_includeRanges.size(); idx++)
|
for (idx = 0; idx < m_includeRanges.size(); idx++)
|
||||||
{
|
{
|
||||||
if (m_includeRanges[idx].isInRange(i, j, k))
|
if (m_includeRanges[idx].isInRange(i, j, k, isInSubGridArea))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -109,11 +109,11 @@ bool CellRangeFilter::isCellVisible(size_t i, size_t j, size_t k) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool CellRangeFilter::isCellExcluded(size_t i, size_t j, size_t k) const
|
bool CellRangeFilter::isCellExcluded(size_t i, size_t j, size_t k, bool isInSubGridArea) const
|
||||||
{
|
{
|
||||||
for (size_t idx = 0; idx < m_excludeRanges.size(); idx++)
|
for (size_t idx = 0; idx < m_excludeRanges.size(); idx++)
|
||||||
{
|
{
|
||||||
if (m_excludeRanges[idx].isInRange(i, j, k))
|
if (m_excludeRanges[idx].isInRange(i, j, k, isInSubGridArea))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -122,47 +122,6 @@ bool CellRangeFilter::isCellExcluded(size_t i, size_t j, size_t k) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
CellRangeFilter::CellStateType CellRangeFilter::cellState(size_t i, size_t j, size_t k) const
|
|
||||||
{
|
|
||||||
if (m_includeRanges.size() == 0 && m_excludeRanges.size() == 0)
|
|
||||||
{
|
|
||||||
return INCLUDED;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t idx;
|
|
||||||
for (idx = 0; idx < m_excludeRanges.size(); idx++)
|
|
||||||
{
|
|
||||||
if (m_excludeRanges[idx].isInRange(i, j, k))
|
|
||||||
{
|
|
||||||
return EXCLUDED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (idx = 0; idx < m_includeRanges.size(); idx++)
|
|
||||||
{
|
|
||||||
if (m_includeRanges[idx].isInRange(i, j, k))
|
|
||||||
{
|
|
||||||
return INCLUDED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NOT_INCLUDED;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
CellRangeFilter::CellStateType CellRangeFilter::combine(CellRangeFilter::CellStateType a, CellRangeFilter::CellStateType b)
|
|
||||||
{
|
|
||||||
if (a == EXCLUDED || b == EXCLUDED) return EXCLUDED;
|
|
||||||
if (a == INCLUDED || b == INCLUDED) return INCLUDED;
|
|
||||||
return NOT_INCLUDED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,26 +38,13 @@ class CellRangeFilter
|
|||||||
public:
|
public:
|
||||||
CellRangeFilter();
|
CellRangeFilter();
|
||||||
|
|
||||||
void addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK);
|
void addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas);
|
||||||
void addCellInclude(size_t i, size_t j, size_t k);
|
void addCellInclude(size_t i, size_t j, size_t k, bool applyToSubGridAreas);
|
||||||
|
|
||||||
void addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK);
|
void addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas);
|
||||||
|
|
||||||
//bool isCellRejected(size_t i, size_t j, size_t k) const;
|
bool isCellVisible(size_t i, size_t j, size_t k, bool isInSubGridArea) const;
|
||||||
|
bool isCellExcluded(size_t i, size_t j, size_t k, bool isInSubGridArea) const;
|
||||||
bool isCellVisible(size_t i, size_t j, size_t k) const;
|
|
||||||
bool isCellExcluded(size_t i, size_t j, size_t k) const;
|
|
||||||
|
|
||||||
|
|
||||||
enum CellStateType
|
|
||||||
{
|
|
||||||
INCLUDED, /// Cell is among the included cells
|
|
||||||
NOT_INCLUDED, /// Cell is not among the included cells
|
|
||||||
EXCLUDED /// Filter actively states that cell is to be hidden
|
|
||||||
};
|
|
||||||
|
|
||||||
CellStateType cellState(size_t i, size_t j, size_t k) const;
|
|
||||||
static CellStateType combine(CellStateType a, CellStateType b) ;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CellRange
|
class CellRange
|
||||||
@ -65,18 +52,21 @@ private:
|
|||||||
public:
|
public:
|
||||||
CellRange()
|
CellRange()
|
||||||
: m_min(cvf::Vec3st::ZERO),
|
: m_min(cvf::Vec3st::ZERO),
|
||||||
m_max(UNDEFINED_SIZE_T, UNDEFINED_SIZE_T, UNDEFINED_SIZE_T)
|
m_max(UNDEFINED_SIZE_T, UNDEFINED_SIZE_T, UNDEFINED_SIZE_T),
|
||||||
|
m_applyToSubGridAreas(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CellRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK)
|
CellRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas)
|
||||||
: m_min(minI, minJ, minK),
|
: m_min(minI, minJ, minK),
|
||||||
m_max(maxI, maxJ, maxK)
|
m_max(maxI, maxJ, maxK),
|
||||||
|
m_applyToSubGridAreas(applyToSubGridAreas)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInRange(size_t i, size_t j, size_t k) const
|
bool isInRange(size_t i, size_t j, size_t k, bool isInSubGridArea) const
|
||||||
{
|
{
|
||||||
|
if (isInSubGridArea && !m_applyToSubGridAreas) return false;
|
||||||
cvf::Vec3st test(i, j, k);
|
cvf::Vec3st test(i, j, k);
|
||||||
|
|
||||||
int idx;
|
int idx;
|
||||||
@ -94,6 +84,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
cvf::Vec3st m_min;
|
cvf::Vec3st m_min;
|
||||||
cvf::Vec3st m_max;
|
cvf::Vec3st m_max;
|
||||||
|
bool m_applyToSubGridAreas;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user