Refactor RimWellPath and RigWellPath

This commit is contained in:
Gaute Lindkvist 2020-10-06 12:37:16 +02:00
parent c29cf315d2
commit aceac43652
83 changed files with 853 additions and 723 deletions

View File

@ -1638,9 +1638,9 @@ void RiaApplication::loadAndUpdatePlotData()
caf::ProgressInfo plotProgress( plotCount, "Loading Plot Data" ); caf::ProgressInfo plotProgress( plotCount, "Loading Plot Data" );
if ( wlpColl ) if ( wlpColl )
{ {
for ( size_t wlpIdx = 0; wlpIdx < wlpColl->wellLogPlots().size(); ++wlpIdx ) for ( auto wellLogPlot : wlpColl->wellLogPlots() )
{ {
wlpColl->wellLogPlots[wlpIdx]->loadDataAndUpdate(); wellLogPlot->loadDataAndUpdate();
plotProgress.incrementProgress(); plotProgress.incrementProgress();
} }
} }

View File

@ -28,8 +28,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RiaExtractionTools::wellLogExtractorEclipseCase( RimWellPath* wellPath, RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
RimEclipseCase* eclipseCase ) gsl::not_null<RimEclipseCase*> eclipseCase )
{ {
auto wlPlotCollection = wellLogPlotCollection(); auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr; if ( !wlPlotCollection ) return nullptr;
@ -40,7 +40,8 @@ RigEclipseWellLogExtractor* RiaExtractionTools::wellLogExtractorEclipseCase( Rim
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RiaExtractionTools::wellLogExtractorGeoMechCase( RimWellPath* wellPath, RimGeoMechCase* geomCase ) RigGeoMechWellLogExtractor* RiaExtractionTools::findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geomCase )
{ {
auto wlPlotCollection = wellLogPlotCollection(); auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr; if ( !wlPlotCollection ) return nullptr;
@ -51,17 +52,13 @@ RigGeoMechWellLogExtractor* RiaExtractionTools::wellLogExtractorGeoMechCase( Rim
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( const RimSimWellInView* simWell, RigEclipseWellLogExtractor*
const RigWellPath* wellPathGeom ) RiaExtractionTools::findOrCreateSimWellExtractor( gsl::not_null<const RimSimWellInView*> simWell,
gsl::not_null<const RigWellPath*> wellPathGeom )
{ {
auto wlPlotCollection = wellLogPlotCollection(); auto wlPlotCollection = wellLogPlotCollection();
if ( !wlPlotCollection ) return nullptr; if ( !wlPlotCollection ) return nullptr;
if ( !( simWell && wellPathGeom ) )
{
return nullptr;
}
RimEclipseCase* eclipseCase = nullptr; RimEclipseCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType( eclipseCase ); simWell->firstAncestorOrThisOfType( eclipseCase );
if ( !( eclipseCase && eclipseCase->eclipseCaseData() ) ) if ( !( eclipseCase && eclipseCase->eclipseCaseData() ) )

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include <gsl/gsl>
class RigEclipseWellLogExtractor; class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor; class RigGeoMechWellLogExtractor;
class RigWellPath; class RigWellPath;
@ -34,10 +36,13 @@ class QString;
//================================================================================================== //==================================================================================================
namespace RiaExtractionTools namespace RiaExtractionTools
{ {
RigEclipseWellLogExtractor* wellLogExtractorEclipseCase( RimWellPath* wellPath, RimEclipseCase* eclipseCase ); RigEclipseWellLogExtractor* findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
RigGeoMechWellLogExtractor* wellLogExtractorGeoMechCase( RimWellPath* wellPath, RimGeoMechCase* geomCase ); gsl::not_null<RimEclipseCase*> eclipseCase );
RigGeoMechWellLogExtractor* findOrCreateWellLogExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geomCase );
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const RimSimWellInView* simWell, const RigWellPath* wellPathGeom ); RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( gsl::not_null<const RimSimWellInView*> simWell,
gsl::not_null<const RigWellPath*> wellPathGeom );
RimWellLogPlotCollection* wellLogPlotCollection(); RimWellLogPlotCollection* wellLogPlotCollection();

View File

@ -40,27 +40,25 @@ RiaPolyArcLineSampler::RiaPolyArcLineSampler( const cvf::Vec3d& sta
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::pair<std::vector<cvf::Vec3d>, std::vector<double>>
void RiaPolyArcLineSampler::sampledPointsAndMDs( double sampleInterval, RiaPolyArcLineSampler::sampledPointsAndMDs( double sampleInterval, bool isResamplingLines )
bool isResamplingLines,
std::vector<cvf::Vec3d>* points,
std::vector<double>* mds )
{ {
CVF_ASSERT( sampleInterval > 0.0 ); CVF_ASSERT( sampleInterval > 0.0 );
std::vector<cvf::Vec3d> points;
std::vector<double> mds;
m_maxSamplingsInterval = sampleInterval; m_maxSamplingsInterval = sampleInterval;
m_isResamplingLines = isResamplingLines; m_isResamplingLines = isResamplingLines;
double startMD = 0.0; double startMD = 0.0;
points->clear();
mds->clear();
std::vector<cvf::Vec3d> pointsNoDuplicates = RiaPolyArcLineSampler::pointsWithoutDuplicates( m_lineArcEndPoints ); std::vector<cvf::Vec3d> pointsNoDuplicates = RiaPolyArcLineSampler::pointsWithoutDuplicates( m_lineArcEndPoints );
if ( pointsNoDuplicates.size() < 2 ) return; if ( pointsNoDuplicates.size() < 2 ) return std::make_pair( points, mds );
m_points = points; m_points = &points;
m_meshDs = mds; m_meshDs = &mds;
m_totalMD = startMD; m_totalMD = startMD;
cvf::Vec3d p1 = pointsNoDuplicates[0]; cvf::Vec3d p1 = pointsNoDuplicates[0];
@ -75,7 +73,7 @@ void RiaPolyArcLineSampler::sampledPointsAndMDs( double sample
sampleSegment( t2, pointsNoDuplicates[pIdx], pointsNoDuplicates[pIdx + 1], &t2 ); sampleSegment( t2, pointsNoDuplicates[pIdx], pointsNoDuplicates[pIdx + 1], &t2 );
} }
return; return std::make_pair( points, mds );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -27,10 +27,8 @@ class RiaPolyArcLineSampler
public: public:
RiaPolyArcLineSampler( const cvf::Vec3d& startTangent, const std::vector<cvf::Vec3d>& lineArcEndPoints ); RiaPolyArcLineSampler( const cvf::Vec3d& startTangent, const std::vector<cvf::Vec3d>& lineArcEndPoints );
void sampledPointsAndMDs( double maxSampleInterval, std::pair<std::vector<cvf::Vec3d>, std::vector<double>> sampledPointsAndMDs( double maxSampleInterval,
bool isResamplingLines, bool isResamplingLines );
std::vector<cvf::Vec3d>* points,
std::vector<double>* mds );
static std::vector<cvf::Vec3d> pointsWithoutDuplicates( const std::vector<cvf::Vec3d>& points ); static std::vector<cvf::Vec3d> pointsWithoutDuplicates( const std::vector<cvf::Vec3d>& points );

View File

@ -58,17 +58,7 @@ add_library( ${PROJECT_NAME} OBJECT
target_include_directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
$<TARGET_PROPERTY:LibCore,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries ${CMAKE_SOURCE_DIR}/ThirdParty
$<TARGET_PROPERTY:cafCommand,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:cafPdmCvf,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:cafPdmScripting,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:cafTensor,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:cafViewer,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:cafVizExtensions,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:ecl,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:nightcharts,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
$<TARGET_PROPERTY:qwt,INCLUDE_DIRECTORIES> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
${Qt5Network_INCLUDE_DIRS} # Needed for cmake version < 3.12. Remove when we can use target_link_libraries
) )
# Before cmake 3.12 OBJECT libraries could not use the target_link_libraries command, # Before cmake 3.12 OBJECT libraries could not use the target_link_libraries command,
@ -76,22 +66,23 @@ target_include_directories(${PROJECT_NAME}
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
# Use this code when 3.12 can be used as minimum version of cmake # Use this code when 3.12 can be used as minimum version of cmake
#set( LINK_LIBRARIES set( LINK_LIBRARIES
# LibCore LibCore
# cafCommand cafCommand
# cafPdmCvf cafPdmCvf
# cafTensor cafPdmScripting
# cafViewer cafTensor
# cafVizExtensions cafViewer
# ecl cafVizExtensions
# nightcharts ecl
# qwt nightcharts
qwt
# ${QT_LIBRARIES} ${QT_LIBRARIES}
#) )
#target_link_libraries( ${PROJECT_NAME} target_link_libraries( ${PROJECT_NAME}
# ${LINK_LIBRARIES} ${LINK_LIBRARIES}
#) )
source_group("" FILES ${PROJECT_FILES}) source_group("" FILES ${PROJECT_FILES})

View File

@ -90,16 +90,14 @@ void RicExportFishbonesLateralsFeature::onActionTriggered( bool isChecked )
lateralMDs.push_back( coordMD.second ); lateralMDs.push_back( coordMD.second );
} }
RigWellPath geometry; RigWellPath geometry( lateralCoords, lateralMDs );
geometry.m_wellPathPoints = lateralCoords;
geometry.m_measuredDepths = lateralMDs;
// Pad with "0" to get a total of two characters defining the sub index text // Pad with "0" to get a total of two characters defining the sub index text
QString subIndexText = QString( "%1" ).arg( sub.subIndex, 2, 10, QChar( '0' ) ); QString subIndexText = QString( "%1" ).arg( sub.subIndex, 2, 10, QChar( '0' ) );
QString lateralName = QString lateralName =
QString( "%1_%2_Sub%3_Lat%4" ).arg( wellPath->name() ).arg( fishboneName ).arg( subIndexText ).arg( lateralIndex ); QString( "%1_%2_Sub%3_Lat%4" ).arg( wellPath->name() ).arg( fishboneName ).arg( subIndexText ).arg( lateralIndex );
EXP::writeWellPathGeometryToStream( *stream, &geometry, lateralName, mdStepSize, false, 0.0, false ); EXP::writeWellPathGeometryToStream( *stream, geometry, lateralName, mdStepSize, false, 0.0, false );
} }
} }
} }

View File

