]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add simple test that computes the derivatives of a constant function.
authorRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 3 May 2001 12:34:46 +0000 (12:34 +0000)
committerRalf Hartmann <Ralf.Hartmann@dlr.de>
Thu, 3 May 2001 12:34:46 +0000 (12:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@4529 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/polynomial_test.cc
tests/base/polynomial_test.checked

index 3e7050672611100a5ee97a68f5cf450d21df4d13..eccc7653aeece4195b0c0beda56ccde36292df5b 100644 (file)
@@ -87,8 +87,8 @@ int main(int, char)
       deallog << "x=" << xi << ",    all derivatives: ";
       vector<double> 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<double> a_const(1,1.);
+      const Polynomial<double> pol_const(a_const);
+      vector<double> exact_values(5,0.);
+      exact_values[0]=1.;
+      vector<double> computed_values(5);
+
+      pol_const.value(0.24, computed_values);
+      bool ok=true;
+      for (unsigned int i=0; i<exact_values.size(); ++i)
+       {
+         if (fabs(computed_values[i]-exact_values[i])>1e-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;
index 760b525eb2a1b654b12b2723adc20032ea16b031..b6284bba514ac98b982bf98acf621713bab4833f 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.