Package PyFoam :: Package Applications :: Module CommonStandardOutput
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Applications.CommonStandardOutput

 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   
8 -class CommonStandardOutput(object):
9 """ The class that defines options for standard output 10 """ 11
12 - def addOptions(self,logname=None):
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=logname, 24 help="Name of the logfile") 25 grp.add_option("--compress", 26 action="store_true", 27 dest="compress", 28 default=False, 29 help="Compress the logfile into a gzip file. Possible loss of data if the run fails") 30 grp.add_option("--no-log", 31 action="store_true", 32 dest="noLog", 33 default=False, 34 help="Do not output a log-file") 35 36 self.parser.add_option_group(grp) 37 38 inf=OptionGroup(self.parser, 39 "Run Info", 40 "Additional information about the run") 41 inf.add_option("--remark", 42 dest="remark", 43 default=None, 44 help="Text string with a remark about the run") 45 inf.add_option("--job-id", 46 dest="jobId", 47 default=None, 48 help="Text string with the job-ID of the queuing system (usually unused)") 49 self.parser.add_option_group(inf)
50
51 - def setLogname(self, 52 default="PyFoamRunner", 53 useApplication=True):
54 """Builds a logfile-name 55 @param default: Default value if no prefix for the logfile-has been defined 56 @param useApplication: append the name of the application to the prefix""" 57 58 if self.opts.logname==None: 59 self.opts.logname=default 60 if useApplication: 61 self.opts.logname+="."+path.basename(self.parser.getArgs()[0])
62