From a308eb64194beb7b143d66ae6ce5e8d075deaa98 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 12 Sep 2025 12:10:15 +0200 Subject: [PATCH] #12894 Stimplan model export: make sure MD is always increasing. The numerical precision in the output was lowered in #11556 since Stimplan was not correctly handling the high precision (requested by Nan). That change leads to the MD not always increasing (which is expected by Stimplan). Added another tweak to the MD values to make sure it increases in the precision range that will be written to file. The original issue asked for improved precision in the output, but that is not a viable option this Stimplan does not use all of the decimal precision. Fixes #12894. --- .../RifStimPlanModelDeviationFrkExporter.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp b/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp index 10d88d114e..c2d5aa88f3 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp @@ -88,7 +88,8 @@ void RifStimPlanModelDeviationFrkExporter::appendHeaderToStream( QTextStream& st //-------------------------------------------------------------------------------------------------- void RifStimPlanModelDeviationFrkExporter::appendToStream( QTextStream& stream, const QString& label, const std::vector& values ) { - stream.setRealNumberPrecision( 8 ); + stream.setRealNumberNotation( QTextStream::FixedNotation ); + stream.setRealNumberPrecision( 4 ); stream << "" << '\n' << "" << '\n' << label << '\n' @@ -171,6 +172,13 @@ void RifStimPlanModelDeviationFrkExporter::fixupDepthValuesForExport( const std: double wiggle = 0.001; exportMdValues.push_back( exportMdValues[i - 1] + changeTvd + wiggle ); } + else if ( std::fabs( changeMd ) < 0.001 ) + { + // Stimplan wants the MD to always be increasing. + // Add small amount when that is not the case. + double wiggle = 0.002; + exportMdValues.push_back( exportMdValues[i - 1] + wiggle ); + } else { exportMdValues.push_back( mdValues[i] );