2018-06-08 08:10:45 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-06-08 08:10:45 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2018-06-08 08:10:45 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2018-06-08 08:10:45 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
#include <cstddef>
|
|
|
|
#include <set>
|
2019-09-06 03:40:57 -05:00
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
2018-06-08 08:10:45 -05:00
|
|
|
|
|
|
|
class QDateTime;
|
|
|
|
|
|
|
|
//==================================================================================================
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2018-06-08 08:10:45 -05:00
|
|
|
//==================================================================================================
|
|
|
|
class RiaCurveDataTools
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef std::vector<std::pair<size_t, size_t>> CurveIntervals;
|
|
|
|
|
2019-11-25 02:43:38 -06:00
|
|
|
enum ErrorAxis
|
|
|
|
{
|
|
|
|
ERROR_ALONG_X_AXIS,
|
|
|
|
ERROR_ALONG_Y_AXIS
|
|
|
|
};
|
|
|
|
|
2018-06-08 08:10:45 -05:00
|
|
|
public:
|
2019-09-06 03:40:57 -05:00
|
|
|
static CurveIntervals calculateIntervalsOfValidValues( const std::vector<double>& values,
|
|
|
|
bool includePositiveValuesOnly );
|
2018-06-08 08:10:45 -05:00
|
|
|
|
|
|
|
template <typename T>
|
2019-09-06 03:40:57 -05:00
|
|
|
static void getValuesByIntervals( const std::vector<T>& values,
|
|
|
|
const CurveIntervals& intervals,
|
|
|
|
std::vector<T>* filteredValues )
|
2018-06-08 08:10:45 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( filteredValues );
|
2018-06-08 08:10:45 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t intIdx = 0; intIdx < intervals.size(); intIdx++ )
|
2018-06-08 08:10:45 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
for ( size_t vIdx = intervals[intIdx].first; vIdx <= intervals[intIdx].second; vIdx++ )
|
2018-06-08 08:10:45 -05:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
filteredValues->push_back( values[vIdx] );
|
2018-06-08 08:10:45 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static std::vector<std::pair<size_t, size_t>> computePolyLineStartStopIndices( const CurveIntervals& intervals );
|
2018-06-08 08:10:45 -05:00
|
|
|
|
|
|
|
public:
|
2019-09-06 03:40:57 -05:00
|
|
|
static bool isValidValue( double value, bool allowPositiveValuesOnly );
|
2018-06-08 08:10:45 -05:00
|
|
|
};
|