From: bangerth Date: Tue, 24 Jul 2012 23:35:44 +0000 (+0000) Subject: Make DoFTools::make_zero_boundary_constraints work in parallel. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=961d9e9955b116abc6fe1534ecec2c0a19f4cd90;p=dealii-svn.git Make DoFTools::make_zero_boundary_constraints work in parallel. git-svn-id: https://svn.dealii.org/trunk@25725 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 7d32b7f25e..f98af3824b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -216,9 +216,13 @@ enabled due to a missing include file in file

Specific improvements

    -
  1. Fixed: GridTools::find_active_cell_around_point() works now also if the cell in which the point we look for lies is not adjacent to the closest vertex of p. The tests bits/find_cell_8 and _9 illustrate this. +
  2. Fixed: DoFTools::make_zero_boundary_constraints now also works for parallel distributed triangulations.
    -(Wolfgang Bangerth, Christian Goll 2012/07/22) +(Wolfgang Bangerth, Christian Goll 2012/07/24) + +
  3. Fixed: GridTools::find_active_cell_around_point() works now also if the cell in which the point we look for lies is not adjacent to the closest vertex of p. The tests bits/find_cell_8 and _9 illustrate this. +
    +(Wolfgang Bangerth, Christian Goll 2012/07/20)
  4. Fixed: Using the SolutionTransfer class with hp::DoFHandler and on meshes where some cells are associated with a FE_Nothing element diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index d4ab38d510..891c69ef93 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@ -6139,46 +6139,47 @@ namespace DoFTools cell = dof.begin_active(), endc = dof.end(); for (; cell!=endc; ++cell) - for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; - ++face_no) - { - const FiniteElement &fe = cell->get_fe(); + if (!cell->is_artificial()) + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + { + const FiniteElement &fe = cell->get_fe(); - typename DH::face_iterator face = cell->face(face_no); + typename DH::face_iterator face = cell->face(face_no); // if face is on the boundary - if (face->at_boundary ()) - { - // get indices and physical - // location on this face - face_dofs.resize (fe.dofs_per_face); - face->get_dof_indices (face_dofs, cell->active_fe_index()); - - // enter those dofs into the list - // that match the component - // signature. - for (unsigned int i=0; i &nonzero_component_array - = cell->get_fe().get_nonzero_components (i); - bool nonzero = false; - for (unsigned int c=0; cat_boundary ()) + { + // get indices and physical + // location on this face + face_dofs.resize (fe.dofs_per_face); + face->get_dof_indices (face_dofs, cell->active_fe_index()); + + // enter those dofs into the list + // that match the component + // signature. + for (unsigned int i=0; i &nonzero_component_array + = cell->get_fe().get_nonzero_components (i); + bool nonzero = false; + for (unsigned int c=0; c diff --git a/tests/mpi/make_zero_boundary_values.cc b/tests/mpi/make_zero_boundary_values.cc new file mode 100644 index 0000000000..1401ddbf73 --- /dev/null +++ b/tests/mpi/make_zero_boundary_values.cc @@ -0,0 +1,108 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2009, 2010, 2011, 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. +// +//--------------------------------------------------------------------------- + + +// Test DoFTools::make_zero_boundary_constraints for parallel DoFHandlers + +#include "../tests.h" +#include "coarse_grid_common.h" +#include +#include +#include +#include +#include +#include + +#include + + +template +void test() +{ + parallel::distributed::Triangulation tr(MPI_COMM_WORLD); + + GridGenerator::hyper_ball(tr); + tr.refine_global (2); + + const FE_Q fe(2); + DoFHandler dofh(tr); + dofh.distribute_dofs (fe); + + { + ConstraintMatrix boundary_values; + DoFTools::make_zero_boundary_constraints (dofh, + boundary_values); + if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) + boundary_values.print (deallog.get_file_stream()); + } + + // the result of extract_boundary_dofs is + // supposed to be a subset of the locally + // relevant dofs, so do the test again with + // that + { + IndexSet relevant_set (dofh.n_dofs()); + DoFTools::extract_locally_relevant_dofs (dofh, relevant_set); + ConstraintMatrix boundary_values (relevant_set); + DoFTools::make_zero_boundary_constraints (dofh, + boundary_values); + if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) + boundary_values.print (deallog.get_file_stream()); + } +} + + +int main(int argc, char *argv[]) +{ +#ifdef DEAL_II_COMPILER_SUPPORTS_MPI + MPI_Init (&argc,&argv); +#else + (void)argc; + (void)argv; +#endif + + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + + + deallog.push(Utilities::int_to_string(myid)); + + if (myid == 0) + { + std::ofstream logfile(output_file_for_mpi("make_zero_boundary_values").c_str()); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + deallog.push("2d"); + test<2>(); + deallog.pop(); + + deallog.push("3d"); + test<3>(); + deallog.pop(); + } + else + { + deallog.push("2d"); + test<2>(); + deallog.pop(); + + deallog.push("3d"); + test<3>(); + deallog.pop(); + } + +#ifdef DEAL_II_COMPILER_SUPPORTS_MPI + MPI_Finalize(); +#endif +} diff --git a/tests/mpi/make_zero_boundary_values/ncpu_10/cmp/generic b/tests/mpi/make_zero_boundary_values/ncpu_10/cmp/generic new file mode 100644 index 0000000000..4e4feb0bcd --- /dev/null +++ b/tests/mpi/make_zero_boundary_values/ncpu_10/cmp/generic @@ -0,0 +1,317 @@ + + 0 = 0 + 1 = 0 + 6 = 0 + 9 = 0 + 12 = 0 + 25 = 0 + 28 = 0 + 31 = 0 + 34 = 0 + 81 = 0 + 83 = 0 + 153 = 0 + 156 = 0 + 0 = 0 + 1 = 0 + 6 = 0 + 9 = 0 + 12 = 0 + 25 = 0 + 28 = 0 + 31 = 0 + 34 = 0 + 81 = 0 + 83 = 0 + 153 = 0 + 156 = 0 + 0 = 0 + 1 = 0 + 2 = 0 + 3 = 0 + 8 = 0 + 9 = 0 + 10 = 0 + 11 = 0 + 24 = 0 + 27 = 0 + 28 = 0 + 31 = 0 + 32 = 0 + 33 = 0 + 42 = 0 + 45 = 0 + 46 = 0 + 49 = 0 + 50 = 0 + 51 = 0 + 60 = 0 + 63 = 0 + 65 = 0 + 66 = 0 + 72 = 0 + 125 = 0 + 126 = 0 + 129 = 0 + 130 = 0 + 131 = 0 + 140 = 0 + 143 = 0 + 144 = 0 + 147 = 0 + 148 = 0 + 149 = 0 + 158 = 0 + 161 = 0 + 163 = 0 + 164 = 0 + 170 = 0 + 173 = 0 + 175 = 0 + 176 = 0 + 182 = 0 + 225 = 0 + 226 = 0 + 229 = 0 + 230 = 0 + 231 = 0 + 240 = 0 + 243 = 0 + 245 = 0 + 246 = 0 + 252 = 0 + 255 = 0 + 256 = 0 + 259 = 0 + 260 = 0 + 261 = 0 + 270 = 0 + 273 = 0 + 275 = 0 + 276 = 0 + 282 = 0 + 325 = 0 + 327 = 0 + 328 = 0 + 334 = 0 + 337 = 0 + 339 = 0 + 340 = 0 + 346 = 0 + 349 = 0 + 351 = 0 + 352 = 0 + 358 = 0 + 361 = 0 + 363 = 0 + 364 = 0 + 370 = 0 + 729 = 0 + 730 = 0 + 735 = 0 + 737 = 0 + 738 = 0 + 743 = 0 + 747 = 0 + 750 = 0 + 752 = 0 + 755 = 0 + 829 = 0 + 832 = 0 + 834 = 0 + 837 = 0 + 841 = 0 + 844 = 0 + 846 = 0 + 849 = 0 + 1377 = 0 + 1379 = 0 + 1385 = 0 + 1387 = 0 + 1381 = 0 + 1389 = 0 + 1407 = 0 + 1412 = 0 + 1409 = 0 + 1414 = 0 + 1557 = 0 + 1562 = 0 + 1559 = 0 + 1564 = 0 + 1577 = 0 + 1582 = 0 + 1579 = 0 + 1584 = 0 + 2025 = 0 + 2028 = 0 + 2030 = 0 + 2033 = 0 + 2037 = 0 + 2040 = 0 + 2042 = 0 + 2045 = 0 + 2105 = 0 + 2108 = 0 + 2110 = 0 + 2113 = 0 + 2117 = 0 + 2119 = 0 + 2529 = 0 + 2534 = 0 + 2531 = 0 + 2536 = 0 + 2549 = 0 + 2554 = 0 + 2551 = 0 + 2556 = 0 + 2673 = 0 + 2678 = 0 + 2675 = 0 + 2680 = 0 + 2693 = 0 + 2695 = 0 + 0 = 0 + 1 = 0 + 2 = 0 + 3 = 0 + 8 = 0 + 9 = 0 + 10 = 0 + 11 = 0 + 24 = 0 + 27 = 0 + 28 = 0 + 31 = 0 + 32 = 0 + 33 = 0 + 42 = 0 + 45 = 0 + 46 = 0 + 49 = 0 + 50 = 0 + 51 = 0 + 60 = 0 + 63 = 0 + 65 = 0 + 66 = 0 + 72 = 0 + 125 = 0 + 126 = 0 + 129 = 0 + 130 = 0 + 131 = 0 + 140 = 0 + 143 = 0 + 144 = 0 + 147 = 0 + 148 = 0 + 149 = 0 + 158 = 0 + 161 = 0 + 163 = 0 + 164 = 0 + 170 = 0 + 173 = 0 + 175 = 0 + 176 = 0 + 182 = 0 + 225 = 0 + 226 = 0 + 229 = 0 + 230 = 0 + 231 = 0 + 240 = 0 + 243 = 0 + 245 = 0 + 246 = 0 + 252 = 0 + 255 = 0 + 256 = 0 + 259 = 0 + 260 = 0 + 261 = 0 + 270 = 0 + 273 = 0 + 275 = 0 + 276 = 0 + 282 = 0 + 325 = 0 + 327 = 0 + 328 = 0 + 334 = 0 + 337 = 0 + 339 = 0 + 340 = 0 + 346 = 0 + 349 = 0 + 351 = 0 + 352 = 0 + 358 = 0 + 361 = 0 + 363 = 0 + 364 = 0 + 370 = 0 + 729 = 0 + 730 = 0 + 735 = 0 + 737 = 0 + 738 = 0 + 743 = 0 + 747 = 0 + 750 = 0 + 752 = 0 + 755 = 0 + 829 = 0 + 832 = 0 + 834 = 0 + 837 = 0 + 841 = 0 + 844 = 0 + 846 = 0 + 849 = 0 + 1377 = 0 + 1379 = 0 + 1385 = 0 + 1387 = 0 + 1381 = 0 + 1389 = 0 + 1407 = 0 + 1412 = 0 + 1409 = 0 + 1414 = 0 + 1557 = 0 + 1562 = 0 + 1559 = 0 + 1564 = 0 + 1577 = 0 + 1582 = 0 + 1579 = 0 + 1584 = 0 + 2025 = 0 + 2028 = 0 + 2030 = 0 + 2033 = 0 + 2037 = 0 + 2040 = 0 + 2042 = 0 + 2045 = 0 + 2105 = 0 + 2108 = 0 + 2110 = 0 + 2113 = 0 + 2117 = 0 + 2119 = 0 + 2529 = 0 + 2534 = 0 + 2531 = 0 + 2536 = 0 + 2549 = 0 + 2554 = 0 + 2551 = 0 + 2556 = 0 + 2673 = 0 + 2678 = 0 + 2675 = 0 + 2680 = 0 + 2693 = 0 + 2695 = 0 diff --git a/tests/mpi/make_zero_boundary_values/ncpu_4/cmp/generic b/tests/mpi/make_zero_boundary_values/ncpu_4/cmp/generic new file mode 100644 index 0000000000..4f6933c8f0 --- /dev/null +++ b/tests/mpi/make_zero_boundary_values/ncpu_4/cmp/generic @@ -0,0 +1,509 @@ + + 0 = 0 + 1 = 0 + 6 = 0 + 9 = 0 + 12 = 0 + 25 = 0 + 28 = 0 + 31 = 0 + 34 = 0 + 81 = 0 + 83 = 0 + 91 = 0 + 93 = 0 + 117 = 0 + 119 = 0 + 153 = 0 + 156 = 0 + 0 = 0 + 1 = 0 + 6 = 0 + 9 = 0 + 12 = 0 + 25 = 0 + 28 = 0 + 31 = 0 + 34 = 0 + 81 = 0 + 83 = 0 + 91 = 0 + 93 = 0 + 117 = 0 + 119 = 0 + 153 = 0 + 156 = 0 + 0 = 0 + 1 = 0 + 2 = 0 + 3 = 0 + 8 = 0 + 9 = 0 + 10 = 0 + 11 = 0 + 24 = 0 + 27 = 0 + 28 = 0 + 31 = 0 + 32 = 0 + 33 = 0 + 42 = 0 + 45 = 0 + 46 = 0 + 49 = 0 + 50 = 0 + 51 = 0 + 60 = 0 + 63 = 0 + 65 = 0 + 66 = 0 + 72 = 0 + 125 = 0 + 126 = 0 + 129 = 0 + 130 = 0 + 131 = 0 + 140 = 0 + 143 = 0 + 144 = 0 + 147 = 0 + 148 = 0 + 149 = 0 + 158 = 0 + 161 = 0 + 163 = 0 + 164 = 0 + 170 = 0 + 173 = 0 + 175 = 0 + 176 = 0 + 182 = 0 + 225 = 0 + 226 = 0 + 229 = 0 + 230 = 0 + 231 = 0 + 240 = 0 + 243 = 0 + 245 = 0 + 246 = 0 + 252 = 0 + 255 = 0 + 256 = 0 + 259 = 0 + 260 = 0 + 261 = 0 + 270 = 0 + 273 = 0 + 275 = 0 + 276 = 0 + 282 = 0 + 325 = 0 + 327 = 0 + 328 = 0 + 334 = 0 + 337 = 0 + 339 = 0 + 340 = 0 + 346 = 0 + 349 = 0 + 351 = 0 + 352 = 0 + 358 = 0 + 361 = 0 + 363 = 0 + 364 = 0 + 370 = 0 + 729 = 0 + 730 = 0 + 735 = 0 + 737 = 0 + 738 = 0 + 743 = 0 + 747 = 0 + 750 = 0 + 752 = 0 + 755 = 0 + 779 = 0 + 780 = 0 + 785 = 0 + 787 = 0 + 788 = 0 + 793 = 0 + 797 = 0 + 800 = 0 + 802 = 0 + 805 = 0 + 829 = 0 + 832 = 0 + 834 = 0 + 837 = 0 + 841 = 0 + 844 = 0 + 846 = 0 + 849 = 0 + 869 = 0 + 872 = 0 + 874 = 0 + 877 = 0 + 881 = 0 + 884 = 0 + 886 = 0 + 889 = 0 + 1053 = 0 + 1054 = 0 + 1059 = 0 + 1061 = 0 + 1062 = 0 + 1067 = 0 + 1071 = 0 + 1074 = 0 + 1076 = 0 + 1079 = 0 + 1103 = 0 + 1104 = 0 + 1109 = 0 + 1111 = 0 + 1112 = 0 + 1117 = 0 + 1121 = 0 + 1124 = 0 + 1126 = 0 + 1129 = 0 + 1153 = 0 + 1156 = 0 + 1158 = 0 + 1161 = 0 + 1165 = 0 + 1168 = 0 + 1170 = 0 + 1173 = 0 + 1193 = 0 + 1196 = 0 + 1198 = 0 + 1201 = 0 + 1205 = 0 + 1208 = 0 + 1210 = 0 + 1213 = 0 + 3003 = 0 + 3505 = 0 + 3015 = 0 + 3517 = 0 + 3510 = 0 + 3519 = 0 + 3535 = 0 + 3547 = 0 + 3540 = 0 + 3549 = 0 + 3709 = 0 + 3721 = 0 + 3714 = 0 + 3723 = 0 + 2815 = 0 + 2835 = 0 + 3739 = 0 + 3745 = 0 + 1377 = 0 + 1379 = 0 + 1385 = 0 + 1387 = 0 + 1381 = 0 + 1389 = 0 + 1407 = 0 + 1412 = 0 + 1409 = 0 + 1414 = 0 + 1557 = 0 + 1562 = 0 + 1559 = 0 + 1564 = 0 + 1577 = 0 + 1582 = 0 + 1579 = 0 + 1584 = 0 + 2025 = 0 + 2028 = 0 + 2030 = 0 + 2033 = 0 + 2037 = 0 + 2040 = 0 + 2042 = 0 + 2045 = 0 + 2105 = 0 + 2108 = 0 + 2110 = 0 + 2113 = 0 + 2117 = 0 + 2119 = 0 + 2135 = 0 + 2147 = 0 + 2140 = 0 + 2149 = 0 + 2973 = 0 + 2985 = 0 + 2978 = 0 + 2987 = 0 + 3008 = 0 + 3017 = 0 + 2389 = 0 + 2394 = 0 + 2391 = 0 + 2396 = 0 + 2409 = 0 + 2414 = 0 + 2411 = 0 + 2416 = 0 + 2533 = 0 + 2538 = 0 + 2535 = 0 + 2540 = 0 + 2553 = 0 + 2555 = 0 + 2563 = 0 + 2568 = 0 + 2583 = 0 + 2585 = 0 + 2785 = 0 + 2790 = 0 + 2805 = 0 + 2807 = 0 + 2820 = 0 + 2837 = 0 + 0 = 0 + 1 = 0 + 2 = 0 + 3 = 0 + 8 = 0 + 9 = 0 + 10 = 0 + 11 = 0 + 24 = 0 + 27 = 0 + 28 = 0 + 31 = 0 + 32 = 0 + 33 = 0 + 42 = 0 + 45 = 0 + 46 = 0 + 49 = 0 + 50 = 0 + 51 = 0 + 60 = 0 + 63 = 0 + 65 = 0 + 66 = 0 + 72 = 0 + 125 = 0 + 126 = 0 + 129 = 0 + 130 = 0 + 131 = 0 + 140 = 0 + 143 = 0 + 144 = 0 + 147 = 0 + 148 = 0 + 149 = 0 + 158 = 0 + 161 = 0 + 163 = 0 + 164 = 0 + 170 = 0 + 173 = 0 + 175 = 0 + 176 = 0 + 182 = 0 + 225 = 0 + 226 = 0 + 229 = 0 + 230 = 0 + 231 = 0 + 240 = 0 + 243 = 0 + 245 = 0 + 246 = 0 + 252 = 0 + 255 = 0 + 256 = 0 + 259 = 0 + 260 = 0 + 261 = 0 + 270 = 0 + 273 = 0 + 275 = 0 + 276 = 0 + 282 = 0 + 325 = 0 + 327 = 0 + 328 = 0 + 334 = 0 + 337 = 0 + 339 = 0 + 340 = 0 + 346 = 0 + 349 = 0 + 351 = 0 + 352 = 0 + 358 = 0 + 361 = 0 + 363 = 0 + 364 = 0 + 370 = 0 + 729 = 0 + 730 = 0 + 735 = 0 + 737 = 0 + 738 = 0 + 743 = 0 + 747 = 0 + 750 = 0 + 752 = 0 + 755 = 0 + 779 = 0 + 780 = 0 + 785 = 0 + 787 = 0 + 788 = 0 + 793 = 0 + 797 = 0 + 800 = 0 + 802 = 0 + 805 = 0 + 829 = 0 + 832 = 0 + 834 = 0 + 837 = 0 + 841 = 0 + 844 = 0 + 846 = 0 + 849 = 0 + 869 = 0 + 872 = 0 + 874 = 0 + 877 = 0 + 881 = 0 + 884 = 0 + 886 = 0 + 889 = 0 + 1053 = 0 + 1054 = 0 + 1059 = 0 + 1061 = 0 + 1062 = 0 + 1067 = 0 + 1071 = 0 + 1074 = 0 + 1076 = 0 + 1079 = 0 + 1103 = 0 + 1104 = 0 + 1109 = 0 + 1111 = 0 + 1112 = 0 + 1117 = 0 + 1121 = 0 + 1124 = 0 + 1126 = 0 + 1129 = 0 + 1153 = 0 + 1156 = 0 + 1158 = 0 + 1161 = 0 + 1165 = 0 + 1168 = 0 + 1170 = 0 + 1173 = 0 + 1193 = 0 + 1196 = 0 + 1198 = 0 + 1201 = 0 + 1205 = 0 + 1208 = 0 + 1210 = 0 + 1213 = 0 + 3003 = 0 + 3505 = 0 + 3015 = 0 + 3517 = 0 + 3510 = 0 + 3519 = 0 + 3535 = 0 + 3547 = 0 + 3540 = 0 + 3549 = 0 + 3709 = 0 + 3721 = 0 + 3714 = 0 + 3723 = 0 + 2815 = 0 + 2835 = 0 + 3739 = 0 + 3745 = 0 + 1377 = 0 + 1379 = 0 + 1385 = 0 + 1387 = 0 + 1381 = 0 + 1389 = 0 + 1407 = 0 + 1412 = 0 + 1409 = 0 + 1414 = 0 + 1557 = 0 + 1562 = 0 + 1559 = 0 + 1564 = 0 + 1577 = 0 + 1582 = 0 + 1579 = 0 + 1584 = 0 + 2025 = 0 + 2028 = 0 + 2030 = 0 + 2033 = 0 + 2037 = 0 + 2040 = 0 + 2042 = 0 + 2045 = 0 + 2105 = 0 + 2108 = 0 + 2110 = 0 + 2113 = 0 + 2117 = 0 + 2119 = 0 + 2135 = 0 + 2147 = 0 + 2140 = 0 + 2149 = 0 + 2973 = 0 + 2985 = 0 + 2978 = 0 + 2987 = 0 + 3008 = 0 + 3017 = 0 + 2389 = 0 + 2394 = 0 + 2391 = 0 + 2396 = 0 + 2409 = 0 + 2414 = 0 + 2411 = 0 + 2416 = 0 + 2533 = 0 + 2538 = 0 + 2535 = 0 + 2540 = 0 + 2553 = 0 + 2555 = 0 + 2563 = 0 + 2568 = 0 + 2583 = 0 + 2585 = 0 + 2785 = 0 + 2790 = 0 + 2805 = 0 + 2807 = 0 + 2820 = 0 + 2837 = 0