本文整理汇总了Python中pylith.topology.SolutionFields.SolutionFields.cleanup方法的典型用法代码示例。如果您正苦于以下问题:Python SolutionFields.cleanup方法的具体用法?Python SolutionFields.cleanup怎么用?Python SolutionFields.cleanup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylith.topology.SolutionFields.SolutionFields
的用法示例。
在下文中一共展示了SolutionFields.cleanup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Formulation
# 需要导入模块: from pylith.topology.SolutionFields import SolutionFields [as 别名]
# 或者: from pylith.topology.SolutionFields.SolutionFields import cleanup [as 别名]
#.........这里部分代码省略.........
self.jacobianViewer.view(self.jacobian, t, comm)
self._debug.log(resourceUsageString())
return
def _reformResidual(self, t, dt):
"""
Reform residual vector for operator.
"""
from pylith.mpi.Communicator import mpi_comm_world
comm = mpi_comm_world()
if 0 == comm.rank:
self._info.log("Integrating residual term in operator.")
self._eventLogger.stagePush("Reform Residual")
self.updateSettings(self.jacobian, self.fields, t, dt)
self.reformResidual()
self._eventLogger.stagePop()
self._debug.log(resourceUsageString())
return
def _writeData(self, t):
"""
Write data for time t.
"""
logEvent = "%swrite" % self._loggingPrefix
self._eventLogger.eventBegin(logEvent)
for integrator in self.integrators:
integrator.writeData(t, self.fields)
for constraint in self.constraints:
constraint.writeData(t, self.fields)
self._eventLogger.eventEnd(logEvent)
return
def _setupLogging(self):
"""
Setup event logging.
"""
if not "_loggingPrefix" in dir(self):
self._loggingPrefix = ""
from pylith.utils.EventLogger import EventLogger
logger = EventLogger()
logger.className("PDE Formulation")
logger.initialize()
events = ["preinit",
"verify",
"init",
"timestep",
"prestep",
"step",
"poststep",
"write",
"finalize"]
for event in events:
logger.registerEvent("%s%s" % (self._loggingPrefix, event))
stages = ["Reform Jacobian",
"Reform Residual",
"Solve"]
for stage in stages:
logger.registerStage(stage)
self._eventLogger = logger
return
def _modelMemoryUse(self):
"""
Model memory allocation.
"""
self.perfLogger.logFields('Problem', self.fields)
self.perfLogger.logJacobian('Jacobian', 'dummy')
self.perfLogger.logGlobalOrder('GlobalOrder', 'VectorOrder',
self.fields.get('residual'))
for integrator in self.integrators:
self.perfLogger.logQuadrature('Quadrature', integrator.quadrature())
return
def _cleanup(self):
"""
Deallocate PETSc and local data structures.
"""
if not self.jacobian is None:
self.jacobian.cleanup()
if not self.fields is None:
self.fields.cleanup()
if not self.integrators is None:
for integrator in self.integrators:
integrator.cleanup()
return