@ -43,12 +43,7 @@
CAF_CMD_SOURCE_INIT( RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature" ); CAF_CMD_SOURCE_INIT( RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature" );
//-------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double getWellPathTipMd( RimWellPath* wellPath );
//--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked ) void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
@ -63,7 +58,7 @@ void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs; RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
fishbonesCollection->appendFishbonesSubs( obj ); fishbonesCollection->appendFishbonesSubs( obj );
double wellPathTipMd = getWellPathTipMd( wellPath ); double wellPathTipMd = wellPath->endMD();
if ( wellPathTipMd != HUGE_VAL ) if ( wellPathTipMd != HUGE_VAL )
{ {
double startMd = wellPathTipMd - 150 - 100; double startMd = wellPathTipMd - 150 - 100;
@ -204,17 +199,3 @@ void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling( RimFishbonesCollecti
RiuMainWindow::instance()->updateScaleValue(); RiuMainWindow::instance()->updateScaleValue();
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double getWellPathTipMd( RimWellPath* wellPath )
{
RigWellPath* geometry = wellPath ? wellPath->wellPathGeometry() : nullptr;
if ( geometry && !geometry->m_measuredDepths.empty() )
{
return geometry->m_measuredDepths.back();
}
return HUGE_VAL;
}

View File

@ -598,12 +598,13 @@ void RicExportFractureCompletionsImpl::calculateInternalFractureTransmissibiliti
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportFractureCompletionsImpl::calculateFractureToWellTransmissibilities( const RimFractureTemplate* fracTemplate, void RicExportFractureCompletionsImpl::calculateFractureToWellTransmissibilities(
const RigFractureGrid* fractureGrid, gsl::not_null<const RimFractureTemplate*> fracTemplate,
const RimFracture* fracture, gsl::not_null<const RigFractureGrid*> fractureGrid,
double cDarcyInCorrectUnit, gsl::not_null<const RimFracture*> fracture,
const RigWellPath* wellPathGeometry, double cDarcyInCorrectUnit,
RigTransmissibilityCondenser& transCondenser ) gsl::not_null<const RigWellPath*> wellPathGeometry,
RigTransmissibilityCondenser& transCondenser )
{ {
//// ////
// If fracture has orientation Azimuth or Transverse, assume only radial inflow // If fracture has orientation Azimuth or Transverse, assume only radial inflow

View File

@ -20,6 +20,8 @@
#include "RigCompletionData.h" #include "RigCompletionData.h"
#include <gsl/gsl>
#include <map> #include <map>
#include <vector> #include <vector>
@ -118,12 +120,12 @@ private:
double cDarcyInCorrectUnit, double cDarcyInCorrectUnit,
RigTransmissibilityCondenser& transCondenser ); RigTransmissibilityCondenser& transCondenser );
static void calculateFractureToWellTransmissibilities( const RimFractureTemplate* fracTemplate, static void calculateFractureToWellTransmissibilities( gsl::not_null<const RimFractureTemplate*> fracTemplate,
const RigFractureGrid* fractureGrid, gsl::not_null<const RigFractureGrid*> fractureGrid,
const RimFracture* fracture, gsl::not_null<const RimFracture*> fracture,
double cDarcyInCorrectUnit, double cDarcyInCorrectUnit,
const RigWellPath* wellPathGeometry, gsl::not_null<const RigWellPath*> wellPathGeometry,
RigTransmissibilityCondenser& transCondenser ); RigTransmissibilityCondenser& transCondenser );
static std::map<size_t, double> calculateMatrixToWellTransmissibilities( RigTransmissibilityCondenser& transCondenser ); static std::map<size_t, double> calculateMatrixToWellTransmissibilities( RigTransmissibilityCondenser& transCondenser );

View File

@ -640,7 +640,7 @@ std::map<QString, std::vector<RigCompletionData>>
auto it = completions.find( gridName ); auto it = completions.find( gridName );
if ( it == completions.end() ) if ( it == completions.end() )
{ {
completions.insert( std::pair<QString, std::vector<RigCompletionData>>( gridName, { completion } ) ); completions.insert( std::pair<QString, std::vector<RigCompletionData>>( gridName, {completion} ) );
} }
else else
{ {
@ -716,19 +716,19 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile( RimEclips
RifTextDataTableFormatter formatter( stream ); RifTextDataTableFormatter formatter( stream );
formatter.setColumnSpacing( 2 ); formatter.setColumnSpacing( 2 );
std::vector<RifTextDataTableColumn> header = { RifTextDataTableColumn( "Well" ), std::vector<RifTextDataTableColumn> header = {RifTextDataTableColumn( "Well" ),
RifTextDataTableColumn( "Grp" ), RifTextDataTableColumn( "Grp" ),
RifTextDataTableColumn( "I" ), RifTextDataTableColumn( "I" ),
RifTextDataTableColumn( "J" ), RifTextDataTableColumn( "J" ),
RifTextDataTableColumn( "RefDepth" ), RifTextDataTableColumn( "RefDepth" ),
RifTextDataTableColumn( "Type" ), RifTextDataTableColumn( "Type" ),
RifTextDataTableColumn( "DrainRad" ), RifTextDataTableColumn( "DrainRad" ),
RifTextDataTableColumn( "GasInEq" ), RifTextDataTableColumn( "GasInEq" ),
RifTextDataTableColumn( "AutoShut" ), RifTextDataTableColumn( "AutoShut" ),
RifTextDataTableColumn( "XFlow" ), RifTextDataTableColumn( "XFlow" ),
RifTextDataTableColumn( "FluidPVT" ), RifTextDataTableColumn( "FluidPVT" ),
RifTextDataTableColumn( "HydSDens" ), RifTextDataTableColumn( "HydSDens" ),
RifTextDataTableColumn( "FluidInPlReg" ) }; RifTextDataTableColumn( "FluidInPlReg" )};
formatter.keyword( "WELSPECS" ); formatter.keyword( "WELSPECS" );
formatter.header( header ); formatter.header( header );
@ -783,20 +783,20 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile(
RifTextDataTableFormatter formatter( stream ); RifTextDataTableFormatter formatter( stream );
formatter.setColumnSpacing( 2 ); formatter.setColumnSpacing( 2 );
std::vector<RifTextDataTableColumn> header = { RifTextDataTableColumn( "Well" ), std::vector<RifTextDataTableColumn> header = {RifTextDataTableColumn( "Well" ),
RifTextDataTableColumn( "Grp" ), RifTextDataTableColumn( "Grp" ),
RifTextDataTableColumn( "LGR" ), RifTextDataTableColumn( "LGR" ),
RifTextDataTableColumn( "I" ), RifTextDataTableColumn( "I" ),
RifTextDataTableColumn( "J" ), RifTextDataTableColumn( "J" ),
RifTextDataTableColumn( "RefDepth" ), RifTextDataTableColumn( "RefDepth" ),
RifTextDataTableColumn( "Type" ), RifTextDataTableColumn( "Type" ),
RifTextDataTableColumn( "DrainRad" ), RifTextDataTableColumn( "DrainRad" ),
RifTextDataTableColumn( "GasInEq" ), RifTextDataTableColumn( "GasInEq" ),
RifTextDataTableColumn( "AutoShut" ), RifTextDataTableColumn( "AutoShut" ),
RifTextDataTableColumn( "XFlow" ), RifTextDataTableColumn( "XFlow" ),
RifTextDataTableColumn( "FluidPVT" ), RifTextDataTableColumn( "FluidPVT" ),
RifTextDataTableColumn( "HydSDens" ), RifTextDataTableColumn( "HydSDens" ),
RifTextDataTableColumn( "FluidInPlReg" ) }; RifTextDataTableColumn( "FluidInPlReg" )};
formatter.keyword( "WELSPECL" ); formatter.keyword( "WELSPECL" );
formatter.header( header ); formatter.header( header );
@ -960,46 +960,44 @@ void RicWellPathExportCompletionDataFeatureImpl::exportCompdatTableUsingFormatte
if ( gridName.isEmpty() ) if ( gridName.isEmpty() )
{ {
header = header = {RifTextDataTableColumn( "Well" ),
{ RifTextDataTableColumn( "Well" ), RifTextDataTableColumn( "I" ),
RifTextDataTableColumn( "I" ), RifTextDataTableColumn( "J" ),
RifTextDataTableColumn( "J" ), RifTextDataTableColumn( "K1" ),
RifTextDataTableColumn( "K1" ), RifTextDataTableColumn( "K2" ),
RifTextDataTableColumn( "K2" ), RifTextDataTableColumn( "Status" ),
RifTextDataTableColumn( "Status" ), RifTextDataTableColumn( "SAT" ),
RifTextDataTableColumn( "SAT" ), RifTextDataTableColumn( "TR",
RifTextDataTableColumn( "TR", RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), RifTextDataTableColumn( "DIAM" ),
RifTextDataTableColumn( "DIAM" ), RifTextDataTableColumn( "KH",
RifTextDataTableColumn( "KH", RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), RifTextDataTableColumn( "S" ),
RifTextDataTableColumn( "S" ), RifTextDataTableColumn( "Df",
RifTextDataTableColumn( "Df", RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), RifTextDataTableColumn( "DIR" )};
RifTextDataTableColumn( "DIR" ) };
formatter.keyword( "COMPDAT" ); formatter.keyword( "COMPDAT" );
} }
else else
{ {
header = header = {RifTextDataTableColumn( "Well" ),
{ RifTextDataTableColumn( "Well" ), RifTextDataTableColumn( "LgrName" ),
RifTextDataTableColumn( "LgrName" ), RifTextDataTableColumn( "I" ),
RifTextDataTableColumn( "I" ), RifTextDataTableColumn( "J" ),
RifTextDataTableColumn( "J" ), RifTextDataTableColumn( "K1" ),
RifTextDataTableColumn( "K1" ), RifTextDataTableColumn( "K2" ),
RifTextDataTableColumn( "K2" ), RifTextDataTableColumn( "Status" ),
RifTextDataTableColumn( "Status" ), RifTextDataTableColumn( "SAT" ),
RifTextDataTableColumn( "SAT" ), RifTextDataTableColumn( "TR",
RifTextDataTableColumn( "TR", RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), RifTextDataTableColumn( "DIAM" ),
RifTextDataTableColumn( "DIAM" ), RifTextDataTableColumn( "KH",
RifTextDataTableColumn( "KH", RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), RifTextDataTableColumn( "S" ),
RifTextDataTableColumn( "S" ), RifTextDataTableColumn( "Df",
RifTextDataTableColumn( "Df", RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ),
RifTextDataTableDoubleFormatting( RifTextDataTableDoubleFormat::RIF_SCIENTIFIC ) ), RifTextDataTableColumn( "DIR" )};
RifTextDataTableColumn( "DIR" ) };
formatter.keyword( "COMPDATL" ); formatter.keyword( "COMPDATL" );
} }
@ -1151,23 +1149,22 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWpimultTableUsingFormatte
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::generatePerforationsCompdatValues( std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::generatePerforationsCompdatValues(
const RimWellPath* wellPath, gsl::not_null<const RimWellPath*> wellPath,
const std::vector<const RimPerforationInterval*>& intervals, const std::vector<const RimPerforationInterval*>& intervals,
const RicExportCompletionDataSettingsUi& settings ) const RicExportCompletionDataSettingsUi& settings )
{ {
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType(); RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
std::vector<RigCompletionData> completionData; std::vector<RigCompletionData> completionData;
if ( !wellPath || !wellPath->wellPathGeometry() )
{
return completionData;
}
const RigActiveCellInfo* activeCellInfo = const RigActiveCellInfo* activeCellInfo =
settings.caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); settings.caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry ) return completionData;
auto timeSteps = settings.caseToApply->timeStepDates(); auto timeSteps = settings.caseToApply->timeStepDates();
if ( wellPath->perforationIntervalCollection()->isChecked() ) if ( wellPath->perforationIntervalCollection()->isChecked() )
{ {
for ( const RimPerforationInterval* interval : intervals ) for ( const RimPerforationInterval* interval : intervals )
@ -1178,7 +1175,7 @@ std::vector<RigCompletionData> RicWellPathExportCompletionDataFeatureImpl::gener
continue; continue;
std::pair<std::vector<cvf::Vec3d>, std::vector<double>> perforationPointsAndMD = std::pair<std::vector<cvf::Vec3d>, std::vector<double>> perforationPointsAndMD =
wellPath->wellPathGeometry()->clippedPointSubset( interval->startMD(), interval->endMD() ); wellPathGeometry->clippedPointSubset( interval->startMD(), interval->endMD() );
std::vector<WellPathCellIntersectionInfo> intersectedCells = std::vector<WellPathCellIntersectionInfo> intersectedCells =
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( settings.caseToApply->eclipseCaseData(), RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( settings.caseToApply->eclipseCaseData(),
@ -1274,7 +1271,7 @@ void RicWellPathExportCompletionDataFeatureImpl::appendCompletionData(
{ {
completionData->insert( completionData->insert(
std::pair<size_t, std::vector<RigCompletionData>>( completion.completionDataGridCell().globalCellIndex(), std::pair<size_t, std::vector<RigCompletionData>>( completion.completionDataGridCell().globalCellIndex(),
std::vector<RigCompletionData>{ completion } ) ); std::vector<RigCompletionData>{completion} ) );
} }
} }
} }
@ -1654,17 +1651,20 @@ double RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibilityAsEc
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::pair<double, cvf::Vec2i> std::pair<double, cvf::Vec2i> RicWellPathExportCompletionDataFeatureImpl::wellPathUpperGridIntersectionIJ(
RicWellPathExportCompletionDataFeatureImpl::wellPathUpperGridIntersectionIJ( const RimEclipseCase* gridCase, gsl::not_null<const RimEclipseCase*> gridCase,
const RimWellPath* wellPath, gsl::not_null<const RimWellPath*> wellPath,
const QString& gridName ) const QString& gridName )
{ {
const RigEclipseCaseData* caseData = gridCase->eclipseCaseData(); const RigEclipseCaseData* caseData = gridCase->eclipseCaseData();
const RigMainGrid* mainGrid = caseData->mainGrid(); const RigMainGrid* mainGrid = caseData->mainGrid();
const RigActiveCellInfo* activeCellInfo = caseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); const RigActiveCellInfo* activeCellInfo = caseData->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
const RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints(); auto wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<double>& mds = wellPathGeometry->measureDepths(); CVF_ASSERT( wellPathGeometry );
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints();
const std::vector<double>& mds = wellPathGeometry->measuredDepths();
CVF_ASSERT( !coords.empty() && !mds.empty() ); CVF_ASSERT( !coords.empty() && !mds.empty() );
std::vector<WellPathCellIntersectionInfo> intersections = std::vector<WellPathCellIntersectionInfo> intersections =

View File

@ -23,11 +23,13 @@
#include "RicExportCompletionDataSettingsUi.h" #include "RicExportCompletionDataSettingsUi.h"
#include "RicWellPathFractureReportItem.h" #include "RicWellPathFractureReportItem.h"
#include <QFile>
#include "cvfVector2.h" #include "cvfVector2.h"
#include "cvfVector3.h" #include "cvfVector3.h"
#include <QFile>
#include <gsl/gsl>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -127,7 +129,7 @@ public:
computeDynamicCompletionsForWellPath( RimWellPath* wellPath, RimEclipseCase* eclipseCase, size_t timeStepIndex ); computeDynamicCompletionsForWellPath( RimWellPath* wellPath, RimEclipseCase* eclipseCase, size_t timeStepIndex );
static std::vector<RigCompletionData> static std::vector<RigCompletionData>
generatePerforationsCompdatValues( const RimWellPath* wellPath, generatePerforationsCompdatValues( gsl::not_null<const RimWellPath*> wellPath,
const std::vector<const RimPerforationInterval*>& intervals, const std::vector<const RimPerforationInterval*>& intervals,
const RicExportCompletionDataSettingsUi& settings ); const RicExportCompletionDataSettingsUi& settings );
@ -182,9 +184,9 @@ private:
static void appendCompletionData( std::map<size_t, std::vector<RigCompletionData>>* completionData, static void appendCompletionData( std::map<size_t, std::vector<RigCompletionData>>* completionData,
const std::vector<RigCompletionData>& data ); const std::vector<RigCompletionData>& data );
static std::pair<double, cvf::Vec2i> wellPathUpperGridIntersectionIJ( const RimEclipseCase* gridCase, static std::pair<double, cvf::Vec2i> wellPathUpperGridIntersectionIJ( gsl::not_null<const RimEclipseCase*> gridCase,
const RimWellPath* wellPath, gsl::not_null<const RimWellPath*> wellPath,
const QString& gridName = "" ); const QString& gridName = "" );
static void exportCarfinForTemporaryLgrs( const RimEclipseCase* sourceCase, const QString& folder ); static void exportCarfinForTemporaryLgrs( const RimEclipseCase* sourceCase, const QString& folder );

View File

@ -940,9 +940,11 @@ RicMswExportInfo
caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
RiaEclipseUnitTools::UnitSystem unitSystem = caseToApply->eclipseCaseData()->unitsType(); RiaEclipseUnitTools::UnitSystem unitSystem = caseToApply->eclipseCaseData()->unitsType();
const RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); auto wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints(); CVF_ASSERT( wellPathGeometry );
const std::vector<double>& mds = wellPathGeometry->measureDepths();
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints();
const std::vector<double>& mds = wellPathGeometry->measuredDepths();
CVF_ASSERT( !coords.empty() && !mds.empty() ); CVF_ASSERT( !coords.empty() && !mds.empty() );
std::vector<WellPathCellIntersectionInfo> intersections = std::vector<WellPathCellIntersectionInfo> intersections =
@ -1119,9 +1121,12 @@ std::vector<WellPathCellIntersectionInfo>
{ {
const RigActiveCellInfo* activeCellInfo = const RigActiveCellInfo* activeCellInfo =
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
const RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints(); auto wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<double>& mds = wellPathGeometry->measureDepths(); CVF_ASSERT( wellPathGeometry );
const std::vector<cvf::Vec3d>& coords = wellPathGeometry->wellPathPoints();
const std::vector<double>& mds = wellPathGeometry->measuredDepths();
CVF_ASSERT( !coords.empty() && !mds.empty() ); CVF_ASSERT( !coords.empty() && !mds.empty() );
const RigMainGrid* mainGrid = eclipseCase->mainGrid(); const RigMainGrid* mainGrid = eclipseCase->mainGrid();
@ -1176,9 +1181,9 @@ std::vector<WellPathCellIntersectionInfo>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<WellPathCellIntersectionInfo> std::vector<WellPathCellIntersectionInfo>
RicWellPathExportMswCompletionsImpl::filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections, RicWellPathExportMswCompletionsImpl::filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections,
double initialMD, double initialMD,
const RigWellPath* wellPathGeometry, gsl::not_null<const RigWellPath*> wellPathGeometry,
const RimEclipseCase* eclipseCase ) gsl::not_null<const RimEclipseCase*> eclipseCase )
{ {
std::vector<WellPathCellIntersectionInfo> filteredIntersections; std::vector<WellPathCellIntersectionInfo> filteredIntersections;
@ -1669,6 +1674,10 @@ void RicWellPathExportMswCompletionsImpl::writeMainBoreWelsegsSegment( std::shar
std::vector<std::pair<double, double>> subSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength ); std::vector<std::pair<double, double>> subSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength );
CVF_ASSERT( exportInfo.wellPath() );
auto wellPathGeometry = exportInfo.wellPath()->wellPathGeometry();
CVF_ASSERT( wellPathGeometry );
double prevOutMD = exportInfo.initialMD(); double prevOutMD = exportInfo.initialMD();
double prevOutTVD = exportInfo.initialTVD(); double prevOutTVD = exportInfo.initialTVD();
if ( previousSegment ) if ( previousSegment )
@ -1678,8 +1687,8 @@ void RicWellPathExportMswCompletionsImpl::writeMainBoreWelsegsSegment( std::shar
} }
for ( const auto& [subStartMD, subEndMD] : subSegments ) for ( const auto& [subStartMD, subEndMD] : subSegments )
{ {
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD ); auto startPoint = wellPathGeometry->interpolatedPointAlongWellPath( subStartMD );
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD ); auto endPoint = wellPathGeometry->interpolatedPointAlongWellPath( subEndMD );
double subStartTVD = -startPoint.z(); double subStartTVD = -startPoint.z();
double subEndTVD = -endPoint.z(); double subEndTVD = -endPoint.z();
@ -1745,12 +1754,16 @@ void RicWellPathExportMswCompletionsImpl::writeValveWelsegsSegment( std::shared_
std::vector<std::pair<double, double>> splitSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength ); std::vector<std::pair<double, double>> splitSegments = createSubSegmentMDPairs( startMD, endMD, maxSegmentLength );
CVF_ASSERT( exportInfo.wellPath() );
auto wellPathGeometry = exportInfo.wellPath()->wellPathGeometry();
CVF_ASSERT( wellPathGeometry );
for ( const auto& [subStartMD, subEndMD] : splitSegments ) for ( const auto& [subStartMD, subEndMD] : splitSegments )
{ {
int subSegmentNumber = ( *segmentNumber )++; int subSegmentNumber = ( *segmentNumber )++;
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD ); auto startPoint = wellPathGeometry->interpolatedPointAlongWellPath( subStartMD );
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD ); auto endPoint = wellPathGeometry->interpolatedPointAlongWellPath( subEndMD );
double subStartTVD = -startPoint.z(); double subStartTVD = -startPoint.z();
double subEndTVD = -endPoint.z(); double subEndTVD = -endPoint.z();
@ -1801,6 +1814,10 @@ void RicWellPathExportMswCompletionsImpl::writeCompletionWelsegsSegment( std::sh
formatter.comment( QString( "%1 connected to %2" ).arg( completion->label() ).arg( segment->label() ) ); formatter.comment( QString( "%1 connected to %2" ).arg( completion->label() ).arg( segment->label() ) );
} }
CVF_ASSERT( exportInfo.wellPath() );
auto wellPathGeometry = exportInfo.wellPath()->wellPathGeometry();
CVF_ASSERT( wellPathGeometry );
for ( std::shared_ptr<RicMswSubSegment> subSegment : completion->subSegments() ) for ( std::shared_ptr<RicMswSubSegment> subSegment : completion->subSegments() )
{ {
double startMD = subSegment->startMD(); double startMD = subSegment->startMD();
@ -1812,8 +1829,8 @@ void RicWellPathExportMswCompletionsImpl::writeCompletionWelsegsSegment( std::sh
{ {
int subSegmentNumber = ( *segmentNumber )++; int subSegmentNumber = ( *segmentNumber )++;
auto startPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subStartMD ); auto startPoint = wellPathGeometry->interpolatedPointAlongWellPath( subStartMD );
auto endPoint = exportInfo.wellPath()->wellPathGeometry()->interpolatedPointAlongWellPath( subEndMD ); auto endPoint = wellPathGeometry->interpolatedPointAlongWellPath( subEndMD );
double subStartTVD = -startPoint.z(); double subStartTVD = -startPoint.z();
double subEndTVD = -endPoint.z(); double subEndTVD = -endPoint.z();
@ -1932,9 +1949,7 @@ void RicWellPathExportMswCompletionsImpl::assignFishbonesLateralIntersections( c
lateralCoords, lateralCoords,
lateralMDs ); lateralMDs );
RigWellPath pathGeometry; RigWellPath pathGeometry( lateralCoords, lateralMDs );
pathGeometry.m_wellPathPoints = lateralCoords;
pathGeometry.m_measuredDepths = lateralMDs;
double previousExitMD = lateralMDs.front(); double previousExitMD = lateralMDs.front();
double previousExitTVD = -lateralCoords.front().z(); double previousExitTVD = -lateralCoords.front().z();
@ -2009,24 +2024,25 @@ void RicWellPathExportMswCompletionsImpl::assignFractureCompletionsToCellSegment
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> std::vector<RigCompletionData> RicWellPathExportMswCompletionsImpl::generatePerforationIntersections(
RicWellPathExportMswCompletionsImpl::generatePerforationIntersections( const RimWellPath* wellPath, gsl::not_null<const RimWellPath*> wellPath,
const RimPerforationInterval* perforationInterval, gsl::not_null<const RimPerforationInterval*> perforationInterval,
int timeStep, int timeStep,
RimEclipseCase* eclipseCase ) gsl::not_null<RimEclipseCase*> eclipseCase )
{ {
std::vector<RigCompletionData> completionData; std::vector<RigCompletionData> completionData;
const RigActiveCellInfo* activeCellInfo = const RigActiveCellInfo* activeCellInfo =
eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); eclipseCase->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL );
auto wellPathGeometry = wellPath->wellPathGeometry();
CVF_ASSERT( wellPathGeometry );
bool hasDate = (size_t)timeStep < eclipseCase->timeStepDates().size(); bool hasDate = (size_t)timeStep < eclipseCase->timeStepDates().size();
bool isActive = !hasDate || perforationInterval->isActiveOnDate( eclipseCase->timeStepDates()[timeStep] ); bool isActive = !hasDate || perforationInterval->isActiveOnDate( eclipseCase->timeStepDates()[timeStep] );
if ( wellPath->perforationIntervalCollection()->isChecked() && perforationInterval->isChecked() && isActive ) if ( wellPath->perforationIntervalCollection()->isChecked() && perforationInterval->isChecked() && isActive )
{ {
std::pair<std::vector<cvf::Vec3d>, std::vector<double>> perforationPointsAndMD = std::pair<std::vector<cvf::Vec3d>, std::vector<double>> perforationPointsAndMD =
wellPath->wellPathGeometry()->clippedPointSubset( perforationInterval->startMD(), wellPathGeometry->clippedPointSubset( perforationInterval->startMD(), perforationInterval->endMD() );
perforationInterval->endMD() );
std::vector<WellPathCellIntersectionInfo> intersectedCells = std::vector<WellPathCellIntersectionInfo> intersectedCells =
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( eclipseCase->eclipseCaseData(), RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( eclipseCase->eclipseCaseData(),
@ -2139,11 +2155,13 @@ void RicWellPathExportMswCompletionsImpl::assignBranchNumbers( const RimEclipseC
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RicWellPathExportMswCompletionsImpl::tvdFromMeasuredDepth( const RimWellPath* wellPath, double measuredDepth ) double RicWellPathExportMswCompletionsImpl::tvdFromMeasuredDepth( gsl::not_null<const RimWellPath*> wellPath,
double measuredDepth )
{ {
CVF_ASSERT( wellPath && wellPath->wellPathGeometry() ); auto wellPathGeometry = wellPath->wellPathGeometry();
CVF_ASSERT( wellPathGeometry );
double tvdValue = -wellPath->wellPathGeometry()->interpolatedPointAlongWellPath( measuredDepth ).z(); double tvdValue = -wellPathGeometry->interpolatedPointAlongWellPath( measuredDepth ).z();
return tvdValue; return tvdValue;
} }

View File

@ -20,6 +20,8 @@
#include "RicMswExportInfo.h" #include "RicMswExportInfo.h"
#include "RigCompletionData.h" #include "RigCompletionData.h"
#include <gsl/gsl>
class RicExportCompletionDataSettingsUi; class RicExportCompletionDataSettingsUi;
class RifTextDataTableFormatter; class RifTextDataTableFormatter;
class RigActiveCellInfo; class RigActiveCellInfo;
@ -83,8 +85,8 @@ private:
static std::vector<WellPathCellIntersectionInfo> static std::vector<WellPathCellIntersectionInfo>
filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections, filterIntersections( const std::vector<WellPathCellIntersectionInfo>& intersections,
double initialMD, double initialMD,
const RigWellPath* wellPathGeometry, gsl::not_null<const RigWellPath*> wellPathGeometry,
const RimEclipseCase* eclipseCase ); gsl::not_null<const RimEclipseCase*> eclipseCase );
static void generateWelsegsTable( RifTextDataTableFormatter& formatter, static void generateWelsegsTable( RifTextDataTableFormatter& formatter,
const RicMswExportInfo& exportInfo, const RicMswExportInfo& exportInfo,
@ -180,10 +182,11 @@ private:
std::shared_ptr<RicMswSegment> segment, std::shared_ptr<RicMswSegment> segment,
bool* foundSubGridIntersections ); bool* foundSubGridIntersections );
static std::vector<RigCompletionData> generatePerforationIntersections( const RimWellPath* wellPath, static std::vector<RigCompletionData>
const RimPerforationInterval* perforationInterval, generatePerforationIntersections( gsl::not_null<const RimWellPath*> wellPath,
int timeStep, gsl::not_null<const RimPerforationInterval*> perforationInterval,
RimEclipseCase* eclipseCase ); int timeStep,
gsl::not_null<RimEclipseCase*> eclipseCase );
static void assignPerforationIntersections( const std::vector<RigCompletionData>& completionData, static void assignPerforationIntersections( const std::vector<RigCompletionData>& completionData,
std::shared_ptr<RicMswCompletion> perforationCompletion, std::shared_ptr<RicMswCompletion> perforationCompletion,
@ -196,5 +199,5 @@ private:
assignBranchNumbers( const RimEclipseCase* caseToApply, std::shared_ptr<RicMswSegment> segment, int* branchNum ); assignBranchNumbers( const RimEclipseCase* caseToApply, std::shared_ptr<RicMswSegment> segment, int* branchNum );
static void assignBranchNumbers( const RimEclipseCase* caseToApply, RicMswExportInfo* exportInfo ); static void assignBranchNumbers( const RimEclipseCase* caseToApply, RicMswExportInfo* exportInfo );
static double tvdFromMeasuredDepth( const RimWellPath* wellPath, double measuredDepth ); static double tvdFromMeasuredDepth( gsl::not_null<const RimWellPath*> wellPath, double measuredDepth );
}; };

View File

@ -50,10 +50,10 @@ CAF_CMD_SOURCE_INIT( RicExportSelectedWellPathsFeature, "RicExportSelectedWellPa
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportSelectedWellPathsFeature::exportWellPath( const RimWellPath* wellPath, void RicExportSelectedWellPathsFeature::exportWellPath( gsl::not_null<const RimWellPath*> wellPath,
double mdStepSize, double mdStepSize,
const QString& folder, const QString& folder,
bool writeProjectInfo ) bool writeProjectInfo )
{ {
auto fileName = wellPath->name() + ".dev"; auto fileName = wellPath->name() + ".dev";
auto filePtr = openFileForExport( folder, fileName ); auto filePtr = openFileForExport( folder, fileName );
@ -75,7 +75,7 @@ void RicExportSelectedWellPathsFeature::exportWellPath( const RimWellPath* wellP
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStream& stream, void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStream& stream,
const RigWellPath* wellPathGeom, const RigWellPath& wellPathGeom,
const QString& exportName, const QString& exportName,
double mdStepSize, double mdStepSize,
bool useMdRkb, bool useMdRkb,

View File

@ -22,6 +22,8 @@
#include <QFile> #include <QFile>
#include <gsl/gsl>
#include <memory> #include <memory>
class RigWellPath; class RigWellPath;
@ -44,21 +46,23 @@ class RicExportSelectedWellPathsFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
static void handleAction( const std::vector<RimWellPath*>& wellPaths ); static void handleAction( const std::vector<RimWellPath*>& wellPaths );
static void static void exportWellPath( gsl::not_null<const RimWellPath*> wellPath,
exportWellPath( const RimWellPath* wellPath, double mdStepSize, const QString& folder, bool writeProjectInfo = true ); double mdStepSize,
const QString& folder,
bool writeProjectInfo = true );
static RicExportWellPathsUi* openDialog(); static RicExportWellPathsUi* openDialog();
static QFilePtr openFileForExport( const QString& folderName, const QString& fileName ); static QFilePtr openFileForExport( const QString& folderName, const QString& fileName );
static QTextStreamPtr createOutputFileStream( QFile& file ); static QTextStreamPtr createOutputFileStream( QFile& file );
static void writeWellPathGeometryToStream( QTextStream& stream, static void writeWellPathGeometryToStream( QTextStream& stream,
const RimWellPath* wellPath, gsl::not_null<const RimWellPath*> wellPath,
const QString& exportName, const QString& exportName,
double mdStepSize, double mdStepSize,
bool writeProjectInfo = true ); bool writeProjectInfo = true );
static void writeWellPathGeometryToStream( QTextStream& stream, static void writeWellPathGeometryToStream( QTextStream& stream,
const RigWellPath* wellPath, const RigWellPath& wellPath,
const QString& exportName, const QString& exportName,
double mdStepSize, double mdStepSize,
bool useMdRkb, bool useMdRkb,

View File

@ -330,13 +330,13 @@ std::vector<LocationForNewFracture> RiuCreateMultipleFractionsUi::locationsForNe
{ {
for ( auto w : m_wellPaths ) for ( auto w : m_wellPaths )
{ {
auto wellPathGeometry = w->wellPathGeometry(); if ( w->wellPathGeometry() )
if ( wellPathGeometry )
{ {
double endMD = w->endMD();
int fractureCountForWell = 0; int fractureCountForWell = 0;
auto options = fractureOptions( m_sourceCase->eclipseCaseData(), w, this->options() ); auto options = fractureOptions( m_sourceCase->eclipseCaseData(), w, this->options() );
auto mdOfWellPathTip = wellPathGeometry->measureDepths().back(); double lastFracMd = endMD;
double lastFracMd = mdOfWellPathTip;
// Iterate options which are sorted from deeper to shallower // Iterate options which are sorted from deeper to shallower
for ( size_t i = 0; i < options.size(); i++ ) for ( size_t i = 0; i < options.size(); i++ )
@ -345,7 +345,7 @@ std::vector<LocationForNewFracture> RiuCreateMultipleFractionsUi::locationsForNe
double fracMdCandidate; double fracMdCandidate;
if ( i == 0 ) if ( i == 0 )
{ {
fracMdCandidate = mdOfWellPathTip - m_minDistanceFromWellTd; fracMdCandidate = endMD - m_minDistanceFromWellTd;
} }
else else
{ {
@ -428,12 +428,13 @@ std::vector<MultipleFracturesOption>
if ( !caseData->mainGrid() ) return options; if ( !caseData->mainGrid() ) return options;
auto wellPathGeometry = wellPath->wellPathGeometry(); auto wellPathGeometry = wellPath->wellPathGeometry();
CAF_ASSERT( wellPathGeometry );
std::vector<WellPathCellIntersectionInfo> wellPathInfos = std::vector<WellPathCellIntersectionInfo> wellPathInfos =
RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( caseData, RigWellPathIntersectionTools::findCellIntersectionInfosAlongPath( caseData,
wellPath->name(), wellPath->name(),
wellPathGeometry->wellPathPoints(), wellPathGeometry->wellPathPoints(),
wellPathGeometry->measureDepths() ); wellPathGeometry->measuredDepths() );
std::reverse( wellPathInfos.begin(), wellPathInfos.end() ); std::reverse( wellPathInfos.begin(), wellPathInfos.end() );
bool doCreateNewOption = true; bool doCreateNewOption = true;

View File

@ -52,10 +52,8 @@ CAF_CMD_SOURCE_INIT( RicNewWellPathFractureFeature, "RicNewWellPathFractureFeatu
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellPathFractureFeature::addFracture( RimWellPath* wellPath, double measuredDepth ) void RicNewWellPathFractureFeature::addFracture( gsl::not_null<RimWellPath*> wellPath, double measuredDepth )
{ {
CVF_ASSERT( wellPath );
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return; if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
RimWellPathFractureCollection* fractureCollection = wellPath->fractureCollection(); RimWellPathFractureCollection* fractureCollection = wellPath->fractureCollection();
@ -76,8 +74,11 @@ void RicNewWellPathFractureFeature::addFracture( RimWellPath* wellPath, double m
fracture->setMeasuredDepth( measuredDepth ); fracture->setMeasuredDepth( measuredDepth );
fracture->setFractureUnit( wellPath->unitSystem() ); fracture->setFractureUnit( wellPath->unitSystem() );
RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); auto wellPathGeometry = wellPath->wellPathGeometry();
cvf::Vec3d positionAtWellpath = wellPathGeometry->interpolatedPointAlongWellPath( measuredDepth ); CVF_ASSERT( wellPathGeometry );
if ( !wellPathGeometry ) return;
cvf::Vec3d positionAtWellpath = wellPathGeometry->interpolatedPointAlongWellPath( measuredDepth );
fracture->setAnchorPosition( positionAtWellpath ); fracture->setAnchorPosition( positionAtWellpath );
RimOilField* oilfield = nullptr; RimOilField* oilfield = nullptr;

View File

@ -20,6 +20,7 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include <gsl/gsl>
#include <vector> #include <vector>
class RimWellPathFractureCollection; class RimWellPathFractureCollection;
@ -33,7 +34,7 @@ class RicNewWellPathFractureFeature : public caf::CmdFeature
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
public: public:
static void addFracture( RimWellPath* wellPath, double measuredDepth ); static void addFracture( gsl::not_null<RimWellPath*> wellPath, double measuredDepth );
protected: protected:
void onActionTriggered( bool isChecked ) override; void onActionTriggered( bool isChecked ) override;

View File

@ -61,7 +61,7 @@ bool RicNewPltPlotFeature::isCommandEnabled()
if ( selectedWellPath ) if ( selectedWellPath )
{ {
if ( selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData( selectedWellPath ) ) if ( !selectedWellPath->wellPathGeometry() || !RimWellPlotTools::hasFlowData( selectedWellPath ) )
{ {
return false; return false;
} }

View File

@ -178,13 +178,15 @@ void RicNewWellBoreStabilityPlotFeature::onActionTriggered( bool isChecked )
return; return;
} }
if ( !wellPath->wellPathGeometry() ) auto wellPathGeometry = wellPath->wellPathGeometry();
if ( !wellPathGeometry )
{ {
RiaLogging::error( RiaLogging::error(
QString( "The well path %1 has no geometry. Cannot create a Well Bore Stability Plot" ).arg( wellPath->name() ) ); QString( "The well path %1 has no geometry. Cannot create a Well Bore Stability Plot" ).arg( wellPath->name() ) );
return; return;
} }
if ( wellPath->wellPathGeometry()->rkbDiff() == HUGE_VAL ) if ( wellPathGeometry->rkbDiff() == HUGE_VAL )
{ {
RiaLogging::error( QString( "The well path %1 has no datum elevation and we cannot estimate TVDRKB. Cannot " RiaLogging::error( QString( "The well path %1 has no datum elevation and we cannot estimate TVDRKB. Cannot "
"create a Well Bore Stability Plot" ) "create a Well Bore Stability Plot" )

View File

@ -60,7 +60,7 @@ RimWellBoreStabilityPlot*
plot->setAsPlotMdiWindow(); plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back( plot ); wellLogPlotColl->addWellLogPlot( plot );
if ( !plotDescription.isEmpty() ) if ( !plotDescription.isEmpty() )
{ {
@ -69,7 +69,7 @@ RimWellBoreStabilityPlot*
else else
{ {
plot->nameConfig()->setCustomName( plot->nameConfig()->setCustomName(
QString( "Well Bore Stability Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) ); QString( "Well Bore Stability Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots().size() ) );
} }
if ( showAfterCreation ) if ( showAfterCreation )
@ -94,7 +94,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
RimWellLogPlot* plot = new RimWellLogPlot(); RimWellLogPlot* plot = new RimWellLogPlot();
plot->setAsPlotMdiWindow(); plot->setAsPlotMdiWindow();
wellLogPlotColl->wellLogPlots().push_back( plot ); wellLogPlotColl->addWellLogPlot( plot );
if ( !plotDescription.isEmpty() ) if ( !plotDescription.isEmpty() )
{ {
@ -103,7 +103,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
else else
{ {
plot->nameConfig()->setCustomName( plot->nameConfig()->setCustomName(
QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots.size() ) ); QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots().size() ) );
} }
if ( showAfterCreation ) if ( showAfterCreation )

View File

@ -79,7 +79,7 @@ void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked )
fileCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); fileCurve->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
CVF_ASSERT( newObject ); CVF_ASSERT( newObject );
wellLogPlotCollection->wellLogPlots.push_back( newObject ); wellLogPlotCollection->addWellLogPlot( newObject );
// Resolve references after object has been inserted into the project data model // Resolve references after object has been inserted into the project data model
newObject->resolveReferencesRecursively(); newObject->resolveReferencesRecursively();

View File

@ -55,7 +55,7 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler( RimWellPathGeometryDef* wellGeometryDef ) RicCreateWellTargetsPickEventHandler::RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDef*> wellGeometryDef )
: m_geometryToAddTargetsTo( wellGeometryDef ) : m_geometryToAddTargetsTo( wellGeometryDef )
{ {
} }
@ -104,17 +104,15 @@ bool RicCreateWellTargetsPickEventHandler::handle3dPickEvent( const Ric3dPickEve
double azimuth = 0.0; double azimuth = 0.0;
double inclination = 0.0; double inclination = 0.0;
if ( wellPathSourceInfo ) if ( wellPathSourceInfo && wellPathSourceInfo->wellPath() && wellPathSourceInfo->wellPath()->wellPathGeometry() )
{ {
auto wellPathGeometry = wellPathSourceInfo->wellPath()->wellPathGeometry();
targetPointInDomain = targetPointInDomain =
wellPathSourceInfo->closestPointOnCenterLine( firstPickItem.faceIdx(), intersectionPointInDomain ); wellPathSourceInfo->closestPointOnCenterLine( firstPickItem.faceIdx(), intersectionPointInDomain );
double md = wellPathSourceInfo->measuredDepth( firstPickItem.faceIdx(), intersectionPointInDomain ); double md = wellPathSourceInfo->measuredDepth( firstPickItem.faceIdx(), intersectionPointInDomain );
doSetAzimuthAndInclination = doSetAzimuthAndInclination = calculateAzimuthAndInclinationAtMd( md, wellPathGeometry, &azimuth, &inclination );
calculateAzimuthAndInclinationAtMd( md, double rkbDiff = wellPathGeometry->rkbDiff();
wellPathSourceInfo->wellPath()->wellPathGeometry(),
&azimuth,
&inclination );
double rkbDiff = wellPathSourceInfo->wellPath()->wellPathGeometry()->rkbDiff();
if ( m_geometryToAddTargetsTo->airGap() == 0.0 && rkbDiff != std::numeric_limits<double>::infinity() ) if ( m_geometryToAddTargetsTo->airGap() == 0.0 && rkbDiff != std::numeric_limits<double>::infinity() )
{ {
m_geometryToAddTargetsTo->setAirGap( rkbDiff ); m_geometryToAddTargetsTo->setAirGap( rkbDiff );
@ -195,13 +193,13 @@ bool RicCreateWellTargetsPickEventHandler::handle3dPickEvent( const Ric3dPickEve
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd( double measuredDepth, bool RicCreateWellTargetsPickEventHandler::calculateAzimuthAndInclinationAtMd( double measuredDepth,
const RigWellPath* wellPathGeometry, gsl::not_null<const RigWellPath*> wellPathGeometry,
double* azimuth, double* azimuth,
double* inclination ) const double* inclination ) const
{ {
int mdIndex = -1; int mdIndex = -1;
auto mdList = wellPathGeometry->measureDepths(); auto mdList = wellPathGeometry->measuredDepths();
for ( int i = 0; i < (int)mdList.size(); i++ ) for ( int i = 0; i < (int)mdList.size(); i++ )
{ {
@ -258,10 +256,10 @@ bool RicCreateWellTargetsPickEventHandler::isGridSourceObject( const cvf::Object
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( Rim3dView* view, cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( gsl::not_null<Rim3dView*> view,
const RiuPickItemInfo& pickItem, const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin, const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd ) const cvf::Vec3d& domainRayEnd )
{ {
auto sourceInfo = dynamic_cast<const RivSourceInfo*>( pickItem.sourceInfo() ); auto sourceInfo = dynamic_cast<const RivSourceInfo*>( pickItem.sourceInfo() );
auto femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>( pickItem.sourceInfo() ); auto femSourceInfo = dynamic_cast<const RivFemPickSourceInfo*>( pickItem.sourceInfo() );
@ -275,7 +273,7 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( Rim
{ {
cellIndex = sourceInfo->m_cellFaceFromTriangleMapper->cellIndex( pickItem.faceIdx() ); cellIndex = sourceInfo->m_cellFaceFromTriangleMapper->cellIndex( pickItem.faceIdx() );
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view ); RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view.get() );
if ( eclipseView && eclipseView->mainGrid() ) if ( eclipseView && eclipseView->mainGrid() )
{ {
RigGridBase* hitGrid = eclipseView->mainGrid()->gridByIndex( gridIndex ); RigGridBase* hitGrid = eclipseView->mainGrid()->gridByIndex( gridIndex );
@ -290,7 +288,7 @@ cvf::Vec3d RicCreateWellTargetsPickEventHandler::findHexElementIntersection( Rim
{ {
size_t elementIndex = femSourceInfo->triangleToElmMapper()->elementIndex( pickItem.faceIdx() ); size_t elementIndex = femSourceInfo->triangleToElmMapper()->elementIndex( pickItem.faceIdx() );
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view ); RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view.get() );
if ( geoMechView && geoMechView->femParts() ) if ( geoMechView && geoMechView->femParts() )
{ {
RigFemPart* femPart = geoMechView->femParts()->part( femPartIndex ); RigFemPart* femPart = geoMechView->femParts()->part( femPartIndex );

View File

@ -22,6 +22,8 @@
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include <gsl/gsl>
class RimWellPathGeometryDef; class RimWellPathGeometryDef;
class RigWellPath; class RigWellPath;
@ -31,7 +33,7 @@ class RigWellPath;
class RicCreateWellTargetsPickEventHandler : public Ric3dViewPickEventHandler class RicCreateWellTargetsPickEventHandler : public Ric3dViewPickEventHandler
{ {
public: public:
RicCreateWellTargetsPickEventHandler( RimWellPathGeometryDef* wellGeometryDef ); RicCreateWellTargetsPickEventHandler( gsl::not_null<RimWellPathGeometryDef*> wellGeometryDef );
~RicCreateWellTargetsPickEventHandler(); ~RicCreateWellTargetsPickEventHandler();
void registerAsPickEventHandler() override; void registerAsPickEventHandler() override;
@ -41,16 +43,16 @@ protected:
void notifyUnregistered() override; void notifyUnregistered() override;
private: private:
bool calculateAzimuthAndInclinationAtMd( double measuredDepth, bool calculateAzimuthAndInclinationAtMd( double measuredDepth,
const RigWellPath* wellPathGeometry, gsl::not_null<const RigWellPath*> wellPathGeometry,
double* azimuth, double* azimuth,
double* inclination ) const; double* inclination ) const;
static bool isGridSourceObject( const cvf::Object* object ); static bool isGridSourceObject( const cvf::Object* object );
static cvf::Vec3d findHexElementIntersection( Rim3dView* view, static cvf::Vec3d findHexElementIntersection( gsl::not_null<Rim3dView*> view,
const RiuPickItemInfo& pickItem, const RiuPickItemInfo& pickItem,
const cvf::Vec3d& domainRayOrigin, const cvf::Vec3d& domainRayOrigin,
const cvf::Vec3d& domainRayEnd ); const cvf::Vec3d& domainRayEnd );
private: private:
caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo; caf::PdmPointer<RimWellPathGeometryDef> m_geometryToAddTargetsTo;

View File

@ -121,7 +121,7 @@ double RifFractureModelPerfsFrkExporter::computeMeasuredDepthForPosition( const
{ {
const RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); const RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
const std::vector<double>& mdValuesOfWellPath = wellPathGeometry->measureDepths(); const std::vector<double>& mdValuesOfWellPath = wellPathGeometry->measuredDepths();
const std::vector<double>& tvdValuesOfWellPath = wellPathGeometry->trueVerticalDepths(); const std::vector<double>& tvdValuesOfWellPath = wellPathGeometry->trueVerticalDepths();
const double targetTvd = -position.z(); const double targetTvd = -position.z();

View File

@ -178,9 +178,11 @@ RifWellPathImporter::WellData RifWellPathImporter::readJsonWellData( const QStri
cvf::Vec3d vec3d( coordinateMap["east"].toDouble(), cvf::Vec3d vec3d( coordinateMap["east"].toDouble(),
coordinateMap["north"].toDouble(), coordinateMap["north"].toDouble(),
-( coordinateMap["tvd"].toDouble() - datumElevation ) ); -( coordinateMap["tvd"].toDouble() - datumElevation ) );
wellData.m_wellPathGeometry->m_wellPathPoints.push_back( vec3d );
double measuredDepth = coordinateMap["md"].toDouble(); double measuredDepth = coordinateMap["md"].toDouble();
wellData.m_wellPathGeometry->m_measuredDepths.push_back( measuredDepth );
wellData.m_wellPathGeometry->addWellPathPoint( vec3d );
wellData.m_wellPathGeometry->addMeasuredDepth( measuredDepth );
} }
return wellData; return wellData;
} }
@ -225,8 +227,8 @@ void RifWellPathImporter::readAllAsciiWellData( const QString& filePath )
} }
cvf::Vec3d wellPoint( x, y, -tvd ); cvf::Vec3d wellPoint( x, y, -tvd );
fileWellDataArray.back().m_wellPathGeometry->m_wellPathPoints.push_back( wellPoint ); fileWellDataArray.back().m_wellPathGeometry->addWellPathPoint( wellPoint );
fileWellDataArray.back().m_wellPathGeometry->m_measuredDepths.push_back( md ); fileWellDataArray.back().m_wellPathGeometry->addMeasuredDepth( md );
hasReadWellPointInCurrentWell = true; hasReadWellPointInCurrentWell = true;
} }

View File

@ -219,7 +219,7 @@ void RigFemPartResultsCollection::setActiveFormationNames( RigFormationNames* ac
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if ( plotCollection ) if ( plotCollection )
{ {
for ( RimWellLogPlot* wellLogPlot : plotCollection->wellLogPlots ) for ( auto wellLogPlot : plotCollection->wellLogPlots() )
{ {
wellLogPlot->loadDataAndUpdate(); wellLogPlot->loadDataAndUpdate();
} }

View File

@ -45,21 +45,19 @@ Riv3dWellLogCurveGeometryGenerator::Riv3dWellLogCurveGeometryGenerator( RimWellP
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables( const caf::DisplayCoordTransform* displayCoordTransform, void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables( gsl::not_null<const caf::DisplayCoordTransform*> displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve, gsl::not_null<const Rim3dWellLogCurve*> wellLogCurve,
double planeOffsetFromWellPathCenter, double planeOffsetFromWellPathCenter,
double planeWidth, double planeWidth,
const std::vector<cvf::Vec3d>& drawSurfaceVertices, const std::vector<cvf::Vec3d>& drawSurfaceVertices,
int currentTimeStep ) int currentTimeStep )
{ {
CVF_ASSERT( rim3dWellLogCurve );
// Make sure all drawables are cleared in case we return early to avoid a // Make sure all drawables are cleared in case we return early to avoid a
// previous drawable being "stuck" when changing result type. // previous drawable being "stuck" when changing result type.
clearCurvePointsAndGeometry(); clearCurvePointsAndGeometry();
float curveUIRange = rim3dWellLogCurve->maxCurveUIValue() - rim3dWellLogCurve->minCurveUIValue(); float curveUIRange = wellLogCurve->maxCurveUIValue() - wellLogCurve->minCurveUIValue();
if ( curveUIRange < 1.0e-6f ) if ( curveUIRange < 1.0e-6f )
{ {
return; return;
@ -67,19 +65,21 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables( const caf::Displa
std::vector<double> resultValues; std::vector<double> resultValues;
std::vector<double> resultMds; std::vector<double> resultMds;
if ( rim3dWellLogCurve->followAnimationTimeStep() ) if ( wellLogCurve->followAnimationTimeStep() )
{ {
rim3dWellLogCurve->curveValuesAndMdsAtTimeStep( &resultValues, &resultMds, currentTimeStep ); wellLogCurve->curveValuesAndMdsAtTimeStep( &resultValues, &resultMds, currentTimeStep );
} }
else else
{ {
rim3dWellLogCurve->curveValuesAndMds( &resultValues, &resultMds ); wellLogCurve->curveValuesAndMds( &resultValues, &resultMds );
} }
m_planeWidth = planeWidth; m_planeWidth = planeWidth;
if ( !wellPathGeometry() ) return; auto wellPathGeometry = this->wellPathGeometry();
if ( wellPathGeometry()->m_wellPathPoints.empty() ) return; if ( !wellPathGeometry ) return;
if ( wellPathGeometry->wellPathPoints().empty() ) return;
if ( !wellPathClipBoundingBox.isValid() ) return; if ( !wellPathClipBoundingBox.isValid() ) return;
if ( resultValues.empty() ) return; if ( resultValues.empty() ) return;
@ -88,7 +88,7 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables( const caf::Displa
RimWellPathCollection* wellPathCollection = nullptr; RimWellPathCollection* wellPathCollection = nullptr;
m_wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection ); m_wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
cvf::Vec3d clipLocation = wellPathGeometry()->m_wellPathPoints.front(); cvf::Vec3d clipLocation = wellPathGeometry->wellPathPoints().front();
if ( wellPathCollection->wellPathClip ) if ( wellPathCollection->wellPathClip )
{ {
double clipZDistance = wellPathCollection->wellPathClipZDistance; double clipZDistance = wellPathCollection->wellPathClipZDistance;
@ -97,20 +97,19 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables( const caf::Displa
clipLocation = displayCoordTransform->transformToDisplayCoord( clipLocation ); clipLocation = displayCoordTransform->transformToDisplayCoord( clipLocation );
std::vector<cvf::Vec3d> displayCoords = std::vector<cvf::Vec3d> displayCoords =
displayCoordTransform->transformToDisplayCoords( wellPathGeometry()->m_wellPathPoints ); displayCoordTransform->transformToDisplayCoords( wellPathGeometry->wellPathPoints() );
std::vector<cvf::Vec3d> wellPathCurveNormals = std::vector<cvf::Vec3d> wellPathCurveNormals =
RigWellPathGeometryTools::calculateLineSegmentNormals( displayCoords, RigWellPathGeometryTools::calculateLineSegmentNormals( displayCoords,
rim3dWellLogCurve->drawPlaneAngle( wellLogCurve->drawPlaneAngle( wellLogCurve->drawPlane() ) );
rim3dWellLogCurve->drawPlane() ) );
std::vector<cvf::Vec3d> interpolatedWellPathPoints; std::vector<cvf::Vec3d> interpolatedWellPathPoints;
std::vector<cvf::Vec3d> interpolatedCurveNormals; std::vector<cvf::Vec3d> interpolatedCurveNormals;
// Iterate from bottom of well path and up to be able to stop at given Z max clipping height // Iterate from bottom of well path and up to be able to stop at given Z max clipping height
for ( auto md = resultMds.rbegin(); md != resultMds.rend(); md++ ) for ( auto md = resultMds.rbegin(); md != resultMds.rend(); md++ )
{ {
cvf::Vec3d point = wellPathGeometry()->interpolatedVectorValuesAlongWellPath( displayCoords, *md ); cvf::Vec3d point = wellPathGeometry->interpolatedVectorValuesAlongWellPath( displayCoords, *md );
cvf::Vec3d normal = wellPathGeometry()->interpolatedVectorValuesAlongWellPath( wellPathCurveNormals, *md ); cvf::Vec3d normal = wellPathGeometry->interpolatedVectorValuesAlongWellPath( wellPathCurveNormals, *md );
if ( point.z() > clipLocation.z() ) break; if ( point.z() > clipLocation.z() ) break;
interpolatedWellPathPoints.push_back( point ); interpolatedWellPathPoints.push_back( point );
@ -129,8 +128,8 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveDrawables( const caf::Displa
double maxVisibleResult = -std::numeric_limits<double>::max(); double maxVisibleResult = -std::numeric_limits<double>::max();
double minVisibleResult = std::numeric_limits<double>::max(); double minVisibleResult = std::numeric_limits<double>::max();
double minCurveValue = rim3dWellLogCurve->minCurveUIValue(); double minCurveValue = wellLogCurve->minCurveUIValue();
double maxCurveValue = rim3dWellLogCurve->maxCurveUIValue(); double maxCurveValue = wellLogCurve->maxCurveUIValue();
double curveEpsilon = 1.0e-6; double curveEpsilon = 1.0e-6;

View File

@ -24,6 +24,8 @@
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include <gsl/gsl>
#include <vector> #include <vector>
namespace caf namespace caf
@ -46,13 +48,13 @@ public:
typedef std::pair<cvf::Vec3d, double> PointValuePair; typedef std::pair<cvf::Vec3d, double> PointValuePair;
Riv3dWellLogCurveGeometryGenerator( RimWellPath* wellPath ); Riv3dWellLogCurveGeometryGenerator( RimWellPath* wellPath );
void createCurveDrawables( const caf::DisplayCoordTransform* displayCoordTransform, void createCurveDrawables( gsl::not_null<const caf::DisplayCoordTransform*> displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox, const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve, gsl::not_null<const Rim3dWellLogCurve*> wellLogCurve,
double planeOffsetFromWellPathCenter, double planeOffsetFromWellPathCenter,
double planeWidth, double planeWidth,
const std::vector<cvf::Vec3d>& drawSurfaceVertices, const std::vector<cvf::Vec3d>& drawSurfaceVertices,
int currentTimeStep ); int currentTimeStep );
void clearCurvePointsAndGeometry(); void clearCurvePointsAndGeometry();

View File

@ -57,7 +57,7 @@ bool Riv3dWellLogDrawSurfaceGenerator::createDrawSurface( const caf::DisplayCoor
clearGeometry(); clearGeometry();
if ( !wellPathGeometry() || wellPathGeometry()->m_measuredDepths.empty() ) if ( !wellPathGeometry() || wellPathGeometry()->measuredDepths().empty() )
{ {
return false; return false;
} }
@ -72,7 +72,7 @@ bool Riv3dWellLogDrawSurfaceGenerator::createDrawSurface( const caf::DisplayCoor
std::vector<cvf::Vec3d> wellPathDisplayCoords; std::vector<cvf::Vec3d> wellPathDisplayCoords;
{ {
std::vector<cvf::Vec3d> domainCoords = wellPathGeometry()->m_wellPathPoints; const std::vector<cvf::Vec3d>& domainCoords = wellPathGeometry()->wellPathPoints();
if ( domainCoords.size() < (size_t)2 ) if ( domainCoords.size() < (size_t)2 )
{ {
// Need at least two well path points to create a valid path. // Need at least two well path points to create a valid path.
@ -193,8 +193,8 @@ void Riv3dWellLogDrawSurfaceGenerator::createCurveNormalVectors( const caf::Disp
std::vector<cvf::Vec3d> interpolatedWellPathPoints; std::vector<cvf::Vec3d> interpolatedWellPathPoints;
std::vector<cvf::Vec3d> interpolatedWellPathNormals; std::vector<cvf::Vec3d> interpolatedWellPathNormals;
double firstMd = wellPathGeometry()->m_measuredDepths.at( clipStartIndex ); double firstMd = wellPathGeometry()->measuredDepths().at( clipStartIndex );
double lastMd = wellPathGeometry()->m_measuredDepths.back(); double lastMd = wellPathGeometry()->measuredDepths().back();
double md = lastMd; double md = lastMd;
while ( md >= firstMd ) while ( md >= firstMd )

View File

@ -104,7 +104,7 @@ void RivWellConnectionFactorPartMgr::appendDynamicGeometryPartsToModel( cvf::Mod
std::vector<WellPathCellIntersectionInfo> wellPathCellIntersections; std::vector<WellPathCellIntersectionInfo> wellPathCellIntersections;
{ {
RigEclipseWellLogExtractor* extractor = RigEclipseWellLogExtractor* extractor =
RiaExtractionTools::wellLogExtractorEclipseCase( m_rimWellPath, eclipseCase ); RiaExtractionTools::findOrCreateWellLogExtractor( m_rimWellPath, eclipseCase );
if ( extractor ) if ( extractor )
{ {
wellPathCellIntersections = extractor->cellIntersectionInfosAlongWellPath(); wellPathCellIntersections = extractor->cellIntersectionInfosAlongWellPath();

View File

@ -100,7 +100,7 @@ bool RivWellPathPartMgr::isWellPathWithinBoundingBox( const cvf::BoundingBox& we
{ {
if ( !m_rimWellPath->wellPathGeometry() ) return false; if ( !m_rimWellPath->wellPathGeometry() ) return false;
const std::vector<cvf::Vec3d>& wellpathCenterLine = m_rimWellPath->wellPathGeometry()->m_wellPathPoints; const std::vector<cvf::Vec3d>& wellpathCenterLine = m_rimWellPath->wellPathGeometry()->wellPathPoints();
if ( wellpathCenterLine.size() < 2 ) return false; if ( wellpathCenterLine.size() < 2 ) return false;
// Skip visualization if outside the domain of this case // Skip visualization if outside the domain of this case
@ -430,7 +430,7 @@ void RivWellPathPartMgr::appendPerforationsToModel( cvf::ModelBasicList*
} }
// Since we're using the index of measured depths to find the index of a point, ensure they're equal // Since we're using the index of measured depths to find the index of a point, ensure they're equal
CVF_ASSERT( wellPathGeometry->m_measuredDepths.size() == wellPathGeometry->m_wellPathPoints.size() ); CVF_ASSERT( wellPathGeometry->measuredDepths().size() == wellPathGeometry->wellPathPoints().size() );
double wellPathRadius = this->wellPathRadius( characteristicCellSize, wellPathCollection ); double wellPathRadius = this->wellPathRadius( characteristicCellSize, wellPathCollection );
double perforationRadius = wellPathRadius * 1.1; double perforationRadius = wellPathRadius * 1.1;
@ -652,7 +652,7 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d
RigWellPath* wellPathGeometry = m_rimWellPath->wellPathGeometry(); RigWellPath* wellPathGeometry = m_rimWellPath->wellPathGeometry();
if ( !wellPathGeometry ) return; if ( !wellPathGeometry ) return;
const std::vector<cvf::Vec3d>& wellpathCenterLine = wellPathGeometry->m_wellPathPoints; const std::vector<cvf::Vec3d>& wellpathCenterLine = wellPathGeometry->wellPathPoints();
if ( wellpathCenterLine.size() < 2 ) return; if ( wellpathCenterLine.size() < 2 ) return;

View File

@ -64,10 +64,14 @@ double RivWellPathSourceInfo::measuredDepth( size_t triangleIndex, const cvf::Ve
size_t firstSegmentIndex = cvf::UNDEFINED_SIZE_T; size_t firstSegmentIndex = cvf::UNDEFINED_SIZE_T;
double norm = 0.0; double norm = 0.0;
CAF_ASSERT( m_wellPath.notNull() );
auto wellPathGeometry = m_wellPath->wellPathGeometry();
CAF_ASSERT( wellPathGeometry );
normalizedIntersection( triangleIndex, globalIntersectionInDomain, &firstSegmentIndex, &norm ); normalizedIntersection( triangleIndex, globalIntersectionInDomain, &firstSegmentIndex, &norm );
double firstDepth = m_wellPath->wellPathGeometry()->m_measuredDepths[firstSegmentIndex]; double firstDepth = wellPathGeometry->measuredDepths()[firstSegmentIndex];
double secDepth = m_wellPath->wellPathGeometry()->m_measuredDepths[firstSegmentIndex + 1]; double secDepth = wellPathGeometry->measuredDepths()[firstSegmentIndex + 1];
return firstDepth * ( 1.0 - norm ) + norm * secDepth; return firstDepth * ( 1.0 - norm ) + norm * secDepth;
} }
@ -81,10 +85,14 @@ cvf::Vec3d RivWellPathSourceInfo::closestPointOnCenterLine( size_t tr
size_t firstSegmentIndex = cvf::UNDEFINED_SIZE_T; size_t firstSegmentIndex = cvf::UNDEFINED_SIZE_T;
double norm = 0.0; double norm = 0.0;
CAF_ASSERT( m_wellPath.notNull() );
auto wellPathGeometry = m_wellPath->wellPathGeometry();
CAF_ASSERT( wellPathGeometry );
normalizedIntersection( triangleIndex, globalIntersectionInDomain, &firstSegmentIndex, &norm ); normalizedIntersection( triangleIndex, globalIntersectionInDomain, &firstSegmentIndex, &norm );
cvf::Vec3d firstDepth = m_wellPath->wellPathGeometry()->m_wellPathPoints[firstSegmentIndex]; cvf::Vec3d firstDepth = wellPathGeometry->wellPathPoints()[firstSegmentIndex];
cvf::Vec3d secDepth = m_wellPath->wellPathGeometry()->m_wellPathPoints[firstSegmentIndex + 1]; cvf::Vec3d secDepth = wellPathGeometry->wellPathPoints()[firstSegmentIndex + 1];
return firstDepth * ( 1.0 - norm ) + norm * secDepth; return firstDepth * ( 1.0 - norm ) + norm * secDepth;
} }
@ -97,11 +105,14 @@ void RivWellPathSourceInfo::normalizedIntersection( size_t triangleIn
size_t* firstSegmentIndex, size_t* firstSegmentIndex,
double* normalizedSegmentIntersection ) const double* normalizedSegmentIntersection ) const
{ {
size_t segIndex = segmentIndex( triangleIndex ); CAF_ASSERT( m_wellPath.notNull() );
RigWellPath* rigWellPath = m_wellPath->wellPathGeometry(); auto wellPathGeometry = m_wellPath->wellPathGeometry();
CAF_ASSERT( wellPathGeometry );
cvf::Vec3d segmentStart = rigWellPath->m_wellPathPoints[segIndex]; size_t segIndex = segmentIndex( triangleIndex );
cvf::Vec3d segmentEnd = rigWellPath->m_wellPathPoints[segIndex + 1];
cvf::Vec3d segmentStart = wellPathGeometry->wellPathPoints()[segIndex];
cvf::Vec3d segmentEnd = wellPathGeometry->wellPathPoints()[segIndex + 1];
double norm = 0.0; double norm = 0.0;
cvf::GeometryTools::projectPointOnLine( segmentStart, segmentEnd, globalIntersectionInDomain, &norm ); cvf::GeometryTools::projectPointOnLine( segmentStart, segmentEnd, globalIntersectionInDomain, &norm );

View File

@ -24,6 +24,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimCellEdgeColors.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.h ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewTools.h ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewTools.h
${CMAKE_CURRENT_LIST_DIR}/RimAbstractWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h ${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.h
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h ${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.h
@ -204,6 +205,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimCellEdgeColors.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInView.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSimWellInViewTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RimAbstractWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimFileWellPath.cpp
${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimModeledWellPath.cpp

View File

@ -81,7 +81,8 @@ void RimCompletionCellIntersectionCalc::calculateCompletionTypeResult( RimEclips
{ {
auto intersectedCells = auto intersectedCells =
RigWellPathIntersectionTools::findIntersectedGlobalCellIndices( eclipseCaseData, RigWellPathIntersectionTools::findIntersectedGlobalCellIndices( eclipseCaseData,
wellPath->wellPathGeometry()->m_wellPathPoints ); wellPath->wellPathGeometry()
->wellPathPoints() );
for ( auto& intersection : intersectedCells ) for ( auto& intersection : intersectedCells )
{ {

View File

@ -68,8 +68,8 @@ void RimFishboneWellPathCollection::importCompletionsFromFile( const QStringList
RifWellPathImporter::WellData wellData = wellPathImporter.readWellData( filePath, i ); RifWellPathImporter::WellData wellData = wellPathImporter.readWellData( filePath, i );
RimFishboneWellPath* wellCompletion = new RimFishboneWellPath(); RimFishboneWellPath* wellCompletion = new RimFishboneWellPath();
wellCompletion->setName( wellData.m_name ); wellCompletion->setName( wellData.m_name );
wellCompletion->setCoordinates( wellData.m_wellPathGeometry->m_wellPathPoints ); wellCompletion->setCoordinates( wellData.m_wellPathGeometry->wellPathPoints() );
wellCompletion->setMeasuredDepths( wellData.m_wellPathGeometry->m_measuredDepths ); wellCompletion->setMeasuredDepths( wellData.m_wellPathGeometry->measuredDepths() );
appendCompletion( wellCompletion ); appendCompletion( wellCompletion );
} }
} }

View File

@ -868,18 +868,12 @@ void RimFractureModel::defineEditorAttribute( const caf::PdmFieldHandle* field,
if ( myAttr ) if ( myAttr )
{ {
RimWellPath* rimWellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( rimWellPath ); this->firstAncestorOrThisOfType( wellPath );
if ( !rimWellPath ) return; if ( !wellPath ) return;
RigWellPath* wellPathGeo = rimWellPath->wellPathGeometry(); myAttr->m_minimum = wellPath->startMD();
if ( !wellPathGeo ) return; myAttr->m_maximum = wellPath->endMD();
if ( wellPathGeo->m_measuredDepths.size() > 1 )
{
myAttr->m_minimum = wellPathGeo->m_measuredDepths.front();
myAttr->m_maximum = wellPathGeo->m_measuredDepths.back();
}
} }
} }
} }

View File

@ -159,23 +159,18 @@ void RimMultipleValveLocations::computeRangesAndLocations()
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath ); this->firstAncestorOrThisOfTypeAsserted( wellPath );
RigWellPath* rigWellPathGeo = wellPath->wellPathGeometry(); double firstWellPathMD = wellPath->startMD();
if ( rigWellPathGeo && rigWellPathGeo->m_measuredDepths.size() > 1 ) double lastWellPathMD = wellPath->endMD();
double overlapStart = std::max( firstWellPathMD, m_rangeStart() );
double overlapEnd = std::min( lastWellPathMD, m_rangeEnd() );
double overlap = std::max( 0.0, overlapEnd - overlapStart );
if ( overlap )
{ {
double firstWellPathMD = rigWellPathGeo->m_measuredDepths.front(); for ( auto md : locationsFromStartSpacingAndCount( overlapStart, m_rangeValveSpacing, m_rangeValveCount ) )
double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back();
double overlapStart = std::max( firstWellPathMD, m_rangeStart() );
double overlapEnd = std::min( lastWellPathMD, m_rangeEnd() );
double overlap = std::max( 0.0, overlapEnd - overlapStart );
if ( overlap )
{ {
for ( auto md : validMeasuredDepths.push_back( md );
locationsFromStartSpacingAndCount( overlapStart, m_rangeValveSpacing, m_rangeValveCount ) )
{
validMeasuredDepths.push_back( md );
}
} }
} }
} }
@ -433,13 +428,7 @@ double RimMultipleValveLocations::perforationEndMD() const
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath ); this->firstAncestorOrThisOfTypeAsserted( wellPath );
RigWellPath* rigWellPathGeo = wellPath->wellPathGeometry(); return wellPath->endMD();
if ( rigWellPathGeo && !rigWellPathGeo->m_measuredDepths.empty() )
{
double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back();
return lastWellPathMD;
}
return std::numeric_limits<double>::infinity();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -397,18 +397,12 @@ void RimPerforationInterval::defineEditorAttribute( const caf::PdmFieldHandle* f
if ( myAttr ) if ( myAttr )
{ {
RimWellPath* rimWellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( rimWellPath ); this->firstAncestorOrThisOfType( wellPath );
if ( !rimWellPath ) return; if ( !wellPath ) return;
RigWellPath* wellPathGeo = rimWellPath->wellPathGeometry(); myAttr->m_minimum = wellPath->startMD();
if ( !wellPathGeo ) return; myAttr->m_maximum = wellPath->endMD();
if ( wellPathGeo->m_measuredDepths.size() > 1 )
{
myAttr->m_minimum = wellPathGeo->m_measuredDepths.front();
myAttr->m_maximum = wellPathGeo->m_measuredDepths.back();
}
} }
} }
} }

View File

@ -134,10 +134,8 @@ std::vector<cvf::Vec3d> RimSimWellFracture::perforationLengthCenterLineCoords()
if ( !m_branchCenterLines.empty() && m_branchIndex < static_cast<int>( m_branchCenterLines.size() ) ) if ( !m_branchCenterLines.empty() && m_branchIndex < static_cast<int>( m_branchCenterLines.size() ) )
{ {
RigWellPath wellPathGeometry; RigWellPath wellPathGeometry( m_branchCenterLines[m_branchIndex].wellPathPoints(),
m_branchCenterLines[m_branchIndex].measuredDepths() );
wellPathGeometry.m_wellPathPoints = m_branchCenterLines[m_branchIndex].wellPathPoints();
wellPathGeometry.m_measuredDepths = m_branchCenterLines[m_branchIndex].measuredDepths();
double startMd = m_location - perforationLength() / 2.0; double startMd = m_location - perforationLength() / 2.0;
double endMd = m_location + perforationLength() / 2.0; double endMd = m_location + perforationLength() / 2.0;

View File

@ -293,18 +293,12 @@ void RimWellPathFracture::defineEditorAttribute( const caf::PdmFieldHandle* fiel
if ( myAttr ) if ( myAttr )
{ {
RimWellPath* rimWellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfType( rimWellPath ); this->firstAncestorOrThisOfType( wellPath );
if ( !rimWellPath ) return; if ( !wellPath ) return;
RigWellPath* wellPathGeo = rimWellPath->wellPathGeometry(); myAttr->m_minimum = wellPath->startMD();
if ( !wellPathGeo ) return; myAttr->m_maximum = wellPath->endMD();
if ( wellPathGeo->m_measuredDepths.size() > 1 )
{
myAttr->m_minimum = wellPathGeo->m_measuredDepths.front();
myAttr->m_maximum = wellPathGeo->m_measuredDepths.back();
}
} }
} }
} }

View File

@ -572,16 +572,11 @@ void RimWellPathValve::defineEditorAttribute( const caf::PdmFieldHandle* field,
} }
else else
{ {
RimWellPath* rimWellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( rimWellPath ); this->firstAncestorOrThisOfTypeAsserted( wellPath );
RigWellPath* wellPathGeo = rimWellPath->wellPathGeometry();
if ( !wellPathGeo ) return;
if ( wellPathGeo->m_measuredDepths.size() > 1 ) minimumValue = wellPath->startMD();
{ maximumValue = wellPath->endMD();
minimumValue = wellPathGeo->measureDepths().front();
maximumValue = wellPathGeo->measureDepths().back();
}
} }
myAttr->m_minimum = minimumValue; myAttr->m_minimum = minimumValue;
myAttr->m_maximum = maximumValue; myAttr->m_maximum = maximumValue;

View File

@ -190,7 +190,7 @@ void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep( std::vector<doubl
if ( eclipseCase ) if ( eclipseCase )
{ {
cvf::ref<RigEclipseWellLogExtractor> eclExtractor = cvf::ref<RigEclipseWellLogExtractor> eclExtractor =
RiaExtractionTools::wellLogExtractorEclipseCase( wellPath, eclipseCase ); RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, eclipseCase );
if ( eclExtractor.notNull() ) if ( eclExtractor.notNull() )
{ {
*measuredDepthValues = eclExtractor->cellIntersectionMDs(); *measuredDepthValues = eclExtractor->cellIntersectionMDs();
@ -214,7 +214,7 @@ void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep( std::vector<doubl
if ( geomCase ) if ( geomCase )
{ {
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = cvf::ref<RigGeoMechWellLogExtractor> geomExtractor =
RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath, geomCase ); RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, geomCase );
if ( geomExtractor.notNull() ) if ( geomExtractor.notNull() )
{ {

View File

@ -0,0 +1,29 @@
#include "RimAbstractWellPath.h"
#include "RigWellPath.h"
CAF_PDM_ABSTRACT_SOURCE_INIT( RimAbstractWellPath, "AbstractWellPath" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimAbstractWellPath::startMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measuredDepths().front();
}
return std::numeric_limits<double>::infinity();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimAbstractWellPath::endMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measuredDepths().back();
}
return std::numeric_limits<double>::infinity();
}

View File

@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020- 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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimWellPathComponentInterface.h"
#include "cafPdmObject.h"
class RigWellPath;
class RimAbstractWellPath : public caf::PdmObject, public RimWellPathComponentInterface
{
CAF_PDM_HEADER_INIT;
public:
virtual RigWellPath* wellPathGeometry() = 0;
virtual const RigWellPath* wellPathGeometry() const = 0;
double startMD() const override;
double endMD() const override;
};

View File

@ -434,7 +434,7 @@ std::vector<std::vector<cvf::Vec3d>> RimExtrudedCurveIntersection::polyLines( cv
{ {
if ( wellPath() && wellPath->wellPathGeometry() ) if ( wellPath() && wellPath->wellPathGeometry() )
{ {
lines.push_back( wellPath->wellPathGeometry()->m_wellPathPoints ); lines.push_back( wellPath->wellPathGeometry()->wellPathPoints() );
RimCase* ownerCase = nullptr; RimCase* ownerCase = nullptr;
this->firstAncestorOrThisOfType( ownerCase ); this->firstAncestorOrThisOfType( ownerCase );
if ( ownerCase ) if ( ownerCase )
@ -550,7 +550,7 @@ void RimExtrudedCurveIntersection::updateSimulationWellCenterline() const
auto branches = simulationWell->wellPipeBranches(); auto branches = simulationWell->wellPipeBranches();
for ( const auto& branch : branches ) for ( const auto& branch : branches )
{ {
m_simulationWellBranchCenterlines.push_back( branch->m_wellPathPoints ); m_simulationWellBranchCenterlines.push_back( branch->wellPathPoints() );
} }
} }
} }

View File

@ -237,7 +237,7 @@ RimFractureModelPlotCollection* RimMainPlotCollection::fractureModelPlotCollecti
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimMainPlotCollection::deleteAllContainedObjects() void RimMainPlotCollection::deleteAllContainedObjects()
{ {
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects(); m_wellLogPlotCollection()->deleteAllPlots();
m_rftPlotCollection()->deleteAllPlots(); m_rftPlotCollection()->deleteAllPlots();
m_pltPlotCollection()->deleteAllPlots(); m_pltPlotCollection()->deleteAllPlots();
m_summaryPlotCollection()->deleteAllPlots(); m_summaryPlotCollection()->deleteAllPlots();

View File

@ -56,19 +56,20 @@ RimPltPlotCollection::~RimPltPlotCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName, RigEclipseWellLogExtractor*
const QString& caseUserDescription, RimPltPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName,
const RigWellPath* wellPathGeom, const QString& caseUserDescription,
const RigEclipseCaseData* eclCaseData ) gsl::not_null<const RigWellPath*> wellPathGeometry,
gsl::not_null<const RigEclipseCaseData*> eclCaseData )
{ {
if ( !( wellPathGeom && eclCaseData ) ) if ( !( wellPathGeometry && eclCaseData ) )
{ {
return nullptr; return nullptr;
} }
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{ {
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_extractors[exIdx].p(); return m_extractors[exIdx].p();
} }
@ -76,7 +77,7 @@ RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateSimWellExtractor(
std::string errorIdName = ( simWellName + " " + caseUserDescription ).toStdString(); std::string errorIdName = ( simWellName + " " + caseUserDescription ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeom, errorIdName ); new RigEclipseWellLogExtractor( eclCaseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() ); m_extractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -85,18 +86,19 @@ RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateSimWellExtractor(
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase ) RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclCase )
{ {
if ( !( wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData() ) ) if ( !( wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData() ) )
{ {
return nullptr; return nullptr;
} }
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData(); RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry(); RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{ {
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_extractors[exIdx].p(); return m_extractors[exIdx].p();
} }
@ -104,7 +106,7 @@ RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( RimWell
std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeom, errorIdName ); new RigEclipseWellLogExtractor( eclCaseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() ); m_extractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -113,18 +115,20 @@ RigEclipseWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( RimWell
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* geomCase ) RigGeoMechWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geomCase )
{ {
if ( !( wellPath && geomCase && wellPath->wellPathGeometry() && geomCase->geoMechData() ) ) if ( !( wellPath && geomCase && wellPath->wellPathGeometry() && geomCase->geoMechData() ) )
{ {
return nullptr; return nullptr;
} }
RigGeoMechCaseData* geomCaseData = geomCase->geoMechData(); RigGeoMechCaseData* geomCaseData = geomCase->geoMechData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry(); RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx )
{ {
if ( m_geomExtractors[exIdx]->caseData() == geomCaseData && m_geomExtractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_geomExtractors[exIdx]->caseData() == geomCaseData &&
m_geomExtractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_geomExtractors[exIdx].p(); return m_geomExtractors[exIdx].p();
} }
@ -132,7 +136,7 @@ RigGeoMechWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( RimWell
std::string errorIdName = ( wellPath->name() + " " + geomCase->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPath->name() + " " + geomCase->caseUserDescription() ).toStdString();
cvf::ref<RigGeoMechWellLogExtractor> extractor = cvf::ref<RigGeoMechWellLogExtractor> extractor =
new RigGeoMechWellLogExtractor( geomCaseData, wellPathGeom, errorIdName ); new RigGeoMechWellLogExtractor( geomCaseData, wellPathGeometry, errorIdName );
m_geomExtractors.push_back( extractor.p() ); m_geomExtractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -141,11 +145,11 @@ RigGeoMechWellLogExtractor* RimPltPlotCollection::findOrCreateExtractor( RimWell
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimPltPlotCollection::removeExtractors( const RigWellPath* wellPath ) void RimPltPlotCollection::removeExtractors( const RigWellPath* wellPathGeometry )
{ {
for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- ) for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- )
{ {
if ( m_extractors[eIdx]->wellPathData() == wellPath ) if ( m_extractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{ {
m_extractors.eraseAt( eIdx ); m_extractors.eraseAt( eIdx );
} }
@ -153,7 +157,7 @@ void RimPltPlotCollection::removeExtractors( const RigWellPath* wellPath )
for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- ) for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- )
{ {
if ( m_geomExtractors[eIdx]->wellPathData() == wellPath ) if ( m_geomExtractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{ {
m_geomExtractors.eraseAt( eIdx ); m_geomExtractors.eraseAt( eIdx );
} }
@ -213,7 +217,7 @@ const std::vector<RimWellPltPlot*> RimPltPlotCollection::pltPlots() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimPltPlotCollection::addPlot( RimWellPltPlot* newPlot ) void RimPltPlotCollection::addPlot( gsl::not_null<RimWellPltPlot*> newPlot )
{ {
m_pltPlots.push_back( newPlot ); m_pltPlots.push_back( newPlot );
} }
@ -221,7 +225,7 @@ void RimPltPlotCollection::addPlot( RimWellPltPlot* newPlot )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimPltPlotCollection::removePlot( RimWellPltPlot* plot ) void RimPltPlotCollection::removePlot( gsl::not_null<RimWellPltPlot*> plot )
{ {
m_pltPlots.removeChildObject( plot ); m_pltPlots.removeChildObject( plot );
updateAllRequiredEditors(); updateAllRequiredEditors();

View File

@ -24,6 +24,8 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cvfCollection.h" #include "cvfCollection.h"
#include <gsl/gsl>
class RimWellLogPlot; class RimWellLogPlot;
class RigEclipseWellLogExtractor; class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor; class RigGeoMechWellLogExtractor;
@ -48,13 +50,15 @@ public:
RimPltPlotCollection(); RimPltPlotCollection();
~RimPltPlotCollection() override; ~RimPltPlotCollection() override;
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName, RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription, const QString& caseUserDescription,
const RigWellPath* wellPathGeom, gsl::not_null<const RigWellPath*> wellPathGeom,
const RigEclipseCaseData* eclCaseData ); gsl::not_null<const RigEclipseCaseData*> eclCaseData );
RigEclipseWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase ); RigEclipseWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
RigGeoMechWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* eclCase ); gsl::not_null<RimEclipseCase*> eclCase );
RigGeoMechWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> eclCase );
void removeExtractors( const RigWellPath* wellPath ); void removeExtractors( const RigWellPath* wellPath );
void removeExtractors( const RigEclipseCaseData* caseData ); void removeExtractors( const RigEclipseCaseData* caseData );
@ -62,8 +66,8 @@ public:
void deleteAllExtractors(); void deleteAllExtractors();
const std::vector<RimWellPltPlot*> pltPlots() const; const std::vector<RimWellPltPlot*> pltPlots() const;
void addPlot( RimWellPltPlot* newPlot ); void addPlot( gsl::not_null<RimWellPltPlot*> newPlot );
void removePlot( RimWellPltPlot* plot ); void removePlot( gsl::not_null<RimWellPltPlot*> plot );
void deleteAllPlots(); void deleteAllPlots();
private: private:

View File

@ -56,10 +56,11 @@ RimRftPlotCollection::~RimRftPlotCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName, RigEclipseWellLogExtractor*
const QString& caseUserDescription, RimRftPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName,
const RigWellPath* wellPathGeom, const QString& caseUserDescription,
const RigEclipseCaseData* eclCaseData ) gsl::not_null<const RigWellPath*> wellPathGeom,
gsl::not_null<const RigEclipseCaseData*> eclCaseData )
{ {
if ( !( wellPathGeom && eclCaseData ) ) if ( !( wellPathGeom && eclCaseData ) )
{ {
@ -68,7 +69,7 @@ RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateSimWellExtractor(
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{ {
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeom )
{ {
return m_extractors[exIdx].p(); return m_extractors[exIdx].p();
} }
@ -85,18 +86,19 @@ RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateSimWellExtractor(
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase ) RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclCase )
{ {
if ( !( wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData() ) ) if ( !( wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData() ) )
{ {
return nullptr; return nullptr;
} }
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData(); RigEclipseCaseData* caseData = eclCase->eclipseCaseData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry(); RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{ {
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_extractors[exIdx]->caseData() == caseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_extractors[exIdx].p(); return m_extractors[exIdx].p();
} }
@ -104,7 +106,7 @@ RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( RimWell
std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeom, errorIdName ); new RigEclipseWellLogExtractor( caseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() ); m_extractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -113,18 +115,20 @@ RigEclipseWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( RimWell
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* geomCase ) RigGeoMechWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geomCase )
{ {
if ( !( wellPath && geomCase && wellPath->wellPathGeometry() && geomCase->geoMechData() ) ) if ( !( wellPath && geomCase && wellPath->wellPathGeometry() && geomCase->geoMechData() ) )
{ {
return nullptr; return nullptr;
} }
RigGeoMechCaseData* geomCaseData = geomCase->geoMechData(); RigGeoMechCaseData* caseData = geomCase->geoMechData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry(); RigWellPath* wellPathGeometry = wellPath->wellPathGeometry();
for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx )
{ {
if ( m_geomExtractors[exIdx]->caseData() == geomCaseData && m_geomExtractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_geomExtractors[exIdx]->caseData() == caseData &&
m_geomExtractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_geomExtractors[exIdx].p(); return m_geomExtractors[exIdx].p();
} }
@ -132,7 +136,7 @@ RigGeoMechWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( RimWell
std::string errorIdName = ( wellPath->name() + " " + geomCase->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPath->name() + " " + geomCase->caseUserDescription() ).toStdString();
cvf::ref<RigGeoMechWellLogExtractor> extractor = cvf::ref<RigGeoMechWellLogExtractor> extractor =
new RigGeoMechWellLogExtractor( geomCaseData, wellPathGeom, errorIdName ); new RigGeoMechWellLogExtractor( caseData, wellPathGeometry, errorIdName );
m_geomExtractors.push_back( extractor.p() ); m_geomExtractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -141,11 +145,11 @@ RigGeoMechWellLogExtractor* RimRftPlotCollection::findOrCreateExtractor( RimWell
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::removeExtractors( const RigWellPath* wellPath ) void RimRftPlotCollection::removeExtractors( const RigWellPath* wellPathGeometry )
{ {
for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- ) for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- )
{ {
if ( m_extractors[eIdx]->wellPathData() == wellPath ) if ( m_extractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{ {
m_extractors.eraseAt( eIdx ); m_extractors.eraseAt( eIdx );
} }
@ -153,7 +157,7 @@ void RimRftPlotCollection::removeExtractors( const RigWellPath* wellPath )
for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- ) for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- )
{ {
if ( m_geomExtractors[eIdx]->wellPathData() == wellPath ) if ( m_geomExtractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{ {
m_geomExtractors.eraseAt( eIdx ); m_geomExtractors.eraseAt( eIdx );
} }
@ -213,7 +217,7 @@ const std::vector<RimWellRftPlot*> RimRftPlotCollection::rftPlots() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::addPlot( RimWellRftPlot* newPlot ) void RimRftPlotCollection::addPlot( gsl::not_null<RimWellRftPlot*> newPlot )
{ {
m_rftPlots.push_back( newPlot ); m_rftPlots.push_back( newPlot );
} }
@ -221,7 +225,7 @@ void RimRftPlotCollection::addPlot( RimWellRftPlot* newPlot )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimRftPlotCollection::removePlot( RimWellRftPlot* plot ) void RimRftPlotCollection::removePlot( gsl::not_null<RimWellRftPlot*> plot )
{ {
m_rftPlots.removeChildObject( plot ); m_rftPlots.removeChildObject( plot );
updateAllRequiredEditors(); updateAllRequiredEditors();

View File

@ -24,6 +24,8 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cvfCollection.h" #include "cvfCollection.h"
#include <gsl/gsl>
class RimWellLogPlot; class RimWellLogPlot;
class RigEclipseWellLogExtractor; class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor; class RigGeoMechWellLogExtractor;
@ -48,13 +50,15 @@ public:
RimRftPlotCollection(); RimRftPlotCollection();
~RimRftPlotCollection() override; ~RimRftPlotCollection() override;
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName, RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription, const QString& caseUserDescription,
const RigWellPath* wellPathGeom, gsl::not_null<const RigWellPath*> wellPathGeom,
const RigEclipseCaseData* eclCaseData ); gsl::not_null<const RigEclipseCaseData*> eclCaseData );
RigEclipseWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase ); RigEclipseWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
RigGeoMechWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* eclCase ); gsl::not_null<RimEclipseCase*> eclCase );
RigGeoMechWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> eclCase );
void removeExtractors( const RigWellPath* wellPath ); void removeExtractors( const RigWellPath* wellPath );
void removeExtractors( const RigEclipseCaseData* caseData ); void removeExtractors( const RigEclipseCaseData* caseData );
@ -62,8 +66,8 @@ public:
void deleteAllExtractors(); void deleteAllExtractors();
const std::vector<RimWellRftPlot*> rftPlots() const; const std::vector<RimWellRftPlot*> rftPlots() const;
void addPlot( RimWellRftPlot* newPlot ); void addPlot( gsl::not_null<RimWellRftPlot*> newPlot );
void removePlot( RimWellRftPlot* plot ); void removePlot( gsl::not_null<RimWellRftPlot*> plot );
void deleteAllPlots(); void deleteAllPlots();
private: private:

View File

@ -462,7 +462,7 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength,
{ {
measuredDepthValues = eclExtractor->cellIntersectionMDs(); measuredDepthValues = eclExtractor->cellIntersectionMDs();
tvDepthValues = eclExtractor->cellIntersectionTVDs(); tvDepthValues = eclExtractor->cellIntersectionTVDs();
rkbDiff = eclExtractor->wellPathData()->rkbDiff(); rkbDiff = eclExtractor->wellPathGeometry()->rkbDiff();
m_eclipseResultDefinition->loadResult(); m_eclipseResultDefinition->loadResult();
@ -489,7 +489,7 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength,
{ {
measuredDepthValues = geomExtractor->cellIntersectionMDs(); measuredDepthValues = geomExtractor->cellIntersectionMDs();
tvDepthValues = geomExtractor->cellIntersectionTVDs(); tvDepthValues = geomExtractor->cellIntersectionTVDs();
rkbDiff = geomExtractor->wellPathData()->rkbDiff(); rkbDiff = geomExtractor->wellPathGeometry()->rkbDiff();
if ( measuredDepthValues.empty() ) if ( measuredDepthValues.empty() )
{ {

View File

@ -45,8 +45,8 @@ RimWellLogPlotCollection::RimWellLogPlotCollection()
{ {
CAF_PDM_InitObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" ); CAF_PDM_InitObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( &wellLogPlots, "WellLogPlots", "", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "", "", "", "" );
wellLogPlots.uiCapability()->setUiHidden( true ); m_wellLogPlots.uiCapability()->setUiHidden( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -54,25 +54,20 @@ RimWellLogPlotCollection::RimWellLogPlotCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection::~RimWellLogPlotCollection() RimWellLogPlotCollection::~RimWellLogPlotCollection()
{ {
wellLogPlots.deleteAllChildObjects();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName, RigEclipseWellLogExtractor*
const QString& caseUserDescription, RimWellLogPlotCollection::findOrCreateSimWellExtractor( const QString& simWellName,
const RigWellPath* wellPathGeom, const QString& caseUserDescription,
const RigEclipseCaseData* eclCaseData ) gsl::not_null<const RigWellPath*> wellPathGeometry,
gsl::not_null<const RigEclipseCaseData*> eclCaseData )
{ {
if ( !( wellPathGeom && eclCaseData ) )
{
return nullptr;
}
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{ {
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_extractors[exIdx].p(); return m_extractors[exIdx].p();
} }
@ -80,7 +75,7 @@ RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtract
std::string errorIdName = ( simWellName + " " + caseUserDescription ).toStdString(); std::string errorIdName = ( simWellName + " " + caseUserDescription ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeom, errorIdName ); new RigEclipseWellLogExtractor( eclCaseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() ); m_extractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -89,18 +84,17 @@ RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtract
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase ) RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimEclipseCase*> eclCase )
{ {
if ( !( wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData() ) ) RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
{ auto wellPathGeometry = wellPath->wellPathGeometry();
return nullptr;
} if ( !( eclCaseData && wellPathGeometry ) ) return nullptr;
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry();
for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx )
{ {
if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_extractors[exIdx].p(); return m_extractors[exIdx].p();
} }
@ -108,7 +102,7 @@ RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( Rim
std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPath->name() + " " + eclCase->caseUserDescription() ).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = cvf::ref<RigEclipseWellLogExtractor> extractor =
new RigEclipseWellLogExtractor( eclCaseData, wellPathGeom, errorIdName ); new RigEclipseWellLogExtractor( eclCaseData, wellPathGeometry, errorIdName );
m_extractors.push_back( extractor.p() ); m_extractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
@ -117,37 +111,60 @@ RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( Rim
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* geomCase ) RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geoMechCase )
{ {
if ( !( wellPath && geomCase && wellPath->wellPathGeometry() && geomCase->geoMechData() ) ) RigGeoMechCaseData* caseData = geoMechCase->geoMechData();
{ auto wellPathGeometry = wellPath->wellPathGeometry();
return nullptr; if ( !( caseData && wellPathGeometry ) ) return nullptr;
}
RigGeoMechCaseData* geomCaseData = geomCase->geoMechData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry();
for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx ) for ( size_t exIdx = 0; exIdx < m_geomExtractors.size(); ++exIdx )
{ {
if ( m_geomExtractors[exIdx]->caseData() == geomCaseData && m_geomExtractors[exIdx]->wellPathData() == wellPathGeom ) if ( m_geomExtractors[exIdx]->caseData() == caseData &&
m_geomExtractors[exIdx]->wellPathGeometry() == wellPathGeometry )
{ {
return m_geomExtractors[exIdx].p(); return m_geomExtractors[exIdx].p();
} }
} }
std::string errorIdName = ( wellPath->name() + " " + geomCase->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPath->name() + " " + geoMechCase->caseUserDescription() ).toStdString();
cvf::ref<RigGeoMechWellLogExtractor> extractor = cvf::ref<RigGeoMechWellLogExtractor> extractor =
new RigGeoMechWellLogExtractor( geomCaseData, wellPathGeom, errorIdName ); new RigGeoMechWellLogExtractor( caseData, wellPathGeometry, errorIdName );
m_geomExtractors.push_back( extractor.p() ); m_geomExtractors.push_back( extractor.p() );
return extractor.p(); return extractor.p();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogPlot*> RimWellLogPlotCollection::wellLogPlots() const
{
return m_wellLogPlots.childObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::addWellLogPlot( gsl::not_null<RimWellLogPlot*> wellLogPlot )
{
m_wellLogPlots.push_back( wellLogPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::deleteAllPlots()
{
m_wellLogPlots.deleteAllChildObjects();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::reloadAllPlots() void RimWellLogPlotCollection::reloadAllPlots()
{ {
for ( const auto& w : wellLogPlots() ) for ( const auto& w : m_wellLogPlots() )
{ {
w->loadDataAndUpdate(); w->loadDataAndUpdate();
} }
@ -165,11 +182,11 @@ void RimWellLogPlotCollection::deleteAllExtractors()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::removeExtractors( const RigWellPath* wellPath ) void RimWellLogPlotCollection::removeExtractors( const RigWellPath* wellPathGeometry )
{ {
for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- ) for ( int eIdx = (int)m_extractors.size() - 1; eIdx >= 0; eIdx-- )
{ {
if ( m_extractors[eIdx]->wellPathData() == wellPath ) if ( m_extractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{ {
m_extractors.eraseAt( eIdx ); m_extractors.eraseAt( eIdx );
} }
@ -177,7 +194,7 @@ void RimWellLogPlotCollection::removeExtractors( const RigWellPath* wellPath )
for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- ) for ( int eIdx = (int)m_geomExtractors.size() - 1; eIdx >= 0; eIdx-- )
{ {
if ( m_geomExtractors[eIdx]->wellPathData() == wellPath ) if ( m_geomExtractors[eIdx]->wellPathGeometry() == wellPathGeometry )
{ {
m_geomExtractors.eraseAt( eIdx ); m_geomExtractors.eraseAt( eIdx );
} }
@ -216,7 +233,7 @@ void RimWellLogPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle*
std::vector<caf::PdmObjectHandle*>& referringObjects ) std::vector<caf::PdmObjectHandle*>& referringObjects )
{ {
// Make sure the plot collection disappears with the last plot // Make sure the plot collection disappears with the last plot
if ( wellLogPlots.empty() ) if ( m_wellLogPlots().empty() )
{ {
RimProject* project = RimProject::current(); RimProject* project = RimProject::current();
if ( project ) if ( project )

View File

@ -24,6 +24,8 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cvfCollection.h" #include "cvfCollection.h"
#include <gsl/gsl>
class RimWellLogPlot; class RimWellLogPlot;
class RigEclipseWellLogExtractor; class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor; class RigGeoMechWellLogExtractor;
@ -46,27 +48,32 @@ public:
RimWellLogPlotCollection(); RimWellLogPlotCollection();
~RimWellLogPlotCollection() override; ~RimWellLogPlotCollection() override;
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName, RigEclipseWellLogExtractor* findOrCreateSimWellExtractor( const QString& simWellName,
const QString& caseUserDescription, const QString& caseUserDescription,
const RigWellPath* wellPathGeom, gsl::not_null<const RigWellPath*> wellPathGeometry,
const RigEclipseCaseData* eclCaseData ); gsl::not_null<const RigEclipseCaseData*> eclCaseData );
RigEclipseWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimEclipseCase* eclCase ); RigEclipseWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
RigGeoMechWellLogExtractor* findOrCreateExtractor( RimWellPath* wellPath, RimGeoMechCase* eclCase ); gsl::not_null<RimEclipseCase*> eclCase );
RigGeoMechWellLogExtractor* findOrCreateExtractor( gsl::not_null<RimWellPath*> wellPath,
gsl::not_null<RimGeoMechCase*> geoMechCase );
std::vector<RimWellLogPlot*> wellLogPlots() const;
void addWellLogPlot( gsl::not_null<RimWellLogPlot*> wellLogPlot );
void deleteAllPlots();
void reloadAllPlots(); void reloadAllPlots();
void deleteAllExtractors(); void deleteAllExtractors();
void removeExtractors( const RigWellPath* wellPath ); void removeExtractors( const RigWellPath* wellPathGeometry );
void removeExtractors( const RigEclipseCaseData* caseData ); void removeExtractors( const RigEclipseCaseData* caseData );
void removeExtractors( const RigGeoMechCaseData* caseData ); void removeExtractors( const RigGeoMechCaseData* caseData );
private:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override; std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots; caf::PdmChildArrayField<RimWellLogPlot*> m_wellLogPlots;
private:
cvf::Collection<RigEclipseWellLogExtractor> m_extractors; cvf::Collection<RigEclipseWellLogExtractor> m_extractors;
cvf::Collection<RigGeoMechWellLogExtractor> m_geomExtractors; cvf::Collection<RigGeoMechWellLogExtractor> m_geomExtractors;
}; };

View File

@ -1016,7 +1016,7 @@ bool RimWellLogRftCurve::deriveMeasuredDepthValuesFromWellPath( const std::vecto
if ( wellPath ) if ( wellPath )
{ {
const std::vector<double>& mdValuesOfWellPath = wellPath->wellPathGeometry()->measureDepths(); const std::vector<double>& mdValuesOfWellPath = wellPath->wellPathGeometry()->measuredDepths();
const std::vector<double>& tvdValuesOfWellPath = wellPath->wellPathGeometry()->trueVerticalDepths(); const std::vector<double>& tvdValuesOfWellPath = wellPath->wellPathGeometry()->trueVerticalDepths();
derivedMDValues = derivedMDValues =

View File

@ -1988,9 +1988,9 @@ std::vector<std::pair<double, double>> RimWellLogTrack::waterAndRockRegions( Ria
if ( depthType == RiaDefines::DepthTypeEnum::MEASURED_DEPTH ) if ( depthType == RiaDefines::DepthTypeEnum::MEASURED_DEPTH )
{ {
double waterStartMD = 0.0; double waterStartMD = 0.0;
if ( extractor->wellPathData()->rkbDiff() != std::numeric_limits<double>::infinity() ) if ( extractor->wellPathGeometry()->rkbDiff() != std::numeric_limits<double>::infinity() )
{ {
waterStartMD += extractor->wellPathData()->rkbDiff(); waterStartMD += extractor->wellPathGeometry()->rkbDiff();
} }
double waterEndMD = extractor->cellIntersectionMDs().front(); double waterEndMD = extractor->cellIntersectionMDs().front();
double rockEndMD = extractor->cellIntersectionMDs().back(); double rockEndMD = extractor->cellIntersectionMDs().back();
@ -2005,9 +2005,9 @@ std::vector<std::pair<double, double>> RimWellLogTrack::waterAndRockRegions( Ria
} }
else if ( depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB ) else if ( depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB )
{ {
double waterStartTVDRKB = extractor->wellPathData()->rkbDiff(); double waterStartTVDRKB = extractor->wellPathGeometry()->rkbDiff();
double waterEndTVDRKB = extractor->cellIntersectionTVDs().front() + extractor->wellPathData()->rkbDiff(); double waterEndTVDRKB = extractor->cellIntersectionTVDs().front() + extractor->wellPathGeometry()->rkbDiff();
double rockEndTVDRKB = extractor->cellIntersectionTVDs().back() + extractor->wellPathData()->rkbDiff(); double rockEndTVDRKB = extractor->cellIntersectionTVDs().back() + extractor->wellPathGeometry()->rkbDiff();
return {{waterStartTVDRKB, waterEndTVDRKB}, {waterEndTVDRKB, rockEndTVDRKB}}; return {{waterStartTVDRKB, waterEndTVDRKB}, {waterEndTVDRKB, rockEndTVDRKB}};
} }
return {}; return {};
@ -2198,7 +2198,7 @@ CurveSamplingPointData RimWellLogTrack::curveSamplingPointData( RigEclipseWellLo
curveData.md = extractor->cellIntersectionMDs(); curveData.md = extractor->cellIntersectionMDs();
curveData.tvd = extractor->cellIntersectionTVDs(); curveData.tvd = extractor->cellIntersectionTVDs();
curveData.rkbDiff = extractor->wellPathData()->rkbDiff(); curveData.rkbDiff = extractor->wellPathGeometry()->rkbDiff();
extractor->curveData( resultAccessor, &curveData.data ); extractor->curveData( resultAccessor, &curveData.data );
@ -2215,7 +2215,7 @@ CurveSamplingPointData RimWellLogTrack::curveSamplingPointData( RigGeoMechWellLo
curveData.md = extractor->cellIntersectionMDs(); curveData.md = extractor->cellIntersectionMDs();
curveData.tvd = extractor->cellIntersectionTVDs(); curveData.tvd = extractor->cellIntersectionTVDs();
curveData.rkbDiff = extractor->wellPathData()->rkbDiff(); curveData.rkbDiff = extractor->wellPathGeometry()->rkbDiff();
extractor->curveData( resultAddress, 0, &curveData.data ); extractor->curveData( resultAddress, 0, &curveData.data );
return curveData; return curveData;
@ -2545,8 +2545,8 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
else else
{ {
eclWellLogExtractor = eclWellLogExtractor =
RiaExtractionTools::wellLogExtractorEclipseCase( m_formationWellPathForSourceCase, RiaExtractionTools::findOrCreateWellLogExtractor( m_formationWellPathForSourceCase,
dynamic_cast<RimEclipseCase*>( m_formationCase() ) ); dynamic_cast<RimEclipseCase*>( m_formationCase() ) );
} }
if ( eclWellLogExtractor ) if ( eclWellLogExtractor )
@ -2566,8 +2566,8 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
else else
{ {
geoMechWellLogExtractor = geoMechWellLogExtractor =
RiaExtractionTools::wellLogExtractorGeoMechCase( m_formationWellPathForSourceCase, RiaExtractionTools::findOrCreateWellLogExtractor( m_formationWellPathForSourceCase,
dynamic_cast<RimGeoMechCase*>( m_formationCase() ) ); dynamic_cast<RimGeoMechCase*>( m_formationCase() ) );
if ( !geoMechWellLogExtractor ) return; if ( !geoMechWellLogExtractor ) return;
std::string activeFormationNamesResultName = RiaDefines::activeFormationNamesResultName().toStdString(); std::string activeFormationNamesResultName = RiaDefines::activeFormationNamesResultName().toStdString();
@ -2659,8 +2659,8 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit(); RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit();
RigEclipseWellLogExtractor* eclWellLogExtractor = RigEclipseWellLogExtractor* eclWellLogExtractor =
RiaExtractionTools::wellLogExtractorEclipseCase( m_formationWellPathForSourceCase, RiaExtractionTools::findOrCreateWellLogExtractor( m_formationWellPathForSourceCase,
dynamic_cast<RimEclipseCase*>( m_formationCase() ) ); dynamic_cast<RimEclipseCase*>( m_formationCase() ) );
if ( !eclWellLogExtractor ) if ( !eclWellLogExtractor )
{ {
@ -2768,7 +2768,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
{ {
RigGeoMechWellLogExtractor* geoMechWellLogExtractor = nullptr; RigGeoMechWellLogExtractor* geoMechWellLogExtractor = nullptr;
geoMechWellLogExtractor = geoMechWellLogExtractor =
RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath, dynamic_cast<RimGeoMechCase*>( geoMechCase ) ); RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, dynamic_cast<RimGeoMechCase*>( geoMechCase ) );
if ( !geoMechWellLogExtractor ) return; if ( !geoMechWellLogExtractor ) return;
std::pair<double, double> xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); std::pair<double, double> xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() );

View File

@ -73,7 +73,7 @@ const char RimWellPath::SIM_WELL_NONE_UI_TEXT[] = "None";
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellPath::RimWellPath() RimWellPath::RimWellPath()
{ {
CAF_PDM_InitScriptableObjectWithNameAndComment( "WellPath", ":/Well.png", "", "", "WellPath", "The Base class for Well Paths" ); CAF_PDM_InitScriptableObjectWithNameAndComment( "WellPath", ":/Well.png", "", "", "WellPath", "A ResInsight Well Path" );
CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
m_name.registerKeywordAlias( "WellPathName" ); m_name.registerKeywordAlias( "WellPathName" );
@ -127,7 +127,7 @@ RimWellPath::RimWellPath()
m_wellPathAttributes = new RimWellPathAttributeCollection; m_wellPathAttributes = new RimWellPathAttributeCollection;
m_wellPathAttributes->uiCapability()->setUiTreeHidden( true ); m_wellPathAttributes->uiCapability()->setUiTreeHidden( true );
m_wellPath = nullptr; m_wellPathGeometry = nullptr;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -154,7 +154,7 @@ RimWellPath::~RimWellPath()
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if ( plotCollection ) if ( plotCollection )
{ {
plotCollection->removeExtractors( m_wellPath.p() ); plotCollection->removeExtractors( m_wellPathGeometry.p() );
} }
} }
} }
@ -233,30 +233,6 @@ cvf::Color3f RimWellPath::defaultComponentColor() const
return RiaColorTables::wellPathComponentColors()[componentType()]; return RiaColorTables::wellPathComponentColors()[componentType()];
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPath::startMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measureDepths().front();
}
return 0.0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimWellPath::endMD() const
{
if ( wellPathGeometry() )
{
return wellPathGeometry()->measureDepths().back();
}
return 0.0;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -350,7 +326,7 @@ const RimFractureModelCollection* RimWellPath::fractureModelCollection() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigWellPath* RimWellPath::wellPathGeometry() RigWellPath* RimWellPath::wellPathGeometry()
{ {
return m_wellPath.p(); return m_wellPathGeometry.p();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -358,7 +334,7 @@ RigWellPath* RimWellPath::wellPathGeometry()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const RigWellPath* RimWellPath::wellPathGeometry() const const RigWellPath* RimWellPath::wellPathGeometry() const
{ {
return m_wellPath.p(); return m_wellPathGeometry.p();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -562,7 +538,7 @@ caf::PdmFieldHandle* RimWellPath::objectToggleField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPath::setWellPathGeometry( RigWellPath* wellPathModel ) void RimWellPath::setWellPathGeometry( RigWellPath* wellPathModel )
{ {
m_wellPath = wellPathModel; m_wellPathGeometry = wellPathModel;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -591,12 +567,12 @@ void RimWellPath::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& ui
caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup( "Well Info" ); caf::PdmUiGroup* ssihubGroup = uiOrdering.addNewGroup( "Well Info" );
if ( m_wellPath.notNull() && m_wellPath->rkbDiff() > 0.0 ) if ( m_wellPathGeometry.notNull() && m_wellPathGeometry->rkbDiff() > 0.0 )
{ {
ssihubGroup->add( &m_airGap ); ssihubGroup->add( &m_airGap );
} }
if ( m_wellPath.notNull() && m_wellPath->hasDatumElevation() ) if ( m_wellPathGeometry.notNull() && m_wellPathGeometry->hasDatumElevation() )
{ {
ssihubGroup->add( &m_datumElevation ); ssihubGroup->add( &m_datumElevation );
} }
@ -701,9 +677,9 @@ RiaEclipseUnitTools::UnitSystem RimWellPath::unitSystem() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimWellPath::airGap() const double RimWellPath::airGap() const
{ {
if ( m_wellPath.notNull() && m_wellPath->rkbDiff() > 0.0 ) if ( m_wellPathGeometry.notNull() && m_wellPathGeometry->rkbDiff() > 0.0 )
{ {
return m_wellPath->rkbDiff(); return m_wellPathGeometry->rkbDiff();
} }
return 0.0; return 0.0;
} }
@ -713,9 +689,9 @@ double RimWellPath::airGap() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
double RimWellPath::datumElevation() const double RimWellPath::datumElevation() const
{ {
if ( m_wellPath.notNull() && m_wellPath->hasDatumElevation() ) if ( m_wellPathGeometry.notNull() && m_wellPathGeometry->hasDatumElevation() )
{ {
return m_wellPath->datumElevation(); return m_wellPathGeometry->datumElevation();
} }
return 0.0; return 0.0;
} }

View File

@ -22,13 +22,12 @@
#include "RiaEclipseUnitTools.h" #include "RiaEclipseUnitTools.h"
#include "RimWellPathComponentInterface.h" #include "RimAbstractWellPath.h"
#include "cafAppEnum.h" #include "cafAppEnum.h"
#include "cafFilePath.h" #include "cafFilePath.h"
#include "cafPdmChildField.h" #include "cafPdmChildField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include "cafPdmProxyValueField.h" #include "cafPdmProxyValueField.h"
@ -42,7 +41,6 @@
class RifWellPathImporter; class RifWellPathImporter;
class RifWellPathFormationsImporter; class RifWellPathFormationsImporter;
class RigWellPath;
class RimProject; class RimProject;
class RimWellLogFile; class RimWellLogFile;
class RimFractureTemplateCollection; class RimFractureTemplateCollection;
@ -63,7 +61,7 @@ class Rim3dWellLogCurveCollection;
/// ///
/// ///
//================================================================================================== //==================================================================================================
class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface class RimWellPath : public RimAbstractWellPath
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
@ -90,8 +88,8 @@ public:
double airGap() const; double airGap() const;
double datumElevation() const; double datumElevation() const;
RigWellPath* wellPathGeometry(); RigWellPath* wellPathGeometry() override;
const RigWellPath* wellPathGeometry() const; const RigWellPath* wellPathGeometry() const override;
void addWellLogFile( RimWellLogFile* logFileInfo ); void addWellLogFile( RimWellLogFile* logFileInfo );
void deleteWellLogFile( RimWellLogFile* logFileInfo ); void deleteWellLogFile( RimWellLogFile* logFileInfo );
@ -136,8 +134,6 @@ public:
QString componentLabel() const override; QString componentLabel() const override;
QString componentTypeLabel() const override; QString componentTypeLabel() const override;
cvf::Color3f defaultComponentColor() const override; cvf::Color3f defaultComponentColor() const override;
double startMD() const override;
double endMD() const override;
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects ) override; std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
@ -188,8 +184,7 @@ private:
private: private:
// Geometry and data // Geometry and data
cvf::ref<RigWellPath> m_wellPathGeometry;
cvf::ref<RigWellPath> m_wellPath;
cvf::ref<RigWellPathFormations> m_wellPathFormations; cvf::ref<RigWellPathFormations> m_wellPathFormations;
// Obsolete fields // Obsolete fields

View File

@ -84,10 +84,10 @@ bool RimWellPathAttribute::operator<( const RimWellPathAttribute& rhs ) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellPathAttribute::setDepthsFromWellPath( const RimWellPath* wellPath ) void RimWellPathAttribute::setDepthsFromWellPath( gsl::not_null<const RimWellPath*> wellPath )
{ {
m_startMD = wellPath->wellPathGeometry()->measureDepths().front(); m_startMD = wellPath->startMD();
m_endMD = wellPath->wellPathGeometry()->measureDepths().back(); m_endMD = wellPath->endMD();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -256,7 +256,7 @@ void RimWellPathAttribute::fieldChangedByUi( const caf::PdmFieldHandle* changedF
{ {
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
this->firstAncestorOrThisOfTypeAsserted( wellPath ); this->firstAncestorOrThisOfTypeAsserted( wellPath );
m_startMD = wellPath->wellPathGeometry()->measureDepths().front(); m_startMD = wellPath->startMD();
if ( !supportedDiameters( m_type() ).count( m_diameterInInches() ) ) if ( !supportedDiameters( m_type() ).count( m_diameterInInches() ) )
{ {

View File

@ -19,14 +19,14 @@
#include "RimWellPathComponentInterface.h" #include "RimWellPathComponentInterface.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include <QString> #include <QString>
#include <gsl/gsl>
class RimWellPath; class RimWellPath;
class RimWellPathAttribute : public caf::PdmObject, public RimWellPathComponentInterface class RimWellPathAttribute : public caf::PdmObject, public RimWellPathComponentInterface
@ -44,7 +44,7 @@ public:
double diameterInInches() const; double diameterInInches() const;
QString diameterLabel() const; QString diameterLabel() const;
bool operator<( const RimWellPathAttribute& rhs ) const; bool operator<( const RimWellPathAttribute& rhs ) const;
void setDepthsFromWellPath( const RimWellPath* wellPath ); void setDepthsFromWellPath( gsl::not_null<const RimWellPath*> wellPath );
// Overrides from RimWellPathCompletionInterface // Overrides from RimWellPathCompletionInterface
bool isEnabled() const override; bool isEnabled() const override;

View File

@ -652,7 +652,7 @@ RiaEclipseUnitTools::UnitSystemType RimWellPathCollection::findUnitSystemForWell
const RigEclipseCaseData* eclipseCaseData = project->activeOilField()->analysisModels->cases()[0]->eclipseCaseData(); const RigEclipseCaseData* eclipseCaseData = project->activeOilField()->analysisModels->cases()[0]->eclipseCaseData();
cvf::BoundingBox caseBoundingBox = eclipseCaseData->mainGrid()->boundingBox(); cvf::BoundingBox caseBoundingBox = eclipseCaseData->mainGrid()->boundingBox();
cvf::BoundingBox wellPathBoundingBox; cvf::BoundingBox wellPathBoundingBox;
for ( auto& wellPathPoint : wellPath->wellPathGeometry()->m_wellPathPoints ) for ( const auto& wellPathPoint : wellPath->wellPathGeometry()->wellPathPoints() )
{ {
wellPathBoundingBox.add( wellPathPoint ); wellPathBoundingBox.add( wellPathPoint );
} }

View File

@ -173,10 +173,10 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() ); RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() );
arcLineSampler.sampledPointsAndMDs( 30, auto [wellPathPoints, measuredDepths] = arcLineSampler.sampledPointsAndMDs( 30, false );
false,
&( wellPathGeometry->m_wellPathPoints ), wellPathGeometry->setWellPathPoints( wellPathPoints );
&( wellPathGeometry->m_measuredDepths ) ); wellPathGeometry->setMeasuredDepths( measuredDepths );
if ( m_airGap != 0.0 ) if ( m_airGap != 0.0 )
{ {

View File

@ -36,8 +36,8 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigWellPathStimplanIntersector::RigWellPathStimplanIntersector( const RigWellPath* wellPathGeom, RigWellPathStimplanIntersector::RigWellPathStimplanIntersector( gsl::not_null<const RigWellPath*> wellPathGeom,
const RimFracture* rimFracture ) gsl::not_null<const RimFracture*> rimFracture )
{ {
std::vector<cvf::Vec3d> wellPathPoints = std::vector<cvf::Vec3d> wellPathPoints =
wellPathGeom->wellPathPointsIncludingInterpolatedIntersectionPoint( rimFracture->fractureMD() ); wellPathGeom->wellPathPointsIncludingInterpolatedIntersectionPoint( rimFracture->fractureMD() );

View File

@ -20,6 +20,8 @@
#include "cvfMatrix4.h" #include "cvfMatrix4.h"
#include <gsl/gsl>
#include <map> #include <map>
#include <vector> #include <vector>
@ -48,7 +50,8 @@ public:
double computeLength() const { return cvf::Math::sqrt( hlength * hlength + vlength * vlength ); } double computeLength() const { return cvf::Math::sqrt( hlength * hlength + vlength * vlength ); }
}; };
RigWellPathStimplanIntersector( const RigWellPath* wellpathGeom, const RimFracture* rimFracture ); RigWellPathStimplanIntersector( gsl::not_null<const RigWellPath*> wellpathGeom,
gsl::not_null<const RimFracture*> rimFracture );
const std::map<size_t, WellCellIntersection>& intersections() const; const std::map<size_t, WellCellIntersection>& intersections() const;

View File

@ -522,9 +522,8 @@ std::vector<const RigWellPath*> RigEclipseCaseData::simulationWellBranches( cons
{ {
auto wellMdCalculator = RigSimulationWellCoordsAndMD( pipeBranchesCLCoords[brIdx] ); auto wellMdCalculator = RigSimulationWellCoordsAndMD( pipeBranchesCLCoords[brIdx] );
cvf::ref<RigWellPath> newWellPath = new RigWellPath(); cvf::ref<RigWellPath> newWellPath =
newWellPath->m_measuredDepths = wellMdCalculator.measuredDepths(); new RigWellPath( wellMdCalculator.wellPathPoints(), wellMdCalculator.measuredDepths() );
newWellPath->m_wellPathPoints = wellMdCalculator.wellPathPoints();
m_simWellBranchCache[simWellSeachItem].push_back( newWellPath.p() ); m_simWellBranchCache[simWellSeachItem].push_back( newWellPath.p() );
} }

View File

@ -37,9 +37,9 @@
/// ///
//================================================================================================== //==================================================================================================
RigEclipseWellLogExtractor::RigEclipseWellLogExtractor( const RigEclipseCaseData* aCase, RigEclipseWellLogExtractor::RigEclipseWellLogExtractor( gsl::not_null<const RigEclipseCaseData*> aCase,
const RigWellPath* wellpath, gsl::not_null<const RigWellPath*> wellpath,
const std::string& wellCaseErrorMsgName ) const std::string& wellCaseErrorMsgName )
: RigWellLogExtractor( wellpath, wellCaseErrorMsgName ) : RigWellLogExtractor( wellpath, wellCaseErrorMsgName )
, m_caseData( aCase ) , m_caseData( aCase )
{ {
@ -55,13 +55,13 @@ void RigEclipseWellLogExtractor::calculateIntersection()
bool isCellFaceNormalsOut = m_caseData->mainGrid()->isFaceNormalsOutwards(); bool isCellFaceNormalsOut = m_caseData->mainGrid()->isFaceNormalsOutwards();
if ( m_wellPath->m_wellPathPoints.empty() ) return; if ( m_wellPathGeometry->wellPathPoints().empty() ) return;
for ( size_t wpp = 0; wpp < m_wellPath->m_wellPathPoints.size() - 1; ++wpp ) for ( size_t wpp = 0; wpp < m_wellPathGeometry->wellPathPoints().size() - 1; ++wpp )
{ {
std::vector<HexIntersectionInfo> intersections; std::vector<HexIntersectionInfo> intersections;
cvf::Vec3d p1 = m_wellPath->m_wellPathPoints[wpp]; cvf::Vec3d p1 = m_wellPathGeometry->wellPathPoints()[wpp];
cvf::Vec3d p2 = m_wellPath->m_wellPathPoints[wpp + 1]; cvf::Vec3d p2 = m_wellPathGeometry->wellPathPoints()[wpp + 1];
cvf::BoundingBox bb; cvf::BoundingBox bb;
@ -96,19 +96,19 @@ void RigEclipseWellLogExtractor::calculateIntersection()
// Inserting the intersections in this map will remove identical intersections // Inserting the intersections in this map will remove identical intersections
// and sort them according to MD, CellIdx, Leave/enter // and sort them according to MD, CellIdx, Leave/enter
double md1 = m_wellPath->m_measuredDepths[wpp]; double md1 = m_wellPathGeometry->measuredDepths()[wpp];
double md2 = m_wellPath->m_measuredDepths[wpp + 1]; double md2 = m_wellPathGeometry->measuredDepths()[wpp + 1];
insertIntersectionsInMap( intersections, p1, md1, p2, md2, &uniqueIntersections ); insertIntersectionsInMap( intersections, p1, md1, p2, md2, &uniqueIntersections );
} }
if ( uniqueIntersections.empty() && m_wellPath->m_wellPathPoints.size() > 1 ) if ( uniqueIntersections.empty() && m_wellPathGeometry->wellPathPoints().size() > 1 )
{ {
// When entering this function, all well path points are either completely outside the grid // When entering this function, all well path points are either completely outside the grid
// or all well path points are inside one cell // or all well path points are inside one cell
cvf::Vec3d firstPoint = m_wellPath->m_wellPathPoints.front(); cvf::Vec3d firstPoint = m_wellPathGeometry->wellPathPoints().front();
cvf::Vec3d lastPoint = m_wellPath->m_wellPathPoints.back(); cvf::Vec3d lastPoint = m_wellPathGeometry->wellPathPoints().back();
{ {
cvf::BoundingBox bb; cvf::BoundingBox bb;
@ -137,7 +137,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
isEntering, isEntering,
cvf::StructGridInterface::NO_FACE, cvf::StructGridInterface::NO_FACE,
globalCellIndex ); globalCellIndex );
RigMDCellIdxEnterLeaveKey enterLeaveKey( m_wellPath->m_measuredDepths.front(), RigMDCellIdxEnterLeaveKey enterLeaveKey( m_wellPathGeometry->measuredDepths().front(),
globalCellIndex, globalCellIndex,
isEntering ); isEntering );
@ -149,7 +149,7 @@ void RigEclipseWellLogExtractor::calculateIntersection()
bool isEntering = false; bool isEntering = false;
HexIntersectionInfo info( lastPoint, isEntering, cvf::StructGridInterface::NO_FACE, globalCellIndex ); HexIntersectionInfo info( lastPoint, isEntering, cvf::StructGridInterface::NO_FACE, globalCellIndex );
RigMDCellIdxEnterLeaveKey enterLeaveKey( m_wellPath->m_measuredDepths.back(), RigMDCellIdxEnterLeaveKey enterLeaveKey( m_wellPathGeometry->measuredDepths().back(),
globalCellIndex, globalCellIndex,
isEntering ); isEntering );

View File

@ -36,8 +36,8 @@ class BoundingBox;
class RigEclipseWellLogExtractor : public RigWellLogExtractor class RigEclipseWellLogExtractor : public RigWellLogExtractor
{ {
public: public:
RigEclipseWellLogExtractor( const RigEclipseCaseData* aCase, RigEclipseWellLogExtractor( gsl::not_null<const RigEclipseCaseData*> aCase,
const RigWellPath* wellpath, gsl::not_null<const RigWellPath*> wellpath,
const std::string& wellCaseErrorMsgName ); const std::string& wellCaseErrorMsgName );
void curveData( const RigResultAccessor* resultAccessor, std::vector<double>* values ); void curveData( const RigResultAccessor* resultAccessor, std::vector<double>* values );

View File

@ -80,12 +80,12 @@ void RigFisbonesGeometry::computeLateralPositionAndOrientation( size_t subI
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
m_fishbonesSub->firstAncestorOrThisOfTypeAsserted( wellPath ); m_fishbonesSub->firstAncestorOrThisOfTypeAsserted( wellPath );
RigWellPath* rigWellPath = wellPath->wellPathGeometry(); auto wellPathGeometry = wellPath->wellPathGeometry();
CVF_ASSERT( rigWellPath ); if ( !wellPathGeometry ) return;
double measuredDepth = m_fishbonesSub->measuredDepth( subIndex ); double measuredDepth = m_fishbonesSub->measuredDepth( subIndex );
cvf::Vec3d position = rigWellPath->interpolatedPointAlongWellPath( measuredDepth ); cvf::Vec3d position = wellPathGeometry->interpolatedPointAlongWellPath( measuredDepth );
cvf::Mat4d buildAngleMat; cvf::Mat4d buildAngleMat;
cvf::Vec3d lateralDirection; cvf::Vec3d lateralDirection;
@ -94,7 +94,7 @@ void RigFisbonesGeometry::computeLateralPositionAndOrientation( size_t subI
cvf::Vec3d lateralInitialDirection = cvf::Vec3d::Z_AXIS; cvf::Vec3d lateralInitialDirection = cvf::Vec3d::Z_AXIS;
cvf::Vec3d p1 = cvf::Vec3d::UNDEFINED; cvf::Vec3d p1 = cvf::Vec3d::UNDEFINED;
cvf::Vec3d p2 = cvf::Vec3d::UNDEFINED; cvf::Vec3d p2 = cvf::Vec3d::UNDEFINED;
rigWellPath->twoClosestPoints( position, &p1, &p2 ); wellPathGeometry->twoClosestPoints( position, &p1, &p2 );
CVF_ASSERT( !p1.isUndefined() && !p2.isUndefined() ); CVF_ASSERT( !p1.isUndefined() && !p2.isUndefined() );

View File

@ -53,9 +53,9 @@ const double RigGeoMechWellLogExtractor::GRAVITY_ACCEL = 9.81; // m /
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor::RigGeoMechWellLogExtractor( RigGeoMechCaseData* aCase, RigGeoMechWellLogExtractor::RigGeoMechWellLogExtractor( gsl::not_null<RigGeoMechCaseData*> aCase,
const RigWellPath* wellpath, gsl::not_null<const RigWellPath*> wellpath,
const std::string& wellCaseErrorMsgName ) const std::string& wellCaseErrorMsgName )
: RigWellLogExtractor( wellpath, wellCaseErrorMsgName ) : RigWellLogExtractor( wellpath, wellCaseErrorMsgName )
, m_caseData( aCase ) , m_caseData( aCase )
{ {
@ -118,7 +118,7 @@ QString RigGeoMechWellLogExtractor::curveData( const RigFemResultAddress& resAdd
if ( resAddr.resultPosType == RIG_WELLPATH_DERIVED ) if ( resAddr.resultPosType == RIG_WELLPATH_DERIVED )
{ {
if ( m_wellPath->rkbDiff() == HUGE_VAL ) if ( m_wellPathGeometry->rkbDiff() == HUGE_VAL )
{ {
RiaLogging::error( "Well path has an invalid datum elevation and we cannot estimate TVDRKB. No well bore " RiaLogging::error( "Well path has an invalid datum elevation and we cannot estimate TVDRKB. No well bore "
"stability curves created." ); "stability curves created." );
@ -276,7 +276,7 @@ std::vector<RigGeoMechWellLogExtractor::WbsParameterSource>
std::vector<float> tvdRKBs; std::vector<float> tvdRKBs;
for ( double tvdValue : m_intersectionTVDs ) for ( double tvdValue : m_intersectionTVDs )
{ {
tvdRKBs.push_back( tvdValue + m_wellPath->rkbDiff() ); tvdRKBs.push_back( tvdValue + m_wellPathGeometry->rkbDiff() );
} }
RigFemResultAddress elementPropertyAddr = parameter.femAddress( RigWbsParameter::ELEMENT_PROPERTY_TABLE ); RigFemResultAddress elementPropertyAddr = parameter.femAddress( RigWbsParameter::ELEMENT_PROPERTY_TABLE );
elementPropertyValuesInput = &( resultCollection->resultValues( elementPropertyAddr, 0, frameIndex ) ); elementPropertyValuesInput = &( resultCollection->resultValues( elementPropertyAddr, 0, frameIndex ) );
@ -970,11 +970,11 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
const RigFemPart* femPart = m_caseData->femParts()->part( 0 ); const RigFemPart* femPart = m_caseData->femParts()->part( 0 );
const std::vector<cvf::Vec3f>& nodeCoords = femPart->nodes().coordinates; const std::vector<cvf::Vec3f>& nodeCoords = femPart->nodes().coordinates;
for ( size_t wpp = 0; wpp < m_wellPath->m_wellPathPoints.size() - 1; ++wpp ) for ( size_t wpp = 0; wpp < m_wellPathGeometry->wellPathPoints().size() - 1; ++wpp )
{ {
std::vector<HexIntersectionInfo> intersections; std::vector<HexIntersectionInfo> intersections;
cvf::Vec3d p1 = m_wellPath->m_wellPathPoints[wpp]; cvf::Vec3d p1 = m_wellPathGeometry->wellPathPoints()[wpp];
cvf::Vec3d p2 = m_wellPath->m_wellPathPoints[wpp + 1]; cvf::Vec3d p2 = m_wellPathGeometry->wellPathPoints()[wpp + 1];
cvf::BoundingBox bb; cvf::BoundingBox bb;
@ -1011,8 +1011,8 @@ void RigGeoMechWellLogExtractor::calculateIntersection()
// Inserting the intersections in this map will remove identical intersections // Inserting the intersections in this map will remove identical intersections
// and sort them according to MD, CellIdx, Leave/enter // and sort them according to MD, CellIdx, Leave/enter
double md1 = m_wellPath->m_measuredDepths[wpp]; double md1 = m_wellPathGeometry->measuredDepths()[wpp];
double md2 = m_wellPath->m_measuredDepths[wpp + 1]; double md2 = m_wellPathGeometry->measuredDepths()[wpp + 1];
insertIntersectionsInMap( intersections, p1, md1, p2, md2, &uniqueIntersections ); insertIntersectionsInMap( intersections, p1, md1, p2, md2, &uniqueIntersections );
} }
@ -1068,7 +1068,7 @@ cvf::Vec3d RigGeoMechWellLogExtractor::calculateWellPathTangent( int64_t
if ( calculationType == TangentFollowWellPathSegments ) if ( calculationType == TangentFollowWellPathSegments )
{ {
cvf::Vec3d segmentStart, segmentEnd; cvf::Vec3d segmentStart, segmentEnd;
m_wellPath->twoClosestPoints( m_intersections[intersectionIdx], &segmentStart, &segmentEnd ); m_wellPathGeometry->twoClosestPoints( m_intersections[intersectionIdx], &segmentStart, &segmentEnd );
return ( segmentEnd - segmentStart ).getNormalized(); return ( segmentEnd - segmentStart ).getNormalized();
} }
else else
@ -1374,7 +1374,7 @@ double RigGeoMechWellLogExtractor::hydroStaticPorePressureForIntersection( size_
double waterDensityGCM3 ) const double waterDensityGCM3 ) const
{ {
double trueVerticalDepth = m_intersectionTVDs[intersectionIdx]; double trueVerticalDepth = m_intersectionTVDs[intersectionIdx];
double effectiveDepthMeters = trueVerticalDepth + wellPathData()->rkbDiff(); double effectiveDepthMeters = trueVerticalDepth + m_wellPathGeometry->rkbDiff();
return hydroStaticPorePressureAtDepth( effectiveDepthMeters, waterDensityGCM3 ); return hydroStaticPorePressureAtDepth( effectiveDepthMeters, waterDensityGCM3 );
} }
@ -1385,7 +1385,7 @@ double RigGeoMechWellLogExtractor::hydroStaticPorePressureForSegment( size_t int
{ {
cvf::Vec3f centroid = cellCentroid( intersectionIdx ); cvf::Vec3f centroid = cellCentroid( intersectionIdx );
double trueVerticalDepth = -centroid.z(); double trueVerticalDepth = -centroid.z();
double effectiveDepthMeters = trueVerticalDepth + wellPathData()->rkbDiff(); double effectiveDepthMeters = trueVerticalDepth + m_wellPathGeometry->rkbDiff();
return hydroStaticPorePressureAtDepth( effectiveDepthMeters, waterDensityGCM3 ); return hydroStaticPorePressureAtDepth( effectiveDepthMeters, waterDensityGCM3 );
} }
@ -1405,9 +1405,9 @@ double RigGeoMechWellLogExtractor::hydroStaticPorePressureAtDepth( double effect
double RigGeoMechWellLogExtractor::wbsCurveValuesAtMsl() const double RigGeoMechWellLogExtractor::wbsCurveValuesAtMsl() const
{ {
double waterDensityGCM3 = m_userDefinedValues.at( RigWbsParameter::waterDensity() ); double waterDensityGCM3 = m_userDefinedValues.at( RigWbsParameter::waterDensity() );
double waterDepth = std::abs( wellPathData()->wellPathPoints().front().z() ); double waterDepth = std::abs( m_wellPathGeometry->wellPathPoints().front().z() );
double rkbDiff = wellPathData()->rkbDiff(); double rkbDiff = m_wellPathGeometry->rkbDiff();
if ( rkbDiff == std::numeric_limits<double>::infinity() ) if ( rkbDiff == std::numeric_limits<double>::infinity() )
{ {
rkbDiff = 0.0; rkbDiff = 0.0;

View File

@ -58,8 +58,8 @@ public:
using WbsParameterSourceEnum = RigWbsParameter::SourceEnum; using WbsParameterSourceEnum = RigWbsParameter::SourceEnum;
public: public:
RigGeoMechWellLogExtractor( RigGeoMechCaseData* aCase, RigGeoMechWellLogExtractor( gsl::not_null<RigGeoMechCaseData*> aCase,
const RigWellPath* wellpath, gsl::not_null<const RigWellPath*> wellpath,
const std::string& wellCaseErrorMsgName ); const std::string& wellCaseErrorMsgName );
void performCurveDataSmoothing( int frameIndex, void performCurveDataSmoothing( int frameIndex,

View File

@ -25,8 +25,9 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigWellLogExtractor::RigWellLogExtractor( const RigWellPath* wellpath, const std::string& wellCaseErrorMsgName ) RigWellLogExtractor::RigWellLogExtractor( gsl::not_null<const RigWellPath*> wellpath,
: m_wellPath( wellpath ) const std::string& wellCaseErrorMsgName )
: m_wellPathGeometry( wellpath )
, m_wellCaseErrorMsgName( wellCaseErrorMsgName ) , m_wellCaseErrorMsgName( wellCaseErrorMsgName )
{ {
} }
@ -97,9 +98,9 @@ const std::vector<size_t>& RigWellLogExtractor::intersectedCellsGlobIdx() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const RigWellPath* RigWellLogExtractor::wellPathData() const const RigWellPath* RigWellLogExtractor::wellPathGeometry() const
{ {
return m_wellPath.p(); return m_wellPathGeometry.p();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -202,14 +203,15 @@ void RigWellLogExtractor::populateReturnArrays( std::map<RigMDCellIdxEnterLeaveK
{ {
// Needs wellpath start point in front // Needs wellpath start point in front
HexIntersectionInfo firstLeavingPoint = it->second; HexIntersectionInfo firstLeavingPoint = it->second;
firstLeavingPoint.m_intersectionPoint = m_wellPath->m_wellPathPoints[0]; firstLeavingPoint.m_intersectionPoint = m_wellPathGeometry->wellPathPoints()[0];
firstLeavingPoint.m_face = cvf::StructGridInterface::NO_FACE; firstLeavingPoint.m_face = cvf::StructGridInterface::NO_FACE;
firstLeavingPoint.m_isIntersectionEntering = true; firstLeavingPoint.m_isIntersectionEntering = true;
sortedUniqueIntersections.insert( std::make_pair( RigMDEnterLeaveCellIdxKey( m_wellPath->m_measuredDepths[0], sortedUniqueIntersections.insert(
true, std::make_pair( RigMDEnterLeaveCellIdxKey( m_wellPathGeometry->measuredDepths()[0],
firstLeavingPoint.m_hexIndex ), true,
firstLeavingPoint ) ); firstLeavingPoint.m_hexIndex ),
firstLeavingPoint ) );
} }
// Add an intersection for the well endpoint possibly inside the last cell. // Add an intersection for the well endpoint possibly inside the last cell.
@ -221,12 +223,14 @@ void RigWellLogExtractor::populateReturnArrays( std::map<RigMDCellIdxEnterLeaveK
{ {
// Needs wellpath end point at end // Needs wellpath end point at end
HexIntersectionInfo lastEnterPoint = rit->second; HexIntersectionInfo lastEnterPoint = rit->second;
lastEnterPoint.m_intersectionPoint = m_wellPath->m_wellPathPoints.back(); lastEnterPoint.m_intersectionPoint = m_wellPathGeometry->wellPathPoints().back();
lastEnterPoint.m_isIntersectionEntering = false; lastEnterPoint.m_isIntersectionEntering = false;
lastEnterPoint.m_face = cvf::StructGridInterface::NO_FACE; lastEnterPoint.m_face = cvf::StructGridInterface::NO_FACE;
sortedUniqueIntersections.insert( sortedUniqueIntersections.insert(
std::make_pair( RigMDEnterLeaveCellIdxKey( m_wellPath->m_measuredDepths.back(), false, lastEnterPoint.m_hexIndex ), std::make_pair( RigMDEnterLeaveCellIdxKey( m_wellPathGeometry->measuredDepths().back(),
false,
lastEnterPoint.m_hexIndex ),
lastEnterPoint ) ); lastEnterPoint ) );
} }
} }

View File

@ -59,14 +59,14 @@ class RigWellPath;
class RigWellLogExtractor : public cvf::Object class RigWellLogExtractor : public cvf::Object
{ {
public: public:
RigWellLogExtractor( const RigWellPath* wellpath, const std::string& wellCaseErrorMsgName ); RigWellLogExtractor( gsl::not_null<const RigWellPath*> wellpath, const std::string& wellCaseErrorMsgName );
~RigWellLogExtractor() override; ~RigWellLogExtractor() override;
const std::vector<double>& cellIntersectionMDs() const; const std::vector<double>& cellIntersectionMDs() const;
const std::vector<double>& cellIntersectionTVDs() const; const std::vector<double>& cellIntersectionTVDs() const;
const std::vector<size_t>& intersectedCellsGlobIdx() const; const std::vector<size_t>& intersectedCellsGlobIdx() const;
const RigWellPath* wellPathData() const; const RigWellPath* wellPathGeometry() const;
std::vector<WellPathCellIntersectionInfo> cellIntersectionInfosAlongWellPath() const; std::vector<WellPathCellIntersectionInfo> cellIntersectionInfosAlongWellPath() const;
@ -90,7 +90,7 @@ protected:
std::vector<size_t> m_intersectedCellsGlobIdx; std::vector<size_t> m_intersectedCellsGlobIdx;
std::vector<cvf::StructGridInterface::FaceType> m_intersectedCellFaces; std::vector<cvf::StructGridInterface::FaceType> m_intersectedCellFaces;
cvf::cref<RigWellPath> m_wellPath; cvf::cref<RigWellPath> m_wellPathGeometry;
std::vector<double> m_intersectionMeasuredDepths; std::vector<double> m_intersectionMeasuredDepths;
std::vector<double> m_intersectionTVDs; std::vector<double> m_intersectionTVDs;

View File

@ -31,6 +31,99 @@ RigWellPath::RigWellPath()
{ {
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellPath::RigWellPath( const RigWellPath& rhs )
: m_wellPathPoints( rhs.m_wellPathPoints )
, m_measuredDepths( rhs.m_measuredDepths )
, m_hasDatumElevation( rhs.m_hasDatumElevation )
, m_datumElevation( rhs.m_datumElevation )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellPath::RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const std::vector<double>& measuredDepths )
: m_wellPathPoints( wellPathPoints )
, m_measuredDepths( measuredDepths )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWellPath& RigWellPath::operator=( const RigWellPath& rhs )
{
m_wellPathPoints = rhs.m_wellPathPoints;
m_measuredDepths = rhs.m_measuredDepths;
m_hasDatumElevation = rhs.m_hasDatumElevation;
m_datumElevation = rhs.m_datumElevation;
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<cvf::Vec3d>& RigWellPath::wellPathPoints() const
{
return m_wellPathPoints;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const std::vector<double>& RigWellPath::measuredDepths() const
{
return m_measuredDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellPath::trueVerticalDepths() const
{
std::vector<double> tvds;
for ( const cvf::Vec3d& point : m_wellPathPoints )
{
tvds.push_back( std::fabs( point.z() ) );
}
return tvds;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPath::setWellPathPoints( const std::vector<cvf::Vec3d>& wellPathPoints )
{
m_wellPathPoints = wellPathPoints;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPath::setMeasuredDepths( const std::vector<double>& measuredDepths )
{
m_measuredDepths = measuredDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPath::addWellPathPoint( const cvf::Vec3d& wellPathPoint )
{
m_wellPathPoints.push_back( wellPathPoint );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellPath::addMeasuredDepth( double measuredDepth )
{
m_measuredDepths.push_back( measuredDepth );
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -399,26 +492,3 @@ std::vector<cvf::Vec3d> RigWellPath::clipPolylineStartAboveZ( const std::vector<
return clippedPolyLine; return clippedPolyLine;
} }
const std::vector<cvf::Vec3d>& RigWellPath::wellPathPoints() const
{
return m_wellPathPoints;
}
const std::vector<double>& RigWellPath::measureDepths() const
{
return m_measuredDepths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellPath::trueVerticalDepths() const
{
std::vector<double> tvds;
for ( const cvf::Vec3d& point : m_wellPathPoints )
{
tvds.push_back( std::fabs( point.z() ) );
}
return tvds;
}

View File

@ -35,14 +35,21 @@ class BoundingBox;
class RigWellPath : public cvf::Object class RigWellPath : public cvf::Object
{ {
public: public:
std::vector<cvf::Vec3d> m_wellPathPoints; RigWellPath();
std::vector<double> m_measuredDepths; RigWellPath( const std::vector<cvf::Vec3d>& wellPathPoints, const std::vector<double>& measuredDepths );
RigWellPath( const RigWellPath& rhs );
RigWellPath& operator=( const RigWellPath& rhs );
const std::vector<cvf::Vec3d>& wellPathPoints() const; const std::vector<cvf::Vec3d>& wellPathPoints() const;
const std::vector<double>& measureDepths() const; const std::vector<double>& measuredDepths() const;
std::vector<double> trueVerticalDepths() const; std::vector<double> trueVerticalDepths() const;
RigWellPath(); void setWellPathPoints( const std::vector<cvf::Vec3d>& wellPathPoints );
void setMeasuredDepths( const std::vector<double>& measuredDepths );
void addWellPathPoint( const cvf::Vec3d& wellPathPoint );
void addMeasuredDepth( double measuredDepth );
void setDatumElevation( double value ); void setDatumElevation( double value );
bool hasDatumElevation() const; bool hasDatumElevation() const;
double datumElevation() const; double datumElevation() const;
@ -69,6 +76,9 @@ public:
size_t* indexToFirstVisibleSegment ); size_t* indexToFirstVisibleSegment );
private: private:
std::vector<cvf::Vec3d> m_wellPathPoints;
std::vector<double> m_measuredDepths;
bool m_hasDatumElevation; bool m_hasDatumElevation;
double m_datumElevation; double m_datumElevation;
}; };

View File

@ -27,13 +27,13 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellPathGeometryExporter::exportWellPathGeometry( const RimWellPath* wellPath, void RigWellPathGeometryExporter::exportWellPathGeometry( gsl::not_null<const RimWellPath*> wellPath,
double mdStepSize, double mdStepSize,
std::vector<double>& xValues, std::vector<double>& xValues,
std::vector<double>& yValues, std::vector<double>& yValues,
std::vector<double>& tvdValues, std::vector<double>& tvdValues,
std::vector<double>& mdValues, std::vector<double>& mdValues,
bool& useMdRkb ) bool& useMdRkb )
{ {
auto wellPathGeom = wellPath->wellPathGeometry(); auto wellPathGeom = wellPath->wellPathGeometry();
if ( !wellPathGeom ) return; if ( !wellPathGeom ) return;
@ -41,7 +41,7 @@ void RigWellPathGeometryExporter::exportWellPathGeometry( const RimWellPath* w
useMdRkb = false; useMdRkb = false;
double rkbOffset = 0.0; double rkbOffset = 0.0;
{ {
const RimModeledWellPath* modeledWellPath = dynamic_cast<const RimModeledWellPath*>( wellPath ); const RimModeledWellPath* modeledWellPath = dynamic_cast<const RimModeledWellPath*>( wellPath.get() );
if ( modeledWellPath ) if ( modeledWellPath )
{ {
useMdRkb = true; useMdRkb = true;
@ -55,13 +55,13 @@ void RigWellPathGeometryExporter::exportWellPathGeometry( const RimWellPath* w
} }
} }
} }
exportWellPathGeometry( wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); exportWellPathGeometry( *wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellPathGeometryExporter::exportWellPathGeometry( const RigWellPath* wellPathGeom, void RigWellPathGeometryExporter::exportWellPathGeometry( const RigWellPath& wellPathGeom,
double mdStepSize, double mdStepSize,
double rkbOffset, double rkbOffset,
std::vector<double>& xValues, std::vector<double>& xValues,
@ -69,8 +69,8 @@ void RigWellPathGeometryExporter::exportWellPathGeometry( const RigWellPath* w
std::vector<double>& tvdValues, std::vector<double>& tvdValues,
std::vector<double>& mdValues ) std::vector<double>& mdValues )
{ {
double currMd = wellPathGeom->measureDepths().front() - mdStepSize; double currMd = wellPathGeom.measuredDepths().front() - mdStepSize;
double endMd = wellPathGeom->measureDepths().back(); double endMd = wellPathGeom.measuredDepths().back();
bool isFirst = true; bool isFirst = true;
double prevMd = 0.0; double prevMd = 0.0;
@ -80,7 +80,7 @@ void RigWellPathGeometryExporter::exportWellPathGeometry( const RigWellPath* w
currMd += mdStepSize; currMd += mdStepSize;
if ( currMd > endMd ) currMd = endMd; if ( currMd > endMd ) currMd = endMd;
auto pt = wellPathGeom->interpolatedPointAlongWellPath( currMd ); auto pt = wellPathGeom.interpolatedPointAlongWellPath( currMd );
double tvd = -pt.z(); double tvd = -pt.z();
// The change in measured depth (MD) must be greater or equal to change in // The change in measured depth (MD) must be greater or equal to change in

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include <gsl/gsl>
#include <vector> #include <vector>
class RimWellPath; class RimWellPath;
@ -29,15 +31,15 @@ class RigWellPath;
class RigWellPathGeometryExporter class RigWellPathGeometryExporter
{ {
public: public:
static void exportWellPathGeometry( const RimWellPath* wellPath, static void exportWellPathGeometry( gsl::not_null<const RimWellPath*> wellPath,
double mdStepSize, double mdStepSize,
std::vector<double>& xValues, std::vector<double>& xValues,
std::vector<double>& yValues, std::vector<double>& yValues,
std::vector<double>& tvdValues, std::vector<double>& tvdValues,
std::vector<double>& mdValues, std::vector<double>& mdValues,
bool& useMdRkb ); bool& useMdRkb );
static void exportWellPathGeometry( const RigWellPath* wellPath, static void exportWellPathGeometry( const RigWellPath& wellPath,
double mdStepSize, double mdStepSize,
double rkbOffset, double rkbOffset,
std::vector<double>& xValues, std::vector<double>& xValues,

View File

@ -43,9 +43,7 @@ std::vector<WellPathCellIntersectionInfo>
if ( pathCoords.size() < 2 ) return intersectionInfos; if ( pathCoords.size() < 2 ) return intersectionInfos;
cvf::ref<RigWellPath> dummyWellPath = new RigWellPath; cvf::ref<RigWellPath> dummyWellPath = new RigWellPath( pathCoords, pathMds );
dummyWellPath->m_wellPathPoints = pathCoords;
dummyWellPath->m_measuredDepths = pathMds;
std::string errorIdName = ( wellPathName + " " + caseData->ownerCase()->caseUserDescription() ).toStdString(); std::string errorIdName = ( wellPathName + " " + caseData->ownerCase()->caseUserDescription() ).toStdString();
@ -90,19 +88,17 @@ std::set<size_t> RigWellPathIntersectionTools::findIntersectedGlobalCellIndices(
if ( caseData ) if ( caseData )
{ {
cvf::ref<RigWellPath> dummyWellPath = new RigWellPath; cvf::ref<RigWellPath> dummyWellPath;
if ( measuredDepths.size() == coords.size() ) if ( measuredDepths.size() == coords.size() )
{ {
dummyWellPath->m_wellPathPoints = coords; dummyWellPath = new RigWellPath( coords, measuredDepths );
dummyWellPath->m_measuredDepths = measuredDepths;
} }
else else
{ {
RigSimulationWellCoordsAndMD helper( coords ); RigSimulationWellCoordsAndMD helper( coords );
dummyWellPath->m_wellPathPoints = helper.wellPathPoints(); dummyWellPath = new RigWellPath( helper.wellPathPoints(), helper.measuredDepths() );
dummyWellPath->m_measuredDepths = helper.measuredDepths();
} }
globalCellIndices = findIntersectedGlobalCellIndicesForWellPath( caseData, dummyWellPath.p() ); globalCellIndices = findIntersectedGlobalCellIndicesForWellPath( caseData, dummyWellPath.p() );

View File

@ -10,10 +10,7 @@ TEST( RiaPolyArcLineSampler, Basic )
RiaPolyArcLineSampler sampler( {0, 0, -1}, points ); RiaPolyArcLineSampler sampler( {0, 0, -1}, points );
std::vector<cvf::Vec3d> sampledPoints; auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
std::vector<double> mds;
sampler.sampledPointsAndMDs( 2, true, &sampledPoints, &mds );
#if 1 #if 1
for ( size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx ) for ( size_t pIdx = 0; pIdx < sampledPoints.size(); ++pIdx )
{ {
@ -40,10 +37,7 @@ TEST( RiaPolyArcLineSampler, TestInvalidInput )
RiaPolyArcLineSampler sampler( {0, 0, -1}, points ); RiaPolyArcLineSampler sampler( {0, 0, -1}, points );
std::vector<cvf::Vec3d> sampledPoints; auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
std::vector<double> mds;
sampler.sampledPointsAndMDs( 2, true, &sampledPoints, &mds );
EXPECT_EQ( 0, (int)sampledPoints.size() ); EXPECT_EQ( 0, (int)sampledPoints.size() );
} }
@ -53,10 +47,7 @@ TEST( RiaPolyArcLineSampler, TestInvalidInput )
RiaPolyArcLineSampler sampler( {0, 0, -1}, points ); RiaPolyArcLineSampler sampler( {0, 0, -1}, points );
std::vector<cvf::Vec3d> sampledPoints; auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
std::vector<double> mds;
sampler.sampledPointsAndMDs( 2, true, &sampledPoints, &mds );
EXPECT_EQ( 0, (int)sampledPoints.size() ); EXPECT_EQ( 0, (int)sampledPoints.size() );
} }
@ -66,10 +57,7 @@ TEST( RiaPolyArcLineSampler, TestInvalidInput )
RiaPolyArcLineSampler sampler( {0, 0, -1}, points ); RiaPolyArcLineSampler sampler( {0, 0, -1}, points );
std::vector<cvf::Vec3d> sampledPoints; auto [sampledPoints, mds] = sampler.sampledPointsAndMDs( 2, true );
std::vector<double> mds;
sampler.sampledPointsAndMDs( 2, true, &sampledPoints, &mds );
EXPECT_EQ( 0, (int)sampledPoints.size() ); EXPECT_EQ( 0, (int)sampledPoints.size() );
} }

View File

@ -68,8 +68,8 @@ TEST( RigEclipseWellLogExtractor, ShortWellPathInsideOneCell )
mdValues.push_back( offset ); mdValues.push_back( offset );
} }
wellPathGeometry->m_wellPathPoints = wellPathPoints; wellPathGeometry->setWellPathPoints( wellPathPoints );
wellPathGeometry->m_measuredDepths = mdValues; wellPathGeometry->setMeasuredDepths( mdValues );
} }
cvf::ref<RigEclipseWellLogExtractor> e = new RigEclipseWellLogExtractor( reservoir.p(), wellPathGeometry.p(), "" ); cvf::ref<RigEclipseWellLogExtractor> e = new RigEclipseWellLogExtractor( reservoir.p(), wellPathGeometry.p(), "" );

View File

@ -39,8 +39,8 @@ TEST( RigWellPathGeometryExporter, VerticalPath )
for ( double md : inputMds ) for ( double md : inputMds )
{ {
rigWellPath.m_measuredDepths.push_back( md ); rigWellPath.addMeasuredDepth( md );
rigWellPath.m_wellPathPoints.push_back( cvf::Vec3d( x, y, -md ) ); rigWellPath.addWellPathPoint( cvf::Vec3d( x, y, -md ) );
} }
double mdStepSize = 5.0; double mdStepSize = 5.0;
@ -49,7 +49,7 @@ TEST( RigWellPathGeometryExporter, VerticalPath )
std::vector<double> yValues; std::vector<double> yValues;
std::vector<double> tvdValues; std::vector<double> tvdValues;
std::vector<double> mdValues; std::vector<double> mdValues;
RigWellPathGeometryExporter::exportWellPathGeometry( &rigWellPath, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); RigWellPathGeometryExporter::exportWellPathGeometry( rigWellPath, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues );
double firstMd = inputMds.front(); double firstMd = inputMds.front();
double lastMd = inputMds.back(); double lastMd = inputMds.back();

View File

@ -46,8 +46,8 @@ TEST( RigWellPathTest, FindWellPathCoordsIncludingIntersectionPoint )
mdValues.push_back( 3.0 ); mdValues.push_back( 3.0 );
mdValues.push_back( 4.0 ); mdValues.push_back( 4.0 );
wellPathGeometry.m_wellPathPoints = wellPathPoints; wellPathGeometry.setWellPathPoints( wellPathPoints );
wellPathGeometry.m_measuredDepths = mdValues; wellPathGeometry.setMeasuredDepths( mdValues );
} }
// Before first MD // Before first MD

View File

@ -54,12 +54,10 @@ RiuWellPathComponentPlotItem::RiuWellPathComponentPlotItem( const RimWellPath* w
, m_showLabel( false ) , m_showLabel( false )
{ {
CVF_ASSERT( wellPath && wellPath->wellPathGeometry() ); CVF_ASSERT( wellPath && wellPath->wellPathGeometry() );
double wellStart = 0.0; m_startMD = wellPath->startMD();
double wellEnd = wellPath->wellPathGeometry()->measureDepths().back(); m_endMD = wellPath->endMD();
m_startMD = wellStart; m_label = wellPath->name();
m_endMD = wellEnd; m_legendTitle = "Well Tube";
m_label = wellPath->name();
m_legendTitle = "Well Tube";
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------