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

Source Code for Module PyFoam.LogAnalysis.TimeLineAnalyzer

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