| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * @file error_handler.hpp
|
|---|
| 3 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
|---|
| 4 | * @date Mon Nov 21 13:27:22 2011
|
|---|
| 5 | *
|
|---|
| 6 | * @brief Convert MPI errors to C++ exceptions. Used to be
|
|---|
| 7 | * able to call a debugger when MPI crashes
|
|---|
| 8 | * internally.
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #ifndef ERROR_HANDLER_HPP_
|
|---|
| 13 | #define ERROR_HANDLER_HPP_
|
|---|
| 14 |
|
|---|
| 15 | #ifdef HAVE_MPI
|
|---|
| 16 |
|
|---|
| 17 | #include <stdexcept>
|
|---|
| 18 |
|
|---|
| 19 | namespace VMG
|
|---|
| 20 | {
|
|---|
| 21 |
|
|---|
| 22 | namespace MPI
|
|---|
| 23 | {
|
|---|
| 24 |
|
|---|
| 25 | class Exception : public std::exception
|
|---|
| 26 | {
|
|---|
| 27 | public:
|
|---|
| 28 | Exception(const std::string& what) :
|
|---|
| 29 | std::exception(),
|
|---|
| 30 | m_what(what)
|
|---|
| 31 | {}
|
|---|
| 32 |
|
|---|
| 33 | virtual ~Exception() throw()
|
|---|
| 34 | {}
|
|---|
| 35 |
|
|---|
| 36 | const char* what() const throw()
|
|---|
| 37 | {
|
|---|
| 38 | return m_what.c_str();
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | protected:
|
|---|
| 42 | std::string m_what;
|
|---|
| 43 |
|
|---|
| 44 | };
|
|---|
| 45 |
|
|---|
| 46 | void ConvertToException(MPI_Comm* comm, int* err, ...);
|
|---|
| 47 |
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | #endif /* HAVE_MPI */
|
|---|
| 53 |
|
|---|
| 54 | #endif /* ERROR_HANDLER_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.