[cig-commits] r20750 - in short/3D/PyLith/branches/v1.7-stable/libsrc/pylith: faults feassemble materials meshio problems topology

brad at geodynamics.org brad at geodynamics.org
Thu Sep 20 09:42:15 PDT 2012


Author: brad
Date: 2012-09-20 09:42:15 -0700 (Thu, 20 Sep 2012)
New Revision: 20750

Modified:
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesive.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveLagrange.hh
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.hh
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticity.hh
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticityLgDeform.hh
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/ElasticMaterial.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/Material.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterVTK.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.hh
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/OutputSolnPoints.hh
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Explicit.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Implicit.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.cc
   short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.hh
Log:
Small code cleanup, mostly checking completeness of deallocate().

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesive.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesive.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesive.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -56,6 +56,7 @@
 pylith::faults::FaultCohesive::deallocate(void)
 { // deallocate
   Fault::deallocate();
+  feassemble::Integrator<feassemble::Quadrature<topology::SubMesh> >::deallocate();
 
   delete _fields; _fields = 0;
 } // deallocate

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveDyn.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -91,10 +91,7 @@
   _friction = 0; // :TODO: Use shared pointer
 
   delete _jacobian; _jacobian = 0;
-  if (_ksp) {
-    PetscErrorCode err = KSPDestroy(&_ksp); _ksp = 0;
-    CHECK_PETSC_ERROR(err);
-  } // if
+  PetscErrorCode err = KSPDestroy(&_ksp);CHECK_PETSC_ERROR(err);
 } // deallocate
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveLagrange.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveLagrange.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/faults/FaultCohesiveLagrange.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -278,16 +278,6 @@
 			       const topology::Jacobian& jacobian,
 			       const topology::SolutionFields& fields);
 
-  // PROTECTED MEMBERS //////////////////////////////////////////////////
-protected :
-
-  /// Array of cohesive vertex information.
-  std::vector<CohesiveInfo> _cohesiveVertices;
-
-  /// Map label of cohesive cell to label of cells in fault mesh.
-  std::map<topology::Mesh::SieveMesh::point_type,
-           topology::SubMesh::SieveMesh::point_type> _cohesiveToFault;
-
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :
 
@@ -305,6 +295,16 @@
   /// Calculate fault area field.
   void _calcArea(void);
 
+  // PROTECTED MEMBERS //////////////////////////////////////////////////
+protected :
+
+  /// Array of cohesive vertex information.
+  std::vector<CohesiveInfo> _cohesiveVertices;
+
+  /// Map label of cohesive cell to label of cells in fault mesh.
+  std::map<topology::Mesh::SieveMesh::point_type,
+           topology::SubMesh::SieveMesh::point_type> _cohesiveToFault;
+
   // NOT IMPLEMENTED ////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/ElasticityExplicitLgDeform.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -69,8 +69,7 @@
  * See governing equations section of user manual for more
  * information.
 */
-class pylith::feassemble::ElasticityExplicitLgDeform :
-  public IntegratorElasticityLgDeform
+class pylith::feassemble::ElasticityExplicitLgDeform : public IntegratorElasticityLgDeform
 { // ElasticityExplicitLgDeform
   friend class TestElasticityExplicitLgDeform; // unit testing
 

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticity.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticity.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticity.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -236,15 +236,6 @@
 			  const int numBasis,
 			  const int numQuadPts);
 
-// PROTECTED MEMBERS ////////////////////////////////////////////////////
-protected :
-
-  /// Elastic material associated with integrator
-  materials::ElasticMaterial* _material;
-
-  /// Buffers for output.
-  topology::Fields<topology::Field<topology::Mesh> >* _outputFields;
-
 // PROTECTED TYPEDEFS ///////////////////////////////////////////////////
 protected :
 
@@ -255,6 +246,15 @@
   typedef pylith::topology::Field<pylith::topology::Mesh>::UpdateAddVisitor UpdateAddVisitor;
   typedef ALE::ISieveVisitor::IndicesVisitor<RealSection,SieveMesh::order_type,PylithInt> IndicesVisitor;
 
+// PROTECTED MEMBERS ////////////////////////////////////////////////////
+protected :
+
+  /// Elastic material associated with integrator
+  materials::ElasticMaterial* _material;
+
+  /// Buffers for output.
+  topology::Fields<topology::Field<topology::Mesh> >* _outputFields;
+
 // NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticityLgDeform.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticityLgDeform.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/feassemble/IntegratorElasticityLgDeform.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -35,8 +35,7 @@
  * time integration of the elasticity equation for large rigid body
  * rotations and small strains.
  */
