From c1e691a0ad1a6d6158652cf2fead7ae43a477f56 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 18 Oct 2023 19:57:11 -0700 Subject: [PATCH] Text-Based Diagnostics: Increase Precision (#442) Converting to ASCII comes with precision loss, but at least we can keep printing the significant digits we are provided with by our `ParticleReal` data. --- src/particles/diagnostics/DiagnosticOutput.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/particles/diagnostics/DiagnosticOutput.cpp b/src/particles/diagnostics/DiagnosticOutput.cpp index 703dbff48..f820b9def 100644 --- a/src/particles/diagnostics/DiagnosticOutput.cpp +++ b/src/particles/diagnostics/DiagnosticOutput.cpp @@ -19,6 +19,7 @@ #include // for ParticleReal #include // for PrintToFile +#include #include @@ -36,6 +37,7 @@ namespace impactx::diagnostics // keep file open as we add more and more lines amrex::AllPrintToFile file_handler(std::move(file_name)); + file_handler.SetPrecision(std::numeric_limits::max_digits10); // write file header per MPI RANK if (!append) { @@ -75,6 +77,7 @@ namespace impactx::diagnostics } // if( otype == OutputType::PrintReducedBeamCharacteristics) // create a host-side particle buffer + // todo: NOT needed for OutputType::PrintRefParticle and OutputType::PrintReducedBeamCharacteristics auto tmp = pc.make_alike(); // copy device-to-host