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


Python Level.state方法代码示例

本文整理汇总了Python中level.Level.state方法的典型用法代码示例。如果您正苦于以下问题:Python Level.state方法的具体用法?Python Level.state怎么用?Python Level.state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在level.Level的用法示例。


在下文中一共展示了Level.state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_level

# 需要导入模块: from level import Level [as 别名]
# 或者: from level.Level import state [as 别名]
  def add_level(self, feval, sdc, interpolate=None, restrict=None):
    """Add a level to the PFASST hierarchy.

    :param feval: implicit/explicit function evaluator (instance
            of :class:`pfasst.feval.FEval`)
    :param sdc: implicit/explicit SDC sweeper (instance
            of :class:`pfasst.sdc.SDC`)
    :param interpolate: interpolate from coarser level to this
            level (callable)
    :param restrict: restrict from this level to coarser level
            (callable)

    Levels should be added from finest (level 0) to coarest.

    The *interpolate* callable is called as::

    >>> interpolate(yF, yG, fevalF=fevaF, fevalG=fevalG, **kwargs)

    and should interpolate the coarse y values *yG* that
    correspond to the coarse evaluator *fevalG* to the fine y
    values *yF* that correspond to the fine evaluator *fevalF*.
    The (flattened) result should be stored in *yF*.

    The *restrict* callable is called as::

    >>> restrict(yF, yG, fevalF=fevalF, fevalG=fevalG, **kwargs)

    and should restrict the fine y values *yF* that correspond to
    the fine evaluator *fevalF* to the coarse y values *yG* that
    correspond to the coarse evaluator *fevalG*.  The (flattened)
    result should be stored in *yG*.

    """

    level = Level()

    level.feval       = feval
    level.sdc         = sdc
    level.interpolate = interpolate
    level.restrict    = restrict

    level.level       = len(self.levels)
    level.mpi         = self.mpi
    level.state       = self.state
    level.hooks       = {}
    level.sweeps      = 1

    self.levels.append(level)
开发者ID:mlminion,项目名称:PyPFASST,代码行数:50,代码来源:pfasst.py


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