simplify code by appling varargs messages and warnings
This commit is contained in:
@ -258,6 +258,20 @@ void Error::warning(const std::string &file, int line, const std::string &str)
|
||||
if (logfile) fputs(mesg.c_str(),logfile);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
forward vararg version to single string version
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Error::_warning(const std::string &file, int line, fmt::string_view format,
|
||||
fmt::format_args args)
|
||||
{
|
||||
try {
|
||||
warning(file,line,fmt::vformat(format, args));
|
||||
} catch (fmt::format_error &e) {
|
||||
warning(file,line,e.what());
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
called by one proc in world, typically proc 0
|
||||
write message to screen and logfile (if logflag is set)
|
||||
@ -271,6 +285,20 @@ void Error::message(const std::string &file, int line, const std::string &str)
|
||||
if (logfile) fputs(mesg.c_str(),logfile);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
forward vararg version to single string version
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Error::_message(const std::string &file, int line, fmt::string_view format,
|
||||
fmt::format_args args)
|
||||
{
|
||||
try {
|
||||
message(file,line,fmt::vformat(format, args));
|
||||
} catch (fmt::format_error &e) {
|
||||
message(file,line,e.what());
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
shutdown LAMMPS
|
||||
called by all procs in one world
|
||||
|
||||
Reference in New Issue
Block a user