From 0b1c66e05e914f38fb268027728f464aa1cb2ffa Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 26 Apr 2012 08:38:50 +0000 Subject: [PATCH] New test. git-svn-id: https://svn.dealii.org/trunk@25450 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/mpi/extract_boundary_dofs.cc | 103 +++++++++ .../extract_boundary_dofs/ncpu_10/cmp/generic | 125 ++++++++++ .../extract_boundary_dofs/ncpu_4/cmp/generic | 215 ++++++++++++++++++ 3 files changed, 443 insertions(+) create mode 100644 tests/mpi/extract_boundary_dofs.cc create mode 100644 tests/mpi/extract_boundary_dofs/ncpu_10/cmp/generic create mode 100644 tests/mpi/extract_boundary_dofs/ncpu_4/cmp/generic diff --git a/tests/mpi/extract_boundary_dofs.cc b/tests/mpi/extract_boundary_dofs.cc new file mode 100644 index 0000000000..970d304249 --- /dev/null +++ b/tests/mpi/extract_boundary_dofs.cc @@ -0,0 +1,103 @@ +//--------------------------------------------------------------------------- +// $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::extract_boundary_dofs 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); + + IndexSet relevant_set, boundary_dofs; + DoFTools::extract_boundary_dofs (dofh, + std::vector(1,true), + boundary_dofs); + if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) + boundary_dofs.write (deallog.get_file_stream()); + + // the result of + // extract_boundary_dofs is + // supposed to be a subset of the + // locally relevant dofs, so test + // this + DoFTools::extract_locally_relevant_dofs (dofh, relevant_set); + boundary_dofs.subtract_set (relevant_set); + Assert (boundary_dofs.n_elements() == 0, + ExcInternalError()); +} + + +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("extract_boundary_dofs").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/extract_boundary_dofs/ncpu_10/cmp/generic b/tests/mpi/extract_boundary_dofs/ncpu_10/cmp/generic new file mode 100644 index 0000000000..fc7f139ad3 --- /dev/null +++ b/tests/mpi/extract_boundary_dofs/ncpu_10/cmp/generic @@ -0,0 +1,125 @@ + +337 12 +0 2 +6 7 +9 10 +12 13 +25 26 +28 29 +31 32 +34 35 +81 82 +83 84 +153 154 +156 157 +3817 110 +0 4 +8 12 +24 25 +27 29 +31 34 +42 43 +45 47 +49 52 +60 61 +63 64 +65 67 +72 73 +125 127 +129 132 +140 141 +143 145 +147 150 +158 159 +161 162 +163 165 +170 171 +173 174 +175 177 +182 183 +225 227 +229 232 +240 241 +243 244 +245 247 +252 253 +255 257 +259 262 +270 271 +273 274 +275 277 +282 283 +325 326 +327 329 +334 335 +337 338 +339 341 +346 347 +349 350 +351 353 +358 359 +361 362 +363 365 +370 371 +729 731 +735 736 +737 739 +743 744 +747 748 +750 751 +752 753 +755 756 +829 830 +832 833 +834 835 +837 838 +841 842 +844 845 +846 847 +849 850 +1377 1378 +1379 1380 +1381 1382 +1385 1386 +1387 1388 +1389 1390 +1407 1408 +1409 1410 +1412 1413 +1414 1415 +1557 1558 +1559 1560 +1562 1563 +1564 1565 +1577 1578 +1579 1580 +1582 1583 +1584 1585 +2025 2026 +2028 2029 +2030 2031 +2033 2034 +2037 2038 +2040 2041 +2042 2043 +2045 2046 +2105 2106 +2108 2109 +2110 2111 +2113 2114 +2117 2118 +2119 2120 +2529 2530 +2531 2532 +2534 2535 +2536 2537 +2549 2550 +2551 2552 +2554 2555 +2556 2557 +2673 2674 +2675 2676 +2678 2679 +2680 2681 +2693 2694 +2695 2696 diff --git a/tests/mpi/extract_boundary_dofs/ncpu_4/cmp/generic b/tests/mpi/extract_boundary_dofs/ncpu_4/cmp/generic new file mode 100644 index 0000000000..00ddf9a3e1 --- /dev/null +++ b/tests/mpi/extract_boundary_dofs/ncpu_4/cmp/generic @@ -0,0 +1,215 @@ + +337 16 +0 2 +6 7 +9 10 +12 13 +25 26 +28 29 +31 32 +34 35 +81 82 +83 84 +91 92 +93 94 +117 118 +119 120 +153 154 +156 157 +3817 196 +0 4 +8 12 +24 25 +27 29 +31 34 +42 43 +45 47 +49 52 +60 61 +63 64 +65 67 +72 73 +125 127 +129 132 +140 141 +143 145 +147 150 +158 159 +161 162 +163 165 +170 171 +173 174 +175 177 +182 183 +225 227 +229 232 +240 241 +243 244 +245 247 +252 253 +255 257 +259 262 +270 271 +273 274 +275 277 +282 283 +325 326 +327 329 +334 335 +337 338 +339 341 +346 347 +349 350 +351 353 +358 359 +361 362 +363 365 +370 371 +729 731 +735 736 +737 739 +743 744 +747 748 +750 751 +752 753 +755 756 +779 781 +785 786 +787 789 +793 794 +797 798 +800 801 +802 803 +805 806 +829 830 +832 833 +834 835 +837 838 +841 842 +844 845 +846 847 +849 850 +869 870 +872 873 +874 875 +877 878 +881 882 +884 885 +886 887 +889 890 +1053 1055 +1059 1060 +1061 1063 +1067 1068 +1071 1072 +1074 1075 +1076 1077 +1079 1080 +1103 1105 +1109 1110 +1111 1113 +1117 1118 +1121 1122 +1124 1125 +1126 1127 +1129 1130 +1153 1154 +1156 1157 +1158 1159 +1161 1162 +1165 1166 +1168 1169 +1170 1171 +1173 1174 +1193 1194 +1196 1197 +1198 1199 +1201 1202 +1205 1206 +1208 1209 +1210 1211 +1213 1214 +1377 1378 +1379 1380 +1381 1382 +1385 1386 +1387 1388 +1389 1390 +1407 1408 +1409 1410 +1412 1413 +1414 1415 +1557 1558 +1559 1560 +1562 1563 +1564 1565 +1577 1578 +1579 1580 +1582 1583 +1584 1585 +2025 2026 +2028 2029 +2030 2031 +2033 2034 +2037 2038 +2040 2041 +2042 2043 +2045 2046 +2105 2106 +2108 2109 +2110 2111 +2113 2114 +2117 2118 +2119 2120 +2135 2136 +2140 2141 +2147 2148 +2149 2150 +2389 2390 +2391 2392 +2394 2395 +2396 2397 +2409 2410 +2411 2412 +2414 2415 +2416 2417 +2533 2534 +2535 2536 +2538 2539 +2540 2541 +2553 2554 +2555 2556 +2563 2564 +2568 2569 +2583 2584 +2585 2586 +2785 2786 +2790 2791 +2805 2806 +2807 2808 +2815 2816 +2820 2821 +2835 2836 +2837 2838 +2973 2974 +2978 2979 +2985 2986 +2987 2988 +3003 3004 +3008 3009 +3015 3016 +3017 3018 +3505 3506 +3510 3511 +3517 3518 +3519 3520 +3535 3536 +3540 3541 +3547 3548 +3549 3550 +3709 3710 +3714 3715 +3721 3722 +3723 3724 +3739 3740 +3745 3746 -- 2.39.5