[cig-commits] r15426 - in short/3D/PyLith/trunk: . libsrc/faults modulesrc/faults pylith/faults pylith/problems

brad at geodynamics.org brad at geodynamics.org
Sat Jul 4 16:23:00 PDT 2009


Author: brad
Date: 2009-07-04 16:22:59 -0700 (Sat, 04 Jul 2009)
New Revision: 15426

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
   short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
   short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc
   short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc
   short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.cc
   short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh
   short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc
   short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i
   short/3D/PyLith/trunk/modulesrc/faults/SlipTimeFn.i
   short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
   short/3D/PyLith/trunk/pylith/faults/Fault.py
   short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
   short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
Log:
Improved memory model for faults.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/TODO	2009-07-04 23:22:59 UTC (rev 15426)
@@ -19,7 +19,6 @@
         AbsorbingDampers (_parameters)
         Neumann (_parameters)
         SlipTimeFn (_parameters)
-        FaultCohesiveKin (_fields)
         Quadrature (_geometryFields) [should be NULL]
         OutputManager (_fields)
         CellFilterAvg (_fieldAvg)

Modified: short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/BruneSlipFn.cc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -87,6 +87,7 @@
   assert(!vertices.isNull());
   const label_sequence::iterator verticesBegin = vertices->begin();
   const label_sequence::iterator verticesEnd = vertices->end();
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("Fault");
 

Modified: short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/ConstRateSlipFn.cc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -85,6 +85,7 @@
   assert(!vertices.isNull());
   const label_sequence::iterator verticesBegin = vertices->begin();
   const label_sequence::iterator verticesEnd = vertices->end();
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("Fault");
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.cc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -120,6 +120,7 @@
     assert(0 != src);
     src->initialize(*_faultMesh, *_normalizer);
   } // for
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("Fault");
 
@@ -1195,9 +1196,14 @@
   // Allocate buffer for tractions field (if nec.).
   const ALE::Obj<RealSection>& tractionsSection = tractions->section();
   if (tractionsSection.isNull()) {
+    ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+    logger.stagePush("Fault");
+
     const topology::Field<topology::SubMesh>& slip =_fields->get("slip");
     tractions->newSection(slip, fiberDim);
     tractions->allocate();
+
+    logger.stagePop();
   } // if
   assert(!tractionsSection.isNull());
   tractions->zero();
@@ -1240,6 +1246,9 @@
   if (_fields->hasField("buffer (vector)"))
     return;
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.stagePush("Output");
+
   // Create vector field; use same shape/chart as cumulative slip field.
   assert(0 != _faultMesh);
   _fields->add("buffer (vector)", "buffer");
@@ -1249,6 +1258,8 @@
     _fields->get("cumulative slip");
   buffer.cloneSection(slip);
   buffer.zero();
+
+  logger.stagePop();
 } // _allocateBufferVectorField
 
 // ----------------------------------------------------------------------
@@ -1260,6 +1271,9 @@
   if (_fields->hasField("buffer (scalar)"))
     return;
 
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.stagePush("Output");
+
   // Create vector field; use same shape/chart as area field.
   assert(0 != _faultMesh);
   _fields->add("buffer (scalar)", "buffer");
@@ -1268,6 +1282,8 @@
   const topology::Field<topology::SubMesh>& area = _fields->get("area");
   buffer.cloneSection(area);
   buffer.zero();
+
+  logger.stagePop();
 } // _allocateBufferScalarField
 
 

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.hh	2009-07-04 23:22:59 UTC (rev 15426)
@@ -198,6 +198,13 @@
    */
   bool useLagrangeConstraints(void) const;
 
+  /** Get fields associated with fault.
+   *
+   * @returns Fields associated with fault.
+   */
+  const topology::Fields<topology::Field<topology::SubMesh> >*
+  fields(void) const;
+
   // PRIVATE METHODS ////////////////////////////////////////////////////
 private :
 
@@ -231,15 +238,6 @@
   /// Allocate buffer for scalar field.
   void _allocateBufferScalarField(void);
 
