From f83561a2f95cc42003784e508761bc50c64a3326 Mon Sep 17 00:00:00 2001 From: nyoungbq Date: Thu, 9 Nov 2023 15:16:36 -0500 Subject: [PATCH] buffer dump every 2mb --- .../Filters/Algorithms/VtkRectilinearGridWriter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/VtkRectilinearGridWriter.cpp b/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/VtkRectilinearGridWriter.cpp index b4461a7cc5..4de9210299 100644 --- a/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/VtkRectilinearGridWriter.cpp +++ b/src/Plugins/ComplexCore/src/ComplexCore/Filters/Algorithms/VtkRectilinearGridWriter.cpp @@ -11,6 +11,8 @@ using namespace complex; namespace { +static constexpr usize k_BufferDumpVal = 2000000; + // ----------------------------------------------------------------------------- template std::string TypeForPrimitive(T value, const IFilter::MessageHandler& messageHandler) @@ -178,6 +180,7 @@ struct WriteVtkDataArrayFunctor else { std::stringstream ss; + usize nextDump = k_BufferDumpVal; for(size_t i = 0; i < totalElements; i++) { if(i % 20 == 0 && i > 0) @@ -192,6 +195,14 @@ struct WriteVtkDataArrayFunctor { ss << " " << dataArray[i]; } + + if(i > nextDump) + { + fprintf(outputFile, "%s", ss.str().c_str()); + ss.clear(); + + nextDump += k_BufferDumpVal; + } } ss << "\n"; fprintf(outputFile, "%s", ss.str().c_str());