10 #ifndef _ZOLTAN2_EXCEPTIONS_HPP_
11 #define _ZOLTAN2_EXCEPTIONS_HPP_
28 #define Z2_THROW_OUTSIDE_ERROR(env) \
29 catch (std::exception &e) { \
30 std::cerr<<(env).myRank_<<" "<<__FILE__<<","<<__LINE__<<","<<e.what()<<std::endl; \
44 std::ostringstream emsg;
45 emsg << ffile <<
":" << lline
46 <<
" error: " << ffunc <<
" is not implemented."
51 const char *
what()
const throw() {
return msg.c_str(); }
56 #define Z2_THROW_NOT_IMPLEMENTED \
57 { throw Zoltan2::NotImplemented(__FILE__, __LINE__, __func__zoltan2__); }
70 #define Z2_FORWARD_EXCEPTIONS \
71 catch (std::runtime_error &e) { throw e; } \
72 catch (std::logic_error &e) { throw e; } \
73 catch (std::bad_alloc &e) { throw e; } \
74 catch (std::exception &e) { throw e; }
85 #define Z2_THROW_EXPERIMENTAL(mystr) \
87 std::ostringstream oss; \
88 oss << (mystr) << std::endl \
89 << "To experiment with this software, configure with " \
90 << "-D Zoltan2_ENABLE_Experimental:BOOL=ON " \
92 throw std::runtime_error(oss.str()); \
104 #define Z2_THROW_EXPERIMENTAL_WOLF(mystr) \
106 std::ostringstream oss; \
107 oss << (mystr) << std::endl \
108 << "To experiment with this software, configure with " \
109 << "-D Zoltan2_ENABLE_Experimental_Wolf:BOOL=ON " \
111 throw std::runtime_error(oss.str()); \
118 #define Z2_THROW_SERIAL(mystr) \
120 std::ostringstream oss; \
121 oss << (mystr) << std::endl \
122 << "This algorithm only runs in serial (Comm_Serial or MPI_Comm with worldsize=1). " \
124 throw std::runtime_error(oss.str()); \
134 #define Z2_ASSERT_VALUE(actual, expected) \
136 if (actual != expected) \
138 std::ostringstream oss; \
139 oss << "Expected value " << expected << "does not match actual value"\
140 << actual << "in" << __FILE__<<", "<<__LINE__ \
142 throw std::runtime_error(oss.str()); \
148 #define __func__zoltan2__ __FUNCTION__
150 #define __func__zoltan2__ "unknown zoltan2 function"
153 #define __func__zoltan2__ __func__
NotImplemented(const char *ffile, const int lline, const char *ffunc)
Exception thrown when a called base-class method is not implemented.
const char * what() const