本文整理匯總了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 )