Advanced Multi-Physics (AMP)
On-Line Documentation
Macros
Set of utility macro functions used in AMP

Macros

#define AMP_ASSERT(EXP)
 Assert error.
 
#define AMP_DEBUG_ASSERT(EXP)
 Assert error (debug only)
 
#define AMP_DEBUG_INSIST(EXP, MSG)
 Insist error.
 
#define AMP_ERROR(MSG)   StackTrace::Utilities::abort( MSG, SOURCE_LOCATION_CURRENT() )
 Throw error.
 
#define AMP_INSIST(EXP, MSG)
 Insist error.
 
#define AMP_WARN_ONCE(MSG)
 Print a warning.
 
#define AMP_WARNING(MSG)
 Print a warning.
 
#define DISABLE_WARNINGS
 Re-enable warnings.
 
#define ENABLE_WARNINGS
 Suppress all warnings.
 
#define STATIC_ERROR(MSG)   static_assert( failed_assert_v<TYPE>, MSG )
 Fail assert.
 

Detailed Description

These functions are a list of C++ macros that are used within AMP for common operations, including checking for errors and profiling.

Macro Definition Documentation

◆ AMP_ASSERT

#define AMP_ASSERT (   EXP)
Value:
do { \
if ( !( EXP ) ) { \
StackTrace::Utilities::abort( "Failed assertion: " #EXP, SOURCE_LOCATION_CURRENT() ); \
} \
} while ( 0 )

Assert error.

Throw an error exception from within any C++ source code if the given expression is not true. This is a parallel-friendly version of assert. The file and line number of the abort are printed along with the stack trace (if available).

Parameters
EXPExpression to evaluate

Definition at line 114 of file UtilityMacros.h.

◆ AMP_DEBUG_ASSERT

#define AMP_DEBUG_ASSERT (   EXP)
Value:
do { \
} while ( 0 )

Assert error (debug only)

Throw an error exception from within any C++ source code if the given expression is not true. This only runs if compiled with debug is enabled. If enabled, this is the same as a call to AMP_ASSERT.

Parameters
EXPExpression to evaluate

Definition at line 165 of file UtilityMacros.h.

◆ AMP_DEBUG_INSIST

#define AMP_DEBUG_INSIST (   EXP,
  MSG 
)
Value:
do { \
} while ( 0 )

Insist error.

Throw an error exception from within any C++ source code if the given expression is not true. This will also print the given message. This is a parallel-friendly version of assert. The file and line number of the abort are printed along with the stack trace (if available). This only runs if compiled with debug is enabled. If enabled, this is the same as a call to AMP_INSIST.

Parameters
EXPExpression to evaluate
MSGDebug message to print

Definition at line 168 of file UtilityMacros.h.

◆ AMP_ERROR

#define AMP_ERROR (   MSG)    StackTrace::Utilities::abort( MSG, SOURCE_LOCATION_CURRENT() )

Throw error.

Throw an error exception from within any C++ source code. The macro argument may be any standard ostream expression. The file and line number of the abort are also printed.

Parameters
MSGError message to print

Definition at line 72 of file UtilityMacros.h.

◆ AMP_INSIST

#define AMP_INSIST (   EXP,
  MSG 
)
Value:
do { \
if ( !( EXP ) ) { \
StackTrace::Utilities::abort( "Failed insist: " #EXP "\nMessage: " + \
std::string( MSG ), \
SOURCE_LOCATION_CURRENT() ); \
} \
} while ( 0 )

Insist error.

Throw an error exception from within any C++ source code if the given expression is not true. This will also print the given message. This is a parallel-friendly version of assert. The file and line number of the abort are printed along with the stack trace (if available).

Parameters
EXPExpression to evaluate
MSGDebug message to print

Definition at line 131 of file UtilityMacros.h.

◆ AMP_WARN_ONCE

#define AMP_WARN_ONCE (   MSG)
Value:
do { \
static bool printed = false; \
if ( !printed ) { \
AMP_WARNING( MSG ); \
printed = true; \
} \
} while ( 0 )

Print a warning.

Print a warning without exit. Print file and line number of the warning. The message will only be printed once per execution

Parameters
MSGWarning message to print

Definition at line 96 of file UtilityMacros.h.

◆ AMP_WARNING

#define AMP_WARNING (   MSG)
Value:
do { \
AMP::pout << "WARNING: " << MSG << std::endl; \
AMP::plog << "WARNING: " << MSG << std::endl; \
AMP::pout << " Warning called in " << __FILE__ << " on line " << __LINE__ << std::endl; \
AMP::plog << " Warning called in " << __FILE__ << " on line " << __LINE__ << std::endl; \
AMP::plog << std::flush; \
} while ( 0 )
std::ostream plog
std::ostream pout

Print a warning.

Print a warning without exit. Print file and line number of the warning.

Parameters
MSGWarning message to print

Definition at line 80 of file UtilityMacros.h.

◆ DISABLE_WARNINGS

#define DISABLE_WARNINGS

Re-enable warnings.

This will re-enable warnings after a call to DIASABLE_WARNINGS

Definition at line 247 of file UtilityMacros.h.

◆ ENABLE_WARNINGS

#define ENABLE_WARNINGS

Suppress all warnings.

This will start to supress all compile warnings. Be sure to follow with ENABLE_WARNINGS

Definition at line 248 of file UtilityMacros.h.

◆ STATIC_ERROR

#define STATIC_ERROR (   MSG)    static_assert( failed_assert_v<TYPE>, MSG )

Fail assert.

Fail assert at compile time

Parameters
MSGError message to print

Definition at line 62 of file UtilityMacros.h.



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page