]> https://gitweb.dealii.org/ - dealii.git/commitdiff
embedding matrices
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 9 Mar 2005 03:21:20 +0000 (03:21 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Wed, 9 Mar 2005 03:21:20 +0000 (03:21 +0000)
git-svn-id: https://svn.dealii.org/trunk@10054 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/fe_tools.cc

index 639dcba9bc4e4d62ec62cb7a4f9eb83ac8c21f65..db7d4071f94b08a1c78becfe67837fda8cb6d206 100644 (file)
@@ -2,7 +2,7 @@
 //    fe_tools.cc,v 1.1 2003/11/28 15:03:26 guido Exp
 //    Version: 
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors
+//    Copyright (C) 1998, 1999, 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
@@ -15,6 +15,7 @@
 
 #include "../tests.h"
 #include <iostream>
+#include <iomanip>
 #include <fstream>
 
 #include <base/logstream.h>
 #include <fe/fe_tools.h>
 
 
+template <typename number>
+void print_formatted (const FullMatrix<number> &A,
+                     const unsigned int        precision,
+                     const unsigned int        width)
+{
+  for (unsigned int i=0; i<A.m(); ++i)
+    {
+      for (unsigned int j=0; j<A.n(); ++j)
+       {
+         if (A(i,j) != 0)
+           deallog << std::setw(width) << std::setprecision(precision)
+                   << A(i,j);
+         else
+           deallog << std::setw(width) << std::setprecision(precision)
+                   << "~";
+         deallog << ' ';
+       };
+      deallog << std::endl;
+    };
+}
+
+
+
+template<int dim>
+void test_embedding (const FiniteElement<dim>& fe)
+{  
+  const unsigned int n = fe.dofs_per_cell;
+  const unsigned int nc= GeometryInfo<dim>::children_per_cell;
+  
+  FullMatrix<double> P[nc];
+  for (unsigned int i=0;i<nc;++i)
+    P[i].reinit(n,n);
+  
+  FETools::compute_embedding_matrices(fe, P);
+  
+  for (unsigned int i=0;i<nc;++i)
+    {
+      deallog << fe.get_name() << " embedding " << i << std::endl;
+      print_formatted(P[i], 3, 6);
+    }
+}
+
+  
 template<int dim>
 void test_projection (const FiniteElement<dim>& fe1,
                      const FiniteElement<dim>& fe2,
@@ -61,6 +105,14 @@ void test_projection (std::ostream& out)
   FE_DGP<dim> p3(3);
   FE_DGP<dim> p4(4);
 
+  test_embedding(q0);
+  test_embedding(q1);
+  test_embedding(q2);
+  test_embedding(q3);
+  test_embedding(p1);
+  test_embedding(p2);
+  test_embedding(p3);
+  
   test_projection(p1,p0, out);
   test_projection(p0,p1, out);
   test_projection(p2,p1, out);

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.