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 - def setLogname(self,
28 default="PyFoamRunner",
29 useApplication=True):
30 """Builds a logfile-name
31 @param default: Default value if no prefix for the logfile-has been defined
32 @param useApplication: append the name of the application to the prefix"""
33
34 if self.opts.logname==None:
35 self.opts.logname=default
36 if useApplication:
37 self.opts.logname+="."+path.basename(self.parser.getArgs()[0])
38