[cig-commits] [commit] baagaard/feature-output-station-names, baagaard/feature-progress-monitor, master: Refactor ProgressMonitor into ProgressMonitor, ProgressMonitorTime, and ProgressMonitorStep. (6932460)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Nov 5 15:47:46 PST 2014


Repository : https://github.com/geodynamics/pylith

On branches: baagaard/feature-output-station-names,baagaard/feature-progress-monitor,master
Link       : https://github.com/geodynamics/pylith/compare/f33c75b19fd60eedb2a3405db76a1fee333bb1d7...5b6d812b1612809fea3bd331c4e5af98c25a536a

>---------------------------------------------------------------

commit 6932460317df82082db62b5a460f18b080ce496e
Author: Brad Aagaard <baagaard at usgs.gov>
Date:   Sat Nov 1 12:13:03 2014 -0700

    Refactor ProgressMonitor into ProgressMonitor, ProgressMonitorTime, and ProgressMonitorStep.
    
    Setup progress monitor for TimeDependent and GreensFns problems.


>---------------------------------------------------------------

6932460317df82082db62b5a460f18b080ce496e
 pylith/Makefile.am                                 |   2 +
 pylith/problems/GreensFns.py                       |  13 +++
 pylith/problems/ProgressMonitor.py                 |  61 +++++------
 pylith/problems/ProgressMonitorStep.py             | 109 +++++++++++++++++++
 pylith/problems/ProgressMonitorTime.py             | 118 +++++++++++++++++++++
 pylith/problems/TimeDependent.py                   |   4 +-
 unittests/pytests/problems/Makefile.am             |   4 +-
 unittests/pytests/problems/TestProgressMonitor.py  |  31 ++----
 ...ogressMonitor.py => TestProgressMonitorStep.py} |  37 ++++---
 ...ogressMonitor.py => TestProgressMonitorTime.py} |  18 ++--
 unittests/pytests/problems/data/Makefile.am        |   3 +-
 unittests/pytests/problems/testproblems.py         |   6 ++
 12 files changed, 320 insertions(+), 86 deletions(-)

diff --git a/pylith/Makefile.am b/pylith/Makefile.am
index e1408da..1e5c70b 100644
--- a/pylith/Makefile.am
+++ b/pylith/Makefile.am
@@ -144,6 +144,8 @@ nobase_pkgpyexec_PYTHON = \
 	problems/TimeStepUniform.py \
 	problems/TimeStepUser.py \
 	problems/ProgressMonitor.py \
+	problems/ProgressMonitorStep.py \
+	problems/ProgressMonitorTime.py \
 	topology/__init__.py \
 	topology/Distributor.py \
 	topology/Mesh.py \
diff --git a/pylith/problems/GreensFns.py b/pylith/problems/GreensFns.py
index e18b196..8c42af9 100644
--- a/pylith/problems/GreensFns.py
+++ b/pylith/problems/GreensFns.py
@@ -48,6 +48,7 @@ class GreensFns(Problem):
     ##
     ## \b Facilities
     ## @li \b formulation Formulation for solving PDE.
+    ## @li \b progress_monitor Simple progress monitor via text file.
     ## @li \b checkpoint Checkpoint manager.
 
     import pyre.inventory
@@ -61,6 +62,10 @@ class GreensFns(Problem):
                                           factory=Implicit)
     formulation.meta['tip'] = "Formulation for solving PDE."
 
