本文整理汇总了Python中PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.addToClone方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionDirectory.addToClone方法的具体用法?Python SolutionDirectory.addToClone怎么用?Python SolutionDirectory.addToClone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory
的用法示例。
在下文中一共展示了SolutionDirectory.addToClone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import addToClone [as 别名]
def run(self):
sName=self.parser.getArgs()[0]
if sName[-1]==path.sep:
sName=sName[:-1]
if self.parser.getOptions().tarname!=None:
dName=self.parser.getOptions().tarname
else:
dName=sName+".tgz"
if self.parser.getOptions().pyfoam:
self.parser.getOptions().additional.append("PyFoam*")
sol=SolutionDirectory(sName,archive=None,paraviewLink=False)
if not sol.isValid():
self.error(sName,"does not look like real OpenFOAM-case because",sol.missingFiles(),"are missing or of the wrong type")
if self.parser.getOptions().chemkin:
sol.addToClone("chemkin")
if self.opts.noPloyMesh:
self.parser.getOptions().exclude.append("polyMesh")
sol.packCase(dName,
last=self.parser.getOptions().last,
additional=self.parser.getOptions().additional,
exclude=self.parser.getOptions().exclude,
base=self.parser.getOptions().basename)
示例2: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import addToClone [as 别名]
def run(self):
if len(self.parser.getArgs())>2:
error("Too many arguments:",self.parser.getArgs()[2:],"can not be used")
sName=self.parser.getArgs()[0]
dName=self.parser.getArgs()[1]
if path.exists(dName):
if self.parser.getOptions().force:
warning("Replacing",dName,"(--force option)")
elif path.exists(path.join(dName,"system","controlDict")):
error("Destination",dName,"already existing and a Foam-Case")
elif path.isdir(dName):
dName=path.join(dName,path.basename(sName))
if path.exists(dName) and not self.parser.getOptions().force:
error(dName,"already existing")
elif not path.exists(path.dirname(dName)):
warning("Directory",path.dirname(dName),"does not exist. Creating")
sol=SolutionDirectory(sName,
archive=None,
paraviewLink=False,
addLocalConfig=True,
parallel=self.opts.parallel)
if sol.determineVCS()!=None and self.opts.vcs:
if self.opts.chemkin or self.opts.additional or self.opts.latest:
self.error("Using an unimplemented option together with VCS")
vcsInter=getVCS(sol.determineVCS(),
path=sol.name)
vcsInter.clone(dName)
return
if self.parser.getOptions().chemkin:
sol.addToClone("chemkin")
if self.parser.getOptions().dopyfoam:
sol.addToClone("customRegexp")
for a in self.parser.getOptions().additional:
sol.addToClone(a)
if self.parser.getOptions().latest:
sol.addToClone(sol.getLast())
if self.opts.symlinkMode:
sol.symlinkCase(
dName,
followSymlinks=self.parser.getOptions().followSymlinks,
maxLevel=self.opts.symlinkLevel,
relPath=self.opts.symlinkRelative
)
else:
sol.cloneCase(
dName,
followSymlinks=self.parser.getOptions().followSymlinks
)
self.addToCaseLog(dName,"Cloned to",dName)
示例3: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import addToClone [as 别名]
#.........这里部分代码省略.........
# "wallclocktime","cputime","cputimeuser","cputimesystem","maxmemory","cpuusage","speedup"]
for nr,description,solver,case,prepare,control,preControl,base,weight,additional,utilities,split,toRemove,setInit,decomposition in benchCases:
# control.append( ("endTime",-2000) )
print "Running Benchmark: ",description
print "Solver: ",solver
print "Case: ",case
caseName=solver+"_"+case+"_"+benchName+"."+uname()[1]+".case"
print "Short name: ",caseName
caseDir=caseName+".runDir"
csv["description"]=description
csv["solver"]=solver
csv["case"]=case
csv["caseDir"]=caseDir
csv["base"]=base
csv["benchmark"]=benchName
csv["machine"]=uname()[1]
csv["arch"]=uname()[4]
if lam==None:
csv["cpus"]=1
else:
csv["cpus"]=lam.cpuNr()
csv["os"]=uname()[0]
csv["version"]=uname()[2]
workDir=path.realpath(path.curdir)
orig=SolutionDirectory(path.join(casesDirectory,solver,case),
archive=None,
paraviewLink=False)
for a in additional+utilities:
orig.addToClone(a)
orig.cloneCase(path.join(workDir,caseDir))
if oldApp():
argv=[solver,workDir,caseDir]
else:
argv=[solver,"-case",path.join(workDir,caseDir)]
run=BasicRunner(silent=True,argv=argv,logname="BenchRunning",lam=lam)
runDir=run.getSolutionDirectory()
controlFile=ParameterFile(runDir.controlDict())
for name,value in preControl:
print "Setting parameter",name,"to",value,"in controlDict"
controlFile.replaceParameter(name,value)
for rm in toRemove:
fn=path.join(caseDir,rm)
print "Removing file",fn
remove(fn)
for field,bc,val in setInit:
print "Setting",field,"on",bc,"to",val
SolutionFile(runDir.initialDir(),field).replaceBoundary(bc,val)
oldDeltaT=controlFile.replaceParameter("deltaT",0)
for u in utilities:
print "Building utility ",u
execute("wmake 2>&1 >%s %s" % (path.join(caseDir,"BenchCompile."+u),path.join(caseDir,u)))
print "Preparing the case: "
if lam!=None:
示例4: execute
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import addToClone [as 别名]
def execute(self,para,log):
print_(" Copy last result")
sol=SolutionDirectory(para["case"],archive=None)
sol.addToClone(sol.getLast())
sol.cloneCase(path.join(para["results"],para["id"]))
return True,None
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder-other-scripting-PyFoam,代码行数:8,代码来源:Comparator.py