The compile-time configuration of the solvers used in AMGCL is not always
convenient, especially if the solvers are used inside a software package or
another library. That is why AMGCL provides runtime interface, which allows to
postpone the configuration until, well, runtime. The classes inside
amgcl::runtime namespace correspond to their compile-time
alternatives, but the only template parameter they have is the backend to use.

Since there is no way of knowing the parameter structure at compile time, the
runtime classes accept parameters only in form of
boost::property_tree::ptree. The actual components of the method are set
through the parameter tree as well. The runtime interface provides some
enumerations for this purpose. For example, to select smoothed aggregation for
coarsening, we could do this:

prm is an instance of boost::property_tree::ptree class.
The property tree may contain parameters “coarsening.type” and
“relax.type”. Default values are
amgcl::runtime::coarsening::smoothed_aggregation and
runtime::relaxation::spai0.
The rest of the property tree should copy the structure of
the corresponding amgcl::amg::params struct. For example, when
smoothed aggregation is selected for coarsening, one could:

prm.put("coarsening.aggr.eps_strong",1e-2);

Note

Any parameters that are not relevant to the selected AMG
components are silently ignored.

Computes the solution for the given system matrix A and the right-hand side rhs. Returns the number of iterations made and the achieved residual as a boost::tuple. The solution vector x provides initial approximation in input and holds the computed solution on output.

The system matrix may differ from the matrix used during
initialization. This may be used for the solution of non-stationary
problems with slowly changing coefficients. There is a strong chance
that a preconditioner built for a time step will act as a reasonably
good preconditioner for several subsequent time steps [DeSh12].

Computes the solution for the given right-hand side rhs. The system matrix is the same that was used for the setup of the preconditioner P. Returns the number of iterations made and the achieved residual as a boost::tuple. The solution vector x provides initial approximation in input and holds the computed solution on output.