From: Daniel Arndt Date: Wed, 20 Dec 2017 15:58:40 +0000 (+0100) Subject: Update NumberCache after adding periodicity to a p::d::Triangulation X-Git-Tag: v9.0.0-rc1~634^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c90e222380841c695665423c417543475ee665c;p=dealii.git Update NumberCache after adding periodicity to a p::d::Triangulation --- diff --git a/doc/news/changes/minor/20171220DanielArndtSambitDas b/doc/news/changes/minor/20171220DanielArndtSambitDas new file mode 100644 index 0000000000..208cd8e776 --- /dev/null +++ b/doc/news/changes/minor/20171220DanielArndtSambitDas @@ -0,0 +1,4 @@ +Fixed: parallel::distributed::Triangulation::add_periodicity missed to +update the ghost_owners in the NumberCache member variable. +
+(Daniel Arndt, Sambit Das, 2017/12/11) diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 2f6731e24d..d9fc1b5e1b 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -3522,6 +3522,7 @@ namespace parallel //finally call the base class for storing the periodicity information dealii::Triangulation::add_periodicity(periodicity_vector); + this->update_number_cache(); #else Assert(false, ExcMessage ("Need p4est version >= 0.3.4.1!")); #endif diff --git a/tests/mpi/periodicity_05.cc b/tests/mpi/periodicity_05.cc new file mode 100644 index 0000000000..9f8135deaf --- /dev/null +++ b/tests/mpi/periodicity_05.cc @@ -0,0 +1,72 @@ +/* --------------------------------------------------------------------- + * + * Copyright (C) 2017 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. + * + * --------------------------------------------------------------------- + */ + + +// This testcase previously failed due to missing to update the NumberCache in +// add_periodicity(). This resulted in ghost_owners to be wrong and not sending +// all required messages in GridTools::exchange_cell_data_to_ghosts. + +#include +#include +#include +#include "../tests.h" + + +int main (int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + mpi_initlog(); + const double L=7.6/2.0; + parallel::distributed::Triangulation<3> triangulation(MPI_COMM_WORLD); + GridIn<3> gridin; + gridin.attach_triangulation(triangulation); + std::ifstream f(SOURCE_DIR "/periodicity_05.inp"); + gridin.read_ucd(f); + + typename parallel::distributed::Triangulation<3>::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); + for (; cell!=endc; ++cell) + { + for (unsigned int f=0; f < GeometryInfo<3>::faces_per_cell; ++f) + { + const Point<3> face_center = cell->face(f)->center(); + if (cell->face(f)->at_boundary()) + { + if (std::abs(face_center[0]+(L))<1.0e-4) + cell->face(f)->set_boundary_id(1); + else if (std::abs(face_center[0]-(L))<1.0e-4) + cell->face(f)->set_boundary_id(2); + else if (std::abs(face_center[1]+(L))<1.0e-4) + cell->face(f)->set_boundary_id(3); + else if (std::abs(face_center[1]-(L))<1.0e-4) + cell->face(f)->set_boundary_id(4); + else if (std::abs(face_center[2]+(L))<1.0e-4) + cell->face(f)->set_boundary_id(5); + else if (std::abs(face_center[2]-(L))<1.0e-4) + cell->face(f)->set_boundary_id(6); + } + } + } + + std::vector::cell_iterator> > periodicity_vector; + for (int i = 0; i < 3; ++i) + GridTools::collect_periodic_faces(triangulation, /*b_id1*/ 2*i+1, /*b_id2*/ 2*i+2,/*direction*/ i, periodicity_vector); + triangulation.add_periodicity(periodicity_vector); + + FE_Q<3> fe(1); + DoFHandler<3> dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + deallog << "OK" << std::endl; +} diff --git a/tests/mpi/periodicity_05.inp b/tests/mpi/periodicity_05.inp new file mode 100644 index 0000000000..3629c6907a --- /dev/null +++ b/tests/mpi/periodicity_05.inp @@ -0,0 +1,190 @@ +125 64 0 0 0 +1 -3.8 3.8 -3.8 +2 -1.9 3.8 -3.8 +3 -1.9 3.8 -1.9 +4 -3.8 3.8 -1.9 +5 -3.8 1.9 -3.8 +6 -1.9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.9 -1.9 -1.9 +79 -3.8 -1.9 -1.9 +80 0 -1.9 -3.8 +81 0 -1.9 -1.9 +82 1.9 -1.9 -3.8 +83 1.9 -1.9 -1.9 +84 3.8 -1.9 -3.8 +85 3.8 -1.9 -1.9 +86 -1.9 -1.9 0 +87 -3.8 -1.9 0 +88 0 -1.9 0 +89 1.9 -1.9 0 +90 3.8 -1.9 0 +91 -1.9 -1.9 1.9 +92 -3.8 -1.9 1.9 +93 0 -1.9 1.9 +94 1.9 -1.9 1.9 +95 3.8 -1.9 1.9 +96 -1.9 -1.9 3.8 +97 -3.8 -1.9 3.8 +98 0 -1.9 3.8 +99 1.9 -1.9 3.8 +100 3.8 -1.9 3.8 +101 -3.8 -3.8 -3.8 +102 -1.9 -3.8 -3.8 +103 -1.9 -3.8 -1.9 +104 -3.8 -3.8 -1.9 +105 0 -3.8 -3.8 +106 0 -3.8 -1.9 +107 1.9 -3.8 -3.8 +108 1.9 -3.8 -1.9 +109 3.8 -3.8 -3.8 +110 3.8 -3.8 -1.9 +111 -1.9 -3.8 0 +112 -3.8 -3.8 0 +113 0 -3.8 0 +114 1.9 -3.8 0 +115 3.8 -3.8 0 +116 -1.9 -3.8 1.9 +117 -3.8 -3.8 1.9 +118 0 -3.8 1.9 +119 1.9 -3.8 1.9 +120 3.8 -3.8 1.9 +121 -1.9 -3.8 3.8 +122 -3.8 -3.8 3.8 +123 0 -3.8 3.8 +124 1.9 -3.8 3.8 +125 3.8 -3.8 3.8 +1 0 hex 1 4 3 2 5 8 7 6 +2 0 hex 2 3 10 9 6 7 12 11 +3 0 hex 9 10 14 13 11 12 16 15 +4 0 hex 13 14 18 17 15 16 20 19 +5 0 hex 4 22 21 3 8 24 23 7 +6 0 hex 3 21 25 10 7 23 26 12 +7 0 hex 10 25 27 14 12 26 28 16 +8 0 hex 14 27 29 18 16 28 30 20 +9 0 hex 22 32 31 21 24 34 33 23 +10 0 hex 21 31 35 25 23 33 36 26 +11 0 hex 25 35 37 27 26 36 38 28 +12 0 hex 27 37 39 29 28 38 40 30 +13 0 hex 32 42 41 31 34 44 43 33 +14 0 hex 31 41 45 35 33 43 46 36 +15 0 hex 35 45 47 37 36 46 48 38 +16 0 hex 37 47 49 39 38 48 50 40 +17 0 hex 5 8 7 6 51 54 53 52 +18 0 hex 6 7 12 11 52 53 56 55 +19 0 hex 11 12 16 15 55 56 58 57 +20 0 hex 15 16 20 19 57 58 60 59 +21 0 hex 8 24 23 7 54 62 61 53 +22 0 hex 7 23 26 12 53 61 63 56 +23 0 hex 12 26 28 16 56 63 64 58 +24 0 hex 16 28 30 20 58 64 65 60 +25 0 hex 24 34 33 23 62 67 66 61 +26 0 hex 23 33 36 26 61 66 68 63 +27 0 hex 26 36 38 28 63 68 69 64 +28 0 hex 28 38 40 30 64 69 70 65 +29 0 hex 34 44 43 33 67 72 71 66 +30 0 hex 33 43 46 36 66 71 73 68 +31 0 hex 36 46 48 38 68 73 74 69 +32 0 hex 38 48 50 40 69 74 75 70 +33 0 hex 51 54 53 52 76 79 78 77 +34 0 hex 52 53 56 55 77 78 81 80 +35 0 hex 55 56 58 57 80 81 83 82 +36 0 hex 57 58 60 59 82 83 85 84 +37 0 hex 54 62 61 53 79 87 86 78 +38 0 hex 53 61 63 56 78 86 88 81 +39 0 hex 56 63 64 58 81 88 89 83 +40 0 hex 58 64 65 60 83 89 90 85 +41 0 hex 62 67 66 61 87 92 91 86 +42 0 hex 61 66 68 63 86 91 93 88 +43 0 hex 63 68 69 64 88 93 94 89 +44 0 hex 64 69 70 65 89 94 95 90 +45 0 hex 67 72 71 66 92 97 96 91 +46 0 hex 66 71 73 68 91 96 98 93 +47 0 hex 68 73 74 69 93 98 99 94 +48 0 hex 69 74 75 70 94 99 100 95 +49 0 hex 76 79 78 77 101 104 103 102 +50 0 hex 77 78 81 80 102 103 106 105 +51 0 hex 80 81 83 82 105 106 108 107 +52 0 hex 82 83 85 84 107 108 110 109 +53 0 hex 79 87 86 78 104 112 111 103 +54 0 hex 78 86 88 81 103 111 113 106 +55 0 hex 81 88 89 83 106 113 114 108 +56 0 hex 83 89 90 85 108 114 115 110 +57 0 hex 87 92 91 86 112 117 116 111 +58 0 hex 86 91 93 88 111 116 118 113 +59 0 hex 88 93 94 89 113 118 119 114 +60 0 hex 89 94 95 90 114 119 120 115 +61 0 hex 92 97 96 91 117 122 121 116 +62 0 hex 91 96 98 93 116 121 123 118 +63 0 hex 93 98 99 94 118 123 124 119 +64 0 hex 94 99 100 95 119 124 125 120 diff --git a/tests/mpi/periodicity_05.mpirun=9.output b/tests/mpi/periodicity_05.mpirun=9.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/mpi/periodicity_05.mpirun=9.output @@ -0,0 +1,2 @@ + +DEAL::OK