From 23d50e6cff435a65db3360ecf1347589462ef008 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Mon, 11 Apr 2011 08:41:57 +0000 Subject: [PATCH] use fd approximation provided by the LocalGFEFunction [[Imported from SVN: r7137]] --- test/localgeodesicfefunctiontest.cc | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/test/localgeodesicfefunctiontest.cc b/test/localgeodesicfefunctiontest.cc index 4b3e3533..e14497f7 100644 --- a/test/localgeodesicfefunctiontest.cc +++ b/test/localgeodesicfefunctiontest.cc @@ -156,29 +156,8 @@ void testDerivativeOfGradientWRTCoefficients(const std::vector<TargetSpace>& cor // evaluate fd approximation of derivative Tensor3<double, TargetSpace::EmbeddedTangentVector::size, TargetSpace::EmbeddedTangentVector::size, domainDim> fdDerivative; + f.evaluateFDDerivativeOfGradientWRTCoefficient(quadPos, i, fdDerivative); - for (int j=0; j<TargetSpace::EmbeddedTangentVector::size; j++) { - - std::vector<TargetSpace> cornersPlus = corners; - std::vector<TargetSpace> cornersMinus = corners; - typename TargetSpace::CoordinateType aPlus = corners[i].globalCoordinates(); - typename TargetSpace::CoordinateType aMinus = corners[i].globalCoordinates(); - aPlus[j] += eps; - aMinus[j] -= eps; - cornersPlus[i] = TargetSpace(aPlus); - cornersMinus[i] = TargetSpace(aMinus); - LocalGeodesicFEFunction<domainDim,double,TargetSpace> fPlus(cornersPlus); - LocalGeodesicFEFunction<domainDim,double,TargetSpace> fMinus(cornersMinus); - - FieldMatrix<double,TargetSpace::EmbeddedTangentVector::size,domainDim> hPlus = fPlus.evaluateDerivative(quadPos); - FieldMatrix<double,TargetSpace::EmbeddedTangentVector::size,domainDim> hMinus = fMinus.evaluateDerivative(quadPos); - - fdDerivative[j] = hPlus; - fdDerivative[j] -= hMinus; - fdDerivative[j] /= 2*eps; - - } - if ( (derivative - fdDerivative).infinity_norm() > eps ) { std::cout << className(corners[0]) << ": Analytical derivative of gradient does not match fd approximation." << std::endl; std::cout << "gfe: "; -- GitLab