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

Source Code for Module PyFoam.Applications.ClearCase

 1  """ 
 2  Application-class that implements pyFoamClearCase.py 
 3  """ 
 4  from optparse import OptionGroup 
 5   
 6  from PyFoamApplication import PyFoamApplication 
 7   
 8  from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory 
 9   
10 -class ClearCase(PyFoamApplication):
11 - def __init__(self,args=None):
12 description=""" 13 Removes all timesteps but the first from a case-directory. 14 Also removes other data that is generated by sovers/utilities/PyFoam 15 """ 16 PyFoamApplication.__init__(self, 17 args=args, 18 description=description, 19 usage="%prog <caseDirectory>", 20 interspersed=True, 21 changeVersion=False, 22 nr=1, 23 exactNr=False)
24
25 - def addOptions(self):
26 what=OptionGroup(self.parser, 27 "What", 28 "Define what should be cleared") 29 self.parser.add_option_group(what) 30 31 what.add_option("--after", 32 type="float", 33 dest="after", 34 default=None, 35 help="Only remove timesteps after this time") 36 what.add_option("--processor", 37 action="store_true", 38 dest="processor", 39 default=False, 40 help="Keep the processor directories") 41 what.add_option("--no-pyfoam", 42 action="store_false", 43 dest="pyfoam", 44 default=True, 45 help="Keep the PyFoam-specific directories and logfiles") 46 what.add_option("--keep-last", 47 action="store_true", 48 dest="latest", 49 default=False, 50 help="Keep the data from the last time-step")
51
52 - def run(self):
53 for cName in self.parser.getArgs(): 54 sol=SolutionDirectory(cName,archive=None,paraviewLink=False) 55 sol.clear(after=self.parser.getOptions().after, 56 processor=self.parser.getOptions().processor, 57 pyfoam=self.parser.getOptions().pyfoam, 58 keepLast=self.parser.getOptions().latest)
59