Moved remaining code from RimWellLogCurveImpl to RigWellLogCurveData

Removed class RimWellLogCurveImpl.
RigWellLogCurveData::calculateValidPointsIntervals() needs to be
harmonized with new way of extracting depths from well paths.
This commit is contained in:
Pål Hagen
2015-10-15 13:29:45 +02:00
parent c2577391c2
commit 956beba118
7 changed files with 70 additions and 217 deletions

View File

@@ -19,6 +19,9 @@
#include "RigWellLogCurveData.h"
#include "cvfMath.h"
#include "cvfAssert.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
@@ -45,7 +48,7 @@ void RigWellLogCurveData::setPoints(const std::vector<double>& xValues, const st
m_xValues = xValues;
m_yValues = yValues;
calculateValidXValuesIntervals();
calculateValidPointsIntervals();
}
//--------------------------------------------------------------------------------------------------
@@ -69,7 +72,7 @@ const std::vector<double>& RigWellLogCurveData::yValues() const
//--------------------------------------------------------------------------------------------------
const std::vector< std::pair<size_t, size_t> >& RigWellLogCurveData::filteredIntervals() const
{
return m_validXValuesIntervals;
return m_validPointsIntervals;
}
//--------------------------------------------------------------------------------------------------
@@ -78,7 +81,7 @@ const std::vector< std::pair<size_t, size_t> >& RigWellLogCurveData::filteredInt
std::vector<double> RigWellLogCurveData::validXValues() const
{
std::vector<double> filteredValues;
pickValuesFromIntervals(m_xValues, m_validXValuesIntervals, &filteredValues);
getValuesByIntervals(m_xValues, m_validPointsIntervals, &filteredValues);
return filteredValues;
}
@@ -89,7 +92,7 @@ std::vector<double> RigWellLogCurveData::validXValues() const
std::vector<double> RigWellLogCurveData::validYValues() const
{
std::vector<double> filteredValues;
pickValuesFromIntervals(m_yValues, m_validXValuesIntervals, &filteredValues);
getValuesByIntervals(m_yValues, m_validPointsIntervals, &filteredValues);
return filteredValues;
}
@@ -100,7 +103,7 @@ std::vector<double> RigWellLogCurveData::validYValues() const
std::vector< std::pair<size_t, size_t> > RigWellLogCurveData::validPointsIntervals() const
{
std::vector< std::pair<size_t, size_t> > intervals;
computeFilteredIntervals(m_validXValuesIntervals, &intervals);
computeFilteredIntervals(m_validPointsIntervals, &intervals);
return intervals;
}
@@ -109,9 +112,26 @@ std::vector< std::pair<size_t, size_t> > RigWellLogCurveData::validPointsInterva
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::calculateValidXValuesIntervals()
void RigWellLogCurveData::calculateValidPointsIntervals()
{
calculateIntervalsOfValidValues(m_xValues, &m_validXValuesIntervals);
std::vector< std::pair<size_t, size_t> > valuesIntervals;
calculateIntervalsOfValidValues(m_xValues, &valuesIntervals);
std::vector< std::pair<size_t, size_t> > pointsIntervals;
size_t intervalsCount = valuesIntervals.size();
for (size_t intIdx = 0; intIdx < intervalsCount; intIdx++)
{
std::vector< std::pair<size_t, size_t> > depthValuesIntervals;
calculateIntervalsOfValidDepthValues(m_yValues, valuesIntervals[intIdx].first, valuesIntervals[intIdx].second, &depthValuesIntervals);
for (size_t dvintIdx = 0; dvintIdx < depthValuesIntervals.size(); dvintIdx++)
{
pointsIntervals.push_back(depthValuesIntervals[dvintIdx]);
}
}
m_validPointsIntervals = pointsIntervals;
}
//--------------------------------------------------------------------------------------------------
@@ -150,11 +170,49 @@ void RigWellLogCurveData::calculateIntervalsOfValidValues(const std::vector<doub
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::calculateIntervalsOfValidDepthValues(const std::vector<double>& depthValues, size_t startIdx, size_t stopIdx, std::vector< std::pair<size_t, size_t> >* intervals)
{
CVF_ASSERT(intervals);
if (startIdx > stopIdx)
{
return;
}
if (startIdx == stopIdx || stopIdx - startIdx == 1)
{
intervals->push_back(std::make_pair(startIdx, stopIdx));
return;
}
// !! TODO: Find a reasonable tolerance
const double depthDiffTolerance = 0.1;
// Find intervals containing depth values that should be connected
size_t intStartIdx = startIdx;
for (size_t vIdx = startIdx + 1; vIdx < stopIdx; vIdx += 2)
{
if (cvf::Math::abs(depthValues[vIdx + 1] - depthValues[vIdx]) > depthDiffTolerance)
{
intervals->push_back(std::make_pair(intStartIdx, vIdx));
intStartIdx = vIdx + 1;
}
}
if (intStartIdx <= stopIdx)
{
intervals->push_back(std::make_pair(intStartIdx, stopIdx));
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::pickValuesFromIntervals(const std::vector<double>& values, const std::vector< std::pair<size_t, size_t> >& intervals, std::vector<double>* filteredValues)
void RigWellLogCurveData::getValuesByIntervals(const std::vector<double>& values, const std::vector< std::pair<size_t, size_t> >& intervals, std::vector<double>* filteredValues)
{
CVF_ASSERT(filteredValues);

View File

@@ -46,16 +46,17 @@ public:
std::vector< std::pair<size_t, size_t> > validPointsIntervals() const;
private:
void calculateValidXValuesIntervals();
void calculateValidPointsIntervals();
static void calculateIntervalsOfValidValues(const std::vector<double>& values, std::vector< std::pair<size_t, size_t> >* intervals);
static void pickValuesFromIntervals(const std::vector<double>& values, const std::vector< std::pair<size_t, size_t> >& intervals, std::vector<double>* filteredValues);
static void calculateIntervalsOfValidDepthValues(const std::vector<double>& depthValues, size_t startIdx, size_t stopIdx, std::vector< std::pair<size_t, size_t> >* intervals);
static void getValuesByIntervals(const std::vector<double>& values, const std::vector< std::pair<size_t, size_t> >& intervals, std::vector<double>* filteredValues);
static void computeFilteredIntervals(const std::vector< std::pair<size_t, size_t> >& intervals, std::vector< std::pair<size_t, size_t> >* filteredIntervals);
private:
std::vector<double> m_xValues;
std::vector<double> m_yValues;
std::vector< std::pair<size_t, size_t> > m_validXValuesIntervals;
std::vector< std::pair<size_t, size_t> > m_validPointsIntervals;
friend class RigWellLogCurveDataTestInterface;
};