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

Source Code for Module PyFoam.Execution.StepAnalyzedCommon

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