mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Made posNegClosestToZero a static function
This commit is contained in:
parent
28a0e1107c
commit
a31973e655
@ -70,27 +70,9 @@ void RigEclipseNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double&
|
|||||||
{
|
{
|
||||||
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
std::vector<double>& values = m_resultsData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
||||||
|
|
||||||
size_t i;
|
RigStatisticsCalculator::posNegClosestToZero(values, pos, neg);
|
||||||
for (i = 0; i < values.size(); i++)
|
|
||||||
{
|
|
||||||
if (values[i] == HUGE_VAL)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values[i] < pos && values[i] > 0)
|
|
||||||
{
|
|
||||||
pos = values[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values[i] > neg && values[i] < 0)
|
|
||||||
{
|
|
||||||
neg = values[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -101,8 +83,6 @@ void RigEclipseNativeStatCalc::addDataToHistogramCalculator(size_t timeStepIndex
|
|||||||
histogramCalculator.addData(values);
|
histogramCalculator.addData(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -87,3 +87,28 @@ void RigStatisticsCalculator::addDataToHistogramCalculator(RigHistogramCalculato
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RigStatisticsCalculator::posNegClosestToZero(const std::vector<double>& values, double& pos, double& neg)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < values.size(); i++)
|
||||||
|
{
|
||||||
|
if (values[i] == HUGE_VAL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (values[i] < pos && values[i] > 0)
|
||||||
|
{
|
||||||
|
pos = values[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (values[i] > neg && values[i] < 0)
|
||||||
|
{
|
||||||
|
neg = values[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -46,4 +46,6 @@ public:
|
|||||||
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) = 0;
|
virtual void addDataToHistogramCalculator(size_t timeStepIndex, RigHistogramCalculator& histogramCalculator) = 0;
|
||||||
|
|
||||||
virtual size_t timeStepCount() = 0;
|
virtual size_t timeStepCount() = 0;
|
||||||
|
|
||||||
|
static void posNegClosestToZero(const std::vector<double>& values, double& pos, double& neg);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user