mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 12:10:57 -06:00
7834 cref removal (#7917)
* #7834 Well Log Statistics: prefer std::shared_ptr to cvf::ref. * #7834 Use std::map to avoid hard-coded array length.
This commit is contained in:
parent
414ee77aa8
commit
6547ef1525
@ -745,7 +745,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
|
||||
|
||||
if ( m_statistics->hideEnsembleCurves() ) return;
|
||||
|
||||
cvf::ref<RigWellLogIndexDepthOffset> offsets;
|
||||
std::shared_ptr<RigWellLogIndexDepthOffset> offsets;
|
||||
if ( m_depthEqualization() == RimEnsembleWellLogStatistics::DepthEqualization::K_LAYER )
|
||||
{
|
||||
offsets = RimEnsembleWellLogStatistics::calculateIndexDepthOffset( sumCases );
|
||||
@ -788,7 +788,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
|
||||
curve->setWellLogChannelName( wellLogChannelName );
|
||||
curve->setWellLogFile( wellLogFile );
|
||||
|
||||
if ( !offsets.isNull() ) curve->setIndexDepthOffsets( offsets );
|
||||
if ( offsets ) curve->setIndexDepthOffsets( offsets );
|
||||
curve->loadDataAndUpdate( true );
|
||||
|
||||
curve->updateCurveVisibility();
|
||||
|
@ -162,7 +162,8 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
|
||||
void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellLogFile*>& wellLogFiles,
|
||||
const QString& wellLogChannelName )
|
||||
{
|
||||
cvf::ref<RigWellLogIndexDepthOffset> offsets = RimEnsembleWellLogStatistics::calculateIndexDepthOffset( wellLogFiles );
|
||||
std::shared_ptr<RigWellLogIndexDepthOffset> offsets =
|
||||
RimEnsembleWellLogStatistics::calculateIndexDepthOffset( wellLogFiles );
|
||||
|
||||
std::map<int, std::vector<double>> topValues;
|
||||
std::map<int, std::vector<double>> bottomValues;
|
||||
@ -251,15 +252,14 @@ void RimEnsembleWellLogStatistics::calculateByKLayer( const std::vector<RimWellL
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigWellLogIndexDepthOffset>
|
||||
std::shared_ptr<RigWellLogIndexDepthOffset>
|
||||
RimEnsembleWellLogStatistics::calculateIndexDepthOffset( const std::vector<RimWellLogFile*>& wellLogFiles )
|
||||
{
|
||||
int hack = 1000;
|
||||
std::vector<double> sumTopDepths( hack, 0.0 );
|
||||
std::vector<int> numTopDepths( hack, 0 );
|
||||
std::map<int, double> sumTopDepths;
|
||||
std::map<int, int> numTopDepths;
|
||||
|
||||
std::vector<double> sumBottomDepths( hack, 0.0 );
|
||||
std::vector<int> numBottomDepths( hack, 0 );
|
||||
std::map<int, double> sumBottomDepths;
|
||||
std::map<int, int> numBottomDepths;
|
||||
|
||||
int minLayerK = std::numeric_limits<int>::max();
|
||||
int maxLayerK = -std::numeric_limits<int>::max();
|
||||
@ -326,7 +326,7 @@ cvf::ref<RigWellLogIndexDepthOffset>
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cvf::ref<RigWellLogIndexDepthOffset> offset = cvf::make_ref<RigWellLogIndexDepthOffset>();
|
||||
std::shared_ptr<RigWellLogIndexDepthOffset> offset = std::make_shared<RigWellLogIndexDepthOffset>();
|
||||
for ( int kLayer = minLayerK; kLayer <= maxLayerK; kLayer++ )
|
||||
{
|
||||
if ( numTopDepths[kLayer] > 0 && numBottomDepths[kLayer] > 0 )
|
||||
|
@ -20,8 +20,7 @@
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include <cvfObject.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class QString;
|
||||
@ -70,7 +69,7 @@ public:
|
||||
const QString& wellLogChannelName,
|
||||
DepthEqualization depthEqualization );
|
||||
|
||||
static cvf::ref<RigWellLogIndexDepthOffset>
|
||||
static std::shared_ptr<RigWellLogIndexDepthOffset>
|
||||
calculateIndexDepthOffset( const std::vector<RimWellLogFile*>& wellLogFiles );
|
||||
|
||||
private:
|
||||
|
@ -96,7 +96,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
bool rkbDiff = m_wellPath->wellPathGeometry() ? m_wellPath->wellPathGeometry()->rkbDiff() : 0.0;
|
||||
|
||||
if ( !m_indexDepthOffsets.isNull() )
|
||||
if ( m_indexDepthOffsets )
|
||||
{
|
||||
// Adjust depths by reassigning depths for top and bottom of layer for each K layer
|
||||
std::vector<double> kIndexValues = wellLogFile->values( RiaResultNames::indexKResultName() );
|
||||
@ -289,7 +289,7 @@ void RimWellLogFileCurve::setWellLogFile( RimWellLogFile* wellLogFile )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::setIndexDepthOffsets( cvf::ref<RigWellLogIndexDepthOffset> depthOffsets )
|
||||
void RimWellLogFileCurve::setIndexDepthOffsets( std::shared_ptr<RigWellLogIndexDepthOffset> depthOffsets )
|
||||
{
|
||||
m_indexDepthOffsets = depthOffsets;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
RimWellPath* wellPath() const;
|
||||
void setWellLogChannelName( const QString& name );
|
||||
void setWellLogFile( RimWellLogFile* wellLogFile );
|
||||
void setIndexDepthOffsets( cvf::ref<RigWellLogIndexDepthOffset> depthOffsets );
|
||||
void setIndexDepthOffsets( std::shared_ptr<RigWellLogIndexDepthOffset> depthOffsets );
|
||||
|
||||
// Overrides from RimWellLogPlotCurve
|
||||
QString wellName() const override;
|
||||
@ -82,5 +82,5 @@ protected:
|
||||
caf::PdmField<QString> m_wellLogChannelName;
|
||||
caf::PdmField<QString> m_wellLogChannnelUnit;
|
||||
|
||||
cvf::ref<RigWellLogIndexDepthOffset> m_indexDepthOffsets;
|
||||
std::shared_ptr<RigWellLogIndexDepthOffset> m_indexDepthOffsets;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user