| 1 | /* |
| 2 | * PETSC_util.hpp |
| 3 | * |
| 4 | * Created on: Jul 7, 2015 |
| 5 | * Author: Pietro Incardona |
| 6 | */ |
| 7 | |
| 8 | #ifndef PETSC_UTIL_HPP_ |
| 9 | #define PETSC_UTIL_HPP_ |
| 10 | |
| 11 | #include <iostream> |
| 12 | |
| 13 | #define PETSC_SAFE_CALL(call) {\ |
| 14 | PetscErrorCode err = call;\ |
| 15 | if (err != 0) {\ |
| 16 | std::string msg("Petsc error: ");\ |
| 17 | msg += std::string(__FILE__) + std::string(" ") + std::to_string(__LINE__);\ |
| 18 | PetscInt ln = __LINE__;\ |
| 19 | PetscError(MPI_COMM_WORLD,ln,__FUNCTION__,__FILE__,err,PETSC_ERROR_INITIAL,"Error petsc");\ |
| 20 | }\ |
| 21 | } |
| 22 | |
| 23 | |
| 24 | #endif /* MPI_UTIL_HPP_ */ |
| 25 | |