--- /dev/null
+//---------------------------- extract_dofs_by_component_01_mg.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2000, 2001, 2003, 2004, 2007, 2010, 2012 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.
+//
+//---------------------------- extract_dofs_by_component_01_mg.cc ---------------------------
+
+
+// test internal::extract_dofs_by_component for some corner cases that
+// I was unsure about when refactoring some code in there
+//
+// this is a test for the MG version of this test
+
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/hp/dof_handler.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_raviart_thomas.h>
+#include <deal.II/fe/fe_nedelec.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/multigrid/mg_dof_handler.h>
+#include <deal.II/multigrid/mg_dof_accessor.h>
+
+#include <fstream>
+
+
+
+
+template <int dim>
+void
+check ()
+{
+ Triangulation<dim> tr;
+ GridGenerator::hyper_cube(tr, -1,1);
+ tr.refine_global (1);
+ tr.begin_active()->set_refine_flag();
+ tr.execute_coarsening_and_refinement();
+
+ FESystem<dim> element (FE_Q<dim>(2), 1,
+ FE_Nedelec<dim>(0), 1);
+ MGDoFHandler<dim> dof(tr);
+ dof.distribute_dofs(element);
+
+ // try all possible component
+ // masks, which we encode as bit
+ // strings
+ for (unsigned int int_mask=0; int_mask<(1U<<element.n_components()); ++int_mask)
+ {
+ std::vector<bool> component_mask (element.n_components());
+ for (unsigned int c=0; c<element.n_components(); ++c)
+ component_mask[c] = (int_mask & (1<<c));
+
+ for (unsigned int level=0; level<tr.n_levels(); ++level)
+ {
+ deallog << "level=" << level << std::endl;
+
+ std::vector<bool> dofs (dof.n_dofs(level));
+ DoFTools::extract_level_dofs (level, dof, component_mask, dofs);
+
+ for (unsigned int d=0; d<dofs.size(); ++d)
+ deallog << dofs[d];
+ deallog << std::endl;
+ }
+ }
+}
+
+
+int main ()
+{
+ std::ofstream logfile ("extract_dofs_by_component_01_mg/output");
+ deallog << std::setprecision (2);
+ deallog << std::fixed;
+ deallog.attach(logfile);
+ deallog.depth_console (0);
+
+ deallog.push ("2d");
+ check<2> ();
+ deallog.pop ();
+ deallog.push ("3d");
+ check<3> ();
+ deallog.pop ();
+}
--- /dev/null
+
+DEAL:2d::level=0
+DEAL:2d::0000000000000
+DEAL:2d::level=1
+DEAL:2d::0000000000000000000000000000000000000
+DEAL:2d::level=2
+DEAL:2d::0000000000000000000000000000000000000
+DEAL:2d::level=0
+DEAL:2d::1111101010101
+DEAL:2d::level=1
+DEAL:2d::1111101010101111010101111010101110101
+DEAL:2d::level=2
+DEAL:2d::1111101010101111010101111010101110101
+DEAL:2d::level=0
+DEAL:2d::0000010101010
+DEAL:2d::level=1
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=2
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=0
+DEAL:2d::1111111111111
+DEAL:2d::level=1
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:2d::level=2
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:2d::level=0
+DEAL:2d::0000010101010
+DEAL:2d::level=1
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=2
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=0
+DEAL:2d::1111111111111
+DEAL:2d::level=1
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:2d::level=2
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:2d::level=0
+DEAL:2d::0000010101010
+DEAL:2d::level=1
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=2
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=0
+DEAL:2d::1111111111111
+DEAL:2d::level=1
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:2d::level=2
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000000000000000000000000000000000
+DEAL:3d::level=1
+DEAL:3d::00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+DEAL:3d::level=2
+DEAL:3d::00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+DEAL:3d::level=0
+DEAL:3d::111111111010101010101010101010101111111
+DEAL:3d::level=1
+DEAL:3d::11111111101010101010101010101010111111111111010101010101010111111111110101010101010101111111110101010101111111111010101010101010111111111010101010111111110101010101111111010101111
+DEAL:3d::level=2
+DEAL:3d::11111111101010101010101010101010111111111111010101010101010111111111110101010101010101111111110101010101111111111010101010101010111111111010101010111111110101010101111111010101111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
--- /dev/null
+//---------------------------- extract_dofs_by_component_02_mg.cc ---------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2000, 2001, 2003, 2004, 2007, 2010, 2012 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.
+//
+//---------------------------- extract_dofs_by_component_02_mg.cc ---------------------------
+
+
+// test internal::extract_dofs_by_component for some corner cases that
+// I was unsure about when refactoring some code in there
+//
+// this particular test checks the call path to
+// internal::extract_dofs_by_component from DoFTools::extract_dofs via
+// the block_select flag
+
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/grid/tria.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/hp/dof_handler.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_raviart_thomas.h>
+#include <deal.II/fe/fe_nedelec.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/dofs/dof_tools.h>
+#include <deal.II/multigrid/mg_dof_handler.h>
+#include <deal.II/multigrid/mg_dof_accessor.h>
+
+#include <fstream>
+
+
+
+
+template <int dim>
+void
+check ()
+{
+ Triangulation<dim> tr;
+ GridGenerator::hyper_cube(tr, -1,1);
+ tr.refine_global (1);
+ tr.begin_active()->set_refine_flag();
+ tr.execute_coarsening_and_refinement();
+
+ FESystem<dim> element (FE_Q<dim>(2), 1,
+ FE_Nedelec<dim>(0), 1);
+ MGDoFHandler<dim> dof(tr);
+ dof.distribute_dofs(element);
+
+ // try all possible block
+ // masks, which we encode as bit
+ // strings
+ for (unsigned int int_mask=0; int_mask<(1U<<element[0].n_blocks()); ++int_mask)
+ {
+ std::vector<bool> component_mask (element[0].n_blocks());
+ for (unsigned int c=0; c<element[0].n_blocks(); ++c)
+ component_mask[c] = (int_mask & (1<<c));
+
+ for (unsigned int level=0; level<tr.n_levels(); ++level)
+ {
+ deallog << "level=" << level << std::endl;
+
+ std::vector<bool> dofs (dof.n_dofs(level));
+ DoFTools::extract_level_dofs (level, dof, component_mask, dofs, true);
+
+ for (unsigned int d=0; d<dofs.size(); ++d)
+ deallog << dofs[d];
+ deallog << std::endl;
+ }
+ }
+}
+
+
+int main ()
+{
+ std::ofstream logfile ("extract_dofs_by_component_02_mg/output");
+ deallog << std::setprecision (2);
+ deallog << std::fixed;
+ deallog.attach(logfile);
+ deallog.depth_console (0);
+
+ deallog.push ("2d");
+ check<2> ();
+ deallog.pop ();
+ deallog.push ("3d");
+ check<3> ();
+ deallog.pop ();
+}
--- /dev/null
+
+DEAL:2d::level=0
+DEAL:2d::0000000000000
+DEAL:2d::level=1
+DEAL:2d::0000000000000000000000000000000000000
+DEAL:2d::level=2
+DEAL:2d::0000000000000000000000000000000000000
+DEAL:2d::level=0
+DEAL:2d::1111101010101
+DEAL:2d::level=1
+DEAL:2d::1111101010101111010101111010101110101
+DEAL:2d::level=2
+DEAL:2d::1111101010101111010101111010101110101
+DEAL:2d::level=0
+DEAL:2d::0000010101010
+DEAL:2d::level=1
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=2
+DEAL:2d::0000010101010000101010000101010001010
+DEAL:2d::level=0
+DEAL:2d::1111111111111
+DEAL:2d::level=1
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:2d::level=2
+DEAL:2d::1111111111111111111111111111111111111
+DEAL:3d::level=0
+DEAL:3d::000000000000000000000000000000000000000
+DEAL:3d::level=1
+DEAL:3d::00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+DEAL:3d::level=2
+DEAL:3d::00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+DEAL:3d::level=0
+DEAL:3d::111111111010101010101010101010101111111
+DEAL:3d::level=1
+DEAL:3d::11111111101010101010101010101010111111111111010101010101010111111111110101010101010101111111110101010101111111111010101010101010111111111010101010111111110101010101111111010101111
+DEAL:3d::level=2
+DEAL:3d::11111111101010101010101010101010111111111111010101010101010111111111110101010101010101111111110101010101111111111010101010101010111111111010101010111111110101010101111111010101111
+DEAL:3d::level=0
+DEAL:3d::000000000101010101010101010101010000000
+DEAL:3d::level=1
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=2
+DEAL:3d::00000000010101010101010101010101000000000000101010101010101000000000001010101010101010000000001010101010000000000101010101010101000000000101010101000000001010101010000000101010000
+DEAL:3d::level=0
+DEAL:3d::111111111111111111111111111111111111111
+DEAL:3d::level=1
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
+DEAL:3d::level=2
+DEAL:3d::11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111