https://mooseframework.inl.gov
Classes | Functions | Variables
moose::internal Namespace Reference

Classes

class  ConvergenceIterationTypeRegistry
 Registry for Convergence iteration types. More...
 
class  ExecFlagRegistry
 Registry for statically defining execute flags with consistent numbering. More...
 
class  PerfGraphRegistry
 The place where all timed sections will be stored. More...
 
class  PerfGraphSectionInfo
 Used to hold metadata about the registered sections Note: this is a class instead of a struct because structs are not able to be created in place using emplace_back in C++11. More...
 
struct  SoltionInvalidityNameHash
 Helper class that hash the name associated with an invalid solution. More...
 
class  SolutionInvalidityInfo
 Helper class that stores the info associated with an invalid solution. More...
 
class  SolutionInvalidityName
 Helper class that stores the name associated with an invalid solution. More...
 
class  SolutionInvalidityRegistry
 The place where all sections with solution invalid warnings will be stored. More...
 

Functions

std::string incompatVarMsg (MooseVariableFieldBase &var1, MooseVariableFieldBase &var2)
 Builds and returns a string of the form: More...
 
std::string mooseMsgFmt (const std::string &msg, const std::string &title, const std::string &color)
 Format a message for output with a title. More...
 
std::string mooseMsgFmt (const std::string &msg, const std::string &color)
 Format a message for output without a title. More...
 
void mooseErrorRaw (std::string msg, const std::string &prefix="", const hit::Node *node=nullptr)
 Main callback for emitting a moose error. More...
 
std::string formatMooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, const std::string &msg)
 Formats a documented error. More...
 
template<typename T1 , typename T2 >
void rawValueEqualityHelper (T1 &out, const T2 &in)
 
template<typename T1 , typename T2 >
void rawValueEqualityHelper (std::vector< T1 > &out, const std::vector< T2 > &in)
 
template<typename T1 , typename T2 , std::size_t N>
void rawValueEqualityHelper (std::array< T1, N > &out, const std::array< T2, N > &in)
 
PerfGraphRegistrygetPerfGraphRegistry ()
 Get the global PerfGraphRegistry singleton. More...
 
SolutionInvalidityRegistrygetSolutionInvalidityRegistry ()
 Get the global SolutionInvalidityRegistry singleton. More...
 
std::ostream & operator<< (std::ostream &os, const SolutionInvalidityName &name)
 
bool boundaryRestricted (const std::set< BoundaryID > &boundary_ids)
 
void mooseStreamAll (std::ostringstream &ss)
 All of the following are not meant to be called directly - they are called by the normal macros (mooseError(), etc.) down below. More...
 
template<typename T , typename... Args>
void mooseStreamAll (std::ostringstream &ss, T &&val, Args &&... args)
 
template<typename S , typename... Args>
void mooseWarningStream (S &oss, Args &&... args)
 
template<typename S , typename... Args>
void mooseUnusedStream (S &oss, Args &&... args)
 
template<typename S , typename... Args>
void mooseInfoStreamRepeated (S &oss, Args &&... args)
 
template<typename S , typename... Args>
void mooseInfoStream (S &oss, Args &&... args)
 
template<typename S , typename... Args>
void mooseDeprecatedStream (S &oss, const bool expired, const bool print_title, Args &&... args)
 

Variables

libMesh::Threads::spin_mutex moose_stream_lock
 

Function Documentation

◆ boundaryRestricted()

bool moose::internal::boundaryRestricted ( const std::set< BoundaryID > &  boundary_ids)

Definition at line 46 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getMaterialDataType().

47 {
48  return !boundary_ids.empty() && BoundaryRestrictable::restricted(boundary_ids);
49 }
static bool restricted(const std::set< BoundaryID > &ids)
Helper for determining if the object is boundary restricted.

◆ formatMooseDocumentedError()

std::string moose::internal::formatMooseDocumentedError ( const std::string &  repo_name,
const unsigned int  issue_num,
const std::string &  msg 
)

Formats a documented error.

A documented error is an error that has an issue associated with it.

The repository name repo_name links a named repository to a URL and should be registered at the application level with registerRepository(). See Moose.C for an example of the "moose" repository registration.

Parameters
repo_nameThe repository name where the issue resides
issue_numThe number of the issue
msgThe specific error message

Definition at line 105 of file MooseError.C.

Referenced by MooseBase::mooseDocumentedError(), and mooseDocumentedError().

108 {
109  const auto & repo_url = Registry::getRepositoryURL(repo_name);
110  std::stringstream oss;
111  oss << msg << "\n\nThis error is documented at " << repo_url << "/issues/" << issue_num << ".";
112  return oss.str();
113 }
static const std::string & getRepositoryURL(const std::string &repo_name)
Returns the repository URL associated with repo_name.
Definition: Registry.C:173

