sfepy.solvers.solvers module

Base (abstract) solver classes.

class sfepy.solvers.solvers.EigenvalueSolver(conf, mtx_a=None, mtx_b=None, n_eigs=None, eigenvectors=None, status=None, context=None, **kwargs)[source]

Abstract eigenvalue solver class.

class sfepy.solvers.solvers.LinearSolver(conf, mtx=None, status=None, context=None, **kwargs)[source]

Abstract linear solver class.


Return tuple (eps_a, eps_r) of absolute and relative tolerance settings. Either value can be None, meaning that the solver does not use that setting.

class sfepy.solvers.solvers.NonlinearSolver(conf, fun=None, fun_grad=None, lin_solver=None, iter_hook=None, status=None, context=None, **kwargs)[source]

Abstract nonlinear solver class.

class sfepy.solvers.solvers.OptimizationSolver(conf, obj_fun=None, obj_fun_grad=None, status=None, obj_args=None, context=None, **kwargs)[source]

Abstract optimization solver class.

class sfepy.solvers.solvers.QuadraticEVPSolver(conf, mtx_m=None, mtx_d=None, mtx_k=None, n_eigs=None, eigenvectors=None, status=None, context=None, **kwargs)[source]

Abstract quadratic eigenvalue problem solver class.

class sfepy.solvers.solvers.Solver(conf=None, context=None, **kwargs)[source]

Base class for all solver kinds. Takes care of processing of common configuration options.

The factory method any_from_conf() can be used to create an instance of any subclass.

The subclasses have to reimplement __init__() and __call__().

All solvers use the following configuration parameters:


The name referred to in problem description options.


The solver kind, as given by the name class attribute of the Solver subclasses.

report_statusbool (default: False)

If True, the solver can report the solution status.

verbosebool (default: False)

If True, the solver can print more information about the solution.

static any_from_conf(conf, **kwargs)

Create an instance of a solver class according to the configuration.


Build the kwargs dict for the underlying solver function using the extra options (marked by ‘*’ in _parameters) in conf. The declared parameters are omitted.

classmethod process_conf(conf, kwargs)[source]

Process configuration parameters.

set_field_split(field_ranges, **kwargs)[source]
class sfepy.solvers.solvers.SolverMeta(name, bases, ndict)[source]

Metaclass for solver classes that automatically adds configuration parameters to the solver class docstring from the _parameters class attribute.

class sfepy.solvers.solvers.TimeStepController(conf, **kwargs)[source]

Abstract time step controller class.

get_initial_dt(ts, vec, **kwargs)[source]
class sfepy.solvers.solvers.TimeSteppingSolver(conf, nls=None, status=None, tsc=None, context=None, **kwargs)[source]

Abstract time stepping solver class.

sfepy.solvers.solvers.format_next(text, new_text, pos, can_newline, width, ispaces)[source]
sfepy.solvers.solvers.make_get_conf(conf, kwargs)[source]
sfepy.solvers.solvers.make_option_docstring(name, kind, default, required, doc)[source]
sfepy.solvers.solvers.typeset_to_indent(txt, indent, width)[source]
sfepy.solvers.solvers.use_first_available(solver_list, context=None, **kwargs)[source]

Use the first available solver from solver_list.

solver_listlist of str or Struct

The list of solver names or configuration objects.

contextobject, optional

An optional solver context to pass to the solver.

**kwargskeyword arguments

Additional solver options, see the particular __init__() methods.


The first available solver.