Whitespace

This commit is contained in:
Magne Sjaastad
2019-02-18 11:15:34 +01:00
parent 7fe0b92839
commit 3acd426ead
3 changed files with 629 additions and 580 deletions

View File

@@ -22,9 +22,9 @@
#include "RigActiveCellInfo.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigCaseToCaseCellMapper.h"
#include "RigCell.h"
#include "RigEclipseCaseData.h"
#include "RigGridBase.h"
#include "RigResultAccessorFactory.h"
@@ -51,14 +51,13 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirViewPartMgr::RivReservoirViewPartMgr(RimEclipseView * resv) :
m_reservoirView(resv)
RivReservoirViewPartMgr::RivReservoirViewPartMgr(RimEclipseView* resv)
: m_reservoirView(resv)
{
m_scaleTransform = new cvf::Transform();
clearGeometryCache();
}
//--------------------------------------------------------------------------------------------------
/// Clears the geometry cache for the given, and the dependent geometryTypes (from a visibility standpoint)
//--------------------------------------------------------------------------------------------------
@@ -66,82 +65,82 @@ void RivReservoirViewPartMgr::scheduleGeometryRegen(RivCellSetEnum geometryType)
{
switch (geometryType)
{
case OVERRIDDEN_CELL_VISIBILITY:
clearGeometryCache(OVERRIDDEN_CELL_VISIBILITY);
case INACTIVE:
clearGeometryCache(INACTIVE);
clearGeometryCache(RANGE_FILTERED_INACTIVE);
break;
case RANGE_FILTERED_INACTIVE:
clearGeometryCache(RANGE_FILTERED_INACTIVE);
break;
case ACTIVE:
clearGeometryCache(ACTIVE);
clearGeometryCache(ALL_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case ALL_WELL_CELLS:
clearGeometryCache(ALL_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_CELLS:
clearGeometryCache(VISIBLE_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_FENCE_CELLS:
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case RANGE_FILTERED:
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(RANGE_FILTERED_INACTIVE);
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case RANGE_FILTERED_WELL_CELLS:
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case PROPERTY_FILTERED:
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case PROPERTY_FILTERED_WELL_CELLS:
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case OVERRIDDEN_CELL_VISIBILITY:
clearGeometryCache(OVERRIDDEN_CELL_VISIBILITY);
case INACTIVE:
clearGeometryCache(INACTIVE);
clearGeometryCache(RANGE_FILTERED_INACTIVE);
break;
case RANGE_FILTERED_INACTIVE:
clearGeometryCache(RANGE_FILTERED_INACTIVE);
break;
case ACTIVE:
clearGeometryCache(ACTIVE);
clearGeometryCache(ALL_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case ALL_WELL_CELLS:
clearGeometryCache(ALL_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_CELLS:
clearGeometryCache(VISIBLE_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_FENCE_CELLS:
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case RANGE_FILTERED:
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(RANGE_FILTERED_INACTIVE);
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case RANGE_FILTERED_WELL_CELLS:
clearGeometryCache(RANGE_FILTERED_WELL_CELLS);
clearGeometryCache(RANGE_FILTERED);
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
clearGeometryCache(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
clearGeometryCache(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case PROPERTY_FILTERED:
clearGeometryCache(PROPERTY_FILTERED);
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
case PROPERTY_FILTERED_WELL_CELLS:
clearGeometryCache(PROPERTY_FILTERED_WELL_CELLS);
break;
}
}
@@ -212,8 +211,9 @@ void RivReservoirViewPartMgr::clearGeometryCache()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType,
const std::vector<size_t>& gridIndices)
void RivReservoirViewPartMgr::appendStaticGeometryPartsToModel(cvf::ModelBasicList* model,
RivCellSetEnum geometryType,
const std::vector<size_t>& gridIndices)
{
ensureStaticGeometryPartsCreated(geometryType);
@@ -227,15 +227,17 @@ void RivReservoirViewPartMgr::ensureStaticGeometryPartsCreated(RivCellSetEnum ge
{
if (geometryType < PROPERTY_FILTERED && m_geometriesNeedsRegen[geometryType])
{
createGeometry( geometryType);
createGeometry(geometryType);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType,
size_t frameIndex, const std::vector<size_t>& gridIndices)
void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
RivCellSetEnum geometryType,
size_t frameIndex,
const std::vector<size_t>& gridIndices)
{
ensureDynamicGeometryPartsCreated(geometryType, frameIndex);
@@ -263,7 +265,8 @@ void RivReservoirViewPartMgr::ensureDynamicGeometryPartsCreated(RivCellSetEnum g
}
else if (geometryType == PROPERTY_FILTERED_WELL_CELLS)
{
if (frameIndex >= m_propFilteredWellGeometryFramesNeedsRegen.size() || m_propFilteredWellGeometryFramesNeedsRegen[frameIndex])
if (frameIndex >= m_propFilteredWellGeometryFramesNeedsRegen.size() ||
m_propFilteredWellGeometryFramesNeedsRegen[frameIndex])
{
createPropertyFilteredWellGeometry(frameIndex);
}
@@ -297,23 +300,27 @@ void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, RivCellSetEnum geometryType, RigGridBase* grid, size_t gridIdx)
void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
RivCellSetEnum geometryType,
RigGridBase* grid,
size_t gridIdx)
{
RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
auto activeCellInfo = m_reservoirView->currentActiveCellInfo();
RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
auto activeCellInfo = m_reservoirView->currentActiveCellInfo();
switch (geometryType)
{
case OVERRIDDEN_CELL_VISIBILITY:
computeOverriddenCellVisibility(cellVisibility, grid);
break;
case ACTIVE:
computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true);
break;
case ALL_WELL_CELLS:
copyByteArray(cellVisibility, eclipseCase->wellCellsInGrid(gridIdx));
break;
case VISIBLE_WELL_CELLS:
case OVERRIDDEN_CELL_VISIBILITY:
computeOverriddenCellVisibility(cellVisibility, grid);
break;
case ACTIVE:
computeNativeVisibility(
cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), false, false, true);
break;
case ALL_WELL_CELLS:
copyByteArray(cellVisibility, eclipseCase->wellCellsInGrid(gridIdx));
break;
case VISIBLE_WELL_CELLS:
{
cvf::ref<cvf::UByteArray> allWellCellsVisibility;
ensureStaticGeometryPartsCreated(ALL_WELL_CELLS);
@@ -329,7 +336,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
}
}
break;
case VISIBLE_WELL_FENCE_CELLS:
case VISIBLE_WELL_FENCE_CELLS:
{
cvf::ref<cvf::UByteArray> allWellCellsVisibility;
ensureStaticGeometryPartsCreated(ALL_WELL_CELLS);
@@ -345,37 +352,46 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
}
}
break;
case INACTIVE:
computeNativeVisibility(cellVisibility, grid, activeCellInfo, eclipseCase->wellCellsInGrid(gridIdx), m_reservoirView->showInvalidCells(), true, false);
break;
case RANGE_FILTERED:
case INACTIVE:
computeNativeVisibility(cellVisibility,
grid,
activeCellInfo,
eclipseCase->wellCellsInGrid(gridIdx),
m_reservoirView->showInvalidCells(),
true,
false);
break;
case RANGE_FILTERED:
{
cvf::ref<cvf::UByteArray> nativeVisibility;
ensureStaticGeometryPartsCreated(ACTIVE);
nativeVisibility = m_geometries[ACTIVE].cellVisibility(gridIdx);
computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
computeRangeVisibility(
geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
}
break;
case RANGE_FILTERED_INACTIVE:
case RANGE_FILTERED_INACTIVE:
{
cvf::ref<cvf::UByteArray> nativeVisibility;
ensureStaticGeometryPartsCreated(INACTIVE);
nativeVisibility = m_geometries[INACTIVE].cellVisibility(gridIdx);
computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
computeRangeVisibility(
geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
}
break;
case RANGE_FILTERED_WELL_CELLS:
case RANGE_FILTERED_WELL_CELLS:
{
cvf::ref<cvf::UByteArray> nativeVisibility;
ensureStaticGeometryPartsCreated(ALL_WELL_CELLS);
nativeVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility(gridIdx);
computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
computeRangeVisibility(
geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
}
break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
{
cvf::ref<cvf::UByteArray> visibleWellCells;
cvf::ref<cvf::UByteArray> rangeFilteredWellCells;
@@ -383,7 +399,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
ensureStaticGeometryPartsCreated(VISIBLE_WELL_CELLS);
ensureStaticGeometryPartsCreated(RANGE_FILTERED_WELL_CELLS);
visibleWellCells = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gridIdx);
visibleWellCells = m_geometries[VISIBLE_WELL_CELLS].cellVisibility(gridIdx);
rangeFilteredWellCells = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gridIdx);
cellVisibility->resize(visibleWellCells->size());
@@ -395,7 +411,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
}
}
break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
{
cvf::ref<cvf::UByteArray> visibleWellCells;
cvf::ref<cvf::UByteArray> rangeFilteredWellCells;
@@ -403,7 +419,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
ensureStaticGeometryPartsCreated(VISIBLE_WELL_FENCE_CELLS);
ensureStaticGeometryPartsCreated(RANGE_FILTERED);
visibleWellCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gridIdx);
visibleWellCells = m_geometries[VISIBLE_WELL_FENCE_CELLS].cellVisibility(gridIdx);
rangeFilteredWellCells = m_geometries[RANGE_FILTERED].cellVisibility(gridIdx);
cellVisibility->resize(visibleWellCells->size());
@@ -415,9 +431,9 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
}
}
break;
default:
CVF_ASSERT(false); // Call special function for property filtered stuff
break;
default:
CVF_ASSERT(false); // Call special function for property filtered stuff
break;
}
}
@@ -428,22 +444,23 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
{
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
if ( frameIndex >= m_propFilteredGeometryFrames.size())
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;
if (m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr;
m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(PROPERTY_FILTERED, m_reservoirView->eclipseCase(), m_reservoirView);
m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(
PROPERTY_FILTERED, m_reservoirView->eclipseCase(), 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();
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
{
@@ -489,7 +506,8 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
(*cellVisibility)[cellIdx] = (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
}
computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection());
computePropertyVisibility(
cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection());
m_propFilteredGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
}
@@ -504,22 +522,24 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
{
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
if ( frameIndex >= m_propFilteredWellGeometryFrames.size())
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;
if (m_propFilteredWellGeometryFrames[frameIndex].isNull())
m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr;
m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(PROPERTY_FILTERED_WELL_CELLS, m_reservoirView->eclipseCase(), m_reservoirView);
m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(
PROPERTY_FILTERED_WELL_CELLS, m_reservoirView->eclipseCase(), 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();
bool hasVisibleWellCells = m_reservoirView->wellCollection()->hasVisibleWellCells();
for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
{
@@ -538,14 +558,13 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
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);
rangeVisibility = m_geometries[RANGE_FILTERED_WELL_CELLS].cellVisibility(gIdx);
wellCellsOutsideRange = rangeVisibility;
wellFenceCells = rangeVisibility;
wellFenceCells = rangeVisibility;
}
else if (!hasActiveRangeFilters && hasVisibleWellCells)
{
@@ -560,9 +579,9 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
else if (!hasActiveRangeFilters && !hasVisibleWellCells)
{
ensureStaticGeometryPartsCreated(ALL_WELL_CELLS);
wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility(gIdx);
wellFenceCells = m_geometries[ALL_WELL_CELLS].cellVisibility(gIdx);
wellCellsOutsideRange = wellFenceCells;
rangeVisibility = wellFenceCells;
rangeVisibility = wellFenceCells;
}
cellVisibility->resize(rangeVisibility->size());
@@ -570,10 +589,12 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
#pragma omp parallel for
for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
{
(*cellVisibility)[cellIdx] = (*wellFenceCells)[cellIdx] || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideRange)[cellIdx];
(*cellVisibility)[cellIdx] =
(*wellFenceCells)[cellIdx] || (*rangeVisibility)[cellIdx] || (*wellCellsOutsideRange)[cellIdx];
}
computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection());
computePropertyVisibility(
cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->eclipsePropertyFilterCollection());
m_propFilteredWellGeometryFrames[frameIndex]->setCellVisibility(gIdx, cellVisibility.p());
}
@@ -584,10 +605,13 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
//--------------------------------------------------------------------------------------------------
/// Evaluate visibility based on cell state
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses,
bool invalidCellsIsVisible,
bool inactiveCellsIsVisible,
bool activeCellsIsVisible)
void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisibility,
const RigGridBase* grid,
const RigActiveCellInfo* activeCellInfo,
const cvf::UByteArray* cellIsInWellStatuses,
bool invalidCellsIsVisible,
bool inactiveCellsIsVisible,
bool activeCellsIsVisible)
{
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(grid != nullptr);
@@ -600,14 +624,12 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
#pragma omp parallel for
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++)
{
const RigCell& cell = grid->cell(cellIndex);
size_t reservoirCellIndex = cell.mainGridCellIndex();
const RigCell& cell = grid->cell(cellIndex);
size_t reservoirCellIndex = cell.mainGridCellIndex();
if ( !invalidCellsIsVisible && cell.isInvalid()
|| !inactiveCellsIsVisible && !activeCellInfo->isActive(reservoirCellIndex)
|| !activeCellsIsVisible && activeCellInfo->isActive(reservoirCellIndex)
|| (*cellIsInWellStatuses)[cellIndex]
)
if (!invalidCellsIsVisible && cell.isInvalid() ||
!inactiveCellsIsVisible && !activeCellInfo->isActive(reservoirCellIndex) ||
!activeCellsIsVisible && activeCellInfo->isActive(reservoirCellIndex) || (*cellIsInWellStatuses)[cellIndex])
{
(*cellVisibility)[cellIndex] = false;
}
@@ -623,20 +645,20 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid)
{
RimViewController* masterViewLink = m_reservoirView->viewController();
CVF_ASSERT(masterViewLink);
RimGridView* masterView = masterViewLink->ownerViewLinker()->masterView();
// get cell visibility
#if 1
cvf::ref<cvf::UByteArray> totCellVisibility = masterView->currentTotalCellVisibility();
#else
// 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
std::vector<std::vector<cvf::UByteArray*>> gridsWithCellSetVisibility =
masterView->getAllGridsCurrentCellSetsCellVisibility();
#endif
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(grid != nullptr);
@@ -649,40 +671,38 @@ void RivReservoirViewPartMgr::computeOverriddenCellVisibility(cvf::UByteArray* c
for (size_t lcIdx = 0; lcIdx < gridCellCount; ++lcIdx)
{
#if 1
int reservoirCellIdx = static_cast<int>(grid->reservoirCellIndex(lcIdx));
int cellCount = 0;
#if 1
int reservoirCellIdx = static_cast<int>(grid->reservoirCellIndex(lcIdx));
int cellCount = 0;
const int* cellIndicesInMasterCase = cellMapper->masterCaseCellIndices(reservoirCellIdx, &cellCount);
for (int mcIdx = 0; mcIdx < cellCount; ++mcIdx)
{
(*cellVisibility)[lcIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show
(*cellVisibility)[lcIdx] |= (*totCellVisibility)[cellIndicesInMasterCase[mcIdx]]; // If any is visible, show
}
#else
#else
const RigGridCells& masterCaseCells = cellMapper->masterCaseGridAndLocalCellIndex(grid->gridIndex, lcIdx);
for (int mcIdx = 0; mcIdx < masterCaseCells.cellCount(); ++mcIdx)
{
int cellSetCount = gridsWithCellSetVisibility[ masterCaseCells.gridIndex[mcIdx] ].size();
int cellSetCount = gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]].size();
for (int csIdx = 0; csIdx < cellSetCount; ++csIdx)
{
(*cellVisibility)[lcIdx] |= gridsWithCellSetVisibility[masterCaseCells.gridIndex[mcIdx]][masterCaseCells.cellIndex[mcIdx]];
(*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 ...
/// using parallelized operator [] and not memcopy. Do not know what is faster.
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const cvf::UByteArray* source )
void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const cvf::UByteArray* source)
{
CVF_ASSERT(destination != nullptr);
CVF_ASSERT(source != nullptr);
@@ -699,14 +719,13 @@ void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType,
cvf::UByteArray* cellVisibility,
const RigGridBase* grid,
const cvf::UByteArray* nativeVisibility,
void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType,
cvf::UByteArray* cellVisibility,
const RigGridBase* grid,
const cvf::UByteArray* nativeVisibility,
const RimCellRangeFilterCollection* rangeFilterColl)
{
CVF_ASSERT(cellVisibility != nullptr);
@@ -725,7 +744,7 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
cvf::CellRangeFilter gridCellRangeFilter;
rangeFilterColl->compoundCellRangeFilter(&gridCellRangeFilter, grid->gridIndex());
const RigLocalGrid* lgr = nullptr;
const RigLocalGrid* lgr = nullptr;
cvf::ref<cvf::UByteArray> parentGridVisibilities;
if (!grid->isMainGrid())
@@ -737,7 +756,8 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
if (geometryType == RANGE_FILTERED_WELL_CELLS)
{
geometryType = RANGE_FILTERED; // Use the range filtering in the parent grid, not the well cells in the parent grid
geometryType =
RANGE_FILTERED; // Use the range filtering in the parent grid, not the well cells in the parent grid
}
RivReservoirPartMgr* reservoirGridPartMgr = &m_geometries[geometryType];
@@ -745,19 +765,20 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
parentGridVisibilities = reservoirGridPartMgr->cellVisibility(parentGridIndex);
}
bool hasAdditiveRangeFilters = rangeFilterColl->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
bool hasAdditiveRangeFilters =
rangeFilterColl->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
#pragma omp parallel for
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++)
{
if ( (*nativeVisibility)[cellIndex] )
if ((*nativeVisibility)[cellIndex])
{
const RigCell& cell = grid->cell(cellIndex);
bool visibleDueToParentGrid = false;
const RigCell& cell = grid->cell(cellIndex);
bool visibleDueToParentGrid = false;
if (lgr)
{
size_t parentGridCellIndex = cell.parentCellIndex();
visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex);
visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex);
}
// Normal grid visibility
@@ -780,8 +801,9 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
nativeRangeVisibility = (*nativeVisibility)[cellIndex];
}
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || nativeRangeVisibility)
&& !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
(*cellVisibility)[cellIndex] =
(visibleDueToParentGrid || nativeRangeVisibility) &&
!gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
}
}
}
@@ -790,8 +812,11 @@ void RivReservoirViewPartMgr::computeRangeVisibility(RivCellSetEnum geometryType
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid, size_t timeStepIndex,
const cvf::UByteArray* rangeFilterVisibility, RimEclipsePropertyFilterCollection* propFilterColl)
void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVisibility,
const RigGridBase* grid,
size_t timeStepIndex,
const cvf::UByteArray* rangeFilterVisibility,
RimEclipsePropertyFilterCollection* propFilterColl)
{
CVF_ASSERT(cellVisibility != nullptr);
CVF_ASSERT(rangeFilterVisibility != nullptr);
@@ -801,7 +826,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
CVF_ASSERT(rangeFilterVisibility->size() == grid->cellCount());
// Copy if not equal
if (cellVisibility != rangeFilterVisibility ) (*cellVisibility) = *rangeFilterVisibility;
if (cellVisibility != rangeFilterVisibility) (*cellVisibility) = *rangeFilterVisibility;
if (propFilterColl->hasActiveFilters())
{
@@ -815,14 +840,15 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->eclipseCaseData();
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition());
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(
eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition());
CVF_ASSERT(resultAccessor.notNull());
if (propertyFilter->isCategorySelectionActive())
{
std::vector<int> integerVector = propertyFilter->selectedCategoryValues();
std::set<int> integerSet;
std::set<int> integerSet;
for (auto val : integerVector)
{
integerSet.insert(val);
@@ -892,46 +918,55 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::updateCellColor(RivCellSetEnum geometryType, size_t timeStepIndex, cvf::Color4f color)
{
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex);
pmgr->updateCellColor(color);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::updateCellResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
void RivReservoirViewPartMgr::updateCellResultColor(RivCellSetEnum geometryType,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors)
{
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex);
pmgr->updateCellResultColor(timeStepIndex, cellResultColors);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
void RivReservoirViewPartMgr::updateCellEdgeResultColor(RivCellSetEnum geometryType,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors)
{
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex);
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors, RimCellEdgeColors* cellEdgeResultColors)
void RivReservoirViewPartMgr::updateFaultCellEdgeResultColor(RivCellSetEnum geometryType,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors,
RimCellEdgeColors* cellEdgeResultColors)
{
RivReservoirPartMgr * pmgr = reservoirPartManager(geometryType, timeStepIndex);
RivReservoirPartMgr* pmgr = reservoirPartManager(geometryType, timeStepIndex);
pmgr->updateFaultCellEdgeResultColor(timeStepIndex, cellResultColors, cellEdgeResultColors);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const cvf::UByteArray* RivReservoirViewPartMgr::cellVisibility(RivCellSetEnum geometryType, size_t gridIndex, size_t timeStepIndex)
const cvf::UByteArray*
RivReservoirViewPartMgr::cellVisibility(RivCellSetEnum geometryType, size_t gridIndex, size_t timeStepIndex)
{
ensureDynamicGeometryPartsCreated(geometryType, timeStepIndex);
ensureStaticGeometryPartsCreated(geometryType);
RivReservoirPartMgr * pmgr = (const_cast<RivReservoirViewPartMgr*>(this))->reservoirPartManager( geometryType, timeStepIndex );
RivReservoirPartMgr* pmgr = (const_cast<RivReservoirViewPartMgr*>(this))->reservoirPartManager(geometryType, timeStepIndex);
return pmgr->cellVisibility(gridIndex).p();
}
@@ -958,7 +993,9 @@ RivReservoirPartMgr* RivReservoirViewPartMgr::reservoirPartManager(RivCellSetEnu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::updateFaultColors(RivCellSetEnum geometryType, size_t timeStepIndex, RimEclipseCellColors* cellResultColors)
void RivReservoirViewPartMgr::updateFaultColors(RivCellSetEnum geometryType,
size_t timeStepIndex,
RimEclipseCellColors* cellResultColors)
{
if (geometryType == PROPERTY_FILTERED && timeStepIndex >= m_propFilteredGeometryFrames.size())
{
@@ -983,58 +1020,58 @@ void RivReservoirViewPartMgr::appendFaultsStaticGeometryPartsToModel(cvf::ModelB
ensureStaticGeometryPartsCreated(geometryType);
/*
QString text;
switch (geometryType)
{
case OVERRIDDEN_CELL_VISIBILITY:
text = "OVERRIDDEN_CELL_VISIBILITY";
break;
case ALL_CELLS:
text = "ALL_CELLS";
break;
case ACTIVE:
text = "ACTIVE";
break;
case ALL_WELL_CELLS:
text = "ALL_WELL_CELLS";
break;
case VISIBLE_WELL_CELLS:
text = "VISIBLE_WELL_CELLS";
break;
case VISIBLE_WELL_FENCE_CELLS:
text = "VISIBLE_WELL_FENCE_CELLS";
break;
case INACTIVE:
text = "INACTIVE";
break;
case RANGE_FILTERED:
text = "RANGE_FILTERED";
break;
case RANGE_FILTERED_INACTIVE:
text = "RANGE_FILTERED_INACTIVE";
break;
case RANGE_FILTERED_WELL_CELLS:
text = "RANGE_FILTERED_WELL_CELLS";
break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
text = "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER";
break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
text = "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER";
break;
case PROPERTY_FILTERED:
text = "PROPERTY_FILTERED";
break;
case PROPERTY_FILTERED_WELL_CELLS:
text = "PROPERTY_FILTERED_WELL_CELLS";
break;
default:
break;
}
/*
QString text;
switch (geometryType)
{
case OVERRIDDEN_CELL_VISIBILITY:
text = "OVERRIDDEN_CELL_VISIBILITY";
break;
case ALL_CELLS:
text = "ALL_CELLS";
break;
case ACTIVE:
text = "ACTIVE";
break;
case ALL_WELL_CELLS:
text = "ALL_WELL_CELLS";
break;
case VISIBLE_WELL_CELLS:
text = "VISIBLE_WELL_CELLS";
break;
case VISIBLE_WELL_FENCE_CELLS:
text = "VISIBLE_WELL_FENCE_CELLS";
break;
case INACTIVE:
text = "INACTIVE";
break;
case RANGE_FILTERED:
text = "RANGE_FILTERED";
break;
case RANGE_FILTERED_INACTIVE:
text = "RANGE_FILTERED_INACTIVE";
break;
case RANGE_FILTERED_WELL_CELLS:
text = "RANGE_FILTERED_WELL_CELLS";
break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
text = "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER";
break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
text = "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER";
break;
case PROPERTY_FILTERED:
text = "PROPERTY_FILTERED";
break;
case PROPERTY_FILTERED_WELL_CELLS:
text = "PROPERTY_FILTERED_WELL_CELLS";
break;
default:
break;
}
qDebug() << text;
*/
qDebug() << text;
*/
m_geometries[geometryType].appendFaultPartsToModel(model);
}
@@ -1042,17 +1079,19 @@ void RivReservoirViewPartMgr::appendFaultsStaticGeometryPartsToModel(cvf::ModelB
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex)
void RivReservoirViewPartMgr::appendFaultsDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
RivCellSetEnum geometryType,
size_t frameIndex)
{
if (geometryType == PROPERTY_FILTERED)
{
//qDebug() << "PROPERTY_FILTERED";
// qDebug() << "PROPERTY_FILTERED";
m_propFilteredGeometryFrames[frameIndex]->appendFaultPartsToModel(model);
}
else if (geometryType == PROPERTY_FILTERED_WELL_CELLS)
{
//qDebug() << "PROPERTY_FILTERED_WELL_CELLS";
// qDebug() << "PROPERTY_FILTERED_WELL_CELLS";
m_propFilteredWellGeometryFrames[frameIndex]->appendFaultPartsToModel(model);
}
@@ -1061,7 +1100,8 @@ void RivReservoirViewPartMgr::appendFaultsDynamicGeometryPartsToModel(cvf::Model
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::set<RivCellSetEnum>& geometryTypes, bool showFaultsOutsideFilters) const
RivCellSetEnum RivReservoirViewPartMgr::geometryTypeForFaultLabels(const std::set<RivCellSetEnum>& geometryTypes,
bool showFaultsOutsideFilters) const
{
for (RivCellSetEnum cellSetType : geometryTypes)
{
@@ -1094,7 +1134,9 @@ void RivReservoirViewPartMgr::appendFaultLabelsStaticGeometryPartsToModel(cvf::M
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::appendFaultLabelsDynamicGeometryPartsToModel(cvf::ModelBasicList* model, RivCellSetEnum geometryType, size_t frameIndex)
void RivReservoirViewPartMgr::appendFaultLabelsDynamicGeometryPartsToModel(cvf::ModelBasicList* model,
RivCellSetEnum geometryType,
size_t frameIndex)
{
m_propFilteredGeometryFrames[frameIndex]->appendFaultLabelPartsToModel(model);
}

View File

@@ -29,7 +29,6 @@
#include "cafPdmUiEditorHandle.h"
CAF_PDM_SOURCE_INIT(RimEclipsePropertyFilterCollection, "CellPropertyFilters");
//--------------------------------------------------------------------------------------------------
@@ -39,7 +38,7 @@ RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection()
{
CAF_PDM_InitObject("Property Filters", ":/CellFilter_Values.png", "", "");
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
propertyFilters.uiCapability()->setUiHidden(true);
}
@@ -67,9 +66,8 @@ RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView()
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters()
{
for (size_t i = 0; i < propertyFilters.size(); i++)
for (RimEclipsePropertyFilter* propertyFilter : propertyFilters)
{
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
propertyFilter->resultDefinition()->setEclipseCase(reservoirView()->eclipseCase());
propertyFilter->initAfterRead();
if (isActive() && propertyFilter->isActive())
@@ -95,9 +93,8 @@ bool RimEclipsePropertyFilterCollection::hasActiveFilters() const
{
if (!isActive) return false;
for (size_t i = 0; i < propertyFilters.size(); i++)
for (RimEclipsePropertyFilter* propertyFilter : propertyFilters)
{
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
if (propertyFilter->isActive() && propertyFilter->resultDefinition()->hasResult()) return true;
}
@@ -111,29 +108,26 @@ bool RimEclipsePropertyFilterCollection::hasActiveDynamicFilters() const
{
if (!isActive) return false;
for (size_t i = 0; i < propertyFilters.size(); i++)
for (RimEclipsePropertyFilter* propertyFilter : propertyFilters)
{
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
if (propertyFilter->isActive() && propertyFilter->resultDefinition()->hasDynamicResult()) return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilterCollection::isUsingFormationNames() const
{
if ( !isActive ) return false;
if (!isActive) return false;
for ( size_t i = 0; i < propertyFilters.size(); i++ )
for (RimEclipsePropertyFilter* propertyFilter : propertyFilters)
{
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
if ( propertyFilter->isActive()
&& propertyFilter->resultDefinition()->resultType() == RiaDefines::FORMATION_NAMES
&& propertyFilter->resultDefinition()->resultVariable() != RiaDefines::undefinedResultName()) return true;
if (propertyFilter->isActive() && propertyFilter->resultDefinition()->resultType() == RiaDefines::FORMATION_NAMES &&
propertyFilter->resultDefinition()->resultVariable() != RiaDefines::undefinedResultName())
return true;
}
return false;
@@ -151,8 +145,7 @@ void RimEclipsePropertyFilterCollection::updateIconState()
if (view)
{
RimViewController* viewController = view->viewController();
if (viewController && (viewController->isPropertyFilterOveridden()
|| viewController->isVisibleCellsOveridden()))
if (viewController && (viewController->isPropertyFilterOveridden() || viewController->isVisibleCellsOveridden()))
{
activeIcon = false;
}
@@ -165,9 +158,8 @@ void RimEclipsePropertyFilterCollection::updateIconState()
updateUiIconFromState(activeIcon);
for (size_t i = 0; i < propertyFilters.size(); i++)
for (RimEclipsePropertyFilter* cellFilter : propertyFilters)
{
RimEclipsePropertyFilter* cellFilter = propertyFilters[i];
cellFilter->updateActiveState();
cellFilter->updateIconState();
}
@@ -183,4 +175,3 @@ void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep()
cellFilter->updateFromCurrentTimeStep();
}
}

View File

@@ -53,6 +53,8 @@
#include "RimFaultInViewCollection.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimFlowDiagSolution.h"
#include "RimFracture.h"
#include "RimFractureTemplateCollection.h"
#include "RimGridCollection.h"
#include "RimIntersection.h"
#include "RimIntersectionCollection.h"
@@ -60,38 +62,34 @@
#include "RimProject.h"
#include "RimRegularLegendConfig.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimSimWellFracture.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimStimPlanColors.h"
#include "RimTernaryLegendConfig.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimViewNameConfig.h"
#include "RimVirtualPerforationResults.h"
#include "RimWellPathCollection.h"
#include "RimViewNameConfig.h"
#include "RiuMainWindow.h"
#include "Riu3dSelectionManager.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "RivReservoirSimWellsPartMgr.h"
#include "RivReservoirViewPartMgr.h"
#include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathsPartMgr.h"
#include "RimFracture.h"
#include "RimFractureTemplateCollection.h"
#include "RimSimWellFracture.h"
#include "RivWellFracturePartMgr.h"
#include "RivWellPathsPartMgr.h"
#include "cafCadNavigation.h"
#include "cafCeetronPlusNavigation.h"
#include "cafDisplayCoordTransform.h"
#include "cafFrameAnimationControl.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafOverlayScalarMapperLegend.h"
#include "cafPdmUiTreeOrdering.h"
#include "cvfDrawable.h"
#include "cvfModelBasicList.h"
@@ -104,30 +102,28 @@
#include <climits>
CAF_PDM_SOURCE_INIT(RimEclipseView, "ReservoirView");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView::RimEclipseView()
{
RiaApplication* app = RiaApplication::instance();
RiaApplication* app = RiaApplication::instance();
RiaPreferences* preferences = app->preferences();
CVF_ASSERT(preferences);
CAF_PDM_InitObject("Reservoir View", ":/3DView16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", "");
m_cellResult = new RimEclipseCellColors();
m_cellResult.uiCapability()->setUiHidden(true);
m_cellResult->setDiffResultOptionsEnabled(true);
CAF_PDM_InitFieldNoDefault(&m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "");
CAF_PDM_InitFieldNoDefault(&m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "");
m_cellEdgeResult = new RimCellEdgeColors();
m_cellEdgeResult.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_faultResultSettings, "FaultResultSettings", "Separate Fault Result", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_faultResultSettings, "FaultResultSettings", "Separate Fault Result", "", "", "");
m_faultResultSettings = new RimEclipseFaultColors();
m_faultResultSettings.uiCapability()->setUiHidden(true);
@@ -156,11 +152,11 @@ RimEclipseView::RimEclipseView()
m_propertyFilterCollection.uiCapability()->setUiHidden(true);
// Visualization fields
CAF_PDM_InitField(&m_showMainGrid_OBSOLETE, "ShowMainGrid", true, "Show Main Grid", "", "", "");
CAF_PDM_InitField(&m_showMainGrid_OBSOLETE, "ShowMainGrid", true, "Show Main Grid", "", "", "");
RiaFieldhandleTools::disableWriteAndSetFieldHidden(&m_showMainGrid_OBSOLETE);
CAF_PDM_InitField(&m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "");
CAF_PDM_InitField(&m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", "");
CAF_PDM_InitField(&m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "");
CAF_PDM_InitField(&m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", "");
this->cellResult()->setReservoirView(this);
@@ -170,8 +166,8 @@ RimEclipseView::RimEclipseView()
this->faultResultSettings()->setReservoirView(this);
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
m_simWellsPartManager = new RivReservoirSimWellsPartMgr(this);
m_eclipseCase = nullptr;
m_simWellsPartManager = new RivReservoirSimWellsPartMgr(this);
m_eclipseCase = nullptr;
nameConfig()->setCustomName("3D View");
nameConfig()->hideCaseNameField(false);
@@ -199,7 +195,6 @@ RimEclipseView::~RimEclipseView()
m_eclipseCase = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -265,11 +260,11 @@ void RimEclipseView::clampCurrentTimestep()
{
if (m_currentTimeStep() >= static_cast<int>(this->currentGridCellResults()->maxTimeStepCount()))
{
m_currentTimeStep = static_cast<int>(this->currentGridCellResults()->maxTimeStepCount()) -1;
m_currentTimeStep = static_cast<int>(this->currentGridCellResults()->maxTimeStepCount()) - 1;
}
}
if (m_currentTimeStep < 0 ) m_currentTimeStep = 0;
if (m_currentTimeStep < 0) m_currentTimeStep = 0;
}
//--------------------------------------------------------------------------------------------------
@@ -335,7 +330,7 @@ void RimEclipseView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
void RimEclipseView::updateScaleTransform()
{
cvf::Mat4d scale = cvf::Mat4d::IDENTITY;
scale(2, 2) = scaleZ();
scale(2, 2) = scaleZ();
this->scaleTransform()->setLocalTransform(scale);
m_simWellsPartManager->setScaleTransform(this->scaleTransform());
@@ -379,18 +374,15 @@ void RimEclipseView::createDisplayModel()
timeStepIndices.push_back(i);
}
}
else if (this->cellResult()->hasStaticResult()
|| this->cellEdgeResult()->hasResult()
|| this->eclipsePropertyFilterCollection()->hasActiveFilters())
else if (this->cellResult()->hasStaticResult() || this->cellEdgeResult()->hasResult() ||
this->eclipsePropertyFilterCollection()->hasActiveFilters())
{
// The one and only result entry
timeStepIndices.push_back(0);
}
cvf::Collection<cvf::ModelBasicList> frameModels;
size_t timeIdx;
size_t timeIdx;
for (timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++)
{
frameModels.push_back(new cvf::ModelBasicList);
@@ -411,10 +403,8 @@ void RimEclipseView::createDisplayModel()
// For property filtered geometry : just set all the models as empty scenes
// updateCurrentTimeStep requests the actual parts
if (!this->eclipsePropertyFilterCollection()->hasActiveFilters()
|| ( this->viewController()
&& this->viewController()->isVisibleCellsOveridden()) )
if (!this->eclipsePropertyFilterCollection()->hasActiveFilters() ||
(this->viewController() && this->viewController()->isVisibleCellsOveridden()))
{
std::vector<RivCellSetEnum> geometryTypesToAdd;
@@ -467,13 +457,14 @@ void RimEclipseView::createDisplayModel()
{
for (size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx)
{
if ( isGridVisualizationMode() )
if (isGridVisualizationMode())
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(
frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
}
else
{
m_reservoirGridPartManager->ensureStaticGeometryPartsCreated( geometryTypesToAdd[gtIdx]);
m_reservoirGridPartManager->ensureStaticGeometryPartsCreated(geometryTypesToAdd[gtIdx]);
}
}
}
@@ -488,13 +479,13 @@ void RimEclipseView::createDisplayModel()
m_reservoirGridPartManager->clearWatertightGeometryFlags();
if ( faultCollection()->showFaultCollection()
|| !this->eclipsePropertyFilterCollection()->hasActiveFilters() )
if (faultCollection()->showFaultCollection() || !this->eclipsePropertyFilterCollection()->hasActiveFilters())
{
setVisibleGridPartsWatertight();
std::set<RivCellSetEnum> faultGeometryTypesToAppend = allVisibleFaultGeometryTypes();
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters());
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(
faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters());
for (size_t frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
{
@@ -509,7 +500,6 @@ void RimEclipseView::createDisplayModel()
}
}
// Cross sections
m_crossSectionVizModel->removeAllParts();
@@ -527,14 +517,14 @@ void RimEclipseView::createDisplayModel()
addWellPathsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox());
m_wellPathsPartManager->appendStaticFracturePartsToModel(m_wellPathPipeVizModel.p(), currentActiveCellInfo()->geometryBoundingBox());
m_wellPathsPartManager->appendStaticFracturePartsToModel(m_wellPathPipeVizModel.p(),
currentActiveCellInfo()->geometryBoundingBox());
m_wellPathPipeVizModel->updateBoundingBoxesRecursive();
m_viewer->addStaticModelOnce(m_wellPathPipeVizModel.p());
// Create Scenes from the frameModels
// Animation frames for results display, starts from frame 1
size_t frameIndex;
for (frameIndex = 0; frameIndex < frameModels.size(); frameIndex++)
{
@@ -620,8 +610,10 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
if (isGridVisualizationMode())
{
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(
frameParts.p(), PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(
frameParts.p(), PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
}
else
{
@@ -637,7 +629,8 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
{
if (geometryType == PROPERTY_FILTERED || geometryType == PROPERTY_FILTERED_WELL_CELLS)
{
m_reservoirGridPartManager->appendFaultsDynamicGeometryPartsToModel(frameParts.p(), geometryType, m_currentTimeStep);
m_reservoirGridPartManager->appendFaultsDynamicGeometryPartsToModel(
frameParts.p(), geometryType, m_currentTimeStep);
}
else
{
@@ -645,10 +638,12 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
}
}
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters());
RivCellSetEnum faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(
faultGeometryTypesToAppend, faultCollection()->isShowingFaultsAndFaultsOutsideFilters());
if (faultLabelType == PROPERTY_FILTERED)
{
m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel(frameParts.p(), faultLabelType, m_currentTimeStep);
m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel(
frameParts.p(), faultLabelType, m_currentTimeStep);
}
else
{
@@ -656,15 +651,17 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
}
// Set the transparency on all the Wellcell parts before setting the result color
float opacity = static_cast<float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
m_reservoirGridPartManager->updateCellColor(PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity));
float opacity = static_cast<float>(1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
m_reservoirGridPartManager->updateCellColor(
PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity));
if (this->showInactiveCells())
{
if (this->rangeFilterCollection()->hasActiveFilters()) // Wells not considered, because we do not have a INACTIVE_WELL_CELLS group yet.
if (this->rangeFilterCollection()
->hasActiveFilters()) // Wells not considered, because we do not have a INACTIVE_WELL_CELLS group yet.
{
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RANGE_FILTERED_INACTIVE, gridIndices);
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(
frameParts.p(), RANGE_FILTERED_INACTIVE, gridIndices);
if (!faultCollection()->isShowingFaultsAndFaultsOutsideFilters())
{
@@ -720,9 +717,11 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
{
if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult())
{
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
m_reservoirGridPartManager->updateCellEdgeResultColor(
geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
}
else if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
else if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) ||
this->cellResult()->isTernarySaturationSelected())
{
m_reservoirGridPartManager->updateCellResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult());
}
@@ -734,12 +733,12 @@ void RimEclipseView::updateVisibleGeometriesAndCellColors()
this->updateFaultColors();
if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) || this->cellResult()->isTernarySaturationSelected())
if ((this->hasUserRequestedAnimation() && this->cellResult()->hasResult()) ||
this->cellResult()->isTernarySaturationSelected())
{
m_crossSectionCollection->updateCellResultColor(m_currentTimeStep,
this->cellResult()->legendConfig()->scalarMapper(),
this->cellResult()->ternaryLegendConfig()->scalarMapper());
this->cellResult()->legendConfig()->scalarMapper(),
this->cellResult()->ternaryLegendConfig()->scalarMapper());
}
else
{
@@ -805,7 +804,8 @@ void RimEclipseView::appendWellsAndFracturesToModel()
f->firstAncestorOrThisOfType(simWell);
if (simWell)
{
bool isAnyGeometryPresent = simWell->isWellPipeVisible(m_currentTimeStep) || simWell->isWellSpheresVisible(m_currentTimeStep);
bool isAnyGeometryPresent =
simWell->isWellPipeVisible(m_currentTimeStep) || simWell->isWellSpheresVisible(m_currentTimeStep);
if (!isAnyGeometryPresent)
{
continue;
@@ -834,9 +834,9 @@ void RimEclipseView::onLoadDataAndUpdate()
if (!m_eclipseCase->openReserviorCase())
{
QMessageBox::warning(RiuMainWindow::instance(),
"Error when opening project file",
"Could not open the Eclipse Grid file: \n"+ m_eclipseCase->gridFileName());
this->setEclipseCase( nullptr);
"Error when opening project file",
"Could not open the Eclipse Grid file: \n" + m_eclipseCase->gridFileName());
this->setEclipseCase(nullptr);
return;
}
}
@@ -882,8 +882,6 @@ void RimEclipseView::onLoadDataAndUpdate()
this->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -911,23 +909,22 @@ void RimEclipseView::initAfterRead()
this->updateUiIconFromToggleField();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateStaticCellColors()
{
updateStaticCellColors( OVERRIDDEN_CELL_VISIBILITY);
updateStaticCellColors( ACTIVE);
updateStaticCellColors( ALL_WELL_CELLS);
updateStaticCellColors( VISIBLE_WELL_CELLS);
updateStaticCellColors( VISIBLE_WELL_FENCE_CELLS);
updateStaticCellColors( VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
updateStaticCellColors( VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
updateStaticCellColors( INACTIVE);
updateStaticCellColors( RANGE_FILTERED);
updateStaticCellColors( RANGE_FILTERED_WELL_CELLS);
updateStaticCellColors( RANGE_FILTERED_INACTIVE);
updateStaticCellColors(OVERRIDDEN_CELL_VISIBILITY);
updateStaticCellColors(ACTIVE);
updateStaticCellColors(ALL_WELL_CELLS);
updateStaticCellColors(VISIBLE_WELL_CELLS);
updateStaticCellColors(VISIBLE_WELL_FENCE_CELLS);
updateStaticCellColors(VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
updateStaticCellColors(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
updateStaticCellColors(INACTIVE);
updateStaticCellColors(RANGE_FILTERED);
updateStaticCellColors(RANGE_FILTERED_WELL_CELLS);
updateStaticCellColors(RANGE_FILTERED_INACTIVE);
}
//--------------------------------------------------------------------------------------------------
@@ -954,23 +951,41 @@ void RimEclipseView::updateStaticCellColors(RivCellSetEnum geometryType)
//--------------------------------------------------------------------------------------------------
cvf::Color4f RimEclipseView::colorFromCellCategory(RivCellSetEnum geometryType) const
{
float opacity = static_cast<float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
float opacity = static_cast<float>(1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
cvf::Color4f color(cvf::Color3::ORANGE);
switch (geometryType)
{
case ACTIVE: color = cvf::Color4f(cvf::Color3::ORANGE); break;
case ALL_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break;
case VISIBLE_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break;
case VISIBLE_WELL_FENCE_CELLS: color = cvf::Color4f(cvf::Color3::ORANGE); break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
color = cvf::Color4f(cvf::Color3::ORANGE); break;
case INACTIVE: color = cvf::Color4f(RiaColorTables::undefinedCellColor()); break;
case RANGE_FILTERED: color = cvf::Color4f(cvf::Color3::ORANGE); break;
case RANGE_FILTERED_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity); break;
case RANGE_FILTERED_INACTIVE: color = cvf::Color4f(RiaColorTables::undefinedCellColor()); break;
case ACTIVE:
color = cvf::Color4f(cvf::Color3::ORANGE);
break;
case ALL_WELL_CELLS:
color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity);
break;
case VISIBLE_WELL_CELLS:
color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity);
break;
case VISIBLE_WELL_FENCE_CELLS:
color = cvf::Color4f(cvf::Color3::ORANGE);
break;
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity);
break;
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
color = cvf::Color4f(cvf::Color3::ORANGE);
break;
case INACTIVE:
color = cvf::Color4f(RiaColorTables::undefinedCellColor());
break;
case RANGE_FILTERED:
color = cvf::Color4f(cvf::Color3::ORANGE);
break;
case RANGE_FILTERED_WELL_CELLS:
color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity);
break;
case RANGE_FILTERED_INACTIVE:
color = cvf::Color4f(RiaColorTables::undefinedCellColor());
break;
}
return color;
@@ -1045,9 +1060,7 @@ RigCaseCellResultsData* RimEclipseView::currentGridCellResults()
//--------------------------------------------------------------------------------------------------
const RigActiveCellInfo* RimEclipseView::currentActiveCellInfo() const
{
if (m_eclipseCase &&
m_eclipseCase->eclipseCaseData()
)
if (m_eclipseCase && m_eclipseCase->eclipseCaseData())
{
return m_eclipseCase->eclipseCaseData()->activeCellInfo(cellResult()->porosityModel());
}
@@ -1055,7 +1068,6 @@ const RigActiveCellInfo* RimEclipseView::currentActiveCellInfo() const
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1092,7 +1104,6 @@ void RimEclipseView::scheduleSimWellGeometryRegen()
m_simWellsPartManager->scheduleGeometryRegen();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1113,7 +1124,7 @@ void RimEclipseView::updateLegends()
m_viewer->removeAllColorLegends();
}
if (!m_eclipseCase || !m_viewer || !m_eclipseCase->eclipseCaseData() )
if (!m_eclipseCase || !m_viewer || !m_eclipseCase->eclipseCaseData())
{
return;
}
@@ -1146,14 +1157,16 @@ void RimEclipseView::updateLegends()
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(
globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
if (this->cellEdgeResult()->hasCategoryResult())
{
if (cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RiaDefines::FORMATION_NAMES)
{
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->eclipseResultAddress()));
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(
cellEdgeResult()->singleVarEdgeResultColors()->eclipseResultAddress()));
}
else
{
@@ -1163,13 +1176,15 @@ void RimEclipseView::updateLegends()
}
}
this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName());
this->cellEdgeResult()->legendConfig()->setTitle(QString("Edge Results: \n") +
this->cellEdgeResult()->resultVariableUiShortName());
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->titledOverlayFrame());
}
else
{
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(0, 0, 0, 0);
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(
cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
}
}
@@ -1196,8 +1211,8 @@ void RimEclipseView::updateLegends()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
RimEclipseCellColors* resultColors,
void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel,
RimEclipseCellColors* resultColors,
RigCaseCellResultsData* cellResultsData)
{
resultColors->updateLegendData(m_currentTimeStep);
@@ -1260,12 +1275,11 @@ RimEclipseCase* RimEclipseView::eclipseCase() const
//--------------------------------------------------------------------------------------------------
void RimEclipseView::syncronizeWellsWithResults()
{
if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData()) ) return;
if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData())) return;
cvf::Collection<RigSimWellData> wellResults = m_eclipseCase->eclipseCaseData()->wellResults();
std::vector<caf::PdmPointer<RimSimWellInView> > newWells;
std::vector<caf::PdmPointer<RimSimWellInView>> newWells;
// Clear the possible well results data present
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
@@ -1284,7 +1298,7 @@ void RimEclipseView::syncronizeWellsWithResults()
if (!well)
{
well = new RimSimWellInView;
well = new RimSimWellInView;
well->name = wellResults[wIdx]->m_wellName;
isAnyWellCreated = true;
@@ -1298,8 +1312,8 @@ void RimEclipseView::syncronizeWellsWithResults()
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
{
RimSimWellInView* well = this->wellCollection()->wells()[wIdx];
RigSimWellData* simWellData = well->simWellData();
RimSimWellInView* well = this->wellCollection()->wells()[wIdx];
RigSimWellData* simWellData = well->simWellData();
if (simWellData == nullptr)
{
delete well;
@@ -1349,7 +1363,7 @@ const RivReservoirViewPartMgr* RimEclipseView::reservoirGridPartManager() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirViewPartMgr * RimEclipseView::reservoirGridPartManager()
RivReservoirViewPartMgr* RimEclipseView::reservoirGridPartManager()
{
return m_reservoirGridPartManager.p();
}
@@ -1357,7 +1371,7 @@ RivReservoirViewPartMgr * RimEclipseView::reservoirGridPartManager()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase * grid)
void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase* grid)
{
CVF_ASSERT(visibleCells != nullptr);
@@ -1375,13 +1389,13 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
// Loop over the wells and find their contribution
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
{
RimSimWellInView* well = this->wellCollection()->wells()[wIdx];
RimSimWellInView* well = this->wellCollection()->wells()[wIdx];
if (well->isWellCellsVisible())
{
RigSimWellData* simWellData = well->simWellData();
if (!simWellData) continue;
const std::vector< RigWellResultFrame >& wellResFrames = simWellData->m_wellCellsTimeSteps;
const std::vector<RigWellResultFrame>& wellResFrames = simWellData->m_wellCellsTimeSteps;
for (size_t wfIdx = 0; wfIdx < wellResFrames.size(); ++wfIdx)
{
// Add all the cells from the branches
@@ -1390,7 +1404,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
{
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx)
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx)
{
if (wsResCells[cIdx].m_gridIndex == grid->gridIndex())
{
@@ -1399,7 +1413,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
continue;
}
size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
(*visibleCells)[gridCellIndex] = true;
// Calculate well fence cells
@@ -1408,31 +1422,31 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
size_t i, j, k;
grid->ijkFromCellIndex(gridCellIndex, &i, &j, &k);
size_t* pI = &i;
size_t *pJ = &j;
size_t *pK = &k;
size_t cellCountFenceDirection = 0;
size_t fIdx = 0;
size_t* pI = &i;
size_t* pJ = &j;
size_t* pK = &k;
size_t cellCountFenceDirection = 0;
size_t fIdx = 0;
if (this->wellCollection()->wellCellFenceType == RimSimWellInViewCollection::K_DIRECTION)
{
cellCountFenceDirection = grid->cellCountK();
pK = &fIdx;
pK = &fIdx;
}
else if (this->wellCollection()->wellCellFenceType == RimSimWellInViewCollection::J_DIRECTION)
{
cellCountFenceDirection = grid->cellCountJ();
pJ = &fIdx;
pJ = &fIdx;
}
else if (this->wellCollection()->wellCellFenceType == RimSimWellInViewCollection::I_DIRECTION)
{
cellCountFenceDirection = grid->cellCountI();
pI = &fIdx;
pI = &fIdx;
}
for ( fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx)
for (fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx)
{
size_t fenceCellIndex = grid->cellIndexFromIJK(*pI,*pJ,*pK);
size_t fenceCellIndex = grid->cellIndexFromIJK(*pI, *pJ, *pK);
size_t reservoirCellIndex = grid->reservoirCellIndex(fenceCellIndex);
if (activeCellInfo && activeCellInfo->isActive(reservoirCellIndex))
@@ -1468,10 +1482,8 @@ void RimEclipseView::updateDisplayModelForWellResults()
}
RiuMainWindow::instance()->refreshAnimationActions();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1517,7 +1529,7 @@ void RimEclipseView::calculateCompletionTypeAndRedrawIfRequired()
std::vector<RimIntersection*> intersections = m_crossSectionCollection->intersections();
for (auto intersection : intersections)
{
if ( intersection && intersection->correspondingIntersectionView() )
if (intersection && intersection->correspondingIntersectionView())
{
intersection->correspondingIntersectionView()->scheduleCreateDisplayModelAndRedraw();
}
@@ -1553,7 +1565,8 @@ bool RimEclipseView::isVirtualConnectionFactorGeometryVisible() const
bool RimEclipseView::isMainGridVisible() const
{
auto indicesToVisibleGrids = m_gridCollection->indicesToVisibleGrids();
bool isMainGridVisible = std::find(indicesToVisibleGrids.begin(), indicesToVisibleGrids.end(), 0) != indicesToVisibleGrids.end();
bool isMainGridVisible =
std::find(indicesToVisibleGrids.begin(), indicesToVisibleGrids.end(), 0) != indicesToVisibleGrids.end();
if (!isMainGridVisible) return false;
@@ -1656,7 +1669,8 @@ void RimEclipseView::updateFaultColors()
{
if (this->hasUserRequestedAnimation() && this->cellEdgeResult()->hasResult())
{
m_reservoirGridPartManager->updateFaultCellEdgeResultColor(cellSetType, m_currentTimeStep, faultResultColors, this->cellEdgeResult());
m_reservoirGridPartManager->updateFaultCellEdgeResultColor(
cellSetType, m_currentTimeStep, faultResultColors, this->cellEdgeResult());
}
else
{
@@ -1665,7 +1679,6 @@ void RimEclipseView::updateFaultColors()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1693,7 +1706,6 @@ bool RimEclipseView::isTimeStepDependentDataVisible() const
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1737,11 +1749,12 @@ void RimEclipseView::updateVirtualConnectionLegendRanges()
{
if (!eclipseCase()) return;
const RigVirtualPerforationTransmissibilities* virtualTransmissibilities = eclipseCase()->computeAndGetVirtualPerforationTransmissibilities();
const RigVirtualPerforationTransmissibilities* virtualTransmissibilities =
eclipseCase()->computeAndGetVirtualPerforationTransmissibilities();
if (virtualTransmissibilities)
{
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
double minValue = HUGE_VAL;
double maxValue = -HUGE_VAL;
double posClosestToZero = HUGE_VAL;
double negClosestToZero = -HUGE_VAL;
@@ -1844,14 +1857,15 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV
for (size_t gridIdx = 0; gridIdx < gridCount; ++gridIdx)
{
RigGridBase * grid = this->eclipseCase()->eclipseCaseData()->grid(gridIdx);
int gridCellCount = static_cast<int>(grid->cellCount());
RigGridBase* grid = this->eclipseCase()->eclipseCaseData()->grid(gridIdx);
int gridCellCount = static_cast<int>(grid->cellCount());
for (size_t gpIdx = 0; gpIdx < m_visibleGridParts.size(); ++gpIdx)
{
const cvf::UByteArray* visibility = m_reservoirGridPartManager->cellVisibility(m_visibleGridParts[gpIdx], gridIdx, timeStep);
const cvf::UByteArray* visibility =
m_reservoirGridPartManager->cellVisibility(m_visibleGridParts[gpIdx], gridIdx, timeStep);
for (int lcIdx = 0; lcIdx < gridCellCount; ++ lcIdx)
for (int lcIdx = 0; lcIdx < gridCellCount; ++lcIdx)
{
(*totalVisibility)[grid->reservoirCellIndex(lcIdx)] |= (*visibility)[lcIdx];
}
@@ -1890,7 +1904,7 @@ bool RimEclipseView::showActiveCellsOnly()
//--------------------------------------------------------------------------------------------------
void RimEclipseView::createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts)
{
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
Riu3dSelectionManager* riuSelManager = Riu3dSelectionManager::instance();
std::vector<RiuSelectionItem*> items;
riuSelManager->selectedItems(items);
@@ -1904,7 +1918,9 @@ void RimEclipseView::createPartCollectionFromSelection(cvf::Collection<cvf::Part
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase());
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData());
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_gridLocalCellIndex);
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData(),
eclipseSelItem->m_gridIndex,
eclipseSelItem->m_gridLocalCellIndex);
cvf::ref<cvf::Part> part = partGen.createPart(eclipseSelItem->m_color);
part->setTransform(this->scaleTransform());