+    from ProgressMonitorStep import ProgressMonitorStep
+    progressMonitor = pyre.inventory.facility("progress_monitor", family="progress_monitor", factory=ProgressMonitorStep)
+    formulation.meta['tip'] = "Simple progress monitor via text file."
+
     from pylith.utils.CheckpointTimer import CheckpointTimer
     checkpointTimer = pyre.inventory.facility("checkpoint",
                                               family="checkpointer",
@@ -152,9 +157,14 @@ class GreensFns(Problem):
       material.useElasticBehavior(True)
 
     nimpulses = self.source.numImpulses()
+    if nimpulses > 0:
+      self.progressMonitor.open()
+    
     ipulse = 0;
     dt = 1.0
     while ipulse < nimpulses:
+      self.progressMonitor.update(ipulse, 0, nimpulses)
+
       self._eventLogger.stagePush("Prestep")
       if 0 == comm.rank:
         self._info.log("Main loop, impulse %d of %d." % (ipulse+1, nimpulses))
@@ -188,6 +198,8 @@ class GreensFns(Problem):
 
       # Update time/impulse
       ipulse += 1
+
+    self.progressMonitor.close()      
     return
 
 
@@ -223,6 +235,7 @@ class GreensFns(Problem):
 
     self.faultId = self.inventory.faultId
     self.formulation = self.inventory.formulation
+    self.progressMonitor = self.inventory.progressMonitor
     self.checkpointTimer = self.inventory.checkpointTimer
     return
 
diff --git a/pylith/problems/ProgressMonitor.py b/pylith/problems/ProgressMonitor.py
index 81c186d..41de1d3 100644
--- a/pylith/problems/ProgressMonitor.py
+++ b/pylith/problems/ProgressMonitor.py
@@ -18,9 +18,9 @@
 
 ## @file pylith/solver/ProgressMonitor.py
 ##
-## @brief Python PyLith abstract base class for solver.
+## @brief Python PyLith abstract base class for progress monitor.
 ##
-## Factory: solver
+## Factory: progress_monitor
 
 from pylith.utils.PetscComponent import PetscComponent
 import datetime
@@ -28,9 +28,9 @@ import datetime
 # ProgressMonitor class
 class ProgressMonitor(PetscComponent):
   """
-  Python abstract base class for solver.
+  Python abstract base class for progress monitor.
 
-  Factory: solver.
+  Factory: progress_monitor.
   """
 
   # INVENTORY //////////////////////////////////////////////////////////
@@ -45,7 +45,6 @@ class ProgressMonitor(PetscComponent):
     ##
     ## \b Properties
     ## @li \b filename Name of output file.
-    ## @li \b t_units Units for simulation time in output.
     ## @li \b update_percent Frequency of progress updates (percent).
     ##
     ## \b Facilities
@@ -53,70 +52,57 @@ class ProgressMonitor(PetscComponent):
 
     import pyre.inventory
 
-    filename = pyre.inventory.str("filename", default="progress.txt")
-    filename.meta['tip'] = "Name of output file."
-
-    tUnits = pyre.inventory.str("t_units", default="year")
-    tUnits.meta['tip'] = "Units for simulation time in output."
-
     updatePercent = pyre.inventory.float("update_percent", default=5.0)
     updatePercent.meta['tip'] = "Frequency of progress updates (percent)."
 
 
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
-  def __init__(self, name="progress_monitor"):
+  def __init__(self, name="progressmonitor"):
     """
     Constructor.
     """
     PetscComponent.__init__(self, name, facility="progress_monitor")
-    self.fout = None
+    self.isMaster = True
     return
 
 
   def open(self):
-    self.tPrev = None
+    self.prev = None
     self.datetimeStart = datetime.datetime.now()
     
-    import pyre.units
-    uparser = pyre.units.parser()
-    self.tSimScale = uparser.parse(self.tUnits)
-
     try:
       import pylith.mpi.mpi as mpi
       self.isMaster = 0 == mpi.rank()
     except:
       self.isMaster = True
     if self.isMaster:
-      self.fout = open(self.filename, "w")
-      self.fout.write("Timestamp                     Simulation t   % complete   Est. completion\n")
+      self._open()
     return
 
 
   def close(self):
-    if self.fout:
-      self.fout.close()
-      self.fout = None
+    if self.isMaster:
+      self._close()
     return
 
 
-  def update(self, t, tStart, tEnd):
+  def update(self, current, start, stop):
     writeUpdate = False
-    if self.tPrev:
-      incrCompleted = (t-self.tPrev) / (tEnd-tStart)
+    if self.prev:
+      incrCompleted = (100*(current-self.prev))/(stop-start)
     else:
       incrCompleted = 0.0
-    if not self.tPrev or incrCompleted > self.updatePercent/100.0:
-      percentComplete = (t-tStart)/(tEnd-tStart)*100.0
-      tSimNorm = t.value / self.tSimScale.value
+    if not self.prev or incrCompleted > self.updatePercent:
+      percentComplete = (100*(current-start))/(stop-start)
       now = datetime.datetime.now()
       if percentComplete > 0.0:
         finished = self.datetimeStart + datetime.timedelta(seconds=100.0/percentComplete * ((now-self.datetimeStart).total_seconds()))
       else:
         finished = "TBD"
       if self.isMaster:
-        self.fout.write("%s   %8.2f*%s   %10.0f   %s\n" % (now, tSimNorm, self.tUnits, percentComplete, finished))
-      self.tPrev = t
+        self._update(current, start, stop, now, finished, percentComplete)
+      self.prev = current
     return
 
 
@@ -128,11 +114,20 @@ class ProgressMonitor(PetscComponent):
     """
     PetscComponent._configure(self)
 
-    self.filename = self.inventory.filename
-    self.tUnits = self.inventory.tUnits
     self.updatePercent = self.inventory.updatePercent
     return
 
+  def _open(self):
+    return
+
+
+  def _close(self):
+    return
+
+
+  def _update(self, current, start, stop, now, finished, percentComplete):
+    return
+
   
 # FACTORIES ////////////////////////////////////////////////////////////
 
diff --git a/pylith/problems/ProgressMonitorStep.py b/pylith/problems/ProgressMonitorStep.py
new file mode 100644
index 0000000..103303b
--- /dev/null
+++ b/pylith/problems/ProgressMonitorStep.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2014 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/solver/ProgressMonitorStep.py
+##
+## @brief Python PyLith object for monitoring progress of problem with steps.
+##
+## Factory: progress_monitor
+
+from ProgressMonitor import ProgressMonitor
+
+# ProgressMonitorStep class
+class ProgressMonitorStep(ProgressMonitor):
+  """
+  Python PyLith object for monitoring progress of problem wit steps.
+
+  Factory: progress_monitor.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(ProgressMonitor.Inventory):
+    """
+    Python object for managing ProgressMonitorStep facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing ProgressMonitorStep facilities and properties.
+    ##
+    ## \b Properties
+    ## @li \b filename Name of output file.
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+    filename = pyre.inventory.str("filename", default="progress.txt")
+    filename.meta['tip'] = "Name of output file."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="progressmonitorstep"):
+    """
+    Constructor.
+    """
+    ProgressMonitor.__init__(self, name)
+    self.fout = None
+    return
+
+
+  # PRIVATE METHODS /////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    ProgressMonitor._configure(self)
+
+    self.filename = self.inventory.filename
+    return
+
+
+  def _open(self):
+    self.fout = open(self.filename, "w")
+    self.fout.write("Timestamp                     Step        % complete   Est. completion\n")
+    self.fout.flush()
+    return
+
+
+  def _close(self):
+    if self.fout:
+      self.fout.close()
+      self.fout = None
+    return
+
+
+  def _update(self, stepCurrent, stepStart, stepEnd, now, finished, percentComplete):
+    self.fout.write("%s   %10d   %10.0f   %s\n" % (now, stepCurrent, percentComplete, finished))
+    self.fout.flush()
+    return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def progress_monitor():
+  """
+  Factory associated with ProgressMonitorStep.
+  """
+  return ProgressMonitorStep()
+
+
+# End of file 
diff --git a/pylith/problems/ProgressMonitorTime.py b/pylith/problems/ProgressMonitorTime.py
new file mode 100644
index 0000000..048638c
--- /dev/null
+++ b/pylith/problems/ProgressMonitorTime.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2014 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/solver/ProgressMonitorTime.py
+##
+## @brief Python PyLith object for monitoring progress of time dependent problem.
+##
+## Factory: progress_monitor
+
+from ProgressMonitor import ProgressMonitor
+
+# ProgressMonitorTime class
+class ProgressMonitorTime(ProgressMonitor):
+  """
+  Python PyLith object for monitoring progress of time dependent problem.
+
+  Factory: progress_monitor.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(ProgressMonitor.Inventory):
+    """
+    Python object for managing ProgressMonitorTime facilities and properties.
+    """
+
+    ## @class Inventory
+    ## Python object for managing ProgressMonitorTime facilities and properties.
+    ##
+    ## \b Properties
+    ## @li \b filename Name of output file.
+    ## @li \b t_units Units for simulation time in output.
+    ##
+    ## \b Facilities
+    ## @li None
+
+    import pyre.inventory
+
+    filename = pyre.inventory.str("filename", default="progress.txt")
+    filename.meta['tip'] = "Name of output file."
+
+    tUnits = pyre.inventory.str("t_units", default="year")
+    tUnits.meta['tip'] = "Units for simulation time in output."
+
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="progressmonitortime"):
+    """
+    Constructor.
+    """
+    ProgressMonitor.__init__(self, name)
+    self.fout = None
+    return
+
+
+  # PRIVATE METHODS /////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    ProgressMonitor._configure(self)
+
+    self.filename = self.inventory.filename
+    self.tUnits = self.inventory.tUnits
+    return
+
+
+  def _open(self):
+    import pyre.units
+    uparser = pyre.units.parser()
+    self.tSimScale = uparser.parse(self.tUnits)
+
+    self.fout = open(self.filename, "w")
+    self.fout.write("Timestamp                     Simulation t   % complete   Est. completion\n")
+    self.fout.flush()
+    return
+
+
+  def _close(self):
+    if self.fout:
+      self.fout.close()
+      self.fout = None
+    return
+
+
+  def _update(self, t, tStart, tEnd, now, finished, percentComplete):
+    tSimNorm = t.value / self.tSimScale.value
+    self.fout.write("%s   %8.2f*%s   %10.0f   %s\n" % (now, tSimNorm, self.tUnits, percentComplete, finished))
+    return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def progress_monitor():
+  """
+  Factory associated with ProgressMonitorTime.
+  """
+  return ProgressMonitorTime()
+
+
+# End of file 
diff --git a/pylith/problems/TimeDependent.py b/pylith/problems/TimeDependent.py
index a33e4f1..5cbd465 100644
--- a/pylith/problems/TimeDependent.py
+++ b/pylith/problems/TimeDependent.py
@@ -60,8 +60,8 @@ class TimeDependent(Problem):
     formulation = pyre.inventory.facility("formulation", family="pde_formulation", factory=Implicit)
     formulation.meta['tip'] = "Formulation for solving PDE."
 
