#2141 Use accumulators to compute min/max used to configure legend

This commit is contained in:
Magne Sjaastad
2018-01-19 09:10:30 +01:00
parent b4b1dfa0f9
commit 2da5f8cf54
8 changed files with 76 additions and 51 deletions

View File

@@ -18,13 +18,16 @@
#include "RigStimPlanFractureDefinition.h"
#include <QDebug>
#include "RiaLogging.h"
#include "RigFractureCell.h"
#include "RigFractureGrid.h"
#include "RigStatisticsMath.h"
#include "RivWellFracturePartMgr.h"
#include "cvfMath.h"
#include "RivWellFracturePartMgr.h"
#include "RigFractureCell.h"
#include "RiaLogging.h"
#include "RigFractureGrid.h"
#include <cmath>
//--------------------------------------------------------------------------------------------------
@@ -574,7 +577,8 @@ const std::vector<std::vector<double>>& RigStimPlanFractureDefinition::getDataAt
}
}
qDebug() << "ERROR: Requested parameter does not exists in stimPlan data";
RiaLogging::error("Requested parameter does not exists in stimPlan data");
static std::vector<std::vector<double>> emptyVector;
return emptyVector;
}
@@ -582,12 +586,10 @@ const std::vector<std::vector<double>>& RigStimPlanFractureDefinition::getDataAt
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, const QString& unit,
double* minValue, double* maxValue,
double* posClosestToZero, double* negClosestToZero) const
void RigStimPlanFractureDefinition::appendDataToResultStatistics(const QString& resultName, const QString& unit,
MinMaxAccumulator& minMaxAccumulator,
PosNegAccumulator& posNegAccumulator) const
{
CVF_ASSERT(minValue && maxValue && posClosestToZero && negClosestToZero);
size_t resIndex = resultIndex(resultName, unit);
if (resIndex == cvf::UNDEFINED_SIZE_T) return;
@@ -595,28 +597,8 @@ void RigStimPlanFractureDefinition::computeMinMax(const QString& resultName, con
{
for (const auto& values : timeValues)
{
for (double resultValue : values)
{
if (resultValue < *minValue)
{
*minValue = resultValue;
}
if (resultValue > *maxValue)
{
*maxValue = resultValue;
}
if (resultValue > 0 && resultValue < *posClosestToZero)
{
*posClosestToZero = resultValue;
}
if (resultValue < 0 && resultValue > *negClosestToZero)
{
*posClosestToZero = resultValue;
}
}
minMaxAccumulator.addData(values);
posNegAccumulator.addData(values);
}
}
}

View File

@@ -27,6 +27,8 @@
#include "cvfVector3.h"
class RigFractureGrid;
class MinMaxAccumulator;
class PosNegAccumulator;
class RigStimPlanResultFrames
{
@@ -102,7 +104,10 @@ public:
std::vector<double> fractureGridResults(const QString& resultName,
const QString& unitName,
size_t timeStepIndex) const;
void computeMinMax(const QString& resultName, const QString& unit, double* minValue, double* maxValue, double* posClosestToZero, double* negClosestToZero) const;
void appendDataToResultStatistics(const QString& resultName, const QString& unit,
MinMaxAccumulator& minMaxAccumulator,
PosNegAccumulator& posNegAccumulator) const;
QString conductivityResultName() const;