Skip to content
Snippets Groups Projects

simplify and cleanup the SolverFactory

Merged Nils-Arne Dreier requested to merge simplify_solverfactory into master

This MR simplifies the SolverFactory. This includes the following changes:

  • Unification of the creator interface. All creators (solvers and preconditioners) now get the new type OperatorTraits and a shared_ptr<LinearOperator<X,Y>>. This has the advantage, that all available information is passed to the creator and can be accessed easily via the OperatorTraits. In particular, it is also possible for an iterative solver creator to access the matrix. This was not possible before as the actual operator type was not passed to the creator.
  • The OperatorTraits replace the TypeList that was passed to the creators before. This makes the code far more readable as the type can be accessed by their names instead of a list index.
  • Direct and iterative solvers are no longer kept in separate factories. The reason for keeping them separate was the need of the direct solver to access the matrix. This can now be achieved via the OperatorTraits.

Open questions regarding backward-compatibility:

  • Do we need backward compatibility to the old creator interface?
    • For the direct and iterative solvers, we could add easily the old macros DUNE_REGISTER_ITERARIVE_SOLVER and DUNE_REGISTER_DIRECT_SOLVER the wrap a provided old interface creator to the new interface.
    • I'm not sure how to deal with DUNE_REGISTER_PRECONDITIONER.
    • I added the old macros again and make OperatorTraits compatible to TypeList<matrix_tpye, domain_type, range_type> so that the old interface can be used. For the DUNE_REGISTER_ITERATIVE_SOLVER i added a wrapper that translates the creator to the new interface.
  • The method getSolverFromFactory had a third parameter before to inject a precreated preconditioner. This is now a bit more difficult as the preconditioner is created the the creator of the iterative solvers.
    • Possible solution: Add a setPrecondititioner method to the IterativeSolver class, this could then be used to replace the preconditioner of the created iterative solver. With that we could implement a function with the same functionality as before.
    • I solved that by defining the passed preconditioner in the ProconditionerRegistry with a dummy tag (__passed at runtime__)
Edited by Nils-Arne Dreier

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Nils-Arne Dreier resolved all threads

    resolved all threads

  • added 1 commit

    Compare with previous version

  • Nils-Arne Dreier added 50 commits

    added 50 commits

    Compare with previous version

  • Nils-Arne Dreier marked the checklist item The method getSolverFromFactory had a third parameter before to inject a precreated preconditioner. This is now a bit more difficult as the preconditioner is created the the creator of the iterative solvers. as completed

    marked the checklist item The method getSolverFromFactory had a third parameter before to inject a precreated preconditioner. This is now a bit more difficult as the preconditioner is created the the creator of the iterative solvers. as completed

  • I rebased the branch and fixed some issues with the matrix checks of the direct solvers.

  • Nils-Arne Dreier added 14 commits

    added 14 commits

    Compare with previous version

    • Resolved by Christian Engwer

      I cleaned up the creators of the direct solvers further. Now the only question is whether we need backward compatibility for the Register macros DUNE_REGISTER_DIRECT_SOLVER, DUNE_REGISTER_ITERATIVE_SOLVER and DUNE_REGISTER_PRECONDITIONER?

  • added 1 commit

    • 989df116 - add backward comptibility for the DUNE_REGISTER_... macros

    Compare with previous version

  • Nils-Arne Dreier marked the checklist item Do we need backward compatibility to the old creator interface? as completed

    marked the checklist item Do we need backward compatibility to the old creator interface? as completed

  • added 1 commit

    • 0c094f6b - deprecate old register macros

    Compare with previous version

  • We should probably first decide about !421 (merged) and rebase this MR on it.

  • Nils-Arne Dreier mentioned in merge request !421 (merged)

    mentioned in merge request !421 (merged)

  • Nils-Arne Dreier added 26 commits

    added 26 commits

    Compare with previous version

  • Christian Engwer mentioned in merge request !428 (closed)

    mentioned in merge request !428 (closed)

  • Christian Engwer mentioned in merge request !422

    mentioned in merge request !422

  • Nils-Arne Dreier added 18 commits

    added 18 commits

    • 03ff5111...9dae4be7 - 9 commits from branch master
    • 912fcd41 - simplify and cleanup solverfactory
    • bbdb52bc - remove unused code
    • 0f82c750 - fix matrix checks for direct solvers
    • b0ec0224 - fix matrix check for amg
    • d564d2f3 - fix default preconditioner creators
    • aed9ac66 - simplify direct creators
    • 0769adee - add backward comptibility for the DUNE_REGISTER_... macros
    • b0263dfd - deprecate old register macros
    • cc34f834 - assert sequential operator in creators of direct solvers

    Compare with previous version

  • @christi I rebased and added the assertions for sequential operators in the creators of direct solvers.

  • Christian Engwer resolved all threads

    resolved all threads

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading