diff --git a/dune/gfe/globalgeodesicfefunction.hh b/dune/gfe/globalgeodesicfefunction.hh index c3f88258e92a51aecc2641aeb5417b3c18d414e9..00afb3c2e540000f97540b9d25d8b72fd4c395c4 100644 --- a/dune/gfe/globalgeodesicfefunction.hh +++ b/dune/gfe/globalgeodesicfefunction.hh @@ -72,9 +72,16 @@ public: // create local gfe function LocalGFEFunction localGFE(basis_.getLocalFiniteElement(element),localCoeff); - + // use it to evaluate the derivative - out = localGFE.evaluateDerivative(local); + Dune::FieldMatrix<ctype, embeddedDim, gridDim> refJac = localGFE.evaluateDerivative(local); + + out =0.0; + //transform the gradient + const Dune::FieldMatrix<double,gridDim,gridDim>& jacInvTrans = element.geometry().jacobianInverseTransposed(local); + for (size_t k=0; k< refJac.N(); k++) + jacInvTrans.umv(refJac[k],out[k]); + } /** \brief Export basis */ diff --git a/dune/gfe/globalgfetestfunction.hh b/dune/gfe/globalgfetestfunction.hh index a74f06b0ac5e1327158e27c0c2773a478f3431b8..48c503b13efe7748727e195180d467c54e2df90d 100644 --- a/dune/gfe/globalgfetestfunction.hh +++ b/dune/gfe/globalgfetestfunction.hh @@ -75,7 +75,7 @@ void GlobalGFETestFunction<Basis,TargetSpace,CoefficientType>::evaluateLocal(con basis_.getLocalFiniteElement(element).localBasis().evaluateFunction(local, values); // multiply values with the corresponding test coefficients and sum them up - out = 0; + out = 0.0; for (size_t i=0; i<values.size(); i++) { int index = basis_.index(element,i); @@ -91,13 +91,24 @@ void GlobalGFETestFunction<Basis,TargetSpace,CoefficientType>::evaluateDerivativ Dune::FieldMatrix<ctype, embeddedDim, gridDim>& out) const { // jacobians of the test basis function - a lot of dims here... - std::vector<Dune::array<Dune::FieldMatrix<ctype, embeddedDim, gridDim>, tangentDim> > jacobians; + std::vector<Dune::array<Dune::FieldMatrix<ctype, embeddedDim, gridDim>, tangentDim> > refJacobians,jacobians; // evaluate local gfe test function basis - basis_.getLocalFiniteElement(element).localBasis().evaluateJacobian(local, jacobians); + basis_.getLocalFiniteElement(element).localBasis().evaluateJacobian(local, refJacobians); + + const Dune::FieldMatrix<double,gridDim,gridDim>& jacInvTrans = element.geometry().jacobianInverseTransposed(local); + + //transform the gradients + jacobians.resize(refJacobians.size()); + for (size_t i = 0; i<jacobians.size(); i++) + for (int j=0; j<tangentDim; j++) {// the local basis has a block structure + jacobians[i][j] = 0; + for (size_t comp=0; comp<jacobians[i][j].N(); comp++) + jacInvTrans.umv(refJacobians[i][j][comp], jacobians[i][j][comp]); + } // multiply values with the corresponding test coefficients and sum them up - out = 0; + out = 0.0; for (int i=0; i<jacobians.size(); i++) { int index = basis_.index(element,i);