mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user