Added retrieval of mean value

Added RigGeoMechCaseData::meanCellScalarValues(). Using this method to
retrieve the mean value for display in the info box. ToDo: Make sure
that the mean values this methods needs have been computed.
This commit is contained in:
Stein Dale
2015-06-03 14:37:51 +02:00
parent 9f87011ddd
commit 189e5dca40
3 changed files with 36 additions and 2 deletions

View File

@@ -295,6 +295,37 @@ void RigGeoMechCaseData::posNegClosestToZeroInternal(const RigFemResultAddress&
*overallNegClosestToZero = negClosestToZero;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigGeoMechCaseData::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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -54,6 +54,7 @@ public:
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);
private:
void minMaxScalarValuesInternal(const RigFemResultAddress& resVarAddr, int frameIndex,