本文整理汇总了Python中PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory.timeName方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionDirectory.timeName方法的具体用法?Python SolutionDirectory.timeName怎么用?Python SolutionDirectory.timeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory
的用法示例。
在下文中一共展示了SolutionDirectory.timeName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import timeName [as 别名]
def run(self):
files=self.parser.getArgs()[0:]
if len(files)==1 and path.isdir(files[0]):
sol=SolutionDirectory(
self.parser.getArgs()[0],
archive=None,
parallel=self.opts.parallelTimes,
paraviewLink=False)
self.processTimestepOptions(sol)
if len(self.opts.time)<1:
self.error("No time specified")
globStr=self.parser.getArgs()[0]
if self.opts.parallelTimes:
globStr=path.join(globStr,"processor*")
usedTime=sol.timeName(self.opts.time[0])
globStr=path.join(globStr,
usedTime,
"uniform","profiling*")
files=glob(globStr)
print_("Profiling info from time",usedTime)
if len(files)<1:
self.error("No profiling data found")
elif len(files)>1:
lst=[]
for f in files:
lst.append(self.readProfilingInfo(f))
dataAll,children0,root0=lst[0]
for i in dataAll:
d=dataAll[i]
d["totalTimeMin"]=d["totalTime"]
d["totalTimeMax"]=d["totalTime"]
d["callsMin"]=d["calls"]
d["callsMax"]=d["calls"]
for data,children,root in lst[1:]:
if root0!=root or children!=children0 or data.keys()!=dataAll.keys():
self.error("Inconsistent profiling data. Probably not from same run/timestep")
for i in data:
d=data[i]
s=dataAll[i]
s["totalTime"]+=d["totalTime"]
s["totalTimeMin"]=min(s["totalTimeMin"],d["totalTime"])
s["totalTimeMax"]=max(s["totalTimeMax"],d["totalTime"])
s["calls"]+=d["calls"]
s["callsMin"]=min(s["callsMin"],d["calls"])
s["callsMax"]=max(s["callsMax"],d["calls"])
s["childTime"]+=d["childTime"]
for i in dataAll:
d=dataAll[i]
d["totalTime"]=d["totalTime"]/len(lst)
d["childTime"]=d["childTime"]/len(lst)
d["calls"]=d["calls"]/len(lst)
self.printProfilingInfo(dataAll,children,root,True)
else:
data,children,root=self.readProfilingInfo(files[0])
self.printProfilingInfo(data,children,root)
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-Breeder-other-scripting-PyFoam,代码行数:58,代码来源:ListProfilingInfo.py
示例2: doRegion
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import timeName [as 别名]
def doRegion(self,theRegion):
ReST=RestructuredTextHelper(defaultHeading=self.opts.headingLevel)
if self.opts.allRegions:
print_(ReST.buildHeading("Region: ",theRegion,level=self.opts.headingLevel-1))
sol=SolutionDirectory(self.parser.getArgs()[0],
archive=None,
parallel=self.opts.parallel,
paraviewLink=False,
region=theRegion)
if self.opts.all:
self.opts.caseSize=True
self.opts.shortBCreport=True
self.opts.longBCreport=True
self.opts.dimensions=True
self.opts.internal=True
self.opts.linearSolvers=True
self.opts.relaxationFactors=True
self.opts.processorMatrix=True
self.opts.decomposition=True
if self.opts.time:
try:
self.opts.time=sol.timeName(sol.timeIndex(self.opts.time,minTime=True))
except IndexError:
error("The specified time",self.opts.time,"doesn't exist in the case")
print_("Using time t="+self.opts.time+"\n")
needsPolyBoundaries=False
needsInitialTime=False
if self.opts.longBCreport:
needsPolyBoundaries=True
needsInitialTime=True
if self.opts.shortBCreport:
needsPolyBoundaries=True
needsInitialTime=True
if self.opts.dimensions:
needsInitialTime=True
if self.opts.internal:
needsInitialTime=True
if self.opts.decomposition:
needsPolyBoundaries=True
defaultProc=None
if self.opts.parallel:
defaultProc=0
if needsPolyBoundaries:
proc=None
boundary=BoundaryDict(sol.name,
region=theRegion,
time=self.opts.time,
treatBinaryAsASCII=self.opts.treatBinaryAsASCII,
processor=defaultProc)
boundMaxLen=0
boundaryNames=[]
for b in boundary:
if b.find("procBoundary")!=0:
boundaryNames.append(b)
if self.opts.patches!=None:
tmp=boundaryNames
boundaryNames=[]
for b in tmp:
for p in self.opts.patches:
if fnmatch(b,p):
boundaryNames.append(b)
break
if self.opts.expatches!=None:
tmp=boundaryNames
boundaryNames=[]
for b in tmp:
keep=True
for p in self.opts.expatches:
if fnmatch(b,p):
keep=False
break
if keep:
boundaryNames.append(b)
for b in boundaryNames:
boundMaxLen=max(boundMaxLen,len(b))
boundaryNames.sort()
if self.opts.time==None:
procTime="constant"
else:
procTime=self.opts.time
if needsInitialTime:
fields={}
if self.opts.time==None:
try:
time=sol.timeName(0)
except IndexError:
#.........这里部分代码省略.........
示例3: doRegion
# 需要导入模块: from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory [as 别名]
# 或者: from PyFoam.RunDictionary.SolutionDirectory.SolutionDirectory import timeName [as 别名]
def doRegion(self, theRegion):
ReST = RestructuredTextHelper(defaultHeading=self.opts.headingLevel)
if self.opts.allRegions:
print ReST.buildHeading("Region: ", theRegion, level=self.opts.headingLevel - 1)
sol = SolutionDirectory(
self.parser.getArgs()[0], archive=None, parallel=self.opts.parallel, paraviewLink=False, region=theRegion
)
if self.opts.all:
self.opts.caseSize = True
self.opts.shortBCreport = True
self.opts.longBCreport = True
self.opts.dimensions = True
self.opts.internal = True
self.opts.linearSolvers = True
self.opts.relaxationFactors = True
self.opts.processorMatrix = True
self.opts.decomposition = True
if self.opts.time:
try:
self.opts.time = sol.timeName(sol.timeIndex(self.opts.time, minTime=True))
except IndexError:
error("The specified time", self.opts.time, "doesn't exist in the case")
print "Using time t=" + self.opts.time + "\n"
needsPolyBoundaries = False
needsInitialTime = False
if self.opts.longBCreport:
needsPolyBoundaries = True
needsInitialTime = True
if self.opts.shortBCreport:
needsPolyBoundaries = True
needsInitialTime = True
if self.opts.dimensions:
needsInitialTime = True
if self.opts.internal:
needsInitialTime = True
if self.opts.decomposition:
needsPolyBoundaries = True
defaultProc = None
if self.opts.parallel:
defaultProc = 0
if needsPolyBoundaries:
proc = None
boundary = BoundaryDict(sol.name, region=theRegion, time=self.opts.time, processor=defaultProc)
boundMaxLen = 0
boundaryNames = []
for b in boundary:
if b.find("procBoundary") != 0:
boundaryNames.append(b)
if self.opts.patches != None:
tmp = boundaryNames
boundaryNames = []
for b in tmp:
for p in self.opts.patches:
if fnmatch(b, p):
boundaryNames.append(b)
break
if self.opts.expatches != None:
tmp = boundaryNames
boundaryNames = []
for b in tmp:
keep = True
for p in self.opts.expatches:
if fnmatch(b, p):
keep = False
break
if keep:
boundaryNames.append(b)
for b in boundaryNames:
boundMaxLen = max(boundMaxLen, len(b))
boundaryNames.sort()
if self.opts.time == None:
procTime = "constant"
else:
procTime = self.opts.time
if needsInitialTime:
fields = {}
if self.opts.time == None:
try:
time = sol.timeName(0)
except IndexError:
error("There is no timestep in the case")
else:
time = self.opts.time
tDir = sol[time]
#.........这里部分代码省略.........