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


Python NonlinearSolver.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
    def __init__(self, conf, pmtx=None, prhs=None, comm=None, **kwargs):
        if comm is None:
            try:
                import petsc4py
                petsc4py.init([])
            except ImportError:
                msg = 'cannot import petsc4py!'
                raise ImportError(msg)

        from petsc4py import PETSc as petsc

        converged_reasons = {}
        for key, val in six.iteritems(petsc.SNES.ConvergedReason.__dict__):
            if isinstance(val, int):
                converged_reasons[val] = key

        ksp_converged_reasons = {}
        for key, val in six.iteritems(petsc.KSP.ConvergedReason.__dict__):
            if isinstance(val, int):
                ksp_converged_reasons[val] = key

        NonlinearSolver.__init__(self, conf, petsc=petsc,
                                 pmtx=pmtx, prhs=prhs, comm=comm,
                                 converged_reasons=converged_reasons,
                                 ksp_converged_reasons=ksp_converged_reasons,
                                 **kwargs)
开发者ID:lokik,项目名称:sfepy,代码行数:28,代码来源:nls.py

示例2: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
    def __init__(self, conf, problem, **kwargs):
        NonlinearSolver.__init__(self, conf, **kwargs)

        conf = self.conf

        log = get_logging_conf(conf)
        conf.log = log = Struct(name='log_conf', **log)
        conf.is_any_log = (log.text is not None) or (log.plot is not None)

        conf.problem = problem

        conf = self.conf
        if conf.is_any_log:
            self.log = Log([[r'$||r||$'], ['iteration'],
                            [r'$\gamma$', r'$\max(\delta)$', r'$\max(\tau)$']],
                           xlabels=['', '', 'all iterations'],
                           ylabels=[r'$||r||$', 'iteration', 'stabilization'],
                           yscales=['log', 'linear', 'log'],
                           is_plot=conf.log.plot is not None,
                           log_filename=conf.log.text,
                           formats=[['%.8e'], ['%d'],
                                    ['%.8e', '%.8e', '%.8e']])

        else:
            self.log = None
开发者ID:Nasrollah,项目名称:sfepy,代码行数:27,代码来源:oseen.py

示例3: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
    def __init__(self, conf, pmtx=None, prhs=None, comm=None, **kwargs):
        if comm is None:
            try:
                import petsc4py
                petsc4py.init([])
            except ImportError:
                msg = 'cannot import petsc4py!'
                raise ImportError(msg)

        from petsc4py import PETSc as petsc

        NonlinearSolver.__init__(self, conf, petsc=petsc,
                                 pmtx=pmtx, prhs=prhs, comm=comm, **kwargs)
开发者ID:Gkdnz,项目名称:sfepy,代码行数:15,代码来源:nls.py

示例4: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
    def __init__(self, conf, **kwargs):
        NonlinearSolver.__init__(self, conf, **kwargs)

        conf = self.conf
        if conf.is_any_log:
            self.log = Log([[r'$||r||$'], ['iteration']],
                           xlabels=['', 'all iterations'],
                           ylabels=[r'$||r||$', 'iteration'],
                           yscales=['log', 'linear'],
                           log_filename=conf.log.text,
                           formats=[['%.8e'], ['%d']])

        else:
            self.log = None
开发者ID:LeiDai,项目名称:sfepy,代码行数:16,代码来源:nls.py

示例5: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
    def __init__(self, conf, **kwargs):
        NonlinearSolver.__init__(self, conf, **kwargs)

        conf = self.conf
        if conf.is_any_log:
            self.log = Log(
                [[r"$||r||$"], ["iteration"]],
                xlabels=["", "all iterations"],
                ylabels=[r"$||r||$", "iteration"],
                yscales=["log", "linear"],
                is_plot=conf.log.plot is not None,
                log_filename=conf.log.text,
                formats=[["%.8e"], ["%d"]],
            )

        else:
            self.log = None
开发者ID:taldcroft,项目名称:sfepy,代码行数:19,代码来源:nls.py

示例6: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
    def __init__(self, conf, **kwargs):
        NonlinearSolver.__init__(self, conf, **kwargs)

        conf = self.conf

        log = get_logging_conf(conf)
        conf.log = log = Struct(name='log_conf', **log)
        conf.is_any_log = (log.text is not None) or (log.plot is not None)

        if conf.is_any_log:
            self.log = Log([[r'$||r||$'], ['iteration']],
                           xlabels=['', 'all iterations'],
                           ylabels=[r'$||r||$', 'iteration'],
                           yscales=['log', 'linear'],
                           is_plot=conf.log.plot is not None,
                           log_filename=conf.log.text,
                           formats=[['%.8e'], ['%d']])

        else:
            self.log = None
开发者ID:cheon7886,项目名称:sfepy,代码行数:22,代码来源:nls.py

示例7: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
 def __init__( self, conf, **kwargs ):
     NonlinearSolver.__init__( self, conf, **kwargs )
     self.set_method( self.conf )
开发者ID:mikegraham,项目名称:sfepy,代码行数:5,代码来源:nls.py

示例8: __init__

# 需要导入模块: from sfepy.solvers.solvers import NonlinearSolver [as 别名]
# 或者: from sfepy.solvers.solvers.NonlinearSolver import __init__ [as 别名]
 def __init__( self, conf, **kwargs ):
     NonlinearSolver.__init__( self, conf, **kwargs )
开发者ID:certik,项目名称:sfepy,代码行数:4,代码来源:oseen.py


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