mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
(#401) WIP: Prototyped total cell visibility calculation and
calculation of overridden cell visibility.
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
#include "RimEclipseWellCollection.h"
|
||||
|
||||
#include "RivGridPartMgr.h"
|
||||
#include "RimViewLink.h"
|
||||
#include "RimViewLinker.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -59,6 +61,8 @@ void RivReservoirViewPartMgr::scheduleGeometryRegen(RivCellSetEnum geometryType)
|
||||
{
|
||||
switch (geometryType)
|
||||
{
|
||||
case OVERRIDDEN_CELL_VISIBILITY:
|
||||
clearGeometryCache(OVERRIDDEN_CELL_VISIBILITY);
|
||||
case INACTIVE:
|
||||
clearGeometryCache(INACTIVE);
|
||||
clearGeometryCache(RANGE_FILTERED_INACTIVE);
|
||||
@@ -184,6 +188,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::clearGeometryCache()
|
||||
{
|
||||
clearGeometryCache(OVERRIDDEN_CELL_VISIBILITY);
|
||||
clearGeometryCache(ACTIVE);
|
||||
clearGeometryCache(ALL_WELL_CELLS);
|
||||
clearGeometryCache(VISIBLE_WELL_CELLS);
|
||||
@@ -268,6 +273,9 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
|
||||
|
||||
switch (geometryType)
|
||||
{
|
||||
case OVERRIDDEN_CELL_VISIBILITY:
|
||||
computeOverriddenCellVisibility(cellVisibility, grid);
|
||||
break;
|
||||
case ACTIVE:
|
||||
computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true, m_reservoirView->showMainGrid() );
|
||||
break;
|
||||
@@ -582,6 +590,67 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid)
|
||||
{
|
||||
|
||||
RimViewLink* masterViewLink = m_reservoirView->controllingViewLink();
|
||||
|
||||
CVF_ASSERT(masterViewLink);
|
||||
|
||||
RimView* masterView = masterViewLink->ownerViewLinker()->mainView();
|
||||
|
||||
#if 0
|
||||
// get cell visibility
|
||||
#if 1
|
||||
cvf::ref<cvf::UByteArray> totCellVisibility = masterView->currentTotalCellVisibility();
|
||||
#else
|
||||
// Could get something more like
|
||||
std::vector<std::vector<cvf::UByteArray*> > gridsWithCellSetVisibility = masterView->getAllGridsCurrentCellSetsCellVisibility();
|
||||
#endif
|
||||
|
||||
CVF_ASSERT(cellVisibility != NULL);
|
||||
CVF_ASSERT(grid != NULL);
|
||||
|
||||
size_t gridCellCount = grid->cellCount();
|
||||
cellVisibility->resize(gridCellCount);
|
||||
cellVisibility->setAll(false);
|
||||
|
||||
RigCaseCellMapper* cellMapper = masterViewLink->cellMapper();
|
||||
|
||||
for (size_t lcIdx = 0; lcIdx < gridCellCount; ++lcIdx)
|
||||
{
|
||||
#if 1
|
||||
size_t reservoirCellIdx = grid->reservoirCellIndex(lcIdx);
|
||||
int cellCount = 0;
|
||||
const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndex(reservoirCellIdx, &cellCount);
|
||||
|
||||
for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx)
|
||||
{
|
||||
(*cellVisibility)[lcIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
const RigGridCells& masterCaseCells = cellMapper->masterCaseGridAndLocalCellIndex(grid->gridIndex, lcIdx);
|
||||
|
||||
for (int mcIdx = 0; mcIdx < masterCaseCells.cellCount(); ++mcIdx)
|
||||
{
|
||||
int cellSetCount = gridsWithCellSetVisibility[ masterCaseCells.gridIndex[mcIdx] ].size();
|
||||
for (int csIdx = 0; csIdx < cellSetCount; ++csIdx)
|
||||
{
|
||||
(*cellVisibility)[lcIdx] |= gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]][masterCaseCells.cellIndex[mcIdx]];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Copy the data from source into destination. This is not trivial to do using cvf::Array ...
|
||||
|
||||
@@ -83,7 +83,10 @@ private:
|
||||
static void computeNativeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses, bool invalidCellsIsVisible, bool inactiveCellsIsVisible, bool activeCellsIsVisible, bool mainGridIsVisible);
|
||||
void computeRangeVisibility (RivCellSetEnum geometryType, cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl);
|
||||
static void computePropertyVisibility(cvf::UByteArray* cellVisibilities, const RigGridBase* grid, size_t timeStepIndex, const cvf::UByteArray* rangeFilterVisibility, RimEclipsePropertyFilterCollection* propFilterColl);
|
||||
static void copyByteArray(cvf::UByteArray* cellVisibilities, const cvf::UByteArray* cellIsWellStatuses );
|
||||
void computeOverriddenCellVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid);
|
||||
|
||||
|
||||
static void copyByteArray(cvf::UByteArray* dest, const cvf::UByteArray* source );
|
||||
|
||||
RivReservoirPartMgr * reservoirPartManager(RivCellSetEnum geometryType, size_t timeStepIndex );
|
||||
|
||||
@@ -99,6 +102,6 @@ private:
|
||||
std::vector<uchar> m_propFilteredWellGeometryFramesNeedsRegen;
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user