[cig-commits] r13233 - in short/3D/PyLith/trunk: libsrc/utils pylith/problems

brad at geodynamics.org brad at geodynamics.org
Mon Nov 3 14:44:22 PST 2008


Author: brad
Date: 2008-11-03 14:44:22 -0800 (Mon, 03 Nov 2008)
New Revision: 13233

Modified:
   short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc
   short/3D/PyLith/trunk/pylith/problems/Formulation.py
   short/3D/PyLith/trunk/pylith/problems/Implicit.py
Log:
Added a few more stages to the event logging.

Modified: short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc	2008-11-03 19:18:20 UTC (rev 13232)
+++ short/3D/PyLith/trunk/libsrc/utils/EventLogger.cc	2008-11-03 22:44:22 UTC (rev 13233)
@@ -73,15 +73,15 @@
 int
 pylith::utils::EventLogger::eventId(const char* name)
 { // eventId
-  map_event_type::iterator id = _events.find(name);
-  if (id == _events.end()) {
+  map_event_type::iterator iter = _events.find(name);
+  if (iter == _events.end()) {
     std::ostringstream msg;
     msg << "Could not find logging event '" << name
 	<< "' in logging class '" << _className << "'.";
     throw std::runtime_error(msg.str());
   } // if
 
-  return id->second;
+  return iter->second;
 } // eventId
 
 // ----------------------------------------------------------------------
@@ -98,6 +98,7 @@
     throw std::runtime_error(msg.str());
   } // if  
   _stages[name] = id;
+
   return id;
 } // registerStage
 
@@ -106,14 +107,14 @@
 int
 pylith::utils::EventLogger::stageId(const char* name)
 { // stageId
-  map_event_type::iterator id = _stages.find(name);
-  if (id == _stages.end()) {
+  map_event_type::iterator iter = _stages.find(name);
+  if (iter == _stages.end()) {
     std::ostringstream msg;
     msg << "Could not find logging stage '" << name << "'.";
     throw std::runtime_error(msg.str());
   } // if
 
-  return id->second;
+  return iter->second;
 } // stagesId
 
 

Modified: short/3D/PyLith/trunk/pylith/problems/Formulation.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Formulation.py	2008-11-03 19:18:20 UTC (rev 13232)
+++ short/3D/PyLith/trunk/pylith/problems/Formulation.py	2008-11-03 22:44:22 UTC (rev 13233)
@@ -412,6 +412,7 @@
     Reform Jacobian matrix for operator.
     """
     self._debug.log(resourceUsageString())
+    self._logger.stagePush("Reform Jacobian")
     import pylith.utils.petsc as petsc
     petsc.mat_setzero(self.jacobian)
 
@@ -433,6 +434,7 @@
       self._debug.log(resourceUsageString()) # TEMPORARY
     self._info.log("Doing final assembly of Jacobian of operator.")
     petsc.mat_assemble(self.jacobian, "final_assembly")
+    self._logger.stagePop()
 
     if self.viewJacobian:
       filename = self._createJacobianFilename(t+dt)
@@ -462,6 +464,7 @@
     Reform residual vector for operator.
     """
     self._info.log("Integrating residual term in operator.")
+    self._logger.stagePush("Reform Residual")
     residual = self.fields.getReal("residual")
     import pylith.topology.topology as bindings
     bindings.zeroRealSection(residual)
@@ -479,6 +482,7 @@
       integrator.timeStep(dt)
       integrator.integrateResidualAssembled(residual, t, self.fields)
 
+    self._logger.stagePop()
     return
 
 
@@ -505,6 +509,12 @@
     for event in events:
       logger.registerEvent("%s%s" % (self._loggingPrefix, event))
 
+    stages = ["Reform Jacobian",
+              "Reform Residual",
+              "Solve"]
+    for stage in stages:
+      logger.registerStage(stage)
+
     self._logger = logger
     return
   

Modified: short/3D/PyLith/trunk/pylith/problems/Implicit.py
===================================================================
--- short/3D/PyLith/trunk/pylith/problems/Implicit.py	2008-11-03 19:18:20 UTC (rev 13232)
+++ short/3D/PyLith/trunk/pylith/problems/Implicit.py	2008-11-03 22:44:22 UTC (rev 13233)
@@ -189,7 +189,9 @@
 
     self._info.log("Solving equations.")
     residual = self.fields.getReal("residual")
+    self._logger.stagePush("Solve")
     self.solver.solve(dispIncr, self.jacobian, residual)
+    self._logger.stagePop()
 
     # BEGIN TEMPORARY
     #import pylith.topology.topology as bindings



More information about the CIG-COMMITS mailing list