◆ getPerfGraphRegistry()

PerfGraphRegistry & moose::internal::getPerfGraphRegistry ( )

Get the global PerfGraphRegistry singleton.

So it can be constructed.

Definition at line 20 of file PerfGraphRegistry.C.

Referenced by dataLoad(), dataStore(), PerfGraphInterface::registerTimedSection(), and to_json().

21 {
22  // In C++11 this is even thread safe! (Lookup "Static Initializers")
23  static PerfGraphRegistry perf_graph_registry_singleton;
24 
25  return perf_graph_registry_singleton;
26 }

◆ getSolutionInvalidityRegistry()

SolutionInvalidityRegistry & moose::internal::getSolutionInvalidityRegistry ( )

Get the global SolutionInvalidityRegistry singleton.

So it can be constructed.

Definition at line 18 of file SolutionInvalidityRegistry.C.

Referenced by dataLoad(), SolutionInvalidInterface::flagInvalidSolutionInternal(), SolutionInvalidInterface::registerInvalidSolutionInternal(), SolutionInvalidity::syncIteration(), and to_json().

19 {
20  // In C++11 this is even thread safe! (Lookup "Static Initializers")
21  static SolutionInvalidityRegistry solution_invalid_registry_singleton;
22 
23  return solution_invalid_registry_singleton;
24 }

◆ incompatVarMsg()

std::string moose::internal::incompatVarMsg ( MooseVariableFieldBase var1,
MooseVariableFieldBase var2 
)

Builds and returns a string of the form:

[var1-elemtype],ORDER[var1-order] != [var2-elemtype],ORDER[var2-order]

This is a convenience function to be used when error messages (especially with paramError) need to report that variable types are incompatible (e.g. with residual save-in).

Definition at line 26 of file MooseError.C.

Referenced by ADDGKernel::ADDGKernel(), ADIntegratedBCTempl< T >::ADIntegratedBCTempl(), ADKernelTempl< T >::ADKernelTempl(), ArrayDGKernel::ArrayDGKernel(), ArrayIntegratedBC::ArrayIntegratedBC(), ArrayKernel::ArrayKernel(), DGKernel::DGKernel(), IntegratedBC::IntegratedBC(), Kernel::Kernel(), NodalBC::NodalBC(), NodalKernel::NodalKernel(), and MultiAppDofCopyTransfer::transfer().

27 {
28  std::stringstream ss;
29  ss << libMesh::Utility::enum_to_string<FEFamily>(var1.feType().family) << ",ORDER"
30  << var1.feType().order
31  << " != " << libMesh::Utility::enum_to_string<FEFamily>(var2.feType().family) << ",ORDER"
32  << var2.feType().order;
33  return ss.str();
34 }
const libMesh::FEType & feType() const
Get the type of finite element object.
OrderWrapper order

◆ mooseDeprecatedStream()

template<typename S , typename... Args>
void moose::internal::mooseDeprecatedStream ( S &  oss,
const bool  expired,
const bool  print_title,
Args &&...  args 
)

Definition at line 275 of file MooseError.h.

Referenced by Moose::Builder::build(), MooseBase::mooseDeprecated(), mooseDeprecated(), and mooseDeprecationExpired().

276 {
278  mooseError("\n\nDeprecated code:\n", std::forward<Args>(args)...);
279 
280  std::ostringstream ss;
281  mooseStreamAll(ss, args...);
282 
283  const auto color = expired ? COLOR_RED : COLOR_YELLOW;
284  std::string msg = print_title ? mooseMsgFmt(ss.str(), "*** Deprecation Warning ***", color)
285  : mooseMsgFmt(ss.str(), color);
286  oss << msg;
287  ss.str("");
288  if (Moose::show_trace)
289  {
290  if (libMesh::global_n_processors() == 1)
292  else
294  {
296  oss << ss.str() << std::endl;
297  };
298  };
299 }
bool show_trace
Set to true (the default) to print the stack trace with error and warning messages - false to omit it...
Definition: Moose.C:783
processor_id_type global_n_processors()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
void write_traceout()
bool _deprecated_is_error
Variable to toggle only deprecated warnings as errors.
Definition: Moose.C:779
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:212
void print_trace(std::ostream &out_stream=std::cerr)
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:45
libMesh::Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:166

◆ mooseErrorRaw()

void moose::internal::mooseErrorRaw ( std::string  msg,
const std::string &  prefix = "",
const hit::Node *  node = nullptr 
)

Main callback for emitting a moose error.

Parameters
msgThe error message
prefixOptional prefix to add to every line of the error (for multiapp prefixes)
nodeOptional HIT node to associate with the error, adding file path context

