diff --git a/dune/gfe/embeddedglobalgfefunction.hh b/dune/gfe/embeddedglobalgfefunction.hh index 1c4100072b368d525a046ec7e568d4e9734d9068..724d82595ce82fd10e640958e4a6bfa38059857a 100644 --- a/dune/gfe/embeddedglobalgfefunction.hh +++ b/dune/gfe/embeddedglobalgfefunction.hh @@ -24,7 +24,7 @@ class EmbeddedGlobalGFEFunction public: typedef B Basis; - typedef typename Basis::LocalFiniteElement LocalFiniteElement; + typedef typename Basis::LocalView::Tree::FiniteElement LocalFiniteElement; typedef typename Basis::GridView GridView; typedef typename GridView::template Codim<0>::Entity Element; typedef typename GridView::Grid::ctype ctype; @@ -41,7 +41,7 @@ public: //! Create global function by a global basis and the corresponding coefficient vector EmbeddedGlobalGFEFunction(const Basis& basis, const std::vector<TargetSpace>& coefficients) : - VirtualGridViewFunction<typename B::GridView, typename TargetSpace::CoordinateType>(basis.getGridView()), + VirtualGridViewFunction<typename B::GridView, typename TargetSpace::CoordinateType>(basis.gridView()), basis_(basis), coefficients_(coefficients) {} @@ -56,16 +56,21 @@ public: /** \brief Evaluate the function at local coordinates. */ typename TargetSpace::CoordinateType operator()(const Element& element, const Dune::FieldVector<ctype,gridDim>& local) const { - int numOfBaseFct = basis_.getLocalFiniteElement(element).localBasis().size(); + auto localView = basis_.localView(); + auto localIndexSet = basis_.localIndexSet(); + localView.bind(element); + localIndexSet.bind(localView); + + auto numOfBaseFct = localIndexSet.size(); // Extract local coefficients std::vector<TargetSpace> localCoeff(numOfBaseFct); - for (int i=0; i<numOfBaseFct; i++) - localCoeff[i] = coefficients_[basis_.index(element,i)]; + for (size_t i=0; i<numOfBaseFct; i++) + localCoeff[i] = coefficients_[localIndexSet.index(i)]; // create local gfe function - LocalGFEFunction localGFE(basis_.getLocalFiniteElement(element),localCoeff); + LocalGFEFunction localGFE(localView.tree().finiteElement(),localCoeff); return localGFE.evaluate(local).globalCoordinates(); } @@ -79,16 +84,21 @@ public: /** \brief Evaluate the derivative of the function at local coordinates. */ Dune::FieldMatrix<ctype, embeddedDim, gridDim> derivative(const Element& element, const Dune::FieldVector<ctype,gridDim>& local) const { - int numOfBaseFct = basis_.getLocalFiniteElement(element).localBasis().size(); + auto localView = basis_.localView(); + auto localIndexSet = basis_.localIndexSet(); + localView.bind(element); + localIndexSet.bind(localView); + + int numOfBaseFct = localIndexSet.size(); // Extract local coefficients std::vector<TargetSpace> localCoeff(numOfBaseFct); for (int i=0; i<numOfBaseFct; i++) - localCoeff[i] = coefficients_[basis_.index(element,i)]; + localCoeff[i] = coefficients_[localIndexSet.index(i)]; // create local gfe function - LocalGFEFunction localGFE(basis_.getLocalFiniteElement(element),localCoeff); + LocalGFEFunction localGFE(localView.tree().finiteElement(),localCoeff); // use it to evaluate the derivative Dune::FieldMatrix<ctype, embeddedDim, gridDim> refJac = localGFE.evaluateDerivative(local); diff --git a/src/compute-disc-error.cc b/src/compute-disc-error.cc index 407924dbbff0073430ecd34efe43d55d68b5c25e..3834906769b5c30f0bc4ef282ec5fea245976c7a 100644 --- a/src/compute-disc-error.cc +++ b/src/compute-disc-error.cc @@ -9,10 +9,6 @@ #include <dune/functions/functionspacebases/pqknodalbasis.hh> -#include <dune/fufem/boundarypatch.hh> -#include <dune/fufem/functiontools/basisinterpolator.hh> -#include <dune/fufem/functiontools/boundarydofs.hh> -#include <dune/fufem/functionspacebases/dunefunctionsbasis.hh> #include <dune/fufem/discretizationerror.hh> #include <dune/fufem/dunepython.hh> @@ -43,10 +39,6 @@ void measureDiscreteEOC(const GridView gridView, FEBasis feBasis(gridView); FEBasis referenceFEBasis(referenceGridView); - using FufemFEBasis = DuneFunctionsBasis<FEBasis>; - FufemFEBasis fufemReferenceFEBasis(referenceFEBasis); - FufemFEBasis fufemFEBasis(feBasis); - ////////////////////////////////////////////////////////////////////////////////// // Read the data whose error is to be measured ////////////////////////////////////////////////////////////////////////////////// @@ -69,7 +61,7 @@ void measureDiscreteEOC(const GridView gridView, x[i] = TargetSpace(embeddedX[i]); // The numerical solution, as a grid function - GFE::EmbeddedGlobalGFEFunction<FufemFEBasis, TargetSpace> numericalSolution(fufemFEBasis, x); + GFE::EmbeddedGlobalGFEFunction<FEBasis, TargetSpace> numericalSolution(feBasis, x); /////////////////////////////////////////////////////////////////////////// // Read the reference configuration @@ -88,7 +80,7 @@ void measureDiscreteEOC(const GridView gridView, referenceX[i] = TargetSpace(embeddedReferenceX[i]); // The reference solution, as a grid function - GFE::EmbeddedGlobalGFEFunction<FufemFEBasis, TargetSpace> referenceSolution(fufemReferenceFEBasis, referenceX); + GFE::EmbeddedGlobalGFEFunction<FEBasis, TargetSpace> referenceSolution(referenceFEBasis, referenceX); ///////////////////////////////////////////////////////////////// // Measure the discretization error @@ -225,9 +217,6 @@ void measureAnalyticalEOC(const GridView gridView, // Measure the discretization error ///////////////////////////////////////////////////////////////// - using FufemFEBasis = DuneFunctionsBasis<FEBasis>; - FufemFEBasis fufemFEBasis(feBasis); - // Read reference solution and its derivative into a PythonFunction typedef VirtualDifferentiableFunction<FieldVector<double, dim>, typename TargetSpace::CoordinateType> FBase; @@ -235,7 +224,7 @@ void measureAnalyticalEOC(const GridView gridView, auto referenceSolution = module.get("fdf").toC<std::shared_ptr<FBase>>(); // The numerical solution, as a grid function - GFE::EmbeddedGlobalGFEFunction<FufemFEBasis, TargetSpace> numericalSolution(fufemFEBasis, x); + GFE::EmbeddedGlobalGFEFunction<FEBasis, TargetSpace> numericalSolution(feBasis, x); // QuadratureRule for the integral of the L^2 error QuadratureRuleKey quadKey(dim,6); diff --git a/src/harmonicmaps.cc b/src/harmonicmaps.cc index 71db378aa9f50c21a60da225b2d5470172fcbbcb..6fa27cff8cc2e998a85c93cd5352e37c9948819c 100644 --- a/src/harmonicmaps.cc +++ b/src/harmonicmaps.cc @@ -274,7 +274,7 @@ int main (int argc, char *argv[]) try auto referenceSolution = module.get("fdf").toC<std::shared_ptr<FBase>>(); // The numerical solution, as a grid function - GFE::EmbeddedGlobalGFEFunction<FufemFEBasis, TargetSpace> numericalSolution(feBasis, x); + GFE::EmbeddedGlobalGFEFunction<FEBasis, TargetSpace> numericalSolution(feBasis, x); // QuadratureRule for the integral of the L^2 error QuadratureRuleKey quadKey(dim,6);