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

Source Code for Module PyFoam.Applications.CommonMultiRegion

 1  """ 
 2  Class that implements the common functionality for cases with multiple regions 
 3  """ 
 4   
 5  from optparse import OptionGroup 
 6   
 7  from PyFoam.FoamInformation import oldAppConvention as oldApp 
 8   
9 -class CommonMultiRegion(object):
10 """ The class that looks for multiple mesh regions 11 """ 12
13 - def addOptions(self):
14 grp=OptionGroup(self.parser, 15 "Multiple regions", 16 "Treatment of cases with multiple mesh regions") 17 grp.add_option("--all-regions", 18 action="store_true", 19 default=False, 20 dest="regions", 21 help="Executes the command for all available regions (builds a pseudo-case for each region)") 22 23 grp.add_option("--region", 24 dest="region", 25 default=None, 26 help="Executes the command for a region (builds a pseudo-case for that region)") 27 28 grp.add_option("--keep-pseudocases", 29 action="store_true", 30 default=False, 31 dest="keeppseudo", 32 help="Keep the pseudo-cases that were built for a multi-region case") 33 self.parser.add_option_group(grp)
34 35
36 - def buildRegionArgv(self,case,region):
37 args=self.parser.getArgs()[:] 38 if oldApp(): 39 if region!=None: 40 args[2]+="."+region 41 else: 42 if region!=None: 43 if "-case" in args: 44 args[args.index("-case")+1]=case+"."+region 45 else: 46 args+=["-case",case+"."+region] 47 return args
48