mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -3,17 +3,17 @@
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -27,16 +27,16 @@
|
||||
#include "RigSimWellData.h"
|
||||
#include "RigSimulationWellCenterLineCalculator.h"
|
||||
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
#include "RimSimWellFracture.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimIntersection.h"
|
||||
#include "Rim2dIntersectionView.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -45,58 +45,56 @@
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal functions
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim2dIntersectionView* corresponding2dIntersectionView(RimSimWellInView *simWellInView);
|
||||
Rim2dIntersectionView* corresponding2dIntersectionView( RimSimWellInView* simWellInView );
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimSimWellInView, "Well");
|
||||
CAF_PDM_SOURCE_INIT( RimSimWellInView, "Well" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSimWellInView::RimSimWellInView()
|
||||
{
|
||||
CAF_PDM_InitObject("Well", ":/Well.png", "", "");
|
||||
CAF_PDM_InitObject( "Well", ":/Well.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&name, "WellName", "Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &name, "WellName", "Name", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&showWell, "ShowWell", true, "Show well ", "", "", "");
|
||||
CAF_PDM_InitField( &showWell, "ShowWell", true, "Show well ", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Label", "", "", "");
|
||||
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Well Head", "", "", "");
|
||||
CAF_PDM_InitField(&showWellPipe, "ShowWellPipe", true, "Pipe", "", "", "");
|
||||
CAF_PDM_InitField(&showWellSpheres, "ShowWellSpheres", false, "Spheres", "", "", "");
|
||||
CAF_PDM_InitField( &showWellLabel, "ShowWellLabel", true, "Label", "", "", "" );
|
||||
CAF_PDM_InitField( &showWellHead, "ShowWellHead", true, "Well Head", "", "", "" );
|
||||
CAF_PDM_InitField( &showWellPipe, "ShowWellPipe", true, "Pipe", "", "", "" );
|
||||
CAF_PDM_InitField( &showWellSpheres, "ShowWellSpheres", false, "Spheres", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale", "", "", "");
|
||||
CAF_PDM_InitField(&pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Radius Scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Pipe Color", "", "", "");
|
||||
CAF_PDM_InitField( &wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale", "", "", "" );
|
||||
CAF_PDM_InitField( &pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Radius Scale", "", "", "" );
|
||||
CAF_PDM_InitField( &wellPipeColor, "WellPipeColor", cvf::Color3f( 0.588f, 0.588f, 0.804f ), "Pipe Color", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", false, "Well Cells", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Well Cell Fence", "", "", "");
|
||||
CAF_PDM_InitField( &showWellCells, "ShowWellCells", false, "Well Cells", "", "", "" );
|
||||
CAF_PDM_InitField( &showWellCellFence, "ShowWellCellFence", false, "Well Cell Fence", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&simwellFractureCollection, "FractureCollection", "Fractures", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault( &simwellFractureCollection, "FractureCollection", "Fractures", "", "", "" );
|
||||
|
||||
name.uiCapability()->setUiHidden(true);
|
||||
name.uiCapability()->setUiReadOnly(true);
|
||||
name.uiCapability()->setUiHidden( true );
|
||||
name.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
m_resultWellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
simwellFractureCollection= new RimSimWellFractureCollection();
|
||||
simwellFractureCollection = new RimSimWellFractureCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSimWellInView::~RimSimWellInView()
|
||||
{
|
||||
if (simwellFractureCollection()) delete simwellFractureCollection();
|
||||
if ( simwellFractureCollection() ) delete simwellFractureCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSimWellInView::userDescriptionField()
|
||||
{
|
||||
@@ -104,34 +102,30 @@ caf::PdmFieldHandle* RimSimWellInView::userDescriptionField()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimSimWellInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
if (reservoirView)
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
if ( reservoirView )
|
||||
{
|
||||
if (&showWellLabel == changedField ||
|
||||
&showWellHead == changedField ||
|
||||
&showWellPipe == changedField ||
|
||||
&showWellSpheres == changedField ||
|
||||
&wellPipeColor == changedField)
|
||||
if ( &showWellLabel == changedField || &showWellHead == changedField || &showWellPipe == changedField ||
|
||||
&showWellSpheres == changedField || &wellPipeColor == changedField )
|
||||
{
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
schedule2dIntersectionViewUpdate();
|
||||
}
|
||||
else if (&showWell == changedField ||
|
||||
&showWellCells == changedField ||
|
||||
&showWellCellFence == changedField)
|
||||
|
||||
else if ( &showWell == changedField || &showWellCells == changedField || &showWellCellFence == changedField )
|
||||
|
||||
{
|
||||
reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
reservoirView->scheduleGeometryRegen( VISIBLE_WELL_CELLS );
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
schedule2dIntersectionViewUpdate();
|
||||
}
|
||||
else if ( &pipeScaleFactor == changedField
|
||||
|| &wellHeadScaleFactor == changedField)
|
||||
else if ( &pipeScaleFactor == changedField || &wellHeadScaleFactor == changedField )
|
||||
{
|
||||
reservoirView->scheduleSimWellGeometryRegen();
|
||||
reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
@@ -140,22 +134,22 @@ void RimSimWellInView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
|
||||
RimSimWellInViewCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
if (wellColl)
|
||||
this->firstAncestorOrThisOfType( wellColl );
|
||||
if ( wellColl )
|
||||
{
|
||||
wellColl->updateStateForVisibilityCheckboxes();
|
||||
|
||||
RiuMainWindow::instance()->refreshDrawStyleActions();
|
||||
}
|
||||
|
||||
if (changedField == &wellPipeColor)
|
||||
if ( changedField == &wellPipeColor )
|
||||
{
|
||||
RimSimWellInViewCollection::updateWellAllocationPlots();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimSimWellInView::objectToggleField()
|
||||
{
|
||||
@@ -163,92 +157,91 @@ caf::PdmFieldHandle* RimSimWellInView::objectToggleField()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<const RigWellPath*> RimSimWellInView::wellPipeBranches() const
|
||||
{
|
||||
RimSimWellInViewCollection* simWellCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(simWellCollection);
|
||||
this->firstAncestorOrThisOfTypeAsserted( simWellCollection );
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType(eclipseCase);
|
||||
if (eclipseCase && eclipseCase->eclipseCaseData())
|
||||
this->firstAncestorOrThisOfType( eclipseCase );
|
||||
if ( eclipseCase && eclipseCase->eclipseCaseData() )
|
||||
{
|
||||
RigEclipseCaseData* caseData = eclipseCase->eclipseCaseData();
|
||||
|
||||
bool includeCellCenters = this->isUsingCellCenterForPipe();
|
||||
bool detectBrances = simWellCollection->isAutoDetectingBranches;
|
||||
|
||||
return caseData->simulationWellBranches(this->name(), includeCellCenters, detectBrances);
|
||||
return caseData->simulationWellBranches( this->name(), includeCellCenters, detectBrances );
|
||||
}
|
||||
return std::vector<const RigWellPath*>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::calculateWellPipeStaticCenterLine(std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds)
|
||||
void RimSimWellInView::calculateWellPipeStaticCenterLine( std::vector<std::vector<cvf::Vec3d>>& pipeBranchesCLCoords,
|
||||
std::vector<std::vector<RigWellResultPoint>>& pipeBranchesCellIds )
|
||||
{
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline(this,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds);
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeStaticCenterline( this,
|
||||
pipeBranchesCLCoords,
|
||||
pipeBranchesCellIds );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// frameIndex = -1 will use the static well frame
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::wellHeadTopBottomPosition(int frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom)
|
||||
void RimSimWellInView::wellHeadTopBottomPosition( int frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom )
|
||||
{
|
||||
|
||||
RimEclipseView* m_rimReservoirView;
|
||||
firstAncestorOrThisOfTypeAsserted(m_rimReservoirView);
|
||||
|
||||
firstAncestorOrThisOfTypeAsserted( m_rimReservoirView );
|
||||
|
||||
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
|
||||
|
||||
const RigWellResultFrame* wellResultFramePtr = nullptr;
|
||||
const RigCell* whCellPtr = nullptr;
|
||||
const RigCell* whCellPtr = nullptr;
|
||||
|
||||
if (frameIndex >= 0)
|
||||
if ( frameIndex >= 0 )
|
||||
{
|
||||
if ( !this->simWellData()->hasAnyValidCells(frameIndex) ) return;
|
||||
if ( !this->simWellData()->hasAnyValidCells( frameIndex ) ) return;
|
||||
|
||||
wellResultFramePtr = &(this->simWellData()->wellResultFrame(frameIndex));
|
||||
whCellPtr = &(rigReservoir->cellFromWellResultCell(wellResultFramePtr->wellHeadOrStartCell()));
|
||||
wellResultFramePtr = &( this->simWellData()->wellResultFrame( frameIndex ) );
|
||||
whCellPtr = &( rigReservoir->cellFromWellResultCell( wellResultFramePtr->wellHeadOrStartCell() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
wellResultFramePtr = &(this->simWellData()->staticWellCells());
|
||||
whCellPtr = &(rigReservoir->cellFromWellResultCell(wellResultFramePtr->wellHeadOrStartCell()));
|
||||
wellResultFramePtr = &( this->simWellData()->staticWellCells() );
|
||||
whCellPtr = &( rigReservoir->cellFromWellResultCell( wellResultFramePtr->wellHeadOrStartCell() ) );
|
||||
}
|
||||
|
||||
const RigCell& whCell = *whCellPtr;
|
||||
|
||||
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
|
||||
|
||||
(*bottom) = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
|
||||
( *bottom ) = whCell.faceCenter( cvf::StructGridInterface::NEG_K );
|
||||
|
||||
// Compute well head based on the z position of the top of the K column the well head is part of
|
||||
(*top) = (*bottom);
|
||||
( *top ) = ( *bottom );
|
||||
if ( m_rimReservoirView->wellCollection()->wellHeadPosition() == RimSimWellInViewCollection::WELLHEAD_POS_TOP_COLUMN )
|
||||
{
|
||||
// Position well head at top active cell of IJ-column
|
||||
|
||||
size_t i, j, k;
|
||||
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
|
||||
rigReservoir->mainGrid()->ijkFromCellIndex( whCell.mainGridCellIndex(), &i, &j, &k );
|
||||
|
||||
size_t kIndexWellHeadCell = k;
|
||||
k = 0;
|
||||
k = 0;
|
||||
|
||||
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
|
||||
while ( k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex) )
|
||||
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK( i, j, k );
|
||||
while ( k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive( topActiveCellIndex ) )
|
||||
{
|
||||
k++;
|
||||
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
|
||||
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK( i, j, k );
|
||||
}
|
||||
|
||||
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
|
||||
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
|
||||
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell( topActiveCellIndex );
|
||||
cvf::Vec3d topCellPos = topActiveCell.faceCenter( cvf::StructGridInterface::NEG_K );
|
||||
|
||||
// Modify position if top active cell is closer to sea than well head
|
||||
if ( kIndexWellHeadCell > k )
|
||||
@@ -267,67 +260,64 @@ void RimSimWellInView::wellHeadTopBottomPosition(int frameIndex, cvf::Vec3d* top
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RimSimWellInView::pipeRadius()
|
||||
{
|
||||
RimEclipseView* reservoirView;
|
||||
firstAncestorOrThisOfTypeAsserted(reservoirView);
|
||||
firstAncestorOrThisOfTypeAsserted( reservoirView );
|
||||
|
||||
RigEclipseCaseData* rigReservoir = reservoirView->eclipseCase()->eclipseCaseData();
|
||||
|
||||
|
||||
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
|
||||
|
||||
double pipeRadius = reservoirView->wellCollection()->pipeScaleFactor() * this->pipeScaleFactor() * characteristicCellSize;
|
||||
double pipeRadius = reservoirView->wellCollection()->pipeScaleFactor() * this->pipeScaleFactor() *
|
||||
characteristicCellSize;
|
||||
|
||||
return pipeRadius;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimSimWellInView::pipeCrossSectionVertexCount()
|
||||
{
|
||||
RimSimWellInViewCollection* simWellCollection = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted(simWellCollection);
|
||||
this->firstAncestorOrThisOfTypeAsserted( simWellCollection );
|
||||
return simWellCollection->pipeCrossSectionVertexCount();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::intersectsDynamicWellCellsFilteredCells(size_t frameIndex) const
|
||||
bool RimSimWellInView::intersectsDynamicWellCellsFilteredCells( size_t frameIndex ) const
|
||||
{
|
||||
if (this->simWellData() == nullptr) return false;
|
||||
if ( this->simWellData() == nullptr ) return false;
|
||||
|
||||
if (!simWellData()->hasWellResult(frameIndex)) return false;
|
||||
if ( !simWellData()->hasWellResult( frameIndex ) ) return false;
|
||||
|
||||
const RigWellResultFrame& wrsf = this->simWellData()->wellResultFrame(frameIndex);
|
||||
const RigWellResultFrame& wrsf = this->simWellData()->wellResultFrame( frameIndex );
|
||||
|
||||
return intersectsWellCellsFilteredCells(wrsf, frameIndex);
|
||||
return intersectsWellCellsFilteredCells( wrsf, frameIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::intersectsWellCellsFilteredCells(const RigWellResultFrame &wrsf, size_t frameIndex) const
|
||||
bool RimSimWellInView::intersectsWellCellsFilteredCells( const RigWellResultFrame& wrsf, size_t frameIndex ) const
|
||||
{
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
if (!reservoirView) return false;
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
if ( !reservoirView ) return false;
|
||||
|
||||
const std::vector<RivCellSetEnum>& visGridParts = reservoirView->visibleGridParts();
|
||||
RivReservoirViewPartMgr* rvMan = reservoirView->reservoirGridPartManager();
|
||||
RivReservoirViewPartMgr* rvMan = reservoirView->reservoirGridPartManager();
|
||||
|
||||
|
||||
for (const RivCellSetEnum& visGridPart : visGridParts)
|
||||
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
|
||||
)
|
||||
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;
|
||||
@@ -335,13 +325,13 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells(const RigWellResultFrame
|
||||
|
||||
// First check the wellhead:
|
||||
|
||||
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
|
||||
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)
|
||||
if ( gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
const cvf::UByteArray* cellVisibility = rvMan->cellVisibility(visGridPart, gridIndex, frameIndex);
|
||||
if (gridCellIndex < cellVisibility->size() && (*cellVisibility)[gridCellIndex])
|
||||
const cvf::UByteArray* cellVisibility = rvMan->cellVisibility( visGridPart, gridIndex, frameIndex );
|
||||
if ( gridCellIndex < cellVisibility->size() && ( *cellVisibility )[gridCellIndex] )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -350,18 +340,18 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells(const RigWellResultFrame
|
||||
// Then check the rest of the well, with all the branches
|
||||
|
||||
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
|
||||
for (const RigWellResultBranch& branchSegment : wellResSegments)
|
||||
for ( const RigWellResultBranch& branchSegment : wellResSegments )
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& wsResCells = branchSegment.m_branchResultPoints;
|
||||
for (const RigWellResultPoint& wellResultPoint : wsResCells)
|
||||
for ( const RigWellResultPoint& wellResultPoint : wsResCells )
|
||||
{
|
||||
if (wellResultPoint.isCell())
|
||||
if ( wellResultPoint.isCell() )
|
||||
{
|
||||
gridIndex = wellResultPoint.m_gridIndex;
|
||||
gridIndex = wellResultPoint.m_gridIndex;
|
||||
gridCellIndex = wellResultPoint.m_gridCellIndex;
|
||||
|
||||
const cvf::UByteArray* cellVisibility = rvMan->cellVisibility(visGridPart, gridIndex, frameIndex);
|
||||
if (gridCellIndex < cellVisibility->size() && (*cellVisibility)[gridCellIndex])
|
||||
const cvf::UByteArray* cellVisibility = rvMan->cellVisibility( visGridPart, gridIndex, frameIndex );
|
||||
if ( gridCellIndex < cellVisibility->size() && ( *cellVisibility )[gridCellIndex] )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -374,23 +364,23 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells(const RigWellResultFrame
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::schedule2dIntersectionViewUpdate()
|
||||
{
|
||||
Rim2dIntersectionView* intersectionView = corresponding2dIntersectionView(this);
|
||||
if (intersectionView)
|
||||
Rim2dIntersectionView* intersectionView = corresponding2dIntersectionView( this );
|
||||
if ( intersectionView )
|
||||
{
|
||||
intersectionView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::intersectsStaticWellCellsFilteredCells() const
|
||||
{
|
||||
if (this->simWellData() == nullptr) return false;
|
||||
if ( this->simWellData() == nullptr ) return false;
|
||||
|
||||
// NOTE: Read out static well cells, union of well cells across all time steps
|
||||
const RigWellResultFrame& wrsf = this->simWellData()->staticWellCells();
|
||||
@@ -398,99 +388,95 @@ bool RimSimWellInView::intersectsStaticWellCellsFilteredCells() const
|
||||
// NOTE: Use first time step for visibility evaluation
|
||||
size_t frameIndex = 0;
|
||||
|
||||
return intersectsWellCellsFilteredCells(wrsf, frameIndex);
|
||||
return intersectsWellCellsFilteredCells( wrsf, frameIndex );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimSimWellInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Visibility");
|
||||
appearanceGroup->add(&showWellLabel);
|
||||
appearanceGroup->add(&showWellHead);
|
||||
appearanceGroup->add(&showWellPipe);
|
||||
appearanceGroup->add(&showWellSpheres);
|
||||
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Well Cells and Fence");
|
||||
filterGroup->add(&showWellCells);
|
||||
filterGroup->add(&showWellCellFence);
|
||||
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup( "Visibility" );
|
||||
appearanceGroup->add( &showWellLabel );
|
||||
appearanceGroup->add( &showWellHead );
|
||||
appearanceGroup->add( &showWellPipe );
|
||||
appearanceGroup->add( &showWellSpheres );
|
||||
|
||||
showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
|
||||
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup("Size Scaling");
|
||||
sizeScalingGroup->add(&wellHeadScaleFactor);
|
||||
sizeScalingGroup->add(&pipeScaleFactor);
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Well Cells and Fence" );
|
||||
filterGroup->add( &showWellCells );
|
||||
filterGroup->add( &showWellCellFence );
|
||||
|
||||
caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup("Colors");
|
||||
colorGroup->add(&wellPipeColor);
|
||||
showWellCellFence.uiCapability()->setUiReadOnly( !showWellCells() );
|
||||
caf::PdmUiGroup* sizeScalingGroup = uiOrdering.addNewGroup( "Size Scaling" );
|
||||
sizeScalingGroup->add( &wellHeadScaleFactor );
|
||||
sizeScalingGroup->add( &pipeScaleFactor );
|
||||
|
||||
uiOrdering.skipRemainingFields(true);
|
||||
caf::PdmUiGroup* colorGroup = uiOrdering.addNewGroup( "Colors" );
|
||||
colorGroup->add( &wellPipeColor );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
void RimSimWellInView::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
for (RimSimWellFracture* fracture : simwellFractureCollection()->simwellFractures())
|
||||
for ( RimSimWellFracture* fracture : simwellFractureCollection()->simwellFractures() )
|
||||
{
|
||||
uiTreeOrdering.add(fracture);
|
||||
uiTreeOrdering.add( fracture );
|
||||
}
|
||||
uiTreeOrdering.skipRemainingChildren(true);
|
||||
uiTreeOrdering.skipRemainingChildren( true );
|
||||
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
if (!reservoirView) return;
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
if ( !reservoirView ) return;
|
||||
|
||||
if (reservoirView->rangeFilterCollection() && !reservoirView->rangeFilterCollection()->hasActiveFilters())
|
||||
if ( reservoirView->rangeFilterCollection() && !reservoirView->rangeFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
this->uiCapability()->setUiReadOnly(false);
|
||||
this->uiCapability()->setUiReadOnly( false );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const RimSimWellInViewCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
if (!wellColl) return;
|
||||
|
||||
if (wellColl->showWellsIntersectingVisibleCells() && !this->intersectsDynamicWellCellsFilteredCells(static_cast<size_t>(reservoirView->currentTimeStep())))
|
||||
const RimSimWellInViewCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType( wellColl );
|
||||
if ( !wellColl ) return;
|
||||
|
||||
if ( wellColl->showWellsIntersectingVisibleCells() &&
|
||||
!this->intersectsDynamicWellCellsFilteredCells( static_cast<size_t>( reservoirView->currentTimeStep() ) ) )
|
||||
{
|
||||
// Mark well as read only if well is not intersecting visible cells
|
||||
|
||||
this->uiCapability()->setUiReadOnly(true);
|
||||
this->uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
this->uiCapability()->setUiReadOnly(false);
|
||||
this->uiCapability()->setUiReadOnly( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::isWellCellsVisible() const
|
||||
{
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
|
||||
if (reservoirView == nullptr) return false;
|
||||
if (this->simWellData() == nullptr) return false;
|
||||
if ( reservoirView == nullptr ) return false;
|
||||
if ( this->simWellData() == nullptr ) return false;
|
||||
|
||||
if (!reservoirView->wellCollection()->isActive())
|
||||
return false;
|
||||
if ( !reservoirView->wellCollection()->isActive() ) return false;
|
||||
|
||||
if (!this->showWell())
|
||||
return false;
|
||||
if ( !this->showWell() ) return false;
|
||||
|
||||
if (!this->showWellCells())
|
||||
return false;
|
||||
if ( !this->showWellCells() ) return false;
|
||||
|
||||
if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
|
||||
return true;
|
||||
if ( reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell( this ) ) return true;
|
||||
|
||||
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells()
|
||||
&& reservoirView->rangeFilterCollection()->hasActiveFilters())
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells() &&
|
||||
reservoirView->rangeFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
return intersectsStaticWellCellsFilteredCells();
|
||||
}
|
||||
@@ -501,45 +487,40 @@ bool RimSimWellInView::isWellCellsVisible() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::isWellPipeVisible(size_t frameIndex) const
|
||||
bool RimSimWellInView::isWellPipeVisible( size_t frameIndex ) const
|
||||
{
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
|
||||
if (reservoirView == nullptr) return false;
|
||||
if (this->simWellData() == nullptr) return false;
|
||||
if ( reservoirView == nullptr ) return false;
|
||||
if ( this->simWellData() == nullptr ) return false;
|
||||
|
||||
if (frameIndex >= this->simWellData()->m_resultTimeStepIndexToWellTimeStepIndex.size())
|
||||
if ( frameIndex >= this->simWellData()->m_resultTimeStepIndexToWellTimeStepIndex.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t wellTimeStepIndex = this->simWellData()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex];
|
||||
if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T)
|
||||
if ( wellTimeStepIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reservoirView->wellCollection()->isActive())
|
||||
return false;
|
||||
if ( !reservoirView->wellCollection()->isActive() ) return false;
|
||||
|
||||
if (!this->showWell())
|
||||
return false;
|
||||
if ( !this->showWell() ) return false;
|
||||
|
||||
if (!this->showWellPipe())
|
||||
return false;
|
||||
if ( !this->showWellPipe() ) return false;
|
||||
|
||||
if ( reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell( this ) ) return true;
|
||||
|
||||
if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
|
||||
return true;
|
||||
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells()
|
||||
&& ( reservoirView->rangeFilterCollection()->hasActiveFilters()
|
||||
|| reservoirView->propertyFilterCollection()->hasActiveFilters()) )
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells() &&
|
||||
( reservoirView->rangeFilterCollection()->hasActiveFilters() ||
|
||||
reservoirView->propertyFilterCollection()->hasActiveFilters() ) )
|
||||
{
|
||||
return intersectsDynamicWellCellsFilteredCells(frameIndex);
|
||||
return intersectsDynamicWellCellsFilteredCells( frameIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -548,43 +529,39 @@ bool RimSimWellInView::isWellPipeVisible(size_t frameIndex) const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::isWellSpheresVisible(size_t frameIndex) const
|
||||
bool RimSimWellInView::isWellSpheresVisible( size_t frameIndex ) const
|
||||
{
|
||||
const RimEclipseView* reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(reservoirView);
|
||||
this->firstAncestorOrThisOfType( reservoirView );
|
||||
|
||||
if (reservoirView == nullptr) return false;
|
||||
if (this->simWellData() == nullptr) return false;
|
||||
if ( reservoirView == nullptr ) return false;
|
||||
if ( this->simWellData() == nullptr ) return false;
|
||||
|
||||
if (frameIndex >= this->simWellData()->m_resultTimeStepIndexToWellTimeStepIndex.size())
|
||||
if ( frameIndex >= this->simWellData()->m_resultTimeStepIndexToWellTimeStepIndex.size() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t wellTimeStepIndex = this->simWellData()->m_resultTimeStepIndexToWellTimeStepIndex[frameIndex];
|
||||
if (wellTimeStepIndex == cvf::UNDEFINED_SIZE_T)
|
||||
if ( wellTimeStepIndex == cvf::UNDEFINED_SIZE_T )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reservoirView->wellCollection()->isActive())
|
||||
return false;
|
||||
if ( !reservoirView->wellCollection()->isActive() ) return false;
|
||||
|
||||
if (!this->showWell())
|
||||
return false;
|
||||
if ( !this->showWell() ) return false;
|
||||
|
||||
if (!this->showWellSpheres())
|
||||
return false;
|
||||
if ( !this->showWellSpheres() ) return false;
|
||||
|
||||
if (reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell(this))
|
||||
return true;
|
||||
if ( reservoirView->crossSectionCollection()->hasActiveIntersectionForSimulationWell( this ) ) return true;
|
||||
|
||||
if (reservoirView->wellCollection()->showWellsIntersectingVisibleCells()
|
||||
&& reservoirView->rangeFilterCollection()->hasActiveFilters())
|
||||
if ( reservoirView->wellCollection()->showWellsIntersectingVisibleCells() &&
|
||||
reservoirView->rangeFilterCollection()->hasActiveFilters() )
|
||||
{
|
||||
return intersectsDynamicWellCellsFilteredCells(frameIndex);
|
||||
return intersectsDynamicWellCellsFilteredCells( frameIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -593,27 +570,27 @@ bool RimSimWellInView::isWellSpheresVisible(size_t frameIndex) const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSimWellInView::isUsingCellCenterForPipe() const
|
||||
{
|
||||
const RimSimWellInViewCollection* wellColl = nullptr;
|
||||
this->firstAncestorOrThisOfType(wellColl);
|
||||
this->firstAncestorOrThisOfType( wellColl );
|
||||
|
||||
return (wellColl && wellColl->wellPipeCoordType() == RimSimWellInViewCollection::WELLPIPE_CELLCENTER);
|
||||
return ( wellColl && wellColl->wellPipeCoordType() == RimSimWellInViewCollection::WELLPIPE_CELLCENTER );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSimWellInView::setSimWellData(RigSimWellData* simWellData, size_t resultWellIndex)
|
||||
void RimSimWellInView::setSimWellData( RigSimWellData* simWellData, size_t resultWellIndex )
|
||||
{
|
||||
m_simWellData = simWellData;
|
||||
m_simWellData = simWellData;
|
||||
m_resultWellIndex = resultWellIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigSimWellData* RimSimWellInView::simWellData()
|
||||
{
|
||||
@@ -621,7 +598,7 @@ RigSimWellData* RimSimWellInView::simWellData()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const RigSimWellData* RimSimWellInView::simWellData() const
|
||||
{
|
||||
@@ -629,7 +606,7 @@ const RigSimWellData* RimSimWellInView::simWellData() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSimWellInView::resultWellIndex() const
|
||||
{
|
||||
@@ -639,20 +616,20 @@ size_t RimSimWellInView::resultWellIndex() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal functions
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim2dIntersectionView* corresponding2dIntersectionView(RimSimWellInView *simWellInView)
|
||||
Rim2dIntersectionView* corresponding2dIntersectionView( RimSimWellInView* simWellInView )
|
||||
{
|
||||
Rim3dView* tdView;
|
||||
simWellInView->firstAncestorOrThisOfType(tdView);
|
||||
simWellInView->firstAncestorOrThisOfType( tdView );
|
||||
|
||||
std::vector<RimIntersectionCollection*> intersectionColls;
|
||||
if (tdView)
|
||||
if ( tdView )
|
||||
{
|
||||
tdView->descendantsIncludingThisOfType(intersectionColls);
|
||||
if (intersectionColls.size() == 1)
|
||||
tdView->descendantsIncludingThisOfType( intersectionColls );
|
||||
if ( intersectionColls.size() == 1 )
|
||||
{
|
||||
for (const auto intersection : intersectionColls[0]->intersections())
|
||||
for ( const auto intersection : intersectionColls[0]->intersections() )
|
||||
{
|
||||
if (intersection->simulationWell() == simWellInView)
|
||||
if ( intersection->simulationWell() == simWellInView )
|
||||
{
|
||||
return intersection->correspondingIntersectionView();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user