#1189 Visibility of well cells now follow visible range filtered cells

This commit is contained in:
Magne Sjaastad 2017-02-07 15:07:11 +01:00
parent 0061067aa7
commit 2404cf1582
5 changed files with 124 additions and 2 deletions

View File

@ -159,6 +159,7 @@ void RimCellRangeFilterCollection::updateDisplayModeNotifyManagedViews(RimCellRa
}
}
view->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
view->scheduleGeometryRegen(RANGE_FILTERED);
view->scheduleGeometryRegen(RANGE_FILTERED_INACTIVE);

View File

@ -1149,7 +1149,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
{
RimEclipseWell* well = this->wellCollection()->wells()[wIdx];
if (well->showWell() && well->showWellCells())
if (well->isWellCellsVisible())
{
RigSingleWellResultsData* wres = well->wellResults();
if (!wres) continue;

View File

@ -23,6 +23,7 @@
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSingleWellResultsData.h"
#include "RimCellRangeFilterCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWellCollection.h"
#include "RimIntersectionCollection.h"
@ -217,6 +218,78 @@ bool RimEclipseWell::intersectsVisibleCells(size_t frameIndex) const
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::intersectsStaticWellCellsRangeFilteredCells() const
{
if (this->wellResults() == nullptr) return false;
RimEclipseView* m_reservoirView = nullptr;
this->firstAncestorOrThisOfType(m_reservoirView);
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
// NOTE: Read out static well cells, union of well cells across all time steps
const RigWellResultFrame& wrsf = this->wellResults()->m_staticWellCells;
for (const RivCellSetEnum& visGridPart : visGridParts)
{
if (visGridPart == ALL_WELL_CELLS
|| visGridPart == VISIBLE_WELL_CELLS
|| visGridPart == VISIBLE_WELL_FENCE_CELLS
|| visGridPart == VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER
|| visGridPart == VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER
)
{
// Exclude all cells related to well cells
continue;
}
// NOTE: Use first time step for visibility evaluation
size_t frameIndex = 0;
// First check the wellhead:
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex;
if (gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T)
{
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridPart, gridIndex, frameIndex);
if (gridCellIndex < cellVisibility->size() && (*cellVisibility)[gridCellIndex])
{
return true;
}
}
// Then check the rest of the well, with all the branches
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
for (const RigWellResultBranch& branchSegment : wellResSegments)
{
const std::vector<RigWellResultPoint>& wsResCells = branchSegment.m_branchResultPoints;
for (const RigWellResultPoint& wellResultPoint : wsResCells)
{
if (wellResultPoint.isCell())
{
gridIndex = wellResultPoint.m_gridIndex;
gridCellIndex = wellResultPoint.m_gridCellIndex;
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridPart, gridIndex, frameIndex);
if (gridCellIndex < cellVisibility->size() && (*cellVisibility)[gridCellIndex])
{
return true;
}
}
}
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -251,6 +324,13 @@ void RimEclipseWell::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
this->firstAncestorOrThisOfType(reservoirView);
if (!reservoirView) return;
if (reservoirView->rangeFilterCollection() && !reservoirView->rangeFilterCollection()->hasActiveFilters())
{
this->uiCapability()->setUiReadOnly(false);
return;
}
const RimEclipseWellCollection* wellColl = nullptr;
this->firstAncestorOrThisOfType(wellColl);
if (!wellColl) return;
@ -267,6 +347,40 @@ void RimEclipseWell::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseWell::isWellCellsVisible() const
{
const RimEclipseView* reservoirView = nullptr;
this->firstAncestorOrThisOfType(reservoirView);
if (reservoirView == nullptr) return false;
if (this->wellResults() == nullptr) return false;
if (!reservoirView->wellCollection()->isActive())
return false;
if (!this->showWell())
return false;
if (!this->showWellCells())
return false;
if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
return true;
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
{
return intersectsStaticWellCellsRangeFilteredCells();
}
else
{
return true;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -49,6 +49,7 @@ public:
const RigSingleWellResultsData* wellResults() const;
size_t resultWellIndex() const;
bool isWellCellsVisible() const;
bool isWellPipeVisible(size_t frameIndex) const;
bool isWellSpheresVisible(size_t frameIndex) const;
bool isUsingCellCenterForPipe() const;
@ -88,6 +89,7 @@ protected:
private:
bool intersectsVisibleCells(size_t frameIndex) const;
bool intersectsStaticWellCellsRangeFilteredCells() const;
private:
cvf::ref<RigSingleWellResultsData> m_wellResults;

View File

@ -399,13 +399,18 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &isAutoDetectingBranches == changedField
|| &wellHeadPosition == changedField
|| &wellLabelColor == changedField
|| &showWellsIntersectingVisibleCells == changedField
|| &wellPipeCoordType == changedField
|| &m_showWellPipe == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&showWellsIntersectingVisibleCells == changedField)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
if (&m_applyIndividualColorsToWells == changedField)