.. _program_listing_file_src_pcms_utility_check.hpp: Program Listing for File check.hpp ================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/pcms/utility/check.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef PCMS_UTILITY_CHECK_HPP #define PCMS_UTILITY_CHECK_HPP // Debug checks usable in device code, with the semantics of Omega_h's // OMEGA_H_CHECK / OMEGA_H_CHECK_PRINTF in a Kokkos build: with NDEBUG the // condition is evaluated and ignored; otherwise a failed check prints the // message (PCMS_CHECK_PRINTF) and asserts. #include #include #ifdef NDEBUG #define PCMS_CHECK(cond) static_cast(cond) #define PCMS_CHECK_PRINTF(cond, format, ...) static_cast(cond) #else #define PCMS_CHECK(cond) assert(cond) #define PCMS_CHECK_PRINTF(cond, format, ...) \ do { \ if (!(cond)) { \ Kokkos::printf("ERROR: " format "\n", __VA_ARGS__); \ } \ assert(cond); \ } while (0) #endif #endif // PCMS_UTILITY_CHECK_HPP