]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 2 Oct 2009 00:27:00 +0000 (00:27 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 2 Oct 2009 00:27:00 +0000 (00:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@19658 0785d39b-7218-0410-832d-ea1e28bc413d

tests/hp/Makefile
tests/hp/renumber_component_wise.cc [new file with mode: 0644]
tests/hp/renumber_component_wise/cmp/generic [new file with mode: 0644]

index e04049175cff78a1914f3a1eb225ac33cd98c2df..886d4cac5b9a14912c9432a0683ea0c1feabd4da 100644 (file)
@@ -40,7 +40,8 @@ tests_x = hp_dof_handler \
          matrices* \
          vectors* \
          get_active_fe_indices \
-         create_*
+         create_* \
+         renumber_*
 
 # from above list of regular expressions, generate the real set of
 # tests
diff --git a/tests/hp/renumber_component_wise.cc b/tests/hp/renumber_component_wise.cc
new file mode 100644 (file)
index 0000000..49a8e21
--- /dev/null
@@ -0,0 +1,131 @@
+//----------------------------  renumber_component_wise.cc  ---------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2000, 2001, 2003, 2004, 2009 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.
+//
+//----------------------------  renumber_component_wise.cc  ---------------------------
+
+
+/* Author: Wolfgang Bangerth, University of Heidelberg, 2001 */
+
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <base/function_lib.h>
+#include <lac/vector.h>
+#include <grid/tria.h>
+#include <grid/tria_iterator.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_accessor.h>
+#include <hp/dof_handler.h>
+#include <dofs/dof_renumbering.h>
+#include <multigrid/mg_dof_accessor.h>
+#include <multigrid/mg_dof_handler.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_dgp.h>
+#include <fe/fe_system.h>
+#include <hp/fe_collection.h>
+
+#include <fstream>
+
+
+
+template <int dim>
+void
+print_dofs (const hp::DoFHandler<dim> &dof)
+{
+  std::vector<unsigned int> v;
+  for (typename hp::DoFHandler<dim>::active_cell_iterator cell=dof.begin_active();
+       cell != dof.end(); ++cell)
+    {
+      v.resize (cell->get_fe().dofs_per_cell);
+      deallog << "Cell " << cell << " -- ";
+      cell->get_dof_indices (v);
+      for (unsigned int i=0; i<v.size(); ++i)
+       deallog << v[i] << ' ';
+      deallog << std::endl;
+    }
+}
+
+
+
+template <int dim>
+void
+check_renumbering(hp::DoFHandler<dim>& dof)
+{
+                                  // Prepare a reordering of
+                                  // components for later use
+  std::vector<unsigned int> order(dof.get_fe().n_components());
+  for (unsigned int i=0; i<order.size(); ++i)
+    order[i] = order.size()-i-1;
+
+  DoFRenumbering::component_wise (dof, order);
+  print_dofs (dof);
+}
+
+
+template <int dim>
+void
+check ()
+{
+  Triangulation<dim> tr;
+  if (dim==2)
+    GridGenerator::hyper_ball(tr, Point<dim>(), 1);
+  else
+    GridGenerator::hyper_cube(tr, -1,1);
+  tr.refine_global (1);
+  tr.begin_active()->set_refine_flag ();
+  tr.execute_coarsening_and_refinement ();
+  if (dim==1)
+    tr.refine_global(2);
+
+  hp::DoFHandler<dim> dof(tr);
+  {
+    bool coin = false;
+    for (typename hp::DoFHandler<dim>::active_cell_iterator cell=dof.begin_active();
+        cell != dof.end(); ++cell)
+      {
+       cell->set_active_fe_index (coin ? 0 : 1);
+       coin = !coin;
+      }
+  }
+
+  FESystem<dim> e1 (FE_Q<dim>(2), 2, FE_DGQ<dim>(1), 2);
+  FESystem<dim> e2 (FE_Q<dim>(1), 2, FE_DGQ<dim>(2), 2);
+
+  hp::FECollection<dim> fe_collection;
+  fe_collection.push_back (e1);
+  fe_collection.push_back (e2);
+
+  dof.distribute_dofs(fe_collection);
+  check_renumbering(dof);
+  dof.clear();
+}
+
+
+int main ()
+{
+  std::ofstream logfile ("renumber_component_wise/output");
+  deallog << std::setprecision (2);
+  deallog << std::fixed;
+  deallog.attach(logfile);
+  deallog.depth_console (0);
+
+  deallog.push ("1d");
+  check<1> ();
+  deallog.pop ();
+  deallog.push ("2d");
+  check<2> ();
+  deallog.pop ();
+  deallog.push ("3d");
+  check<3> ();
+  deallog.pop ();
+}
diff --git a/tests/hp/renumber_component_wise/cmp/generic b/tests/hp/renumber_component_wise/cmp/generic
new file mode 100644 (file)
index 0000000..b2d36d6
--- /dev/null
@@ -0,0 +1,51 @@
+
+DEAL:1d::Cell 3.4 -- 97 84 85 72 36 37 38 0 1 2 
+DEAL:1d::Cell 3.5 -- 85 72 86 73 39 40 41 3 4 5 
+DEAL:1d::Cell 3.6 -- 86 73 87 74 42 43 44 6 7 8 
+DEAL:1d::Cell 3.7 -- 87 74 88 75 45 46 47 9 10 11 
+DEAL:1d::Cell 4.0 -- 89 76 90 77 48 49 50 12 13 14 
+DEAL:1d::Cell 4.1 -- 90 77 91 78 51 52 53 15 16 17 
+DEAL:1d::Cell 4.2 -- 91 78 92 79 54 55 56 18 19 20 
+DEAL:1d::Cell 4.3 -- 92 79 93 80 57 58 59 21 22 23 
+DEAL:1d::Cell 4.4 -- 93 80 94 81 60 61 62 24 25 26 
+DEAL:1d::Cell 4.5 -- 94 81 95 82 63 64 65 27 28 29 
+DEAL:1d::Cell 4.6 -- 95 82 96 83 66 67 68 30 31 32 
+DEAL:1d::Cell 4.7 -- 96 83 97 84 69 70 71 33 34 35 
+DEAL:2d::Cell 1.1 -- 430 400 445 415 432 402 447 417 207 208 209 210 211 212 213 214 215 0 1 2 3 4 5 6 7 8 
+DEAL:2d::Cell 1.2 -- 431 401 432 402 433 403 434 404 216 217 218 219 220 221 222 223 224 9 10 11 12 13 14 15 16 17 
+DEAL:2d::Cell 1.3 -- 432 402 447 417 434 404 449 419 225 226 227 228 229 230 231 232 233 18 19 20 21 22 23 24 25 26 
+DEAL:2d::Cell 1.4 -- 435 405 431 401 436 406 437 407 234 235 236 237 238 239 240 241 242 27 28 29 30 31 32 33 34 35 
+DEAL:2d::Cell 1.5 -- 431 401 433 403 437 407 440 410 243 244 245 246 247 248 249 250 251 36 37 38 39 40 41 42 43 44 
+DEAL:2d::Cell 1.6 -- 436 406 437 407 438 408 439 409 252 253 254 255 240 241 256 257 258 45 46 47 48 49 50 51 52 53 
+DEAL:2d::Cell 1.7 -- 437 407 440 410 439 409 442 412 259 260 261 262 263 264 265 266 267 54 55 56 57 58 59 60 61 62 
+DEAL:2d::Cell 1.8 -- 433 403 434 404 440 410 441 411 268 269 270 271 222 223 272 273 274 63 64 65 66 67 68 69 70 71 
+DEAL:2d::Cell 1.9 -- 434 404 449 419 441 411 450 420 275 276 277 278 279 280 281 282 283 72 73 74 75 76 77 78 79 80 
+DEAL:2d::Cell 1.10 -- 440 410 441 411 442 412 443 413 284 285 286 287 272 273 288 289 290 81 82 83 84 85 86 87 88 89 
+DEAL:2d::Cell 1.11 -- 441 411 450 420 443 413 444 414 291 292 293 294 295 296 297 298 299 90 91 92 93 94 95 96 97 98 
+DEAL:2d::Cell 1.12 -- 445 415 446 416 447 417 448 418 300 301 302 303 304 305 306 307 308 99 100 101 102 103 104 105 106 107 
+DEAL:2d::Cell 1.13 -- 446 416 453 423 448 418 454 424 309 310 311 312 313 314 315 316 317 108 109 110 111 112 113 114 115 116 
+DEAL:2d::Cell 1.14 -- 447 417 448 418 449 419 450 420 318 319 320 321 306 307 322 323 324 117 118 119 120 121 122 123 124 125 
+DEAL:2d::Cell 1.15 -- 448 418 454 424 450 420 444 414 325 326 327 328 329 330 331 332 333 126 127 128 129 130 131 132 133 134 
+DEAL:2d::Cell 1.16 -- 438 408 439 409 451 421 452 422 334 335 336 337 256 257 338 339 340 135 136 137 138 139 140 141 142 143 
+DEAL:2d::Cell 1.17 -- 439 409 442 412 452 422 443 413 341 342 343 344 345 346 347 348 349 144 145 146 147 148 149 150 151 152 
+DEAL:2d::Cell 1.18 -- 451 421 452 422 453 423 454 424 350 351 352 353 338 339 354 355 356 153 154 155 156 157 158 159 160 161 
+DEAL:2d::Cell 1.19 -- 452 422 443 413 454 424 444 414 357 358 359 360 361 362 363 364 365 162 163 164 165 166 167 168 169 170 
+DEAL:2d::Cell 2.0 -- 435 405 455 425 456 426 457 427 366 367 368 369 370 371 372 373 374 171 172 173 174 175 176 177 178 179 
+DEAL:2d::Cell 2.1 -- 455 425 430 400 457 427 458 428 375 376 377 378 379 380 381 382 383 180 181 182 183 184 185 186 187 188 
+DEAL:2d::Cell 2.2 -- 456 426 457 427 431 401 459 429 384 385 386 387 372 373 388 389 390 189 190 191 192 193 194 195 196 197 
+DEAL:2d::Cell 2.3 -- 457 427 458 428 459 429 432 402 391 392 393 394 395 396 397 398 399 198 199 200 201 202 203 204 205 206 
+DEAL:3d::Cell 1.1 -- 798 752 799 753 804 758 800 754 814 768 801 755 808 762 802 756 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 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 
+DEAL:3d::Cell 1.2 -- 803 757 804 758 805 759 806 760 807 761 808 762 809 763 810 764 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 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 
+DEAL:3d::Cell 1.3 -- 804 758 800 754 806 760 811 765 808 762 802 756 810 764 812 766 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 
+DEAL:3d::Cell 1.4 -- 813 767 814 768 807 761 808 762 815 769 816 770 817 771 818 772 474 475 476 477 478 479 432 433 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 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 
+DEAL:3d::Cell 1.5 -- 814 768 801 755 808 762 802 756 816 770 819 773 818 772 820 774 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 
+DEAL:3d::Cell 1.6 -- 807 761 808 762 809 763 810 764 817 771 818 772 821 775 822 776 428 429 430 431 432 433 434 435 526 527 528 529 486 487 530 531 492 493 494 495 532 533 534 535 536 537 538 135 84 85 136 137 34 35 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 
+DEAL:3d::Cell 1.7 -- 808 762 802 756 810 764 812 766 818 772 820 774 822 776 823 777 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 
+DEAL:3d::Cell 2.0 -- 824 778 825 779 826 780 827 781 828 782 829 783 830 784 831 785 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 
+DEAL:3d::Cell 2.1 -- 825 779 798 752 827 781 832 786 829 783 833 787 831 785 834 788 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 
+DEAL:3d::Cell 2.2 -- 826 780 827 781 803 757 835 789 830 784 831 785 836 790 837 791 620 621 622 623 572 573 624 625 626 627 628 629 580 581 630 631 586 587 588 589 632 633 634 635 636 637 638 239 188 189 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 
+DEAL:3d::Cell 2.3 -- 827 781 832 786 835 789 804 758 831 785 834 788 837 791 838 792 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 
+DEAL:3d::Cell 2.4 -- 828 782 829 783 830 784 831 785 813 767 839 793 840 794 841 795 574 575 576 577 578 579 580 581 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 291 292 293 294 295 192 193 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 
+DEAL:3d::Cell 2.5 -- 829 783 833 787 831 785 834 788 839 793 814 768 841 795 842 796 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 
+DEAL:3d::Cell 2.6 -- 830 784 831 785 836 790 837 791 840 794 841 795 807 761 843 797 626 627 628 629 580 581 630 631 712 713 714 715 672 673 716 717 678 679 680 681 718 719 720 721 722 723 724 343 294 295 344 345 244 245 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 
+DEAL:3d::Cell 2.7 -- 831 785 834 788 837 791 838 792 841 795 842 796 843 797 808 762 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.