make more use of std::string and fmtlib where beneficial
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include <mpi.h>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "update.h"
|
||||
#include "force.h"
|
||||
#include "input.h"
|
||||
@ -25,6 +26,7 @@
|
||||
#include "comm.h"
|
||||
#include "timer.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -224,15 +226,13 @@ void FixHalt::end_of_step()
|
||||
// soft/continue halt -> trigger timer to break from run loop
|
||||
// print message with ID of fix halt in case multiple instances
|
||||
|
||||
char str[128];
|
||||
sprintf(str,"Fix halt condition for fix-id %s met on step "
|
||||
BIGINT_FORMAT " with value %g",
|
||||
id, update->ntimestep, attvalue);
|
||||
|
||||
std::string message = fmt::format("Fix halt condition for fix-id {} met on "
|
||||
"step {} with value {}",
|
||||
id, update->ntimestep, attvalue);
|
||||
if (eflag == HARD) {
|
||||
error->all(FLERR,str);
|
||||
error->all(FLERR,message);
|
||||
} else if (eflag == SOFT || eflag == CONTINUE) {
|
||||
if (comm->me == 0 && msgflag == YESMSG) error->message(FLERR,str);
|
||||
if (comm->me == 0 && msgflag == YESMSG) error->message(FLERR,message);
|
||||
timer->force_timeout();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user