Skip to content

Commit

Permalink
buffer dump every 2mb
Browse files Browse the repository at this point in the history
  • Loading branch information
nyoungbq committed Nov 9, 2023
1 parent 202f73f commit f83561a
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ using namespace complex;

namespace
{
static constexpr usize k_BufferDumpVal = 2000000;

// -----------------------------------------------------------------------------
template <typename T>
std::string TypeForPrimitive(T value, const IFilter::MessageHandler& messageHandler)
Expand Down Expand Up @@ -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)
Expand All @@ -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());
Expand Down

0 comments on commit f83561a

Please sign in to comment.