-    from ProgressMonitor import ProgressMonitor
-    progressMonitor = pyre.inventory.facility("progress_monitor", family="progress_monitor", factory=ProgressMonitor)
+    from ProgressMonitorTime import ProgressMonitorTime
+    progressMonitor = pyre.inventory.facility("progress_monitor", family="progress_monitor", factory=ProgressMonitorTime)
     formulation.meta['tip'] = "Simple progress monitor via text file."
 
     from pylith.utils.CheckpointTimer import CheckpointTimer
diff --git a/unittests/pytests/problems/Makefile.am b/unittests/pytests/problems/Makefile.am
index 1bd9fc4..d42f91e 100644
--- a/unittests/pytests/problems/Makefile.am
+++ b/unittests/pytests/problems/Makefile.am
@@ -28,7 +28,9 @@ noinst_PYTHON = \
 	TestTimeStepAdapt.py \
 	TestTimeStepUniform.py \
 	TestTimeStepUser.py \
-	TestProgressMonitor.py
+	TestProgressMonitor.py \
+	TestProgressMonitorTime.py \
+	TestProgressMonitorStep.py
 
 
 # End of file 
diff --git a/unittests/pytests/problems/TestProgressMonitor.py b/unittests/pytests/problems/TestProgressMonitor.py
index 50c623f..13c1b7d 100644
--- a/unittests/pytests/problems/TestProgressMonitor.py
+++ b/unittests/pytests/problems/TestProgressMonitor.py
@@ -34,7 +34,6 @@ class TestProgressMonitor(unittest.TestCase):
   def setUp(self):
     self.monitor = ProgressMonitor()
     self.monitor._configure()
