[petsc-users] proper way to make petsc throw exceptions on errors?

Geoffrey Irving irving at naml.us
Thu Nov 14 12:02:25 CST 2013


Is there a safe way to make petsc throw exceptions from C++ code,
without interfering with the same passage from errors through C code?
The existence of PETSC_ERROR_IN_CXX and PetscPushErrorHandler seems
promising?  Could I push a C++ error handler at the top of a C++
function and pop it and the end, for example?

Note that "no" is a fine answer. :)  I only want to do this if there's
a way to do it cleanly.  The alternative is wrapping a CHECK macro
around all my calls to petsc from C++, which is far superior to a
fancy but broken solution.

Thanks,
Geoffrey


More information about the petsc-users mailing list