]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new test for FETools::get_fe_by_name
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 20 Oct 2006 15:55:53 +0000 (15:55 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 20 Oct 2006 15:55:53 +0000 (15:55 +0000)
git-svn-id: https://svn.dealii.org/trunk@14035 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/Makefile
tests/fe/fe_tools_01.cc [new file with mode: 0644]
tests/fe/fe_tools_01/cmp/generic [new file with mode: 0644]

index 6289213fcdd13e8e17eec65a2823a01f1c539f16..8c60260ac127eded46603c2ef1bffe2959aec9c7 100644 (file)
@@ -21,7 +21,7 @@ default: run-tests
 
 ############################################################
 
-tests_x=fe_data_test traits fe_tools fe_tools_test mapping \
+tests_x=fe_data_test traits fe_tools fe_tools_* mapping \
         mapping_c1 shapes derivatives function numbering mapping_q1_eulerian \
         transfer internals derivatives_face \
        dgq_1 \
diff --git a/tests/fe/fe_tools_01.cc b/tests/fe/fe_tools_01.cc
new file mode 100644 (file)
index 0000000..5db5f8c
--- /dev/null
@@ -0,0 +1,79 @@
+//--------------------------------------------------------------------------
+//    fe_tools.cc,v 1.1 2003/11/28 15:03:26 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2006 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.
+//
+//--------------------------------------------------------------------------
+
+// Test FETools::get_fe_by_name
+
+#include "../tests.h"
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <sstream>
+
+#include <base/logstream.h>
+#include <fe/fe.h>
+#include <fe/fe_tools.h>
+
+template <int dim>
+void test_fe(const char* name)
+{
+  FiniteElement<dim>* fe = FETools::get_fe_from_name<dim>(std::string(name));
+
+  deallog << fe->get_name() << std::endl
+         << '\t' << fe->dofs_per_cell
+         << '\t' << fe->dofs_per_vertex
+         << '\t' << fe->dofs_per_line
+         << '\t' << fe->dofs_per_quad
+         << '\t' << fe->dofs_per_hex
+         << std::endl;
+}
+
+
+int
+main()
+{
+  std::ofstream logfile("fe_tools_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+                                  // These names are all correct.
+  test_fe<1>("FE_Q(1)");
+  test_fe<1>("FE_Q(2)");
+  test_fe<1>("FE_Q<1>(2)");
+  test_fe<2>("FE_Q(1)");
+  test_fe<2>("FE_Q<2>(2)");
+  test_fe<2>("FE_Q<dim>(2)");
+  test_fe<2>("FE_DGQ(1)");
+  test_fe<2>("FE_RaviartThomas(1)");
+  test_fe<3>("FE_Q(1)");
+  test_fe<1>("FESystem<1>[FE_Q<dim>(2)^dim-FE_DGQ<d>(1)]");
+  test_fe<2>("FESystem<2>[FE_Q<2>(2)^dim-FE_DGQ<2>(1)]");
+  test_fe<2>("FESystem[FESystem<2>[FE_Q<2>(2)^2-FE_DGQ<2>(1)]^2-FE_Q(1)]");
+  test_fe<2>("FESystem[FESystem[FESystem[FE_Q(1)^2-FE_Q(1)]^2]-FESystem[FE_Q(1)^2]-FESystem[FE_Q(1)-FE_DGP(0)]]");
+
+                                  // Now set up a list of malformed
+                                  // names
+  std::vector<const char*> names;
+//  names.push_back("FE_Q[2]");
+
+  for(unsigned int i=0;i<names.size();++i)
+    {
+      try
+       {
+         test_fe<2>(names[i]);
+       }
+      catch(ExceptionBase& e)
+       {
+         logfile << e.what();
+       }
+    }
+}
diff --git a/tests/fe/fe_tools_01/cmp/generic b/tests/fe/fe_tools_01/cmp/generic
new file mode 100644 (file)
index 0000000..e17791e
--- /dev/null
@@ -0,0 +1,27 @@
+
+DEAL::FE_Q<1>(1)
+DEAL:: 2       1       0       0       0
+DEAL::FE_Q<1>(2)
+DEAL:: 3       1       1       0       0
+DEAL::FE_Q<1>(2)
+DEAL:: 3       1       1       0       0
+DEAL::FE_Q<2>(1)
+DEAL:: 4       1       0       0       0
+DEAL::FE_Q<2>(2)
+DEAL:: 9       1       1       1       0
+DEAL::FE_Q<2>(2)
+DEAL:: 9       1       1       1       0
+DEAL::FE_DGQ<2>(1)
+DEAL:: 4       0       0       4       0
+DEAL::FE_RaviartThomas<2>(1)
+DEAL:: 12      0       2       4       0
+DEAL::FE_Q<3>(1)
+DEAL:: 8       1       0       0       0
+DEAL::FESystem<1>[FE_Q<1>(2)-FE_DGQ<1>(1)]
+DEAL:: 5       1       3       0       0
+DEAL::FESystem<2>[FE_Q<2>(2)^2-FE_DGQ<2>(1)]
+DEAL:: 22      2       2       6       0
+DEAL::FESystem<2>[FESystem<2>[FE_Q<2>(2)^2-FE_DGQ<2>(1)]^2-FE_Q<2>(1)]
+DEAL:: 48      5       4       12      0
+DEAL::FESystem<2>[FESystem<2>[FESystem<2>[FE_Q<2>(1)^2-FE_Q<2>(1)]^2]-FESystem<2>[FE_Q<2>(1)^2]-FESystem<2>[FE_Q<2>(1)-FE_DGP<2>(0)]]
+DEAL:: 37      9       0       1       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.