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 7013 2010-11-21T22:22:06.604864Z bgschaid  $  
 2  """Analyze Line for Time""" 
 3   
 4  import re 
 5   
 6  from LogLineAnalyzer import LogLineAnalyzer 
 7   
 8  from PyFoam import configuration as conf 
 9   
10 -class TimeLineAnalyzer(LogLineAnalyzer):
11 """Parses the line for the current time and makes it available to 12 the parent analyzer (who makes it available to all of his 13 children). This side-effect is important for all the other 14 line-analyzers that need the 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(conf().get("SolverOutput","timeRegExp")) 24 self.progress=progress
25
26 - def doAnalysis(self,line):
27 m=self.exp.match(line) 28 if m!=None: 29 try: 30 self.notify(float(m.group(2))) 31 if self.progress and type(self.parent.time)==float: 32 self.writeProgress("t = %10g" % self.parent.time) 33 34 except ValueError: 35 pass
36