Package PyFoam :: Package Execution :: Module StepAnalyzedCommon
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Execution.StepAnalyzedCommon

 1  #  ICE Revision: $Id: StepAnalyzedCommon.py 7581 2007-06-27 15:29:14Z bgschaid $  
 2  """Common stuff for classes that do something at every timestep""" 
 3   
 4  from AnalyzedCommon import AnalyzedCommon 
 5  from time import time 
 6   
 7   
8 -class StepAnalyzedCommon(AnalyzedCommon):
9 """Stuff is performed forevery timestep in the file""" 10
11 - def __init__(self,filename,analyzer,smallestFreq=0.):
12 """@param smallestFreq: the smallest intervall of real time (in seconds) that the time change is honored""" 13 AnalyzedCommon.__init__(self,filename,analyzer) 14 15 analyzer.addTimeListener(self) 16 self.freq=smallestFreq 17 self.oldtime=0.
18
19 - def timeChanged(self):
20 """React to a change of the simulation time in the log""" 21 now=time() 22 if (now-self.oldtime)>self.freq: 23 self.oldtime=now 24 self.timeHandle()
25
26 - def timeHandle(self):
27 """Handler that reacts to the change of time. To be overridden be sub-classes""" 28 pass
29