]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test for MGConstrainedDofs
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Jul 2016 00:08:18 +0000 (02:08 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 20 Jul 2016 00:22:49 +0000 (02:22 +0200)
tests/multigrid/constrained_dofs_03.cc [new file with mode: 0644]
tests/multigrid/constrained_dofs_03.output [new file with mode: 0644]

diff --git a/tests/multigrid/constrained_dofs_03.cc b/tests/multigrid/constrained_dofs_03.cc
new file mode 100644 (file)
index 0000000..6f55029
--- /dev/null
@@ -0,0 +1,115 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2006 - 2016 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// check mg constrained dofs for primitive and non-primitive FiniteElements
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/function.h>
+#include <deal.II/lac/vector.h>
+#include <deal.II/lac/block_vector.h>
+#include <deal.II/distributed/tria.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/dofs/function_map.h>
+#include <deal.II/fe/fe_dgq.h>
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_raviart_thomas.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/dofs/dof_accessor.h>
+#include <deal.II/multigrid/mg_tools.h>
+#include <deal.II/multigrid/mg_constrained_dofs.h>
+
+#include <fstream>
+#include <iomanip>
+#include <iomanip>
+#include <algorithm>
+
+using namespace std;
+
+template <int dim>
+void check_fe(FiniteElement<dim> &fe, ComponentMask &component_mask)
+{
+  deallog << fe.get_name() << std::endl;
+
+  Triangulation<dim> tr;
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global(1);
+
+  DoFHandler<dim> dofh(tr);
+  dofh.distribute_dofs(fe);
+  dofh.distribute_mg_dofs(fe);
+
+  MGConstrainedDoFs                    mg_constrained_dofs;
+  std::vector<types::boundary_id>      boundary_indicators(1,0);
+  mg_constrained_dofs.initialize(dofh);
+  mg_constrained_dofs.set_zero_boundary_dofs(dofh, boundary_indicators, component_mask);
+
+  const unsigned int n_levels = tr.n_global_levels();
+  for (unsigned int level = 0; level < n_levels; ++level)
+    {
+      deallog << "Level " << level << ":" << std::endl;
+      IndexSet boundary_indices = mg_constrained_dofs.get_boundary_indices (level);
+      boundary_indices.print(deallog);
+    }
+}
+
+template <int dim>
+void check()
+{
+  //All primitive
+  {
+    FE_Q<dim> q1(2);
+    FE_Q<dim> q2(1);
+    FESystem<dim> s1(q1, dim, q2,1);
+
+    //All selected
+    ComponentMask component_mask1(dim+1, true);
+    //Partially selecetd
+    ComponentMask component_mask2(dim+1, true);
+    component_mask2.set(dim, false);
+
+    check_fe(s1, component_mask1);
+    check_fe(s1, component_mask2);
+  }
+
+  //Non-primitive
+  {
+    FE_RaviartThomas<dim> q1(1);
+    FE_DGQ<dim> q2(1);
+    FESystem<dim> s1(q1, 1, q2,1);
+
+    //All selected
+    ComponentMask component_mask1(dim+1, true);
+    //Partially selecetd
+    ComponentMask component_mask2(dim+1, true);
+    component_mask2.set(dim, false);
+
+    check_fe(s1, component_mask1);
+    check_fe(s1, component_mask2);
+  }
+}
+
+int main(int argc, char *argv[])
+{
+  std::ofstream logfile("output");
+  deallog.attach(logfile);
+
+  check<2> ();
+  check<3> ();
+}
diff --git a/tests/multigrid/constrained_dofs_03.output b/tests/multigrid/constrained_dofs_03.output
new file mode 100644 (file)
index 0000000..892c0ee
--- /dev/null
@@ -0,0 +1,41 @@
+
+DEAL::FESystem<2>[FE_Q<2>(2)^2-FE_Q<2>(1)]
+DEAL::Level 0:
+DEAL::{[0,19]}
+DEAL::Level 1:
+DEAL::{[0,8], [12,13], [16,17], [22,31], [36,43], [46,47], [50,56]}
+DEAL::FESystem<2>[FE_Q<2>(2)^2-FE_Q<2>(1)]
+DEAL::Level 0:
+DEAL::{[0,1], [3,4], [6,7], [9,10], [12,19]}
+DEAL::Level 1:
+DEAL::{[0,1], [3,4], [6,7], [12,13], [16,17], [22,23], [25,26], [28,31], [36,37], [39,40], [42,43], [46,47], [50,51], [53,56]}
+DEAL::FESystem<2>[FE_RaviartThomas<2>(1)-FE_DGQ<2>(1)]
+DEAL::Level 0:
+DEAL::{[0,7]}
+DEAL::Level 1:
+DEAL::{[0,1], [4,5], [16,19], [30,31], [34,35], [44,47]}
+DEAL::FESystem<2>[FE_RaviartThomas<2>(1)-FE_DGQ<2>(1)]
+DEAL::Level 0:
+DEAL::{[0,7]}
+DEAL::Level 1:
+DEAL::{[0,1], [4,5], [16,19], [30,31], [34,35], [44,47]}
+DEAL::FESystem<3>[FE_Q<3>(2)^3-FE_Q<3>(1)]
+DEAL::Level 0:
+DEAL::{[0,85]}
+DEAL::Level 1:
+DEAL::{[0,27], [32,46], [50,52], [56,64], [68,70], [74,76], [80,82], [89,119], [123,134], [138,140], [147,174], [178,189], [193,198], [205,236], [243,279], [283,285], [289,291], [295,297], [301,329], [333,335], [339,364], [368,373], [377,398]}
+DEAL::FESystem<3>[FE_Q<3>(2)^3-FE_Q<3>(1)]
+DEAL::Level 0:
+DEAL::{[0,2], [4,6], [8,10], [12,14], [16,18], [20,22], [24,26], [28,30], [32,85]}
+DEAL::Level 1:
+DEAL::{[0,2], [4,6], [8,10], [12,14], [16,18], [20,22], [24,26], [32,46], [50,52], [56,64], [68,70], [74,76], [80,82], [89,91], [93,95], [97,99], [101,103], [105,119], [123,134], [138,140], [147,149], [151,153], [155,157], [159,161], [163,174], [178,189], [193,198], [205,207], [209,211], [213,236], [243,245], [247,249], [251,253], [255,257], [259,279], [283,285], [289,291], [295,297], [301,303], [305,307], [309,329], [333,335], [339,341], [343,345], [347,364], [368,373], [377,379], [381,398]}
+DEAL::FESystem<3>[FE_RaviartThomas<3>(1)-FE_DGQ<3>(1)]
+DEAL::Level 0:
+DEAL::{[0,23]}
+DEAL::Level 1:
+DEAL::{[0,3], [8,11], [16,19], [44,51], [56,59], [84,87], [92,99], [124,135], [160,163], [168,171], [176,179], [200,207], [212,215], [236,239], [244,251], [272,283]}
+DEAL::FESystem<3>[FE_RaviartThomas<3>(1)-FE_DGQ<3>(1)]
+DEAL::Level 0:
+DEAL::{[0,23]}
+DEAL::Level 1:
+DEAL::{[0,3], [8,11], [16,19], [44,51], [56,59], [84,87], [92,99], [124,135], [160,163], [168,171], [176,179], [200,207], [212,215], [236,239], [244,251], [272,283]}

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.