deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\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
Enumerations | Functions | Variables
deal_II_exceptions::internals Namespace Reference

Enumerations

enum class  ExceptionHandling { abort_or_throw_on_exception , throw_on_exception }
 

Functions

void abort (const ExceptionBase &exc) noexcept
 
template<typename ExceptionType >
void issue_error_noreturn (ExceptionHandling handling, const char *file, int line, const char *function, const char *cond, const char *exc_name, ExceptionType e)
 
void do_unreachable (const char *file, int line, const char *function, const char *msg)
 
void do_not_implemented (const char *file, int line, const char *function)
 
void do_issue_error_nothrow (const ExceptionBase &e) noexcept
 
template<typename ExceptionType >
void issue_error_nothrow (const char *file, int line, const char *function, const char *cond, const char *exc_name, ExceptionType e) noexcept
 
template<typename T , typename U >
constexpr bool compare_for_equality (const T t, const U u)
 
template<typename T , typename U >
constexpr bool compare_less_than (const T t, const U u)
 
std::string & get_additional_assert_output ()
 

Variables

bool allow_abort_on_exception = true
 
bool show_stacktrace = true
 

Detailed Description

The functions in this namespace are in connection with the Assert and AssertThrow mechanism but are solely for internal purposes and are not for use outside the exception handling and throwing mechanism.

Enumeration Type Documentation

◆ ExceptionHandling

An enum describing how to treat an exception in issue_error_noreturn.

Enumerator
abort_or_throw_on_exception 

Abort the program by calling std::abort unless deal_II_exceptions::disable_abort_on_exception has been called: in that case the program will throw an exception.

throw_on_exception 

Throw the exception normally.

Definition at line 1051 of file exceptions.h.

Function Documentation

◆ abort()

void deal_II_exceptions::internals::abort ( const ExceptionBase &  exc)
noexcept

Abort the program by printing the error message provided by exc and calling std::abort().

Definition at line 482 of file exceptions.cc.

◆ issue_error_noreturn()

template<typename ExceptionType >
void deal_II_exceptions::internals::issue_error_noreturn ( ExceptionHandling  handling,
const char *  file,
int  line,
const char *  function,
const char *  cond,
const char *  exc_name,
ExceptionType  e 
)

This routine does the main work for the exception generation mechanism used in the Assert and AssertThrow macros: as the name implies, this function either ends by throwing an exception (if handling is ExceptionHandling::throw_on_exception, or handling is try_abort_exception and deal_II_exceptions::disable_abort_on_exception is false) or with a call to abort (if handling is try_abort_exception and deal_II_exceptions::disable_abort_on_exception is true).

The actual exception object (the last argument) is typically an unnamed object created in place; because we modify it, we can't take it by const reference, and temporaries don't bind to non-const references. So take it by value (=copy it) with a templated type to avoid slicing – the performance implications are pretty minimal anyway.

ExceptionBase

Definition at line 1084 of file exceptions.h.

◆ do_unreachable()

void deal_II_exceptions::internals::do_unreachable ( const char *  file,
int  line,
const char *  function,
const char *  msg 
)
inline

Internal function that performs the error handling when DEAL_II_ASSERT_UNREACHABLE is triggered.

Definition at line 1125 of file exceptions.h.

◆ do_not_implemented()

void deal_II_exceptions::internals::do_not_implemented ( const char *  file,
int  line,
const char *  function 
)
inline

Internal function that performs the error handling when DEAL_II_NOT_IMPLEMENTED is triggered.

Definition at line 1172 of file exceptions.h.

◆ do_issue_error_nothrow()

void deal_II_exceptions::internals::do_issue_error_nothrow ( const ExceptionBase &  e)
noexcept

Internal function that does the work of issue_error_nothrow.

Definition at line 533 of file exceptions.cc.

◆ issue_error_nothrow()

template<typename ExceptionType >
void deal_II_exceptions::internals::issue_error_nothrow ( const char *  file,
int  line,
const char *  function,
const char *  cond,
const char *  exc_name,
ExceptionType  e 
)
noexcept

Exception generation mechanism in case we must not throw.

ExceptionBase

Note
This function is defined with a template for the same reasons as issue_error_noreturn().

Definition at line 1228 of file exceptions.h.

◆ compare_for_equality()

template<typename T , typename U >
constexpr bool deal_II_exceptions::internals::compare_for_equality ( const T  t,
const U  u 
)
inlineconstexpr

A function that compares two values for equality, after converting to a common type to avoid compiler warnings when comparing objects of different types (e.g., unsigned and signed variables).

This function takes its arguments by value, rather than reference, because this ensures that we can also compare variables that may not live in a memory space accessible at the place where the comparison occurs – say, comparing static constexpr member variables (which are variables that live in global memory) on a device that has a separate memory space. The copy this implies is generally not problematic because we apply this function to scalar values with integer types.

Definition at line 1269 of file exceptions.h.

◆ compare_less_than()

template<typename T , typename U >
constexpr bool deal_II_exceptions::internals::compare_less_than ( const T  t,
const U  u 
)
inlineconstexpr

A function that compares two values with operator<, after converting to a common type to avoid compiler warnings when comparing objects of different types (e.g., unsigned and signed variables).

This function takes its arguments by value, rather than reference, because this ensures that we can also compare variables that may not live in a memory space accessible at the place where the comparison occurs – say, comparing static constexpr member variables (which are variables that live in global memory) on a device that has a separate memory space. The copy this implies is generally not problematic because we apply this function to scalar values with integer types.

Definition at line 1292 of file exceptions.h.

◆ get_additional_assert_output()

std::string & deal_II_exceptions::internals::get_additional_assert_output ( )

Definition at line 52 of file exceptions.cc.

Variable Documentation

◆ allow_abort_on_exception

bool deal_II_exceptions::internals::allow_abort_on_exception = true

Setting this variable to false will disable deal.II's exception mechanism to abort the problem. The Assert() macro will throw the exception instead and the AssertNothrow() macro will just print the error message. This variable should not be changed directly. Use disable_abort_on_exception() instead.

Definition at line 60 of file exceptions.cc.

◆ show_stacktrace

bool deal_II_exceptions::internals::show_stacktrace = true

Definition at line 58 of file exceptions.cc.