Reference documentation for deal.II version 9.0.0
Enumerations | Functions
deal_II_exceptions::internals Namespace Reference

Enumerations

enum  ExceptionHandling { abort_on_exception, throw_on_exception, abort_nothrow_on_exception }
 

Functions

void abort (const ExceptionBase &exc)
 
template<class 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_issue_error_nothrow (const ExceptionBase &e) noexcept
 
template<class ExceptionType >
void issue_error_nothrow (ExceptionHandling, const char *file, int line, const char *function, const char *cond, const char *exc_name, ExceptionType e) noexcept
 
std::string get_cusparse_error_string (const cusparseStatus_t error_code)
 
std::string get_cusolver_error_string (const cusolverStatus_t error_code)
 

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.

Enumerator
abort_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.

abort_nothrow_on_exception 

Call std::abort as long as deal_II_exceptions::disable_abort_on_exception has not been called: if it has, then just print a description of the exception to deallog.

Definition at line 1014 of file exceptions.h.

Function Documentation

◆ abort()

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

Conditionally abort the program.

Depending on whether deal_II_exceptions::disable_abort_on_exception was called, this function either aborts the program flow by printing the error message provided by exc and calling std::abort(), or throws exc instead.

Definition at line 460 of file exceptions.cc.

◆ issue_error_noreturn()

template<class 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 with a call to abort or throwing an exception.

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 1050 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 444 of file exceptions.cc.

◆ issue_error_nothrow()

template<class ExceptionType >
void deal_II_exceptions::internals::issue_error_nothrow ( ExceptionHandling  ,
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 1091 of file exceptions.h.

◆ get_cusparse_error_string()

std::string deal_II_exceptions::internals::get_cusparse_error_string ( const cusparseStatus_t  error_code)

Return a string given an error code. This is similar to the cudaGetErrorString function but there is no equivalent function for cuSPARSE.

Definition at line 474 of file exceptions.cc.

◆ get_cusolver_error_string()

std::string deal_II_exceptions::internals::get_cusolver_error_string ( const cusolverStatus_t  error_code)

Return a string given an error code. This is similar to the cudaGetErrorString function but there is no equivalent function for cuSOLVER.

Definition at line 519 of file exceptions.cc.