#13727 WellLog: Remove cvf::Object from RigWellLogCurveData, use value types throughout

- RigWellLogCurveData no longer inherits from cvf::Object; calculateResampledCurveData returns by value
- RimWellLogCurve::curveData() returns const reference instead of pointer; m_curveData stored by value
- RigLasFileExporter: replace cvf::Collection with std::vector<RigWellLogCurveData>; SingleChannelData stores RigWellLogCurveData by value
- Update all callers to use dot notation instead of pointer dereference
This commit is contained in:
Magne Sjaastad committed 2026-03-17 20:13:26 +01:00
1 parent b229417f7c
commit 8c82f834cf
16 files changed
+132 -151

No files matched your search

@@ -78,11 +78,11 @@ void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector<double>* values, std::
m_2dWellLogRftCurve->setDefaultAddress( wellName() );
}
const RigWellLogCurveData* curveData = m_2dWellLogRftCurve->curveData();
const RigWellLogCurveData& curveData = m_2dWellLogRftCurve->curveData();
// These values are for a simulation well
*values = curveData->propertyValues();
*measuredDepthValues = curveData->depths( RiaDefines::DepthType::MEASURED_DEPTH );
*values = curveData.propertyValues();
*measuredDepthValues = curveData.depths( RiaDefines::DepthType::MEASURED_DEPTH );
}
//--------------------------------------------------------------------------------------------------
@@ -150,15 +150,14 @@ void RimWellLogCalculatedCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
// Use well A as reference for resampled curve data
auto* firstCurveData = m_firstWellLogCurve()->curveData();
auto* secondCurveData = m_secondWellLogCurve()->curveData();
const auto& firstCurveData = m_firstWellLogCurve()->curveData();
const auto& secondCurveData = m_secondWellLogCurve()->curveData();
if ( !firstCurveData || !secondCurveData ) return;
if ( firstCurveData->depthUnit() != secondCurveData->depthUnit() )
if ( firstCurveData.depthUnit() != secondCurveData.depthUnit() )
{
RiaLogging::warning( "Well log curve depth units are not the same" );
}
if ( firstCurveData->propertyValueUnit() != secondCurveData->propertyValueUnit() )
if ( firstCurveData.propertyValueUnit() != secondCurveData.propertyValueUnit() )
{
RiaLogging::warning( "Well log curve property value units are not the same" );
}
@@ -166,26 +165,26 @@ void RimWellLogCalculatedCurve::onLoadDataAndUpdate( bool updateParentPlot )
// Find the data for resampling
const auto depthType = RiaDefines::DepthType::MEASURED_DEPTH;
const std::vector<double> depthValues = depthValuesFromSource( depthType );
const auto depthUnit = firstCurveData->depthUnit();
const auto propertyUnit = firstCurveData->propertyValueUnit();
const auto depthUnit = firstCurveData.depthUnit();
const auto propertyUnit = firstCurveData.propertyValueUnit();
auto firstCurveDepthValues = firstCurveData->depths( depthType );
auto firstCurvePropertyValues = firstCurveData->propertyValues();
auto secondCurveDepthValues = secondCurveData->depths( depthType );
auto secondCurvePropertyValues = secondCurveData->propertyValues();
auto firstCurveDepthValues = firstCurveData.depths( depthType );
auto firstCurvePropertyValues = firstCurveData.propertyValues();
auto secondCurveDepthValues = secondCurveData.depths( depthType );
auto secondCurvePropertyValues = secondCurveData.propertyValues();
// Resample curve depth and property values if needed
if ( m_depthSource() != DepthSource::FIRST )
{
cvf::ref<RigWellLogCurveData> firstCurveDataResampled = firstCurveData->calculateResampledCurveData( depthType, depthValues );
firstCurveDepthValues = firstCurveDataResampled->depths( depthType );
firstCurvePropertyValues = firstCurveDataResampled->propertyValues();
auto firstCurveDataResampled = firstCurveData.calculateResampledCurveData( depthType, depthValues );
firstCurveDepthValues = firstCurveDataResampled.depths( depthType );
firstCurvePropertyValues = firstCurveDataResampled.propertyValues();
}
if ( m_depthSource() != DepthSource::SECOND )
{
cvf::ref<RigWellLogCurveData> secondCurveDataResampled = secondCurveData->calculateResampledCurveData( depthType, depthValues );
secondCurveDepthValues = secondCurveDataResampled->depths( depthType );
secondCurvePropertyValues = secondCurveDataResampled->propertyValues();
auto secondCurveDataResampled = secondCurveData.calculateResampledCurveData( depthType, depthValues );
secondCurveDepthValues = secondCurveDataResampled.depths( depthType );
secondCurvePropertyValues = secondCurveDataResampled.propertyValues();
}
// Verify equal sizes
@@ -212,8 +211,8 @@ void RimWellLogCalculatedCurve::onLoadDataAndUpdate( bool updateParentPlot )
setPropertyValuesAndDepths( calculatedPropertyValues, depthsMap, 0.0, depthUnit, isExtractionCurve, useLogarithmicScale, propertyUnit );
// Set curve data to plot
std::vector<double> xPlotValues = curveData()->propertyValuesByIntervals();
std::vector<double> yPlotValues = curveData()->depthValuesByIntervals( depthType, depthUnit );
std::vector<double> xPlotValues = curveData().propertyValuesByIntervals();
std::vector<double> yPlotValues = curveData().depthValuesByIntervals( depthType, depthUnit );
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, yPlotValues, useLogarithmicScale );
updateCurvePresentation( updateParentPlot );
}
@@ -283,18 +282,18 @@ double RimWellLogCalculatedCurve::calculateValue( double firstValue, double seco
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellLogCalculatedCurve::depthValuesFromSource( RiaDefines::DepthType depthType ) const
{
if ( !m_firstWellLogCurve || !m_firstWellLogCurve->curveData() || !m_secondWellLogCurve || !m_secondWellLogCurve->curveData() )
if ( !m_firstWellLogCurve || !m_secondWellLogCurve )
{
return {};
}
if ( m_depthSource() == DepthSource::FIRST )
{
return m_firstWellLogCurve->curveData()->depths( depthType );
return m_firstWellLogCurve->curveData().depths( depthType );
}
else if ( m_depthSource() == DepthSource::SECOND )
{
return m_secondWellLogCurve->curveData()->depths( depthType );
return m_secondWellLogCurve->curveData().depths( depthType );
}
else if ( m_depthSource() == DepthSource::UNION )
{
@@ -353,7 +352,7 @@ std::vector<double> RimWellLogCalculatedCurve::unionDepthValuesFromVectors( cons
//--------------------------------------------------------------------------------------------------
std::vector<double> RimWellLogCalculatedCurve::unionDepthValuesFromCurves( RiaDefines::DepthType depthType ) const
{
if ( !m_firstWellLogCurve || !m_firstWellLogCurve->curveData() || !m_secondWellLogCurve || !m_secondWellLogCurve->curveData() )
if ( !m_firstWellLogCurve || !m_secondWellLogCurve )
{
return {};
}
@@ -361,8 +360,8 @@ std::vector<double> RimWellLogCalculatedCurve::unionDepthValuesFromCurves( RiaDe
constexpr double depthThreshold = 0.1;
// Get union of depths
const auto firstDepths = m_firstWellLogCurve->curveData()->depths( depthType );
const auto secondDepths = m_secondWellLogCurve->curveData()->depths( depthType );
const auto firstDepths = m_firstWellLogCurve->curveData().depths( depthType );
const auto secondDepths = m_secondWellLogCurve->curveData().depths( depthType );
return unionDepthValuesFromVectors( firstDepths, secondDepths, depthThreshold );
}
@@ -52,8 +52,6 @@ RimWellLogCurve::RimWellLogCurve()
{
CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png" );
m_curveData = new RigWellLogCurveData;
m_curveDataPropertyValueRange = std::make_pair( std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() );
setDeletable( true );
@@ -71,7 +69,7 @@ RimWellLogCurve::~RimWellLogCurve()
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
{
m_curveData->setDepthUnit( depthUnit );
m_curveData.setDepthUnit( depthUnit );
}
//--------------------------------------------------------------------------------------------------
@@ -114,7 +112,7 @@ bool RimWellLogCurve::depthValueRangeInData( double* minimumValue, double* maxim
auto depthType = wellLogPlot->depthType();
auto displayUnit = wellLogPlot->depthUnit();
return m_curveData->calculateDepthRange( depthType, displayUnit, minimumValue, maximumValue );
return m_curveData.calculateDepthRange( depthType, displayUnit, minimumValue, maximumValue );
}
//--------------------------------------------------------------------------------------------------
@@ -129,8 +127,8 @@ void RimWellLogCurve::setPropertyValuesAndDepths( const std::vector<double>& pro
bool useLogarithmicScale,
const QString& propertyUnit )
{
m_curveData->setValuesAndDepths( propertyValues, depths, depthType, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale );
m_curveData->setPropertyValueUnit( propertyUnit );
m_curveData.setValuesAndDepths( propertyValues, depths, depthType, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale );
m_curveData.setPropertyValueUnit( propertyUnit );
calculateCurveDataPropertyValueRange();
}
@@ -146,8 +144,8 @@ void RimWellLogCurve::setPropertyValuesAndDepths( const std::vector<double>&
const QString& propertyUnit )
{
m_curveData->setValuesAndDepths( propertyValues, depths, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale );
m_curveData->setPropertyValueUnit( propertyUnit );
m_curveData.setValuesAndDepths( propertyValues, depths, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale );
m_curveData.setPropertyValueUnit( propertyUnit );
calculateCurveDataPropertyValueRange();
}
@@ -175,7 +173,7 @@ void RimWellLogCurve::setPropertyAndDepthsAndErrors( const std::vector<double>&
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::clearCurveData()
{
m_curveData->clear();
m_curveData.clear();
}
//--------------------------------------------------------------------------------------------------
@@ -215,9 +213,9 @@ void RimWellLogCurve::setPropertyValuesWithMdAndTVD( const std::vector<double>&
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigWellLogCurveData* RimWellLogCurve::curveData() const
const RigWellLogCurveData& RimWellLogCurve::curveData() const
{
return m_curveData.p();
return m_curveData;
}
//--------------------------------------------------------------------------------------------------
@@ -299,10 +297,9 @@ void RimWellLogCurve::setOverrideCurveData( const std::vector<double>&
//--------------------------------------------------------------------------------------------------
double RimWellLogCurve::closestYValueForX( double xValue ) const
{
if ( m_curveData.isNull() ) return std::numeric_limits<double>::infinity();
auto depths = m_curveData->depths( RiaDefines::DepthType::MEASURED_DEPTH );
auto values = m_curveData->propertyValues();
auto depths = m_curveData.depths( RiaDefines::DepthType::MEASURED_DEPTH );
auto values = m_curveData.propertyValues();
if ( depths.empty() ) return std::numeric_limits<double>::infinity();
if ( depths.empty() || values.empty() ) return std::numeric_limits<double>::infinity();
@@ -347,7 +344,7 @@ void RimWellLogCurve::updateZoomInParentPlot()
{
double plotRange = std::abs( maxPlotDepth - minPlotDepth );
double minCurveDepth, maxCurveDepth;
m_curveData->calculateDepthRange( wellLogPlot->depthType(), wellLogPlot->depthUnit(), &minCurveDepth, &maxCurveDepth );
m_curveData.calculateDepthRange( wellLogPlot->depthType(), wellLogPlot->depthUnit(), &minCurveDepth, &maxCurveDepth );
updateDepthZoom = minCurveDepth < minPlotDepth - eps * plotRange || maxCurveDepth > maxPlotDepth + eps * plotRange;
}
if ( updateDepthZoom )
@@ -386,7 +383,7 @@ void RimWellLogCurve::calculateCurveDataPropertyValueRange()
{
// Invalidate range first
m_curveDataPropertyValueRange = std::make_pair( std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() );
for ( double xValue : m_curveData->propertyValues() )
for ( double xValue : m_curveData.propertyValues() )
{
if ( RiaCurveDataTools::isValidValue( xValue, false ) )
{
@@ -455,5 +452,5 @@ RiuPlotAxis RimWellLogCurve::valueAxis() const
//--------------------------------------------------------------------------------------------------
bool RimWellLogCurve::isAnyCurveDataPresent() const
{
return !m_curveData->propertyValues().empty();
return !m_curveData.propertyValues().empty();
}
@@ -23,9 +23,10 @@
#include "RiaWellLogUnitTools.h"
#include "RimStackablePlotCurve.h"
#include "Well/RigWellLogCurveData.h"
#include "cafPdmPtrField.h"
#include "cafSignal.h"
#include "cvfObject.h"
class RigWellLogCurveData;
class RimWellPath;
@@ -47,7 +48,7 @@ public:
bool propertyValueRangeInData( double* minimumValue, double* maximumValue ) const;
bool depthValueRangeInData( double* minimumValue, double* maximumValue ) const;
const RigWellLogCurveData* curveData() const;
const RigWellLogCurveData& curveData() const;
bool isAnyCurveDataPresent() const override;
void updateCurveAppearance() override;
@@ -113,6 +114,6 @@ protected:
RiuPlotAxis valueAxis() const;
private:
cvf::ref<RigWellLogCurveData> m_curveData;
RigWellLogCurveData m_curveData;
std::pair<double, double> m_curveDataPropertyValueRange;
};
@@ -363,8 +363,8 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
useLogarithmicScale = track->isLogarithmicScale();
}
std::vector<double> xPlotValues = curveData()->propertyValuesByIntervals();
std::vector<double> depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit );
std::vector<double> xPlotValues = curveData().propertyValuesByIntervals();
std::vector<double> depthPlotValues = curveData().depthValuesByIntervals( depthType, displayUnit );
CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() );
if ( wellLogPlot->depthOrientation() == RiaDefines::Orientation::HORIZONTAL )
@@ -373,7 +373,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
else
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, useLogarithmicScale );
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
m_plotCurve->setLineSegmentStartStopIndices( curveData().polylineStartStopIndices() );
RimPlotCurve::updateCurvePresentation( updateParentPlot );
@@ -160,7 +160,7 @@ void RimWellLogLasFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
setPropertyValuesAndDepths( values, validDepths, rkbDiff, wellLogFile->depthUnit(), false, useLogarithmicScale );
QString errMsg;
if ( wellLogPlot && !curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
if ( wellLogPlot && !curveData().availableDepthTypes().count( wellLogPlot->depthType() ) )
{
QString depthTitle = wellLogPlot->depthAxisTitle();
errMsg = QString( "Display of %1 for LAS curves is not possible without %2 "
@@ -190,13 +190,13 @@ void RimWellLogLasFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
RiaDefines::DepthType depthType = RiaDefines::DepthType::MEASURED_DEPTH;
if ( wellLogPlot && curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
if ( wellLogPlot && curveData().availableDepthTypes().count( wellLogPlot->depthType() ) )
{
depthType = wellLogPlot->depthType();
}
setPropertyAndDepthValuesToPlotCurve( curveData()->propertyValuesByIntervals(),
curveData()->depthValuesByIntervals( depthType, displayUnit ) );
setPropertyAndDepthValuesToPlotCurve( curveData().propertyValuesByIntervals(),
curveData().depthValuesByIntervals( depthType, displayUnit ) );
if ( updateParentPlot )
{
@@ -760,8 +760,8 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
m_plotCurve->setPerPointLabels( perPointLabels );
auto propertyValues = curveData()->propertyValuesByIntervals();
auto depthValues = curveData()->depthValuesByIntervals( RiaDefines::DepthType::MEASURED_DEPTH, displayUnit );
auto propertyValues = curveData().propertyValuesByIntervals();
auto depthValues = curveData().depthValuesByIntervals( RiaDefines::DepthType::MEASURED_DEPTH, displayUnit );
if ( !errors.empty() )
{
@@ -772,7 +772,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
setPropertyAndDepthValuesToPlotCurve( propertyValues, depthValues );
}
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
m_plotCurve->setLineSegmentStartStopIndices( curveData().polylineStartStopIndices() );
auto wellLogTrack = firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
@@ -788,8 +788,8 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
m_plotCurve->setPerPointLabels( perPointLabels );
auto propertyValues = curveData()->propertyValuesByIntervals();
auto depthValues = curveData()->depthValuesByIntervals( RiaDefines::DepthType::TRUE_VERTICAL_DEPTH, displayUnit );
auto propertyValues = curveData().propertyValuesByIntervals();
auto depthValues = curveData().depthValuesByIntervals( RiaDefines::DepthType::TRUE_VERTICAL_DEPTH, displayUnit );
bool useLogarithmicScale = false;
if ( !errors.empty() )
@@ -809,7 +809,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
}
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
m_plotCurve->setLineSegmentStartStopIndices( curveData().polylineStartStopIndices() );
}
if ( updateParentPlot )
@@ -805,16 +805,15 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
{
if ( !curve->isChecked() ) continue;
const RigWellLogCurveData* curveData = curve->curveData();
if ( !curveData ) continue;
const RigWellLogCurveData& curveData = curve->curveData();
curveNames.push_back( curve->curveName() );
if ( curveNames.size() == 1 )
{
curveDepths = curveData->depthValuesByIntervals( depthType, depthUnit );
curveDepths = curveData.depthValuesByIntervals( depthType, depthUnit );
}
std::vector<double> xPlotValues = curveData->propertyValuesByIntervals();
std::vector<double> xPlotValues = curveData.propertyValuesByIntervals();
if ( xPlotValues.empty() )
{
curveNames.pop_back();
@@ -831,7 +830,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
foundNonMatchingDepths = true;
}
std::vector<double> depths = curveData->depthValuesByIntervals( depthType, depthUnit );
std::vector<double> depths = curveData.depthValuesByIntervals( depthType, depthUnit );
curveMerger.addCurveData( depths, xPlotValues );
curvesPlotXValues.push_back( xPlotValues );
@@ -2140,9 +2139,9 @@ void RimWellLogTrack::computeAndSetPropertyValueRangeMinForLogarithmicScale()
for ( const auto& curve : m_curves )
{
if ( curve->isChecked() && curve->curveData() )
if ( curve->isChecked() )
{
RigStatisticsCalculator::posNegClosestToZero( curve->curveData()->propertyValuesByIntervals(), pos, neg );
RigStatisticsCalculator::posNegClosestToZero( curve->curveData().propertyValuesByIntervals(), pos, neg );
}
}
@@ -2470,7 +2469,7 @@ void RimWellLogTrack::updateStackedCurveData()
for ( auto curve : stackedCurvesInGroup )
{
auto depths = curve->curveData()->depths( depthType );
auto depths = curve->curveData().depths( depthType );
if ( depths.empty() ) continue;
if ( allDepthValues.empty() )
@@ -2497,8 +2496,8 @@ void RimWellLogTrack::updateStackedCurveData()
std::vector<double> allStackedValues( allDepthValues.size(), 0.0 );
for ( auto curve : stackedCurvesInGroup )
{
auto interpolatedCurveValues = curve->curveData()->calculateResampledCurveData( depthType, allDepthValues );
auto xValues = interpolatedCurveValues->propertyValues();
auto interpolatedCurveValues = curve->curveData().calculateResampledCurveData( depthType, allDepthValues );
auto xValues = interpolatedCurveValues.propertyValues();
for ( size_t i = 0; i < xValues.size(); ++i )
{
if ( xValues[i] != HUGE_VAL )
@@ -89,7 +89,7 @@ void RimWellMeasurementCollection::deleteAllEmptyCurves()
for ( auto curve : measurementCurves )
{
if ( curve->curveData()->propertyValues().empty() )
if ( curve->curveData().propertyValues().empty() )
{
auto track = curve->firstAncestorOrThisOfTypeAsserted<RimWellLogTrack>();
@@ -151,7 +151,7 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
RiaDefines::DepthType depthType = RiaDefines::DepthType::MEASURED_DEPTH;
if ( wellLogPlot && curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) )
if ( wellLogPlot && curveData().availableDepthTypes().count( wellLogPlot->depthType() ) )
{
depthType = wellLogPlot->depthType();
}
@@ -159,10 +159,10 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( m_plotCurve )
{
bool useLogarithmicScale = false;
m_plotCurve->setSamplesFromXValuesAndYValues( curveData()->propertyValuesByIntervals(),
curveData()->depthValuesByIntervals( depthType, displayUnit ),
m_plotCurve->setSamplesFromXValuesAndYValues( curveData().propertyValuesByIntervals(),
curveData().depthValuesByIntervals( depthType, displayUnit ),
useLogarithmicScale );
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
m_plotCurve->setLineSegmentStartStopIndices( curveData().polylineStartStopIndices() );
}
}