mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8182 Fracture Statistics: improve floating point format
This commit is contained in:
committed by
Magne Sjaastad
parent
9324c81322
commit
ce6ea17cd2
@@ -22,6 +22,7 @@
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaInterpolationTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaNumberFormat.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaWeightedGeometricMeanCalculator.h"
|
||||
#include "RiaWeightedHarmonicMeanCalculator.h"
|
||||
@@ -1360,11 +1361,11 @@ QString RimEnsembleFractureStatistics::generateStatisticsTable(
|
||||
text += "</thead>";
|
||||
text += "<tbody>";
|
||||
|
||||
auto emptyTextOnInf = []( double value ) {
|
||||
auto emptyTextOnInf = []( double value, RiaNumberFormat::NumberFormatType numberFormat, int precision ) {
|
||||
if ( std::isinf( value ) )
|
||||
return QString( "" );
|
||||
else
|
||||
return QString::number( value );
|
||||
return RiaNumberFormat::valueToText( value, numberFormat, precision );
|
||||
};
|
||||
|
||||
for ( auto propertyType : propertyTypes )
|
||||
@@ -1376,6 +1377,7 @@ QString RimEnsembleFractureStatistics::generateStatisticsTable(
|
||||
propertyType,
|
||||
numBins );
|
||||
|
||||
auto [numberFormat, precision] = RigEnsembleFractureStatisticsCalculator::numberFormatForProperty( propertyType );
|
||||
text += QString( "<tr>"
|
||||
"<td>%1</td>"
|
||||
"<td align=right>%2</td>"
|
||||
@@ -1385,11 +1387,11 @@ QString RimEnsembleFractureStatistics::generateStatisticsTable(
|
||||
"<td align=right>%6</td>"
|
||||
"</tr>" )
|
||||
.arg( name )
|
||||
.arg( emptyTextOnInf( histogramData.min ) )
|
||||
.arg( emptyTextOnInf( histogramData.p90 ) )
|
||||
.arg( emptyTextOnInf( histogramData.mean ) )
|
||||
.arg( emptyTextOnInf( histogramData.p10 ) )
|
||||
.arg( emptyTextOnInf( histogramData.max ) );
|
||||
.arg( emptyTextOnInf( histogramData.min, numberFormat, precision ) )
|
||||
.arg( emptyTextOnInf( histogramData.p90, numberFormat, precision ) )
|
||||
.arg( emptyTextOnInf( histogramData.mean, numberFormat, precision ) )
|
||||
.arg( emptyTextOnInf( histogramData.p10, numberFormat, precision ) )
|
||||
.arg( emptyTextOnInf( histogramData.max, numberFormat, precision ) );
|
||||
}
|
||||
|
||||
text += "</tbody>";
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include "RiaEclipseUnitTools.h"
|
||||
#include "RiaFractureDefines.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaNumberFormat.h"
|
||||
#include "RiaWeightedGeometricMeanCalculator.h"
|
||||
#include "RiaWeightedMeanCalculator.h"
|
||||
|
||||
@@ -1207,8 +1208,7 @@ QString RimStimPlanFractureTemplate::generatePropertiesTable() const
|
||||
RigEnsembleFractureStatisticsCalculator::calculateProperty( fractureDefinitions, propertyType );
|
||||
if ( !values.empty() )
|
||||
{
|
||||
QString name = caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::uiText( propertyType );
|
||||
appendTextIfValidValue( body, name, values[0] );
|
||||
appendTextIfValidValue( body, values[0], propertyType );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1226,3 +1226,18 @@ void RimStimPlanFractureTemplate::appendTextIfValidValue( QString& body, const Q
|
||||
body += QString( "%1: %2<br>" ).arg( title ).arg( value );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStimPlanFractureTemplate::appendTextIfValidValue( QString& body,
|
||||
double value,
|
||||
RigEnsembleFractureStatisticsCalculator::PropertyType propertyType )
|
||||
{
|
||||
if ( value != HUGE_VAL )
|
||||
{
|
||||
QString name = caf::AppEnum<RigEnsembleFractureStatisticsCalculator::PropertyType>::uiText( propertyType );
|
||||
auto [numberFormat, precision] = RigEnsembleFractureStatisticsCalculator::numberFormatForProperty( propertyType );
|
||||
body += QString( "%1: %2<br>" ).arg( name ).arg( RiaNumberFormat::valueToText( value, numberFormat, precision ) );
|
||||
}
|
||||
}
|
||||
|
@@ -30,8 +30,10 @@
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include "RigEnsembleFractureStatisticsCalculator.h"
|
||||
#include "RigFractureCell.h"
|
||||
#include "RigFractureGrid.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RigStimPlanFractureDefinition;
|
||||
@@ -137,6 +139,9 @@ private:
|
||||
|
||||
QString generatePropertiesTable() const;
|
||||
static void appendTextIfValidValue( QString& body, const QString& title, double value );
|
||||
static void appendTextIfValidValue( QString& body,
|
||||
double value,
|
||||
RigEnsembleFractureStatisticsCalculator::PropertyType propertyType );
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_activeTimeStepIndex;
|
||||
|
Reference in New Issue
Block a user