]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
start with bdm test
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 4 Jan 2004 19:07:59 +0000 (19:07 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 4 Jan 2004 19:07:59 +0000 (19:07 +0000)
git-svn-id: https://svn.dealii.org/trunk@8276 0785d39b-7218-0410-832d-ea1e28bc413d

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

index cd6de3b3e3624e50f828c9779144061b3c846480..34304ab85d5f890fff56ac9978211a129167ad8f 100644 (file)
@@ -38,6 +38,7 @@ threads.exe        : threads.g.$(OBJEXT)                            $(lib-base.g
 anisotropic_1.exe  : anisotropic_1.g.$(OBJEXT)                      $(lib-base.g)
 anisotropic_2.exe  : anisotropic_2.g.$(OBJEXT)                      $(lib-base.g)
 hierarchical.exe   : hierarchical.g.$(OBJEXT)                       $(lib-base.g)
+bdm.exe            : bdm.g.$(OBJEXT)                                $(lib-base.g)
 auto_derivative_function.exe : auto_derivative_function.g.$(OBJEXT) $(libraries) $(lib-base.g)
 
 tests =  logtest reference quadrature_test quadrature_selector table tensor \
diff --git a/tests/base/bdm.cc b/tests/base/bdm.cc
new file mode 100644 (file)
index 0000000..fada51d
--- /dev/null
@@ -0,0 +1,88 @@
+//-----------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2000, 2001, 2002, 2003 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.
+//
+//-----------------------------------------------------------------------------
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <base/logstream.h>
+#include <base/table.h>
+#include <base/polynomial.h>
+#include <base/polynomials_bdm.h>
+#include <base/quadrature_lib.h>
+
+using namespace Polynomials;
+
+template <int dim>
+void moments (PolynomialsBDM<dim>& poly)
+{
+  std::vector<Polynomial<double> > legendre(2);
+  for (unsigned int i=0;i<legendre.size();++i)
+    legendre[i] = Monomial<double>(i);
+
+  QGauss<1> qface(2);
+
+  Table<2,double> integrals (poly.n(), poly.n());
+
+  std::vector<Tensor<1,dim> > values(poly.n());
+  std::vector<Tensor<2,dim> > grads;
+  std::vector<Tensor<3,dim> > grad_grads;
+  values.resize(poly.n());
+
+  for (unsigned int face=0;face<2*dim;++face)
+    for (unsigned int k=0;k<qface.n_quadrature_points;++k)
+      {
+       const double w = qface.weight(k);
+       const double x = qface.point(k)(0);
+       Point<dim> p;
+       switch (face)
+         {
+           case 2:
+             p(1) = 1.;
+           case 0:
+             p(0) = x;
+             break;
+           case 1:
+             p(0) = 1.;
+           case 3:
+             p(1) = x;
+             break;          
+         }
+       std::cerr << p << std::endl;
+       
+       poly.compute (p, values, grads, grad_grads);
+       for (unsigned int i=0;i<poly.n();++i)
+         {
+           integrals(2*face,i) += w * values[i][1-face%2] ;
+           integrals(2*face+1,i) += w * values[i][1-face%2] * legendre[1].value(x);
+         }
+      }
+
+  std::cout.setf(std::ios::fixed);
+  for (unsigned int i=0;i<integrals.n_rows();++i)
+    {
+      for (unsigned int j=0;j<poly.n();++j)
+       std::cout << std::setw(13) << integrals(i,j);
+      std::cout << std::endl;
+    }
+}
+
+
+
+int main()
+{
+  PolynomialsBDM<2> bdm1(1);
+
+  moments(bdm1);
+}

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.