correct error messages and make use of utils and fmtlib

This commit is contained in:
Axel Kohlmeyer
2020-10-04 11:26:22 -04:00
parent c08089c1a7
commit 2f67f299e5

View File

@ -249,7 +249,6 @@ double Timer::get_timeout_remain()
------------------------------------------------------------------------- */
static const char *timer_style[] = { "off", "loop", "normal", "full" };
static const char *timer_mode[] = { "nosync", "(dummy)", "sync" };
static const char timer_fmt[] = "New timer settings: style=%s mode=%s timeout=%s\n";
void Timer::modify_params(int narg, char **arg)
{
@ -271,15 +270,15 @@ void Timer::modify_params(int narg, char **arg)
++iarg;
if (iarg < narg) {
_timeout = utils::timespec2seconds(arg[iarg]);
} else error->all(FLERR,"Illegal timers command");
} else error->all(FLERR,"Illegal timer command");
} else if (strcmp(arg[iarg],"every") == 0) {
++iarg;
if (iarg < narg) {
_checkfreq = utils::inumeric(FLERR,arg[iarg],false,lmp);
if (_checkfreq <= 0)
error->all(FLERR,"Illegal timers command");
} else error->all(FLERR,"Illegal timers command");
} else error->all(FLERR,"Illegal timers command");
error->all(FLERR,"Illegal timer command");
} else error->all(FLERR,"Illegal timer command");
} else error->all(FLERR,"Illegal timer command");
++iarg;
}
@ -295,9 +294,8 @@ void Timer::modify_params(int narg, char **arg)
strftime(timebuf,32,"%H:%M:%S",tm);
}
if (screen)
fprintf(screen,timer_fmt,timer_style[_level],timer_mode[_sync],timebuf);
if (logfile)
fprintf(logfile,timer_fmt,timer_style[_level],timer_mode[_sync],timebuf);
utils::logmesg(lmp,fmt::format("New timer settings: style={} mode={} "
"timeout={}\n",timer_style[_level],
timer_mode[_sync],timebuf);
}
}