From 27e71f8fbf19d8e0e256117cb4df4f1e071cce9b Mon Sep 17 00:00:00 2001 From: vidanovic Date: Mon, 21 Oct 2024 19:00:40 -0700 Subject: [PATCH] Scattering data is now saved with scientific precision. --- CMakeLists.txt | 2 +- src/bsdfdata/Serializers.hpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1227cb4..78970f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ if(NOT TARGET FileParse) FetchContent_Declare( FileParse GIT_REPOSITORY https://github.com/LBNL-ETA/FileParse.git - GIT_TAG "Version_1.0" + GIT_TAG "main" ) FetchContent_MakeAvailable(FileParse) diff --git a/src/bsdfdata/Serializers.hpp b/src/bsdfdata/Serializers.hpp index 5b23ce3..2cd93ac 100644 --- a/src/bsdfdata/Serializers.hpp +++ b/src/bsdfdata/Serializers.hpp @@ -428,7 +428,13 @@ namespace BSDFData std::string serializeRow(const std::vector & row) { std::ostringstream rowStream; - std::copy(row.begin(), row.end(), std::ostream_iterator(rowStream, ", ")); + + // Transform each element into a formatted string and join them with ", " + std::transform(row.begin(), row.end(), std::ostream_iterator(rowStream, ", "), + [](double value) { + return FileParse::formatDouble(value, 5, 1, 0.99); + }); + return rowStream.str(); } } // anonymous namespace