]> https://gitweb.dealii.org/ - dealii.git/commitdiff
start testing vector valued polynomials
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Sun, 22 May 2005 11:56:41 +0000 (11:56 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Sun, 22 May 2005 11:56:41 +0000 (11:56 +0000)
git-svn-id: https://svn.dealii.org/trunk@10696 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/polynomials_tensor.cc [new file with mode: 0644]

diff --git a/tests/base/polynomials_tensor.cc b/tests/base/polynomials_tensor.cc
new file mode 100644 (file)
index 0000000..70b562a
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 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.
+//
+//----------------------------------------------------------------------
+
+// Output function values and derivatives for vector valued
+// polynomials returning Tensor<1,dim> for their values.
+
+// classes: PolynomialsBDM, PolynomialsRaviartThomas
+
+#include <base/logstream.h>
+#include <base/polynomials_bdm.h>
+#include <base/polynomials_raviart_thomas.h>
+
+#include <vector>
+#include <fstream>
+
+using namespace std;
+
+template<int dim, class POLY>
+void check_point (const Point<dim>& x,
+                 const POLY& p)
+{
+  const unsigned int n = p.n();
+  std::vector<Tensor<1,dim> > values(n);
+  std::vector<Tensor<2,dim> > gradients(n);
+  std::vector<Tensor<3,dim> > seconds(0);
+
+  p.compute(x, values, gradients, seconds);
+  
+  deallog << "Point " << x << std::endl;
+  for (unsigned int i=0;i<n;++i)
+    {
+      deallog << "p[" << i << "] value " << values[i];
+      deallog << " first " << gradients[i];
+      deallog << std::endl;
+    }
+}
+
+
+void check_bdm2 ()
+{
+  Point<2> x;
+  
+  PolynomialsBDM<2> p21(1);
+  
+  x(0) = 1.;
+  check_point(x, p21);
+}
+
+template<int dim>
+void check_rt ()
+{
+  Point<dim> x;
+  
+  PolynomialsRaviartThomas<dim> p0(0);
+  PolynomialsRaviartThomas<dim> p1(1);
+  PolynomialsRaviartThomas<dim> p2(2);
+  PolynomialsRaviartThomas<dim> p3(3);
+  
+  x(0) = 2.;
+  x(1) = 3.;
+  if (dim>2)
+    x(2) = 4;
+  
+  check_point(x, p0);
+  check_point(x, p1);
+  check_point(x, p2);
+  check_point(x, p3);
+}
+
+int main()
+{
+  std::ofstream logfile("polynomials_tensor.output");
+  logfile.precision(0);
+  deallog.attach(logfile);
+  deallog.depth_console(2);
+  deallog.threshold_double(1.e-10);
+
+  deallog.push("BDM");
+  check_bdm2();
+  deallog.pop();
+  deallog.push("RT");
+  check_rt<2>();
+  check_rt<3>();
+  deallog.pop();
+}

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.