www.mooseframework.org
Classes | Functions | Variables
moose::internal Namespace Reference

Classes

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="")
 
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)
 
SolutionInvalidityRegistrygetSolutionInvalidityRegistry ()
 Get the global SolutionInvalidityRegistry singleton. More...
 
std::ostream & operator<< (std::ostream &os, const SolutionInvalidityName &name)
 
PerfGraphRegistrygetPerfGraphRegistry ()
 Get the global PerfGraphRegistry singleton. More...
 
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

Threads::spin_mutex moose_stream_lock
 

Function Documentation

◆ boundaryRestricted()

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

Definition at line 42 of file MaterialPropertyInterface.C.

Referenced by MaterialPropertyInterface::getMaterialDataType().

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

◆ 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::registerInvalidSolutionInternal(), SolutionInvalidity::sync(), 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 23 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().

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

◆ mooseDeprecatedStream()

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

Definition at line 236 of file MooseError.h.

Referenced by InputParameters::attemptPrintDeprecated(), MooseBaseErrorInterface::mooseDeprecated(), mooseDeprecated(), and mooseDeprecationExpired().

237 {
239  mooseError("\n\nDeprecated code:\n", std::forward<Args>(args)...);
240 
241  std::ostringstream ss;
242  mooseStreamAll(ss, args...);
243 
244  const auto color = expired ? COLOR_RED : COLOR_YELLOW;
245  std::string msg =
246  print_title
247  ? mooseMsgFmt(
248  ss.str(),
249  "*** Warning, This code is deprecated and will be removed in future versions:",
250  color)
251  : mooseMsgFmt(ss.str(), color);
252  oss << msg;
253  ss.str("");
254  if (Moose::show_trace)
255  {
256  if (libMesh::global_n_processors() == 1)
257  print_trace(ss);
258  else
260  {
261  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
262  oss << ss.str() << std::endl;
263  };
264  };
265 }
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:642
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:284
void write_traceout()
bool _deprecated_is_error
Variable to toggle only deprecated warnings as errors.
Definition: Moose.C:638
Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:134
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:173
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:42

◆ mooseErrorRaw()

void moose::internal::mooseErrorRaw ( std::string  msg,
const std::string  prefix = "" 
)

Definition at line 50 of file MooseError.C.

Referenced by callMooseErrorRaw(), and mooseError().

51 {
53  throw std::runtime_error(msg);
54 
55  msg = mooseMsgFmt(msg, "*** ERROR ***", COLOR_RED);
56 
57  std::ostringstream oss;
58  oss << msg << "\n";
59 
60  // this independent flush of the partial error message (i.e. without the
61  // trace) is here because trace retrieval can be slow in some
62  // circumstances, and we want to get the error message out ASAP.
63  msg = oss.str();
64  if (!prefix.empty())
65  MooseUtils::indentMessage(prefix, msg);
66  {
67  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
68  Moose::err << msg << std::flush;
69  }
70 
71  oss.str("");
73  print_trace(oss);
74 
75  msg = oss.str();
76  if (!prefix.empty())
77  MooseUtils::indentMessage(prefix, msg);
78 
79  {
80  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
81  Moose::err << msg << std::flush;
82 
85  }
86 
87  MOOSE_ABORT;
88 }
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:642
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:721
Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:134
void print_trace(std::ostream &out_stream=std::cerr)
bool _throw_on_error
Variable to turn on exceptions during mooseError(), should only be used within MOOSE unit tests or wh...
Definition: Moose.C:639
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:34

◆ mooseInfoStream()

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

Definition at line 229 of file MooseError.h.

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

230 {
231  mooseDoOnce(mooseInfoStreamRepeated(oss, args...););
232 }
void mooseInfoStreamRepeated(S &oss, Args &&... args)
Definition: MooseError.h:216

◆ mooseInfoStreamRepeated()

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

Definition at line 216 of file MooseError.h.

