1
2 """Run a non-solver utility"""
3
4 from AnalyzedRunner import AnalyzedRunner
5 from PyFoam.LogAnalysis.UtilityAnalyzer import UtilityAnalyzer
6
8 """To this runner regular expressions can be added. Each line is
9 checked against each regular expression and saved with the
10 corresponding time.
11
12 Each RegEx has a name
13
14 For each pattern group in the RegEx one data value is stored"""
15
16 - def __init__(self,
17 argv=None,
18 silent=False,
19 logname="PyFoamUtility",
20 server=False,
21 restart=False,
22 compressLog=False,
23 noLog=False,
24 remark=None,
25 lam=None,
26 jobId=None):
27 """see BasicRunner"""
28 AnalyzedRunner.__init__(self,UtilityAnalyzer(),
29 argv=argv,
30 silent=silent,
31 logname=logname,
32 server=server,
33 restart=restart,
34 compressLog=compressLog,
35 noLog=noLog,
36 remark=remark,
37 lam=lam,
38 jobId=jobId)
39
40 - def add(self,name,exp,idNr=None):
41 """adds a regular expression
42
43 name - name under whcih the RegExp is known
44 exp - the regular expression
45 idNr - number of the pattern group that is used to make a data
46 set unique"""
47 self.analyzer.addExpression(name,exp,idNr)
48 self.reset()
49
50 - def get(self,name,time=None,ID=None):
51 """get a data set
52
53 name - name of the RegExp
54 time - at which time (if unset the last time is used)
55 ID - the unique ID determined by idNr"""
56 return self.analyzer.getData(name,time=time,ID=ID)
57
59 """get a list of all the IDs"""
60 return self.analyzer.getIDs(name)
61
63 """get a list of all the times that are available for ID"""
64 return self.analyzer.getTimes(name,ID=ID)
65