本文整理汇总了Python中anuga.Domain.update_timestep方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.update_timestep方法的具体用法?Python Domain.update_timestep怎么用?Python Domain.update_timestep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类anuga.Domain
的用法示例。
在下文中一共展示了Domain.update_timestep方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_timestep
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import update_timestep [as 别名]
def update_timestep(self, yieldstep, finaltime):
"""Calculate local timestep
"""
generic_comms.communicate_flux_timestep(self, yieldstep, finaltime)
Domain.update_timestep(self, yieldstep, finaltime)
示例2: update_timestep
# 需要导入模块: from anuga import Domain [as 别名]
# 或者: from anuga.Domain import update_timestep [as 别名]
def update_timestep(self, yieldstep, finaltime):
#LINDA:
# moved the calculation so that it is done after timestep
# has been broadcast
# # Calculate local timestep
# Domain.update_timestep(self, yieldstep, finaltime)
import time
t0 = time.time()
# For some reason it looks like pypar only reduces numeric arrays
# hence we need to create some dummy arrays for communication
ltimestep = num.ones( 1, num.float )
ltimestep[0] = self.flux_timestep
gtimestep = num.zeros( 1, num.float ) # Buffer for results
#ltimestep = self.flux_timeste
#print self.processor, ltimestep, gtimestep
gtimestep = pypar.reduce(ltimestep, pypar.MIN, 0, buffer=gtimestep)
#print self.processor, ltimestep, gtimestep
pypar.broadcast(gtimestep,0)
#print self.processor, ltimestep, gtimestep
self.flux_timestep = gtimestep[0]
self.communication_reduce_time += time.time()-t0
# LINDA:
# Now update time stats
# Calculate local timestep
Domain.update_timestep(self, yieldstep, finaltime)