-    self.monitor.filename = "data/progress.txt"
     return
   
 
@@ -51,14 +50,8 @@ class TestProgressMonitor(unittest.TestCase):
     """
     Test open() and close().
     """
-    import os
-    if os.path.exists(self.monitor.filename):
-        os.remove(self.monitor.filename)
     self.monitor.open()
     self.monitor.close()
-
-    self.assertTrue(os.path.isfile(self.monitor.filename))
-
     return
 
 
@@ -66,27 +59,19 @@ class TestProgressMonitor(unittest.TestCase):
     """
     Test update().
     """
-    import os
     self.monitor.open()
 
-    nlines = 1 # header
-    self.monitor.update(1.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(1.5*year, 0.0*year, 10.0*year); nlines += 0
-    self.monitor.update(2.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(4.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(5.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(6.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(8.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(9.0*year, 0.0*year, 10.0*year); nlines += 1
+    self.monitor.update(1.0*year, 0.0*year, 10.0*year)
+    self.monitor.update(1.5*year, 0.0*year, 10.0*year)
+    self.monitor.update(2.0*year, 0.0*year, 10.0*year)
+    self.monitor.update(4.0*year, 0.0*year, 10.0*year)
+    self.monitor.update(5.0*year, 0.0*year, 10.0*year)
+    self.monitor.update(6.0*year, 0.0*year, 10.0*year)
+    self.monitor.update(8.0*year, 0.0*year, 10.0*year)
+    self.monitor.update(9.0*year, 0.0*year, 10.0*year)
 
     self.monitor.close()
 
-    self.assertTrue(os.path.isfile(self.monitor.filename))
-    fin = open(self.monitor.filename, "r")
-    lines = fin.readlines()
-    fin.close()
-    self.assertEqual(nlines, len(lines))
-    
     return
 
 
diff --git a/unittests/pytests/problems/TestProgressMonitor.py b/unittests/pytests/problems/TestProgressMonitorStep.py
similarity index 61%
copy from unittests/pytests/problems/TestProgressMonitor.py
copy to unittests/pytests/problems/TestProgressMonitorStep.py
index 50c623f..ffd7719 100644
--- a/unittests/pytests/problems/TestProgressMonitor.py
+++ b/unittests/pytests/problems/TestProgressMonitorStep.py
@@ -16,25 +16,25 @@
 # ======================================================================
 #
 
-## @file unittests/pytests/problems/TestProgressMonitor.py
+## @file unittests/pytests/problems/TestProgressMonitorStep.py
 
-## @brief Unit testing of ProgressMonitor object.
+## @brief Unit testing of ProgressMonitorStep object.
 
 import unittest
-from pylith.problems.ProgressMonitor import ProgressMonitor
+from pylith.problems.ProgressMonitorStep import ProgressMonitorStep
 
 from pyre.units.time import year
 
 # ----------------------------------------------------------------------
-class TestProgressMonitor(unittest.TestCase):
+class TestProgressMonitorStep(unittest.TestCase):
   """
-  Unit testing of ProgressMonitor object.
+  Unit testing of ProgressMonitorStep object.
   """
 
   def setUp(self):
-    self.monitor = ProgressMonitor()
+    self.monitor = ProgressMonitorStep()
     self.monitor._configure()
-    self.monitor.filename = "data/progress.txt"
+    self.monitor.filename = "data/progress_step.txt"
     return
   
 
@@ -42,7 +42,7 @@ class TestProgressMonitor(unittest.TestCase):
     """
     Test constructor.
     """
-    monitor = ProgressMonitor()
+    monitor = ProgressMonitorStep()
     monitor._configure()
     return
 
@@ -70,14 +70,17 @@ class TestProgressMonitor(unittest.TestCase):
     self.monitor.open()
 
     nlines = 1 # header
-    self.monitor.update(1.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(1.5*year, 0.0*year, 10.0*year); nlines += 0
-    self.monitor.update(2.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(4.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(5.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(6.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(8.0*year, 0.0*year, 10.0*year); nlines += 1
-    self.monitor.update(9.0*year, 0.0*year, 10.0*year); nlines += 1
+    self.monitor.update(1, 1, 100); nlines += 1
+    self.monitor.update(2, 1, 100); nlines += 0
+    self.monitor.update(3, 1, 100); nlines += 0
+    self.monitor.update(10, 1, 100); nlines += 1
+    self.monitor.update(12, 1, 100); nlines += 0
+    self.monitor.update(20, 1, 100); nlines += 1
+    self.monitor.update(40, 1, 100); nlines += 1
+    self.monitor.update(50, 1, 100); nlines += 1
+    self.monitor.update(60, 1, 100); nlines += 1
+    self.monitor.update(80, 1, 100); nlines += 1
+    self.monitor.update(90, 1, 100); nlines += 1
 
     self.monitor.close()
 
@@ -94,7 +97,7 @@ class TestProgressMonitor(unittest.TestCase):
     """
     Test factory method.
     """
-    from pylith.problems.ProgressMonitor import progress_monitor
+    from pylith.problems.ProgressMonitorStep import progress_monitor
     m = progress_monitor()
     return
 
diff --git a/unittests/pytests/problems/TestProgressMonitor.py b/unittests/pytests/problems/TestProgressMonitorTime.py
similarity index 81%
copy from unittests/pytests/problems/TestProgressMonitor.py
copy to unittests/pytests/problems/TestProgressMonitorTime.py
index 50c623f..9b91c83 100644
--- a/unittests/pytests/problems/TestProgressMonitor.py
+++ b/unittests/pytests/problems/TestProgressMonitorTime.py
@@ -16,25 +16,25 @@
 # ======================================================================
 #
 
-## @file unittests/pytests/problems/TestProgressMonitor.py
+## @file unittests/pytests/problems/TestProgressMonitorTime.py
 
-## @brief Unit testing of ProgressMonitor object.
+## @brief Unit testing of ProgressMonitorTime object.
 
 import unittest
-from pylith.problems.ProgressMonitor import ProgressMonitor
+from pylith.problems.ProgressMonitorTime import ProgressMonitorTime
 
 from pyre.units.time import year
 
 # ----------------------------------------------------------------------
-class TestProgressMonitor(unittest.TestCase):
+class TestProgressMonitorTime(unittest.TestCase):
   """
-  Unit testing of ProgressMonitor object.
+  Unit testing of ProgressMonitorTime object.
   """
 
   def setUp(self):
-    self.monitor = ProgressMonitor()
+    self.monitor = ProgressMonitorTime()
     self.monitor._configure()
-    self.monitor.filename = "data/progress.txt"
+    self.monitor.filename = "data/progress_time.txt"
     return
   
 
@@ -42,7 +42,7 @@ class TestProgressMonitor(unittest.TestCase):
     """
     Test constructor.
     """
-    monitor = ProgressMonitor()
+    monitor = ProgressMonitorTime()
     monitor._configure()
     return
 
@@ -94,7 +94,7 @@ class TestProgressMonitor(unittest.TestCase):
     """
     Test factory method.
     """
-    from pylith.problems.ProgressMonitor import progress_monitor
+    from pylith.problems.ProgressMonitorTime import progress_monitor
     m = progress_monitor()
     return
 
diff --git a/unittests/pytests/problems/data/Makefile.am b/unittests/pytests/problems/data/Makefile.am
index 3caa37d..6318f00 100644
--- a/unittests/pytests/problems/data/Makefile.am
+++ b/unittests/pytests/problems/data/Makefile.am
@@ -20,7 +20,8 @@ dist_noinst_DATA = \
 	timesteps.txt
 
 noinst_TMP = \
-	progress.txt
+	progress_time.txt \
+	progress_step.txt
 
 # 'export' the input files by performing a mock install
 export_datadir = $(top_builddir)/unittests/pytests/problems/data
diff --git a/unittests/pytests/problems/testproblems.py b/unittests/pytests/problems/testproblems.py
index 7156503..3799c09 100755
--- a/unittests/pytests/problems/testproblems.py
+++ b/unittests/pytests/problems/testproblems.py
@@ -78,6 +78,12 @@ class TestApp(Script):
     from TestProgressMonitor import TestProgressMonitor
     suite.addTest(unittest.makeSuite(TestProgressMonitor))
 
+    from TestProgressMonitorTime import TestProgressMonitorTime
+    suite.addTest(unittest.makeSuite(TestProgressMonitorTime))
+
+    from TestProgressMonitorStep import TestProgressMonitorStep
+    suite.addTest(unittest.makeSuite(TestProgressMonitorStep))
+
     return suite
 
 



More information about the CIG-COMMITS mailing list