当前位置: 首页>>代码示例>>Python>>正文


Python SolutionDirectory.polyMeshDir方法代码示例

本文整理汇总了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")
开发者ID:LeeRuns,项目名称:PyFoam,代码行数:58,代码来源:MeshInformation.py

示例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")
开发者ID:LeeRuns,项目名称:PyFoam,代码行数:40,代码来源:MeshUtilityRunner.py


注:本文中的PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.polyMeshDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。