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