-  // NOT IMPLEMENTED ////////////////////////////////////////////////////
-private :
-
-  /// Not implemented
-  FaultCohesiveKin(const FaultCohesiveKin&);
-
-  /// Not implemented
-  const FaultCohesiveKin& operator=(const FaultCohesiveKin&);
-
   // PRIVATE TYPEDEFS ///////////////////////////////////////////////////
 private :
 
@@ -257,6 +255,15 @@
   std::map<topology::Mesh::SieveMesh::point_type, 
 	   topology::SubMesh::SieveMesh::point_type> _cohesiveToFault;
 
+  // NOT IMPLEMENTED ////////////////////////////////////////////////////
+private :
+
+  /// Not implemented
+  FaultCohesiveKin(const FaultCohesiveKin&);
+
+  /// Not implemented
+  const FaultCohesiveKin& operator=(const FaultCohesiveKin&);
+
 }; // class FaultCohesiveKin
 
 #include "FaultCohesiveKin.icc" // inline methods

Modified: short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/FaultCohesiveKin.icc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -21,5 +21,12 @@
   return true;
 } // useLagrangeConstraints
 
+// Get fields associated with fault.
+inline
+const pylith::topology::Fields<pylith::topology::Field<pylith::topology::SubMesh> >*
+pylith::faults::FaultCohesiveKin::fields(void) const {
+  return _fields;
+} // fields
 
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/LiuCosSlipFn.cc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -87,6 +87,7 @@
   assert(!vertices.isNull());
   const label_sequence::iterator verticesBegin = vertices->begin();
   const label_sequence::iterator verticesEnd = vertices->end();
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("Fault");
 
@@ -282,7 +283,8 @@
 // ----------------------------------------------------------------------
 // Get increment of slip on fault surface between time t0 and t1.
 void
-pylith::faults::LiuCosSlipFn::slipIncr(				      topology::Field<topology::SubMesh>* slip,
+pylith::faults::LiuCosSlipFn::slipIncr(
+				      topology::Field<topology::SubMesh>* slip,
 				      const double t0,
 				      const double t1)
 { // slipIncr

Modified: short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.cc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.cc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -40,5 +40,13 @@
   delete _parameters; _parameters = 0;
 } // deallocate
   
+// ----------------------------------------------------------------------
+// Get parameter fields.
+const pylith::topology::Fields<pylith::topology::Field<pylith::topology::SubMesh> >*
+pylith::faults::SlipTimeFn::parameterFields(void) const
+{ // parameterFields
+  return _parameters;
+} // parameterFields
 
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/SlipTimeFn.hh	2009-07-04 23:22:59 UTC (rev 15426)
@@ -97,6 +97,13 @@
   virtual
   const topology::Field<topology::SubMesh>& slipTime(void) = 0;
 
+  /** Get parameter fields.
+   *
+   * @returns Parameter fields.
+   */
+  const topology::Fields<topology::Field<topology::SubMesh> >*
+  parameterFields(void) const;
+
 // PROTECTED MEMBERS ////////////////////////////////////////////////////
 protected :
 

Modified: short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/libsrc/faults/StepSlipFn.cc	2009-07-04 23:22:59 UTC (rev 15426)
@@ -83,6 +83,7 @@
   assert(!vertices.isNull());
   const label_sequence::iterator verticesBegin = vertices->begin();
   const label_sequence::iterator verticesEnd = vertices->end();
+
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
   logger.stagePush("Fault");
 

Modified: short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/modulesrc/faults/FaultCohesiveKin.i	2009-07-04 23:22:59 UTC (rev 15426)
@@ -150,6 +150,13 @@
        */
       bool useLagrangeConstraints(void) const;
 
+      /** Get fields associated with fault.
+       *
+       * @returns Fields associated with fault.
+       */
+      const pylith::topology::Fields<pylith::topology::Field<pylith::topology::SubMesh> >*
+      fields(void) const;
+
     }; // class FaultCohesiveKin
 
   } // faults

