Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
deal_II_exceptions Namespace Reference

Namespaces

namespace  internals
 

Functions

void set_additional_assert_output (const char *const p)
 
void suppress_stacktrace_in_exceptions ()
 
void disable_abort_on_exception ()
 
void enable_abort_on_exception ()
 
void set_additional_assert_output (const std::string &p)
 

Detailed Description

In this namespace, functions in connection with the Assert and AssertThrow mechanism are declared.

Function Documentation

◆ set_additional_assert_output() [1/2]

void deal_II_exceptions::set_additional_assert_output ( const char *const p)

Set a string that is printed upon output of the message indicating a triggered Assert statement. This string, which is printed in addition to the usual output may indicate information that is otherwise not readily available unless we are using a debugger. For example, with distributed programs on cluster computers, the output of all processes is redirected to the same console window. In this case, it is convenient to set as additional name the name of the host on which the program runs, so that one can see in which instance of the program the exception occurred.

The string pointed to by the argument is copied, so doesn't need to be stored after the call to this function.

Previously set additional output is replaced by the argument given to this function.

See also
Exceptions

◆ suppress_stacktrace_in_exceptions()

void deal_II_exceptions::suppress_stacktrace_in_exceptions ( )

Calling this function disables printing a stacktrace along with the other output printed when an exception occurs. Most of the time, you will want to see such a stacktrace; suppressing it, however, is useful if one wants to compare the output of a program across different machines and systems, since the stacktrace shows memory addresses and library names/paths that depend on the exact setup of a machine.

See also
Exceptions

Definition at line 72 of file exceptions.cc.

◆ disable_abort_on_exception()

void deal_II_exceptions::disable_abort_on_exception ( )

Calling this function switches off the use of std::abort() when an exception is created using the Assert() macro. Instead, the Exception will be thrown using 'throw', so it can be caught if desired. Generally, you want to abort the execution of a program when Assert() is called, but it needs to be switched off if you want to log all exceptions created, or if you want to test if an assertion is working correctly. This is done for example in regression tests. Please note that some fatal errors will still call abort(), e.g. when an exception is caught during exception handling.

See also
enable_abort_on_exception
Exceptions

Definition at line 80 of file exceptions.cc.

◆ enable_abort_on_exception()

void deal_II_exceptions::enable_abort_on_exception ( )

Calling this function switches on the use of std::abort() when an exception is created using the Assert() macro, instead of throwing it. This restores the standard behavior.

See also
disable_abort_on_exception
Exceptions

Definition at line 88 of file exceptions.cc.

◆ set_additional_assert_output() [2/2]

void deal_II_exceptions::set_additional_assert_output ( const std::string & p)

Definition at line 64 of file exceptions.cc.