Merge branch 'master' into prepare-clang-format
# Conflicts: # src/MOLECULE/bond_fene.h # src/MOLECULE/bond_fene_expand.h
This commit is contained in:
@ -37,7 +37,9 @@ static std::string truncpath(const std::string &path)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Error::Error(LAMMPS *lmp) : Pointers(lmp) {
|
||||
Error::Error(LAMMPS *lmp)
|
||||
: Pointers(lmp), numwarn(0), maxwarn(100), allwarn(0)
|
||||
{
|
||||
#ifdef LAMMPS_EXCEPTIONS
|
||||
last_error_message.clear();
|
||||
last_error_type = ERROR_NONE;
|
||||
@ -117,6 +119,8 @@ void Error::universe_one(const std::string &file, int line, const std::string &s
|
||||
|
||||
void Error::universe_warn(const std::string &file, int line, const std::string &str)
|
||||
{
|
||||
++numwarn;
|
||||
if ((numwarn > maxwarn) || (allwarn > maxwarn) || (maxwarn < 0)) return;
|
||||
if (universe->uscreen)
|
||||
fmt::print(universe->uscreen,"WARNING on proc {}: {} ({}:{})\n",
|
||||
universe->me,str,truncpath(file),line);
|
||||
@ -245,12 +249,28 @@ void Error::_one(const std::string &file, int line, fmt::string_view format,
|
||||
only write to screen if non-nullptr on this proc since could be file
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Error::warning(const std::string &file, int line, const std::string &str, int logflag)
|
||||
void Error::warning(const std::string &file, int line, const std::string &str)
|
||||
{
|
||||
++numwarn;
|
||||
if ((numwarn > maxwarn) || (allwarn > maxwarn) || (maxwarn < 0)) return;
|
||||
std::string mesg = fmt::format("WARNING: {} ({}:{})\n",
|
||||
str,truncpath(file),line);
|
||||
if (screen) fputs(mesg.c_str(),screen);
|
||||
if (logflag && logfile) fputs(mesg.c_str(),logfile);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -258,12 +278,26 @@ void Error::warning(const std::string &file, int line, const std::string &str, i
|
||||
write message to screen and logfile (if logflag is set)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Error::message(const std::string &file, int line, const std::string &str, int logflag)
|
||||
void Error::message(const std::string &file, int line, const std::string &str)
|
||||
{
|
||||
std::string mesg = fmt::format("{} ({}:{})\n",str,truncpath(file),line);
|
||||
|
||||
if (screen) fputs(mesg.c_str(),screen);
|
||||
if (logflag && logfile) fputs(mesg.c_str(),logfile);
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user