]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add test.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 9 Feb 2018 17:48:29 +0000 (18:48 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 14 Feb 2018 17:28:07 +0000 (18:28 +0100)
tests/base/polynomial_hermite_like.cc [new file with mode: 0644]
tests/base/polynomial_hermite_like.with_lapack=true.output [new file with mode: 0644]

diff --git a/tests/base/polynomial_hermite_like.cc b/tests/base/polynomial_hermite_like.cc
new file mode 100644 (file)
index 0000000..a547bc5
--- /dev/null
@@ -0,0 +1,56 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+#include "../tests.h"
+
+#include <deal.II/base/polynomial.h>
+
+using namespace Polynomials;
+
+void plot(const std::vector<Polynomial<double> > &polynomials)
+{
+  LogStream::Prefix("plot");
+  const unsigned int n=8;
+  for (unsigned int i=0; i<=n; ++i)
+    {
+      const double x = 1.*i/n;
+      deallog << x;
+      for (unsigned int p=0; p<polynomials.size(); ++p)
+        deallog << '\t' << polynomials[p].value(x);
+      deallog << std::endl;
+    }
+}
+
+void interpolation_conditions(const std::vector<Polynomial<double> > &polynomials)
+{
+  std::vector<double> values(2);
+  for (unsigned int i=0; i<polynomials.size(); ++i)
+    {
+      polynomials[i].value(0., values);
+      deallog << i << "\t 0:\t" << values[0] << '\t' << values[1] << std::endl;
+      polynomials[i].value(1., values);
+      deallog << i << "\t 1:\t" << values[0] << '\t' << values[1] << std::endl;
+    }
+}
+
+
+int main()
+{
+  initlog();
+
+  interpolation_conditions(HermiteLikeInterpolation::generate_complete_basis(6));
+  plot(HermiteLikeInterpolation::generate_complete_basis(6));
+}
diff --git a/tests/base/polynomial_hermite_like.with_lapack=true.output b/tests/base/polynomial_hermite_like.with_lapack=true.output
new file mode 100644 (file)
index 0000000..8a0594f
--- /dev/null
@@ -0,0 +1,24 @@
+
+DEAL::0         0:     1.00000 -21.1429
+DEAL::0         1:     0.00000 0.00000
+DEAL::1         0:     0.00000 31.7114
+DEAL::1         1:     0.00000 0.00000
+DEAL::2         0:     0.00000 0.00000
+DEAL::2         1:     0.00000 0.00000
+DEAL::3         0:     0.00000 0.00000
+DEAL::3         1:     0.00000 0.00000
+DEAL::4         0:     0.00000 0.00000
+DEAL::4         1:     0.00000 0.00000
+DEAL::5         0:     0.00000 0.00000
+DEAL::5         1:     0.00000 -31.7114
+DEAL::6         0:     0.00000 0.00000
+DEAL::6         1:     1.00000 21.1429
+DEAL::0.00000  1.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+DEAL::0.125000 -0.0775452      0.782431        0.643097        -0.131592       0.0836483       -0.111776       0.0352478
+DEAL::0.250000 0.0627790       -0.278714       1.02264 0.140625        -0.0734223      0.0929046       -0.0287388
+DEAL::0.375000 0.126103        -0.471781       0.613544        0.714111        -0.242755       0.283069        -0.0851833
+DEAL::0.500000 0.00000 0.00000 0.00000 1.00000 0.00000 0.00000 0.00000
+DEAL::0.625000 -0.0851833      0.283069        -0.242755       0.714111        0.613544        -0.471781       0.126103
+DEAL::0.750000 -0.0287388      0.0929046       -0.0734223      0.140625        1.02264 -0.278714       0.0627790
+DEAL::0.875000 0.0352478       -0.111776       0.0836483       -0.131592       0.643097        0.782431        -0.0775452
+DEAL::1.00000  0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1.00000

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.