Referenced by mooseInfoRepeated(), and mooseInfoStream().

217 {
218  std::ostringstream ss;
219  mooseStreamAll(ss, args...);
220  std::string msg = mooseMsgFmt(ss.str(), "*** Info ***", COLOR_CYAN);
221  {
222  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
223  oss << msg << std::flush;
224  }
225 }
Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:134
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:173
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:42

◆ 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 34 of file MooseError.C.

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

35 {
36  std::ostringstream oss;
37  oss << "\n" << color << "\n" << title << "\n" << msg << COLOR_DEFAULT << "\n";
38  return oss.str();
39 }

◆ 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 42 of file MooseError.C.

43 {
44  std::ostringstream oss;
45  oss << "\n" << color << "\n" << msg << COLOR_DEFAULT << "\n";
46  return oss.str();
47 }

◆ 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 91 of file MooseError.C.

Referenced by mooseDeprecatedStream(), MooseBaseErrorInterface::mooseError(), mooseError(), MooseBaseErrorInterface::mooseErrorNonPrefixed(), mooseInfoStreamRepeated(), mooseStreamAll(), mooseUnusedStream(), mooseWarningStream(), and MooseBaseParameterInterface::paramErrorMsg().

92 {
93 }

◆ mooseStreamAll() [2/2]

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

Definition at line 173 of file MooseError.h.

174 {
175  ss << val;
176  mooseStreamAll(ss, std::forward<Args>(args)...);
177 }
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:173

◆ mooseUnusedStream()

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

Definition at line 200 of file MooseError.h.

Referenced by mooseUnused().

201 {
202  std::ostringstream ss;
203  mooseStreamAll(ss, args...);
204  std::string msg = mooseMsgFmt(ss.str(), "*** Warning ***", COLOR_YELLOW);
206  throw std::runtime_error(msg);
207 
208  {
209  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
210  oss << msg << std::flush;
211  }
212 }
Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:134
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:173
bool _throw_on_warning
Variable to turn on exceptions during mooseWarning(), should only be used in MOOSE unit tests...
Definition: Moose.C:640
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:42

◆ mooseWarningStream()

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

Definition at line 181 of file MooseError.h.

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

182 {
184  mooseError(std::forward<Args>(args)...);
185 
186  std::ostringstream ss;
187  mooseStreamAll(ss, args...);
188  std::string msg = mooseMsgFmt(ss.str(), "*** Warning ***", COLOR_YELLOW);
190  throw std::runtime_error(msg);
191 
192  {
193  Threads::spin_mutex::scoped_lock lock(moose_stream_lock);
194  oss << msg << std::flush;
195  }
196 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
bool _warnings_are_errors
Variable to toggle any warning into an error (includes deprecated code warnings)
Definition: Moose.C:637
Threads::spin_mutex moose_stream_lock
Definition: MooseError.h:134
void mooseStreamAll(std::ostringstream &ss, T &&val, Args &&... args)
Definition: MooseError.h:173
bool _throw_on_warning
Variable to turn on exceptions during mooseWarning(), should only be used in MOOSE unit tests...
Definition: Moose.C:640
std::string mooseMsgFmt(const std::string &msg, const std::string &color)
Format a message for output without a title.
Definition: MooseError.C:42

◆ operator<<()

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

Definition at line 43 of file SolutionInvalidityRegistry.C.

44 {
45  os << name.object_type << ": " << name.message;
46  return os;
47 }
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 217 of file MaterialProperty.h.

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

218 {
220 }
auto raw_value(const Eigen::Map< T > &in)
Definition: ADReal.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 224 of file MaterialProperty.h.

225 {
226  out.resize(in.size());
227  for (MooseIndex(in) i = 0; i < in.size(); ++i)
228  rawValueEqualityHelper(out[i], in[i]);
229 }
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 233 of file MaterialProperty.h.

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

Variable Documentation

◆ moose_stream_lock

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