Skip to content
Snippets Groups Projects
solverfactory.hh 2.01 KiB
Newer Older
podlesny's avatar
.  
podlesny committed
#ifndef SRC_SPATIAL_SOLVING_SOLVERFACTORY_HH
#define SRC_SPATIAL_SOLVING_SOLVERFACTORY_HH

podlesny's avatar
.  
podlesny committed
//#define NEW_TNNMG_COMPUTE_ITERATES_DIRECTLY
podlesny's avatar
podlesny committed

podlesny's avatar
.  
podlesny committed
#include <dune/common/bitsetvector.hh>
#include <dune/common/parametertree.hh>

#include <dune/solvers/norms/energynorm.hh>
#include <dune/solvers/solvers/loopsolver.hh>
podlesny's avatar
.  
podlesny committed
#include <dune/solvers/iterationsteps/cgstep.hh>
podlesny's avatar
.  
podlesny committed

podlesny's avatar
podlesny committed
#include <dune/tnnmg/iterationsteps/tnnmgstep.hh>
podlesny's avatar
podlesny committed
#include <dune/tnnmg/iterationsteps/nonlineargsstep.hh>
#include <dune/tnnmg/projections/obstacledefectprojection.hh>
podlesny's avatar
podlesny committed
#include <dune/tnnmg/localsolvers/scalarobstaclesolver.hh>
podlesny's avatar
.  
podlesny committed

podlesny's avatar
podlesny committed
#include "tnnmg/linearization.hh"
#include "tnnmg/linesearchsolver.hh"
#include "tnnmg/localbisectionsolver.hh"
podlesny's avatar
.  
podlesny committed

podlesny's avatar
podlesny committed
template <class FunctionalTEMPLATE, class BitVectorType>
podlesny's avatar
podlesny committed
class SolverFactory {
public:
    using Functional = FunctionalTEMPLATE;
    using Matrix = typename Functional::Matrix;
    using Vector = typename Functional::Vector;
    using BitVector = BitVectorType;
podlesny's avatar
podlesny committed
    using LocalSolver = LocalBisectionSolver;
    using NonlinearSmoother = Dune::TNNMG::NonlinearGSStep<Functional, LocalBisectionSolver, BitVector>;
podlesny's avatar
.  
podlesny committed
    using Linearization = Linearization<Functional, BitVector>;
podlesny's avatar
podlesny committed
    using DefectProjection = typename Dune::TNNMG::ObstacleDefectProjection;

podlesny's avatar
podlesny committed
    using Step = Dune::TNNMG::TNNMGStep<Functional, BitVector, Linearization, DefectProjection, LineSearchSolver>;
podlesny's avatar
.  
podlesny committed

podlesny's avatar
.  
podlesny committed
  SolverFactory(const Dune::ParameterTree&,
podlesny's avatar
.  
podlesny committed
                Functional&,
podlesny's avatar
podlesny committed
                const BitVector&);

podlesny's avatar
podlesny committed
  SolverFactory(const Dune::ParameterTree&,
                std::shared_ptr<Functional>,
                const BitVector&);

podlesny's avatar
podlesny committed
  template <class LinearSolver>
  void build(std::shared_ptr<LinearSolver>& linearSolver);
podlesny's avatar
.  
podlesny committed

podlesny's avatar
podlesny committed
  void setProblem(Vector& x);
podlesny's avatar
.  
podlesny committed

podlesny's avatar
podlesny committed
  auto step() -> std::shared_ptr<Step>;
podlesny's avatar
.  
podlesny committed

podlesny's avatar
.  
podlesny committed
private:
podlesny's avatar
podlesny committed
  const Dune::ParameterTree& parset_;

podlesny's avatar
podlesny committed
  Vector dummyIterate_;
  std::shared_ptr<const Functional> J_;
podlesny's avatar
podlesny committed
  const BitVector& ignoreNodes_;
podlesny's avatar
.  
podlesny committed

podlesny's avatar
podlesny committed
  // nonlinear smoother
  std::shared_ptr<NonlinearSmoother> nonlinearSmoother_;
podlesny's avatar
podlesny committed
  // TNNMGStep
  std::shared_ptr<Step> tnnmgStep_;
podlesny's avatar
.  
podlesny committed
};
podlesny's avatar
.  
podlesny committed

podlesny's avatar
.  
podlesny committed
#endif