From 3f8e702c1b0302d105d32a1b1880a613c5e93dfd Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 21 Oct 2005 15:26:57 +0000 Subject: [PATCH] New test git-svn-id: https://svn.dealii.org/trunk@11648 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/fe/check_derivatives.cc | 145 ++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 tests/fe/check_derivatives.cc diff --git a/tests/fe/check_derivatives.cc b/tests/fe/check_derivatives.cc new file mode 100644 index 0000000000..29aff03b25 --- /dev/null +++ b/tests/fe/check_derivatives.cc @@ -0,0 +1,145 @@ +//---------------------------- check_derivatives.cc --------------------------- +// check_derivatives.cc,v 1.3 2003/06/09 16:00:38 wolf Exp +// Version: +// +// Copyright (C) 2005 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- check_derivatives.cc --------------------------- + +// at a number of quadrature points, evaluate the gradients of shape functions +// and compare it to a finite difference approximation computed using the +// shape values + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +const double delta_x = 1e-8; + + +template +void test (const FiniteElement &fe, + const Quadrature &quadrature) +{ + deallog << fe.get_name() << ' ' << fe.dofs_per_cell << ' '; + + for (unsigned int i=0; i point = quadrature.point(q); + + const Tensor<1,dim> gradient + = fe.shape_grad_component (i, point, c); + + Tensor<1,dim> fd_grad; + for (unsigned int d=0; d point_plus_dx = point; + point_plus_dx[d] += delta_x; + fd_grad[d] = (fe.shape_value_component (i, point_plus_dx, c) - + fe.shape_value_component (i, point, c)) / + delta_x; + } + + Assert ((gradient-fd_grad).norm () <= 1e-5, + ExcInternalError()); + } + deallog << "OK" << std::endl; +} + + + +template