From b5b71bbb927e6d32d47dd834a04843a2fa27dcf1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 26 May 2020 15:16:35 -0400 Subject: [PATCH] (re-)add example uses of {fmt} --- src/create_atoms.cpp | 23 +++++------ src/force.cpp | 36 ++++++++---------- src/read_restart.cpp | 25 ++++-------- src/replicate.cpp | 23 ++++------- src/reset_ids.cpp | 6 +-- src/respa.cpp | 78 +++++++++++++++---------------------- src/set.cpp | 25 ++++-------- src/special.cpp | 91 +++++++++++++++----------------------------- src/utils.cpp | 21 ++++++++-- src/utils.h | 11 +++++- src/verlet.cpp | 9 +++-- 11 files changed, 144 insertions(+), 204 deletions(-) diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index 5325b8b9b1..7d96011415 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -38,6 +38,10 @@ #include "error.h" #include "memory.h" +#include +#include "utils.h" +#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -581,20 +585,11 @@ void CreateAtoms::command(int narg, char **arg) // print status MPI_Barrier(world); - double time2 = MPI_Wtime(); - - if (me == 0) { - if (screen) { - fprintf(screen,"Created " BIGINT_FORMAT " atoms\n", - atom->natoms-natoms_previous); - fprintf(screen," create_atoms CPU = %g secs\n",time2-time1); - } - if (logfile) { - fprintf(logfile,"Created " BIGINT_FORMAT " atoms\n", - atom->natoms-natoms_previous); - fprintf(logfile," create_atoms CPU = %g secs\n",time2-time1); - } - } + if (me == 0) + utils::logmesg(lmp, fmt::format("Created {} atoms\n" + " create_atoms CPU = {:<.3g} seconds\n", + atom->natoms - natoms_previous, + MPI_Wtime() - time1)); } /* ---------------------------------------------------------------------- diff --git a/src/force.cpp b/src/force.cpp index 63d1fcbe31..eb288e59b4 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "style_bond.h" #include "style_angle.h" #include "style_dihedral.h" @@ -34,6 +35,7 @@ #include "kspace.h" #include "error.h" #include "utils.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -945,10 +947,9 @@ double Force::numeric(const char *file, int line, char *str) if (isdigit(str[i])) continue; if (str[i] == '-' || str[i] == '+' || str[i] == '.') continue; if (str[i] == 'e' || str[i] == 'E') continue; - char msg[256]; - snprintf(msg,256,"Expected floating point parameter instead of " - "'%s' in input script or data file",str); - error->all(file,line,msg); + std::string msg = fmt::format("Expected floating point parameter " + "instead of '{}' in input script or data file",str); + error->all(file,line,msg.c_str()); } return atof(str); @@ -971,10 +972,9 @@ int Force::inumeric(const char *file, int line, char *str) for (int i = 0; i < n; i++) { if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue; - char msg[256]; - snprintf(msg,256,"Expected integer parameter instead of " - "'%s' in input script or data file",str); - error->all(file,line,msg); + std::string msg = fmt::format("Expected integer parameter instead " + "of '{}' in input script or data file",str); + error->all(file,line,msg.c_str()); } return atoi(str); @@ -997,10 +997,9 @@ bigint Force::bnumeric(const char *file, int line, char *str) for (int i = 0; i < n; i++) { if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue; - char msg[256]; - snprintf(msg,256,"Expected integer parameter instead of " - "'%s' in input script or data file",str); - error->all(file,line,msg); + std::string msg = fmt::format("Expected integer parameter instead " + "of '{}' in input script or data file",str); + error->all(file,line,msg.c_str()); } return ATOBIGINT(str); @@ -1023,10 +1022,9 @@ tagint Force::tnumeric(const char *file, int line, char *str) for (int i = 0; i < n; i++) { if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue; - char msg[256]; - snprintf(msg,256,"Expected integer parameter instead of " - "'%s' in input script or data file",str); - error->all(file,line,msg); + std::string msg = fmt::format("Expected integer parameter instead " + "of '{}' in input script or data file",str); + error->all(file,line,msg.c_str()); } return ATOTAGINT(str); @@ -1129,10 +1127,8 @@ void Force::potential_date(FILE *fp, const char *name) if (strcmp(word,"DATE:") == 0) { word = strtok(NULL," \t\n\r\f"); if (word == NULL) return; - if (screen) - fprintf(screen,"Reading potential file %s with DATE: %s\n",name,word); - if (logfile) - fprintf(logfile,"Reading potential file %s with DATE: %s\n",name,word); + utils::logmesg(lmp,fmt::format("Reading potential " + "file {} with DATE: {}",name,word)); return; } word = strtok(NULL," \t\n\r\f"); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index c05f9c78f2..2bf34be0f6 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -36,6 +36,7 @@ #include "memory.h" #include "error.h" #include "utils.h" +#include "fmt/format.h" #include "lmprestart.h" @@ -498,36 +499,24 @@ void ReadRestart::command(int narg, char **arg) bigint nblocal = atom->nlocal; MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); - if (me == 0) { - if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",natoms); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",natoms); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} atoms\n",natoms)); if (natoms != atom->natoms) error->all(FLERR,"Did not assign all restart atoms correctly"); if (me == 0) { if (atom->nbonds) { - if (screen) fprintf(screen," " BIGINT_FORMAT " bonds\n",atom->nbonds); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " bonds\n",atom->nbonds); + utils::logmesg(lmp,fmt::format(" {} bonds\n",atom->nbonds)); } if (atom->nangles) { - if (screen) fprintf(screen," " BIGINT_FORMAT " angles\n", - atom->nangles); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " angles\n", - atom->nangles); + utils::logmesg(lmp,fmt::format(" {} angles\n",atom->nangles)); } if (atom->ndihedrals) { - if (screen) fprintf(screen," " BIGINT_FORMAT " dihedrals\n", - atom->ndihedrals); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " dihedrals\n", - atom->ndihedrals); + utils::logmesg(lmp,fmt::format(" {} dihedrals\n",atom->ndihedrals)); } if (atom->nimpropers) { - if (screen) fprintf(screen," " BIGINT_FORMAT " impropers\n", - atom->nimpropers); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " impropers\n", - atom->nimpropers); + utils::logmesg(lmp,fmt::format(" {} impropers\n",atom->nimpropers)); } } diff --git a/src/replicate.cpp b/src/replicate.cpp index 50842ddd0c..bd4be44e53 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -23,6 +23,8 @@ #include "accelerator_kokkos.h" #include "memory.h" #include "error.h" +#include "utils.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -733,8 +735,7 @@ void Replicate::command(int narg, char **arg) MPI_Allreduce(&nblocal,&natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); if (me == 0) { - if (screen) fprintf(screen," " BIGINT_FORMAT " atoms\n",natoms); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " atoms\n",natoms); + utils::logmesg(lmp,fmt::format(" {} atoms\n",natoms)); } if (natoms != atom->natoms) @@ -742,26 +743,16 @@ void Replicate::command(int narg, char **arg) if (me == 0) { if (atom->nbonds) { - if (screen) fprintf(screen," " BIGINT_FORMAT " bonds\n",atom->nbonds); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " bonds\n",atom->nbonds); + utils::logmesg(lmp,fmt::format(" {} bonds\n",atom->nbonds)); } if (atom->nangles) { - if (screen) fprintf(screen," " BIGINT_FORMAT " angles\n", - atom->nangles); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " angles\n", - atom->nangles); + utils::logmesg(lmp,fmt::format(" {} angles\n",atom->nangles)); } if (atom->ndihedrals) { - if (screen) fprintf(screen," " BIGINT_FORMAT " dihedrals\n", - atom->ndihedrals); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " dihedrals\n", - atom->ndihedrals); + utils::logmesg(lmp,fmt::format(" {} dihedrals\n",atom->ndihedrals)); } if (atom->nimpropers) { - if (screen) fprintf(screen," " BIGINT_FORMAT " impropers\n", - atom->nimpropers); - if (logfile) fprintf(logfile," " BIGINT_FORMAT " impropers\n", - atom->nimpropers); + utils::logmesg(lmp,fmt::format(" {} impropers\n",atom->nimpropers)); } } diff --git a/src/reset_ids.cpp b/src/reset_ids.cpp index 4f81abd3fd..20759d2ef6 100644 --- a/src/reset_ids.cpp +++ b/src/reset_ids.cpp @@ -20,6 +20,7 @@ #include "special.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -40,10 +41,7 @@ void ResetIDs::command(int narg, char ** /* arg */) // NOTE: check if any fixes exist which store atom IDs? // if so, this operation will mess up the fix - if (comm->me == 0) { - if (screen) fprintf(screen,"Resetting atom IDs ...\n"); - if (logfile) fprintf(logfile,"Resetting atom IDs ...\n"); - } + if (comm->me == 0) utils::logmesg(lmp,"Resetting atom IDs ...\n"); // create an atom map if one doesn't exist already diff --git a/src/respa.cpp b/src/respa.cpp index a184756335..8a94b18736 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -17,6 +17,7 @@ #include "respa.h" #include +#include #include "neighbor.h" #include "atom.h" #include "atom_vec.h" @@ -38,6 +39,7 @@ #include "error.h" #include "utils.h" #include "pair_hybrid.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -192,44 +194,23 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : // print respa levels if (comm->me == 0) { - if (screen) { - fprintf(screen,"Respa levels:\n"); - for (int i = 0; i < nlevels; i++) { - fprintf(screen," %d =",i+1); - if (level_bond == i) fprintf(screen," bond"); - if (level_angle == i) fprintf(screen," angle"); - if (level_dihedral == i) fprintf(screen," dihedral"); - if (level_improper == i) fprintf(screen," improper"); - if (level_pair == i) fprintf(screen," pair"); - if (level_inner == i) fprintf(screen," pair-inner"); - if (level_middle == i) fprintf(screen," pair-middle"); - if (level_outer == i) fprintf(screen," pair-outer"); - for (int j=0;jme == 0 && screen) { - fprintf(screen,"Setting up r-RESPA run ...\n"); + std::string mesg = "Setting up r-RESPA run ...\n"; if (flag) { - fprintf(screen," Unit style : %s\n", update->unit_style); - fprintf(screen," Current step : " BIGINT_FORMAT "\n", - update->ntimestep); - fprintf(screen," Time steps :"); + mesg += fmt::format(" Unit style : {}\n",update->unit_style); + mesg += fmt::format(" Current step : {}\n", update->ntimestep); + + mesg += " Time steps :"; for (int ilevel=0; ilevel < nlevels; ++ilevel) - fprintf(screen," %d:%g",ilevel+1, step[ilevel]); - fprintf(screen,"\n r-RESPA fixes :"); + mesg += fmt::format(" {}:{}",ilevel+1, step[ilevel]); + + mesg += "\n r-RESPA fixes :"; for (int l=0; l < modify->n_post_force_respa; ++l) { Fix *f = modify->fix[modify->list_post_force_respa[l]]; if (f->respa_level >= 0) - fprintf(screen," %d:%s[%s]", - MIN(f->respa_level+1,nlevels),f->style,f->id); + mesg += fmt::format(" {}:{}[{}]", + MIN(f->respa_level+1,nlevels), + f->style,f->id); } - fprintf(screen,"\n"); + mesg += "\n"; + fputs(mesg.c_str(),screen); timer->print_timeout(screen); } } diff --git a/src/set.cpp b/src/set.cpp index 80636a3ae2..d201d507f8 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -36,6 +36,8 @@ #include "memory.h" #include "error.h" #include "modify.h" +#include "utils.h" +#include "fmt/format.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -601,23 +603,12 @@ void Set::command(int narg, char **arg) MPI_Allreduce(&count,&allcount,1,MPI_INT,MPI_SUM,world); if (comm->me == 0) { - - if (screen) { - if (strcmp(arg[origarg],"cc") == 0) - fprintf(screen," %d settings made for %s index %s\n", - allcount,arg[origarg],arg[origarg+1]); - else - fprintf(screen," %d settings made for %s\n", - allcount,arg[origarg]); - } - if (logfile) { - if (strcmp(arg[origarg],"cc") == 0) - fprintf(logfile," %d settings made for %s index %s\n", - allcount,arg[origarg],arg[origarg+1]); - else - fprintf(logfile," %d settings made for %s\n", - allcount,arg[origarg]); - } + if (strcmp(arg[origarg],"cc") == 0) + utils::logmesg(lmp,fmt::format(" {} settings made for {} index {}", + allcount,arg[origarg],arg[origarg+1])); + else + utils::logmesg(lmp,fmt::format(" {} settings made for {}", + allcount,arg[origarg])); } } diff --git a/src/special.cpp b/src/special.cpp index 0bb27b9540..3b2969e427 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -22,6 +22,8 @@ #include "accelerator_kokkos.h" // IWYU pragma: export #include "atom_masks.h" #include "memory.h" +#include "utils.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -60,11 +62,11 @@ void Special::build() if (me == 0 && screen) { const double * const special_lj = force->special_lj; const double * const special_coul = force->special_coul; - fprintf(screen,"Finding 1-2 1-3 1-4 neighbors ...\n" - " special bond factors lj: %-10g %-10g %-10g\n" - " special bond factors coul: %-10g %-10g %-10g\n", - special_lj[1],special_lj[2],special_lj[3], - special_coul[1],special_coul[2],special_coul[3]); + fmt::print(screen,"Finding 1-2 1-3 1-4 neighbors ...\n" + " special bond factors lj: {:<10g} {:<10g} {:<10g}\n" + " special bond factors coul: {:<10g} {:<10g} {:<10g}\n", + special_lj[1],special_lj[2],special_lj[3], + special_coul[1],special_coul[2],special_coul[3]); } // initialize nspecial counters to 0 @@ -90,10 +92,8 @@ void Special::build() // print max # of 1-2 neighbors - if (me == 0) { - if (screen) fprintf(screen," %d = max # of 1-2 neighbors\n",maxall); - if (logfile) fprintf(logfile," %d = max # of 1-2 neighbors\n",maxall); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = max # of 1-2 neighbors\n",maxall)); // done if special_bond weights for 1-3, 1-4 are set to 1.0 @@ -115,10 +115,8 @@ void Special::build() // print max # of 1-3 neighbors - if (me == 0) { - if (screen) fprintf(screen," %d = max # of 1-3 neighbors\n",maxall); - if (logfile) fprintf(logfile," %d = max # of 1-3 neighbors\n",maxall); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = max # of 1-3 neighbors\n",maxall)); // done if special_bond weights for 1-4 are set to 1.0 @@ -140,10 +138,8 @@ void Special::build() // print max # of 1-4 neighbors - if (me == 0) { - if (screen) fprintf(screen," %d = max # of 1-4 neighbors\n",maxall); - if (logfile) fprintf(logfile," %d = max # of 1-4 neighbors\n",maxall); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = max # of 1-4 neighbors\n",maxall)); // finish processing the onetwo, onethree, onefour lists @@ -694,12 +690,9 @@ void Special::combine() force->special_extra = 0; - if (me == 0) { - if (screen) - fprintf(screen," %d = max # of special neighbors\n",atom->maxspecial); - if (logfile) - fprintf(logfile," %d = max # of special neighbors\n",atom->maxspecial); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = max # of special " + "neighbors\n",atom->maxspecial)); if (lmp->kokkos) { AtomKokkos* atomKK = (AtomKokkos*) atom; @@ -800,14 +793,9 @@ void Special::angle_trim() double allcount; MPI_Allreduce(&onethreecount,&allcount,1,MPI_DOUBLE,MPI_SUM,world); - if (me == 0) { - if (screen) - fprintf(screen, - " %g = # of 1-3 neighbors before angle trim\n",allcount); - if (logfile) - fprintf(logfile, - " %g = # of 1-3 neighbors before angle trim\n",allcount); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = # of 1-3 neighbors " + "before angle trim\n",allcount)); // if angles or dihedrals are defined // rendezvous angle 1-3 and dihedral 1-3,2-4 pairs @@ -1035,14 +1023,9 @@ void Special::angle_trim() for (i = 0; i < nlocal; i++) onethreecount += nspecial[i][1]; MPI_Allreduce(&onethreecount,&allcount,1,MPI_DOUBLE,MPI_SUM,world); - if (me == 0) { - if (screen) - fprintf(screen, - " %g = # of 1-3 neighbors after angle trim\n",allcount); - if (logfile) - fprintf(logfile, - " %g = # of 1-3 neighbors after angle trim\n",allcount); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = # of 1-3 neighbors " + "after angle trim\n",allcount)); } /* ---------------------------------------------------------------------- @@ -1070,14 +1053,9 @@ void Special::dihedral_trim() double allcount; MPI_Allreduce(&onefourcount,&allcount,1,MPI_DOUBLE,MPI_SUM,world); - if (me == 0) { - if (screen) - fprintf(screen, - " %g = # of 1-4 neighbors before dihedral trim\n",allcount); - if (logfile) - fprintf(logfile, - " %g = # of 1-4 neighbors before dihedral trim\n",allcount); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = # of 1-4 neighbors " + "before dihedral trim\n",allcount)); // if dihedrals are defined, rendezvous the dihedral 1-4 pairs @@ -1219,14 +1197,9 @@ void Special::dihedral_trim() for (i = 0; i < nlocal; i++) onefourcount += nspecial[i][2]; MPI_Allreduce(&onefourcount,&allcount,1,MPI_DOUBLE,MPI_SUM,world); - if (me == 0) { - if (screen) - fprintf(screen, - " %g = # of 1-4 neighbors after dihedral trim\n",allcount); - if (logfile) - fprintf(logfile, - " %g = # of 1-4 neighbors after dihedral trim\n",allcount); - } + if (me == 0) + utils::logmesg(lmp,fmt::format(" {} = # of 1-4 neighbors " + "after dihedral trim\n",allcount)); } /* ---------------------------------------------------------------------- @@ -1340,9 +1313,7 @@ void Special::fix_alteration() void Special::timer_output(double time1) { - double time2 = MPI_Wtime(); - if (comm->me == 0) { - if (screen) fprintf(screen," special bonds CPU = %g secs\n",time2-time1); - if (logfile) fprintf(logfile," special bonds CPU = %g secs\n",time2-time1); - } + if (comm->me == 0) + utils::logmesg(lmp,fmt::format(" special bonds CPU = {:<.3g} secs\n", + MPI_Wtime()-time1)); } diff --git a/src/utils.cpp b/src/utils.cpp index 4375b5d9c9..b28bb50e69 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -16,6 +16,7 @@ #include #include "lammps.h" #include "error.h" +#include "fmt/format.h" #if defined(__linux__) #include // for readlink @@ -84,6 +85,19 @@ bool utils::strmatch(std::string text, std::string pattern) return (pos >= 0); } +/* This simplifies the repetitive task of outputting some + * message to both the screen and/or the log file. In combination + * with using fmt::format(), which returns the formatted text + * in a std::string() instance, this can be used to reduce + * operations previously requiring several lines of code to + * a single statement. */ + +void utils::logmesg(LAMMPS *lmp, const std::string &mesg) +{ + if (lmp->screen) fputs(mesg.c_str(), lmp->screen); + if (lmp->logfile) fputs(mesg.c_str(), lmp->logfile); +} + /** \brief try to detect pathname from FILE pointer. Currently only supported on Linux, otherwise will report "(unknown)". * * \param buf storage buffer for pathname. output will be truncated if not large enough @@ -167,14 +181,15 @@ void utils::sfread(const char *srcname, int srcline, void *s, size_t size, /* ------------------------------------------------------------------ */ -std::string utils::check_packages_for_style(std::string style, - std::string name, LAMMPS *lmp) +std::string utils::check_packages_for_style(const std::string &style, + const std::string &name, + LAMMPS *lmp) { std::string errmsg = "Unrecognized " + style + " style '" + name + "'"; const char *pkg = lmp->match_style(style.c_str(),name.c_str()); if (pkg) { - errmsg += " is part of the " + std::string(pkg) + " package"; + errmsg += fmt::format(" is part of the {} package",pkg); if (lmp->is_installed_pkg(pkg)) errmsg += ", but seems to be missing because of a dependency"; else diff --git a/src/utils.h b/src/utils.h index 45fb95aaac..9f9b5fbf0c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -36,6 +36,13 @@ namespace LAMMPS_NS { */ bool strmatch(std::string text, std::string pattern); + /** \brief Send message to screen and logfile, if available + * + * \param lmp pointer to LAMMPS class instance + * \param mesg message to be printed + */ + void logmesg(LAMMPS *lmp, const std::string &mesg); + /** \brief safe wrapper around fgets() which aborts on errors * or EOF and prints a suitable error message to help debugging * @@ -72,8 +79,8 @@ namespace LAMMPS_NS { * \param lmp pointer to top-level LAMMPS class instance * \return string usable for error messages */ - std::string check_packages_for_style(std::string style, - std::string name, LAMMPS *lmp); + std::string check_packages_for_style(const std::string &style, + const std::string &name, LAMMPS *lmp); /** \brief Convert a string to a floating point number while checking if it is a valid floating point or integer number diff --git a/src/verlet.cpp b/src/verlet.cpp index 8cd6fe940d..634aa176e2 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -13,6 +13,7 @@ #include "verlet.h" #include +#include #include "neighbor.h" #include "domain.h" #include "comm.h" @@ -30,6 +31,7 @@ #include "modify.h" #include "timer.h" #include "error.h" +#include "fmt/format.h" using namespace LAMMPS_NS; @@ -87,9 +89,10 @@ void Verlet::setup(int flag) if (comm->me == 0 && screen) { fprintf(screen,"Setting up Verlet run ...\n"); if (flag) { - fprintf(screen," Unit style : %s\n",update->unit_style); - fprintf(screen," Current step : " BIGINT_FORMAT "\n",update->ntimestep); - fprintf(screen," Time step : %g\n",update->dt); + fmt::print(screen," Unit style : {}\n" + " Current step : {}\n" + " Time step : {}\n", + update->unit_style,update->ntimestep,update->dt); timer->print_timeout(screen); } }