]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Check prolongation and get_interpolation.
authorhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Mar 2004 10:09:04 +0000 (10:09 +0000)
committerhartmann <hartmann@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Mar 2004 10:09:04 +0000 (10:09 +0000)
git-svn-id: https://svn.dealii.org/trunk@8720 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/dgp_monomial_1.cc [new file with mode: 0644]
tests/fe/dgp_monomial_2.cc [new file with mode: 0644]

diff --git a/tests/fe/dgp_monomial_1.cc b/tests/fe/dgp_monomial_1.cc
new file mode 100644 (file)
index 0000000..64ca909
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  q_2.cc  ---------------------------
+//    q_2.cc,v 1.1 2003/05/05 13:49:41 wolf Exp
+//    Version: 
+//
+//    Copyright (C) 2003, 2004 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
+//    fuqher information on this license.
+//
+//----------------------------  q_2.cc  ---------------------------
+
+
+// Just output the embedding matrices of the FE_Q element. Test
+// introduced when we started to compute them on the fly, rather than
+// precomputing them for a number of elements and storing them in a
+// table
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <fe/fe_dgp_monomial.h>
+
+#include <fstream>
+#include <string>
+
+#define PRECISION 5
+
+
+
+template<int dim>
+void
+test(const unsigned int degree)
+{
+  deallog << "FE_DGPMonomial<" << dim << "> (" << degree << ")"
+         << std::endl;
+  
+  FE_DGPMonomial<dim> fe_q(degree);
+
+  for (unsigned int c=0; c<GeometryInfo<dim>::children_per_cell; ++c)
+    {
+      const FullMatrix<double> & m = fe_q.get_prolongation_matrix(c);
+
+      for (unsigned int i=0; i<m.m(); ++i)
+       {
+         for (unsigned int j=0; j<m.n(); ++j)
+           deallog << m(i,j) << ' ';
+         deallog << std::endl;
+       }
+      
+      deallog << std::endl;
+    }
+  
+  deallog << std::endl;
+}
+
+
+int
+main()
+{
+  std::ofstream logfile ("dgp_monomial_1.output");
+  logfile.precision (PRECISION);
+  logfile.setf(std::ios::fixed);  
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+                                   // we had the matrices precomputed
+                                   // up to Q4 for 1d, Q3 for 2d and
+                                   // Q2 for 3d
+  for (unsigned int degree=1; degree<=4; ++degree)
+    test<1>(degree);
+
+  for (unsigned int degree=1; degree<=4; ++degree)
+    test<2>(degree);
+
+  for (unsigned int degree=1; degree<=2; ++degree)
+    test<3>(degree);
+  
+  return 0;
+}
+
+
+
diff --git a/tests/fe/dgp_monomial_2.cc b/tests/fe/dgp_monomial_2.cc
new file mode 100644 (file)
index 0000000..5ba0af7
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  q_4.cc  ---------------------------
+//    q_4.cc,v 1.1 2003/05/08 14:54:41 wolf Exp
+//    Version: 
+//
+//    Copyright (C) 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
+//    fuqher information on this license.
+//
+//----------------------------  q_4.cc  ---------------------------
+
+
+// previously, the FETools::get_interpolation_matrix function would
+// compute its result itself by interpolation. now, the different
+// finite elements do that themselves, if they can. make sure the
+// result doesn't change
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <fe/fe_dgp_monomial.h>
+#include <fe/fe_tools.h>
+
+#include <fstream>
+#include <string>
+
+#define PRECISION 5
+
+
+
+template<int dim>
+void
+test(const unsigned int degree1,
+     const unsigned int degree2)
+{
+  deallog << "FE_DGPMonomial" << dim << "> (" << degree1 << ")"
+          << " to FE_DGPMonomial<" << dim << "> (" << degree2 << ")"
+         << std::endl;
+  
+  FE_DGPMonomial<dim> fe1(degree1);
+  FE_DGPMonomial<dim> fe2(degree2);
+
+  FullMatrix<float> m (fe2.dofs_per_cell,
+                       fe1.dofs_per_cell);
+  FETools::get_interpolation_matrix (fe1, fe2, m);
+
+  for (unsigned int i=0; i<m.m(); ++i)
+    {
+      for (unsigned int j=0; j<m.n(); ++j)
+        deallog << m(i,j) << ' ';
+      
+      deallog << std::endl;
+    }
+  
+  deallog << std::endl;
+}
+
+
+int
+main()
+{
+  std::ofstream logfile ("dgp_monomial_2.output");
+  logfile.precision (PRECISION);
+  logfile.setf(std::ios::fixed);  
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  for (unsigned int degree1=1; degree1<=4; ++degree1)
+    for (unsigned int degree2=1; degree2<=4; ++degree2)
+      test<1>(degree1, degree2);
+  for (unsigned int degree1=1; degree1<=3; ++degree1)
+    for (unsigned int degree2=1; degree2<=3; ++degree2)
+      test<2>(degree1, degree2);
+  for (unsigned int degree1=1; degree1<=2; ++degree1)
+    for (unsigned int degree2=1; degree2<=2; ++degree2)
+      test<3>(degree1, degree2);
+  
+  return 0;
+}
+
+
+

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.