Refactor classes in RigWellResultPoint.h

* Move RigWellResultFrame implementation into separate file
Update/correct includes accordingly

* First step of moving attributes from public to private
- Move public members to private and create interface
- Single public member remains due to strong dependency on usage of reference and reference to its object public members

* Second step of moving attributes from public to privatee
- Remove usage of reference directly to attributes. Interface with copy and set.
- Moving attributes in RigWellResultFrame and RigWellResultBranch

* Move class RigWellResultBranch into separate file
This commit is contained in:
Jørgen Herje
2023-04-14 11:00:45 +02:00
committed by GitHub
parent dc4d4022d2
commit 457dc9080f
36 changed files with 653 additions and 999 deletions

View File

@@ -24,6 +24,7 @@
#include "RigFlowDiagResults.h"
#include "RigMainGrid.h"
#include "RigSimWellData.h"
#include "RigWellResultFrame.h"
#include "RigWellResultPoint.h"
#include "RimEclipseResultCase.h"
@@ -178,8 +179,8 @@ std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCell
if ( !simWellData[wIdx]->hasWellResult( timeStepIndex ) ) continue;
const RigWellResultFrame* wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
bool isInjectorWell = ( wellResFrame->m_productionType != RiaDefines::WellProductionType::PRODUCER &&
wellResFrame->m_productionType != RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
bool isInjectorWell = ( wellResFrame->productionType() != RiaDefines::WellProductionType::PRODUCER &&
wellResFrame->productionType() != RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
std::string wellName = simWellData[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding( simWellData[wIdx]->m_wellName ).toStdString();
@@ -187,9 +188,9 @@ std::map<std::string, std::vector<int>> RimFlowDiagSolution::allTracerActiveCell
std::vector<int>& tracerCells = tracersWithCells[wellName];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
for ( const RigWellResultBranch& wBr : wellResFrame->m_wellResultBranches )
for ( const RigWellResultBranch& wBr : wellResFrame->wellResultBranches() )
{
for ( const RigWellResultPoint& wrp : wBr.m_branchResultPoints )
for ( const RigWellResultPoint& wrp : wBr.branchResultPoints() )
{
if ( wrp.isValid() && wrp.isOpen() &&
( ( useInjectors && wrp.flowRate() < 0.0 ) || ( !useInjectors && wrp.flowRate() > 0.0 ) ) )
@@ -241,14 +242,14 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(
tracerStatus = TracerStatusType::CLOSED;
for ( const RigWellResultFrame& wellResFrame : simWellData[wIdx]->m_wellCellsTimeSteps )
{
if ( RiaDefines::isInjector( wellResFrame.m_productionType ) )
if ( RiaDefines::isInjector( wellResFrame.productionType() ) )
{
if ( tracerStatus == TracerStatusType::PRODUCER )
tracerStatus = TracerStatusType::VARYING;
else
tracerStatus = TracerStatusType::INJECTOR;
}
else if ( wellResFrame.m_productionType == RiaDefines::WellProductionType::PRODUCER )
else if ( wellResFrame.productionType() == RiaDefines::WellProductionType::PRODUCER )
{
if ( tracerStatus == TracerStatusType::INJECTOR )
tracerStatus = TracerStatusType::VARYING;
@@ -294,14 +295,14 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
const RigWellResultFrame* wellResFrame = simWellData[wIdx]->wellResultFrame( timeStepIndex );
if ( RiaDefines::isInjector( wellResFrame->m_productionType ) )
if ( RiaDefines::isInjector( wellResFrame->productionType() ) )
{
if ( hasCrossFlowEnding( tracerName ) ) return TracerStatusType::PRODUCER;
return TracerStatusType::INJECTOR;
}
else if ( wellResFrame->m_productionType == RiaDefines::WellProductionType::PRODUCER ||
wellResFrame->m_productionType == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
else if ( wellResFrame->productionType() == RiaDefines::WellProductionType::PRODUCER ||
wellResFrame->productionType() == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
{
if ( hasCrossFlowEnding( tracerName ) ) return TracerStatusType::INJECTOR;

View File

@@ -28,7 +28,7 @@
#include "RigSimWellData.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSimulationWellCoordsAndMD.h"
#include "RigWellResultPoint.h"
#include "RigWellResultFrame.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseTools.h"
@@ -501,7 +501,7 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep( const QString& wellNam
{
const RigWellResultFrame* wellResultFrame = simWellData->wellResultFrame( timeStep );
RiaDefines::WellProductionType prodType = wellResultFrame->m_productionType;
RiaDefines::WellProductionType prodType = wellResultFrame->productionType();
switch ( prodType )
{

View File

@@ -27,6 +27,7 @@
#include "RigSimWellData.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigWellAllocationOverTime.h"
#include "RigWellResultFrame.h"
#include "RimEclipseCaseTools.h"
#include "RimEclipseCellColors.h"

View File

@@ -34,6 +34,7 @@
#include "RigSimWellData.h"
#include "RigWellLogExtractor.h"
#include "RigWellPath.h"
#include "RigWellResultFrame.h"
#include "RigWellResultPoint.h"
#include "RimDataSourceForRftPlt.h"
@@ -409,9 +410,9 @@ public:
const RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
for ( size_t brIdx = 0; brIdx < resFrame->m_wellResultBranches.size(); ++brIdx )
for ( size_t brIdx = 0; brIdx < resFrame->wellResultBranches().size(); ++brIdx )
{
const std::vector<RigWellResultPoint>& branchResPoints = resFrame->m_wellResultBranches[brIdx].m_branchResultPoints;
const std::vector<RigWellResultPoint> branchResPoints = resFrame->branchResultPointsFromBranchIndex( brIdx );
for ( size_t wrpIdx = 0; wrpIdx < branchResPoints.size(); wrpIdx++ )
{
const RigGridBase* grid = mainGrid->gridByIndex( branchResPoints[wrpIdx].gridIndex() );
@@ -447,9 +448,9 @@ public:
m_pipeBranchCLCoords.push_back( intersections[wpExIdx].endPoint );
m_pipeBranchMeasuredDepths.push_back( intersections[wpExIdx].endMD );
const RigWellResultPoint& resPoint = resFrame->m_wellResultBranches[it->second.first].m_branchResultPoints[it->second.second];
const RigWellResultPoint resPoint = resFrame->branchResultPointsFromBranchIndex( it->second.first )[it->second.second];
m_pipeBranchWellResultPoints.push_back( resPoint );
if ( wpExIdx < intersections.size() - 1 )
{
m_pipeBranchWellResultPoints.push_back( RigWellResultPoint() ); // Invalid res point describing the

View File

@@ -42,7 +42,7 @@
#include "RigNNCData.h"
#include "RigSimWellData.h"
#include "RigVirtualPerforationTransmissibilities.h"
#include "RigWellResultPoint.h"
#include "RigWellResultFrame.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimCaseCollection.h"
@@ -426,9 +426,9 @@ const RigVirtualPerforationTransmissibilities* RimEclipseCase::computeAndGetVirt
if ( wellRes->hasWellResult( i ) )
{
for ( const auto& wellResultBranch : wellRes->wellResultFrame( i )->m_wellResultBranches )
for ( const auto& wellResultBranch : wellRes->wellResultFrame( i )->wellResultBranches() )
{
for ( const auto& r : wellResultBranch.m_branchResultPoints )
for ( const auto& r : wellResultBranch.branchResultPoints() )
{
if ( r.isCell() )
{

View File

@@ -38,6 +38,7 @@
#include "RigResultAccessorFactory.h"
#include "RigSimWellData.h"
#include "RigVirtualPerforationTransmissibilities.h"
#include "RigWellResultFrame.h"
#include "RigWellResultPoint.h"
#include "Rim2dIntersectionView.h"
@@ -1689,24 +1690,21 @@ void RimEclipseView::calculateVisibleWellCellsIncFence( cvf::UByteArray* visible
if ( !simWellData ) continue;
const std::vector<RigWellResultFrame>& wellResFrames = simWellData->m_wellCellsTimeSteps;
for ( size_t wfIdx = 0; wfIdx < wellResFrames.size(); ++wfIdx )
for ( const auto& frame : wellResFrames )
{
// Add all the cells from the branches
const std::vector<RigWellResultBranch>& wellResSegments = wellResFrames[wfIdx].m_wellResultBranches;
for ( size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx )
for ( const auto& segment : frame.wellResultBranches() )
{
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
for ( size_t cIdx = 0; cIdx < wsResCells.size(); ++cIdx )
for ( const auto& cell : segment.branchResultPoints() )
{
if ( wsResCells[cIdx].gridIndex() == grid->gridIndex() )
if ( cell.gridIndex() == grid->gridIndex() )
{
if ( !wsResCells[cIdx].isCell() )
if ( !cell.isCell() )
{
continue;
}
size_t gridCellIndex = wsResCells[cIdx].cellIndex();
size_t gridCellIndex = cell.cellIndex();
( *visibleCells )[gridCellIndex] = true;
// Calculate well fence cells

View File

@@ -28,6 +28,7 @@
#include "RigMainGrid.h"
#include "RigSimWellData.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigWellResultFrame.h"
#include "RigWellResultPoint.h"
#include "Rim2dIntersectionView.h"
@@ -331,8 +332,8 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells( const RigWellResultFram
// First check the wellhead:
size_t gridIndex = wrsf->m_wellHead.gridIndex();
size_t gridCellIndex = wrsf->m_wellHead.cellIndex();
size_t gridIndex = wrsf->wellHead().gridIndex();
size_t gridCellIndex = wrsf->wellHead().cellIndex();
if ( gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T )
{
@@ -345,11 +346,10 @@ bool RimSimWellInView::intersectsWellCellsFilteredCells( const RigWellResultFram
// Then check the rest of the well, with all the branches
const std::vector<RigWellResultBranch>& wellResSegments = wrsf->m_wellResultBranches;
const std::vector<RigWellResultBranch> wellResSegments = wrsf->wellResultBranches();
for ( const RigWellResultBranch& branchSegment : wellResSegments )
{
const std::vector<RigWellResultPoint>& wsResCells = branchSegment.m_branchResultPoints;
for ( const RigWellResultPoint& wellResultPoint : wsResCells )
for ( const RigWellResultPoint& wellResultPoint : branchSegment.branchResultPoints() )
{
if ( wellResultPoint.isCell() )
{

View File

@@ -38,7 +38,6 @@
class RigSimWellData;
class RigWellResultFrame;
struct RigWellResultPoint;
class RimSimWellFractureCollection;
class RigWellPath;

View File

@@ -25,7 +25,7 @@
#include "RigEclipseCaseData.h"
#include "RigSimWellData.h"
#include "RigWellResultPoint.h"
#include "RigWellResultFrame.h"
#include "RimEclipseCase.h"
#include "RimEclipseContourMapView.h"
@@ -308,9 +308,9 @@ bool RimSimWellInViewCollection::hasVisibleWellCells()
for ( size_t tIdx = 0; !hasCells && tIdx < well->simWellData()->m_wellCellsTimeSteps.size(); ++tIdx )
{
const RigWellResultFrame& wellResultFrame = well->simWellData()->m_wellCellsTimeSteps[tIdx];
for ( size_t wsIdx = 0; !hasCells && wsIdx < wellResultFrame.m_wellResultBranches.size(); ++wsIdx )
for ( size_t wsIdx = 0; !hasCells && wsIdx < wellResultFrame.wellResultBranches().size(); ++wsIdx )
{
if ( wellResultFrame.m_wellResultBranches[wsIdx].m_branchResultPoints.size() > 0 ) hasCells = true;
if ( !wellResultFrame.branchResultPointsFromBranchIndex( wsIdx ).empty() ) hasCells = true;
}
}
}

View File

@@ -25,7 +25,7 @@
#include "RifSummaryReaderInterface.h"
#include "RigSimWellData.h"
#include "RigWellResultPoint.h"
#include "RigWellResultFrame.h"
#include "Rim3dView.h"
#include "RimEclipseResultCase.h"
@@ -96,7 +96,7 @@ bool RimSimWellInViewTools::isInjector( RimSimWellInView* well )
{
const RigWellResultFrame* wrf = wRes->wellResultFrame( currentTimeStep );
if ( RiaDefines::isInjector( wrf->m_productionType ) )
if ( RiaDefines::isInjector( wrf->productionType() ) )
{
return true;
}
@@ -123,7 +123,7 @@ bool RimSimWellInViewTools::isProducer( RimSimWellInView* well )
{
const RigWellResultFrame* wrf = wRes->wellResultFrame( currentTimeStep );
if ( RiaDefines::WellProductionType::PRODUCER == wrf->m_productionType )
if ( RiaDefines::WellProductionType::PRODUCER == wrf->productionType() )
{
return true;
}

View File

@@ -28,7 +28,7 @@
#include "RigResultAccessorFactory.h"
#include "RigSimWellData.h"
#include "RigTracerPoint.h"
#include "RigWellResultPoint.h"
#include "RigWellResultFrame.h"
#include "RimEclipseCase.h"
#include "RimEclipseInputCase.h"
@@ -405,18 +405,18 @@ void RimStreamlineInViewCollection::findStartCells( int
auto frame = swdata->wellResultFrame( timeIdx );
for ( auto& branch : frame->m_wellResultBranches )
for ( const auto& branch : frame->wellResultBranches() )
{
for ( const auto& point : branch.m_branchResultPoints )
for ( const auto& point : branch.branchResultPoints() )
{
if ( point.isValid() && point.isOpen() )
{
RigCell cell = grids[point.gridIndex()]->cell( point.cellIndex() );
if ( frame->m_productionType == RiaDefines::WellProductionType::PRODUCER )
if ( frame->productionType() == RiaDefines::WellProductionType::PRODUCER )
{
outProducerCells.push_back( std::pair<QString, RigCell>( swdata->m_wellName, cell ) );
}
else if ( frame->m_productionType != RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
else if ( frame->productionType() != RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE )
{
outInjectorCells.push_back( std::pair<QString, RigCell>( swdata->m_wellName, cell ) );
}