[cig-commits] r15142 - in short/3D/PyLith/trunk: libsrc/feassemble libsrc/materials libsrc/meshio libsrc/topology pylith/perf

knepley at geodynamics.org knepley at geodynamics.org
Mon Jun 8 11:27:53 PDT 2009


Author: knepley
Date: 2009-06-08 11:27:52 -0700 (Mon, 08 Jun 2009)
New Revision: 15142

Modified:
   short/3D/PyLith/trunk/libsrc/feassemble/Quadrature.cc
   short/3D/PyLith/trunk/libsrc/materials/Material.cc
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/trunk/libsrc/topology/Field.cc
   short/3D/PyLith/trunk/libsrc/topology/Field.hh
   short/3D/PyLith/trunk/pylith/perf/Field.py
   short/3D/PyLith/trunk/pylith/perf/Material.py
   short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
   short/3D/PyLith/trunk/pylith/perf/VertexGroup.py
Log:
More logging work (left in some debugging prints)


Modified: short/3D/PyLith/trunk/libsrc/feassemble/Quadrature.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/feassemble/Quadrature.cc	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/libsrc/feassemble/Quadrature.cc	2009-06-08 18:27:52 UTC (rev 15142)
@@ -141,7 +141,6 @@
 
   const char* loggingStage = "Quadrature";
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
-  logger.setDebug(1);
   logger.stagePush(loggingStage);
 
   delete _geometryFields;
@@ -161,7 +160,6 @@
   const typename RealSection::chart_type& chart = section->getChart();
 
   // Allocate field and cell buffer for Jacobian at quadrature points
-  logger.setDebug(2);
   std::cout << "Jacobian: cell dim: " << _cellDim << std::endl;
   _geometryFields->add("jacobian", "jacobian");
   topology::Field<mesh_type>& jacobianField = 
@@ -171,7 +169,6 @@
     _numQuadPts * 1 * _spaceDim;
   jacobianField->newSection(chart, fiberDim);
   jacobianField->allocate();
-  logger.setDebug(1);
   
   // Allocate field and cell buffer for determinant of Jacobian at quad pts
   std::cout << "Jacobian det:" << std::endl;
@@ -193,7 +190,6 @@
   basisDerivField.allocate();
 
   logger.stagePop();
-  logger.setDebug(0);
 
 #if defined(ALE_MEM_LOGGING)
   std::cout 

Modified: short/3D/PyLith/trunk/libsrc/materials/Material.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/materials/Material.cc	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/libsrc/materials/Material.cc	2009-06-08 18:27:52 UTC (rev 15142)
@@ -105,6 +105,7 @@
   assert(0 != _dbProperties);
   assert(0 != quadrature);
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.setDebug(2);
   logger.stagePush("Materials");
 
   // Get quadrature information
@@ -261,6 +262,7 @@
   if (0 != _dbInitialState)
     _dbInitialState->close();
   logger.stagePop();
+  logger.setDebug(0);
 } // initialize
 
 // ----------------------------------------------------------------------
@@ -333,6 +335,7 @@
     _dimProperties(&propertyScales[0], propertyScales.size());
 
     ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+    logger.setDebug(2);
     logger.stagePush("Materials");
     // Allocate buffer for property field if necessary.
     const ALE::Obj<RealSection>& fieldSection = field->section();
@@ -357,6 +360,7 @@
     field->scale(propertyScales[propOffset]);
     fieldType = _metadata.fieldType(name, Metadata::PROPERTY);
     logger.stagePop();
+    logger.setDebug(0);
   
     // Buffer for property at cell's quadrature points
     double_array fieldCell(numQuadPts*fiberDim);
@@ -408,6 +412,7 @@
     _dimStateVars(&stateVarScales[0], stateVarScales.size());
 
     ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+    logger.setDebug(2);
     logger.stagePush("Materials");
     // Allocate buffer for state variable field if necessary.
     const ALE::Obj<RealSection>& fieldSection = field->section();
@@ -432,6 +437,7 @@
     field->label(name);
     field->scale(stateVarScales[varOffset]);
     logger.stagePop();
+    logger.setDebug(0);
   
     // Buffer for state variable at cell's quadrature points
     double_array fieldCell(numQuadPts*fiberDim);

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2009-06-08 18:27:52 UTC (rev 15142)
@@ -191,6 +191,7 @@
   assert(!sieveMesh.isNull());
 
   ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  logger.setDebug(2);
   logger.stagePush("Materials");
   const ALE::Obj<SieveMesh::label_type>& labelMaterials = 
     sieveMesh->createLabel("material-id");
@@ -233,6 +234,7 @@
 #endif
   } // if
   logger.stagePop();
+  logger.setDebug(0);
 
 #if defined(ALE_MEM_LOGGING)
   std::cout 

Modified: short/3D/PyLith/trunk/libsrc/topology/Field.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.cc	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.cc	2009-06-08 18:27:52 UTC (rev 15142)
@@ -177,6 +177,34 @@
 } // newSection
 
 // ----------------------------------------------------------------------
