1 """
2 Class that implements the common functionality for treatment of the standard output
3 """
4
5 from optparse import OptionGroup
6 from os import path
7
9 """ The class that defines options for standard output
10 """
11
13 grp=OptionGroup(self.parser,
14 "Standard Output",
15 "Treatment of the standard output that is captured from the OpenFOAM-application")
16 grp.add_option("--progress",
17 action="store_true",
18 default=False,
19 dest="progress",
20 help="Only prints the progress of the simulation, but swallows all the other output")
21 grp.add_option("--logname",
22 dest="logname",
23 default=None,
24 help="Name of the logfile")
25 self.parser.add_option_group(grp)
26
27 grp.add_option("--no-log",
28 action="store_true",
29 dest="noLog",
30 default=False,
31 help="Do not output a log-file")
32 self.parser.add_option_group(grp)
33
34 - def setLogname(self,
35 default="PyFoamRunner",
36 useApplication=True):
37 """Builds a logfile-name
38 @param default: Default value if no prefix for the logfile-has been defined
39 @param useApplication: append the name of the application to the prefix"""
40
41 if self.opts.logname==None:
42 self.opts.logname=default
43 if useApplication:
44 self.opts.logname+="."+path.basename(self.parser.getArgs()[0])
45