本文整理汇总了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)
示例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
示例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)
示例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
示例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
示例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
示例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 )
示例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 )