Loading...
Searching...
No Matches
21#ifndef OPM_ERRORMACROS_HPP
22#define OPM_ERRORMACROS_HPP
24#include <opm/common/OpmLog/OpmLog.hpp>
25#include <opm/common/utility/gpuDecorators.hpp>
32#if OPM_IS_COMPILING_WITH_GPU_COMPILER
39# define OPM_REPORT do { std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " } while (false)
40# define OPM_MESSAGE(x) do { OPM_REPORT; std::cerr << x << "\n"; } while (false)
41# define OPM_MESSAGE_IF(cond, m) do {if(cond) OPM_MESSAGE(m);} while (false)
43# define OPM_REPORT do {} while (false)
44# define OPM_MESSAGE(x) do {} while (false)
45# define OPM_MESSAGE_IF(cond, m) do {} while (false)
48#if OPM_IS_INSIDE_HOST_FUNCTION
58#define OPM_THROW(Exception, message) \
60 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
61 std::to_string(__LINE__) + "] " + \
63 ::Opm::OpmLog::error(oss_); \
64 throw Exception(oss_); \
76#define OPM_THROW_PROBLEM(Exception, message) \
78 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
79 std::to_string(__LINE__) + "] " + \
81 ::Opm::OpmLog::problem(oss_); \
82 throw Exception(oss_); \
88#define OPM_THROW_NOLOG(Exception, message) \
90 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
91 std::to_string(__LINE__) + "] " + \
93 throw Exception(oss_); \
97#define OPM_ERROR_IF(condition, message) do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)
113#define OPM_THROW(Exception, message) \
119#define OPM_THROW_PROBLEM(Exception, message) \
125#define OPM_THROW_NOLOG(Exception, message) \
131#define OPM_ERROR_IF(condition, message) \
132 do {if(condition){abort();}} while(false)