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


Python SolutionFields.cleanup方法代码示例

本文整理汇总了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
开发者ID:youngsolar,项目名称:pylith,代码行数:104,代码来源:Formulation.py


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