From: Ralf Hartmann Date: Thu, 3 May 2001 12:34:46 +0000 (+0000) Subject: Add simple test that computes the derivatives of a constant function. X-Git-Tag: v8.0.0~19261 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20f5b25c88daf6a6995ba5f3a2b58d784d5181ef;p=dealii.git Add simple test that computes the derivatives of a constant function. git-svn-id: https://svn.dealii.org/trunk@4529 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/polynomial_test.cc b/tests/base/polynomial_test.cc index 3e70506726..eccc7653ae 100644 --- a/tests/base/polynomial_test.cc +++ b/tests/base/polynomial_test.cc @@ -87,8 +87,8 @@ int main(int, char) deallog << "x=" << xi << ", all derivatives: "; vector v_exact(6); - v_exact[1]=256.0*xi*xi*xi-384.0*xi*xi+152.0*xi-12.0; v_exact[0]=64.0*xi*xi*xi*xi-128.0*xi*xi*xi+76.0*xi*xi-12.0*xi; + v_exact[1]=256.0*xi*xi*xi-384.0*xi*xi+152.0*xi-12.0; v_exact[2]=768.0*xi*xi-768.0*xi+152.0; v_exact[3]=1536*xi-768; v_exact[4]=1536; @@ -113,6 +113,33 @@ int main(int, char) deallog << std::endl; } + if (true) + { + deallog << std::endl << "Derivatives of a polynomial of degree 0 (a constant function)." << std::endl; + vector a_const(1,1.); + const Polynomial pol_const(a_const); + vector exact_values(5,0.); + exact_values[0]=1.; + vector computed_values(5); + + pol_const.value(0.24, computed_values); + bool ok=true; + for (unsigned int i=0; i1e-15) + ok=false; + } + + if (ok) + deallog << "ok"; + else + deallog << "false"; + + deallog << std::endl; + } + + + deallog << std::endl << "Test of TensorProductPolynomials:" << std::endl; deallog << "2D Example:" << std::endl; diff --git a/tests/base/polynomial_test.checked b/tests/base/polynomial_test.checked index 760b525eb2..b6284bba51 100644 --- a/tests/base/polynomial_test.checked +++ b/tests/base/polynomial_test.checked @@ -72,6 +72,9 @@ DEAL::x=0.80, all derivatives: ok DEAL::x=0.90, all derivatives: ok DEAL::x=1.00, all derivatives: ok DEAL:: +DEAL::Derivatives of a polynomial of degree 0 (a constant function). +DEAL::ok +DEAL:: DEAL::Test of TensorProductPolynomials: DEAL::2D Example: DEAL::v_1=-0.02