1
2 """
3 Application class that implements pyFoamUtilityRunner
4 """
5
6 from PyFoamApplication import PyFoamApplication
7
8 from PyFoam.FoamInformation import changeFoamVersion
9
10 from PyFoam.Execution.UtilityRunner import UtilityRunner
11
12 import sys
13 from os import path
14
17 description="""
18 Runs a OpenFoam Utility and analyzes the output. Needs a regular
19 expression to look for. The next 3 arguments are the usual OpenFoam
20 argumens (<solver> <directory> <case>) and passes them on (plus
21 additional arguments). Output is sent to stdout and a logfile inside
22 the case directory (PyFoamUtility.logfile). The Directory
23 PyFoamUtility.analyzed contains a file test with the information of
24 the regexp (the pattern groups).
25 """
26
27 PyFoamApplication.__init__(self,
28 exactNr=False,
29 args=args,
30 description=description)
31
33 self.parser.add_option("-r",
34 "--regexp",
35 type="string",
36 dest="regexp",
37 help="The regular expression to look for")
38
39 self.parser.add_option("-n",
40 "--name",
41 type="string",
42 dest="name",
43 default="test",
44 help="The name for the resulting file")
45
46 self.parser.add_option("--echo",
47 action="store_true",
48 dest="echo",
49 default=False,
50 help="Echo the result file after the run")
51
52 self.parser.add_option("--silent",
53 action="store_true",
54 dest="silent",
55 default=False,
56 help="Don't print the output of the utility to the console")
57
58 self.parser.add_option("--foamVersion",
59 dest="foamVersion",
60 default=None,
61 help="Change the OpenFOAM-version that is to be used")
62
89