mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
3D view info box is up to speed.
This completes #291 feature wise Statistics is now pr result address and not pr. Part-result Address
This commit is contained in:
parent
e6231c0601
commit
00796b3fb4
@ -20,15 +20,17 @@
|
||||
|
||||
#include "RigFemNativeStatCalc.h"
|
||||
#include "RigFemScalarResultFrames.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "RigStatisticsMath.h"
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemNativeStatCalc::RigFemNativeStatCalc(RigFemScalarResultFrames* cellResultsData)
|
||||
RigFemNativeStatCalc::RigFemNativeStatCalc(RigFemPartResultsCollection* femResultCollection, const RigFemResultAddress& resVarAddr)
|
||||
: m_resVarAddr(resVarAddr)
|
||||
{
|
||||
m_resultsData = cellResultsData;
|
||||
m_resultsData = femResultCollection;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -36,26 +38,29 @@ RigFemNativeStatCalc::RigFemNativeStatCalc(RigFemScalarResultFrames* cellResults
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max)
|
||||
{
|
||||
std::vector<float>& values = m_resultsData->frameData(timeStepIndex);
|
||||
for (int pIdx = 0; pIdx < static_cast<int>(m_resultsData->m_femPartResults.size()); ++pIdx)
|
||||
{
|
||||
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL) // TODO
|
||||
{
|
||||
continue;
|
||||
}
|
||||
size_t i;
|
||||
for (i = 0; i < values.size(); i++)
|
||||
{
|
||||
if (values[i] == HUGE_VAL) // TODO
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (values[i] < min)
|
||||
{
|
||||
min = values[i];
|
||||
}
|
||||
if (values[i] < min)
|
||||
{
|
||||
min = values[i];
|
||||
}
|
||||
|
||||
if (values[i] > max)
|
||||
{
|
||||
max = values[i];
|
||||
}
|
||||
}
|
||||
if (values[i] > max)
|
||||
{
|
||||
max = values[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,7 +68,28 @@ void RigFemNativeStatCalc::minMaxCellScalarValues(size_t timeStepIndex, double&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg)
|
||||
{
|
||||
|
||||
for (int pIdx = 0; pIdx < static_cast<int>(m_resultsData->m_femPartResults.size()); ++pIdx)
|
||||
{
|
||||
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, (int)timeStepIndex);
|
||||
|
||||
for (size_t 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -71,7 +97,31 @@ void RigFemNativeStatCalc::posNegClosestToZero(size_t timeStepIndex, double& pos
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemNativeStatCalc::valueSumAndSampleCount(double& valueSum, size_t& sampleCount)
|
||||
{
|
||||
int timestepCount = (int)(this->timeStepCount());
|
||||
int partCount = static_cast<int>(m_resultsData->m_femPartResults.size());
|
||||
|
||||
for (int pIdx = 0; pIdx < partCount; ++pIdx)
|
||||
{
|
||||
for (int tIdx = 0; tIdx < timestepCount; tIdx++)
|
||||
{
|
||||
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tIdx);
|
||||
size_t undefValueCount = 0;
|
||||
for (size_t cIdx = 0; cIdx < values.size(); ++cIdx)
|
||||
{
|
||||
double value = values[cIdx];
|
||||
if (value == HUGE_VAL || value != value)
|
||||
{
|
||||
++undefValueCount;
|
||||
continue;
|
||||
}
|
||||
|
||||
valueSum += value;
|
||||
}
|
||||
|
||||
sampleCount += values.size();
|
||||
sampleCount -= undefValueCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -79,7 +129,17 @@ void RigFemNativeStatCalc::valueSumAndSampleCount(double& valueSum, size_t& samp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemNativeStatCalc::addDataToHistogramCalculator(RigHistogramCalculator& histogramCalculator)
|
||||
{
|
||||
int timestepCount = (int)(this->timeStepCount());
|
||||
int partCount = static_cast<int>(m_resultsData->m_femPartResults.size());
|
||||
for (int pIdx = 0; pIdx < partCount; ++pIdx)
|
||||
{
|
||||
for (int tIdx = 0; tIdx < timestepCount; tIdx++)
|
||||
{
|
||||
const std::vector<float>& values = m_resultsData->resultValues(m_resVarAddr, pIdx, tIdx);
|
||||
|
||||
histogramCalculator.addData(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -89,3 +149,5 @@ size_t RigFemNativeStatCalc::timeStepCount()
|
||||
{
|
||||
return m_resultsData->frameCount();
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,12 +24,16 @@
|
||||
///
|
||||
//==================================================================================================
|
||||
#include "RigStatisticsCalculator.h"
|
||||
class RigFemScalarResultFrames;
|
||||
#include "RigFemResultAddress.h"
|
||||
|
||||
|
||||
class RigFemPartResultsCollection;
|
||||
|
||||
|
||||
class RigFemNativeStatCalc : public RigStatisticsCalculator
|
||||
{
|
||||
public:
|
||||
RigFemNativeStatCalc(RigFemScalarResultFrames* cellResultsData);
|
||||
RigFemNativeStatCalc(RigFemPartResultsCollection* femResultCollection, const RigFemResultAddress& resVarAddr);
|
||||
|
||||
virtual void minMaxCellScalarValues(size_t timeStepIndex, double& min, double& max);
|
||||
virtual void posNegClosestToZero(size_t timeStepIndex, double& pos, double& neg);
|
||||
@ -39,7 +43,8 @@ public:
|
||||
virtual size_t timeStepCount();
|
||||
|
||||
private:
|
||||
RigFemScalarResultFrames* m_resultsData;
|
||||
RigFemPartResultsCollection* m_resultsData;
|
||||
RigFemResultAddress m_resVarAddr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
#include "RigFemNativeStatCalc.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -91,7 +92,7 @@ std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::sc
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(int partIndex,
|
||||
const RigFemResultAddress& resVarAddr)
|
||||
const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
CVF_ASSERT(partIndex < m_femPartResults.size());
|
||||
CVF_ASSERT(m_readerInterface.notNull());
|
||||
@ -100,29 +101,29 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::findOrLoadScalarResult(in
|
||||
if (frames) return frames;
|
||||
|
||||
std::vector<std::string> stepNames = m_readerInterface->stepNames();
|
||||
frames = m_femPartResults[partIndex]->createScalarResult( resVarAddr);
|
||||
frames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
|
||||
|
||||
for (int stepIndex = 0; stepIndex < static_cast<int>(stepNames.size()); ++stepIndex)
|
||||
{
|
||||
std::vector<double > frameTimes = m_readerInterface->frameTimes(stepIndex);
|
||||
std::vector<double > frameTimes = m_readerInterface->frameTimes(stepIndex);
|
||||
|
||||
for (int fIdx = 1; (size_t)fIdx < frameTimes.size() && fIdx < 2 ; ++fIdx) // Read only the second frame
|
||||
{
|
||||
std::vector<float>* frameData = &(frames->frameData(stepIndex));
|
||||
switch (resVarAddr.resultPosType)
|
||||
for (int fIdx = 1; (size_t)fIdx < frameTimes.size() && fIdx < 2 ; ++fIdx) // Read only the second frame
|
||||
{
|
||||
case RIG_NODAL:
|
||||
m_readerInterface->readScalarNodeField(resVarAddr.fieldName, resVarAddr.componentName, partIndex, stepIndex, fIdx, frameData);
|
||||
break;
|
||||
case RIG_ELEMENT_NODAL:
|
||||
m_readerInterface->readScalarElementNodeField(resVarAddr.fieldName, resVarAddr.componentName, partIndex, stepIndex, fIdx, frameData);
|
||||
break;
|
||||
case RIG_INTEGRATION_POINT:
|
||||
m_readerInterface->readScalarIntegrationPointField(resVarAddr.fieldName, resVarAddr.componentName, partIndex, stepIndex, fIdx, frameData);
|
||||
break;
|
||||
std::vector<float>* frameData = &(frames->frameData(stepIndex));
|
||||
switch (resVarAddr.resultPosType)
|
||||
{
|
||||
case RIG_NODAL:
|
||||
m_readerInterface->readScalarNodeField(resVarAddr.fieldName, resVarAddr.componentName, partIndex, stepIndex, fIdx, frameData);
|
||||
break;
|
||||
case RIG_ELEMENT_NODAL:
|
||||
m_readerInterface->readScalarElementNodeField(resVarAddr.fieldName, resVarAddr.componentName, partIndex, stepIndex, fIdx, frameData);
|
||||
break;
|
||||
case RIG_INTEGRATION_POINT:
|
||||
m_readerInterface->readScalarIntegrationPointField(resVarAddr.fieldName, resVarAddr.componentName, partIndex, stepIndex, fIdx, frameData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
|
||||
@ -135,151 +136,6 @@ std::vector<std::string> RigFemPartResultsCollection::stepNames()
|
||||
return m_readerInterface->stepNames();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::minMaxScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* localMin, double* localMax)
|
||||
{
|
||||
minMaxScalarValuesInternal(resVarAddr, frameIndex, localMin, localMax);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::minMaxScalarValues(const RigFemResultAddress& resVarAddr,
|
||||
double* globalMin, double* globalMax)
|
||||
{
|
||||
minMaxScalarValuesInternal(resVarAddr, -1, globalMin, globalMax);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex, double* overallMin, double* overallMax)
|
||||
{
|
||||
CVF_ASSERT(overallMax && overallMin);
|
||||
|
||||
double min = HUGE_VAL;
|
||||
double max = -HUGE_VAL;
|
||||
|
||||
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
||||
{
|
||||
if (m_femPartResults[pIdx].notNull())
|
||||
{
|
||||
RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, resVarAddr);
|
||||
if (frames)
|
||||
{
|
||||
double lmin;
|
||||
double lmax;
|
||||
|
||||
RigStatisticsDataCache* stats = frames->statistics();
|
||||
if (frameIndex == -1)
|
||||
{
|
||||
stats->minMaxCellScalarValues(lmin, lmax);
|
||||
}
|
||||
else
|
||||
{
|
||||
stats->minMaxCellScalarValues(frameIndex, lmin, lmax);
|
||||
}
|
||||
min = lmin < min ? lmin: min;
|
||||
max = lmax > max ? lmax: max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*overallMax = max;
|
||||
*overallMin = min;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero)
|
||||
{
|
||||
posNegClosestToZeroInternal(resVarAddr, frameIndex, localPosClosestToZero, localNegClosestToZero);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero)
|
||||
{
|
||||
posNegClosestToZeroInternal(resVarAddr, -1, globalPosClosestToZero, globalNegClosestToZero);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* overallPosClosestToZero, double* overallNegClosestToZero)
|
||||
{
|
||||
CVF_ASSERT(overallPosClosestToZero && overallNegClosestToZero);
|
||||
|
||||
double posClosestToZero = HUGE_VAL;
|
||||
double negClosestToZero = -HUGE_VAL;
|
||||
|
||||
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
||||
{
|
||||
if (m_femPartResults[pIdx].notNull())
|
||||
{
|
||||
RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, resVarAddr);
|
||||
if (frames)
|
||||
{
|
||||
double partNeg, partPos;
|
||||
|
||||
RigStatisticsDataCache* stats = frames->statistics();
|
||||
if (frameIndex == -1)
|
||||
{
|
||||
stats->posNegClosestToZero(partPos, partNeg);
|
||||
}
|
||||
else
|
||||
{
|
||||
stats->posNegClosestToZero(frameIndex, partPos, partNeg);
|
||||
}
|
||||
|
||||
if (partNeg > negClosestToZero && partNeg < 0) negClosestToZero = partNeg;
|
||||
if (partPos < posClosestToZero && partPos > 0) posClosestToZero = partPos;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*overallPosClosestToZero = posClosestToZero;
|
||||
*overallNegClosestToZero = negClosestToZero;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::meanCellScalarValues(const RigFemResultAddress& resVarAddr, double* meanValue)
|
||||
{
|
||||
CVF_ASSERT(meanValue);
|
||||
|
||||
double mean = 0;
|
||||
size_t meanContribCount = 0;
|
||||
|
||||
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
||||
{
|
||||
if (m_femPartResults[pIdx].notNull())
|
||||
{
|
||||
RigFemScalarResultFrames* frames = findOrLoadScalarResult(pIdx, resVarAddr);
|
||||
if (frames)
|
||||
{
|
||||
double localMean = 0;
|
||||
|
||||
RigStatisticsDataCache* stats = frames->statistics();
|
||||
stats->meanCellScalarValues(localMean);
|
||||
|
||||
mean += localMean;
|
||||
meanContribCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*meanValue = meanContribCount > 0 ? mean/meanContribCount : 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -291,7 +147,7 @@ int RigFemPartResultsCollection::frameCount()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::assertResultsLoaded( const RigFemResultAddress& resVarAddr)
|
||||
void RigFemPartResultsCollection::assertResultsLoaded(const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
for (int pIdx = 0; pIdx < static_cast<int>(m_femPartResults.size()); ++pIdx)
|
||||
{
|
||||
@ -311,4 +167,80 @@ const std::vector<float>& RigFemPartResultsCollection::resultValues(const RigFem
|
||||
return scalarResults->frameData(frameIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigStatisticsDataCache* RigFemPartResultsCollection::statistics(const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
RigStatisticsDataCache* statCache = m_resultStatistics[resVarAddr].p();
|
||||
if (!statCache)
|
||||
{
|
||||
RigFemNativeStatCalc* calculator = new RigFemNativeStatCalc(this, resVarAddr);
|
||||
statCache = new RigStatisticsDataCache(calculator);
|
||||
m_resultStatistics[resVarAddr] = statCache;
|
||||
}
|
||||
|
||||
return statCache;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::minMaxScalarValues(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* localMin, double* localMax)
|
||||
{
|
||||
this->statistics(resVarAddr)->minMaxCellScalarValues(frameIndex, *localMin, *localMax);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::minMaxScalarValues(const RigFemResultAddress& resVarAddr,
|
||||
double* globalMin, double* globalMax)
|
||||
{
|
||||
this->statistics(resVarAddr)->minMaxCellScalarValues(*globalMin, *globalMax);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero)
|
||||
{
|
||||
this->statistics(resVarAddr)->posNegClosestToZero(frameIndex, *localPosClosestToZero, *localNegClosestToZero);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero)
|
||||
{
|
||||
this->statistics(resVarAddr)->posNegClosestToZero(*globalPosClosestToZero, *globalNegClosestToZero);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue)
|
||||
{
|
||||
CVF_ASSERT(meanValue);
|
||||
|
||||
this->statistics(resVarAddr)->meanCellScalarValues(*meanValue);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigFemPartResultsCollection::p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90)
|
||||
{
|
||||
this->statistics(resVarAddr)->p10p90CellScalarValues(*p10, *p90);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<size_t>& RigFemPartResultsCollection::scalarValuesHistogram(const RigFemResultAddress& resVarAddr)
|
||||
{
|
||||
return this->statistics(resVarAddr)->cellScalarValuesHistogram();
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@ class RifGeoMechReaderInterface;
|
||||
class RigFemScalarResultFrames;
|
||||
class RigFemPartResultsCollection;
|
||||
class RigFemPartResults;
|
||||
class RigStatisticsDataCache;
|
||||
|
||||
class RigFemPartResultsCollection: public cvf::Object
|
||||
{
|
||||
@ -38,32 +39,37 @@ public:
|
||||
~RigFemPartResultsCollection();
|
||||
|
||||
std::map<std::string, std::vector<std::string> > scalarFieldAndComponentNames(RigFemResultPosEnum resPos);
|
||||
std::vector<std::string> stepNames();
|
||||
void assertResultsLoaded(const RigFemResultAddress& resVarAddr);
|
||||
const std::vector<float>& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex);
|
||||
std::vector<std::string> stepNames();
|
||||
void assertResultsLoaded(const RigFemResultAddress& resVarAddr);
|
||||
const std::vector<float>& resultValues(const RigFemResultAddress& resVarAddr, int partIndex, int frameIndex);
|
||||
|
||||
int frameCount();
|
||||
int frameCount();
|
||||
|
||||
|
||||
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax);
|
||||
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero);
|
||||
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax);
|
||||
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero);
|
||||
void meanCellScalarValues(const RigFemResultAddress& resVarAddr, double* meanValue);
|
||||
|
||||
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, int frameIndex, double* localMin, double* localMax);
|
||||
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, int frameIndex, double* localPosClosestToZero, double* localNegClosestToZero);
|
||||
void minMaxScalarValues (const RigFemResultAddress& resVarAddr, double* globalMin, double* globalMax);
|
||||
void posNegClosestToZero(const RigFemResultAddress& resVarAddr, double* globalPosClosestToZero, double* globalNegClosestToZero);
|
||||
void meanScalarValue(const RigFemResultAddress& resVarAddr, double* meanValue);
|
||||
void p10p90ScalarValues(const RigFemResultAddress& resVarAddr, double* p10, double* p90);
|
||||
const std::vector<size_t>& scalarValuesHistogram(const RigFemResultAddress& resVarAddr);
|
||||
private:
|
||||
RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex,
|
||||
const RigFemResultAddress& resVarAddr);
|
||||
RigFemScalarResultFrames* findOrLoadScalarResult(int partIndex,
|
||||
const RigFemResultAddress& resVarAddr);
|
||||
|
||||
|
||||
void minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* overallMin, double* overallMax);
|
||||
void posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* localPosClosestToZero, double* localNegClosestToZero);
|
||||
void minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* overallMin, double* overallMax);
|
||||
void posNegClosestToZeroInternal(const RigFemResultAddress& resVarAddr, int frameIndex,
|
||||
double* localPosClosestToZero, double* localNegClosestToZero);
|
||||
|
||||
cvf::Collection<RigFemPartResults> m_femPartResults;
|
||||
friend class RigFemNativeStatCalc;
|
||||
cvf::Collection<RigFemPartResults> m_femPartResults;
|
||||
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
||||
|
||||
cvf::ref<RifGeoMechReaderInterface> m_readerInterface;
|
||||
RigStatisticsDataCache* statistics(const RigFemResultAddress& resVarAddr);
|
||||
|
||||
std::map<RigFemResultAddress, cvf::ref<RigStatisticsDataCache> > m_resultStatistics;
|
||||
};
|
||||
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "RigFemScalarResultFrames.h"
|
||||
#include "RigFemNativeStatCalc.h"
|
||||
#include "RigStatisticsDataCache.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -48,19 +47,6 @@ size_t RigFemScalarResultFrames::frameCount()
|
||||
return m_frameNames.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigStatisticsDataCache* RigFemScalarResultFrames::statistics()
|
||||
{
|
||||
if (m_statistics.isNull())
|
||||
{
|
||||
RigFemNativeStatCalc* calculator = new RigFemNativeStatCalc(this);
|
||||
m_statistics = new RigStatisticsDataCache(calculator);
|
||||
}
|
||||
|
||||
return m_statistics.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -36,13 +36,10 @@ public:
|
||||
std::vector<float>& frameData(size_t frameIndex);
|
||||
size_t frameCount();
|
||||
|
||||
RigStatisticsDataCache* statistics();
|
||||
|
||||
private:
|
||||
std::vector< std::vector<float> > m_dataForEachFrame;
|
||||
std::vector<std::string> m_frameNames;
|
||||
|
||||
cvf::ref<RigStatisticsDataCache> m_statistics;
|
||||
};
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ void RivFemPartPartMgr::updateCellResultColor(size_t timeStepIndex, RimGeoMechRe
|
||||
|
||||
RigFemResultAddress resVarAddress(resPosType, fieldName.toStdString(), compName.toStdString());
|
||||
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, m_gridIdx, timeStepIndex);
|
||||
const std::vector<float>& resultValues = caseData->femPartResults()->resultValues(resVarAddress, m_gridIdx, (int)timeStepIndex);
|
||||
|
||||
const std::vector<size_t>* vxToResultMapping = NULL;
|
||||
|
||||
|
@ -331,12 +331,12 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
double mean = 0;
|
||||
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
caseData->femPartResults()->meanCellScalarValues(resAddress, &mean);
|
||||
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
|
||||
caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max);
|
||||
|
||||
// ToDo: Implement statistics for geomech data
|
||||
|
||||
//caseData->p10p90CellScalarValues(resAddress, p10, p90);
|
||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
|
||||
|
||||
infoText += QString("<table border=0 cellspacing=5 ><tr><td>Min</td><td>P10</td> <td>Mean</td> <td>P90</td> <td>Max</td> </tr>"
|
||||
"<tr><td>%1</td><td> %2</td><td> %3</td><td> %4</td><td> %5 </td></tr></table>").arg(min).arg(p10).arg(mean).arg(p90).arg(max);
|
||||
@ -379,14 +379,10 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
double mean = 0;
|
||||
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
caseData->femPartResults()->meanCellScalarValues(resAddress, &mean);
|
||||
caseData->femPartResults()->meanScalarValue(resAddress, &mean);
|
||||
caseData->femPartResults()->minMaxScalarValues(resAddress,&min, &max);
|
||||
|
||||
// ToDo: Implement statistics for geomech data
|
||||
|
||||
//caseData->p10p90CellScalarValues(resAddress, p10, p90);
|
||||
caseData->femPartResults()->minMaxScalarValues(resAddress, &min, &max);
|
||||
//geoMechView->viewer()->setHistogram(min, max, caseData->scalarValuesHistogram(resAddress));
|
||||
caseData->femPartResults()->p10p90ScalarValues(resAddress, &p10, &p90);
|
||||
geoMechView->viewer()->setHistogram(min, max, caseData->femPartResults()->scalarValuesHistogram(resAddress));
|
||||
geoMechView->viewer()->setHistogramPercentiles(p10, p90, mean);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user