--- /dev/null
+//----------------------------------------------------------------------
+// $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);
+}
--- /dev/null
+
+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