[cig-commits] r15196 - in short/3D/PyLith/trunk: . libsrc/problems modulesrc/meshio modulesrc/problems
brad at geodynamics.org
brad at geodynamics.org
Thu Jun 11 10:43:29 PDT 2009
Author: brad
Date: 2009-06-11 10:43:28 -0700 (Thu, 11 Jun 2009)
New Revision: 15196
Modified:
short/3D/PyLith/trunk/TODO
short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
short/3D/PyLith/trunk/libsrc/problems/Solver.cc
short/3D/PyLith/trunk/libsrc/problems/Solver.hh
short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc
short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc
short/3D/PyLith/trunk/modulesrc/meshio/CellFilter.i
short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
short/3D/PyLith/trunk/modulesrc/problems/Solver.i
Log:
More work on adding deallocate() methods to allow explicit deallocation from Python.
Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/TODO 2009-06-11 17:43:28 UTC (rev 15196)
@@ -54,6 +54,7 @@
feassemble C++, SWIG
materials C++, SWIG
meshio C++, SWIG
+ problems C++, SWIG
2. Add missing unit tests
Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.cc 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.cc 2009-06-11 17:43:28 UTC (rev 15196)
@@ -38,11 +38,19 @@
// Destructor
pylith::problems::Formulation::~Formulation(void)
{ // destructor
- _jacobian = 0; // Handle only, we do not manage the memory.
- _fields = 0; // Handle only, we do not manage the memory.
+ deallocate();
} // destructor
// ----------------------------------------------------------------------
+// Deallocate PETSc and local data structures.
+void
+pylith::problems::Formulation::deallocate(void)
+{ // deallocate
+ _jacobian = 0; // :TODO: Use shared pointer.
+ _fields = 0; // :TODO: Use shared pointer.
+} // deallocate
+
+// ----------------------------------------------------------------------
// Return the fields
const pylith::topology::SolutionFields&
pylith::problems::Formulation::fields(void) const
Modified: short/3D/PyLith/trunk/libsrc/problems/Formulation.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Formulation.hh 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/libsrc/problems/Formulation.hh 2009-06-11 17:43:28 UTC (rev 15196)
@@ -51,6 +51,9 @@
/// Destructor
~Formulation(void);
+ /// Deallocate PETSc and local data structures.
+ void deallocate(void);
+
/** Set handles to integrators over the mesh.
*
* @param integrators Integrators over the mesh.
Modified: short/3D/PyLith/trunk/libsrc/problems/Solver.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Solver.cc 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/libsrc/problems/Solver.cc 2009-06-11 17:43:28 UTC (rev 15196)
@@ -27,10 +27,18 @@
// Destructor
pylith::problems::Solver::~Solver(void)
{ // destructor
- _formulation = 0; // Handle only, do not manage memory.
+ deallocate();
} // destructor
// ----------------------------------------------------------------------
+// Deallocate PETSc and local data structures.
+void
+pylith::problems::Solver::deallocate(void)
+{ // deallocate
+ _formulation = 0; // Handle only, do not manage memory.
+} // deallocate
+
+// ----------------------------------------------------------------------
// Initialize solver.
void
pylith::problems::Solver::initialize(const topology::SolutionFields& fields,
Modified: short/3D/PyLith/trunk/libsrc/problems/Solver.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/Solver.hh 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/libsrc/problems/Solver.hh 2009-06-11 17:43:28 UTC (rev 15196)
@@ -38,8 +38,13 @@
Solver(void);
/// Destructor
+ virtual
~Solver(void);
+ /// Deallocate PETSc and local data structures.
+ virtual
+ void deallocate(void);
+
/** Initialize solver.
*
* @param fields Solution fields.
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverLinear.cc 2009-06-11 17:43:28 UTC (rev 15196)
@@ -47,6 +47,8 @@
void
pylith::problems::SolverLinear::deallocate(void)
{ // deallocate
+ Solver::deallocate();
+
if (0 != _ksp) {
PetscErrorCode err = KSPDestroy(_ksp); _ksp = 0;
CHECK_PETSC_ERROR(err);
Modified: short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/libsrc/problems/SolverNonlinear.cc 2009-06-11 17:43:28 UTC (rev 15196)
@@ -41,6 +41,8 @@
void
pylith::problems::SolverNonlinear::deallocate(void)
{ // deallocate
+ Solver::deallocate();
+
if (0 != _snes) {
PetscErrorCode err = SNESDestroy(_snes); _snes = 0;
CHECK_PETSC_ERROR(err);
Modified: short/3D/PyLith/trunk/modulesrc/meshio/CellFilter.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/CellFilter.i 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/modulesrc/meshio/CellFilter.i 2009-06-11 17:43:28 UTC (rev 15196)
@@ -41,7 +41,7 @@
CellFilter* clone(void) const = 0;
/// Deallocate PETSc and local data structures.
- cirtual
+ virtual
void deallocate(void);
/** Set quadrature associated with cells.
Modified: short/3D/PyLith/trunk/modulesrc/problems/Formulation.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Formulation.i 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/modulesrc/problems/Formulation.i 2009-06-11 17:43:28 UTC (rev 15196)
@@ -31,6 +31,9 @@
/// Destructor
~Formulation(void);
+ /// Deallocate PETSc and local data structures.
+ void deallocate(void);
+
/** Set handles to integrators over the mesh.
*
* @param integrators Integrators over the mesh.
Modified: short/3D/PyLith/trunk/modulesrc/problems/Solver.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/problems/Solver.i 2009-06-11 17:34:07 UTC (rev 15195)
+++ short/3D/PyLith/trunk/modulesrc/problems/Solver.i 2009-06-11 17:43:28 UTC (rev 15196)
@@ -29,8 +29,13 @@
Solver(void);
/// Destructor
+ virtual
~Solver(void);
+ /// Deallocate PETSc and local data structures.
+ virtual
+ void deallocate(void);
+
/** Initialize solver.
*
* @param fields Solution fields.
More information about the CIG-COMMITS
mailing list