Definition at line 53 of file MooseError.C.

Referenced by MooseBase::callMooseError(), mooseDocumentedError(), and mooseError().

56 {
58  throw MooseRuntimeError(msg, node);
59 
60  // If we have a node available, add in the hit context (file location)
61  if (node)
62  msg = Moose::hitMessagePrefix(*node) + msg;
63 
64  msg = mooseMsgFmt(msg, "*** ERROR ***", COLOR_RED);
65 
66  std::ostringstream oss;
67  oss << msg << "\n";
68 
69  // this independent flush of the partial error message (i.e. without the
70  // trace) is here because trace retrieval can be slow in some
71  // circumstances, and we want to get the error message out ASAP.
72  msg = oss.str();
73  if (!prefix.empty())
74  MooseUtils::indentMessage(prefix, msg);
75  {
76  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
77  Moose::err << msg << std::flush;
78  }
79 
80  oss.str("");
82  print_trace(oss);
83 
84  msg = oss.str();
85  if (!prefix.empty())
86  MooseUtils::indentMessage(prefix, msg);
87 
88  {
89  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
90  Moose::err << msg << std::flush;
91 
94  }
95 
96  MOOSE_ABORT;
97 }
bool show_trace
Set to true (the default) to print the stack trace with error and warning messages - false to omit it...
Definition: Moose.C:783
processor_id_type global_n_processors()
void write_traceout()
void indentMessage(const std::string &prefix, std::string &message, const char *color=COLOR_CYAN, bool dont_indent_first_line=true, const std::string &post_prefix=": ")
Indents the supplied message given the prefix and color.
Definition: MooseUtils.C:734
void print_trace(std::ostream &out_stream=std::cerr)
std::string hitMessagePrefix(const hit::Node &node)
Get the prefix to be associated with a hit node for a message.
Definition: Moose.C:767
Exception to be thrown whenever we have _throw_on_error set and a mooseError() is emitted...
Definition: MooseError.h:143
libMesh::Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:166
bool _throw_on_error
Variable to turn on exceptions during mooseError(), should only be used within MOOSE unit tests or wh...
Definition: Moose.C:780
std::string mooseMsgFmt(const std::string &msg, const std::string &title, const std::string &color)
Format a message for output with a title.
Definition: MooseError.C:37

◆ mooseInfoStream()

template<typename S , typename... Args>
void moose::internal::mooseInfoStream ( S &  oss,
Args &&...  args 
)

Definition at line 268 of file MooseError.h.

Referenced by MooseBase::mooseInfo(), and mooseInfo().

269 {
270  mooseDoOnce(mooseInfoStreamRepeated(oss, args...););
271 }
void mooseInfoStreamRepeated(S &oss, Args &&... args)
Definition: MooseError.h:255

◆ mooseInfoStreamRepeated()

template<typename S , typename... Args>
void moose::internal::mooseInfoStreamRepeated ( S &  oss,
Args &&...  args 
)

Definition at line 255 of file MooseError.h.

Referenced by mooseInfoRepeated(), and mooseInfoStream().

256 {
257  std::ostringstream ss;
258  mooseStreamAll(ss, args...);
259  std::string msg = mooseMsgFmt(ss.str(), "*** Info ***", COLOR_CYAN);
260  {
262  oss << msg << std::flush;
263  }
264 }
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:212
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:45
libMesh::Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:166

◆ mooseMsgFmt() [1/2]

std::string moose::internal::mooseMsgFmt ( const std::string &  msg,
const std::string &  title,
const std::string &  color 
)

Format a message for output with a title.

Parameters
msgThe message to print
titleThe title that will go on a line before the message
colorThe color to print the message in
Returns
The formatted message

Definition at line 37 of file MooseError.C.

Referenced by mooseDeprecatedStream(), mooseErrorRaw(), mooseInfoStreamRepeated(), mooseUnusedStream(), and mooseWarningStream().

38 {
39  std::ostringstream oss;
40  oss << "\n" << color << "\n" << title << "\n" << msg << COLOR_DEFAULT << "\n";
41  return oss.str();
42 }

◆ mooseMsgFmt() [2/2]

std::string moose::internal::mooseMsgFmt ( const std::string &  msg,
const std::string &  color 
)

Format a message for output without a title.

Parameters
msgThe message to print
colorThe color to print the message in
Returns
The formatted message

Definition at line 45 of file MooseError.C.

46 {
47  std::ostringstream oss;
48  oss << "\n" << color << "\n" << msg << COLOR_DEFAULT << "\n";
49  return oss.str();
50 }

◆ mooseStreamAll() [1/2]

void moose::internal::mooseStreamAll ( std::ostringstream &  ss)

All of the following are not meant to be called directly - they are called by the normal macros (mooseError(), etc.) down below.

