[cig-commits] [commit] knepley/fix-faults-parallel: Fix error trapping for PETSc functions. (e786a4d)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Tue May 27 09:01:08 PDT 2014


Repository : https://github.com/geodynamics/pylith

On branch  : knepley/fix-faults-parallel
Link       : https://github.com/geodynamics/pylith/compare/a6dcee9c56c2ed915b63f90186133bd8ce8789a9...e786a4ddc13c1d46ee37b87dcd1ec90b9015ba30

>---------------------------------------------------------------

commit e786a4ddc13c1d46ee37b87dcd1ec90b9015ba30
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Tue May 27 09:00:57 2014 -0700

    Fix error trapping for PETSc functions.
    
    Since PETSc is now usually built with C compiler, we can't trap errors
    using PetscError(). Throw C++ exception from PYLITH_CHECK_ERROR instead.


>---------------------------------------------------------------

e786a4ddc13c1d46ee37b87dcd1ec90b9015ba30
 libsrc/pylith/utils/error.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libsrc/pylith/utils/error.h b/libsrc/pylith/utils/error.h
index dcd8751..aaa0839 100644
--- a/libsrc/pylith/utils/error.h
+++ b/libsrc/pylith/utils/error.h
@@ -42,11 +42,11 @@
 #define PYLITH_METHOD_END PetscFunctionReturnVoid()
 #define PYLITH_METHOD_RETURN(v) PetscFunctionReturn(v)
 
-#define PYLITH_CHECK_ERROR(err) do {if (PetscUnlikely(err)) {PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,err,PETSC_ERROR_IN_CXX,0);}} while(0)
+#define PYLITH_CHECK_ERROR(err) do {if (PetscUnlikely(err)) {PetscError(PETSC_COMM_SELF,__LINE__,PETSC_FUNCTION_NAME,__FILE__,err,PETSC_ERROR_REPEAT,0);throw std::runtime_error("Error detected while in PETSc function.");}} while(0)
 
 #define PYLITH_CHECK_ERROR_MSG(err, msg) \
   if (err) { \
-    PetscError(PETSC_COMM_SELF,__LINE__,__FUNCT__,__FILE__,err,PETSC_ERROR_IN_CXX, 0, " "); \
+    PetscError(PETSC_COMM_SELF,__LINE__,__FUNCT__,__FILE__,err,PETSC_ERROR_REPEAT, 0, " "); \
     throw std::runtime_error(msg); }
 
 #endif // pylith_utils_error_h



More information about the CIG-COMMITS mailing list