1
2 """Run a non-solver utility"""
3
4 from PyFoam.Execution.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 logTail=None,
25 remark=None,
26 parameters=None,
27 lam=None,
28 jobId=None):
29 """see BasicRunner"""
30 AnalyzedRunner.__init__(self,UtilityAnalyzer(),
31 argv=argv,
32 silent=silent,
33 logname=logname,
34 server=server,
35 restart=restart,
36 compressLog=compressLog,
37 noLog=noLog,
38 logTail=logTail,
39 remark=remark,
40 parameters=parameters,
41 lam=lam,
42 jobId=jobId)
43
44 - def add(self,name,exp,idNr=None):
45 """adds a regular expression
46
47 name - name under whcih the RegExp is known
48 exp - the regular expression
49 idNr - number of the pattern group that is used to make a data
50 set unique"""
51 self.analyzer.addExpression(name,exp,idNr)
52 self.reset()
53
54 - def get(self,name,time=None,ID=None):
55 """get a data set
56
57 name - name of the RegExp
58 time - at which time (if unset the last time is used)
59 ID - the unique ID determined by idNr"""
60 return self.analyzer.getData(name,time=time,ID=ID)
61
63 """get a list of all the IDs"""
64 return self.analyzer.getIDs(name)
65
67 """get a list of all the times that are available for ID"""
68 return self.analyzer.getTimes(name,ID=ID)
69