-class pylith::feassemble::IntegratorElasticityLgDeform : 
-  public IntegratorElasticity
+class pylith::feassemble::IntegratorElasticityLgDeform : public IntegratorElasticity
 { // IntegratorElasticityLgDeform
   friend class TestIntegratorElasticityLgDeform; // unit testing
 

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/ElasticMaterial.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/ElasticMaterial.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/ElasticMaterial.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -70,6 +70,7 @@
 void
 pylith::materials::ElasticMaterial::deallocate(void)
 { // deallocate
+  Material::deallocate();
   delete _initialFields; _initialFields = 0;
 
   _dbInitialStress = 0; // :TODO: Use shared pointer.

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/Material.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/Material.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/materials/Material.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -109,9 +109,8 @@
 // ----------------------------------------------------------------------
 // Get physical property parameters and initial state (if used) from database.
 void
-pylith::materials::Material::initialize(
-		     const topology::Mesh& mesh,
-		     feassemble::Quadrature<topology::Mesh>* quadrature)
+pylith::materials::Material::initialize(const topology::Mesh& mesh,
+					feassemble::Quadrature<topology::Mesh>* quadrature)
 { // initialize
   assert(0 != _dbProperties);
   assert(0 != quadrature);

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -50,8 +50,9 @@
 void
 pylith::meshio::DataWriterHDF5<mesh_type, field_type>::deallocate(void)
 { // deallocate
+  DataWriter<mesh_type, field_type>::deallocate();
+
   PetscErrorCode err = 0;
-
   err = PetscViewerDestroy(&_viewer); CHECK_PETSC_ERROR(err);
   err = VecDestroy(&_tstamp); CHECK_PETSC_ERROR(err);
 } // deallocate

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -50,12 +50,14 @@
 void
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::deallocate(void)
 { // deallocate
+  DataWriter<mesh_type, field_type>::deallocate();
+
+  PetscErrorCode err = 0;
   const typename dataset_type::const_iterator& dEnd = _datasets.end();
   for (typename dataset_type::iterator d_iter=_datasets.begin();
        d_iter != dEnd;
        ++d_iter) {
-    PetscErrorCode err = PetscViewerDestroy(&d_iter->second.viewer);
-    CHECK_PETSC_ERROR(err);
+    err = PetscViewerDestroy(&d_iter->second.viewer);CHECK_PETSC_ERROR(err);
   } // for
 } // deallocate
   

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterVTK.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/DataWriterVTK.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -67,9 +67,10 @@
 void
 pylith::meshio::DataWriterVTK<mesh_type, field_type>::deallocate(void)
 { // deallocate
-  if (0 != _viewer)
-    PetscViewerDestroy(&_viewer);
-  _viewer = 0;
+  DataWriter<mesh_type, field_type>::deallocate();
+
+  PetscErrorCode err = 0;
+  err = PetscViewerDestroy(&_viewer);CHECK_PETSC_ERROR(err);
 } // deallocate
   
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -51,10 +51,18 @@
 // Destructor
 pylith::meshio::ExodusII::~ExodusII(void)
 { // destructor
-  close();
+  deallocate();
 } // destructor
 
 // ----------------------------------------------------------------------
+// Deallocate data structures.
+void
+pylith::meshio::ExodusII::deallocate(void)
+{ // deallocate
+  close();
+} // deallocate
+
+// ----------------------------------------------------------------------
 // Set filename.
 void
 pylith::meshio::ExodusII::filename(const char* name)

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/ExodusII.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -56,6 +56,9 @@
   /// Destructor
   ~ExodusII(void);
 
+  /// Deallocate data structures.
+  void deallocate(void);
+
   /** Set filename.
    *
    * @param filename Name of file

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/OutputSolnPoints.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/OutputSolnPoints.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/meshio/OutputSolnPoints.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -38,8 +38,7 @@
 /** @brief C++ object for managing output of finite-element data over
  * a subdomain.
  */
-class pylith::meshio::OutputSolnPoints : 
-  public OutputManager<topology::Mesh, topology::Field<topology::Mesh> >
+class pylith::meshio::OutputSolnPoints : public OutputManager<topology::Mesh, topology::Field<topology::Mesh> >
 { // OutputSolnPoints
   friend class TestOutputSolnPoints; // unit testing
 

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Explicit.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Explicit.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Explicit.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -36,7 +36,6 @@
 // Destructor
 pylith::problems::Explicit::~Explicit(void)
 { // destructor
-  deallocate();
 } // destructor
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Implicit.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Implicit.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/problems/Implicit.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -36,7 +36,6 @@
 // Destructor
 pylith::problems::Implicit::~Implicit(void)
 { // destructor
-  deallocate();
 } // destructor
 
 // ----------------------------------------------------------------------

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.cc
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.cc	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.cc	2012-09-20 16:42:15 UTC (rev 20750)
@@ -45,9 +45,17 @@
 // Destructor
 pylith::topology::RefineUniform::~RefineUniform(void)
 { // destructor
+  deallocate();
 } // destructor
 
 // ----------------------------------------------------------------------
+// Deallocate data structures.
+void
+pylith::topology::RefineUniform::deallocate(void)
+{ // deallocate
+} // deallocate
+
+// ----------------------------------------------------------------------
 // Refine mesh.
 void
 pylith::topology::RefineUniform::refine(Mesh* const newMesh,

Modified: short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.hh
===================================================================
--- short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.hh	2012-09-20 14:48:26 UTC (rev 20749)
+++ short/3D/PyLith/branches/v1.7-stable/libsrc/pylith/topology/RefineUniform.hh	2012-09-20 16:42:15 UTC (rev 20750)
@@ -43,6 +43,9 @@
   /// Destructor
   ~RefineUniform(void);
 
+  /// Deallocate data structures.
+  void deallocate(void);
+
   /** Refine mesh.
    *
    * @param newMesh Refined mesh (result).



More information about the CIG-COMMITS mailing list