//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t frameIndex) { RigCaseData* res = m_reservoirView->eclipseCase()->reservoirData(); if ( frameIndex >= m_propFilteredGeometryFrames.size()) { m_propFilteredGeometryFrames.resize(frameIndex + 1); m_propFilteredGeometryFramesNeedsRegen.resize(frameIndex + 1, true); } if ( m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr; m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(res, m_reservoirView); m_propFilteredGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); std::vector<RigGridBase*> grids; res->allGrids(&grids); bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters(); bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells(); for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx) { cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(gIdx); cvf::ref<cvf::UByteArray> rangeVisibility; cvf::ref<cvf::UByteArray> fenceVisibility; cvf::cref<cvf::UByteArray> isWellCell = res->wellCellsInGrid(gIdx); if (hasActiveRangeFilters && hasVisibleWellCells) { if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED); if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER); rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx); fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx); } else if (hasActiveRangeFilters && !hasVisibleWellCells) { if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED); rangeVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx); fenceVisibility = m_geometries[RANGE_FILTERED].cellVisibility(gIdx); } else if (!hasActiveRangeFilters && hasVisibleWellCells) { if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS]) createGeometry(VISIBLE_WELL_FENCE_CELLS); rangeVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gIdx); fenceVisibility = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gIdx); } else if (!hasActiveRangeFilters && !hasVisibleWellCells) { if (m_geometriesNeedsRegen[ACTIVE]) createGeometry(ACTIVE); rangeVisibility = m_geometries[ACTIVE].cellVisibility(gIdx); fenceVisibility = m_geometries[ACTIVE].cellVisibility(gIdx); } cellVisibility->resize(rangeVisibility->size()); #pragma omp parallel for for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) { (*cellVisibility)[cellIdx] = (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx]; } computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection()); m_propFilteredGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p()); } m_propFilteredGeometryFramesNeedsRegen[frameIndex] = false; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, ReservoirGeometryCacheType geometryType, RigGridBase* grid, size_t gridIdx) { RigCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData(); RigActiveCellInfo* activeCellInfo = m_reservoirView->currentActiveCellInfo(); switch (geometryType) { case ACTIVE: computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true, m_reservoirView->showMainGrid() ); break; case ALL_WELL_CELLS: copyByteArray(cellVisibility, eclipseCase->wellCellsInGrid(gridIdx)); break; case VISIBLE_WELL_CELLS: { cvf::ref<cvf::UByteArray> allWellCellsVisibility; if (m_geometriesNeedsRegen[ALL_WELL_CELLS]) createGeometry(ALL_WELL_CELLS); allWellCellsVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility(gridIdx); m_reservoirView->calculateVisibleWellCellsIncFence(cellVisibility, grid); #pragma omp parallel for for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) { (*cellVisibility)[cellIdx] = (*allWellCellsVisibility)[cellIdx] && (*cellVisibility)[cellIdx]; } } break; case VISIBLE_WELL_FENCE_CELLS: { cvf::ref<cvf::UByteArray> allWellCellsVisibility; if (m_geometriesNeedsRegen[ALL_WELL_CELLS]) createGeometry(ALL_WELL_CELLS); allWellCellsVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility(gridIdx); m_reservoirView->calculateVisibleWellCellsIncFence(cellVisibility, grid); #pragma omp parallel for for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) { (*cellVisibility)[cellIdx] = !(*allWellCellsVisibility)[cellIdx] && (*cellVisibility)[cellIdx]; } } break; case INACTIVE: computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), m_reservoirView->showInvalidCells(), true, false, m_reservoirView->showMainGrid()); break; case RANGE_FILTERED: { cvf::ref<cvf::UByteArray> nativeVisibility; if (m_geometriesNeedsRegen[ACTIVE]) createGeometry(ACTIVE); nativeVisibility = m_geometries[ACTIVE].cellVisibility(gridIdx); computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); } break; case RANGE_FILTERED_INACTIVE: { cvf::ref<cvf::UByteArray> nativeVisibility; if (m_geometriesNeedsRegen[INACTIVE]) createGeometry(INACTIVE); nativeVisibility = m_geometries[INACTIVE].cellVisibility(gridIdx); computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); } break; case RANGE_FILTERED_WELL_CELLS: { cvf::ref<cvf::UByteArray> nativeVisibility; if (m_geometriesNeedsRegen[ALL_WELL_CELLS]) createGeometry(ALL_WELL_CELLS); nativeVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility(gridIdx); computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection()); } break; case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER: { cvf::ref<cvf::UByteArray> visibleWellCells; cvf::ref<cvf::UByteArray> rangeFilteredWellCells; if (m_geometriesNeedsRegen[VISIBLE_WELL_CELLS]) createGeometry(VISIBLE_WELL_CELLS); if (m_geometriesNeedsRegen[RANGE_FILTERED_WELL_CELLS]) createGeometry(RANGE_FILTERED_WELL_CELLS); visibleWellCells = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gridIdx); rangeFilteredWellCells = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gridIdx); cellVisibility->resize(visibleWellCells->size()); #pragma omp parallel for for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) { (*cellVisibility)[cellIdx] = (*visibleWellCells)[cellIdx] && !(*rangeFilteredWellCells)[cellIdx]; } } break; case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER: { cvf::ref<cvf::UByteArray> visibleWellCells; cvf::ref<cvf::UByteArray> rangeFilteredWellCells; if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS]) createGeometry(VISIBLE_WELL_FENCE_CELLS); if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED); visibleWellCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gridIdx); rangeFilteredWellCells = m_geometries[RANGE_FILTERED].cellVisibility(gridIdx); cellVisibility->resize(visibleWellCells->size()); #pragma omp parallel for for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx) { (*cellVisibility)[cellIdx] = (*visibleWellCells)[cellIdx] && !(*rangeFilteredWellCells)[cellIdx]; } } break; default: CVF_ASSERT(false); // Call special function for property filtered stuff break; } }