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:
parent
9f87011ddd
commit
189e5dca40
@ -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,
|
||||
|
@ -38,8 +38,7 @@
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RimGeoMechResultSlot.h"
|
||||
|
||||
|
||||
#include "RigFemResultAddress.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig");
|
||||
|
||||
@ -330,6 +329,9 @@ void Rim3dOverlayInfoConfig::updateGeoMech3DInfo(RimGeoMechView * geoMechView)
|
||||
double p10 = 0, p90 = 0;
|
||||
double mean = 0;
|
||||
|
||||
RigFemResultAddress resAddress = geoMechView->cellResult()->resultAddress();
|
||||
caseData->meanCellScalarValues(resAddress, &mean);
|
||||
|
||||
// ToDo: Implement statistics for geomech data
|
||||
/*RigStatisticsDataCache* statistics = caseData ? caseData->statistics() : NULL;
|
||||
statistics->minMaxCellScalarValues(min, max);
|
||||
|
Loading…
Reference in New Issue
Block a user