本文整理汇总了Python中PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.polyMeshDir方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionDirectory.polyMeshDir方法的具体用法?Python SolutionDirectory.polyMeshDir怎么用?Python SolutionDirectory.polyMeshDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory
的用法示例。
在下文中一共展示了SolutionDirectory.polyMeshDir方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import polyMeshDir [as 别名]
class MeshInformation:
"""Reads Information about the mesh on demand"""
def __init__(self,
case,
time="constant",
processor=None,
region=None):
"""@param case: Path to the case-directory
@param time: Time for which the mesh should be looked at
@param processor: Name of the processor directory for decomposed cases"""
self.sol=SolutionDirectory(case,paraviewLink=False,archive=None,region=region)
self.time=time
self.processor=processor
def nrOfFaces(self):
try:
return self.faces
except AttributeError:
try:
faces=ListFile(self.sol.polyMeshDir(time=self.time,processor=self.processor),"faces")
self.faces=faces.getSize()
except IOError:
faces=ListFile(self.sol.polyMeshDir(processor=self.processor),"faces")
self.faces=faces.getSize()
return self.faces
def nrOfPoints(self):
try:
return self.points
except AttributeError:
try:
points=ListFile(self.sol.polyMeshDir(time=self.time,processor=self.processor),"points")
self.points=points.getSize()
except IOError:
points=ListFile(self.sol.polyMeshDir(processor=self.processor),"points")
self.points=points.getSize()
return self.points
def nrOfCells(self):
try:
return self.cells
except:
try:
try:
owner=ParsedFileHeader(path.join(self.sol.polyMeshDir(time=self.time,processor=self.processor),"owner"))
except IOError:
owner=ParsedFileHeader(path.join(self.sol.polyMeshDir(processor=self.processor),"owner"))
mat=re.compile('.+nCells: *([0-9]+) .+').match(owner["note"])
self.cells=int(mat.group(1))
return self.cells
except:
raise PyFoamException("Not Implemented")
示例2: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import polyMeshDir [as 别名]
def run(self):
cName=self.parser.casePath()
self.checkCase(cName)
sol=SolutionDirectory(cName,archive=None)
print_("Clearing out old timesteps ....")
sol.clearResults()
self.checkAndCommit(SolutionDirectory(cName,archive=None))
run=BasicRunner(argv=self.parser.getArgs(),
server=self.opts.server,
logname="PyFoamMeshUtility")
self.addLibFunctionTrigger(run,sol)
self.addToCaseLog(cName,"Starting")
run.start()
self.setData(run.data)
sol.reread(force=True)
self.addToCaseLog(cName,"Ending")
if sol.latestDir()!=sol.initialDir():
for f in listdir(path.join(sol.latestDir(),"polyMesh")):
system("mv -f "+path.join(sol.latestDir(),"polyMesh",f)+" "+sol.polyMeshDir())
print_("\nClearing out new timesteps ....")
sol.clearResults()
else:
print_("\n\n No new timestep. Utility propably failed")