petsc_util.hpp 509 Bytes
Newer Older
Pietro Incardona's avatar
Pietro Incardona committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * PETSC_util.hpp
 *
 *  Created on: Jul 7, 2015
 *      Author: Pietro Incardona
 */

#ifndef PETSC_UTIL_HPP_
#define PETSC_UTIL_HPP_

#include <iostream>

#define PETSC_SAFE_CALL(call) {\
	PetscErrorCode err = call;\
	if (err != 0) {\
		std::string msg("Petsc error: ");\
		msg += std::string(__FILE__) + std::string(" ") + std::to_string(__LINE__);\
18 19
		PetscInt ln = __LINE__;\
		PetscError(MPI_COMM_WORLD,ln,__FUNCT__,__FILE__,err,PETSC_ERROR_INITIAL,"Error petsc");\
Pietro Incardona's avatar
Pietro Incardona committed
20 21 22 23 24
	}\
}


#endif /* MPI_UTIL_HPP_ */