15#include "libmesh/string_to_enum.h"
27 ss << libMesh::Utility::enum_to_string<FEFamily>(var1.
feType().
family) <<
",ORDER"
29 <<
" != " << libMesh::Utility::enum_to_string<FEFamily>(var2.
feType().
family) <<
",ORDER"
35mooseMsgFmt(
const std::string & msg,
const std::string & title,
const std::string & color)
37 std::ostringstream oss;
38 oss <<
"\n" << color <<
"\n" << title <<
"\n" << msg << COLOR_DEFAULT <<
"\n";
43mooseMsgFmt(
const std::string & msg,
const std::string & color)
45 std::ostringstream oss;
46 oss <<
"\n" << color <<
"\n" << msg << COLOR_DEFAULT <<
"\n";
52 const std::string & prefix ,
53 const hit::Node * node ,
54 const bool show_trace )
60 static std::atomic_flag aborting = ATOMIC_FLAG_INIT;
64 thread_local static bool this_thread_aborting =
false;
71 if (aborting.test_and_set(std::memory_order_acq_rel) && !this_thread_aborting)
86 if (this_thread_aborting)
89 this_thread_aborting =
true;
100 msg =
mooseMsgFmt(msg,
"*** ERROR ***", COLOR_RED) +
"\n";
106 Moose::err << msg << std::flush;
113 std::ostringstream oss;
115 auto trace = oss.str();
121 Moose::err << trace << std::flush;
141 const unsigned int issue_num,
142 const std::string & msg)
145 std::stringstream oss;
146 oss << msg <<
"\n\nThis error is documented at " << repo_url <<
"/issues/" << issue_num <<
".";
156 "We caught a MetaPhysicL error in while performing element or face loops. This is "
157 "potentially due to AD not having a sufficiently large derivative container size. To "
158 "increase the AD container size, you can run configure in the MOOSE root directory with the "
159 "'--with-derivative-size=<n>' option and then recompile. Other causes of MetaPhysicL logic "
160 "errors include evaluating functions where they are not defined or differentiable like sqrt "
161 "(which gets called for vector norm functions) or log with arguments <= 0");
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Exception to be thrown whenever we have _throw_on_error set and a mooseError() is emitted.
const libMesh::FEType & feType() const
Get the type of finite element object.
This class provides an interface for common operations on field variables of both FE and FV types wit...
static const std::string & getRepositoryURL(const std::string &repo_name)
Returns the repository URL associated with repo_name.
void indentMessage(const std::string &prefix, std::string &message, const char *color, bool indent_first_line, const std::string &post_prefix)
bool _throw_on_error
Variable to turn on exceptions during mooseError(), should only be used within MOOSE unit tests or wh...
std::string hitMessagePrefix(const hit::Node &node)
Get the prefix to be associated with a hit node for a message.
processor_id_type global_n_processors()
void print_trace(std::ostream &out_stream=std::cerr)
void mooseErrorRaw(std::string msg, const std::string &prefix="", const hit::Node *node=nullptr, const bool show_trace=true)
Main callback for emitting a moose error.
libMesh::Threads::spin_mutex moose_stream_lock
std::string formatMooseDocumentedError(const std::string &repo_name, const unsigned int issue_num, const std::string &msg)
Formats a documented error.
std::string mooseMsgFmt(const std::string &msg, const std::string &title, const std::string &color)
Format a message for output with a title.
void mooseStreamAll(std::ostringstream &ss)
All of the following are not meant to be called directly - they are called by the normal macros (moos...
std::string incompatVarMsg(MooseVariableFieldBase &var1, MooseVariableFieldBase &var2)
Builds and returns a string of the form:
void translateMetaPhysicLError(const MetaPhysicL::LogicError &)
emit a relatively clear error message when we catch a MetaPhysicL logic error