From c524447fbe6346797f62319ca459e60932646844 Mon Sep 17 00:00:00 2001 From: Oliver Sander <oliver.sander@tu-dresden.de> Date: Thu, 14 May 2020 09:43:23 +0200 Subject: [PATCH] Fix test to always use appropriate power bases Previously, the method constructBoundaryDofs would accept scalar bases together with blocked bit vectors, and would tacitly do The Right Thing. This has changed: Nowadays, the basis really has match the blocking structure of the bit vectors. This means that we have to introduce a second type of power basis: The one that already exists has the dimension of the embedding space. That is correct for sampling initial configurations. However, the Dirichlet values apply to corrections, which live in the tangent space. Therefore, their 'power-order' needs to be the dimension of that, i.e., lower. --- test/harmonicmaptest.cc | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/test/harmonicmaptest.cc b/test/harmonicmaptest.cc index 2dbe7729..1b11a59d 100644 --- a/test/harmonicmaptest.cc +++ b/test/harmonicmaptest.cc @@ -35,9 +35,6 @@ const int dim = 2; // Image space of the geodesic fe functions typedef UnitVector<double,3> TargetSpace; -// Tangent vector of the image space -const int blocksize = TargetSpace::TangentVector::dimension; - const int order = 1; using namespace Dune; @@ -87,6 +84,24 @@ int main (int argc, char *argv[]) FEBasis feBasis(gridView); SolutionType x(feBasis.size()); + using namespace Functions::BasisFactory; + + // A basis for the embedding space + auto powerBasis = makeBasis( + gridView, + power<TargetSpace::CoordinateType::dimension>( + lagrange<order>(), + blockedInterleaved() + )); + + // A basis for the tangent space + auto tangentBasis = makeBasis( + gridView, + power<TargetSpace::TangentVector::dimension>( + lagrange<order>(), + blockedInterleaved() + )); + /////////////////////////////////////////// // Determine Dirichlet values /////////////////////////////////////////// @@ -107,12 +122,12 @@ int main (int argc, char *argv[]) } BoundaryPatch<GridView> dirichletBoundary(gridView, dirichletVertices); - BitSetVector<blocksize> dirichletNodes(feBasis.size(), false); + BitSetVector<TargetSpace::TangentVector::dimension> dirichletNodes(powerBasis.size(), false); #if DUNE_VERSION_LT(DUNE_GEOMETRY, 2, 7) DuneFunctionsBasis<FEBasis> fufemBasis(feBasis); constructBoundaryDofs(dirichletBoundary,fufemBasis,dirichletNodes); #else - constructBoundaryDofs(dirichletBoundary,feBasis,dirichletNodes); + constructBoundaryDofs(dirichletBoundary,tangentBasis,dirichletNodes); #endif //////////////////////////// @@ -127,15 +142,6 @@ int main (int argc, char *argv[]) }; std::vector<TargetSpace::CoordinateType> v; - using namespace Functions::BasisFactory; - - auto powerBasis = makeBasis( - gridView, - power<TargetSpace::CoordinateType::dimension>( - lagrange<order>(), - blockedInterleaved() - )); - Dune::Functions::interpolate(powerBasis, v, initialIterateFunction); for (size_t i=0; i<x.size(); i++) -- GitLab