]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Check primitivity and other features of FEs.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 May 2002 09:44:35 +0000 (09:44 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 17 May 2002 09:44:35 +0000 (09:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@5847 0785d39b-7218-0410-832d-ea1e28bc413d

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

diff --git a/tests/fe/fe_traits.cc b/tests/fe/fe_traits.cc
new file mode 100644 (file)
index 0000000..9f4d878
--- /dev/null
@@ -0,0 +1,112 @@
+//----------------------------  fe_traits_test.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2002 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.
+//
+//----------------------------  fe_traits_test.cc  ---------------------------
+
+
+#include <iostream>
+#include <fstream>
+
+#include <base/logstream.h>
+#include <grid/tria_iterator.h>
+#include <dofs/dof_accessor.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_dgp.h>
+#include <fe/fe_system.h>
+
+
+template <int dim>
+void check (const FiniteElement<dim> &fe)
+{
+  const unsigned int dofs_per_cell = fe.dofs_per_cell;
+
+                                  // first check whether shape
+                                  // functions are primitive:
+  deallog << "  Primitivity: ";
+  for (unsigned int i=0; i<dofs_per_cell; ++i)
+    deallog << (fe.is_primitive(i) ? 1 : 0);
+  deallog << std::endl;
+
+                                  // then check n_nonzero_components
+  deallog << "  n_nonzero_components: ";
+  for (unsigned int i=0; i<dofs_per_cell; ++i)
+    deallog << fe.n_nonzero_components(i);
+  deallog << std::endl;
+
+                                  // finally check component pattern
+                                  // for each shape function
+  deallog << "  component pattern for each shape function:" << std::endl;
+  for (unsigned int i=0; i<dofs_per_cell; ++i)
+    {
+      deallog << "    shape function i=" << i << ": ";
+                      
+      for (unsigned int j=0; j<fe.n_components(); ++j)
+       {
+         Assert (fe.get_nonzero_components(i).size() == fe.n_components(),
+                 ExcInternalError());
+         deallog << (fe.get_nonzero_components(i)[j] ? 1 : 0);
+       };
+      deallog << std::endl;
+    };
+};
+
+
+
+template <int dim>
+void check ()
+{
+                                  // check usual Lagrange elements
+  for (unsigned int p=1; p<3; ++p)
+    {
+      deallog << "Checking FE_Q<" << dim << ">(" << p << "): "
+             << std::endl;
+      check (FE_Q<dim>(p));
+    };
+
+                                  // check DG Lagrange elements
+  for (unsigned int p=0; p<3; ++p)
+    {
+      deallog << "Checking FE_DGQ<" << dim << ">(" << p << "): "
+             << std::endl;
+      check (FE_DGQ<dim>(p));
+    };
+
+                                  // check DG-P elements
+  for (unsigned int p=0; p<3; ++p)
+    {
+      deallog << "Checking FE_DGP<" << dim << ">(" << p << "): "
+             << std::endl;
+      check (FE_DGP<dim>(p));
+    };
+
+                                  // check systems of Q-elements
+  for (unsigned int p=1; p<3; ++p)
+    {
+      deallog << "Checking FE_Q<" << dim << ">(" << p << ")^2: "
+             << std::endl;
+      check (FESystem<dim> (FE_Q<dim>(p),2));
+    };
+};
+
+  
+
+
+int main ()
+{
+  std::ofstream logfile("fe_traits.output");
+  deallog.attach(logfile);
+//    deallog.depth_console(0);
+
+  check<1> ();
+  check<2> ();
+  check<3> ();
+};

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.