Modified: short/3D/PyLith/trunk/modulesrc/faults/SlipTimeFn.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/faults/SlipTimeFn.i	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/modulesrc/faults/SlipTimeFn.i	2009-07-04 23:22:59 UTC (rev 15426)
@@ -85,6 +85,13 @@
       virtual
       const pylith::topology::Field<pylith::topology::SubMesh>& slipTime(void) = 0;
 
+      /** Get parameter fields.
+       *
+       * @returns Parameter fields.
+       */
+      const pylith::topology::Fields<pylith::topology::Field<pylith::topology::SubMesh> >*
+      parameterFields(void) const;
+
     }; // class SlipTimeFn
 
   } // faults

Modified: short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/pylith/faults/EqKinSrc.py	2009-07-04 23:22:59 UTC (rev 15426)
@@ -101,6 +101,14 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    self.slipfn.finalize()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/trunk/pylith/faults/Fault.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/Fault.py	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/pylith/faults/Fault.py	2009-07-04 23:22:59 UTC (rev 15426)
@@ -94,7 +94,12 @@
   faultQuadrature = pyre.inventory.facility("quadrature", factory=SubMeshQuadrature)
   faultQuadrature.meta['tip'] = "Quadrature object for numerical integration."
   
+  from pylith.perf.MemoryLogger import MemoryLogger
+  perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
+                                       factory=MemoryLogger)
+  perfLogger.meta['tip'] = "Performance and memory logging."
 
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="fault"):
@@ -200,6 +205,14 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    self._modelMemoryUse()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -212,6 +225,7 @@
     self.normalDir = map(float, self.inventory.normalDir)
     ModuleFault.id(self, self.inventory.matId)
     ModuleFault.label(self, self.inventory.faultLabel)
+    self.perfLogger = self.inventory.perfLogger
     return
 
   
@@ -223,4 +237,13 @@
                               "derived class.")
   
   
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    raise NotImplementedError, \
+          "Please implement _modelModelUse() in derived class."
+    return
+
+
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/pylith/faults/FaultCohesiveKin.py	2009-07-04 23:22:59 UTC (rev 15426)
@@ -191,6 +191,17 @@
     return field
 
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    for eqsrc in self.eqsrcs.components():
+      eqsrc.finalize()
+    FaultCohesive.finalize(self)
+    Integrator.finalize(self)
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -211,6 +222,14 @@
     return
     
   
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields("Fault", self.fields())
+    return
+
+
 # FACTORIES ////////////////////////////////////////////////////////////
 
 def fault():

Modified: short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py
===================================================================
--- short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/pylith/faults/SlipTimeFn.py	2009-07-04 23:22:59 UTC (rev 15426)
@@ -27,6 +27,16 @@
   Factory: slip_time_fn
   """
 
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  import pyre.inventory
+
+  from pylith.perf.MemoryLogger import MemoryLogger
+  perfLogger = pyre.inventory.facility("perf_logger", family="perf_logger",
+                                       factory=MemoryLogger)
+  perfLogger.meta['tip'] = "Performance and memory logging."
+
+
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def __init__(self, name="sliptimefn"):
@@ -67,6 +77,14 @@
     return
 
 
+  def finalize(self):
+    """
+    Cleanup.
+    """
+    self._modelMemoryUse()
+    return
+  
+
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
@@ -74,6 +92,7 @@
     Setup members using inventory.
     """
     PetscComponent._configure(self)
+    self.perfLogger = self.inventory.perfLogger
     return
 
   
@@ -98,4 +117,12 @@
     return
   
 
+  def _modelMemoryUse(self):
+    """
+    Model memory allocation.
+    """
+    self.perfLogger.logFields("Fault", self.parameterFields())
+    return
+
+
 # End of file 

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2009-07-04 22:22:51 UTC (rev 15425)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2009-07-04 23:22:59 UTC (rev 15426)
@@ -535,8 +535,6 @@
                                    self.fields.get('residual'))
     for integrator in self.integratorsMesh + self.integratorsSubMesh:
       self.perfLogger.logQuadrature('Quadrature', integrator.quadrature())
-    # Placeholders until we know we they go
-    self.perfLogger.memory['Fault'] = 0
     return
 
 



More information about the CIG-COMMITS mailing list