[cig-commits] r16764 - short/3D/PyLith/trunk/libsrc/problems

brad at geodynamics.org brad at geodynamics.org
Sat May 22 16:05:29 PDT 2010


Author: brad
Date: 2010-05-22 16:05:29 -0700 (Sat, 22 May 2010)
New Revision: 16764

Modified:
   short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
Log:
Eliminated segfault by only destroying preconditioner matrix in solver. Need to ask Matt about how to use PETSc reference counting properly.

Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.cc	2010-05-22 22:59:38 UTC (rev 16763)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.cc	2010-05-22 23:05:29 UTC (rev 16764)
@@ -53,11 +53,15 @@
   _jacobianLumped = 0; // :TODO: Use shared pointer.
   _fields = 0; // :TODO: Use shared pointer.
 
+#if 0   // :KLUDGE: Assume Solver deallocates matrix.
   PetscErrorCode err = 0;
   if (0 != _precondMatrix) {
-    err = MatDestroy(_precondMatrix); _precondMatrix = 0;
-    CHECK_PETSC_ERROR(err);
+    err = PetscObjectDereference((PetscObject) _precondMatrix);
+    _precondMatrix = 0; CHECK_PETSC_ERROR(err);
   } // if
+#else
+  _precondMatrix = 0;
+#endif
 } // deallocate
   
 // ----------------------------------------------------------------------
@@ -141,8 +145,10 @@
 { // preconditioner
   _precondMatrix = mat;
 
+#if 0 // :KLUDGE: Assume solver deallocates matrix
   PetscErrorCode err = 0;
-  err = PetscObjectReference((PetscObject) _precondMatrix); CHECK_PETSC_ERROR(err);
+  err = PetscObjectReference((PetscObject) mat); CHECK_PETSC_ERROR(err);
+#endif
 } // preconditioner
 
 // ----------------------------------------------------------------------



More information about the CIG-COMMITS mailing list