Esempio n. 1
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
{
    RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
    m_geometries[geometryType].clearAndSetReservoir(res, m_reservoirView);
    m_geometries[geometryType].setTransform(m_scaleTransform.p());
    
    std::vector<RigGridBase*> grids;
    res->allGrids(&grids);

    for (size_t i = 0; i < grids.size(); ++i)
    {
        cvf::ref<cvf::UByteArray> cellVisibility = m_geometries[geometryType].cellVisibility(i); 
        computeVisibility(cellVisibility.p(), geometryType, grids[i], i);
        
        m_geometries[geometryType].setCellVisibility(i, cellVisibility.p());
    }

    m_geometriesNeedsRegen[geometryType] = false;
}
Esempio n. 2
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameIndex)
{
    RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();

    if ( frameIndex >= m_propFilteredWellGeometryFrames.size())
    { 
        m_propFilteredWellGeometryFrames.resize(frameIndex + 1);
        m_propFilteredWellGeometryFramesNeedsRegen.resize(frameIndex + 1, true);
    }

    if ( m_propFilteredWellGeometryFrames[frameIndex].isNull())  m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr;

    m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(res, m_reservoirView);
    m_propFilteredWellGeometryFrames[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_propFilteredWellGeometryFrames[frameIndex]->cellVisibility(gIdx); 
        cvf::ref<cvf::UByteArray> rangeVisibility; 
        cvf::ref<cvf::UByteArray> wellCellsOutsideRange; 
        cvf::ref<cvf::UByteArray> wellFenceCells;  

        if (hasActiveRangeFilters && hasVisibleWellCells)
        {
            ensureStaticGeometryPartsCreated(RANGE_FILTERED_WELL_CELLS);
            rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);

            ensureStaticGeometryPartsCreated(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
            wellCellsOutsideRange = m_geometries[VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);

            ensureStaticGeometryPartsCreated(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
            wellFenceCells = m_geometries[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER].cellVisibility(gIdx);

        }
        else if (hasActiveRangeFilters && !hasVisibleWellCells)
        {
            ensureStaticGeometryPartsCreated(RANGE_FILTERED_WELL_CELLS);
            rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);
            wellCellsOutsideRange = rangeVisibility;
            wellFenceCells = rangeVisibility;
        }
        else if (!hasActiveRangeFilters && hasVisibleWellCells)
        {
            ensureStaticGeometryPartsCreated(VISIBLE_WELL_CELLS);
            wellCellsOutsideRange = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gIdx);

            ensureStaticGeometryPartsCreated(VISIBLE_WELL_FENCE_CELLS);
            wellFenceCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gIdx);

            rangeVisibility = wellCellsOutsideRange;
        }
        else if (!hasActiveRangeFilters && !hasVisibleWellCells)
        {
            ensureStaticGeometryPartsCreated(ALL_WELL_CELLS);
            wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility(gIdx);
            wellCellsOutsideRange = wellFenceCells;
            rangeVisibility = wellFenceCells;
        }

        cellVisibility->resize(rangeVisibility->size());

#pragma omp parallel for
        for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
        {
            (*cellVisibility)[cellIdx] =  (*wellFenceCells)[cellIdx] || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideRange)[cellIdx];
        }

        computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection()); 

        m_propFilteredWellGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
    }

    m_propFilteredWellGeometryFramesNeedsRegen[frameIndex] = false;
}