]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added new test `mpi/hp_unify_dof_indices_13`.
authorMarc Fehling <marc.fehling@gmx.net>
Fri, 27 Aug 2021 21:18:45 +0000 (15:18 -0600)
committerMarc Fehling <mafehling.git@gmail.com>
Sat, 28 Aug 2021 01:17:11 +0000 (19:17 -0600)
tests/mpi/hp_unify_dof_indices_13.cc [new file with mode: 0644]
tests/mpi/hp_unify_dof_indices_13.mpirun=1.with_p4est=true.output [new file with mode: 0644]
tests/mpi/hp_unify_dof_indices_13.mpirun=2.with_p4est=true.output [new file with mode: 0644]

diff --git a/tests/mpi/hp_unify_dof_indices_13.cc b/tests/mpi/hp_unify_dof_indices_13.cc
new file mode 100644 (file)
index 0000000..62c6d47
--- /dev/null
@@ -0,0 +1,94 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2021 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+
+// have a 2x2 coarse mesh (or 2x2x1) and verify DoF indices in the hp-
+// case with an FECollection that contains FE_Q elements with increasing degree.
+// the hp-code will unify DoF indices on boundaries between all subdomains.
+
+
+#include <deal.II/distributed/tria.h>
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/hp/fe_collection.h>
+
+#include "../tests.h"
+
+#include "hp_unify_dof_indices.h"
+
+
+template <int dim>
+void
+test()
+{
+  parallel::distributed::Triangulation<dim> triangulation(
+    MPI_COMM_WORLD, Triangulation<dim>::limit_level_difference_at_vertices);
+
+  std::vector<unsigned int> reps(dim, 1U);
+  reps[0] = 2;
+  reps[1] = 2;
+  Point<dim> top_right;
+  for (unsigned int d = 0; d < dim; ++d)
+    top_right[d] = (d == 0 ? 2 : 1);
+  GridGenerator::subdivided_hyper_rectangle(triangulation,
+                                            reps,
+                                            Point<dim>(),
+                                            top_right);
+  Assert(triangulation.n_global_active_cells() == 4, ExcInternalError());
+  Assert(triangulation.n_active_cells() == 4, ExcInternalError());
+
+  hp::FECollection<dim> fe;
+  for (unsigned int d = 1; d <= 4; ++d)
+    fe.push_back(FE_Q<dim>(d));
+
+  DoFHandler<dim> dof_handler(triangulation);
+  for (const auto &cell : dof_handler.active_cell_iterators())
+    if (cell->is_locally_owned())
+      {
+        if (cell->id().to_string() == "0_0:")
+          cell->set_active_fe_index(0);
+        if (cell->id().to_string() == "1_0:")
+          cell->set_active_fe_index(1);
+        if (cell->id().to_string() == "2_0:")
+          cell->set_active_fe_index(2);
+        if (cell->id().to_string() == "3_0:")
+          cell->set_active_fe_index(3);
+      }
+  dof_handler.distribute_dofs(fe);
+
+  log_dof_diagnostics(dof_handler);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+  MPILogInitAll                    log;
+
+  deallog.push("2d");
+  test<2>();
+  deallog.pop();
+
+  deallog.push("3d");
+  test<3>();
+  deallog.pop();
+}
diff --git a/tests/mpi/hp_unify_dof_indices_13.mpirun=1.with_p4est=true.output b/tests/mpi/hp_unify_dof_indices_13.mpirun=1.with_p4est=true.output
new file mode 100644 (file)
index 0000000..285cf06
--- /dev/null
@@ -0,0 +1,31 @@
+
+DEAL:0:2d::Cell: 0.0
+DEAL:0:2d::  locally owned
+DEAL:0:2d::  0 1 2 3
+DEAL:0:2d::Cell: 0.1
+DEAL:0:2d::  locally owned
+DEAL:0:2d::  1 4 3 5 6 7 8 9 10
+DEAL:0:2d::Cell: 0.2
+DEAL:0:2d::  locally owned
+DEAL:0:2d::  2 3 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+DEAL:0:2d::Cell: 0.3
+DEAL:0:2d::  locally owned
+DEAL:0:2d::  3 5 12 25 26 27 28 29 30 31 32 9 33 34 35 36 37 38 39 40 41 42 43 44 45
+DEAL:0:2d::locally_owned_dofs: {[0,45]}
+DEAL:0:2d::n_locally_owned_dofs: 46
+DEAL:0:2d::n_global_dofs: 46
+DEAL:0:3d::Cell: 0.0
+DEAL:0:3d::  locally owned
+DEAL:0:3d::  0 1 2 3 4 5 6 7
+DEAL:0:3d::Cell: 0.1
+DEAL:0:3d::  locally owned
+DEAL:0:3d::  1 8 3 9 5 10 7 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
+DEAL:0:3d::Cell: 0.2
+DEAL:0:3d::  locally owned
+DEAL:0:3d::  2 3 31 32 6 7 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
+DEAL:0:3d::Cell: 0.3
+DEAL:0:3d::  locally owned
+DEAL:0:3d::  3 9 32 91 7 11 34 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 27 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
+DEAL:0:3d::locally_owned_dofs: {[0,208]}
+DEAL:0:3d::n_locally_owned_dofs: 209
+DEAL:0:3d::n_global_dofs: 209
diff --git a/tests/mpi/hp_unify_dof_indices_13.mpirun=2.with_p4est=true.output b/tests/mpi/hp_unify_dof_indices_13.mpirun=2.with_p4est=true.output
new file mode 100644 (file)
index 0000000..5b6abe0
--- /dev/null
@@ -0,0 +1,63 @@
+
+DEAL:0:2d::Cell: 0.0
+DEAL:0:2d::  locally owned
+DEAL:0:2d::  0 1 2 3
+DEAL:0:2d::Cell: 0.1
+DEAL:0:2d::  locally owned
+DEAL:0:2d::  1 4 3 5 6 7 8 9 10
+DEAL:0:2d::Cell: 0.2
+DEAL:0:2d::  ghost
+DEAL:0:2d::  2 3 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+DEAL:0:2d::Cell: 0.3
+DEAL:0:2d::  ghost
+DEAL:0:2d::  3 5 12 25 26 27 28 29 30 31 32 9 33 34 35 36 37 38 39 40 41 42 43 44 45
+DEAL:0:2d::locally_owned_dofs: {[0,10]}
+DEAL:0:2d::n_locally_owned_dofs: 11
+DEAL:0:2d::n_global_dofs: 46
+DEAL:0:3d::Cell: 0.0
+DEAL:0:3d::  locally owned
+DEAL:0:3d::  0 1 2 3 4 5 6 7
+DEAL:0:3d::Cell: 0.1
+DEAL:0:3d::  locally owned
+DEAL:0:3d::  1 8 3 9 5 10 7 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
+DEAL:0:3d::Cell: 0.2
+DEAL:0:3d::  ghost
+DEAL:0:3d::  2 3 31 32 6 7 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
+DEAL:0:3d::Cell: 0.3
+DEAL:0:3d::  ghost
+DEAL:0:3d::  3 9 32 91 7 11 34 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 27 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
+DEAL:0:3d::locally_owned_dofs: {[0,30]}
+DEAL:0:3d::n_locally_owned_dofs: 31
+DEAL:0:3d::n_global_dofs: 209
+
+DEAL:1:2d::Cell: 0.0
+DEAL:1:2d::  ghost
+DEAL:1:2d::  0 1 2 3
+DEAL:1:2d::Cell: 0.1
+DEAL:1:2d::  ghost
+DEAL:1:2d::  1 4 3 5 6 7 8 9 10
+DEAL:1:2d::Cell: 0.2
+DEAL:1:2d::  locally owned
+DEAL:1:2d::  2 3 11 12 13 14 15 16 17 18 19 20 21 22 23 24
+DEAL:1:2d::Cell: 0.3
+DEAL:1:2d::  locally owned
+DEAL:1:2d::  3 5 12 25 26 27 28 29 30 31 32 9 33 34 35 36 37 38 39 40 41 42 43 44 45
+DEAL:1:2d::locally_owned_dofs: {[11,45]}
+DEAL:1:2d::n_locally_owned_dofs: 35
+DEAL:1:2d::n_global_dofs: 46
+DEAL:1:3d::Cell: 0.0
+DEAL:1:3d::  ghost
+DEAL:1:3d::  0 1 2 3 4 5 6 7
+DEAL:1:3d::Cell: 0.1
+DEAL:1:3d::  ghost
+DEAL:1:3d::  1 8 3 9 5 10 7 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
+DEAL:1:3d::Cell: 0.2
+DEAL:1:3d::  locally owned
+DEAL:1:3d::  2 3 31 32 6 7 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
+DEAL:1:3d::Cell: 0.3
+DEAL:1:3d::  locally owned
+DEAL:1:3d::  3 9 32 91 7 11 34 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 27 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
+DEAL:1:3d::locally_owned_dofs: {[31,208]}
+DEAL:1:3d::n_locally_owned_dofs: 178
+DEAL:1:3d::n_global_dofs: 209
+

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.