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>
35# define OPM_REPORT do { std::cerr << "[" << __FILE__ << ":" << __LINE__ << "] " } while (false)
36# define OPM_MESSAGE(x) do { OPM_REPORT; std::cerr << x << "\n"; } while (false)
37# define OPM_MESSAGE_IF(cond, m) do {if(cond) OPM_MESSAGE(m);} while (false)
39# define OPM_REPORT do {} while (false)
40# define OPM_MESSAGE(x) do {} while (false)
41# define OPM_MESSAGE_IF(cond, m) do {} while (false)
44#if OPM_IS_INSIDE_HOST_FUNCTION
54#define OPM_THROW(Exception, message) \
56 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
57 std::to_string(__LINE__) + "] " + \
59 ::Opm::OpmLog::error(oss_); \
60 throw Exception(oss_); \
72#define OPM_THROW_PROBLEM(Exception, message) \
74 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
75 std::to_string(__LINE__) + "] " + \
77 ::Opm::OpmLog::problem(oss_); \
78 throw Exception(oss_); \
84#define OPM_THROW_NOLOG(Exception, message) \
86 std::string oss_ = std::string{"["} + __FILE__ + ":" + \
87 std::to_string(__LINE__) + "] " + \
89 throw Exception(oss_); \
93#define OPM_ERROR_IF(condition, message) do {if(condition){ OPM_THROW(std::logic_error, message);}} while(false)
110#define OPM_THROW(Exception, message) \
116#define OPM_THROW_PROBLEM(Exception, message) \
122#define OPM_THROW_NOLOG(Exception, message) \
128#define OPM_ERROR_IF(condition, message) \
129 do {if(condition){assert(false);}} while(false)