Refactor classes in RigWellResultPoint.h

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

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

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

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

View File

@@ -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

View File

@@ -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();

View File

@@ -35,7 +35,6 @@ class DrawableGeo;
class Part;
} // namespace cvf
class RigWellResultFrame;
class RimEclipseView;
class RimSimWellInView;
class RivPipeGeometryGenerator;

View File

@@ -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;

View File

@@ -46,7 +46,6 @@ enum class WellProductionType : short;
class Rim3dView;
class RimSimWellInView;
class RimSimWellInViewCollection;
class RigWellResultFrame;
class RivWellDiskPartMgr : public cvf::Object
{

View File

@@ -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 );
}

View File

@@ -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<std::pair<cvf::Vec3f, cvf::Color3f>> 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<cvf::Part> part = createPart( centerColorPairs, wellResultFrame->m_isOpen );
cvf::ref<cvf::Part> 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;