← Back to team overview

dolfin team mailing list archive

Re: linear solvers

 

On Mon, May 31, 2010 at 01:58:08PM +0100, Garth N. Wells wrote:
>
>
> On 31/05/10 13:50, Anders Logg wrote:
> >On Mon, May 31, 2010 at 01:17:15PM +0100, Garth N. Wells wrote:
> >>At the moment, a linear solver is not associated with a particular
> >>matrix. This makes it awkward and dangerous to re-use
> >>preconditioners, factorisations, etc. I suggest that we change the
> >>interface of the linear solver classes to accept a matrix at
> >>construction, and that the solvers maintain a (smart) pointer to the
> >>matrix. Opinions?
> >
> >It feels awkward to associate a linear solver with a specific system.
> >
>
> Why is that? All our la backends do it. It seems natural to me since
> solving a linear system involves a number of data structures which
> are specific to the matrix.

Would would the interface look like?

  LinearSolver solver(A);
  solver.parameters["preconditioner"] = "amg";

  solver.solve(x, b); ?
  x = solver.solve(b); ?

The other option would be to introduce a class LinearSystem:

  LinearSystem system(A, b);
  x = system.solve();

That would be analogous to VariationalProblem:

  VariationalProblem problem(a, L);
  u = problem.solve()

Looks like there are three options:

  1. LinearSolver / VariationalSolver
  2. LinearSystem / VariationalProblem
  3. Both 1 and 2

--
Anders


> Garth
>
> >One option would be to have both Problem and Solver classes for linear
> >systems.
> >
> >This is also related to the following blueprint that addresses the
> >issue of the inconsistency between the interfaces for linear systems
> >and variational problems:
> >
> >   https://blueprints.launchpad.net/dolfin/+spec/solver-interfaces
> >
>

Attachment: signature.asc
Description: Digital signature


Follow ups

References