本文整理匯總了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