Definition at line 100 of file MooseError.C.

Referenced by mooseDeprecatedStream(), mooseDocumentedError(), mooseError(), InputParameters::mooseError(), mooseInfoStreamRepeated(), mooseStreamAll(), mooseUnusedStream(), mooseWarningStream(), InputParameters::paramError(), and InputParameters::paramMessage().

101 {
102 }

◆ mooseStreamAll() [2/2]

template<typename T , typename... Args>
void moose::internal::mooseStreamAll ( std::ostringstream &  ss,
T &&  val,
Args &&...  args 
)

Definition at line 212 of file MooseError.h.

213 {
214  ss << val;
215  mooseStreamAll(ss, std::forward<Args>(args)...);
216 }
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:212

◆ mooseUnusedStream()

template<typename S , typename... Args>
void moose::internal::mooseUnusedStream ( S &  oss,
Args &&...  args 
)

Definition at line 239 of file MooseError.h.

Referenced by mooseUnused().

240 {
241  std::ostringstream ss;
242  mooseStreamAll(ss, args...);
243  std::string msg = mooseMsgFmt(ss.str(), "*** Warning ***", COLOR_YELLOW);
245  throw std::runtime_error(msg);
246 
247  {
249  oss << msg << std::flush;
250  }
251 }
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:212
bool _throw_on_warning
Variable to turn on exceptions during mooseWarning(), should only be used in MOOSE unit tests...
Definition: Moose.C:781
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:45
libMesh::Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:166

◆ mooseWarningStream()

template<typename S , typename... Args>
void moose::internal::mooseWarningStream ( S &  oss,
Args &&...  args 
)

Definition at line 220 of file MooseError.h.

Referenced by MooseBase::mooseWarning(), mooseWarning(), and MooseBase::mooseWarningNonPrefixed().

221 {
223  mooseError(std::forward<Args>(args)...);
224 
225  std::ostringstream ss;
226  mooseStreamAll(ss, args...);
227  std::string msg = mooseMsgFmt(ss.str(), "*** Warning ***", COLOR_YELLOW);
229  throw std::runtime_error(msg);
230 
231  {
233  oss << msg << std::flush;
234  }
235 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:333
bool _warnings_are_errors
Variable to toggle any warning into an error (includes deprecated code warnings)
Definition: Moose.C:778
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:212
bool _throw_on_warning
Variable to turn on exceptions during mooseWarning(), should only be used in MOOSE unit tests...
Definition: Moose.C:781
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:45
libMesh::Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:166

◆ operator<<()

std::ostream & moose::internal::operator<< ( std::ostream &  os,
const SolutionInvalidityName name 
)

Definition at line 46 of file SolutionInvalidityRegistry.C.

47 {
48  os << name.object_type << ": " << name.message;
49  return os;
50 }
std::string name(const ElemQuality q)
std::basic_ostream< charT, traits > * os
Definition: InfixIterator.h:33

◆ rawValueEqualityHelper() [1/3]

template<typename T1 , typename T2 >
void moose::internal::rawValueEqualityHelper ( T1 &  out,
const T2 &  in 
)

Definition at line 216 of file MaterialProperty.h.

Referenced by MaterialPropertyBase< T, false >::qpCopy(), rawValueEqualityHelper(), and MaterialPropertyBase< T, false >::swap().

217 {
219 }
auto raw_value(const Eigen::Map< T > &in)
Definition: EigenADReal.h:73
OStreamProxy out

◆ rawValueEqualityHelper() [2/3]

template<typename T1 , typename T2 >
void moose::internal::rawValueEqualityHelper ( std::vector< T1 > &  out,
const std::vector< T2 > &  in 
)

Definition at line 223 of file MaterialProperty.h.

224 {
225  out.resize(in.size());
226  for (MooseIndex(in) i = 0; i < in.size(); ++i)
227  rawValueEqualityHelper(out[i], in[i]);
228 }
void rawValueEqualityHelper(std::array< T1, N > &out, const std::array< T2, N > &in)
OStreamProxy out

◆ rawValueEqualityHelper() [3/3]

template<typename T1 , typename T2 , std::size_t N>
void moose::internal::rawValueEqualityHelper ( std::array< T1, N > &  out,
const std::array< T2, N > &  in 
)

Definition at line 232 of file MaterialProperty.h.

233 {
234  for (MooseIndex(in) i = 0; i < in.size(); ++i)
235  rawValueEqualityHelper(out[i], in[i]);
236 }
void rawValueEqualityHelper(std::array< T1, N > &out, const std::array< T2, N > &in)

Variable Documentation

◆ moose_stream_lock

libMesh::Threads::spin_mutex moose::internal::moose_stream_lock
inline