]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Rename test and add a new one that verifies FECollection objects with more than one...
authorgoll <goll@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 6 Jul 2011 16:31:11 +0000 (16:31 +0000)
committergoll <goll@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 6 Jul 2011 16:31:11 +0000 (16:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@23925 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/count_dofs_per_component_hp_01.cc [moved from tests/bits/count_dofs_per_component_hp.cc with 97% similarity]
tests/bits/count_dofs_per_component_hp_01/cmp/generic [moved from tests/bits/count_dofs_per_component_hp/cmp/generic with 100% similarity]
tests/bits/count_dofs_per_component_hp_02.cc [new file with mode: 0644]
tests/bits/count_dofs_per_component_hp_02/cmp/generic [new file with mode: 0644]

similarity index 97%
rename from tests/bits/count_dofs_per_component_hp.cc
rename to tests/bits/count_dofs_per_component_hp_01.cc
index 184f1397ec28252943f57091b6816a785be178ba..53d93b248775c61748cbb600171a49197300c0c5 100644 (file)
@@ -71,7 +71,7 @@ void test ()
 
 int main () 
 {
-  std::ofstream logfile("count_dofs_per_component_hp/output");
+  std::ofstream logfile("count_dofs_per_component_hp_01/output");
   deallog.attach(logfile);
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
diff --git a/tests/bits/count_dofs_per_component_hp_02.cc b/tests/bits/count_dofs_per_component_hp_02.cc
new file mode 100644 (file)
index 0000000..00aab45
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2003, 2004, 2005, 2009 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 "../tests.h"
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <grid/tria_iterator.h>
+#include <hp/fe_collection.h>
+#include <hp/dof_handler.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
+#include <fe/fe_q.h>
+#include <fe/fe_system.h>
+#include <dofs/dof_tools.h>
+
+// check
+//   DoFTools::
+//   count_dofs_per_component (...);
+// for the hp case
+//
+// in contrast to the _01 test also check that this works if the element 
+// collection has more than one element
+
+
+using namespace std;
+
+template <int dim>
+void test ()
+{
+  Triangulation<dim> triangulation;
+  GridGenerator::hyper_cube(triangulation);
+  triangulation.refine_global(2);
+
+  //define DoFhandler and FEs
+  FE_Q<dim> u1(2);
+  FE_Q<dim> p1(1);
+  FESystem<dim> fe_system1(u1, 2, p1, 1);
+  FE_Q<dim> u2(3);
+  FE_Q<dim> p2(2);
+  FESystem<dim> fe_system2(u2, 2, p2, 1);
+
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back(fe_system1);
+  fe_collection.push_back(fe_system2);
+
+  hp::DoFHandler<dim> hp_dof_handler(triangulation);
+  hp_dof_handler.begin_active()->set_active_fe_index(1);
+
+  //distribute dofs
+  hp_dof_handler.distribute_dofs(fe_collection);
+
+  //count dofs per component and show them on the screen
+  std::vector<unsigned int> dofs_per_component_hp(3,0);
+  DoFTools::count_dofs_per_component(hp_dof_handler, dofs_per_component_hp);
+
+  for (unsigned int i=0; i<3; i++)
+    {
+      deallog <<"DoFs in the " <<i<<". component for hp FE: "<< dofs_per_component_hp.at(i)<< std::endl;
+    }
+
+}
+
+int main () 
+{
+  std::ofstream logfile("count_dofs_per_component_hp_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1> ();
+  test<2> ();
+  test<3> ();
+  return 0;
+}
diff --git a/tests/bits/count_dofs_per_component_hp_02/cmp/generic b/tests/bits/count_dofs_per_component_hp_02/cmp/generic
new file mode 100644 (file)
index 0000000..1698e0e
--- /dev/null
@@ -0,0 +1,10 @@
+
+DEAL::DoFs in the 0. component for hp FE: 10
+DEAL::DoFs in the 1. component for hp FE: 10
+DEAL::DoFs in the 2. component for hp FE: 6
+DEAL::DoFs in the 0. component for hp FE: 90
+DEAL::DoFs in the 1. component for hp FE: 90
+DEAL::DoFs in the 2. component for hp FE: 30
+DEAL::DoFs in the 0. component for hp FE: 778
+DEAL::DoFs in the 1. component for hp FE: 778
+DEAL::DoFs in the 2. component for hp FE: 144

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.