[cig-commits] r14346 - short/3D/PyLith/branches/pylith-swig/libsrc/utils

brad at geodynamics.org brad at geodynamics.org
Mon Mar 16 15:10:06 PDT 2009


Author: brad
Date: 2009-03-16 15:10:06 -0700 (Mon, 16 Mar 2009)
New Revision: 14346

Added:
   short/3D/PyLith/branches/pylith-swig/libsrc/utils/petscerror.h
Modified:
   short/3D/PyLith/branches/pylith-swig/libsrc/utils/Makefile.am
Log:
Added macro for PETSc error checking (similar to CHKERRQ(), but calls std::runtime_error() instead of return).

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/utils/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/utils/Makefile.am	2009-03-16 21:52:25 UTC (rev 14345)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/utils/Makefile.am	2009-03-16 22:10:06 UTC (rev 14346)
@@ -23,6 +23,7 @@
 	lapack.h \
 	macrodefs.h \
 	petscfwd.h \
+	petscerror.h \
 	sievefwd.hh \
 	sievetypes.hh \
 	vectorfields.hh \

Added: short/3D/PyLith/branches/pylith-swig/libsrc/utils/petscerror.h
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/utils/petscerror.h	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/utils/petscerror.h	2009-03-16 22:10:06 UTC (rev 14346)
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file pylith/utils/petscerror.h
+ *
+ * @brief Wrappers around PETSc error handling routines.
+ */
+
+#if !defined(pylith_utils_petscerror_h)
+#define pylith_utils_petscerror_h
+
+#define CHECK_PETSC_ERROR(err) \
+  if (err) { \
+    PetscError(__LINE__, __FUNCT__, __FILE__, __SDIR__, err, 0, " "); \
+    throw std::runtime_error("PETSc error."); }
+
+#define CHECK_PETSC_ERROR_MSG(err, msg) \
+  if (err) { \
+    PetscError(__LINE__, __FUNCT__, __FILE__, __SDIR__, err, 0, " "); \
+    throw std::runtime_error(msg); }
+
+#endif // pylith_utils_petscerror_h
+
+// End of file



More information about the CIG-COMMITS mailing list