Package PyFoam :: Package LogAnalysis :: Module TimeLineAnalyzer
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.LogAnalysis.TimeLineAnalyzer

 1  #  ICE Revision: $Id: TimeLineAnalyzer.py 7581 2007-06-27 15:29:14Z bgschaid $  
 2  """Analyze Line for Time""" 
 3   
 4  import re 
 5  from sys import stdout 
 6   
 7  from LogLineAnalyzer import LogLineAnalyzer 
 8   
9 -class TimeLineAnalyzer(LogLineAnalyzer):
10 """Parses the line for the current time and makes it available to 11 the parent analyzer (who makes it available to all of his 12 children). This side-effect is important for all the other 13 line-analyzers that need the time""" 14 15 timeRegExp="^Time = (.+)$" 16
17 - def __init__(self,progress=False):
18 """ 19 Constructs the analyzer 20 21 @param progress: whether to print the time on the console 22 """ 23 LogLineAnalyzer.__init__(self) 24 self.exp=re.compile(self.timeRegExp) 25 self.progress=progress
26
27 - def doAnalysis(self,line):
28 m=self.exp.match(line) 29 if m!=None: 30 self.parent.setTime(float(m.group(1))) 31 if self.progress: 32 print "\r t = %10g" % self.parent.time, 33 stdout.flush()
34