Block-Structured AMR Software Framework
AMReX_BLassert.H
Go to the documentation of this file.
1
2
#ifndef AMREX_BLASSERT_H_
3
#define AMREX_BLASSERT_H_
4
#include <AMReX_Config.H>
5
6
#include <
AMReX.H
>
7
8
#ifdef AMREX_ASSERT
9
#undef AMREX_ASSERT
10
#endif
11
12
#ifdef BL_ASSERT
13
#undef BL_ASSERT
14
#endif
15
16
#if !defined(AMREX_DEBUG) && !defined(AMREX_USE_ASSERTION)
17
18
/*
19
The macro AMREX_ASSERT(EX) is a debugging macro, used to test the
20
internal consistency of AMReX, that may also be useful in user
21
code. The argument EX is a C++ expression that you expect to
22
always evaluate to true.
23
24
When code is compiled with the DEBUG macro set to TRUE, the
25
AMREX_ASSERT(EX) macro expands to a boolean test of the expression EX.
26
If that expression evaluates to true, nothing happens, but if the
27
expression evaluates to false, a message is output detailing the
28
file and line number of the AMREX_ASSERT(EX) statement, as well as the
29
literal expression EX itself, and then exits via abort() using
30
amrex::Assert(). The idea is that if the assertion fails, something
31
has gone terribly wrong somewhere.
32
33
If the DEBUG macro is not set to TRUE, the AMREX_ASSERT(EX) call becomes
34
a null statement in the code, which will be eliminated by the code
35
optimizer.
36
*/
37
#define AMREX_ASSERT_WITH_MESSAGE(EX,MSG) ((void)0)
38
#define AMREX_ASSERT(EX) ((void)0)
39
#define BL_ASSERT(EX) ((void)0)
40
41
#else
42
43
#define AMREX_ASSERT_WITH_MESSAGE(EX,MSG) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__ , # MSG)
44
#define AMREX_ASSERT(EX) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__)
45
#define BL_ASSERT(EX) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__)
46
47
#endif
48
49
#define AMREX_ALWAYS_ASSERT_WITH_MESSAGE(EX,MSG) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__ , # MSG)
50
#define AMREX_ALWAYS_ASSERT(EX) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__)
51
52
53
#if !defined(AMREX_USE_GPU) || !defined(AMREX_DEBUG) && !defined(AMREX_USE_ASSERTION)
54
#define AMREX_GPU_ASSERT(EX) ((void)0)
55
#else
56
#define AMREX_GPU_ASSERT(EX) (EX)?((void)0):amrex::Assert( # EX , __FILE__, __LINE__)
57
#endif
58
59
#endif
/*BL_BL_ASSERT_H*/
AMReX.H
Src
Base
AMReX_BLassert.H
Generated by
1.9.1