]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new class BlockInfo
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 13 Sep 2009 17:38:36 +0000 (17:38 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 13 Sep 2009 17:38:36 +0000 (17:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@19450 0785d39b-7218-0410-832d-ea1e28bc413d

tests/deal.II/Makefile
tests/deal.II/block_info.cc [new file with mode: 0644]
tests/deal.II/block_info/cmp/generic [new file with mode: 0644]

index 52506660a31fa47fd5998c2a2c4adf788b2d5019..4e19b4e2709a89b52432dbd46d20e8f6ed61a0c3 100644 (file)
@@ -21,7 +21,7 @@ default: run-tests
 
 ############################################################
 
-tests_x = block_matrices \
+tests_x = block_info block_matrices \
        user_data_* \
        constraints \
        constraint_graph \
diff --git a/tests/deal.II/block_info.cc b/tests/deal.II/block_info.cc
new file mode 100644 (file)
index 0000000..080fea7
--- /dev/null
@@ -0,0 +1,103 @@
+//----------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 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 <base/logstream.h>
+#include <dofs/block_info.h>
+#include <multigrid/mg_dof_handler.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <fe/fe_q.h>
+#include <fe/fe_system.h>
+#include <fstream>
+
+
+template <int dim>
+void test_grid(const Triangulation<dim>& tr,
+              const FiniteElement<dim>& fe)
+{
+  MGDoFHandler<dim> mgdof(tr);
+  mgdof.distribute_dofs(fe);
+  BlockInfo bi;
+  bi.initialize(mgdof);
+  bi.initialize_local(mgdof);
+
+  deallog << "Global dofs    " << mgdof.n_dofs() << std::endl;
+  deallog << "Global blocks ";
+  for (unsigned int i=0;i<bi.global().size();++i)
+      deallog << ' ' << bi.global().block_size(i);
+  deallog << std::endl;
+
+  for (unsigned int l=0;l<tr.n_levels();++l)
+    {
+      deallog << "Level dofs     " << mgdof.n_dofs(l) << std::endl;
+      deallog << "Level block[" << l << ']';
+      for (unsigned int i=0;i<bi.level(l).size();++i)
+       deallog << ' ' << bi.level(l).block_size(i);
+      deallog << std::endl;
+    }
+  
+  deallog << "Local blocks  ";
+  for (unsigned int i=0;i<bi.local().size();++i)
+      deallog << ' ' << bi.local().block_size(i);
+  deallog << std::endl;
+
+  std::vector<unsigned int> renumbered(fe.dofs_per_cell);
+  
+  deallog << "Renumbering   ";
+  for (unsigned int i=0;i<fe.dofs_per_cell;++i)
+    {
+      deallog << ' ' << bi.renumber(i);
+      renumbered[bi.renumber(i)] = i;
+    }
+  deallog << std::endl;
+  
+  deallog << "Inverse       ";
+  for (unsigned int i=0;i<fe.dofs_per_cell;++i)
+    deallog << ' ' << renumbered[i];
+  deallog << std::endl;
+}
+
+
+template<int dim>
+void test_fe (const FiniteElement<dim>& fe)
+{
+  Triangulation<dim> tr;
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global(5-dim);
+  test_grid(tr, fe);
+}
+
+
+int main () 
+{
+  std::ofstream logfile("block_info/output");
+  deallog.attach(logfile);
+  deallog.depth_console(10);
+
+  FE_Q<2> q21(1);
+  FE_Q<2> q22(2);
+  FESystem<2> s2(q21, 3, q22, 2);
+  
+  test_fe(q21);
+  test_fe(q22);
+  test_fe(s2);
+  
+  FE_Q<3> q31(1);
+  FE_Q<3> q32(2);
+  FESystem<3> s3(q31, 3, q32, 2);
+  
+  test_fe(q31);
+  test_fe(q32);
+  test_fe(s3);
+}
diff --git a/tests/deal.II/block_info/cmp/generic b/tests/deal.II/block_info/cmp/generic
new file mode 100644 (file)
index 0000000..221ae3f
--- /dev/null
@@ -0,0 +1,40 @@
+
+DEAL::Global dofs    81
+DEAL::Global blocks  81
+DEAL::Level dofs     4
+DEAL::Level block[0] 4
+DEAL::Level dofs     9
+DEAL::Level block[1] 9
+DEAL::Level dofs     25
+DEAL::Level block[2] 25
+DEAL::Level dofs     81
+DEAL::Level block[3] 81
+DEAL::Local blocks   4
+DEAL::Renumbering    0 1 2 3
+DEAL::Inverse        0 1 2 3
+DEAL::Global dofs    289
+DEAL::Global blocks  289
+DEAL::Level dofs     9
+DEAL::Level block[0] 9
+DEAL::Level dofs     25
+DEAL::Level block[1] 25
+DEAL::Level dofs     81
+DEAL::Level block[2] 81
+DEAL::Level dofs     289
+DEAL::Level block[3] 289
+DEAL::Local blocks   9
+DEAL::Renumbering    0 1 2 3 4 5 6 7 8
+DEAL::Inverse        0 1 2 3 4 5 6 7 8
+DEAL::Global dofs    821
+DEAL::Global blocks  81 81 81 289 289
+DEAL::Level dofs     30
+DEAL::Level block[0] 4 4 4 9 9
+DEAL::Level dofs     77
+DEAL::Level block[1] 9 9 9 25 25
+DEAL::Level dofs     237
+DEAL::Level block[2] 25 25 25 81 81
+DEAL::Level dofs     821
+DEAL::Level block[3] 81 81 81 289 289
+DEAL::Local blocks   4 4 4 9 9
+DEAL::Renumbering    0 4 8 12 21 1 5 9 13 22 2 6 10 14 23 3 7 11 15 24 16 25 17 26 18 27 19 28 20 29
+DEAL::Inverse        0 5 10 15 1 6 11 16 2 7 12 17 3 8 13 18 20 22 24 26 28 4 9 14 19 21 23 25 27 29

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.