[cig-commits] r14585 - in short/3D/PyLith/branches/pylith-swig: libsrc/problems modulesrc/problems pylith/problems

brad at geodynamics.org brad at geodynamics.org
Fri Apr 3 17:38:13 PDT 2009


Author: brad
Date: 2009-04-03 17:38:13 -0700 (Fri, 03 Apr 2009)
New Revision: 14585

Modified:
   short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc
   short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.hh
   short/3D/PyLith/branches/pylith-swig/modulesrc/problems/SolverNonlinear.i
   short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverNonlinear.py
Log:
Added deallocat() to SolverNonlinear.

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc	2009-04-04 00:02:41 UTC (rev 14584)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.cc	2009-04-04 00:38:13 UTC (rev 14585)
@@ -33,12 +33,20 @@
 // Destructor
 pylith::problems::SolverNonlinear::~SolverNonlinear(void)
 { // destructor
+  deallocate();
+} // destructor
+
+// ----------------------------------------------------------------------
+// Deallocate data structures.
+void
+pylith::problems::SolverNonlinear::deallocate(void)
+{ // deallocate
   if (0 != _snes) {
     PetscErrorCode err = SNESDestroy(_snes); _snes = 0;
     CHECK_PETSC_ERROR(err);
   } // if
-} // destructor
-
+} // deallocate
+  
 // ----------------------------------------------------------------------
 // Initialize solver.
 void

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.hh	2009-04-04 00:02:41 UTC (rev 14584)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/problems/SolverNonlinear.hh	2009-04-04 00:38:13 UTC (rev 14585)
@@ -43,6 +43,9 @@
   /// Destructor
   ~SolverNonlinear(void);
 
+  /// Deallocate PETSc and local data structures.
+  void deallocate(void);
+  
   /** Initialize solver.
    *
    * @param fields Solution fields.

Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/problems/SolverNonlinear.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/problems/SolverNonlinear.i	2009-04-04 00:02:41 UTC (rev 14584)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/problems/SolverNonlinear.i	2009-04-04 00:38:13 UTC (rev 14585)
@@ -31,6 +31,9 @@
       /// Destructor
       ~SolverNonlinear(void);
 
+      /// Deallocate PETSc and local data structures.
+      void deallocate(void);
+
       /** Initialize solver.
        *
        * @param fields Solution fields.

Modified: short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverNonlinear.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverNonlinear.py	2009-04-04 00:02:41 UTC (rev 14584)
+++ short/3D/PyLith/branches/pylith-swig/pylith/problems/SolverNonlinear.py	2009-04-04 00:38:13 UTC (rev 14585)
@@ -18,7 +18,7 @@
 from problems import SolverNonlinear as ModuleSolverNonlinear
 
 # SolverNonlinear class
-class SolverNonlinear(Solver):
+class SolverNonlinear(Solver, ModuleSolverNonlinear):
   """
   Python PyLith nonlinear algebraic solver.
   """
@@ -63,6 +63,14 @@
     return
 
 
+  def _cleanup(self):
+    """
+    Deallocate PETSc and local data structures.
+    """
+    self.deallocate()
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def solver():



More information about the CIG-COMMITS mailing list