當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。