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