FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
assertion.hpp File Reference
#include <kernel/base_header.hpp>
#include <kernel/runtime.hpp>
#include <string>

Go to the source code of this file.

Namespaces

namespace  FEAT
 FEAT namespace.
 

Macros

#define ASSERT(expr)   void(0)
 Debug-Assertion macro definition. More...
 
#define ASSERTM(expr, msg)   void(0)
 Debug-Assertion macro definition with custom message. More...
 
#define XABORTM(msg)   FEAT::abortion(__func__, __FILE__, __LINE__, msg)
 Abortion macro definition with custom message. More...
 
#define XASSERT(expr)   FEAT::assertion(expr, #expr, __func__, __FILE__, __LINE__)
 Assertion macro definition. More...
 
#define XASSERTM(expr, msg)   FEAT::assertion(expr, #expr, __func__, __FILE__, __LINE__, msg)
 Assertion macro definition with custom message. More...
 

Functions

CUDA_HOST_DEVICE void FEAT::abortion (const char *const func, const char *const file, const int line, const char *const msg)
 Abortion function. More...
 
CUDA_HOST void FEAT::abortion (const char *const func, const char *const file, const int line, const std::string &msg)
 
CUDA_HOST_DEVICE void FEAT::assertion (bool expr, const char *const expr_str, const char *const func, const char *const file, const int line, const char *const msg=nullptr)
 Assertion function. More...
 
CUDA_HOST void FEAT::assertion (bool expr, const char *const expr_str, const char *const func, const char *const file, const int line, const std::string &msg)
 

Macro Definition Documentation

◆ ASSERT

#define ASSERT (   expr)    void(0)

Debug-Assertion macro definition.

This macro defines a debug-mode assertion that will abort program execution if the asserted expression evaluates to false.

Parameters
exprBoolean expression that shall be asserted.
Note
This macro will only be compiled in debug mode; it is an empty macro in non-debug mode. Use the XASSERT macro if you want to use the assertion in both debug and non-debug modes.

Definition at line 229 of file assertion.hpp.

◆ ASSERTM

#define ASSERTM (   expr,
  msg 
)    void(0)

Debug-Assertion macro definition with custom message.

This macro defines a debug-mode assertion that will abort program execution if the asserted expression evaluates to false.

Parameters
exprBoolean expression that shall be asserted.
msgAn error message that is to be displayed if the assertion fails.
Note
This macro will only be compiled in debug mode; it is an empty macro in non-debug mode. Use the XASSERTM macro if you want to use the assertion in both debug and non-debug modes.

Definition at line 230 of file assertion.hpp.

◆ XABORTM

#define XABORTM (   msg)    FEAT::abortion(__func__, __FILE__, __LINE__, msg)

Abortion macro definition with custom message.

This macro prints an errors message and aborts program execution.

Parameters
msgAn error message that is to be displayed.

This macro will be compiled in both debug and non-debug mode builds.

Compiler Hack:
Intel C++ compiler is too dumb for [[noreturn]] attribute, so attach an additional call to std::abort() to silence warning 1011 that complains about missing return statements in non-void functions.

Definition at line 192 of file assertion.hpp.

◆ XASSERT

#define XASSERT (   expr)    FEAT::assertion(expr, #expr, __func__, __FILE__, __LINE__)

Assertion macro definition.

This macro defines an assertion that will abort program execution if the asserted expression evaluates to false.

Parameters
exprBoolean expression that shall be asserted.
Note
This macro will be compiled in both debug and non-debug mode builds. Use the ASSERT macro if you want to use the assertion ony in debug builds.

Definition at line 262 of file assertion.hpp.

◆ XASSERTM

#define XASSERTM (   expr,
  msg 
)    FEAT::assertion(expr, #expr, __func__, __FILE__, __LINE__, msg)

Assertion macro definition with custom message.

This macro defines a n assertion that will abort program execution if the asserted expression evaluates to false.

Parameters
exprBoolean expression that shall be asserted.
msgAn error message that is to be displayed if the assertion fails.

This macro will be compiled in both debug and non-debug mode builds. Use the ASSERTM macro if you want to use the assertion ony in debug builds.

Definition at line 263 of file assertion.hpp.