mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1189 Harmonized static and dynamic evaluation of cell visibilities
This commit is contained in:
parent
2404cf1582
commit
4bfb85c62e
@ -151,23 +151,33 @@ void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimEclipseWell::intersectsVisibleCells(size_t frameIndex) const
|
bool RimEclipseWell::intersectsDynamicWellCellsFilteredCells(size_t frameIndex) const
|
||||||
{
|
{
|
||||||
if (this->wellResults() == nullptr) return false;
|
if (this->wellResults() == nullptr) return false;
|
||||||
|
|
||||||
if (!wellResults()->hasWellResult(frameIndex)) return false;
|
if (!wellResults()->hasWellResult(frameIndex)) 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();
|
|
||||||
|
|
||||||
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
||||||
|
|
||||||
|
return intersectsWellCellsFilteredCells(wrsf, frameIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimEclipseWell::intersectsWellCellsFilteredCells(const RigWellResultFrame &wrsf, size_t frameIndex) const
|
||||||
|
{
|
||||||
|
RimEclipseView* reservoirView = nullptr;
|
||||||
|
this->firstAncestorOrThisOfType(reservoirView);
|
||||||
|
if (!reservoirView) return false;
|
||||||
|
|
||||||
|
const std::vector<RivCellSetEnum>& visGridParts = reservoirView->visibleGridParts();
|
||||||
|
cvf::cref<RivReservoirViewPartMgr> rvMan = reservoirView->reservoirGridPartManager();
|
||||||
|
|
||||||
|
|
||||||
for (const RivCellSetEnum& visGridPart : visGridParts)
|
for (const RivCellSetEnum& visGridPart : visGridParts)
|
||||||
{
|
{
|
||||||
if ( visGridPart == ALL_WELL_CELLS
|
if (visGridPart == ALL_WELL_CELLS
|
||||||
|| visGridPart == VISIBLE_WELL_CELLS
|
|| visGridPart == VISIBLE_WELL_CELLS
|
||||||
|| visGridPart == VISIBLE_WELL_FENCE_CELLS
|
|| visGridPart == VISIBLE_WELL_FENCE_CELLS
|
||||||
|| visGridPart == VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER
|
|| visGridPart == VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER
|
||||||
@ -221,73 +231,17 @@ bool RimEclipseWell::intersectsVisibleCells(size_t frameIndex) const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
bool RimEclipseWell::intersectsStaticWellCellsRangeFilteredCells() const
|
bool RimEclipseWell::intersectsStaticWellCellsFilteredCells() const
|
||||||
{
|
{
|
||||||
if (this->wellResults() == nullptr) return false;
|
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
|
// NOTE: Read out static well cells, union of well cells across all time steps
|
||||||
const RigWellResultFrame& wrsf = this->wellResults()->m_staticWellCells;
|
const RigWellResultFrame& wrsf = this->wellResults()->m_staticWellCells;
|
||||||
|
|
||||||
for (const RivCellSetEnum& visGridPart : visGridParts)
|
// NOTE: Use first time step for visibility evaluation
|
||||||
{
|
size_t frameIndex = 0;
|
||||||
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
|
return intersectsWellCellsFilteredCells(wrsf, frameIndex);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -335,7 +289,7 @@ void RimEclipseWell::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering
|
|||||||
this->firstAncestorOrThisOfType(wellColl);
|
this->firstAncestorOrThisOfType(wellColl);
|
||||||
if (!wellColl) return;
|
if (!wellColl) return;
|
||||||
|
|
||||||
if (wellColl->showWellsIntersectingVisibleCells() && !this->intersectsVisibleCells(static_cast<size_t>(reservoirView->currentTimeStep())))
|
if (wellColl->showWellsIntersectingVisibleCells() && !this->intersectsDynamicWellCellsFilteredCells(static_cast<size_t>(reservoirView->currentTimeStep())))
|
||||||
{
|
{
|
||||||
// Mark well as read only if well is not intersecting visible cells
|
// Mark well as read only if well is not intersecting visible cells
|
||||||
|
|
||||||
@ -373,7 +327,7 @@ bool RimEclipseWell::isWellCellsVisible() const
|
|||||||
|
|
||||||
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
||||||
{
|
{
|
||||||
return intersectsStaticWellCellsRangeFilteredCells();
|
return intersectsStaticWellCellsFilteredCells();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -417,7 +371,7 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex) const
|
|||||||
|
|
||||||
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
||||||
{
|
{
|
||||||
return intersectsVisibleCells(frameIndex);
|
return intersectsDynamicWellCellsFilteredCells(frameIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -461,7 +415,7 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex) const
|
|||||||
|
|
||||||
if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
if (m_reservoirView->wellCollection()->showWellsIntersectingVisibleCells())
|
||||||
{
|
{
|
||||||
return intersectsVisibleCells(frameIndex);
|
return intersectsDynamicWellCellsFilteredCells(frameIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -88,8 +88,10 @@ protected:
|
|||||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool intersectsVisibleCells(size_t frameIndex) const;
|
bool intersectsDynamicWellCellsFilteredCells(size_t frameIndex) const;
|
||||||
bool intersectsStaticWellCellsRangeFilteredCells() const;
|
bool intersectsStaticWellCellsFilteredCells() const;
|
||||||
|
|
||||||
|
bool intersectsWellCellsFilteredCells(const RigWellResultFrame &wrsf, size_t frameIndex) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
||||||
|
Loading…
Reference in New Issue
Block a user