From 86e769efe6e1fc905afe559f55cc501bb1ffd055 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 27 Aug 2021 16:04:28 -0600 Subject: [PATCH] Added new test `mpi/hp_unify_dof_indices_14`. --- tests/mpi/hp_unify_dof_indices_14.cc | 94 +++++++++++++++++++ ...indices_14.mpirun=1.with_p4est=true.output | 31 ++++++ ...indices_14.mpirun=2.with_p4est=true.output | 63 +++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 tests/mpi/hp_unify_dof_indices_14.cc create mode 100644 tests/mpi/hp_unify_dof_indices_14.mpirun=1.with_p4est=true.output create mode 100644 tests/mpi/hp_unify_dof_indices_14.mpirun=2.with_p4est=true.output diff --git a/tests/mpi/hp_unify_dof_indices_14.cc b/tests/mpi/hp_unify_dof_indices_14.cc new file mode 100644 index 0000000000..1f8859375e --- /dev/null +++ b/tests/mpi/hp_unify_dof_indices_14.cc @@ -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 decreasing degree. +// the hp-code will unify DoF indices on boundaries between all subdomains. + + +#include + +#include + +#include + +#include + +#include + +#include "../tests.h" + +#include "hp_unify_dof_indices.h" + + +template +void +test() +{ + parallel::distributed::Triangulation triangulation( + MPI_COMM_WORLD, Triangulation::limit_level_difference_at_vertices); + + std::vector reps(dim, 1U); + reps[0] = 2; + reps[1] = 2; + Point top_right; + for (unsigned int d = 0; d < dim; ++d) + top_right[d] = (d == 0 ? 2 : 1); + GridGenerator::subdivided_hyper_rectangle(triangulation, + reps, + Point(), + top_right); + Assert(triangulation.n_global_active_cells() == 4, ExcInternalError()); + Assert(triangulation.n_active_cells() == 4, ExcInternalError()); + + hp::FECollection fe; + for (unsigned int d = 4; d >= 1; --d) + fe.push_back(FE_Q(d)); + + DoFHandler 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_14.mpirun=1.with_p4est=true.output b/tests/mpi/hp_unify_dof_indices_14.mpirun=1.with_p4est=true.output new file mode 100644 index 0000000000..a440d70a42 --- /dev/null +++ b/tests/mpi/hp_unify_dof_indices_14.mpirun=1.with_p4est=true.output @@ -0,0 +1,31 @@ + +DEAL:0:2d::Cell: 0.0 +DEAL:0:2d:: locally owned +DEAL:0:2d:: 0 21 35 42 1 2 3 4 5 6 7 8 9 10 39 11 12 13 14 15 16 17 18 19 20 +DEAL:0:2d::Cell: 0.1 +DEAL:0:2d:: locally owned +DEAL:0:2d:: 21 22 42 43 23 24 25 26 27 28 29 30 31 32 33 34 +DEAL:0:2d::Cell: 0.2 +DEAL:0:2d:: locally owned +DEAL:0:2d:: 35 42 36 44 37 38 39 40 41 +DEAL:0:2d::Cell: 0.3 +DEAL:0:2d:: locally owned +DEAL:0:2d:: 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 118 178 201 1 120 180 205 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 196 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 +DEAL:0:3d::Cell: 0.1 +DEAL:0:3d:: locally owned +DEAL:0:3d:: 118 119 201 202 120 121 205 206 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 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 +DEAL:0:3d::Cell: 0.2 +DEAL:0:3d:: locally owned +DEAL:0:3d:: 178 201 179 203 180 205 181 207 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 +DEAL:0:3d::Cell: 0.3 +DEAL:0:3d:: locally owned +DEAL:0:3d:: 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_14.mpirun=2.with_p4est=true.output b/tests/mpi/hp_unify_dof_indices_14.mpirun=2.with_p4est=true.output new file mode 100644 index 0000000000..c92386af6a --- /dev/null +++ b/tests/mpi/hp_unify_dof_indices_14.mpirun=2.with_p4est=true.output @@ -0,0 +1,63 @@ + +DEAL:0:2d::Cell: 0.0 +DEAL:0:2d:: locally owned +DEAL:0:2d:: 0 21 35 42 1 2 3 4 5 6 7 8 9 10 39 11 12 13 14 15 16 17 18 19 20 +DEAL:0:2d::Cell: 0.1 +DEAL:0:2d:: locally owned +DEAL:0:2d:: 21 22 42 43 23 24 25 26 27 28 29 30 31 32 33 34 +DEAL:0:2d::Cell: 0.2 +DEAL:0:2d:: ghost +DEAL:0:2d:: 35 42 36 44 37 38 39 40 41 +DEAL:0:2d::Cell: 0.3 +DEAL:0:2d:: ghost +DEAL:0:2d:: 42 43 44 45 +DEAL:0:2d::locally_owned_dofs: {[0,34]} +DEAL:0:2d::n_locally_owned_dofs: 35 +DEAL:0:2d::n_global_dofs: 46 +DEAL:0:3d::Cell: 0.0 +DEAL:0:3d:: locally owned +DEAL:0:3d:: 0 118 178 201 1 120 180 205 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 196 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 +DEAL:0:3d::Cell: 0.1 +DEAL:0:3d:: locally owned +DEAL:0:3d:: 118 119 201 202 120 121 205 206 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 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 +DEAL:0:3d::Cell: 0.2 +DEAL:0:3d:: ghost +DEAL:0:3d:: 178 201 179 203 180 205 181 207 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 +DEAL:0:3d::Cell: 0.3 +DEAL:0:3d:: ghost +DEAL:0:3d:: 201 202 203 204 205 206 207 208 +DEAL:0:3d::locally_owned_dofs: {[0,177]} +DEAL:0:3d::n_locally_owned_dofs: 178 +DEAL:0:3d::n_global_dofs: 209 + +DEAL:1:2d::Cell: 0.0 +DEAL:1:2d:: ghost +DEAL:1:2d:: 0 21 35 42 1 2 3 4 5 6 7 8 9 10 39 11 12 13 14 15 16 17 18 19 20 +DEAL:1:2d::Cell: 0.1 +DEAL:1:2d:: ghost +DEAL:1:2d:: 21 22 42 43 23 24 25 26 27 28 29 30 31 32 33 34 +DEAL:1:2d::Cell: 0.2 +DEAL:1:2d:: locally owned +DEAL:1:2d:: 35 42 36 44 37 38 39 40 41 +DEAL:1:2d::Cell: 0.3 +DEAL:1:2d:: locally owned +DEAL:1:2d:: 42 43 44 45 +DEAL:1:2d::locally_owned_dofs: {[35,45]} +DEAL:1:2d::n_locally_owned_dofs: 11 +DEAL:1:2d::n_global_dofs: 46 +DEAL:1:3d::Cell: 0.0 +DEAL:1:3d:: ghost +DEAL:1:3d:: 0 118 178 201 1 120 180 205 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 196 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 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 +DEAL:1:3d::Cell: 0.1 +DEAL:1:3d:: ghost +DEAL:1:3d:: 118 119 201 202 120 121 205 206 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 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 +DEAL:1:3d::Cell: 0.2 +DEAL:1:3d:: locally owned +DEAL:1:3d:: 178 201 179 203 180 205 181 207 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 +DEAL:1:3d::Cell: 0.3 +DEAL:1:3d:: locally owned +DEAL:1:3d:: 201 202 203 204 205 206 207 208 +DEAL:1:3d::locally_owned_dofs: {[178,208]} +DEAL:1:3d::n_locally_owned_dofs: 31 +DEAL:1:3d::n_global_dofs: 209 + -- 2.39.5