Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Namespaces | Functions
deal_II_exceptions Namespace Reference

Namespaces

 internals
 

Functions

void set_additional_assert_output (const char *const p)
 
void suppress_stacktrace_in_exceptions ()
 
void disable_abort_on_exception ()
 

Detailed Description

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

Function Documentation

◆ set_additional_assert_output()

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 and assertions

◆ 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 and assertions

Definition at line 65 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
Exceptions and assertions

Definition at line 71 of file exceptions.cc.