mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#11556 StimPlan Model: export deviation with less precision.
Fixes #11556.
This commit is contained in:
parent
80f7623151
commit
56e139b9d6
@ -58,6 +58,11 @@ bool RifStimPlanModelDeviationFrkExporter::writeToFile( RimStimPlanModel* stimPl
|
||||
convertFromMeterToFeet( mdValues );
|
||||
convertFromMeterToFeet( tvdValues );
|
||||
|
||||
// Round to less precision. StimPlan does not handle high precision.
|
||||
int numSignificantDigits = 2;
|
||||
roundToPrecision( mdValues, numSignificantDigits );
|
||||
roundToPrecision( tvdValues, numSignificantDigits );
|
||||
|
||||
std::vector<double> exportTvdValues;
|
||||
std::vector<double> exportMdValues;
|
||||
fixupDepthValuesForExport( tvdValues, mdValues, exportTvdValues, exportMdValues );
|
||||
@ -83,7 +88,7 @@ void RifStimPlanModelDeviationFrkExporter::appendHeaderToStream( QTextStream& st
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifStimPlanModelDeviationFrkExporter::appendToStream( QTextStream& stream, const QString& label, const std::vector<double>& values )
|
||||
{
|
||||
stream.setRealNumberPrecision( 20 );
|
||||
stream.setRealNumberPrecision( 8 );
|
||||
stream << "<cNamedSet>" << '\n'
|
||||
<< "<name>" << '\n'
|
||||
<< label << '\n'
|
||||
@ -122,6 +127,23 @@ void RifStimPlanModelDeviationFrkExporter::convertFromMeterToFeet( std::vector<d
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifStimPlanModelDeviationFrkExporter::roundToPrecision( std::vector<double>& data, int numSignificantDigits )
|
||||
{
|
||||
auto roundUp = []( double value, int decimalPlaces ) -> double
|
||||
{
|
||||
const double multiplier = std::pow( 10.0, decimalPlaces );
|
||||
return std::ceil( value * multiplier ) / multiplier;
|
||||
};
|
||||
|
||||
for ( size_t i = 0; i < data.size(); i++ )
|
||||
{
|
||||
data[i] = roundUp( data[i], numSignificantDigits );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -42,4 +42,5 @@ private:
|
||||
static void appendToStream( QTextStream& stream, const QString& label, const std::vector<double>& values );
|
||||
static void appendFooterToStream( QTextStream& stream );
|
||||
static void convertFromMeterToFeet( std::vector<double>& data );
|
||||
static void roundToPrecision( std::vector<double>& data, int numSignificantDigits );
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user