本文整理汇总了Python中PyFoam.RunDictionary.ParsedParameterFile.ParsedParameterFile.content方法的典型用法代码示例。如果您正苦于以下问题:Python ParsedParameterFile.content方法的具体用法?Python ParsedParameterFile.content怎么用?Python ParsedParameterFile.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.ParsedParameterFile.ParsedParameterFile
的用法示例。
在下文中一共展示了ParsedParameterFile.content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processABoundaryFile
# 需要导入模块: from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile [as 别名]
# 或者: from PyFoam.RunDictionary.ParsedParameterFile.ParsedParameterFile import content [as 别名]
def processABoundaryFile(self,func,targetDir):
"""
@param func: the function that transforms the actual boundary file
"""
boundaryPath=path.join(targetDir,self.opts.region,"polyMesh","boundary")
try:
boundary=ParsedParameterFile(boundaryPath,
debug=False,
boundaryDict=True,
treatBinaryAsASCII=True)
except IOError:
self.warning("Problem opening boundary file",boundaryPath)
return False
bnd=boundary.content
if type(bnd)!=list:
self.warning("Problem with boundary file (not a list)")
return False
boundary.content=func(bnd,targetDir)
if boundary.content:
if self.opts.test:
print_(boundary)
else:
boundary.writeFile()
# self.addToCaseLog(boundaryPath)
return True
else:
self.warning(boundaryPath,"unchanged")
return False
开发者ID:mortbauer,项目名称:openfoam-extend-Breeder-other-scripting-PyFoam,代码行数:34,代码来源:CommonChangeBoundary.py
示例2: upgrade
# 需要导入模块: from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile [as 别名]
# 或者: from PyFoam.RunDictionary.ParsedParameterFile.ParsedParameterFile import content [as 别名]
def upgrade(self,force,printIt):
backup=self.path()+".upgradeBackup"
if not printIt:
if path.exists(backup):
if not force:
error("The backup-file",backup,"does already exist")
copyfile(self.path(),backup)
f=ParsedParameterFile(self.path(),
listDict=self.listDict,
noHeader=self.noHeader)
r=self.manipulate(f.content)
if r:
f.content=r
if not printIt:
f.writeFile()
else:
print_(f)