From 73a507a55d41568e3d06c8d916a24da7afc4956d Mon Sep 17 00:00:00 2001
From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de>
Date: Wed, 12 Jun 2019 17:17:33 +0200
Subject: [PATCH] Use std::make_shared to create the BaseSolver of the
 Trustregion Algorithm

---
 dune/gfe/riemanniantrsolver.cc | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/dune/gfe/riemanniantrsolver.cc b/dune/gfe/riemanniantrsolver.cc
index 8feb344f..927e7b14 100644
--- a/dune/gfe/riemanniantrsolver.cc
+++ b/dune/gfe/riemanniantrsolver.cc
@@ -78,12 +78,17 @@ setup(const GridType& grid,
     QuadraticIPOptSolver<MatrixType,CorrectionType> baseSolver;
     baseSolver.setSolverParameter(baseTolerance, 100, NumProc::QUIET);
 #else
+    // First create a Gauss-seidel base solver
+    auto baseSolverStep = std::make_shared<TrustRegionGSStep<MatrixType, CorrectionType>>();
+
     // Hack: the two-norm may not scale all that well, but it is fast!
-    ::LoopSolver<CorrectionType> baseSolver(TrustRegionGSStep<MatrixType, CorrectionType>{},
-                                                        baseIterations,
-                                                        baseTolerance,
-                                                        TwoNorm<CorrectionType>{},
-                                                        Solver::QUIET);
+    auto baseNorm = std::make_shared<TwoNorm<CorrectionType>>();
+
+    auto baseSolver = std::make_shared<::LoopSolver<CorrectionType>>(baseSolverStep,
+                                                                            baseIterations,
+                                                                            baseTolerance,
+                                                                            baseNorm,
+                                                                            Solver::QUIET);
 #endif
 #if HAVE_MPI
     // Transfer all Dirichlet data to the master processor
-- 
GitLab