Add utils::flush_buffers()

This commit is contained in:
Richard Berger
2022-02-04 17:53:36 -05:00
parent ea0f31c997
commit 50a7d4e7fc
3 changed files with 18 additions and 5 deletions

View File

@ -24,6 +24,7 @@
#include "text_file_reader.h"
#include "tokenizer.h"
#include "update.h"
#include "universe.h"
#include <algorithm>
#include <cctype>
@ -138,6 +139,14 @@ void utils::fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_ar
}
}
void utils::flush_buffers(LAMMPS *lmp)
{
if (lmp->screen) fflush(lmp->screen);
if (lmp->logfile) fflush(lmp->logfile);
if (lmp->universe->uscreen) fflush(lmp->universe->uscreen);
if (lmp->universe->ulogfile) fflush(lmp->universe->ulogfile);
}
/* define this here, so we won't have to include the headers
everywhere and utils.h will more likely be included anyway. */