From 457dc9080f2c4e9aae39ffd1d858d5e9ead5af1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Herje?= <82032112+jorgenherje@users.noreply.github.com> Date: Fri, 14 Apr 2023 11:00:45 +0200 Subject: [PATCH] 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 --- .../FileInterface/RifReaderEclipseOutput.cpp | 115 ++-- .../RivSimWellPipesPartMgr.cpp | 22 +- .../RivWellConnectionsPartMgr.cpp | 14 +- .../RivWellConnectionsPartMgr.h | 1 - .../ModelVisualization/RivWellDiskPartMgr.cpp | 4 +- .../ModelVisualization/RivWellDiskPartMgr.h | 1 - .../ModelVisualization/RivWellHeadPartMgr.cpp | 22 +- .../RivWellSpheresPartMgr.cpp | 9 +- .../Flow/RimFlowDiagSolution.cpp | 19 +- .../Flow/RimWellAllocationPlot.cpp | 4 +- .../Flow/RimWellConnectivityTable.cpp | 1 + .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 9 +- .../ProjectDataModel/RimEclipseCase.cpp | 6 +- .../ProjectDataModel/RimEclipseView.cpp | 16 +- .../ProjectDataModel/RimSimWellInView.cpp | 10 +- .../ProjectDataModel/RimSimWellInView.h | 1 - .../RimSimWellInViewCollection.cpp | 6 +- .../RimSimWellInViewTools.cpp | 6 +- .../RimStreamlineInViewCollection.cpp | 10 +- .../ReservoirDataModel/CMakeLists_files.cmake | 4 + .../ReservoirDataModel/RigEclipseCaseData.cpp | 18 +- .../RigMswCenterLineCalculator.cpp | 23 +- .../RigMswCenterLineCalculator.h | 2 +- .../RigReservoirBuilderMock.cpp | 38 +- .../ReservoirDataModel/RigSimWellData.cpp | 136 +--- .../RigSimulationWellCenterLineCalculator.cpp | 633 +----------------- .../RigSimulationWellCenterLineCalculator.h | 19 +- .../RigWellResultBranch.cpp | 67 ++ .../ReservoirDataModel/RigWellResultBranch.h | 49 ++ .../ReservoirDataModel/RigWellResultFrame.cpp | 210 ++++++ .../ReservoirDataModel/RigWellResultFrame.h | 67 ++ .../ReservoirDataModel/RigWellResultPoint.cpp | 16 - .../ReservoirDataModel/RigWellResultPoint.h | 44 -- .../SocketInterface/RiaWellDataCommands.cpp | 27 +- .../UserInterface/RiuResultTextBuilder.cpp | 13 +- .../RiaGrpcSimulationWellService.cpp | 10 +- 36 files changed, 653 insertions(+), 999 deletions(-) create mode 100644 ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.h create mode 100644 ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.cpp create mode 100644 ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.h diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp index 8aae1d4947..e0b0dc54e3 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp @@ -44,6 +44,7 @@ #include "RigMainGrid.h" #include "RigNNCData.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include "cafProgressInfo.h" @@ -1553,6 +1554,7 @@ private: std::set m_gridCellsWithSubCellWellConnections; const RigMainGrid* m_mainGrid; }; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1616,8 +1618,8 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo { if ( reportNumbers[i] == reportNr ) { - wellResFrame.m_timestamp = timeSteps[i]; - haveFoundTimeStamp = true; + wellResFrame.setTimestamp( timeSteps[i] ); + haveFoundTimeStamp = true; } } } @@ -1627,34 +1629,34 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo // This fallback will not work for timesteps before 1970. // Also see RifEclipseOutputFileAccess::timeStepsText for accessing time_t structures - time_t stepTime = well_state_get_sim_time( ert_well_state ); - wellResFrame.m_timestamp = QDateTime::fromSecsSinceEpoch( stepTime ); + time_t stepTime = well_state_get_sim_time( ert_well_state ); + wellResFrame.setTimestamp( QDateTime::fromSecsSinceEpoch( stepTime ) ); } // Production type well_type_enum ert_well_type = well_state_get_type( ert_well_state ); if ( ert_well_type == ECL_WELL_PRODUCER ) { - wellResFrame.m_productionType = RiaDefines::WellProductionType::PRODUCER; + wellResFrame.setProductionType( RiaDefines::WellProductionType::PRODUCER ); } else if ( ert_well_type == ECL_WELL_WATER_INJECTOR ) { - wellResFrame.m_productionType = RiaDefines::WellProductionType::WATER_INJECTOR; + wellResFrame.setProductionType( RiaDefines::WellProductionType::WATER_INJECTOR ); } else if ( ert_well_type == ECL_WELL_GAS_INJECTOR ) { - wellResFrame.m_productionType = RiaDefines::WellProductionType::GAS_INJECTOR; + wellResFrame.setProductionType( RiaDefines::WellProductionType::GAS_INJECTOR ); } else if ( ert_well_type == ECL_WELL_OIL_INJECTOR ) { - wellResFrame.m_productionType = RiaDefines::WellProductionType::OIL_INJECTOR; + wellResFrame.setProductionType( RiaDefines::WellProductionType::OIL_INJECTOR ); } else { - wellResFrame.m_productionType = RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE; + wellResFrame.setProductionType( RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ); } - wellResFrame.m_isOpen = well_state_is_open( ert_well_state ); + wellResFrame.setIsOpen( well_state_is_open( ert_well_state ) ); if ( importCompleteMswData && well_state_is_MSW( ert_well_state ) ) { @@ -1678,21 +1680,25 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo const well_conn_type* ert_wellhead = well_state_iget_wellhead( ert_well_state, static_cast( gridNr ) ); if ( ert_wellhead ) { - wellResFrame.m_wellHead = createWellResultPoint( grids[gridNr], ert_wellhead, wellName ); + auto wellHead = createWellResultPoint( grids[gridNr], ert_wellhead, wellName ); // HACK: Ert returns open as "this is equally wrong as closed for well heads". // Well heads are not open jfr mail communication with HHGS and JH Statoil 07.01.2016 - wellResFrame.m_wellHead.setIsOpen( false ); + wellHead.setIsOpen( false ); + wellResFrame.setWellHead( wellHead ); break; } } - well_branch_collection_type* branches = well_state_get_branches( ert_well_state ); - int branchCount = well_branch_collection_get_size( branches ); - wellResFrame.m_wellResultBranches.resize( branchCount ); + well_branch_collection_type* branches = well_state_get_branches( ert_well_state ); + int branchCount = well_branch_collection_get_size( branches ); std::map> segmentIdToPositionContrib; std::vector upperSegmentIdsOfUnpositionedSegementGroup; + // Create copy of well result branches for modification + std::vector wellResultBranches = wellResFrame.wellResultBranches(); + wellResultBranches.resize( branchCount ); + // For each branch, go from bottom segment upwards and transfer their connections to WellResultpoints. // If they have no connections, create a resultpoint representing their bottom position, which will // receive an actual position at a later stage. @@ -1700,12 +1706,12 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo for ( int bIdx = 0; bIdx < well_branch_collection_get_size( branches ); bIdx++ ) { - RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[bIdx]; + RigWellResultBranch& wellResultBranch = wellResultBranches[bIdx]; const well_segment_type* segment = well_branch_collection_iget_start_segment( branches, bIdx ); - int branchId = well_segment_get_branch_id( segment ); - wellResultBranch.m_ertBranchId = branchId; + int branchId = well_segment_get_branch_id( segment ); + wellResultBranch.setErtBranchId( branchId ); // Data for segment position calculation int lastConnectionSegmentId = -1; @@ -1737,7 +1743,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo for ( int connIdx = connectionCount - 1; connIdx >= 0; connIdx-- ) { well_conn_type* ert_connection = well_conn_collection_iget( connections, connIdx ); - wellResultBranch.m_branchResultPoints.push_back( + wellResultBranch.addBranchResultPoint( createWellResultPoint( grids[gridNr], ert_connection, segment, wellName ) ); } @@ -1769,7 +1775,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo RigWellResultPoint data; data.setSegmentData( branchId, well_segment_get_id( segment ) ); - wellResultBranch.m_branchResultPoints.push_back( data ); + wellResultBranch.addBranchResultPoint( data ); // Store data for segment position calculation bool isAnInsolationContribution = accLengthFromLastConnection < lastConnectionCellSize; @@ -1825,7 +1831,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo // Clear all flow in this result point resultPoint.clearAllFlow(); - wellResultBranch.m_branchResultPoints.push_back( resultPoint ); + wellResultBranch.addBranchResultPoint( resultPoint ); outletSegmentHasConnections = true; break; // Stop looping over grids @@ -1838,7 +1844,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo RigWellResultPoint data; data.setSegmentData( well_segment_get_branch_id( outletSegment ), well_segment_get_id( outletSegment ) ); - wellResultBranch.m_branchResultPoints.push_back( data ); + wellResultBranch.addBranchResultPoint( data ); // Store data for segment position calculation, // and propagate it upwards until we meet a segment with connections @@ -1929,27 +1935,30 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo // The centerline calculations would be a bit simpler, I think. } - // Reverse the order of the resultpoints in this branch, making the deepest come last - - std::reverse( wellResultBranch.m_branchResultPoints.begin(), wellResultBranch.m_branchResultPoints.end() ); + // Reverse the order of the result points in this branch, making the deepest come last + auto branchResultPoints = wellResultBranch.branchResultPoints(); + std::reverse( branchResultPoints.begin(), branchResultPoints.end() ); + wellResultBranch.setBranchResultPoints( branchResultPoints ); } // End of the branch loop + // Set modified copy back to frame + wellResFrame.setWellResultBranches( wellResultBranches ); + // Propagate position contributions from connections above unpositioned segments downwards well_segment_collection_type* allErtSegments = well_state_get_segments( ert_well_state ); - for ( size_t bIdx = 0; bIdx < wellResFrame.m_wellResultBranches.size(); ++bIdx ) + bool isWellHead = true; + for ( const auto& wellResultBranch : wellResFrame.wellResultBranches() ) { - RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[bIdx]; - bool previousResultPointWasCell = false; - if ( bIdx == 0 ) previousResultPointWasCell = true; // Wellhead + bool previousResultPointWasCell = isWellHead ? true : false; - // Go downwards until we find a none-cell resultpoint just after a cell-resultpoint + // Go downwards until we find a none-cell result point just after a cell result point // When we do, start propagating - for ( size_t rpIdx = 0; rpIdx < wellResultBranch.m_branchResultPoints.size(); ++rpIdx ) + for ( size_t rpIdx = 0; rpIdx < wellResultBranch.branchResultPoints().size(); ++rpIdx ) { - RigWellResultPoint resPoint = wellResultBranch.m_branchResultPoints[rpIdx]; + const RigWellResultPoint resPoint = wellResultBranch.branchResultPoints()[rpIdx]; if ( resPoint.isCell() ) { previousResultPointWasCell = true; @@ -1959,13 +1968,13 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo if ( previousResultPointWasCell ) { RigWellResultPoint prevResPoint; - if ( bIdx == 0 && rpIdx == 0 ) + if ( isWellHead && rpIdx == 0 ) { - prevResPoint = wellResFrame.m_wellHead; + prevResPoint = wellResFrame.wellHead(); } else { - prevResPoint = wellResultBranch.m_branchResultPoints[rpIdx - 1]; + prevResPoint = wellResultBranch.branchResultPoints()[rpIdx - 1]; } cvf::Vec3d lastConnectionPos = grids[prevResPoint.gridIndex()]->cell( prevResPoint.cellIndex() ).center(); @@ -1992,6 +2001,8 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo previousResultPointWasCell = false; } } + + isWellHead = false; } // Calculate the bottom position of all the unpositioned segments @@ -2005,21 +2016,22 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo ++posContribIt; } - // Distribute the positions to the resultpoints stored in the wellResultBranch.m_branchResultPoints + // Copy content and distribute the positions to the result points stored in the wellResultBranch.branchResultPoints() + // set updated copy back to frame - for ( size_t bIdx = 0; bIdx < wellResFrame.m_wellResultBranches.size(); ++bIdx ) + std::vector newWellResultBranches = wellResFrame.wellResultBranches(); + for ( auto& wellResultBranch : newWellResultBranches ) { - RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches[bIdx]; - for ( size_t rpIdx = 0; rpIdx < wellResultBranch.m_branchResultPoints.size(); ++rpIdx ) + RigWellResultBranch& newWellResultBranch = wellResultBranch; + for ( auto& resultPoint : newWellResultBranch.branchResultPoints() ) { - RigWellResultPoint& resPoint = wellResultBranch.m_branchResultPoints[rpIdx]; - if ( !resPoint.isCell() ) + if ( !resultPoint.isCell() ) { - resPoint.setBottomPosition( bottomPositions[resPoint.segmentId()] ); + resultPoint.setBottomPosition( bottomPositions[resultPoint.segmentId()] ); } } } - + wellResFrame.setWellResultBranches( newWellResultBranches ); } // End of the MSW section else { @@ -2037,7 +2049,7 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo // Well heads are not open jfr mail communication with HHGS and JH Statoil 07.01.2016 wellHeadRp.setIsOpen( false ); - if ( !subCellConnCalc.hasSubCellConnection( wellHeadRp ) ) wellResFrame.m_wellHead = wellHeadRp; + if ( !subCellConnCalc.hasSubCellConnection( wellHeadRp ) ) wellResFrame.setWellHead( wellHeadRp ); } const well_conn_collection_type* connections = @@ -2049,13 +2061,12 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo int connectionCount = well_conn_collection_get_size( connections ); if ( connectionCount ) { - wellResFrame.m_wellResultBranches.push_back( RigWellResultBranch() ); - RigWellResultBranch& wellResultBranch = wellResFrame.m_wellResultBranches.back(); + RigWellResultBranch wellResultBranch; + wellResultBranch.setErtBranchId( 0 ); // Normal wells have only one branch - wellResultBranch.m_ertBranchId = 0; // Normal wells have only one branch - - size_t existingCellCount = wellResultBranch.m_branchResultPoints.size(); - wellResultBranch.m_branchResultPoints.resize( existingCellCount + connectionCount ); + std::vector branchResultPoints = wellResultBranch.branchResultPoints(); + const size_t existingCellCount = branchResultPoints.size(); + branchResultPoints.resize( existingCellCount + connectionCount ); for ( int connIdx = 0; connIdx < connectionCount; connIdx++ ) { @@ -2064,9 +2075,11 @@ void RifReaderEclipseOutput::readWellCells( const ecl_grid_type* mainEclGrid, bo if ( !subCellConnCalc.hasSubCellConnection( wellRp ) ) { - wellResultBranch.m_branchResultPoints[existingCellCount + connIdx] = wellRp; + branchResultPoints[existingCellCount + connIdx] = wellRp; } } + wellResultBranch.setBranchResultPoints( branchResultPoints ); + wellResFrame.addWellResultBranch( wellResultBranch ); } } } diff --git a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp index 6105d6f2b8..75f8dc3a76 100644 --- a/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivSimWellPipesPartMgr.cpp @@ -30,7 +30,7 @@ #include "RigVirtualPerforationTransmissibilities.h" #include "RigWellLogExtractor.h" #include "RigWellPath.h" -#include "RigWellResultPoint.h" +#include "RigWellResultFrame.h" #include "Rim3dView.h" #include "RimCase.h" @@ -335,15 +335,15 @@ void RivSimWellPipesPartMgr::appendVirtualConnectionFactorGeo( const RimEclipseV for ( const auto& intersectionInfo : wellPathCellIntersections ) { - size_t globalCellIndex = intersectionInfo.globCellIndex; - const RigWellResultPoint* wResCell = wResFrame->findResultCellWellHeadIncluded( 0, globalCellIndex ); + size_t globalCellIndex = intersectionInfo.globCellIndex; + const RigWellResultPoint wResCell = wResFrame->findResultCellWellHeadIncluded( 0, globalCellIndex ); - if ( !wResCell || !wResCell->isValid() ) + if ( !wResCell.isValid() ) { continue; } - if ( !virtualPerforationResult->showConnectionFactorsOnClosedConnections() && !wResCell->isOpen() ) + if ( !virtualPerforationResult->showConnectionFactorsOnClosedConnections() && !wResCell.isOpen() ) { continue; } @@ -363,7 +363,7 @@ void RivSimWellPipesPartMgr::appendVirtualConnectionFactorGeo( const RimEclipseV cvf::Vec3d anchor = displayXf->transformToDisplayCoord( domainCoord ); { - CompletionVizData data( anchor, direction, wResCell->connectionFactor(), globalCellIndex ); + CompletionVizData data( anchor, direction, wResCell.connectionFactor(), globalCellIndex ); completionVizDataItems.push_back( data ); } @@ -590,20 +590,20 @@ void RivSimWellPipesPartMgr::updatePipeResultColor( size_t frameIndex ) for ( size_t wcIdx = 0; wcIdx < cellIds.size(); ++wcIdx ) { // we need a faster lookup, I guess - const RigWellResultPoint* wResCell = nullptr; + RigWellResultPoint wResCell; if ( cellIds[wcIdx].isCell() ) { wResCell = wResFrame->findResultCellWellHeadExcluded( cellIds[wcIdx].gridIndex(), cellIds[wcIdx].cellIndex() ); } - if ( wResCell ) + if ( wResCell.isValid() ) { double cellState = defaultState; - if ( wResCell->isOpen() ) + if ( wResCell.isOpen() ) { - switch ( wResFrame->m_productionType ) + switch ( wResFrame->productionType() ) { case RiaDefines::WellProductionType::PRODUCER: cellState = producerState; @@ -647,7 +647,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor( size_t frameIndex ) wellBranch.m_surfaceDrawable->setTextureCoordArray( surfTexCoords.p() ); wellBranch.m_largeSurfaceDrawable->setTextureCoordArray( surfTexCoords.p() ); - if ( wResFrame->m_isOpen ) + if ( wResFrame->isOpen() ) { // Use slightly larger geometry for open wells to avoid z-fighting when two wells are located at the // same position diff --git a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp index 4b578021c8..965dbd81b7 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp @@ -28,7 +28,7 @@ #include "RigFlowDiagResults.h" #include "RigMainGrid.h" #include "RigSimWellData.h" -#include "RigWellResultPoint.h" +#include "RigWellResultFrame.h" #include "cafDisplayCoordTransform.h" #include "cafEffectGenerator.h" @@ -65,11 +65,11 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBas if ( !m_rimReservoirView->eclipseCase() ) return; if ( !m_rimWell->showWell() ) return; if ( !m_rimWell->simWellData()->hasWellResult( frameIndex ) ) return; - if ( !m_rimWell->simWellData()->wellResultFrame( frameIndex )->m_isOpen ) return; - if ( m_rimWell->simWellData()->wellResultFrame( frameIndex )->m_productionType == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ) + if ( !m_rimWell->simWellData()->wellResultFrame( frameIndex )->isOpen() ) return; + if ( m_rimWell->simWellData()->wellResultFrame( frameIndex )->productionType() == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ) return; - bool isProducer = ( m_rimWell->simWellData()->wellResultFrame( frameIndex )->m_productionType == RiaDefines::WellProductionType::PRODUCER ); + bool isProducer = ( m_rimWell->simWellData()->wellResultFrame( frameIndex )->productionType() == RiaDefines::WellProductionType::PRODUCER ); double pipeRadius = m_rimWell->pipeRadius(); cvf::Vec3d wellHeadTop; @@ -132,13 +132,13 @@ void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBas { if ( otherWell == m_rimWell ) continue; if ( !otherWell->simWellData()->hasWellResult( frameIndex ) ) continue; - if ( !otherWell->simWellData()->wellResultFrame( frameIndex )->m_isOpen ) continue; - if ( otherWell->simWellData()->wellResultFrame( frameIndex )->m_productionType == + if ( !otherWell->simWellData()->wellResultFrame( frameIndex )->isOpen() ) continue; + if ( otherWell->simWellData()->wellResultFrame( frameIndex )->productionType() == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ) continue; bool isOtherProducer = - ( otherWell->simWellData()->wellResultFrame( frameIndex )->m_productionType == RiaDefines::WellProductionType::PRODUCER ); + ( otherWell->simWellData()->wellResultFrame( frameIndex )->productionType() == RiaDefines::WellProductionType::PRODUCER ); { std::string otherWellName = otherWell->name().toStdString(); diff --git a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.h b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.h index a31681c6bc..d9d0dd2f6f 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.h @@ -35,7 +35,6 @@ class DrawableGeo; class Part; } // namespace cvf -class RigWellResultFrame; class RimEclipseView; class RimSimWellInView; class RivPipeGeometryGenerator; diff --git a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp index e08a603164..d2e312a7e9 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.cpp @@ -24,7 +24,7 @@ #include "RigActiveCellInfo.h" #include "RigCell.h" #include "RigSimWellData.h" -#include "RigWellResultPoint.h" +#include "RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" @@ -99,7 +99,7 @@ void RivWellDiskPartMgr::buildWellDiskParts( size_t frameIndex, const caf::Displ if ( !well->simWellData()->hasWellResult( frameIndex ) ) return; - auto productionType = well->simWellData()->wellResultFrame( frameIndex )->m_productionType; + auto productionType = well->simWellData()->wellResultFrame( frameIndex )->productionType(); double pipeRadius = m_rimWell->pipeRadius(); unsigned int numSectors = 100; diff --git a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.h b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.h index d7a482083c..ed2b286acf 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivWellDiskPartMgr.h @@ -46,7 +46,6 @@ enum class WellProductionType : short; class Rim3dView; class RimSimWellInView; class RimSimWellInViewCollection; -class RigWellResultFrame; class RivWellDiskPartMgr : public cvf::Object { diff --git a/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp index f7c93c5b38..2b150bb75f 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellHeadPartMgr.cpp @@ -27,7 +27,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigSimWellData.h" -#include "RigWellResultPoint.h" +#include "RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" @@ -110,7 +110,7 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t frameIndex, const caf::Displ double pipeRadius = m_rimWell->pipeRadius(); int pipeCrossSectionVxCount = m_rimWell->pipeCrossSectionVertexCount(); - if ( wellResultFrame->m_isOpen ) + if ( wellResultFrame->isOpen() ) { // Use slightly larger well head arrow when well is open pipeRadius *= 1.1; @@ -178,7 +178,7 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t frameIndex, const caf::Displ double arrowLength = characteristicCellSize * simWellInViewCollection()->wellHeadScaleFactor() * m_rimWell->wellHeadScaleFactor(); - if ( wellResultFrame->m_isOpen ) + if ( wellResultFrame->isOpen() ) { // Use slightly larger well head arrow when well is open arrowLength = 1.1 * arrowLength; @@ -188,13 +188,13 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t frameIndex, const caf::Displ textPosition.z() += 1.2 * arrowLength; cvf::Mat4f matr; - if ( wellResultFrame->m_productionType != RiaDefines::WellProductionType::PRODUCER ) + if ( wellResultFrame->productionType() != RiaDefines::WellProductionType::PRODUCER ) { matr = cvf::Mat4f::fromRotation( cvf::Vec3f( 1.0f, 0.0f, 0.0f ), cvf::Math::toRadians( 180.0f ) ); } double ijScaleFactor = arrowLength / 6; - if ( wellResultFrame->m_isOpen ) + if ( wellResultFrame->isOpen() ) { ijScaleFactor *= 1.1; } @@ -202,7 +202,7 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t frameIndex, const caf::Displ matr( 1, 1 ) *= ijScaleFactor; matr( 2, 2 ) *= arrowLength; - if ( wellResultFrame->m_productionType != RiaDefines::WellProductionType::PRODUCER ) + if ( wellResultFrame->productionType() != RiaDefines::WellProductionType::PRODUCER ) { arrowPosition.z() += arrowLength; } @@ -248,21 +248,21 @@ void RivWellHeadPartMgr::buildWellHeadParts( size_t frameIndex, const caf::Displ if ( wellColl && wellColl->showConnectionStatusColors() ) { - if ( wellResultFrame->m_isOpen ) + if ( wellResultFrame->isOpen() ) { - if ( wellResultFrame->m_productionType == RiaDefines::WellProductionType::PRODUCER ) + if ( wellResultFrame->productionType() == RiaDefines::WellProductionType::PRODUCER ) { headColor = cvf::Color4f( cvf::Color3::GREEN ); } - else if ( wellResultFrame->m_productionType == RiaDefines::WellProductionType::OIL_INJECTOR ) + else if ( wellResultFrame->productionType() == RiaDefines::WellProductionType::OIL_INJECTOR ) { headColor = cvf::Color4f( cvf::Color3::ORANGE ); } - else if ( wellResultFrame->m_productionType == RiaDefines::WellProductionType::GAS_INJECTOR ) + else if ( wellResultFrame->productionType() == RiaDefines::WellProductionType::GAS_INJECTOR ) { headColor = cvf::Color4f( cvf::Color3::RED ); } - else if ( wellResultFrame->m_productionType == RiaDefines::WellProductionType::WATER_INJECTOR ) + else if ( wellResultFrame->productionType() == RiaDefines::WellProductionType::WATER_INJECTOR ) { headColor = cvf::Color4f( cvf::Color3::BLUE ); } diff --git a/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp index c46beeba10..95f5496cce 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -22,6 +22,7 @@ #include "RigMainGrid.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include "RimEclipseCase.h" @@ -84,9 +85,9 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBasicLi std::vector> centerColorPairs; - for ( const RigWellResultBranch& wellResultBranch : wellResultFrame->m_wellResultBranches ) + for ( const RigWellResultBranch& wellResultBranch : wellResultFrame->wellResultBranches() ) { - for ( const RigWellResultPoint& wellResultPoint : wellResultBranch.m_branchResultPoints ) + for ( const RigWellResultPoint& wellResultPoint : wellResultBranch.branchResultPoints() ) { size_t gridIndex = wellResultPoint.gridIndex(); @@ -111,7 +112,7 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel( cvf::ModelBasicLi if ( !centerColorPairs.empty() ) { - cvf::ref part = createPart( centerColorPairs, wellResultFrame->m_isOpen ); + cvf::ref part = createPart( centerColorPairs, wellResultFrame->isOpen() ); model->addPart( part.p() ); } } @@ -209,7 +210,7 @@ cvf::Color3f RivWellSpheresPartMgr::wellCellColor( const RigWellResultFrame* wel { if ( wellResultPoint.isOpen() ) { - switch ( wellResultFrame->m_productionType ) + switch ( wellResultFrame->productionType() ) { case RiaDefines::WellProductionType::PRODUCER: cellColor = cvf::Color3f::GREEN; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp index 72a0bfac59..941f1bc6cf 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp @@ -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> 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> RimFlowDiagSolution::allTracerActiveCell std::vector& tracerCells = tracersWithCells[wellName]; std::vector& 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; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 3e624616e7..d7e2f2fc50 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -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 ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp index 48064882d5..b535404944 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp @@ -27,6 +27,7 @@ #include "RigSimWellData.h" #include "RigSimulationWellCenterLineCalculator.h" #include "RigWellAllocationOverTime.h" +#include "RigWellResultFrame.h" #include "RimEclipseCaseTools.h" #include "RimEclipseCellColors.h" diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index e9e876ad71..17b2009665 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -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& branchResPoints = resFrame->m_wellResultBranches[brIdx].m_branchResultPoints; + const std::vector 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 diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index d1009398f1..75e3a83b37 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -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() ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index b007df4846..513818c7fc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -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& 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& wellResSegments = wellResFrames[wfIdx].m_wellResultBranches; - for ( size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx ) + for ( const auto& segment : frame.wellResultBranches() ) { - const std::vector& 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 diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp index 734f261718..2ca00a9a1b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp @@ -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& wellResSegments = wrsf->m_wellResultBranches; + const std::vector wellResSegments = wrsf->wellResultBranches(); for ( const RigWellResultBranch& branchSegment : wellResSegments ) { - const std::vector& wsResCells = branchSegment.m_branchResultPoints; - for ( const RigWellResultPoint& wellResultPoint : wsResCells ) + for ( const RigWellResultPoint& wellResultPoint : branchSegment.branchResultPoints() ) { if ( wellResultPoint.isCell() ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h index 16d8b0cf25..73fb48ede2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.h @@ -38,7 +38,6 @@ class RigSimWellData; class RigWellResultFrame; -struct RigWellResultPoint; class RimSimWellFractureCollection; class RigWellPath; diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index d125bd6921..2edb81f32b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -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; } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp index 5abf18ba52..0f58e3be0c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp @@ -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; } diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index 1705613d30..963d028c52 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -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( 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( swdata->m_wellName, cell ) ); } diff --git a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake index 1158abc83a..c9e54322b6 100644 --- a/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ReservoirDataModel/CMakeLists_files.cmake @@ -90,6 +90,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RigPressureDepthData.h ${CMAKE_CURRENT_LIST_DIR}/RigMswCenterLineCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RigWellAllocationOverTime.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultBranch.h + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultFrame.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -177,6 +179,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RigPressureDepthData.cpp ${CMAKE_CURRENT_LIST_DIR}/RigMswCenterLineCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RigWellAllocationOverTime.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultBranch.cpp + ${CMAKE_CURRENT_LIST_DIR}/RigWellResultFrame.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp index 0cf5b17899..c045a1236d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseCaseData.cpp @@ -33,6 +33,7 @@ #include "RigSimulationWellCoordsAndMD.h" #include "RigVirtualPerforationTransmissibilities.h" #include "RigWellPath.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include @@ -241,22 +242,17 @@ void RigEclipseCaseData::computeWellCellsPrGrid() RigWellResultFrame& wellCells = m_simWellData[wIdx]->m_wellCellsTimeSteps[tIdx]; // Well result branches - for ( size_t sIdx = 0; sIdx < wellCells.m_wellResultBranches.size(); ++sIdx ) + for ( const auto& wellSegment : wellCells.wellResultBranches() ) { - RigWellResultBranch& wellSegment = wellCells.m_wellResultBranches[sIdx]; - - size_t cdIdx; - for ( cdIdx = 0; cdIdx < wellSegment.m_branchResultPoints.size(); ++cdIdx ) + for ( const auto& resultPoint : wellSegment.branchResultPoints() ) { - size_t gridIndex = wellSegment.m_branchResultPoints[cdIdx].gridIndex(); - size_t gridCellIndex = wellSegment.m_branchResultPoints[cdIdx].cellIndex(); - + size_t gridIndex = resultPoint.gridIndex(); + size_t gridCellIndex = resultPoint.cellIndex(); if ( gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size() ) { // NOTE : We do not check if the grid cell is active as we do for well head. - // If we add test for active cell, thorough testing and verification of the new behaviour must - // be adressed - + // If we add test for active cell, thorough testing and verification of the new behavior must + // be addressed m_wellCellsInGrid[gridIndex]->set( gridCellIndex, true ); m_gridCellToResultWellIndex[gridIndex]->set( gridCellIndex, static_cast( wIdx ) ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp index 178464750c..7d220cfe9c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.cpp @@ -25,6 +25,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" @@ -80,8 +81,8 @@ std::vector wellFramePtr = wellResults->wellResultFrame( timeStepIndex ); } - const RigWellResultFrame& wellFrame = *wellFramePtr; - const std::vector& resultBranches = wellFrame.m_wellResultBranches; + const RigWellResultFrame& wellFrame = *wellFramePtr; + const std::vector resultBranches = wellFrame.wellResultBranches(); std::vector wellBranches = mergeShortBranchesIntoLongBranches( resultBranches ); @@ -89,18 +90,18 @@ std::vector for ( const auto& resultBranch : resultBranches ) { - if ( resultBranch.m_branchResultPoints.empty() ) continue; + if ( resultBranch.branchResultPoints().empty() ) continue; - const auto firstResultPoint = resultBranch.m_branchResultPoints.front(); + const RigWellResultPoint firstResultPoint = resultBranch.branchResultPoints().front(); for ( auto& wellBranch : wellBranches ) { - if ( wellBranch.m_branchId == resultBranch.m_ertBranchId ) + if ( wellBranch.m_branchId == resultBranch.ertBranchId() ) { - if ( firstResultPoint.branchId() == resultBranch.m_ertBranchId ) + if ( firstResultPoint.branchId() == resultBranch.ertBranchId() ) { // The first result point is on the same branch, use well head as outlet - RigWellResultPoint outletResultPoint = wellFrame.m_wellHead; + RigWellResultPoint outletResultPoint = wellFrame.wellHead(); auto gridAndCellIndex = std::make_pair( outletResultPoint.gridIndex(), outletResultPoint.cellIndex() ); wellBranch.m_segmentsWithGridCells[outletResultPoint.segmentId()].push_back( gridAndCellIndex ); @@ -157,7 +158,7 @@ std::vector RigWellResultPoint resPoint; for ( const auto& resBranch : resultBranches ) { - for ( const auto& respoint : resBranch.m_branchResultPoints ) + for ( const auto& respoint : resBranch.branchResultPoints() ) { if ( respoint.segmentId() == firstSegment ) { @@ -301,9 +302,9 @@ std::vector for ( const auto& resultBranch : resBranches ) { WellBranch branch; - branch.m_branchId = resultBranch.m_ertBranchId; + branch.m_branchId = resultBranch.ertBranchId(); - for ( const auto& resPoint : resultBranch.m_branchResultPoints ) + for ( const auto& resPoint : resultBranch.branchResultPoints() ) { size_t gridIndex = resPoint.gridIndex(); size_t gridCellIndex = resPoint.cellIndex(); @@ -318,7 +319,7 @@ std::vector } const int resultPointThreshold = 3; - if ( resultBranch.m_branchResultPoints.size() > resultPointThreshold ) + if ( resultBranch.branchResultPoints().size() > resultPointThreshold ) { longWellBranches.push_back( branch ); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.h b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.h index 07d453f16b..345b0ceb46 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.h +++ b/ApplicationLibCode/ReservoirDataModel/RigMswCenterLineCalculator.h @@ -18,7 +18,7 @@ #pragma once -#include "RigWellResultPoint.h" +#include "RigWellResultBranch.h" #include "cvfVector3.h" diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 3c6b05a29c..a5e8b5b866 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -26,9 +26,10 @@ #include "RigMainGrid.h" #include "RigNNCData.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" +#include "RigWellResultPoint.h" /* rand example: guess the number */ -#include "RigWellResultPoint.h" #include #include #include @@ -393,11 +394,13 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG { RigWellResultFrame& wellCells = wellCellsTimeHistory->m_wellCellsTimeSteps[timeIdx]; - wellCells.m_productionType = RiaDefines::WellProductionType::PRODUCER; - wellCells.m_isOpen = true; + wellCells.setProductionType( RiaDefines::WellProductionType::PRODUCER ); + wellCells.setIsOpen( true ); - wellCells.m_wellHead.setGridIndex( 0 ); - wellCells.m_wellHead.setGridCellIndex( grid->cellIndexFromIJK( 1, 0, 0 ) ); + auto wellHead = wellCells.wellHead(); + wellHead.setGridIndex( 0 ); + wellHead.setGridCellIndex( grid->cellIndexFromIJK( 1, 0, 0 ) ); + wellCells.setWellHead( wellHead ); // Connections // int connectionCount = std::min(dim.x(), std::min(dim.y(), dim.z())) - 2; @@ -405,8 +408,9 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG if ( connectionCount > 0 ) { // Only main grid supported by now. Must be taken care of when LGRs are supported - wellCells.m_wellResultBranches.resize( 1 ); - RigWellResultBranch& wellSegment = wellCells.m_wellResultBranches[0]; + auto newWellResultBranches = wellCells.wellResultBranches(); + newWellResultBranches.resize( 1 ); + RigWellResultBranch& wellSegment = newWellResultBranches[0]; size_t connIdx; for ( connIdx = 0; connIdx < connectionCount; connIdx++ ) @@ -430,10 +434,9 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG data.setIsOpen( false ); } - if ( wellSegment.m_branchResultPoints.size() == 0 || - wellSegment.m_branchResultPoints.back().cellIndex() != data.cellIndex() ) + if ( wellSegment.branchResultPoints().empty() || wellSegment.branchResultPoints().back().cellIndex() != data.cellIndex() ) { - wellSegment.m_branchResultPoints.push_back( data ); + wellSegment.addBranchResultPoint( data ); if ( connIdx == connectionCount / 2 ) { @@ -445,13 +448,13 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG deadEndData1.setGridCellIndex( data.cellIndex() + 2 ); deadEndData1.setIsOpen( false ); - wellSegment.m_branchResultPoints.push_back( deadEndData ); - wellSegment.m_branchResultPoints.push_back( deadEndData1 ); + wellSegment.addBranchResultPoint( deadEndData ); + wellSegment.addBranchResultPoint( deadEndData1 ); - wellSegment.m_branchResultPoints.push_back( deadEndData ); + wellSegment.addBranchResultPoint( deadEndData ); data.setIsOpen( true ); - wellSegment.m_branchResultPoints.push_back( data ); + wellSegment.addBranchResultPoint( data ); } } @@ -459,13 +462,14 @@ void RigReservoirBuilderMock::addWellData( RigEclipseCaseData* eclipseCase, RigG { data.setGridCellIndex( grid->cellIndexFromIJK( 1, 1 + connIdx, 2 + connIdx ) ); - if ( wellSegment.m_branchResultPoints.size() == 0 || - wellSegment.m_branchResultPoints.back().cellIndex() != data.cellIndex() ) + if ( wellSegment.branchResultPoints().empty() || + wellSegment.branchResultPoints().back().cellIndex() != data.cellIndex() ) { - wellSegment.m_branchResultPoints.push_back( data ); + wellSegment.addBranchResultPoint( data ); } } } + wellCells.setWellResultBranches( newWellResultBranches ); } } diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp b/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp index accfd4d308..3fa73617dc 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigSimWellData.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include @@ -60,7 +61,7 @@ void RigSimWellData::computeMappingFromResultTimeIndicesToWellTimeIndices( const qDebug() << "Well TimeStamps"; for ( size_t i = 0; i < m_wellCellsTimeSteps.size(); i++ ) { - qDebug() << m_wellCellsTimeSteps[i].m_timestamp.toString(); + qDebug() << m_wellCellsTimeSteps[i].timestamp().toString(); } qDebug() << "Result TimeStamps"; @@ -74,13 +75,13 @@ void RigSimWellData::computeMappingFromResultTimeIndicesToWellTimeIndices( const for ( size_t resultTimeStepIndex = 0; resultTimeStepIndex < simulationTimeSteps.size(); resultTimeStepIndex++ ) { while ( wellTimeStepIndex < m_wellCellsTimeSteps.size() && - m_wellCellsTimeSteps[wellTimeStepIndex].m_timestamp < simulationTimeSteps[resultTimeStepIndex] ) + m_wellCellsTimeSteps[wellTimeStepIndex].timestamp() < simulationTimeSteps[resultTimeStepIndex] ) { wellTimeStepIndex++; } if ( wellTimeStepIndex < m_wellCellsTimeSteps.size() && - m_wellCellsTimeSteps[wellTimeStepIndex].m_timestamp == simulationTimeSteps[resultTimeStepIndex] ) + m_wellCellsTimeSteps[wellTimeStepIndex].timestamp() == simulationTimeSteps[resultTimeStepIndex] ) { m_resultTimeStepIndexToWellTimeStepIndex[resultTimeStepIndex] = wellTimeStepIndex; } @@ -120,15 +121,14 @@ bool RigSimWellData::hasAnyValidCells( size_t resultTimeStepIndex ) const if ( wellTimeStepIndex == cvf::UNDEFINED_SIZE_T ) return false; - if ( wellResultFrame( resultTimeStepIndex )->m_wellHead.isCell() ) return true; + if ( wellResultFrame( resultTimeStepIndex )->wellHead().isCell() ) return true; - const std::vector& resBranches = wellResultFrame( resultTimeStepIndex )->m_wellResultBranches; - - for ( size_t i = 0; i < resBranches.size(); ++i ) + const std::vector resBranches = wellResultFrame( resultTimeStepIndex )->wellResultBranches(); + for ( const auto& branch : resBranches ) { - for ( size_t cIdx = 0; cIdx < resBranches[i].m_branchResultPoints.size(); ++cIdx ) + for ( const auto& branchResPoint : branch.branchResultPoints() ) { - if ( resBranches[i].m_branchResultPoints[cIdx].isCell() ) return true; + if ( branchResPoint.isCell() ) return true; } } @@ -156,28 +156,31 @@ void RigSimWellData::computeStaticWellCellPath() const std::map> staticWellBranches; // Add ResultCell data from the first timestep to the final result. - - for ( size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[0].m_wellResultBranches.size(); ++bIdx ) + for ( const auto& wellResultBranch : m_wellCellsTimeSteps[0].wellResultBranches() ) { - int branchErtId = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_ertBranchId; - const std::vector& frameCells = m_wellCellsTimeSteps[0].m_wellResultBranches[bIdx].m_branchResultPoints; + const int branchErtId = wellResultBranch.ertBranchId(); + std::list& branch = staticWellBranches[branchErtId]; - std::list& branch = staticWellBranches[branchErtId]; - - for ( size_t cIdx = 0; cIdx < frameCells.size(); ++cIdx ) + for ( const auto& frameCell : wellResultBranch.branchResultPoints() ) { - branch.push_back( frameCells[cIdx] ); + branch.push_back( frameCell ); } } - for ( size_t tIdx = 1; tIdx < m_wellCellsTimeSteps.size(); ++tIdx ) + bool doSkipTimeStep = true; + for ( const auto& wellCellsTimeStep : m_wellCellsTimeSteps ) { - // Merge well branches separately - - for ( size_t bIdx = 0; bIdx < m_wellCellsTimeSteps[tIdx].m_wellResultBranches.size(); ++bIdx ) + if ( doSkipTimeStep ) // Skip first { - int branchId = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_ertBranchId; - const std::vector& resBranch = m_wellCellsTimeSteps[tIdx].m_wellResultBranches[bIdx].m_branchResultPoints; + doSkipTimeStep = false; + continue; + } + + // Merge well branches separately + for ( const auto& wellResultBranch : wellCellsTimeStep.wellResultBranches() ) + { + const int branchId = wellResultBranch.ertBranchId(); + const std::vector resBranch = wellResultBranch.branchResultPoints(); std::list& stBranch = staticWellBranches[branchId]; std::list::iterator sEndIt; @@ -270,25 +273,21 @@ void RigSimWellData::computeStaticWellCellPath() const // Populate the static well info - std::map>::iterator bIt; + m_staticWellCells->clearWellResultBranches(); + m_staticWellCells->setWellHead( m_wellCellsTimeSteps[0].wellHead() ); - m_staticWellCells->m_wellResultBranches.clear(); - m_staticWellCells->m_wellHead = m_wellCellsTimeSteps[0].m_wellHead; - - for ( bIt = staticWellBranches.begin(); bIt != staticWellBranches.end(); ++bIt ) + for ( const auto& [ertBranchId, resultPoints] : staticWellBranches ) { // Copy from first time step RigWellResultBranch rigBranch; - rigBranch.m_ertBranchId = bIt->first; + rigBranch.setErtBranchId( ertBranchId ); - std::list& branch = bIt->second; - std::list::iterator cIt; - for ( cIt = branch.begin(); cIt != branch.end(); ++cIt ) + for ( const auto& resultPoint : resultPoints ) { - rigBranch.m_branchResultPoints.push_back( *cIt ); + rigBranch.addBranchResultPoint( resultPoint ); } - m_staticWellCells->m_wellResultBranches.push_back( rigBranch ); + m_staticWellCells->addWellResultBranch( rigBranch ); } } @@ -316,7 +315,7 @@ RiaDefines::WellProductionType RigSimWellData::wellProductionType( size_t result if ( hasWellResult( resultTimeStepIndex ) ) { const RigWellResultFrame* wResFrame = wellResultFrame( resultTimeStepIndex ); - return wResFrame->m_productionType; + return wResFrame->productionType(); } else { @@ -330,7 +329,7 @@ RiaDefines::WellProductionType RigSimWellData::wellProductionType( size_t result const RigWellResultFrame* RigSimWellData::staticWellResultFrame() const { // Make sure we have computed the static representation of the well - if ( m_staticWellCells->m_wellResultBranches.size() == 0 ) + if ( m_staticWellCells->wellResultBranches().empty() ) { computeStaticWellCellPath(); } @@ -346,73 +345,10 @@ bool RigSimWellData::isOpen( size_t resultTimeStepIndex ) const if ( hasWellResult( resultTimeStepIndex ) ) { const RigWellResultFrame* wResFrame = wellResultFrame( resultTimeStepIndex ); - return wResFrame->m_isOpen; + return wResFrame->isOpen(); } else { return false; } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const RigWellResultPoint* RigWellResultFrame::findResultCellWellHeadIncluded( size_t gridIndex, size_t gridCellIndex ) const -{ - const RigWellResultPoint* wellResultPoint = findResultCellWellHeadExcluded( gridIndex, gridCellIndex ); - if ( wellResultPoint ) return wellResultPoint; - - // If we could not find the cell among the real connections, we try the wellhead. - // The wellhead does however not have a real connection state, and is rendering using pipe color - // https://github.com/OPM/ResInsight/issues/4328 - - // This behavior was different prior to release 2019.04 and was rendered as a closed connection (gray) - // https://github.com/OPM/ResInsight/issues/712 - - if ( m_wellHead.cellIndex() == gridCellIndex && m_wellHead.gridIndex() == gridIndex ) - { - return &m_wellHead; - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const RigWellResultPoint* RigWellResultFrame::findResultCellWellHeadExcluded( size_t gridIndex, size_t gridCellIndex ) const -{ - CVF_ASSERT( gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T ); - - for ( size_t wb = 0; wb < m_wellResultBranches.size(); ++wb ) - { - for ( size_t wc = 0; wc < m_wellResultBranches[wb].m_branchResultPoints.size(); ++wc ) - { - if ( m_wellResultBranches[wb].m_branchResultPoints[wc].cellIndex() == gridCellIndex && - m_wellResultBranches[wb].m_branchResultPoints[wc].gridIndex() == gridIndex ) - { - return &( m_wellResultBranches[wb].m_branchResultPoints[wc] ); - } - } - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RigWellResultPoint RigWellResultFrame::wellHeadOrStartCell() const -{ - if ( m_wellHead.isCell() ) return m_wellHead; - - for ( const RigWellResultBranch& resBranch : m_wellResultBranches ) - { - for ( const RigWellResultPoint& wrp : resBranch.m_branchResultPoints ) - { - if ( wrp.isCell() ) return wrp; - } - } - - return m_wellHead; // Nothing else to do -} diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp index 5414ba5038..343a981118 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.cpp @@ -26,7 +26,7 @@ #include "RigEclipseCaseData.h" #include "RigMainGrid.h" #include "RigSimWellData.h" -#include "RigWellResultPoint.h" +#include "RigWellResultFrame.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" @@ -233,8 +233,8 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineForTimeSt } #endif - const RigWellResultFrame& wellFrame = *wellFramePtr; - const std::vector& resBranches = wellFrame.m_wellResultBranches; + const RigWellResultFrame& wellFrame = *wellFramePtr; + const std::vector resBranches = wellFrame.wellResultBranches(); // Well head // Match this position with well head position in RivWellHeadPartMgr::buildWellHeadParts() @@ -290,7 +290,7 @@ void RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineForTimeSt // Loop over all the resultPoints in the branch - const std::vector& resBranchCells = resBranches[brIdx].m_branchResultPoints; + const std::vector resBranchCells = resBranches[brIdx].branchResultPoints(); for ( int cIdx = 0; cIdx < static_cast( resBranchCells.size() ); cIdx++ ) // Need int because cIdx can // temporarily end on @@ -554,17 +554,11 @@ void RigSimulationWellCenterLineCalculator::addCellCenterPoints( const RigEclips //-------------------------------------------------------------------------------------------------- bool RigSimulationWellCenterLineCalculator::hasAnyValidDataCells( const RigWellResultBranch& branch ) { - bool hasValidData = false; - for ( size_t cIdx = 0; cIdx < branch.m_branchResultPoints.size(); ++cIdx ) + for ( const auto& branchResultPoint : branch.branchResultPoints() ) { - if ( branch.m_branchResultPoints[cIdx].isValid() ) - { - hasValidData = true; - break; - } + if ( branchResultPoint.isValid() ) return true; } - - return hasValidData; + return false; } //-------------------------------------------------------------------------------------------------- @@ -581,616 +575,3 @@ void RigSimulationWellCenterLineCalculator::finishPipeCenterLine( std::vector>>::iterator aBranchLineIt, bool aToFrontOfBranchLine2 ) - : dist( adist ) - , branchLineIt( aBranchLineIt ) - , toFrontOfBranchLine( aToFrontOfBranchLine2 ) - { - } - - double dist; - - std::list>>::iterator branchLineIt; - bool toFrontOfBranchLine; - - bool operator<( const DistToEndPoint& other ) const { return dist < other.dist; } - }; - - auto cmp = []( std::list>>::iterator a, - std::list>>::iterator b ) { return &( *a ) < &( *b ); }; - - std::set>>::iterator, decltype( cmp )> unusedBranchLineIterators( cmp ); - - std::map> resBranchIdxToBranchLineEndPointsDists; - - /// Creating useful lambda functions - - auto buildResBranchToBranchLineEndsDistMap = - [&unusedBranchLineIterators, &resBranchIdxToBranchLineEndPointsDists, this]( const cvf::Vec3d& fromPoint, int resultBranchIndex ) - { - for ( auto it : unusedBranchLineIterators ) - { - { - double dist = calculateFrontToPointDistance( it->second, fromPoint ); - resBranchIdxToBranchLineEndPointsDists[resultBranchIndex].insert( DistToEndPoint( dist, it, true ) ); - } - - { - double dist = calculateEndToPointDistance( it->second, fromPoint ); - resBranchIdxToBranchLineEndPointsDists[resultBranchIndex].insert( DistToEndPoint( dist, it, false ) ); - } - } - }; - - auto removeBranchLineFromDistanceMap = - [&resBranchIdxToBranchLineEndPointsDists]( std::list>>::iterator branchLineToMergeIt ) - { - for ( auto& brIdx_DistToEndPointSet : resBranchIdxToBranchLineEndPointsDists ) - { - std::vector::iterator> iteratorsToErase; - for ( auto it = brIdx_DistToEndPointSet.second.begin(); it != brIdx_DistToEndPointSet.second.end(); ++it ) - { - if ( it->branchLineIt == branchLineToMergeIt ) - { - iteratorsToErase.push_back( it ); - } - } - - for ( auto itToErase : iteratorsToErase ) - brIdx_DistToEndPointSet.second.erase( itToErase ); - } - }; - - // Make the result container ready - - m_branchedWell.m_wellResultBranches.clear(); - m_branchedWell.m_wellResultBranches.push_back( RigWellResultBranch() ); - - // Build set of unused branch lines - - for ( auto brLIt = m_branchLines.begin(); brLIt != m_branchLines.end(); ++brLIt ) - { - if ( brLIt->first ) unusedBranchLineIterators.insert( brLIt ); - } - - // Calculate wellhead to branch line ends distances - { - const RigCell& whCell = m_eclipseCaseData->cellFromWellResultCell( m_orgWellResultFrame.wellHeadOrStartCell() ); - cvf::Vec3d whStartPos = whCell.faceCenter( cvf::StructGridInterface::NEG_K ); - - buildResBranchToBranchLineEndsDistMap( whStartPos, -1 ); - } - - // Add the branchLine closest to wellhead into the result - { - auto closestEndPointIt = resBranchIdxToBranchLineEndPointsDists[-1].begin(); - addBranchLineToLastWellResultBranch( closestEndPointIt->branchLineIt, closestEndPointIt->toFrontOfBranchLine ); - unusedBranchLineIterators.erase( closestEndPointIt->branchLineIt ); - removeBranchLineFromDistanceMap( closestEndPointIt->branchLineIt ); - } - - // Add the branchLines that starts directly from another branchLine - { - for ( auto brLIt = m_branchLines.begin(); brLIt != m_branchLines.end(); ++brLIt ) - { - if ( !brLIt->first ) - { - m_branchedWell.m_wellResultBranches.push_back( RigWellResultBranch() ); - addBranchLineToLastWellResultBranch( brLIt, true ); - } - } - } - - while ( !unusedBranchLineIterators.empty() ) - { - // Calculate distance from end of all currently added result branches to all branch lines - - for ( size_t resultBranchIndex = 0; resultBranchIndex < m_branchedWell.m_wellResultBranches.size(); ++resultBranchIndex ) - { - if ( !resBranchIdxToBranchLineEndPointsDists.count( (int)resultBranchIndex ) && - m_branchedWell.m_wellResultBranches[resultBranchIndex].m_branchResultPoints.size() && - m_branchedWell.m_wellResultBranches[resultBranchIndex].m_branchResultPoints.back().isCell() ) - { - const RigCell& whCell = eclipseCaseData->cellFromWellResultCell( - m_branchedWell.m_wellResultBranches[resultBranchIndex].m_branchResultPoints.back() ); - cvf::Vec3d branchEndPoint = whCell.center(); - - buildResBranchToBranchLineEndsDistMap( branchEndPoint, (int)resultBranchIndex ); - } - } - - // Find the result branch to grow, by finding the one with the closest distance to a branchLine - - int minDistanceBrIdx = -1; - DistToEndPoint closestEndPoint( HUGE_VAL, m_branchLines.end(), true ); - - for ( auto& brIdx_DistToEndPointSet : resBranchIdxToBranchLineEndPointsDists ) - { - if ( brIdx_DistToEndPointSet.second.begin()->dist < closestEndPoint.dist ) - { - minDistanceBrIdx = brIdx_DistToEndPointSet.first; - closestEndPoint = *( brIdx_DistToEndPointSet.second.begin() ); - } - } - - // Grow the result branch with the branchLine - - auto closestEndPointIt = resBranchIdxToBranchLineEndPointsDists[minDistanceBrIdx].begin(); - auto branchLineToAddIt = closestEndPointIt->branchLineIt; - addBranchLineToWellResultBranch( minDistanceBrIdx, branchLineToAddIt, closestEndPointIt->toFrontOfBranchLine ); - - // Remove the branchLine from the control datastructures - - unusedBranchLineIterators.erase( branchLineToAddIt ); - resBranchIdxToBranchLineEndPointsDists.erase( minDistanceBrIdx ); - removeBranchLineFromDistanceMap( branchLineToAddIt ); - } - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - RigWellResultFrame splittedWellResultFrame() { return m_branchedWell; } - -private: - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void addBranchLineToLastWellResultBranch( std::list>>::iterator branchLineIt, bool startAtFront ) - { - addBranchLineToWellResultBranch( static_cast( m_branchedWell.m_wellResultBranches.size() ) - 1, branchLineIt, startAtFront ); - } - - //-------------------------------------------------------------------------------------------------- - /// branchIdx == -1 creates a new branch - //-------------------------------------------------------------------------------------------------- - void addBranchLineToWellResultBranch( int branchIdx, std::list>>::iterator branchLineIt, bool startAtFront ) - { - if ( branchIdx < 0 ) - { - m_branchedWell.m_wellResultBranches.push_back( RigWellResultBranch() ); - branchIdx = static_cast( m_branchedWell.m_wellResultBranches.size() ) - 1; - RigWellResultPoint wellHeadAsPoint; - const RigCell& whCell = m_eclipseCaseData->cellFromWellResultCell( m_orgWellResultFrame.wellHeadOrStartCell() ); - cvf::Vec3d whStartPos = whCell.faceCenter( cvf::StructGridInterface::NEG_K ); - - wellHeadAsPoint.setBottomPosition( whStartPos ); - m_branchedWell.m_wellResultBranches[branchIdx].m_branchResultPoints.push_back( wellHeadAsPoint ); - } - - RigWellResultBranch& currentBranch = m_branchedWell.m_wellResultBranches[branchIdx]; - std::deque wellCellIndices = branchLineIt->second; - if ( !startAtFront ) std::reverse( wellCellIndices.begin(), wellCellIndices.end() ); - - const std::vector& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints; - -#if 1 - if ( wellCellIndices.size() ) - { - if ( !branchLineIt->first ) // Is real branch, with first cell as cell *before* entry point on main branch - { - RigWellResultPoint branchStartAsResultPoint; - const RigCell& branchStartCell = m_eclipseCaseData->cellFromWellResultCell( orgWellResultPoints[wellCellIndices.front()] ); - cvf::Vec3d branchStartPos = branchStartCell.center(); - - if ( wellCellIndices.size() > 1 ) - { - // Use the shared face between the cell before, and the branching cell as start point for the - // branch, to make the pipe "whole" - - cvf::StructGridInterface::FaceType sharedFace = cvf::StructGridInterface::NO_FACE; - m_eclipseCaseData->findSharedSourceFace( sharedFace, - orgWellResultPoints[wellCellIndices[0]], - orgWellResultPoints[wellCellIndices[1]] ); - if ( sharedFace != cvf::StructGridInterface::NO_FACE ) - { - branchStartPos = branchStartCell.faceCenter( sharedFace ); - } - } - - branchStartAsResultPoint.setBottomPosition( branchStartPos ); - m_branchedWell.m_wellResultBranches[branchIdx].m_branchResultPoints.push_back( branchStartAsResultPoint ); - } - else - { - currentBranch.m_branchResultPoints.push_back( orgWellResultPoints[wellCellIndices.front()] ); - } - - for ( size_t i = 1; i < wellCellIndices.size(); ++i ) - { - size_t wcIdx = wellCellIndices[i]; - currentBranch.m_branchResultPoints.push_back( orgWellResultPoints[wcIdx] ); - } - } -#else - for ( size_t wcIdx : wellCellIndices ) - { - currentBranch.m_branchResultPoints.push_back( orgWellResultPoints[wcIdx] ); - } -#endif - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void buildCellSearchTree() - { - const std::vector& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints; - size_t cellCount = orgWellResultPoints.size(); - - m_cellBoundingBoxes.resize( cellCount ); - - const std::vector& nodes = m_eclipseCaseData->mainGrid()->nodes(); - - for ( size_t cIdx = 0; cIdx < cellCount; ++cIdx ) - { - if ( !orgWellResultPoints[cIdx].isCell() ) continue; - const RigCell& wellCell = m_eclipseCaseData->cellFromWellResultCell( orgWellResultPoints[cIdx] ); - - if ( wellCell.isInvalid() ) continue; - - const std::array& cellIndices = wellCell.cornerIndices(); - - cvf::BoundingBox& cellBB = m_cellBoundingBoxes[cIdx]; - - for ( size_t i : cellIndices ) - { - cellBB.add( nodes[i] ); - } - } - - m_cellSearchTree.buildTreeFromBoundingBoxes( m_cellBoundingBoxes, nullptr ); - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void buildCellsToNeighborsMap() - { - const std::vector& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints; - size_t cellCount = orgWellResultPoints.size(); - const std::vector& nodes = m_eclipseCaseData->mainGrid()->nodes(); - double cellSizeI, cellSizeJ, cellSizeK; - m_eclipseCaseData->mainGrid()->characteristicCellSizes( &cellSizeI, &cellSizeJ, &cellSizeK ); - double stdArea = cellSizeK * ( cellSizeI + cellSizeJ ) * 0.5; - - for ( size_t cIdx = 0; cIdx < cellCount; ++cIdx ) - { - std::vector closeCells; - m_cellSearchTree.findIntersections( m_cellBoundingBoxes[cIdx], &closeCells ); - - const RigCell& c1 = m_eclipseCaseData->cellFromWellResultCell( orgWellResultPoints[cIdx] ); - - m_cellsWithNeighbors[cIdx]; // Add an empty set for this cell, in case we have no neighbors - - for ( size_t idxToCloseCell : closeCells ) - { - if ( idxToCloseCell != cIdx && m_cellsWithNeighbors[cIdx].count( idxToCloseCell ) == 0 ) - { - const RigCell& c2 = m_eclipseCaseData->cellFromWellResultCell( orgWellResultPoints[idxToCloseCell] ); - std::vector poygonIndices; - std::vector intersections; - - auto contactFace = RigCellFaceGeometryTools::calculateCellFaceOverlap( c1, - c2, - *( m_eclipseCaseData->mainGrid() ), - &poygonIndices, - &intersections ); - - if ( contactFace != cvf::StructGridInterface::NO_FACE ) - { - std::vector realPolygon; - - for ( size_t pIdx = 0; pIdx < poygonIndices.size(); ++pIdx ) - { - if ( poygonIndices[pIdx] < nodes.size() ) - realPolygon.push_back( nodes[poygonIndices[pIdx]] ); - else - realPolygon.push_back( intersections[poygonIndices[pIdx] - nodes.size()] ); - } - - // Polygon area vector - - cvf::Vec3d area = cvf::GeometryTools::polygonAreaNormal3D( realPolygon ); - - if ( area.length() < 1e-3 * stdArea ) continue; - - m_cellsWithNeighbors[cIdx].insert( idxToCloseCell ); - m_cellsWithNeighbors[idxToCloseCell].insert( cIdx ); - } - } - } - } - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void buildUnusedCellsSet() - { - const std::vector& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints; - size_t cellCount = orgWellResultPoints.size(); - - for ( size_t i = 0; i < cellCount; ++i ) - { - if ( orgWellResultPoints[i].isCell() ) m_unusedWellCellIndices.insert( i ); - } - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void buildBranchLinesOfContinousNeighbourCells() - { - for ( auto& cellWithNeighborsPair : m_cellsWithNeighbors ) - { - auto it = m_unusedWellCellIndices.find( cellWithNeighborsPair.first ); - if ( it != m_unusedWellCellIndices.end() ) - { - m_unusedWellCellIndices.erase( it ); - - // Create a new branchline containing the cell itself. - m_branchLines.push_back( std::make_pair( true, std::deque() ) ); - auto currentBranchLineIt = std::prev( m_branchLines.end() ); - auto& branchList = currentBranchLineIt->second; - - branchList.push_back( cellWithNeighborsPair.first ); - - unsigned endToGrow = 0; // 0 end, 1 front, > 1 new branch - - size_t neighbour = findBestNeighbor( cellWithNeighborsPair.first, cellWithNeighborsPair.second ); - while ( neighbour != cvf::UNDEFINED_SIZE_T ) - { - m_unusedWellCellIndices.erase( neighbour ); - if ( endToGrow == 0 ) - { - branchList.push_back( neighbour ); - growBranchListEnd( currentBranchLineIt ); - endToGrow++; - } - else if ( endToGrow == 1 ) - { - branchList.push_front( neighbour ); - growBranchListFront( currentBranchLineIt ); - endToGrow++; - } - else // if ( endToGrow > 1 ) - { - m_branchLines.push_back( - std::make_pair( false, std::deque{ branchList.front(), cellWithNeighborsPair.first, neighbour } ) ); - auto newBranchLineIt = std::prev( m_branchLines.end() ); - growBranchListEnd( newBranchLineIt ); - if ( newBranchLineIt->second.size() == 3 ) - { - // No real contribution from the branch. - // Put the cell into main stem - // Todo - } - } - - neighbour = findBestNeighbor( cellWithNeighborsPair.first, cellWithNeighborsPair.second ); - } - } - } - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - size_t findBestNeighbor( size_t cell, std::set neighbors ) - { - size_t posKNeighbor = cvf::UNDEFINED_SIZE_T; - size_t firstUnused = cvf::UNDEFINED_SIZE_T; - const std::vector& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints; - - for ( size_t neighbor : neighbors ) - { - if ( m_unusedWellCellIndices.count( neighbor ) ) - { - cvf::StructGridInterface::FaceType sharedFace; - m_eclipseCaseData->findSharedSourceFace( sharedFace, orgWellResultPoints[cell], orgWellResultPoints[neighbor] ); - if ( sharedFace == cvf::StructGridInterface::NEG_K ) return neighbor; - if ( sharedFace == cvf::StructGridInterface::POS_K ) - posKNeighbor = neighbor; - else if ( firstUnused == cvf::UNDEFINED_SIZE_T ) - { - firstUnused = neighbor; - } - } - } - - if ( posKNeighbor != cvf::UNDEFINED_SIZE_T ) - { - return posKNeighbor; - } - else - { - return firstUnused; - } - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void growBranchListEnd( std::list>>::iterator branchListIt ) - { - std::deque& branchList = branchListIt->second; - - CVF_ASSERT( branchList.size() ); - - size_t startCell = branchList.back(); - size_t prevCell = cvf::UNDEFINED_SIZE_T; - size_t startCellPosInStem = branchList.size() - 1; - - if ( branchList.size() > 1 ) prevCell = branchList[branchList.size() - 2]; - - const auto& neighbors = m_cellsWithNeighbors[startCell]; - - size_t nb = findBestNeighbor( startCell, neighbors ); - if ( nb != cvf::UNDEFINED_SIZE_T ) - { - branchList.push_back( nb ); - m_unusedWellCellIndices.erase( nb ); - growBranchListEnd( branchListIt ); - } - - startAndGrowSeparateBranchesFromRestOfNeighbors( startCell, prevCell, neighbors, branchList, startCellPosInStem, true ); - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void startAndGrowSeparateBranchesFromRestOfNeighbors( size_t startCell, - size_t prevCell, - const std::set& neighbors, - std::deque mainStem, - size_t branchPosInMainStem, - bool stemEndIsGrowing ) - { - size_t nb = findBestNeighbor( startCell, neighbors ); - while ( nb != cvf::UNDEFINED_SIZE_T ) - { - if ( prevCell == cvf::UNDEFINED_SIZE_T ) - { - m_branchLines.push_back( std::make_pair( false, std::deque{ startCell, nb } ) ); - } - else - { - m_branchLines.push_back( std::make_pair( false, std::deque{ prevCell, startCell, nb } ) ); - } - - m_unusedWellCellIndices.erase( nb ); - - auto lastBranchIt = std::prev( m_branchLines.end() ); - size_t separateBranchStartSize = lastBranchIt->second.size(); - growBranchListEnd( lastBranchIt ); - - if ( lastBranchIt->second.size() == separateBranchStartSize ) - { - // No use in this branch. - // put cell into main stem instead - if ( stemEndIsGrowing ) - mainStem.insert( mainStem.begin() + branchPosInMainStem, nb ); - else - mainStem.insert( mainStem.end() - branchPosInMainStem, nb ); - m_branchLines.erase( lastBranchIt ); - } - - nb = findBestNeighbor( startCell, neighbors ); - } - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void growBranchListFront( std::list>>::iterator branchListIt ) - { - std::deque& branchList = branchListIt->second; - - CVF_ASSERT( branchList.size() ); - - size_t startCell = branchList.front(); - size_t prevCell = cvf::UNDEFINED_SIZE_T; - size_t startCellPosInStem = branchList.size() - 1; - - if ( branchList.size() > 1 ) prevCell = branchList[1]; - - const auto& neighbors = m_cellsWithNeighbors[startCell]; - - size_t nb = findBestNeighbor( startCell, neighbors ); - if ( nb != cvf::UNDEFINED_SIZE_T ) - { - branchList.push_front( nb ); - m_unusedWellCellIndices.erase( nb ); - growBranchListFront( branchListIt ); - } - - startAndGrowSeparateBranchesFromRestOfNeighbors( startCell, prevCell, neighbors, branchList, startCellPosInStem, false ); - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - double calculateFrontToPointDistance( const std::deque& second, const cvf::Vec3d& point ) - { - // Todo, more fancy virtual curvature based distance using an estimated direction from the branch-end - - return calculateWellCellToPointDistance( second.front(), point ); - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - double calculateEndToPointDistance( const std::deque& second, const cvf::Vec3d& point ) - { - // Todo, more fancy virtual curvature based distance using an estimated direction from the branch-end - - return calculateWellCellToPointDistance( second.back(), point ); - } - - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - double calculateWellCellToPointDistance( size_t wellCellIdx, const cvf::Vec3d& point ) - { - const std::vector& orgWellResultPoints = m_orgWellResultFrame.m_wellResultBranches[0].m_branchResultPoints; - - const RigCell& c = m_eclipseCaseData->cellFromWellResultCell( orgWellResultPoints[wellCellIdx] ); - - cvf::Vec3d cellCenter = c.center(); - - return ( point - cellCenter ).length(); - } - -private: - // The bool tells if this can be expanded in the front, - // Set to false when the branchLine starts from a branching cell (cell with more than two neighbors) - std::list>> m_branchLines; - - std::vector m_cellBoundingBoxes; - cvf::BoundingBoxTree m_cellSearchTree; - - std::map> m_cellsWithNeighbors; - std::set m_unusedWellCellIndices; - - RigWellResultFrame m_branchedWell; - - const RigEclipseCaseData* m_eclipseCaseData; - const RigWellResultFrame& m_orgWellResultFrame; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RigWellResultFrame RigSimulationWellCenterLineCalculator::splitIntoBranches( const RigWellResultFrame& wellResultFrame, - const RigEclipseCaseData* eclipseCaseData ) -{ - BranchSplitter splitter( wellResultFrame, eclipseCaseData ); - - return splitter.splittedWellResultFrame(); -} diff --git a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.h b/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.h index 6730d66966..347edc2d45 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.h +++ b/ApplicationLibCode/ReservoirDataModel/RigSimulationWellCenterLineCalculator.h @@ -19,7 +19,7 @@ #pragma once -#include "RigWellResultPoint.h" +#include "RigWellResultBranch.h" #include "cvfVector3.h" @@ -29,8 +29,6 @@ class RigEclipseCaseData; class RimSimWellInView; class RigSimWellData; -struct RigWellResultPoint; -struct RigWellResultBranch; class RigWellResultFrame; //-------------------------------------------------------------------------------------------------- @@ -63,19 +61,10 @@ private: std::vector>& pipeBranchesCLCoords, std::vector>& pipeBranchesCellIds ); - static std::vector calculateMswWellPipeGeometryForTimeStep( const RigEclipseCaseData* eclipseCaseData, - const RigSimWellData* simWellData, - int timeStepIndex ); - - static SimulationWellCellBranch addSegmentsToCellFaces( const std::vector branchCoords, - const std::vector& resultPoints, - const RigEclipseCaseData* eclipseCaseData ); - static bool hasAnyValidDataCells( const RigWellResultBranch& branch ); static void finishPipeCenterLine( std::vector>& pipeBranchesCLCoords, const cvf::Vec3d& lastCellCenter ); - static RigWellResultFrame splitIntoBranches( const RigWellResultFrame& wellResultFrame, const RigEclipseCaseData* eclipseCaseData ); - static void addCellCenterPoints( const RigEclipseCaseData* eclipseCaseData, - std::vector>& pipeBranchesCLCoords, - std::vector>& pipeBranchesCellIds ); + static void addCellCenterPoints( const RigEclipseCaseData* eclipseCaseData, + std::vector>& pipeBranchesCLCoords, + std::vector>& pipeBranchesCellIds ); }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.cpp new file mode 100644 index 0000000000..b6e523f93b --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023- Equinor ASA +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigWellResultBranch.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellResultBranch::RigWellResultBranch() + : m_ertBranchId( -1 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RigWellResultBranch::ertBranchId() const +{ + return m_ertBranchId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultBranch::setErtBranchId( int id ) +{ + m_ertBranchId = id; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellResultBranch::branchResultPoints() const +{ + return m_branchResultPoints; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultBranch::addBranchResultPoint( const RigWellResultPoint& point ) +{ + m_branchResultPoints.push_back( point ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultBranch::setBranchResultPoints( const std::vector& points ) +{ + m_branchResultPoints = points; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.h b/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.h new file mode 100644 index 0000000000..444a223f4d --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultBranch.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023- Equinor ASA +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaDefines.h" + +#include "RigWellResultPoint.h" + +#include "cvfVector3.h" + +#include + +//================================================================================================== +/// This class contains the connection information from and including a split point to the end of +/// that particular branch. +//================================================================================================== +struct RigWellResultBranch +{ + RigWellResultBranch(); + + int ertBranchId() const; + void setErtBranchId( int id ); + + std::vector branchResultPoints() const; + void addBranchResultPoint( const RigWellResultPoint& point ); + void setBranchResultPoints( const std::vector& points ); + +private: + int m_ertBranchId; + std::vector m_branchResultPoints; +}; + +using SimulationWellCellBranch = std::pair, std::vector>; diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.cpp new file mode 100644 index 0000000000..417b1dc07d --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.cpp @@ -0,0 +1,210 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023- Equinor ASA +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RigWellResultFrame.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellResultFrame::RigWellResultFrame() + : m_productionType( RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ) + , m_isOpen( false ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellResultPoint RigWellResultFrame::findResultCellWellHeadIncluded( size_t gridIndex, size_t gridCellIndex ) const +{ + const RigWellResultPoint wellResultPoint = findResultCellWellHeadExcluded( gridIndex, gridCellIndex ); + if ( wellResultPoint.isValid() ) return wellResultPoint; + + // If we could not find the cell among the real connections, we try the wellhead. + // The wellhead does however not have a real connection state, and is rendering using pipe color + // https://github.com/OPM/ResInsight/issues/4328 + + // This behavior was different prior to release 2019.04 and was rendered as a closed connection (gray) + // https://github.com/OPM/ResInsight/issues/712 + + if ( m_wellHead.cellIndex() == gridCellIndex && m_wellHead.gridIndex() == gridIndex ) + { + return m_wellHead; + } + + return RigWellResultPoint(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellResultPoint RigWellResultFrame::findResultCellWellHeadExcluded( size_t gridIndex, size_t gridCellIndex ) const +{ + CVF_ASSERT( gridIndex != cvf::UNDEFINED_SIZE_T && gridCellIndex != cvf::UNDEFINED_SIZE_T ); + + for ( const auto& wellResultBranch : m_wellResultBranches ) + { + for ( const auto& branchResultPoint : wellResultBranch.branchResultPoints() ) + { + if ( branchResultPoint.cellIndex() == gridCellIndex && branchResultPoint.gridIndex() == gridIndex ) + { + return branchResultPoint; + } + } + } + return RigWellResultPoint(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::setWellHead( RigWellResultPoint wellHead ) +{ + m_wellHead = wellHead; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellResultPoint RigWellResultFrame::wellHead() const +{ + return m_wellHead; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWellResultPoint RigWellResultFrame::wellHeadOrStartCell() const +{ + if ( m_wellHead.isCell() ) return m_wellHead; + + for ( const RigWellResultBranch& resBranch : m_wellResultBranches ) + { + for ( const RigWellResultPoint& wrp : resBranch.branchResultPoints() ) + { + if ( wrp.isCell() ) return wrp; + } + } + + return m_wellHead; // Nothing else to do +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellResultFrame::allResultPoints() const +{ + std::vector allPoints; + for ( const auto& resultBranch : m_wellResultBranches ) + { + for ( const auto& resultPoint : resultBranch.branchResultPoints() ) + { + allPoints.push_back( resultPoint ); + } + } + return allPoints; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::setIsOpen( bool isOpen ) +{ + m_isOpen = isOpen; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigWellResultFrame::isOpen() const +{ + return m_isOpen; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::setProductionType( RiaDefines::WellProductionType productionType ) +{ + m_productionType = productionType; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::WellProductionType RigWellResultFrame::productionType() const +{ + return m_productionType; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::setTimestamp( const QDateTime& timeStamp ) +{ + m_timestamp = timeStamp; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QDateTime RigWellResultFrame::timestamp() const +{ + return m_timestamp; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellResultFrame::wellResultBranches() const +{ + return m_wellResultBranches; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::clearWellResultBranches() +{ + m_wellResultBranches.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::addWellResultBranch( const RigWellResultBranch& wellResultBranch ) +{ + m_wellResultBranches.push_back( wellResultBranch ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigWellResultFrame::setWellResultBranches( const std::vector& wellResultBranches ) +{ + m_wellResultBranches = wellResultBranches; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellResultFrame::branchResultPointsFromBranchIndex( size_t index ) const +{ + CVF_ASSERT( index < m_wellResultBranches.size() ); + return m_wellResultBranches[index].branchResultPoints(); +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.h b/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.h new file mode 100644 index 0000000000..1a15b6c633 --- /dev/null +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultFrame.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2023- Equinor ASA +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaDefines.h" + +#include "RigWellResultBranch.h" + +#include + +#include + +//================================================================================================== +/// This class contains the well information for one timestep. +/// The main content is the vector of RigWellResultBranch which contains all the simple pipe +/// sections that make up the well +//================================================================================================== +class RigWellResultFrame +{ +public: + RigWellResultFrame(); + + RigWellResultPoint findResultCellWellHeadIncluded( size_t gridIndex, size_t gridCellIndex ) const; + RigWellResultPoint findResultCellWellHeadExcluded( size_t gridIndex, size_t gridCellIndex ) const; + std::vector allResultPoints() const; + + void setIsOpen( bool isOpen ); + void setProductionType( RiaDefines::WellProductionType productionType ); + void setTimestamp( const QDateTime& timestampe ); + void setWellHead( RigWellResultPoint wellHead ); + + bool isOpen() const; + RiaDefines::WellProductionType productionType() const; + QDateTime timestamp() const; + RigWellResultPoint wellHead() const; + RigWellResultPoint wellHeadOrStartCell() const; + + std::vector wellResultBranches() const; + void clearWellResultBranches(); + void addWellResultBranch( const RigWellResultBranch& wellResultBranch ); + void setWellResultBranches( const std::vector& wellResultBranches ); + std::vector branchResultPointsFromBranchIndex( size_t index ) const; + +private: + bool m_isOpen; + RiaDefines::WellProductionType m_productionType; + QDateTime m_timestamp; + RigWellResultPoint m_wellHead; + + std::vector m_wellResultBranches; +}; diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp index 55376547cb..5d17092969 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.cpp @@ -301,19 +301,3 @@ cvf::Vec3d RigWellResultPoint::bottomPosition() const { return m_bottomPosition; } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RigWellResultFrame::allResultPoints() const -{ - std::vector allPoints; - for ( const auto& resultBranch : m_wellResultBranches ) - { - for ( const auto& resultPoint : resultBranch.m_branchResultPoints ) - { - allPoints.push_back( resultPoint ); - } - } - return allPoints; -} diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h index f1ca903817..ad8134af8e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h +++ b/ApplicationLibCode/ReservoirDataModel/RigWellResultPoint.h @@ -90,47 +90,3 @@ private: double m_connectionFactor; bool m_isConnectedToValve; }; - -//================================================================================================== -/// This class contains the connection information from and including a splitpoint to the end of -/// that particular branch. -//================================================================================================== -struct RigWellResultBranch -{ - RigWellResultBranch() - : m_ertBranchId( -1 ) - { - } - - int m_ertBranchId; - std::vector m_branchResultPoints; -}; - -//================================================================================================== -/// This class contains the well information for one timestep. -/// The main content is the vector of RigWellResultBranch which contains all the simple pipe -/// sections that make up the well -//================================================================================================== -class RigWellResultFrame -{ -public: - RigWellResultFrame() - : m_productionType( RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE ) - , m_isOpen( false ) - { - } - - const RigWellResultPoint* findResultCellWellHeadIncluded( size_t gridIndex, size_t gridCellIndex ) const; - const RigWellResultPoint* findResultCellWellHeadExcluded( size_t gridIndex, size_t gridCellIndex ) const; - std::vector allResultPoints() const; - - RigWellResultPoint wellHeadOrStartCell() const; - RiaDefines::WellProductionType m_productionType; - bool m_isOpen; - RigWellResultPoint m_wellHead; - QDateTime m_timestamp; - - std::vector m_wellResultBranches; -}; - -using SimulationWellCellBranch = std::pair, std::vector>; diff --git a/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp b/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp index 682745e491..3ed0a1cda3 100644 --- a/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaWellDataCommands.cpp @@ -25,6 +25,7 @@ #include "RigEclipseCaseData.h" #include "RigGridBase.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include "RimEclipseCase.h" @@ -173,7 +174,7 @@ public: qint32 wellStatus = 0; if ( currentWellResult->hasWellResult( tsIdx ) ) { - switch ( currentWellResult->wellResultFrame( tsIdx )->m_productionType ) + switch ( currentWellResult->wellResultFrame( tsIdx )->productionType() ) { case RiaDefines::WellProductionType::PRODUCER: wellType = "Producer"; @@ -189,7 +190,7 @@ public: break; } - wellStatus = currentWellResult->wellResultFrame( tsIdx )->m_isOpen ? 1 : 0; + wellStatus = currentWellResult->wellResultFrame( tsIdx )->isOpen() ? 1 : 0; } wellTypes.push_back( wellType ); @@ -283,29 +284,25 @@ public: std::vector grids; rimCase->eclipseCaseData()->allGrids( &grids ); - for ( size_t bIdx = 0; bIdx < wellResFrame->m_wellResultBranches.size(); ++bIdx ) + for ( const auto& wellResultBranch : wellResFrame->wellResultBranches() ) { - const std::vector& branchResPoints = wellResFrame->m_wellResultBranches[bIdx].m_branchResultPoints; - for ( size_t rpIdx = 0; rpIdx < branchResPoints.size(); ++rpIdx ) + for ( const auto& branchResultPoint : wellResultBranch.branchResultPoints() ) { - const RigWellResultPoint& resPoint = branchResPoints[rpIdx]; - - if ( resPoint.isCell() ) + if ( branchResultPoint.isCell() ) { size_t i; size_t j; size_t k; - size_t gridIdx = resPoint.gridIndex(); - grids[gridIdx]->ijkFromCellIndex( resPoint.cellIndex(), &i, &j, &k ); - bool isOpen = resPoint.isOpen(); - int branchId = resPoint.branchId(); - int segmentId = resPoint.segmentId(); - + size_t gridIdx = branchResultPoint.gridIndex(); + grids[gridIdx]->ijkFromCellIndex( branchResultPoint.cellIndex(), &i, &j, &k ); + bool isOpen = branchResultPoint.isOpen(); + int branchId = branchResultPoint.branchId(); + int segmentId = branchResultPoint.segmentId(); cellIs.push_back( static_cast( i + 1 ) ); // NB: 1-based index in Octave cellJs.push_back( static_cast( j + 1 ) ); // NB: 1-based index in Octave cellKs.push_back( static_cast( k + 1 ) ); // NB: 1-based index in Octave gridIndices.push_back( static_cast( gridIdx ) ); - cellStatuses.push_back( static_cast( isOpen ) ); + cellStatuses.push_back( isOpen ? static_cast( 1 ) : static_cast( 0 ) ); branchIds.push_back( branchId ); segmentIds.push_back( segmentId ); } diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 4929c6e5e3..ed787c471d 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -28,6 +28,7 @@ #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include "Rim2dIntersectionView.h" @@ -1168,13 +1169,13 @@ QString RiuResultTextBuilder::wellResultText() continue; } - const RigWellResultPoint* wellResultCell = wellResultFrame->findResultCellWellHeadIncluded( m_gridIndex, m_cellIndex ); - if ( wellResultCell ) + const RigWellResultPoint wellResultCell = wellResultFrame->findResultCellWellHeadIncluded( m_gridIndex, m_cellIndex ); + if ( wellResultCell.isValid() ) { - const int branchId = wellResultCell->branchId(); - const int segmentId = wellResultCell->segmentId(); - const int outletBranchId = wellResultCell->outletBranchId(); - const int outletSegmentId = wellResultCell->outletSegmentId(); + const int branchId = wellResultCell.branchId(); + const int segmentId = wellResultCell.segmentId(); + const int outletBranchId = wellResultCell.outletBranchId(); + const int outletSegmentId = wellResultCell.outletSegmentId(); text += QString( "-- Well-cell connection info --\n Well Name: %1\n Branch Id: %2\n Segment " "Id: %3\n Outlet Branch Id: %4\n Outlet Segment Id: %5\n" ) diff --git a/GrpcInterface/RiaGrpcSimulationWellService.cpp b/GrpcInterface/RiaGrpcSimulationWellService.cpp index b15bc5a1eb..180cefda6e 100644 --- a/GrpcInterface/RiaGrpcSimulationWellService.cpp +++ b/GrpcInterface/RiaGrpcSimulationWellService.cpp @@ -22,6 +22,7 @@ #include "RigEclipseCaseData.h" #include "RigGridBase.h" #include "RigSimWellData.h" +#include "RigWellResultFrame.h" #include "RigWellResultPoint.h" #include "RimCase.h" @@ -58,7 +59,7 @@ grpc::Status RiaGrpcSimulationWellService::GetSimulationWellStatus( grpc::Server bool wellStatus = false; if ( currentWellResult->hasWellResult( tsIdx ) ) { - switch ( currentWellResult->wellResultFrame( tsIdx )->m_productionType ) + switch ( currentWellResult->wellResultFrame( tsIdx )->productionType() ) { case RiaDefines::WellProductionType::PRODUCER: wellType = "Producer"; @@ -74,7 +75,7 @@ grpc::Status RiaGrpcSimulationWellService::GetSimulationWellStatus( grpc::Server break; } - wellStatus = currentWellResult->wellResultFrame( tsIdx )->m_isOpen; + wellStatus = currentWellResult->wellResultFrame( tsIdx )->isOpen(); } reply->set_well_type( wellType.toStdString() ); @@ -111,10 +112,9 @@ grpc::Status RiaGrpcSimulationWellService::GetSimulationWellCells( grpc::ServerC std::vector grids; eclipseCase->eclipseCaseData()->allGrids( &grids ); - for ( size_t bIdx = 0; bIdx < wellResFrame->m_wellResultBranches.size(); ++bIdx ) + for ( size_t bIdx = 0; bIdx < wellResFrame->wellResultBranches().size(); ++bIdx ) { - const std::vector& branchResPoints = - wellResFrame->m_wellResultBranches[bIdx].m_branchResultPoints; + const std::vector branchResPoints = wellResFrame->branchResultPointsFromBranchIndex( bIdx ); for ( size_t rpIdx = 0; rpIdx < branchResPoints.size(); ++rpIdx ) { const RigWellResultPoint& resPoint = branchResPoints[rpIdx];