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

Source Code for Module PyFoam.LogAnalysis.TimeLineAnalyzer

 1  #  ICE Revision: $Id: /local/openfoam/Python/PyFoam/PyFoam/LogAnalysis/TimeLineAnalyzer.py 6632 2010-05-30T11:34:57.777395Z bgschaid  $  
 2  """Analyze Line for Time""" 
 3   
 4  import re 
 5  from sys import stdout 
 6   
 7  from LogLineAnalyzer import LogLineAnalyzer 
 8   
 9  from PyFoam import configuration as conf 
10   
11 -class TimeLineAnalyzer(LogLineAnalyzer):
12 """Parses the line for the current time and makes it available to 13 the parent analyzer (who makes it available to all of his 14 children). This side-effect is important for all the other 15 line-analyzers that need the 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(conf().get("SolverOutput","timeRegExp")) 25 self.progress=progress
26
27 - def doAnalysis(self,line):
28 m=self.exp.match(line) 29 if m!=None: 30 try: 31 self.notify(float(m.group(2))) 32 if self.progress and type(self.parent.time)==float: 33 print "\r t = %10g" % self.parent.time, 34 stdout.flush() 35 36 except ValueError: 37 pass
38