From 5c81d3627988a6b563223305eb0e02feffde3777 Mon Sep 17 00:00:00 2001 From: guido Date: Fri, 7 Jul 2006 10:03:43 +0000 Subject: [PATCH] use set for MG boundaries git-svn-id: https://svn.dealii.org/trunk@13350 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/multigrid/mg_tools.h | 7 ++-- .../deal.II/source/multigrid/mg_dof_tools.cc | 10 +++--- .../multigrid/mg_tools.all_dimensions.cc | 36 +++++++++---------- tests/multigrid/boundary_01.cc | 29 ++++----------- tests/multigrid/boundary_01/cmp/generic | 25 +++++++++++++ 5 files changed, 56 insertions(+), 51 deletions(-) diff --git a/deal.II/deal.II/include/multigrid/mg_tools.h b/deal.II/deal.II/include/multigrid/mg_tools.h index 1bc62146a8..ca4a0a29aa 100644 --- a/deal.II/deal.II/include/multigrid/mg_tools.h +++ b/deal.II/deal.II/include/multigrid/mg_tools.h @@ -20,6 +20,7 @@ #include #include +#include template class MGLevelObject; template class MGDoFHandler; @@ -236,18 +237,18 @@ class MGTools static void make_boundary_list( const MGDoFHandler& mg_dof, const typename FunctionMap::type& function_map, - std::vector >& boundary_indices, + std::vector >& boundary_indices, const std::vector& component_mask = std::vector()); template static void apply_boundary_values ( - const std::vector &boundary_values, + const std::set &boundary_dofs, SparseMatrix& matrix, const bool preserve_symmetry); template static void apply_boundary_values ( - const std::vector& boundary_values, + const std::set& boundary_dofs, BlockSparseMatrix& matrix, const bool preserve_symmetry); diff --git a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc index b10aca91d4..40a5410af3 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_tools.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_tools.cc @@ -1024,7 +1024,7 @@ void MGTools::make_boundary_list( const MGDoFHandler&, const typename FunctionMap::type&, - std::vector >&, + std::vector >&, const std::vector&) { Assert(false, ExcNotImplemented()); @@ -1038,7 +1038,7 @@ void MGTools::make_boundary_list( const MGDoFHandler& dof, const typename FunctionMap::type& function_map, - std::vector >& boundary_indices, + std::vector >& boundary_indices, const std::vector& component_mask_) { // if for whatever reason we were @@ -1202,12 +1202,12 @@ MGTools::make_boundary_list( } if (component_mask[component] == true) - boundary_indices[level].push_back(face_dofs[i]); + boundary_indices[level].insert(face_dofs[i]); } } else for (unsigned int i=0; i ( template void MGTools::make_boundary_list( const MGDoFHandler&, const FunctionMap::type&, - std::vector >&, + std::vector >&, const std::vector&); diff --git a/deal.II/deal.II/source/multigrid/mg_tools.all_dimensions.cc b/deal.II/deal.II/source/multigrid/mg_tools.all_dimensions.cc index d11b7bd1c5..d73e79f7f2 100644 --- a/deal.II/deal.II/source/multigrid/mg_tools.all_dimensions.cc +++ b/deal.II/deal.II/source/multigrid/mg_tools.all_dimensions.cc @@ -28,13 +28,13 @@ template void MGTools::apply_boundary_values ( - const std::vector &boundary_values, + const std::set &boundary_dofs, SparseMatrix& matrix, const bool preserve_symmetry) { // if no boundary values are to be applied // simply return - if (boundary_values.size() == 0) + if (boundary_dofs.size() == 0) return; @@ -55,8 +55,8 @@ MGTools::apply_boundary_values ( } - std::vector::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); + std::set::const_iterator dof = boundary_dofs.begin(), + endd = boundary_dofs.end(); const SparsityPattern &sparsity = matrix.get_sparsity_pattern(); const unsigned int *sparsity_rowstart = sparsity.get_rowstart_indices(); const unsigned int *sparsity_colnums = sparsity.get_column_numbers(); @@ -163,7 +163,7 @@ MGTools::apply_boundary_values ( template void MGTools::apply_boundary_values ( - const std::vector& boundary_values, + const std::set& boundary_dofs, BlockSparseMatrix& matrix, const bool preserve_symmetry) { @@ -182,7 +182,7 @@ MGTools::apply_boundary_values ( // if no boundary values are to be applied // simply return - if (boundary_values.size() == 0) + if (boundary_dofs.size() == 0) return; @@ -216,8 +216,8 @@ MGTools::apply_boundary_values ( first_nonzero_diagonal_entry = 1; - std::vector::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); + std::set::const_iterator dof = boundary_dofs.begin(), + endd = boundary_dofs.end(); const BlockSparsityPattern & sparsity_pattern = matrix.get_sparsity_pattern(); @@ -428,18 +428,14 @@ MGTools::apply_boundary_values ( template void MGTools::apply_boundary_values ( - const std::vector& boundary_values, - SparseMatrix& matrix, - const bool preserve_symmetry); + const std::set&, + SparseMatrix&, const bool); template void MGTools::apply_boundary_values ( - const std::vector& boundary_values, - SparseMatrix& matrix, - const bool preserve_symmetry); + const std::set&, + SparseMatrix&, const bool); template void MGTools::apply_boundary_values ( - const std::vector& boundary_values, - BlockSparseMatrix& matrix, - const bool preserve_symmetry); + const std::set&, + BlockSparseMatrix&, const bool); template void MGTools::apply_boundary_values ( - const std::vector& boundary_values, - BlockSparseMatrix& matrix, - const bool preserve_symmetry); + const std::set&, + BlockSparseMatrix&, const bool); diff --git a/tests/multigrid/boundary_01.cc b/tests/multigrid/boundary_01.cc index 50693e9b38..0b2f6e67bc 100644 --- a/tests/multigrid/boundary_01.cc +++ b/tests/multigrid/boundary_01.cc @@ -37,30 +37,14 @@ using namespace std; -void log_vector (const std::vector >& count) +void log_vector (const std::vector >& count) { for (unsigned int l=0;l -void face_levels(const MGDoFHandler& dof) -{ - typename MGDoFHandler::face_iterator face; - const typename MGDoFHandler::face_iterator end = dof.end_face(); - - for (face = dof.begin_face(); face != end; ++face) - { - deallog << "Face " << face->level(); - for (unsigned int i=0;i::vertices_per_face;++i) - deallog << " v" << face->vertex(i); - deallog << " dofs "; + deallog << "Level " << l << ':'; + for (std::set::const_iterator c=count[l].begin(); + c != count[l].end();++c) + deallog << ' ' << *c; deallog << std::endl; } } @@ -80,9 +64,8 @@ void check_fe(FiniteElement& fe) MGDoFHandler mgdof(tr); mgdof.distribute_dofs(fe); - face_levels(mgdof); - std::vector > boundary_indices(tr.n_levels()); + std::vector > boundary_indices(tr.n_levels()); MGTools::make_boundary_list(mgdof, fmap, boundary_indices); log_vector(boundary_indices); } diff --git a/tests/multigrid/boundary_01/cmp/generic b/tests/multigrid/boundary_01/cmp/generic index e69de29bb2..35373c6e6d 100644 --- a/tests/multigrid/boundary_01/cmp/generic +++ b/tests/multigrid/boundary_01/cmp/generic @@ -0,0 +1,25 @@ + +DEAL::FE_Q<2>(1) +DEAL::Level 0: 0 1 2 3 +DEAL::Level 1: 0 1 2 4 5 6 7 8 +DEAL::Level 2: 0 1 2 4 6 9 11 12 14 15 18 19 20 22 23 24 +DEAL::FE_Q<2>(2) +DEAL::Level 0: 0 1 2 3 4 5 6 7 +DEAL::Level 1: 0 1 2 4 6 9 10 11 12 15 16 17 19 21 22 23 +DEAL::Level 2: 0 1 2 4 6 9 12 15 17 25 28 31 32 33 34 41 42 45 47 55 56 57 59 61 63 69 70 73 75 77 78 79 +DEAL::FESystem<2>[FE_Q<2>(1)^2-FE_Q<2>(2)] +DEAL::Level 0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +DEAL::Level 1: 0 1 2 3 4 5 6 7 8 12 14 17 18 19 20 21 22 23 24 27 28 29 30 31 32 33 35 37 38 39 40 41 +DEAL::Level 2: 0 1 2 3 4 5 6 7 8 12 14 17 18 19 24 27 28 29 33 43 44 45 50 53 54 55 56 57 58 59 60 69 70 71 72 75 76 77 81 91 92 93 94 95 96 97 99 101 102 103 105 113 114 115 116 119 120 121 123 125 126 127 128 129 +DEAL::FE_Q<3>(1) +DEAL::Level 0: 0 1 2 3 4 5 6 7 +DEAL::Level 1: 0 1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 +DEAL::Level 2: 0 1 2 3 4 5 6 8 9 10 12 13 14 16 18 19 20 22 24 27 28 29 31 32 33 34 35 37 38 39 41 42 44 45 46 47 49 51 52 53 54 55 56 57 60 61 62 63 65 66 67 68 69 70 72 73 74 75 76 77 79 81 84 85 86 87 88 89 90 91 92 93 95 96 98 99 100 101 102 103 104 105 108 109 110 111 112 113 114 115 116 118 119 120 121 122 123 124 +DEAL::FE_Q<3>(2) +DEAL::Level 0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 +DEAL::Level 1: 0 1 2 3 4 5 6 8 9 10 11 12 14 16 17 18 20 22 24 27 28 29 30 31 32 33 34 35 37 38 39 40 42 45 46 47 48 49 50 51 52 54 55 56 57 59 60 63 64 65 66 67 68 69 70 71 72 75 76 77 78 79 80 81 82 83 84 85 87 89 91 93 94 95 96 97 98 99 100 101 103 105 106 107 108 109 110 111 112 114 115 117 118 119 120 121 122 123 +DEAL::Level 2: 0 1 2 3 4 5 6 8 9 10 11 12 14 16 17 18 20 22 24 27 28 29 31 32 33 35 37 40 42 45 46 47 49 50 51 52 55 57 60 63 65 66 72 75 76 77 79 81 83 84 85 87 89 93 96 98 101 105 107 110 112 125 126 127 129 130 131 133 135 138 140 143 144 145 146 147 148 149 150 151 153 154 155 156 158 161 163 164 170 173 174 175 176 177 179 180 182 185 188 190 193 197 198 199 200 202 203 204 205 217 218 220 221 225 226 227 229 230 231 232 235 237 240 243 245 246 252 255 256 257 258 259 260 261 262 264 265 266 267 269 270 273 274 275 276 278 279 281 282 285 287 290 292 305 306 307 309 310 311 312 314 317 319 320 322 325 327 328 334 337 338 339 340 341 343 344 346 349 350 351 352 354 355 357 358 361 362 363 364 365 366 367 368 369 370 381 382 384 385 389 391 392 394 397 398 399 400 401 402 405 406 407 409 411 413 414 415 417 419 423 426 428 431 435 437 440 442 455 456 457 458 459 460 461 462 463 464 465 467 469 471 473 474 475 476 477 478 481 483 485 486 487 488 489 490 492 495 497 498 499 503 505 508 510 513 517 518 519 520 522 523 524 525 537 538 540 541 545 546 547 548 549 550 553 555 557 558 559 560 561 562 563 564 565 567 569 570 571 575 577 578 579 580 581 583 585 587 590 592 605 606 607 609 610 611 612 614 617 619 620 622 625 626 627 628 629 630 632 635 637 638 639 643 645 646 647 648 649 650 651 652 654 655 657 658 659 660 662 663 673 674 676 677 681 683 684 686 689 690 691 692 693 694 697 698 699 703 705 706 707 708 709 711 713 714 715 716 718 719 721 722 723 724 725 726 727 +DEAL::FESystem<3>[FE_Q<3>(1)^2-FE_Q<3>(2)] +DEAL::Level 0: 0 1 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 +DEAL::Level 1: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 24 25 26 27 28 30 32 33 34 36 38 40 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 61 62 63 64 66 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 91 92 95 96 97 98 99 100 101 102 103 104 105 106 107 108 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 131 133 135 137 138 139 140 141 142 143 144 145 146 147 148 149 151 153 154 155 156 157 158 159 160 161 162 163 164 166 167 169 170 171 172 173 174 175 176 177 +DEAL::Level 2: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 24 25 26 27 28 30 32 33 34 36 38 40 43 44 45 46 47 48 49 50 51 55 56 57 59 61 64 66 69 70 71 72 73 74 75 76 77 81 82 83 84 87 89 92 95 96 97 101 102 108 111 112 113 114 115 116 117 118 119 123 125 127 128 129 131 133 137 138 139 144 146 149 153 154 155 159 162 164 179 180 181 182 183 184 185 186 187 191 192 193 195 197 200 202 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 223 224 225 226 228 231 232 233 237 238 244 247 248 249 250 251 252 253 254 255 257 258 260 263 264 265 270 272 275 279 280 281 282 283 284 285 286 288 289 290 291 305 306 307 308 310 311 315 316 317 318 319 320 321 322 323 327 328 329 330 333 335 338 341 342 343 347 348 354 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 374 375 376 377 379 380 383 384 385 386 387 388 389 390 392 393 395 396 399 400 401 405 408 410 425 426 427 428 429 430 431 433 434 435 436 438 441 442 443 445 446 448 451 452 453 457 458 464 467 468 469 470 471 472 473 474 475 477 478 480 483 484 485 486 487 488 489 490 492 493 495 496 499 500 501 502 503 504 505 506 507 508 509 510 511 512 525 526 527 528 530 531 535 536 537 539 540 542 545 546 547 548 549 550 551 552 555 556 557 558 559 560 561 562 563 567 569 571 572 573 575 577 581 582 583 588 590 593 597 598 599 603 606 608 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 643 645 647 649 650 651 652 653 654 655 656 657 658 661 663 665 666 667 668 669 670 671 672 673 674 676 679 681 682 683 684 685 689 691 692 693 698 700 703 707 708 709 710 711 712 713 714 716 717 718 719 733 734 735 736 738 739 743 744 745 746 747 748 749 750 751 752 755 757 759 760 761 762 763 764 765 766 767 768 769 770 771 773 775 776 777 778 779 783 785 786 787 788 789 790 791 793 795 796 797 801 804 806 821 822 823 824 825 826 827 829 830 831 832 834 837 838 839 841 842 844 847 848 849 850 851 852 853 854 855 856 858 861 863 864 865 866 867 871 873 874 875 876 877 878 879 880 881 882 883 884 886 887 889 890 891 892 893 894 896 897 909 910 911 912 914 915 919 920 921 923 924 926 929 930 931 932 933 934 935 936 939 940 941 942 943 947 949 950 951 952 953 954 955 957 959 960 961 962 963 964 966 967 969 970 971 972 973 974 975 976 977 -- 2.39.5