+// Create sieve section and set chart and fiber dimesion for a list of
+// points.
+template<typename mesh_type>
+void
+pylith::topology::Field<mesh_type>::newSection(const chart_type& chart,
+					       const int fiberDim)
+{ // newSection
+  typedef typename mesh_type::SieveMesh::point_type point_type;
+
+  ALE::MemoryLogger& logger = ALE::MemoryLogger::singleton();
+  std::cout << "Making Field " << _label << " section type 1c" << std::endl;
+  logger.stagePush("Field");
+  if (fiberDim < 0) {
+    std::ostringstream msg;
+    msg << "Fiber dimension (" << fiberDim << ") for field '" << _label
+	<< "' must be nonnegative.";
+    throw std::runtime_error(msg.str());
+  } // if
+  
+  _section = new RealSection(_mesh.comm(), _mesh.debug());
+  _section->setChart(chart);
+  for(typename chart_type::const_iterator p_iter = chart.begin(); p_iter != chart.end(); ++p_iter) {
+    _section->setFiberDimension(*p_iter, fiberDim);
+  }
+  logger.stagePop();
+} // newSection
+
+// ----------------------------------------------------------------------
 // Create sieve section and set chart and fiber dimesion.
 template<typename mesh_type>
 void

Modified: short/3D/PyLith/trunk/libsrc/topology/Field.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/Field.hh	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/libsrc/topology/Field.hh	2009-06-08 18:27:52 UTC (rev 15142)
@@ -157,6 +157,15 @@
   void newSection(const ALE::Obj<label_sequence>& points,
 		  const int fiberDim);
 
+  /** Create sieve section and set chart and fiber dimesion for
+   * sequence of points.
+   *
+   * @param chart Points over which to define section.
+   * @param dim Fiber dimension for section.
+   */
+  void newSection(const chart_type& chart,
+		  const int fiberDim);
+
   /** Create sieve section and set chart and fiber dimesion for a list
    * of points.
    *

Modified: short/3D/PyLith/trunk/pylith/perf/Field.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/Field.py	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/pylith/perf/Field.py	2009-06-08 18:27:52 UTC (rev 15142)
@@ -20,7 +20,9 @@
     Tabulate memory use.
     """
     # Here we have data + atlas + bc
-    memDict[self.label] = (self.sizeDouble * self.size) + (2 * self.sizeInt * self.chartSize) + (2 * self.sizeInt * self.chartSize)
+    if not self.label in memDict:
+      memDict[self.label] = 0
+    memDict[self.label] += (self.sizeDouble * self.size) + (2 * self.sizeInt * self.chartSize) + (2 * self.sizeInt * self.chartSize)
     return
 
 if __name__ == '__main__':

Modified: short/3D/PyLith/trunk/pylith/perf/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/Material.py	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/pylith/perf/Material.py	2009-06-08 18:27:52 UTC (rev 15142)
@@ -18,7 +18,9 @@
     """
     Tabulate memory use.
     """
-    memDict[self.label] = self.sizeArrow * self.ncells
+    if not self.label in memDict:
+      memDict[self.label] = 0
+    memDict[self.label] += self.sizeArrow * self.ncells
     return
 
 if __name__ == '__main__':

Modified: short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/pylith/perf/MemoryLogger.py	2009-06-08 18:27:52 UTC (rev 15142)
@@ -91,11 +91,9 @@
     if not stage in self.memory: self.memory[stage] = {}
     materialModel = pylith.perf.Material.Material(material.label(), material.ncells)
     materialModel.tabulate(self.memory[stage])
+    print 'Material:',material.label()
     self.logField(stage, material.getProperties())
     self.logField(stage, material.getStateVars())
-    # For debugging right now
-    self.logField('Field', material.getProperties())
-    self.logField('Field', material.getStateVars())
     if self.verbose: self.show()
     return
 
@@ -119,6 +117,7 @@
     import pylith.perf.Field
 
     if not stage in self.memory: self.memory[stage] = {}
+    print '  Field:',field.label(), field.sectionSize(), field.chartSize()
     fieldModel = pylith.perf.Field.Field(field.label(), field.sectionSize(), field.chartSize())
     fieldModel.tabulate(self.memory[stage])
     if self.verbose: self.show()

Modified: short/3D/PyLith/trunk/pylith/perf/VertexGroup.py
===================================================================
--- short/3D/PyLith/trunk/pylith/perf/VertexGroup.py	2009-06-08 18:11:24 UTC (rev 15141)
+++ short/3D/PyLith/trunk/pylith/perf/VertexGroup.py	2009-06-08 18:27:52 UTC (rev 15142)
@@ -20,7 +20,9 @@
     Tabulate memory use.
     """
     # Here we have data + atlas (could use uniform) + bc (use Section)
-    memDict[self.label] = (self.sizeInt * self.nvertices) + (2 * self.sizeInt * self.nMeshVertices) + (2 * self.sizeInt * self.nMeshVertices)
+    if not self.label in memDict:
+      memDict[self.label] = 0
+    memDict[self.label] += (self.sizeInt * self.nvertices) + (2 * self.sizeInt * self.nMeshVertices) + (2 * self.sizeInt * self.nMeshVertices)
     return
 
 if __name__ == '__main__':



More information about the CIG-COMMITS mailing list