From d474b99b9a5102054f91ad031125ab09537fbb39 Mon Sep 17 00:00:00 2001
From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de>
Date: Wed, 18 Jan 2023 11:36:39 +0100
Subject: [PATCH] Test to use a 1x1 matrix with the
 DuneFunctionsOperatorAssembler and PoweBases

---
 dune/elasticity/common/trustregionsolver.cc | 12 ++++++------
 dune/elasticity/common/trustregionsolver.hh |  5 +++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dune/elasticity/common/trustregionsolver.cc b/dune/elasticity/common/trustregionsolver.cc
index ef683c5..5627ade 100644
--- a/dune/elasticity/common/trustregionsolver.cc
+++ b/dune/elasticity/common/trustregionsolver.cc
@@ -121,7 +121,7 @@ setup(const typename BasisType::GridView::Grid& grid,
     // //////////////////////////////////////////////////////////////////////////////////////
 
 
-    MatrixType localA;
+    ScalarMatrixType localA;
 
     Dune::Fufem::DuneFunctionsOperatorAssembler operatorAssembler(basis,basis);
 
@@ -129,24 +129,24 @@ setup(const typename BasisType::GridView::Grid& grid,
 
     operatorAssembler.assembleBulk(Dune::Fufem::istlMatrixBackend(localA), laplaceStiffness);
 
-    MatrixType* A = new MatrixType(localA);
+    ScalarMatrixType* A = new ScalarMatrixType(localA);
 
-    h1SemiNorm_ = std::make_shared<EnergyNorm<MatrixType, CorrectionType> >(*A);
+    h1SemiNorm_ = std::make_shared<EnergyNorm<ScalarMatrixType, CorrectionType> >(*A);
 
     // //////////////////////////////////////////////////////////////////////////////////////
     //   Assemble a mass matrix to create a norm that's equivalent to the L2-norm
     //   This will be used to monitor the gradient
     // //////////////////////////////////////////////////////////////////////////////////////
 
-    MatrixType localMassMatrix;
+    ScalarMatrixType localMassMatrix;
 
     Dune::Fufem::MassAssembler massStiffness;
 
     operatorAssembler.assembleBulk(Dune::Fufem::istlMatrixBackend(localMassMatrix), massStiffness);
 
-    MatrixType* massMatrix = new MatrixType(localMassMatrix);
+    ScalarMatrixType* massMatrix = new ScalarMatrixType(localMassMatrix);
 
-    l2Norm_ = std::make_shared<EnergyNorm<MatrixType, CorrectionType> >(*massMatrix);
+    l2Norm_ = std::make_shared<EnergyNorm<ScalarMatrixType, CorrectionType> >(*massMatrix);
 
     // ////////////////////////////////////////////////////////////
     //    Create Hessian matrix and its occupation structure
diff --git a/dune/elasticity/common/trustregionsolver.hh b/dune/elasticity/common/trustregionsolver.hh
index fcd49fd..c80b181 100644
--- a/dune/elasticity/common/trustregionsolver.hh
+++ b/dune/elasticity/common/trustregionsolver.hh
@@ -62,6 +62,7 @@ class TrustRegionSolver
 
     // Some types that I need
     typedef Dune::BCRSMatrix<Dune::FieldMatrix<field_type, blocksize, blocksize> > MatrixType;
+    typedef Dune::BCRSMatrix<Dune::FieldMatrix<field_type,1,1> >                   ScalarMatrixType;
     typedef Dune::BlockVector<Dune::FieldVector<field_type, blocksize> >           CorrectionType;
     typedef VectorType                                                             SolutionType;
 
@@ -164,10 +165,10 @@ protected:
     std::shared_ptr<const Dune::BitSetVector<blocksize> > ignoreNodes_;
 
     /** \brief The norm used to measure multigrid convergence */
-    std::shared_ptr<EnergyNorm<MatrixType,CorrectionType> > h1SemiNorm_;
+    std::shared_ptr<EnergyNorm<ScalarMatrixType,CorrectionType> > h1SemiNorm_;
 
     /** \brief An L2-norm, really.  The H1SemiNorm class is badly named */
-    std::shared_ptr<EnergyNorm<MatrixType,CorrectionType> > l2Norm_;
+    std::shared_ptr<EnergyNorm<ScalarMatrixType,CorrectionType> > l2Norm_;
 
 };
 
-- 
GitLab