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

Source Code for Module PyFoam.Execution.StepAnalyzedCommon

 1  #  ICE Revision: $Id: /local/openfoam/Python/PyFoam/PyFoam/Execution/StepAnalyzedCommon.py 6539 2010-05-04T19:25:43.455866Z 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 -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 self.freq>0 and (now-self.oldtime)>self.freq: 22 self.oldtime=now 23 self.timeHandle() 24 if self.doPickling: 25 self.picklePlots()
26
27 - def timeHandle(self):
28 """Handler that reacts to the change of time. To be overridden be sub-classes""" 29 pass
30
31 - def stopHandle(self):
32 if self.doPickling: 33 self.picklePlots(wait=True)
34