--- /srv/rebuilderd/tmp/rebuilderdjPUbAQ/inputs/libdune-istl-doc_2.10.0-2_all.deb +++ /srv/rebuilderd/tmp/rebuilderdjPUbAQ/out/libdune-istl-doc_2.10.0-2_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2025-05-14 13:17:18.000000 debian-binary │ --rw-r--r-- 0 0 0 27164 2025-05-14 13:17:18.000000 control.tar.xz │ --rw-r--r-- 0 0 0 3892164 2025-05-14 13:17:18.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 27228 2025-05-14 13:17:18.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 3892664 2025-05-14 13:17:18.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -5,164 +5,164 @@ │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/ │ │ │ -rw-r--r-- 0 root (0) root (0) 1466 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/changelog.Debian.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 4857 2024-10-23 08:25:03.000000 ./usr/share/doc/libdune-istl-doc/changelog.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 3254 2023-01-12 15:07:31.000000 ./usr/share/doc/libdune-istl-doc/copyright │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/ │ │ │ -rw-r--r-- 0 root (0) root (0) 3040 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00002.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3038 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00005.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9224 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ --rw-r--r-- 0 root (0) root (0) 74489 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4753 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ --rw-r--r-- 0 root (0) root (0) 23163 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10513 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ --rw-r--r-- 0 root (0) root (0) 147918 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6296 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ --rw-r--r-- 0 root (0) root (0) 101642 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9092 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ --rw-r--r-- 0 root (0) root (0) 159845 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8584 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ --rw-r--r-- 0 root (0) root (0) 75168 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4949 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9479 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17509 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ --rw-r--r-- 0 root (0) root (0) 315402 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12156 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ --rw-r--r-- 0 root (0) root (0) 21371 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16829 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ --rw-r--r-- 0 root (0) root (0) 47493 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4921 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14274 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10120 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041.html │ │ │ --rw-r--r-- 0 root (0) root (0) 108266 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7149 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ --rw-r--r-- 0 root (0) root (0) 57750 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6043 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ --rw-r--r-- 0 root (0) root (0) 113921 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9765 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ --rw-r--r-- 0 root (0) root (0) 42294 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13275 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ --rw-r--r-- 0 root (0) root (0) 299656 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16525 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ --rw-r--r-- 0 root (0) root (0) 174385 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4840 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15098 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7519 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ --rw-r--r-- 0 root (0) root (0) 98130 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6664 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ --rw-r--r-- 0 root (0) root (0) 52580 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 18718 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ --rw-r--r-- 0 root (0) root (0) 208522 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5869 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071.html │ │ │ --rw-r--r-- 0 root (0) root (0) 20988 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6347 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17312 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5396 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ --rw-r--r-- 0 root (0) root (0) 29427 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8770 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ --rw-r--r-- 0 root (0) root (0) 72546 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10969 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ --rw-r--r-- 0 root (0) root (0) 187632 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6402 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ --rw-r--r-- 0 root (0) root (0) 65780 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7253 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ --rw-r--r-- 0 root (0) root (0) 76536 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6561 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ --rw-r--r-- 0 root (0) root (0) 69283 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5678 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ --rw-r--r-- 0 root (0) root (0) 30671 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13572 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ --rw-r--r-- 0 root (0) root (0) 345511 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7900 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ --rw-r--r-- 0 root (0) root (0) 66197 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9428 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ --rw-r--r-- 0 root (0) root (0) 133061 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5185 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ --rw-r--r-- 0 root (0) root (0) 22057 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8179 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ --rw-r--r-- 0 root (0) root (0) 124664 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9508 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ --rw-r--r-- 0 root (0) root (0) 87699 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8900 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ --rw-r--r-- 0 root (0) root (0) 47365 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5436 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14293 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9427 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ --rw-r--r-- 0 root (0) root (0) 237782 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15752 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ --rw-r--r-- 0 root (0) root (0) 410561 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9761 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128.html │ │ │ --rw-r--r-- 0 root (0) root (0) 132501 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 19505 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ --rw-r--r-- 0 root (0) root (0) 312900 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6623 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ --rw-r--r-- 0 root (0) root (0) 33547 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6810 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ --rw-r--r-- 0 root (0) root (0) 74340 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8190 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140.html │ │ │ --rw-r--r-- 0 root (0) root (0) 62252 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10104 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ --rw-r--r-- 0 root (0) root (0) 125204 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13202 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146.html │ │ │ --rw-r--r-- 0 root (0) root (0) 131099 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13396 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ --rw-r--r-- 0 root (0) root (0) 185805 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12507 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152.html │ │ │ --rw-r--r-- 0 root (0) root (0) 121273 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 44338 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ --rw-r--r-- 0 root (0) root (0) 253735 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4929 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ --rw-r--r-- 0 root (0) root (0) 36955 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7690 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161.html │ │ │ --rw-r--r-- 0 root (0) root (0) 219591 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8609 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ --rw-r--r-- 0 root (0) root (0) 79450 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6798 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11405 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 18633 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ --rw-r--r-- 0 root (0) root (0) 131214 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6498 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173.html │ │ │ --rw-r--r-- 0 root (0) root (0) 44113 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12194 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ --rw-r--r-- 0 root (0) root (0) 79102 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8601 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ --rw-r--r-- 0 root (0) root (0) 40908 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 33563 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ --rw-r--r-- 0 root (0) root (0) 145688 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8726 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ --rw-r--r-- 0 root (0) root (0) 34915 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5929 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ --rw-r--r-- 0 root (0) root (0) 162670 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5445 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ --rw-r--r-- 0 root (0) root (0) 165177 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6449 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ --rw-r--r-- 0 root (0) root (0) 23236 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7777 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17436 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10169 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12123 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7349 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203.html │ │ │ --rw-r--r-- 0 root (0) root (0) 90025 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7563 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ --rw-r--r-- 0 root (0) root (0) 139768 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5596 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ --rw-r--r-- 0 root (0) root (0) 43628 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7795 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ --rw-r--r-- 0 root (0) root (0) 34252 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5569 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ --rw-r--r-- 0 root (0) root (0) 35007 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8890 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ --rw-r--r-- 0 root (0) root (0) 416273 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4543 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ --rw-r--r-- 0 root (0) root (0) 53929 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4384 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ --rw-r--r-- 0 root (0) root (0) 18369 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4549 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ --rw-r--r-- 0 root (0) root (0) 55275 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7083 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14006 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4929 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 36955 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7777 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17436 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10169 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12123 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6798 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11405 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6498 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 44113 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9761 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 132501 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5678 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 30671 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6347 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17312 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6664 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 52580 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8900 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 47365 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9428 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 133061 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9427 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 237782 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9508 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 87699 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6561 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 69283 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5396 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 29427 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15752 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 410561 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5869 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 20988 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10969 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 187632 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6402 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 65780 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13572 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 345511 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5185 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 22057 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5436 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14293 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7519 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 98130 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8770 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 72546 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7253 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 76536 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7900 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 66197 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8179 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 124664 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 18718 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 208522 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6449 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 23236 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8190 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 62252 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7563 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 139768 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8726 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 34915 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8609 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 79450 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 44338 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 253735 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8601 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 40908 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16829 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 47493 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4543 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 53929 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13202 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 131099 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6810 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 74340 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9765 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 42294 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4753 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 23163 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4921 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14274 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12194 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 79102 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7149 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 57750 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5596 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 43628 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13275 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 299656 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9092 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 159845 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16525 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 174385 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4549 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 55275 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12507 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 121273 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7083 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14006 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 33563 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 145688 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4949 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9479 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4840 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15098 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6296 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 101642 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9224 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 74489 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12156 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 21371 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7795 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 34252 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17509 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 315402 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8890 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 416273 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13396 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 185805 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10513 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 147918 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10104 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 125204 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 18633 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 131214 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7349 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 90025 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6043 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 113921 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 19505 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 312900 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7690 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 219591 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6623 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 33547 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4384 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 18369 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5569 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 35007 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10120 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 108266 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5445 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 165177 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5929 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 162670 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8584 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 75168 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 5516 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00233.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3415 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00234.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3466 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00235.html │ │ │ -rw-r--r-- 0 root (0) root (0) 278681 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00236.html │ │ │ -rw-r--r-- 0 root (0) root (0) 23094 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00236.png │ │ │ -rw-r--r-- 0 root (0) root (0) 32148 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00237.html │ │ │ -rw-r--r-- 0 root (0) root (0) 19073 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00237.png │ │ │ @@ -1106,15 +1106,15 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 8035 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e12c67a8fe12cf8b78c94f3b4cb9926_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 4246 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e69be5995c9f5d42bf491ae6f29600e.html │ │ │ -rw-r--r-- 0 root (0) root (0) 1620 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e69be5995c9f5d42bf491ae6f29600e_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 14064 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4.html │ │ │ -rw-r--r-- 0 root (0) root (0) 1878 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 3664 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_e68e8157741866f444e17edd764ebbae.html │ │ │ -rw-r--r-- 0 root (0) root (0) 45631 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/doxygen.css │ │ │ --rw-r--r-- 0 root (0) root (0) 177483 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 177490 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 7704 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dynsections.js │ │ │ -rw-r--r-- 0 root (0) root (0) 29311 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/files.html │ │ │ -rw-r--r-- 0 root (0) root (0) 549 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_0.png │ │ │ -rw-r--r-- 0 root (0) root (0) 572 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_0_dark.png │ │ │ -rw-r--r-- 0 root (0) root (0) 531 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_1.png │ │ │ -rw-r--r-- 0 root (0) root (0) 860 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_10.png │ │ │ -rw-r--r-- 0 root (0) root (0) 909 2025-05-14 13:17:18.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_10_dark.png │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: supermatrix.hh File Reference │ │ │ +dune-istl: matrixindexset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,55 +72,31 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
supermatrix.hh File Reference
│ │ │ +
matrixindexset.hh File Reference
│ │ │
│ │ │
│ │ │ -
#include "bcrsmatrix.hh"
│ │ │ -#include "bvector.hh"
│ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ -#include <dune/common/fvector.hh>
│ │ │ -#include <dune/common/typetraits.hh>
│ │ │ -#include <limits>
│ │ │ -#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ -#include "superlufunctions.hh"
│ │ │ +
#include <algorithm>
│ │ │ +#include <cstddef>
│ │ │ +#include <cstdint>
│ │ │ +#include <set>
│ │ │ +#include <variant>
│ │ │ +#include <vector>
│ │ │ +#include <dune/common/overloadset.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::SuperMatrixCreateSparseChooser< T >
 
struct  Dune::SuperMatrixPrinter< T >
 
struct  Dune::BaseGetSuperLUType< T >
 
struct  Dune::GetSuperLUType< T >
 
struct  Dune::GetSuperLUType< double >
 
struct  Dune::GetSuperLUType< float >
 
struct  Dune::GetSuperLUType< std::complex< double > >
 
struct  Dune::GetSuperLUType< std::complex< float > >
 
struct  Dune::SuperLUMatrix< M >
 Utility class for converting an ISTL Matrix into a SuperLU Matrix. More...
 
struct  Dune::SuperMatrixInitializer< M >
 
class  Dune::SuperLUMatrix< BCRSMatrix< B, TA > >
 Converter for BCRSMatrix to SuperLU Matrix. More...
 
class  Dune::SuperMatrixInitializer< BCRSMatrix< B, A > >
class  Dune::MatrixIndexSet
 Stores the nonzero entries for creating a sparse matrix. More...
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
 
│ │ │ ├── html2text {} │ │ │ │ @@ -1,50 +1,25 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -supermatrix.hh File Reference │ │ │ │ -#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ -#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ -#include "_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h" │ │ │ │ +matrixindexset.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _d_o_u_b_l_e_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _f_l_o_a_t_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _f_l_o_a_t_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _M_ _> │ │ │ │ -  Utility class for converting an _I_S_T_L _M_a_t_r_i_x into a _S_u_p_e_r_L_U _M_a_t_r_i_x. │ │ │ │ - _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _M_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _> │ │ │ │ -  Converter for _B_C_R_S_M_a_t_r_i_x to _S_u_p_e_r_L_U _M_a_t_r_i_x. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ +class   _D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ +  Stores the nonzero entries for creating a sparse matrix. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: supermatrix.hh Source File │ │ │ +dune-istl: matrixindexset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,427 +74,213 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
supermatrix.hh
│ │ │ +
matrixindexset.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SUPERMATRIX_HH
│ │ │ -
6#define DUNE_ISTL_SUPERMATRIX_HH
│ │ │ +
5#ifndef DUNE_ISTL_MATRIXINDEXSET_HH
│ │ │ +
6#define DUNE_ISTL_MATRIXINDEXSET_HH
│ │ │
7
│ │ │ -
8#if HAVE_SUPERLU
│ │ │ -
9
│ │ │ -
10#include "bcrsmatrix.hh"
│ │ │ -
11#include "bvector.hh"
│ │ │ -
12#include <dune/common/fmatrix.hh>
│ │ │ -
13#include <dune/common/fvector.hh>
│ │ │ -
14#include <dune/common/typetraits.hh>
│ │ │ -
15#include <limits>
│ │ │ +
8#include <algorithm>
│ │ │ +
9#include <cstddef>
│ │ │ +
10#include <cstdint>
│ │ │ +
11#include <set>
│ │ │ +
12#include <variant>
│ │ │ +
13#include <vector>
│ │ │ +
14
│ │ │ +
15#include <dune/common/overloadset.hh>
│ │ │
16
│ │ │ - │ │ │ +
17namespace Dune {
│ │ │
18
│ │ │ -
19#include "superlufunctions.hh"
│ │ │ -
20
│ │ │ -
21namespace Dune
│ │ │ -
22{
│ │ │ -
23
│ │ │ -
24 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
26 {};
│ │ │ -
│ │ │ -
27
│ │ │ -
28 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
30 {};
│ │ │ -
│ │ │ -
31
│ │ │ -
32#if __has_include("slu_sdefs.h")
│ │ │ -
33 template<>
│ │ │ - │ │ │ -
35 {
│ │ │ -
36 static void create(SuperMatrix *mat, int n, int m, int offset,
│ │ │ -
37 float *values, int *rowindex, int* colindex,
│ │ │ -
38 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
39 {
│ │ │ -
40 sCreate_CompCol_Matrix(mat, n, m, offset, values, rowindex, colindex,
│ │ │ -
41 stype, dtype, mtype);
│ │ │ -
42 }
│ │ │ -
43 };
│ │ │ -
44
│ │ │ -
45 template<>
│ │ │ -
46 struct SuperMatrixPrinter<float>
│ │ │ -
47 {
│ │ │ -
48 static void print(char* name, SuperMatrix* mat)
│ │ │ -
49 {
│ │ │ -
50 sPrint_CompCol_Matrix(name, mat);
│ │ │ -
51 }
│ │ │ -
52 };
│ │ │ -
53#endif
│ │ │ -
54
│ │ │ -
55#if __has_include("slu_ddefs.h")
│ │ │ -
56 template<>
│ │ │ -
57 struct SuperMatrixCreateSparseChooser<double>
│ │ │ -
58 {
│ │ │ -
59 static void create(SuperMatrix *mat, int n, int m, int offset,
│ │ │ -
60 double *values, int *rowindex, int* colindex,
│ │ │ -
61 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
62 {
│ │ │ -
63 dCreate_CompCol_Matrix(mat, n, m, offset, values, rowindex, colindex,
│ │ │ -
64 stype, dtype, mtype);
│ │ │ -
65 }
│ │ │ -
66 };
│ │ │ -
67
│ │ │ -
68 template<>
│ │ │ -
69 struct SuperMatrixPrinter<double>
│ │ │ -
70 {
│ │ │ -
71 static void print(char* name, SuperMatrix* mat)
│ │ │ -
72 {
│ │ │ -
73 dPrint_CompCol_Matrix(name, mat);
│ │ │ -
74 }
│ │ │ -
75 };
│ │ │ -
76#endif
│ │ │ +
19
│ │ │ +
│ │ │ + │ │ │ +
37 {
│ │ │ +
38 using Index = std::uint_least32_t;
│ │ │ +
39
│ │ │ +
40 // A vector that partly mimics a std::set by staying
│ │ │ +
41 // sorted on insert() and having unique values.
│ │ │ +
42 class FlatSet : public std::vector<Index>
│ │ │ +
43 {
│ │ │ +
44 using Base = std::vector<Index>;
│ │ │ +
45 public:
│ │ │ +
46 using Base::Base;
│ │ │ +
47 using Base::begin;
│ │ │ +
48 using Base::end;
│ │ │ +
49 void insert(const Index& value) {
│ │ │ +
50 auto it = std::lower_bound(begin(), end(), value);
│ │ │ +
51 if ((it == end() or (*it != value)))
│ │ │ +
52 Base::insert(it, value);
│ │ │ +
53 }
│ │ │ +
54 bool contains(const Index& value) const {
│ │ │ +
55 return std::binary_search(begin(), end(), value);
│ │ │ +
56 }
│ │ │ +
57 };
│ │ │ +
58
│ │ │ +
59 using RowIndexSet = std::variant<FlatSet, std::set<Index>>;
│ │ │ +
60
│ │ │ +
61 public:
│ │ │ +
62
│ │ │ +
63 using size_type = Index;
│ │ │ +
64
│ │ │ +
76 static constexpr size_type defaultMaxVectorSize = 2048;
│ │ │
77
│ │ │ -
78#if __has_include("slu_cdefs.h")
│ │ │ -
79 template<>
│ │ │ -
80 struct SuperMatrixCreateSparseChooser<std::complex<float> >
│ │ │ -
81 {
│ │ │ -
82 static void create(SuperMatrix *mat, int n, int m, int offset,
│ │ │ -
83 std::complex<float> *values, int *rowindex, int* colindex,
│ │ │ -
84 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
85 {
│ │ │ -
86 cCreate_CompCol_Matrix(mat, n, m, offset, reinterpret_cast<singlecomplex*>(values),
│ │ │ -
87 rowindex, colindex, stype, dtype, mtype);
│ │ │ -
88 }
│ │ │ -
89 };
│ │ │ -
90
│ │ │ -
91 template<>
│ │ │ -
92 struct SuperMatrixPrinter<std::complex<float> >
│ │ │ -
93 {
│ │ │ -
94 static void print(char* name, SuperMatrix* mat)
│ │ │ -
95 {
│ │ │ -
96 cPrint_CompCol_Matrix(name, mat);
│ │ │ -
97 }
│ │ │ -
98 };
│ │ │ -
99#endif
│ │ │ -
100
│ │ │ -
101#if __has_include("slu_zdefs.h")
│ │ │ -
102 template<>
│ │ │ -
103 struct SuperMatrixCreateSparseChooser<std::complex<double> >
│ │ │ -
104 {
│ │ │ -
105 static void create(SuperMatrix *mat, int n, int m, int offset,
│ │ │ -
106 std::complex<double> *values, int *rowindex, int* colindex,
│ │ │ -
107 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
108 {
│ │ │ -
109 zCreate_CompCol_Matrix(mat, n, m, offset, reinterpret_cast<doublecomplex*>(values),
│ │ │ -
110 rowindex, colindex, stype, dtype, mtype);
│ │ │ -
111 }
│ │ │ -
112 };
│ │ │ -
113
│ │ │ -
114 template<>
│ │ │ -
115 struct SuperMatrixPrinter<std::complex<double> >
│ │ │ -
116 {
│ │ │ -
117 static void print(char* name, SuperMatrix* mat)
│ │ │ -
118 {
│ │ │ -
119 zPrint_CompCol_Matrix(name, mat);
│ │ │ -
120 }
│ │ │ -
121 };
│ │ │ -
122#endif
│ │ │ -
123
│ │ │ -
124 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
126 {
│ │ │ -
127 static const Dtype_t type;
│ │ │ -
128 };
│ │ │ -
│ │ │ -
129
│ │ │ -
130 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
132 {};
│ │ │ +
│ │ │ +
83 MatrixIndexSet(size_type maxVectorSize=defaultMaxVectorSize) noexcept : rows_(0), cols_(0), maxVectorSize_(maxVectorSize)
│ │ │ +
84 {}
│ │ │ +
│ │ │ +
85
│ │ │ +
│ │ │ +
93 MatrixIndexSet(size_type rows, size_type cols, size_type maxVectorSize=defaultMaxVectorSize) : rows_(rows), cols_(cols), maxVectorSize_(maxVectorSize)
│ │ │ +
94 {
│ │ │ +
95 indices_.resize(rows_, FlatSet());
│ │ │ +
96 }
│ │ │ +
│ │ │ +
97
│ │ │ +
│ │ │ + │ │ │ +
100 rows_ = rows;
│ │ │ +
101 cols_ = cols;
│ │ │ +
102 indices_.resize(rows_, FlatSet());
│ │ │ +
103 }
│ │ │ +
│ │ │ +
104
│ │ │ +
│ │ │ + │ │ │ +
113 return std::visit(Dune::overload(
│ │ │ +
114 // If row is stored as set, call insert directly
│ │ │ +
115 [&](std::set<size_type>& set) {
│ │ │ +
116 set.insert(col);
│ │ │ +
117 },
│ │ │ +
118 // If row is stored as vector only insert directly
│ │ │ +
119 // if maxVectorSize_ is not reached. Otherwise switch
│ │ │ +
120 // to set storage first.
│ │ │ +
121 [&](FlatSet& sortedVector) {
│ │ │ +
122 if (sortedVector.size() < maxVectorSize_)
│ │ │ +
123 sortedVector.insert(col);
│ │ │ +
124 else if (not sortedVector.contains(col))
│ │ │ +
125 {
│ │ │ +
126 std::set<size_type> set(sortedVector.begin(), sortedVector.end());
│ │ │ +
127 set.insert(col);
│ │ │ +
128 indices_[row] = std::move(set);
│ │ │ +
129 }
│ │ │ +
130 }
│ │ │ +
131 ), indices_[row]);
│ │ │ +
132 }
│ │ │
│ │ │
133
│ │ │ -
134 template<class T>
│ │ │ -
135 const Dtype_t BaseGetSuperLUType<T>::type =
│ │ │ -
136 std::is_same<T,float>::value ? SLU_S :
│ │ │ -
137 ( std::is_same<T,std::complex<double> >::value ? SLU_Z :
│ │ │ -
138 ( std::is_same<T,std::complex<float> >::value ? SLU_C : SLU_D ));
│ │ │ -
139
│ │ │ -
140 template<>
│ │ │ -
│ │ │ -
141 struct GetSuperLUType<double>
│ │ │ -
142 : public BaseGetSuperLUType<double>
│ │ │ -
143 {
│ │ │ -
144 typedef double float_type;
│ │ │ -
145 };
│ │ │ -
│ │ │ -
146
│ │ │ -
147 template<>
│ │ │ -
│ │ │ -
148 struct GetSuperLUType<float>
│ │ │ -
149 : public BaseGetSuperLUType<float>
│ │ │ -
150 {
│ │ │ -
151 typedef float float_type;
│ │ │ -
152 };
│ │ │ -
│ │ │ -
153
│ │ │ -
154 template<>
│ │ │ -
│ │ │ -
155 struct GetSuperLUType<std::complex<double> >
│ │ │ -
156 : public BaseGetSuperLUType<std::complex<double> >
│ │ │ -
157 {
│ │ │ -
158 typedef double float_type;
│ │ │ -
159 };
│ │ │ +
│ │ │ +
135 size_type size() const {
│ │ │ +
136 size_type entries = 0;
│ │ │ +
137 for (size_type i=0; i<rows_; i++)
│ │ │ +
138 entries += rowsize(i);
│ │ │ +
139 return entries;
│ │ │ +
140 }
│ │ │ +
│ │ │ +
141
│ │ │ +
143 size_type rows() const {return rows_;}
│ │ │ +
144
│ │ │ +
146 size_type cols() const {return cols_;}
│ │ │ +
147
│ │ │ +
│ │ │ +
157 const auto& columnIndices(size_type row) const {
│ │ │ +
158 return indices_[row];
│ │ │ +
159 }
│ │ │
│ │ │
160
│ │ │ -
161 template<>
│ │ │ -
│ │ │ -
162 struct GetSuperLUType<std::complex<float> >
│ │ │ -
163 : public BaseGetSuperLUType<std::complex<float> >
│ │ │ -
164 {
│ │ │ -
165 typedef float float_type;
│ │ │ -
166
│ │ │ -
167 };
│ │ │ -
│ │ │ -
168
│ │ │ -
173 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
175 {};
│ │ │ -
│ │ │ +
│ │ │ + │ │ │ +
163 return std::visit([&](const auto& rowIndices) {
│ │ │ +
164 return rowIndices.size();
│ │ │ +
165 }, indices_[row]);
│ │ │ +
166 }
│ │ │ +
│ │ │ +
167
│ │ │ +
174 template <class MatrixType>
│ │ │ +
│ │ │ +
175 void import(const MatrixType& m, size_type rowOffset=0, size_type colOffset=0) {
│ │ │
176
│ │ │ -
177 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
179 {};
│ │ │ -
│ │ │ -
180
│ │ │ -
181 template<class T>
│ │ │ -
182 class SuperLU;
│ │ │ +
177 typedef typename MatrixType::row_type RowType;
│ │ │ +
178 typedef typename RowType::ConstIterator ColumnIterator;
│ │ │ +
179
│ │ │ +
180 for (size_type rowIdx=0; rowIdx<m.N(); rowIdx++) {
│ │ │ +
181
│ │ │ +
182 const RowType& row = m[rowIdx];
│ │ │
183
│ │ │ -
184 template<class M, class X, class TM, class TD, class T1>
│ │ │ - │ │ │ +
184 ColumnIterator cIt = row.begin();
│ │ │ +
185 ColumnIterator cEndIt = row.end();
│ │ │
186
│ │ │ -
187 template<class T, bool flag>
│ │ │ - │ │ │ +
187 for(; cIt!=cEndIt; ++cIt)
│ │ │ +
188 add(rowIdx+rowOffset, cIt.index()+colOffset);
│ │ │
189
│ │ │ -
193 template<class B, class TA>
│ │ │ -
│ │ │ - │ │ │ -
195 : public ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type, int>
│ │ │ -
196 {
│ │ │ -
197 template<class M, class X, class TM, class TD, class T1>
│ │ │ - │ │ │ -
199 friend struct SuperMatrixInitializer<BCRSMatrix<B,TA> >;
│ │ │ -
200 public:
│ │ │ - │ │ │ -
203
│ │ │ - │ │ │ -
205
│ │ │ -
206 typedef typename Matrix::size_type size_type;
│ │ │ +
190 }
│ │ │ +
191
│ │ │ +
192 }
│ │ │ +
│ │ │ +
193
│ │ │ +
199 template <class MatrixType>
│ │ │ +
│ │ │ +
200 void exportIdx(MatrixType& matrix) const {
│ │ │ +
201
│ │ │ +
202 matrix.setSize(rows_, cols_);
│ │ │ +
203 matrix.setBuildMode(MatrixType::random);
│ │ │ +
204
│ │ │ +
205 for (size_type row=0; row<rows_; row++)
│ │ │ +
206 matrix.setrowsize(row, rowsize(row));
│ │ │
207
│ │ │ -
│ │ │ -
212 explicit SuperLUMatrix(const Matrix& mat) : ISTL::Impl::BCCSMatrix<BCRSMatrix<B,TA>, int>(mat)
│ │ │ -
213 {}
│ │ │ -
│ │ │ -
214
│ │ │ -
│ │ │ -
215 SuperLUMatrix() : ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type, int>()
│ │ │ -
216 {}
│ │ │ -
│ │ │ +
208 matrix.endrowsizes();
│ │ │ +
209
│ │ │ +
210 for (size_type row=0; row<rows_; row++) {
│ │ │ +
211 std::visit([&](const auto& rowIndices) {
│ │ │ +
212 matrix.setIndicesNoSort(row, rowIndices.begin(), rowIndices.end());
│ │ │ +
213 }, indices_[row]);
│ │ │ +
214 }
│ │ │ +
215
│ │ │ +
216 matrix.endindices();
│ │ │
217
│ │ │ -
│ │ │ - │ │ │ -
220 {
│ │ │ -
221 if (this->N_+this->M_*this->Nnz_ != 0)
│ │ │ -
222 free();
│ │ │ -
223 }
│ │ │ -
│ │ │ -
224
│ │ │ -
│ │ │ -
226 operator SuperMatrix&()
│ │ │ -
227 {
│ │ │ -
228 return A;
│ │ │ -
229 }
│ │ │ -
│ │ │ -
230
│ │ │ -
│ │ │ -
232 operator const SuperMatrix&() const
│ │ │ -
233 {
│ │ │ -
234 return A;
│ │ │ -
235 }
│ │ │ -
│ │ │ -
236
│ │ │ -
│ │ │ - │ │ │ -
238 {
│ │ │ -
239 if (this->N_ + this->M_ + this->Nnz_!=0)
│ │ │ -
240 free();
│ │ │ -
241
│ │ │ -
242 using Matrix = BCRSMatrix<B,TA>;
│ │ │ - │ │ │ - │ │ │ -
245 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*this);
│ │ │ -
246
│ │ │ -
247 copyToBCCSMatrix(initializer, mat);
│ │ │ -
248
│ │ │ - │ │ │ -
250 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
│ │ │ -
251 this->values,this->rowindex, this->colstart, SLU_NC,
│ │ │ -
252 static_cast<Dtype_t>(GetSuperLUType<typename Matrix::field_type>::type), SLU_GE);
│ │ │ -
253 return *this;
│ │ │ -
254 }
│ │ │ -
│ │ │ -
255
│ │ │ -
│ │ │ - │ │ │ -
257 {
│ │ │ -
258 if (this->N_ + this->M_ + this->Nnz_!=0)
│ │ │ -
259 free();
│ │ │ -
260
│ │ │ -
261 using Matrix = BCRSMatrix<B,TA>;
│ │ │ - │ │ │ - │ │ │ -
264 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*this);
│ │ │ -
265
│ │ │ -
266 copyToBCCSMatrix(initializer, mat);
│ │ │ -
267
│ │ │ - │ │ │ -
269 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
│ │ │ -
270 this->values,this->rowindex, this->colstart, SLU_NC,
│ │ │ -
271 static_cast<Dtype_t>(GetSuperLUType<B>::type), SLU_GE);
│ │ │ -
272 return *this;
│ │ │ -
273 }
│ │ │ -
│ │ │ -
274
│ │ │ -
│ │ │ -
281 virtual void setMatrix(const Matrix& mat, const std::set<std::size_t>& mrs)
│ │ │ -
282 {
│ │ │ -
283 if(this->N_+this->M_+this->Nnz_!=0)
│ │ │ -
284 free();
│ │ │ -
285 this->N_=mrs.size()*MatrixDimension<typename Matrix::block_type>::rowdim(*(mat[0].begin()));
│ │ │ -
286 this->M_=mrs.size()*MatrixDimension<typename Matrix::block_type>::coldim(*(mat[0].begin()));
│ │ │ -
287 SuperMatrixInitializer<Matrix> initializer(*this);
│ │ │ -
288
│ │ │ -
289 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(mat,mrs));
│ │ │ -
290 }
│ │ │ -
│ │ │ -
291
│ │ │ -
│ │ │ -
293 virtual void setMatrix(const Matrix& mat)
│ │ │ -
294 {
│ │ │ - │ │ │ - │ │ │ -
297 SuperMatrixInitializer<Matrix> initializer(*this);
│ │ │ -
298
│ │ │ -
299 copyToBCCSMatrix(initializer, mat);
│ │ │ -
300 }
│ │ │ -
│ │ │ -
301
│ │ │ -
│ │ │ -
303 virtual void free()
│ │ │ -
304 {
│ │ │ -
305 ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type, int>::free();
│ │ │ -
306 SUPERLU_FREE(A.Store);
│ │ │ -
307 }
│ │ │ -
│ │ │ -
308 private:
│ │ │ -
309 SuperMatrix A;
│ │ │ -
310 };
│ │ │ -
│ │ │ -
311
│ │ │ -
312 template<class B, class A>
│ │ │ -
│ │ │ - │ │ │ -
314 : public ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>
│ │ │ -
315 {
│ │ │ -
316 template<class I, class S, class D>
│ │ │ - │ │ │ -
318 public:
│ │ │ - │ │ │ - │ │ │ -
321
│ │ │ -
│ │ │ -
322 SuperMatrixInitializer(SuperLUMatrix& lum) : ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>(lum)
│ │ │ -
323 ,slumat(&lum)
│ │ │ -
324 {}
│ │ │ -
│ │ │ -
325
│ │ │ -
│ │ │ -
326 SuperMatrixInitializer() : ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>()
│ │ │ -
327 {}
│ │ │ -
│ │ │ -
328
│ │ │ -
│ │ │ -
329 virtual void createMatrix() const
│ │ │ -
330 {
│ │ │ -
331 ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>::createMatrix();
│ │ │ - │ │ │ -
333 ::create(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols],
│ │ │ -
334 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC,
│ │ │ -
335 static_cast<Dtype_t>(GetSuperLUType<typename Matrix::field_type>::type), SLU_GE);
│ │ │ -
336 }
│ │ │ -
│ │ │ -
337 private:
│ │ │ -
338 SuperLUMatrix* slumat;
│ │ │ -
339 };
│ │ │ -
│ │ │ -
340}
│ │ │ -
341#endif // HAVE_SUPERLU
│ │ │ -
342#endif
│ │ │ - │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ - │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ -
STL namespace.
│ │ │ +
218 }
│ │ │ +
│ │ │ +
219
│ │ │ +
220 private:
│ │ │ +
221
│ │ │ +
222 std::vector<RowIndexSet> indices_;
│ │ │ +
223
│ │ │ +
224 size_type rows_, cols_;
│ │ │ +
225 size_type maxVectorSize_;
│ │ │ +
226
│ │ │ +
227 };
│ │ │ +
│ │ │ +
228
│ │ │ +
229
│ │ │ +
230} // end namespace Dune
│ │ │ +
231
│ │ │ +
232#endif
│ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │
Definition allocator.hh:11
│ │ │ -
Initializer for SuperLU Matrices representing the subdomains.
Definition overlappingschwarz.hh:47
│ │ │ -
static auto coldim(const M &A)
Definition matrixutils.hh:219
│ │ │ -
static auto rowdim(const M &A)
Definition matrixutils.hh:214
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ -
A::size_type size_type
The type for the index access and the size.
Definition bcrsmatrix.hh:497
│ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ -
Definition overlappingschwarz.hh:694
│ │ │ -
SuperLu Solver.
Definition superlu.hh:271
│ │ │ -
Definition supermatrix.hh:26
│ │ │ -
Definition supermatrix.hh:30
│ │ │ -
Definition supermatrix.hh:126
│ │ │ -
static const Dtype_t type
Definition supermatrix.hh:127
│ │ │ -
Definition supermatrix.hh:132
│ │ │ -
double float_type
Definition supermatrix.hh:144
│ │ │ -
float float_type
Definition supermatrix.hh:151
│ │ │ -
double float_type
Definition supermatrix.hh:158
│ │ │ -
float float_type
Definition supermatrix.hh:165
│ │ │ -
Utility class for converting an ISTL Matrix into a SuperLU Matrix.
Definition supermatrix.hh:175
│ │ │ -
Definition supermatrix.hh:179
│ │ │ -
virtual void free()
free allocated space.
Definition supermatrix.hh:303
│ │ │ -
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const SuperLUMatrix< BCRSMatrix< B, TA > > &mat)
Definition supermatrix.hh:256
│ │ │ -
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const BCRSMatrix< B, TA > &mat)
Definition supermatrix.hh:237
│ │ │ -
SuperLUMatrix(const Matrix &mat)
Constructor that initializes the data.
Definition supermatrix.hh:212
│ │ │ -
virtual void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition supermatrix.hh:293
│ │ │ -
SuperLUMatrix()
Definition supermatrix.hh:215
│ │ │ -
Matrix::size_type size_type
Definition supermatrix.hh:206
│ │ │ -
BCRSMatrix< B, TA > Matrix
The type of the matrix to convert.
Definition supermatrix.hh:202
│ │ │ -
virtual void setMatrix(const Matrix &mat, const std::set< std::size_t > &mrs)
Initialize data from a given set of matrix rows and columns.
Definition supermatrix.hh:281
│ │ │ -
virtual ~SuperLUMatrix()
Destructor.
Definition supermatrix.hh:219
│ │ │ -
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
Definition supermatrix.hh:320
│ │ │ -
BCRSMatrix< B, A > Matrix
Definition supermatrix.hh:319
│ │ │ -
SuperMatrixInitializer()
Definition supermatrix.hh:326
│ │ │ -
virtual void createMatrix() const
Definition supermatrix.hh:329
│ │ │ -
SuperMatrixInitializer(SuperLUMatrix &lum)
Definition supermatrix.hh:322
│ │ │ +
Stores the nonzero entries for creating a sparse matrix.
Definition matrixindexset.hh:37
│ │ │ +
void resize(size_type rows, size_type cols)
Reset the size of an index set.
Definition matrixindexset.hh:99
│ │ │ +
static constexpr size_type defaultMaxVectorSize
Default value for maxVectorSize.
Definition matrixindexset.hh:76
│ │ │ +
Index size_type
Definition matrixindexset.hh:63
│ │ │ +
size_type rows() const
Return the number of rows.
Definition matrixindexset.hh:143
│ │ │ +
void exportIdx(MatrixType &matrix) const
Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet.
Definition matrixindexset.hh:200
│ │ │ +
void add(size_type row, size_type col)
Add an index to the index set.
Definition matrixindexset.hh:112
│ │ │ +
MatrixIndexSet(size_type rows, size_type cols, size_type maxVectorSize=defaultMaxVectorSize)
Constructor setting the matrix size.
Definition matrixindexset.hh:93
│ │ │ +
MatrixIndexSet(size_type maxVectorSize=defaultMaxVectorSize) noexcept
Constructor with custom maxVectorSize.
Definition matrixindexset.hh:83
│ │ │ +
const auto & columnIndices(size_type row) const
Return column indices of entries in given row.
Definition matrixindexset.hh:157
│ │ │ +
size_type rowsize(size_type row) const
Return the number of entries in a given row.
Definition matrixindexset.hh:162
│ │ │ +
size_type size() const
Return the number of entries.
Definition matrixindexset.hh:135
│ │ │ +
size_type cols() const
Return the number of columns.
Definition matrixindexset.hh:146
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,461 +1,232 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -supermatrix.hh │ │ │ │ +matrixindexset.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SUPERMATRIX_HH │ │ │ │ -6#define DUNE_ISTL_SUPERMATRIX_HH │ │ │ │ +5#ifndef DUNE_ISTL_MATRIXINDEXSET_HH │ │ │ │ +6#define DUNE_ISTL_MATRIXINDEXSET_HH │ │ │ │ 7 │ │ │ │ -8#if HAVE_SUPERLU │ │ │ │ -9 │ │ │ │ -10#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ -11#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15#include │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14 │ │ │ │ +15#include │ │ │ │ 16 │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ 18 │ │ │ │ -19#include "_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h" │ │ │ │ -20 │ │ │ │ -21namespace _D_u_n_e │ │ │ │ -22{ │ │ │ │ -23 │ │ │ │ -24 template │ │ │ │ -_2_5 struct _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r │ │ │ │ -26 {}; │ │ │ │ -27 │ │ │ │ -28 template │ │ │ │ -_2_9 struct _S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r │ │ │ │ -30 {}; │ │ │ │ -31 │ │ │ │ -32#if __has_include("slu_sdefs.h") │ │ │ │ -33 template<> │ │ │ │ -34 struct _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r │ │ │ │ -35 { │ │ │ │ -36 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ -37 float *values, int *rowindex, int* colindex, │ │ │ │ -38 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -39 { │ │ │ │ -40 sCreate_CompCol_Matrix(_m_a_t, n, m, offset, values, rowindex, colindex, │ │ │ │ -41 stype, dtype, mtype); │ │ │ │ -42 } │ │ │ │ -43 }; │ │ │ │ -44 │ │ │ │ -45 template<> │ │ │ │ -46 struct SuperMatrixPrinter │ │ │ │ -47 { │ │ │ │ -48 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ -49 { │ │ │ │ -50 sPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ -51 } │ │ │ │ -52 }; │ │ │ │ -53#endif │ │ │ │ -54 │ │ │ │ -55#if __has_include("slu_ddefs.h") │ │ │ │ -56 template<> │ │ │ │ -57 struct SuperMatrixCreateSparseChooser │ │ │ │ -58 { │ │ │ │ -59 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ -60 double *values, int *rowindex, int* colindex, │ │ │ │ -61 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -62 { │ │ │ │ -63 dCreate_CompCol_Matrix(_m_a_t, n, m, offset, values, rowindex, colindex, │ │ │ │ -64 stype, dtype, mtype); │ │ │ │ -65 } │ │ │ │ -66 }; │ │ │ │ -67 │ │ │ │ -68 template<> │ │ │ │ -69 struct SuperMatrixPrinter │ │ │ │ -70 { │ │ │ │ -71 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ -72 { │ │ │ │ -73 dPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ -74 } │ │ │ │ -75 }; │ │ │ │ -76#endif │ │ │ │ +19 │ │ │ │ +_3_6 class _M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ +37 { │ │ │ │ +38 using Index = std::uint_least32_t; │ │ │ │ +39 │ │ │ │ +40 // A vector that partly mimics a std::set by staying │ │ │ │ +41 // sorted on insert() and having unique values. │ │ │ │ +42 class FlatSet : public std::vector │ │ │ │ +43 { │ │ │ │ +44 using Base = std::vector; │ │ │ │ +45 public: │ │ │ │ +46 using Base::Base; │ │ │ │ +47 using Base::begin; │ │ │ │ +48 using Base::end; │ │ │ │ +49 void insert(const Index& value) { │ │ │ │ +50 auto it = std::lower_bound(begin(), end(), value); │ │ │ │ +51 if ((it == end() or (*it != value))) │ │ │ │ +52 Base::insert(it, value); │ │ │ │ +53 } │ │ │ │ +54 bool contains(const Index& value) const { │ │ │ │ +55 return std::binary_search(begin(), end(), value); │ │ │ │ +56 } │ │ │ │ +57 }; │ │ │ │ +58 │ │ │ │ +59 using RowIndexSet = std::variant>; │ │ │ │ +60 │ │ │ │ +61 public: │ │ │ │ +62 │ │ │ │ +_6_3 using _s_i_z_e___t_y_p_e = Index; │ │ │ │ +64 │ │ │ │ +_7_6 static constexpr _s_i_z_e___t_y_p_e _d_e_f_a_u_l_t_M_a_x_V_e_c_t_o_r_S_i_z_e = 2048; │ │ │ │ 77 │ │ │ │ -78#if __has_include("slu_cdefs.h") │ │ │ │ -79 template<> │ │ │ │ -80 struct SuperMatrixCreateSparseChooser<_s_t_d::complex > │ │ │ │ -81 { │ │ │ │ -82 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ -83 std::complex *values, int *rowindex, int* colindex, │ │ │ │ -84 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -85 { │ │ │ │ -86 cCreate_CompCol_Matrix(_m_a_t, n, m, offset, reinterpret_cast │ │ │ │ -(values), │ │ │ │ -87 rowindex, colindex, stype, dtype, mtype); │ │ │ │ -88 } │ │ │ │ -89 }; │ │ │ │ -90 │ │ │ │ -91 template<> │ │ │ │ -92 struct SuperMatrixPrinter<_s_t_d::complex > │ │ │ │ -93 { │ │ │ │ -94 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ -95 { │ │ │ │ -96 cPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ -97 } │ │ │ │ -98 }; │ │ │ │ -99#endif │ │ │ │ -100 │ │ │ │ -101#if __has_include("slu_zdefs.h") │ │ │ │ -102 template<> │ │ │ │ -103 struct SuperMatrixCreateSparseChooser<_s_t_d::complex > │ │ │ │ -104 { │ │ │ │ -105 static void create(SuperMatrix *_m_a_t, int n, int m, int offset, │ │ │ │ -106 std::complex *values, int *rowindex, int* colindex, │ │ │ │ -107 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -108 { │ │ │ │ -109 zCreate_CompCol_Matrix(_m_a_t, n, m, offset, reinterpret_cast │ │ │ │ -(values), │ │ │ │ -110 rowindex, colindex, stype, dtype, mtype); │ │ │ │ -111 } │ │ │ │ -112 }; │ │ │ │ -113 │ │ │ │ -114 template<> │ │ │ │ -115 struct SuperMatrixPrinter<_s_t_d::complex > │ │ │ │ -116 { │ │ │ │ -117 static void print(char* name, SuperMatrix* _m_a_t) │ │ │ │ -118 { │ │ │ │ -119 zPrint_CompCol_Matrix(name, _m_a_t); │ │ │ │ -120 } │ │ │ │ -121 }; │ │ │ │ -122#endif │ │ │ │ -123 │ │ │ │ -124 template │ │ │ │ -_1_2_5 struct _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -126 { │ │ │ │ -_1_2_7 static const Dtype_t _t_y_p_e; │ │ │ │ -128 }; │ │ │ │ -129 │ │ │ │ -130 template │ │ │ │ -_1_3_1 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -132 {}; │ │ │ │ +_8_3 _M_a_t_r_i_x_I_n_d_e_x_S_e_t(_s_i_z_e___t_y_p_e maxVectorSize=_d_e_f_a_u_l_t_M_a_x_V_e_c_t_o_r_S_i_z_e) noexcept : │ │ │ │ +rows_(0), cols_(0), maxVectorSize_(maxVectorSize) │ │ │ │ +84 {} │ │ │ │ +85 │ │ │ │ +_9_3 _M_a_t_r_i_x_I_n_d_e_x_S_e_t(_s_i_z_e___t_y_p_e _r_o_w_s, _s_i_z_e___t_y_p_e _c_o_l_s, _s_i_z_e___t_y_p_e │ │ │ │ +maxVectorSize=_d_e_f_a_u_l_t_M_a_x_V_e_c_t_o_r_S_i_z_e) : rows_(_r_o_w_s), cols_(_c_o_l_s), maxVectorSize_ │ │ │ │ +(maxVectorSize) │ │ │ │ +94 { │ │ │ │ +95 indices_.resize(rows_, FlatSet()); │ │ │ │ +96 } │ │ │ │ +97 │ │ │ │ +_9_9 void _r_e_s_i_z_e(_s_i_z_e___t_y_p_e _r_o_w_s, _s_i_z_e___t_y_p_e _c_o_l_s) { │ │ │ │ +100 rows_ = _r_o_w_s; │ │ │ │ +101 cols_ = _c_o_l_s; │ │ │ │ +102 indices_.resize(rows_, FlatSet()); │ │ │ │ +103 } │ │ │ │ +104 │ │ │ │ +_1_1_2 void _a_d_d(_s_i_z_e___t_y_p_e row, _s_i_z_e___t_y_p_e _c_o_l) { │ │ │ │ +113 return std::visit(Dune::overload( │ │ │ │ +114 // If row is stored as set, call insert directly │ │ │ │ +115 [&](std::set& set) { │ │ │ │ +116 set.insert(_c_o_l); │ │ │ │ +117 }, │ │ │ │ +118 // If row is stored as vector only insert directly │ │ │ │ +119 // if maxVectorSize_ is not reached. Otherwise switch │ │ │ │ +120 // to set storage first. │ │ │ │ +121 [&](FlatSet& sortedVector) { │ │ │ │ +122 if (sortedVector.size() < maxVectorSize_) │ │ │ │ +123 sortedVector.insert(_c_o_l); │ │ │ │ +124 else if (not sortedVector.contains(_c_o_l)) │ │ │ │ +125 { │ │ │ │ +126 std::set set(sortedVector.begin(), sortedVector.end()); │ │ │ │ +127 set.insert(_c_o_l); │ │ │ │ +128 indices_[row] = std::move(set); │ │ │ │ +129 } │ │ │ │ +130 } │ │ │ │ +131 ), indices_[row]); │ │ │ │ +132 } │ │ │ │ 133 │ │ │ │ -134 template │ │ │ │ -135 const Dtype_t _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e = │ │ │ │ -136 std::is_same::value ? SLU_S : │ │ │ │ -137 ( std::is_same >::value ? SLU_Z : │ │ │ │ -138 ( std::is_same >::value ? SLU_C : SLU_D )); │ │ │ │ -139 │ │ │ │ -140 template<> │ │ │ │ -_1_4_1 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -142 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -143 { │ │ │ │ -_1_4_4 typedef double _f_l_o_a_t___t_y_p_e; │ │ │ │ -145 }; │ │ │ │ -146 │ │ │ │ -147 template<> │ │ │ │ -_1_4_8 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -149 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -150 { │ │ │ │ -_1_5_1 typedef float _f_l_o_a_t___t_y_p_e; │ │ │ │ -152 }; │ │ │ │ -153 │ │ │ │ -154 template<> │ │ │ │ -_1_5_5 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e<_s_t_d::complex > │ │ │ │ -156 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e > │ │ │ │ -157 { │ │ │ │ -_1_5_8 typedef double _f_l_o_a_t___t_y_p_e; │ │ │ │ -159 }; │ │ │ │ +_1_3_5 _s_i_z_e___t_y_p_e _s_i_z_e() const { │ │ │ │ +136 _s_i_z_e___t_y_p_e entries = 0; │ │ │ │ +137 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_1_6_2 struct _G_e_t_S_u_p_e_r_L_U_T_y_p_e<_s_t_d::complex > │ │ │ │ -163 : public _B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e > │ │ │ │ -164 { │ │ │ │ -_1_6_5 typedef float _f_l_o_a_t___t_y_p_e; │ │ │ │ -166 │ │ │ │ -167 }; │ │ │ │ -168 │ │ │ │ -173 template │ │ │ │ -_1_7_4 struct _S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -175 {}; │ │ │ │ +_1_6_2 _s_i_z_e___t_y_p_e _r_o_w_s_i_z_e(_s_i_z_e___t_y_p_e row) const { │ │ │ │ +163 return std::visit([&](const auto& rowIndices) { │ │ │ │ +164 return rowIndices.size(); │ │ │ │ +165 }, indices_[row]); │ │ │ │ +166 } │ │ │ │ +167 │ │ │ │ +174 template │ │ │ │ +_1_7_5 void import(const MatrixType& m, _s_i_z_e___t_y_p_e rowOffset=0, _s_i_z_e___t_y_p_e │ │ │ │ +colOffset=0) { │ │ │ │ 176 │ │ │ │ -177 template │ │ │ │ -_1_7_8 struct _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -179 {}; │ │ │ │ -180 │ │ │ │ -181 template │ │ │ │ -182 class _S_u_p_e_r_L_U; │ │ │ │ +177 typedef typename MatrixType::row_type RowType; │ │ │ │ +178 typedef typename RowType::ConstIterator ColumnIterator; │ │ │ │ +179 │ │ │ │ +180 for (_s_i_z_e___t_y_p_e rowIdx=0; rowIdx │ │ │ │ -185 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ +184 ColumnIterator cIt = row.begin(); │ │ │ │ +185 ColumnIterator cEndIt = row.end(); │ │ │ │ 186 │ │ │ │ -187 template │ │ │ │ -188 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r; │ │ │ │ +187 for(; cIt!=cEndIt; ++cIt) │ │ │ │ +188 _a_d_d(rowIdx+rowOffset, cIt.index()+colOffset); │ │ │ │ 189 │ │ │ │ -193 template │ │ │ │ -_1_9_4 class _S_u_p_e_r_L_U_M_a_t_r_i_x<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ -195 : public ISTL::Impl::BCCSMatrix::field_type, int> │ │ │ │ -196 { │ │ │ │ -197 template │ │ │ │ -_1_9_8 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -199 friend struct _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r<_B_C_R_S_M_a_t_r_i_x >; │ │ │ │ -200 public: │ │ │ │ -_2_0_2 typedef _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> _M_a_t_r_i_x; │ │ │ │ -203 │ │ │ │ -204 friend struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r<_S_u_p_e_r_L_U<_M_a_t_r_i_x>, true>; │ │ │ │ -205 │ │ │ │ -_2_0_6 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ +190 } │ │ │ │ +191 │ │ │ │ +192 } │ │ │ │ +193 │ │ │ │ +199 template │ │ │ │ +_2_0_0 void _e_x_p_o_r_t_I_d_x(MatrixType& matrix) const { │ │ │ │ +201 │ │ │ │ +202 matrix.setSize(rows_, cols_); │ │ │ │ +203 matrix.setBuildMode(MatrixType::random); │ │ │ │ +204 │ │ │ │ +205 for (_s_i_z_e___t_y_p_e row=0; row, int>(_m_a_t) │ │ │ │ -213 {} │ │ │ │ -214 │ │ │ │ -_2_1_5 _S_u_p_e_r_L_U_M_a_t_r_i_x() : ISTL::Impl::BCCSMatrix:: │ │ │ │ -field_type, int>() │ │ │ │ -216 {} │ │ │ │ +208 matrix.endrowsizes(); │ │ │ │ +209 │ │ │ │ +210 for (_s_i_z_e___t_y_p_e row=0; rowN_+this->M_*this->Nnz_ != 0) │ │ │ │ -222 free(); │ │ │ │ -223 } │ │ │ │ -224 │ │ │ │ -_2_2_6 operator SuperMatrix&() │ │ │ │ -227 { │ │ │ │ -228 return A; │ │ │ │ -229 } │ │ │ │ -230 │ │ │ │ -_2_3_2 operator const SuperMatrix&() const │ │ │ │ -233 { │ │ │ │ -234 return A; │ │ │ │ -235 } │ │ │ │ -236 │ │ │ │ -_2_3_7 _S_u_p_e_r_L_U_M_a_t_r_i_x_<_B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> >& _o_p_e_r_a_t_o_r_=(const _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_>& _m_a_t) │ │ │ │ -238 { │ │ │ │ -239 if (this->N_ + this->M_ + this->Nnz_!=0) │ │ │ │ -240 free(); │ │ │ │ -241 │ │ │ │ -242 using _M_a_t_r_i_x = _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_>; │ │ │ │ -243 this->N_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t); │ │ │ │ -244 this->M_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t); │ │ │ │ -245 ISTL::Impl::BCCSMatrixInitializer initializer(*this); │ │ │ │ -246 │ │ │ │ -247 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ -248 │ │ │ │ -249 _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ -250_ _:_:_c_r_e_a_t_e(&A, this->N_, this->M_, this->colstart[this->N_], │ │ │ │ -251 this->values,this->rowindex, this->colstart, SLU_NC, │ │ │ │ -252 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_>_:_:_t_y_p_e), │ │ │ │ -SLU_GE); │ │ │ │ -253 return *this; │ │ │ │ -254 } │ │ │ │ -255 │ │ │ │ -_2_5_6 _S_u_p_e_r_L_U_M_a_t_r_i_x_<_B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> >& _o_p_e_r_a_t_o_r_=(const _S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -<_B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_> >& _m_a_t) │ │ │ │ -257 { │ │ │ │ -258 if (this->N_ + this->M_ + this->Nnz_!=0) │ │ │ │ -259 free(); │ │ │ │ -260 │ │ │ │ -261 using _M_a_t_r_i_x = _B_C_R_S_M_a_t_r_i_x_<_B_,_T_A_>; │ │ │ │ -262 this->N_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t); │ │ │ │ -263 this->M_ = _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t); │ │ │ │ -264 ISTL::Impl::BCCSMatrixInitializer initializer(*this); │ │ │ │ -265 │ │ │ │ -266 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ -267 │ │ │ │ -268 _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_B_> │ │ │ │ -269_ _:_:_c_r_e_a_t_e(&A, this->N_, this->M_, this->colstart[this->N_], │ │ │ │ -270 this->values,this->rowindex, this->colstart, SLU_NC, │ │ │ │ -271 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_B_>_:_:_t_y_p_e), SLU_GE); │ │ │ │ -272 return *this; │ │ │ │ -273 } │ │ │ │ -274 │ │ │ │ -_2_8_1 virtual void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& _m_a_t, const std::set& mrs) │ │ │ │ -282 { │ │ │ │ -283 if(this->N_+this->M_+this->Nnz_!=0) │ │ │ │ -284 free(); │ │ │ │ -285 this->N_=mrs.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e_>_:_:_r_o_w_d_i_m(* │ │ │ │ -(_m_a_t[0].begin())); │ │ │ │ -286 this->M_=mrs.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e_>_:_:_c_o_l_d_i_m(* │ │ │ │ -(_m_a_t[0].begin())); │ │ │ │ -287 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_M_a_t_r_i_x_> initializer(*this); │ │ │ │ -288 │ │ │ │ -289 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ -set >(_m_a_t,mrs)); │ │ │ │ -290 } │ │ │ │ -291 │ │ │ │ -_2_9_3 virtual void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& _m_a_t) │ │ │ │ -294 { │ │ │ │ -295 this->N_=_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(_m_a_t); │ │ │ │ -296 this->M_=_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_m_a_t); │ │ │ │ -297 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_M_a_t_r_i_x_> initializer(*this); │ │ │ │ -298 │ │ │ │ -299 copyToBCCSMatrix(initializer, _m_a_t); │ │ │ │ -300 } │ │ │ │ -301 │ │ │ │ -_3_0_3 virtual void _f_r_e_e() │ │ │ │ -304 { │ │ │ │ -305 ISTL::Impl::BCCSMatrix::field_type, int>::free(); │ │ │ │ -306 SUPERLU_FREE(A.Store); │ │ │ │ -307 } │ │ │ │ -308 private: │ │ │ │ -309 SuperMatrix A; │ │ │ │ -310 }; │ │ │ │ -311 │ │ │ │ -312 template │ │ │ │ -_3_1_3 class _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ -314 : public ISTL::Impl::BCCSMatrixInitializer, int> │ │ │ │ -315 { │ │ │ │ -316 template │ │ │ │ -_3_1_7 friend class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ -318 public: │ │ │ │ -_3_1_9 typedef _B_C_R_S_M_a_t_r_i_x_<_B_,_A_> _M_a_t_r_i_x; │ │ │ │ -_3_2_0 typedef _D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_M_a_t_r_i_x_> _S_u_p_e_r_L_U_M_a_t_r_i_x; │ │ │ │ -321 │ │ │ │ -_3_2_2 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r(_S_u_p_e_r_L_U_M_a_t_r_i_x& lum) : ISTL::Impl:: │ │ │ │ -BCCSMatrixInitializer<_B_C_R_S_M_a_t_r_i_x, int>(lum) │ │ │ │ -323 ,slumat(&lum) │ │ │ │ -324 {} │ │ │ │ -325 │ │ │ │ -_3_2_6 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r() : ISTL::Impl:: │ │ │ │ -BCCSMatrixInitializer<_B_C_R_S_M_a_t_r_i_x, int>() │ │ │ │ -327 {} │ │ │ │ -328 │ │ │ │ -_3_2_9 virtual void _c_r_e_a_t_e_M_a_t_r_i_x() const │ │ │ │ -330 { │ │ │ │ -331 ISTL::Impl::BCCSMatrixInitializer, int>::createMatrix(); │ │ │ │ -332 _S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ -333_ _:_:_c_r_e_a_t_e(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols], │ │ │ │ -334 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC, │ │ │ │ -335 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e_>_:_:_t_y_p_e), │ │ │ │ -SLU_GE); │ │ │ │ -336 } │ │ │ │ -337 private: │ │ │ │ -338 _S_u_p_e_r_L_U_M_a_t_r_i_x* slumat; │ │ │ │ -339 }; │ │ │ │ -340} │ │ │ │ -341#endif // HAVE_SUPERLU │ │ │ │ -342#endif │ │ │ │ -_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ -_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ -_m_a_t │ │ │ │ -Matrix & mat │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +218 } │ │ │ │ +219 │ │ │ │ +220 private: │ │ │ │ +221 │ │ │ │ +222 std::vector indices_; │ │ │ │ +223 │ │ │ │ +224 _s_i_z_e___t_y_p_e rows_, cols_; │ │ │ │ +225 _s_i_z_e___t_y_p_e maxVectorSize_; │ │ │ │ +226 │ │ │ │ +227 }; │ │ │ │ +228 │ │ │ │ +229 │ │ │ │ +230} // end namespace Dune │ │ │ │ +231 │ │ │ │ +232#endif │ │ │ │ +_c_o_l │ │ │ │ +Col col │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -Initializer for SuperLU Matrices representing the subdomains. │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:47 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_c_o_l_d_i_m │ │ │ │ -static auto coldim(const M &A) │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:219 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_:_:_r_o_w_d_i_m │ │ │ │ -static auto rowdim(const M &A) │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:214 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ -A::size_type size_type │ │ │ │ -The type for the index access and the size. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:497 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -Sequential overlapping Schwarz preconditioner. │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U │ │ │ │ -SuperLu Solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:271 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_C_r_e_a_t_e_S_p_a_r_s_e_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:26 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:30 │ │ │ │ -_D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:126 │ │ │ │ -_D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_:_:_t_y_p_e │ │ │ │ -static const Dtype_t type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:127 │ │ │ │ -_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:132 │ │ │ │ -_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _d_o_u_b_l_e_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ -double float_type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:144 │ │ │ │ -_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _f_l_o_a_t_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ -float float_type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:151 │ │ │ │ -_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ -double float_type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:158 │ │ │ │ -_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _f_l_o_a_t_ _>_ _>_:_:_f_l_o_a_t___t_y_p_e │ │ │ │ -float float_type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:165 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -Utility class for converting an ISTL Matrix into a SuperLU Matrix. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:175 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:179 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_f_r_e_e │ │ │ │ -virtual void free() │ │ │ │ -free allocated space. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:303 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ -SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const SuperLUMatrix< │ │ │ │ -BCRSMatrix< B, TA > > &mat) │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:256 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ -SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const BCRSMatrix< B, TA > │ │ │ │ -&mat) │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:237 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -SuperLUMatrix(const Matrix &mat) │ │ │ │ -Constructor that initializes the data. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:212 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -virtual void setMatrix(const Matrix &mat) │ │ │ │ -Initialize data from given matrix. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:293 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -SuperLUMatrix() │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:215 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ -Matrix::size_type size_type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:206 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ -BCRSMatrix< B, TA > Matrix │ │ │ │ -The type of the matrix to convert. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:202 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -virtual void setMatrix(const Matrix &mat, const std::set< std::size_t > &mrs) │ │ │ │ -Initialize data from a given set of matrix rows and columns. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:281 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_ _>_:_:_~_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -virtual ~SuperLUMatrix() │ │ │ │ -Destructor. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:219 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -Dune::SuperLUMatrix< Matrix > SuperLUMatrix │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:320 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ -BCRSMatrix< B, A > Matrix │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:319 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -SuperMatrixInitializer() │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:326 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_c_r_e_a_t_e_M_a_t_r_i_x │ │ │ │ -virtual void createMatrix() const │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:329 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _>_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -SuperMatrixInitializer(SuperLUMatrix &lum) │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:322 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ +Stores the nonzero entries for creating a sparse matrix. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:37 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_r_e_s_i_z_e │ │ │ │ +void resize(size_type rows, size_type cols) │ │ │ │ +Reset the size of an index set. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:99 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_d_e_f_a_u_l_t_M_a_x_V_e_c_t_o_r_S_i_z_e │ │ │ │ +static constexpr size_type defaultMaxVectorSize │ │ │ │ +Default value for maxVectorSize. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:76 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_s_i_z_e___t_y_p_e │ │ │ │ +Index size_type │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:63 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_r_o_w_s │ │ │ │ +size_type rows() const │ │ │ │ +Return the number of rows. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:143 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_e_x_p_o_r_t_I_d_x │ │ │ │ +void exportIdx(MatrixType &matrix) const │ │ │ │ +Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:200 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_a_d_d │ │ │ │ +void add(size_type row, size_type col) │ │ │ │ +Add an index to the index set. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:112 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ +MatrixIndexSet(size_type rows, size_type cols, size_type │ │ │ │ +maxVectorSize=defaultMaxVectorSize) │ │ │ │ +Constructor setting the matrix size. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:93 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ +MatrixIndexSet(size_type maxVectorSize=defaultMaxVectorSize) noexcept │ │ │ │ +Constructor with custom maxVectorSize. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:83 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_c_o_l_u_m_n_I_n_d_i_c_e_s │ │ │ │ +const auto & columnIndices(size_type row) const │ │ │ │ +Return column indices of entries in given row. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:157 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_r_o_w_s_i_z_e │ │ │ │ +size_type rowsize(size_type row) const │ │ │ │ +Return the number of entries in a given row. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:162 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_s_i_z_e │ │ │ │ +size_type size() const │ │ │ │ +Return the number of entries. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:135 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_n_d_e_x_S_e_t_:_:_c_o_l_s │ │ │ │ +size_type cols() const │ │ │ │ +Return the number of columns. │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:146 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlufunctions.hh File Reference │ │ │ +dune-istl: registry.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,47 +65,92 @@ │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ +Namespaces | │ │ │ Macros
│ │ │ -
superlufunctions.hh File Reference
│ │ │ +
registry.hh File Reference
│ │ │
│ │ │
│ │ │ -
#include <dune-istl-config.hh>
│ │ │ -#include <supermatrix.h>
│ │ │ -#include <slu_util.h>
│ │ │ +
#include <cstddef>
│ │ │ +#include <iostream>
│ │ │ +#include <memory>
│ │ │ +#include <string>
│ │ │ +#include <utility>
│ │ │ +#include "counter.hh"
│ │ │ +#include <dune/common/typelist.hh>
│ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ +#include <dune/common/parameterizedobject.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ + │ │ │ + │ │ │ + │ │ │ +

│ │ │ +Namespaces

namespace  Dune
 
│ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ Macros

#define int_t   SUPERLU_INT_TYPE
 
#define DUNE_REGISTRY_PUT(Tag, id, ...)
 
│ │ │

Macro Definition Documentation

│ │ │ - │ │ │ -

◆ int_t

│ │ │ + │ │ │ +

◆ DUNE_REGISTRY_PUT

│ │ │ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │
#define int_t   SUPERLU_INT_TYPE#define DUNE_REGISTRY_PUT( Tag,
 id,
 ... 
)
│ │ │
│ │ │ - │ │ │ +Value:
namespace { \
│ │ │ +
template<> \
│ │ │ +
struct Registry<Tag, DUNE_GET_COUNTER(Tag)> \
│ │ │ +
{ \
│ │ │ +
static auto getCreator() \
│ │ │ +
{ \
│ │ │ +
return __VA_ARGS__; \
│ │ │ +
} \
│ │ │ +
static std::string name() { return id; } \
│ │ │ +
}; \
│ │ │ +
} \
│ │ │ +
DUNE_INC_COUNTER(Tag)
│ │ │ +
#define DUNE_GET_COUNTER(Tag)
Definition counter.hh:17
│ │ │ +
│ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,20 +1,49 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_M_a_c_r_o_s │ │ │ │ -superlufunctions.hh File Reference │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ + * _c_o_m_m_o_n │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ +registry.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_c_o_u_n_t_e_r_._h_h" │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ +NNaammeessppaacceess │ │ │ │ +namespace   _D_u_n_e │ │ │ │ +  │ │ │ │ MMaaccrrooss │ │ │ │ -#define  _i_n_t___t   SUPERLU_INT_TYPE │ │ │ │ +#define  _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(Tag, id, ...) │ │ │ │   │ │ │ │ ********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? iinntt__tt ********** │ │ │ │ -#define int_t   SUPERLU_INT_TYPE │ │ │ │ +********** _?◆_? DDUUNNEE__RREEGGIISSTTRRYY__PPUUTT ********** │ │ │ │ +#define DUNE_REGISTRY_PUT (   Tag, │ │ │ │ +   id, │ │ │ │ +   ......  │ │ │ │ + ) │ │ │ │ +VVaalluuee:: │ │ │ │ +namespace { \ │ │ │ │ +template<> \ │ │ │ │ +struct Registry \ │ │ │ │ +{ \ │ │ │ │ +static auto getCreator() \ │ │ │ │ +{ \ │ │ │ │ +return __VA_ARGS__; \ │ │ │ │ +} \ │ │ │ │ +static std::string name() { return id; } \ │ │ │ │ +}; \ │ │ │ │ +} \ │ │ │ │ +DUNE_INC_COUNTER(Tag) │ │ │ │ +_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ +#define DUNE_GET_COUNTER(Tag) │ │ │ │ +DDeeffiinniittiioonn counter.hh:17 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlufunctions.hh Source File │ │ │ +dune-istl: registry.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,135 +70,106 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
superlufunctions.hh
│ │ │ +
registry.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ -
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ -
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SUPERLUFUNCTIONS_HH
│ │ │ -
6#define DUNE_ISTL_SUPERLUFUNCTIONS_HH
│ │ │ -
7#if HAVE_SUPERLU
│ │ │ -
8
│ │ │ -
9#include <dune-istl-config.hh> // SUPERLU_INT_TYPE
│ │ │ -
10
│ │ │ -
11#define int_t SUPERLU_INT_TYPE
│ │ │ -
12#include <supermatrix.h>
│ │ │ -
13#include <slu_util.h>
│ │ │ -
14#undef int_t
│ │ │ -
15
│ │ │ -
16#if __has_include("slu_sdefs.h")
│ │ │ -
17extern "C" {
│ │ │ -
18 extern void
│ │ │ -
19 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ -
20 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ -
21 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ -
22 float *, float *, float *, float *,
│ │ │ -
23 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ -
24
│ │ │ -
25 extern void
│ │ │ -
26 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int,
│ │ │ -
27 Stype_t, Dtype_t, Mtype_t);
│ │ │ -
28 extern void
│ │ │ -
29 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *,
│ │ │ -
30 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ -
31 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ +
3#ifndef DUNE_ISTL_COMMON_REGISTRY_HH
│ │ │ +
4#define DUNE_ISTL_COMMON_REGISTRY_HH
│ │ │ +
5
│ │ │ +
6#include <cstddef>
│ │ │ +
7#include <iostream>
│ │ │ +
8#include <memory>
│ │ │ +
9#include <string>
│ │ │ +
10#include <utility>
│ │ │ +
11
│ │ │ +
12#include "counter.hh"
│ │ │ +
13
│ │ │ +
14#include <dune/common/typelist.hh>
│ │ │ +
15#include <dune/common/hybridutilities.hh>
│ │ │ +
16#include <dune/common/parameterizedobject.hh>
│ │ │ +
17
│ │ │ +
│ │ │ +
18#define DUNE_REGISTRY_PUT(Tag, id, ...) \
│ │ │ +
19 namespace { \
│ │ │ +
20 template<> \
│ │ │ +
21 struct Registry<Tag, DUNE_GET_COUNTER(Tag)> \
│ │ │ +
22 { \
│ │ │ +
23 static auto getCreator() \
│ │ │ +
24 { \
│ │ │ +
25 return __VA_ARGS__; \
│ │ │ +
26 } \
│ │ │ +
27 static std::string name() { return id; } \
│ │ │ +
28 }; \
│ │ │ +
29 } \
│ │ │ +
30 DUNE_INC_COUNTER(Tag)
│ │ │ +
│ │ │ +
31
│ │ │
32
│ │ │ -
33 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ -
34}
│ │ │ -
35#endif
│ │ │ -
36
│ │ │ -
37#if __has_include("slu_ddefs.h")
│ │ │ -
38extern "C" {
│ │ │ -
39 extern void
│ │ │ -
40 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ -
41 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ -
42 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ -
43 double *, double *, double *, double *,
│ │ │ -
44 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ -
45
│ │ │ -
46 extern void
│ │ │ -
47 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *,
│ │ │ -
48 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ -
49
│ │ │ -
50 extern void
│ │ │ -
51 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int,
│ │ │ -
52 Stype_t, Dtype_t, Mtype_t);
│ │ │ -
53
│ │ │ -
54 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ -
55
│ │ │ -
56 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ -
57}
│ │ │ -
58#endif
│ │ │ -
59
│ │ │ -
60#if __has_include("slu_cdefs.h")
│ │ │ -
61#include "slu_scomplex.h"
│ │ │ -
62
│ │ │ -
63extern "C" {
│ │ │ -
64 extern void
│ │ │ -
65 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ -
66 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ -
67 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ -
68 float *, float *, float *, float *,
│ │ │ -
69 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ -
70
│ │ │ -
71
│ │ │ -
72 extern void
│ │ │ -
73 cCreate_Dense_Matrix(SuperMatrix *, int, int, singlecomplex *, int,
│ │ │ -
74 Stype_t, Dtype_t, Mtype_t);
│ │ │ -
75
│ │ │ -
76
│ │ │ -
77 extern void
│ │ │ -
78 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, singlecomplex *,
│ │ │ -
79 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ -
80
│ │ │ -
81 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ -
82
│ │ │ -
83 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ -
84}
│ │ │ -
85#endif
│ │ │ -
86
│ │ │ -
87#if __has_include("slu_zdefs.h")
│ │ │ -
88#include "slu_dcomplex.h"
│ │ │ -
89extern "C" {
│ │ │ -
90 extern void
│ │ │ -
91 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ -
92 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ -
93 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ -
94 double *, double *, double *, double *,
│ │ │ -
95 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ -
96
│ │ │ -
97
│ │ │ -
98 extern void
│ │ │ -
99 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
│ │ │ -
100 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ -
101
│ │ │ -
102 extern void
│ │ │ -
103 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
│ │ │ -
104 Stype_t, Dtype_t, Mtype_t);
│ │ │ -
105
│ │ │ -
106 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ -
107
│ │ │ -
108 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ -
109}
│ │ │ -
110#endif
│ │ │ -
111
│ │ │ -
112
│ │ │ -
113#endif
│ │ │ -
114#endif
│ │ │ +
33namespace Dune {
│ │ │ +
34 namespace {
│ │ │ +
35 template<class Tag, std::size_t index>
│ │ │ +
36 struct Registry;
│ │ │ +
37 }
│ │ │ +
38
│ │ │ +
39 namespace {
│ │ │ +
40 template<template<class> class Base, class V, class Tag, typename... Args>
│ │ │ +
41 auto registryGet(Tag , std::string name, Args... args)
│ │ │ +
42 {
│ │ │ +
43 constexpr auto count = DUNE_GET_COUNTER(Tag);
│ │ │ +
44 std::shared_ptr<Base<V> > result;
│ │ │ +
45 Dune::Hybrid::forEach(std::make_index_sequence<count>{},
│ │ │ +
46 [&](auto index) {
│ │ │ +
47 using Reg = Registry<Tag, index>;
│ │ │ +
48 if(!result && Reg::name() == name) {
│ │ │ +
49 result = Reg::getCreator()(Dune::MetaType<V>{}, args...);
│ │ │ +
50 }
│ │ │ +
51 });
│ │ │ +
52 return result;
│ │ │ +
53 }
│ │ │ +
54
│ │ │ +
55 /*
│ │ │ +
56 Register all creators from the registry in the Parameterizedobjectfactory An
│ │ │ +
57 object of V is passed in the creator and should be used to determine the
│ │ │ +
58 template arguments.
│ │ │ +
59 */
│ │ │ +
60 template<class V, class Type, class Tag, class... Args>
│ │ │ +
61 int addRegistryToFactory(Dune::ParameterizedObjectFactory<Type(Args...), std::string>& factory,
│ │ │ +
62 Tag){
│ │ │ +
63 constexpr auto count = DUNE_GET_COUNTER(Tag);
│ │ │ +
64 Dune::Hybrid::forEach(std::make_index_sequence<count>{},
│ │ │ +
65 [&](auto index) {
│ │ │ +
66 // we first get the generic lambda
│ │ │ +
67 // and later specialize it with given parameters.
│ │ │ +
68 // doing all at once leads to an ICE with g++-6
│ │ │ +
69 using Reg = Registry<Tag, index>;
│ │ │ +
70 auto genericcreator = Reg::getCreator();
│ │ │ +
71 factory.define(Reg::name(), [genericcreator](Args... args){
│ │ │ +
72 return genericcreator(V{}, args...);
│ │ │ +
73 });
│ │ │ +
74 });
│ │ │ +
75 return count;
│ │ │ +
76 }
│ │ │ +
77 } // end anonymous namespace
│ │ │ +
78} // end namespace Dune
│ │ │ +
79
│ │ │ +
80#endif // DUNE_ISTL_COMMON_REGISTRY_HH
│ │ │ + │ │ │ +
#define DUNE_GET_COUNTER(Tag)
Definition counter.hh:17
│ │ │ +
Definition allocator.hh:11
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,125 +1,99 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -superlufunctions.hh │ │ │ │ + * _c_o_m_m_o_n │ │ │ │ +registry.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ -3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ -4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SUPERLUFUNCTIONS_HH │ │ │ │ -6#define DUNE_ISTL_SUPERLUFUNCTIONS_HH │ │ │ │ -7#if HAVE_SUPERLU │ │ │ │ -8 │ │ │ │ -9#include // SUPERLU_INT_TYPE │ │ │ │ -10 │ │ │ │ -_1_1#define int_t SUPERLU_INT_TYPE │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#undef int_t │ │ │ │ -15 │ │ │ │ -16#if __has_include("slu_sdefs.h") │ │ │ │ -17extern "C" { │ │ │ │ -18 extern void │ │ │ │ -19 sgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ -20 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ -21 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ -22 float *, float *, float *, float *, │ │ │ │ -23 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ -24 │ │ │ │ -25 extern void │ │ │ │ -26 sCreate_Dense_Matrix(SuperMatrix *, int, int, float *, int, │ │ │ │ -27 Stype_t, Dtype_t, Mtype_t); │ │ │ │ -28 extern void │ │ │ │ -29 sCreate_CompCol_Matrix(SuperMatrix *, int, int, int, float *, │ │ │ │ -30 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ -31 extern int sQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ +3#ifndef DUNE_ISTL_COMMON_REGISTRY_HH │ │ │ │ +4#define DUNE_ISTL_COMMON_REGISTRY_HH │ │ │ │ +5 │ │ │ │ +6#include │ │ │ │ +7#include │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11 │ │ │ │ +12#include "_c_o_u_n_t_e_r_._h_h" │ │ │ │ +13 │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ +17 │ │ │ │ +_1_8#define DUNE_REGISTRY_PUT(Tag, id, ...) \ │ │ │ │ +19 namespace { \ │ │ │ │ +20 template<> \ │ │ │ │ +21 struct Registry \ │ │ │ │ +22 { \ │ │ │ │ +23 static auto getCreator() \ │ │ │ │ +24 { \ │ │ │ │ +25 return __VA_ARGS__; \ │ │ │ │ +26 } \ │ │ │ │ +27 static std::string name() { return id; } \ │ │ │ │ +28 }; \ │ │ │ │ +29 } \ │ │ │ │ +30 DUNE_INC_COUNTER(Tag) │ │ │ │ +31 │ │ │ │ 32 │ │ │ │ -33 extern void sPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ -34} │ │ │ │ -35#endif │ │ │ │ -36 │ │ │ │ -37#if __has_include("slu_ddefs.h") │ │ │ │ -38extern "C" { │ │ │ │ -39 extern void │ │ │ │ -40 dgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ -41 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ -42 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ -43 double *, double *, double *, double *, │ │ │ │ -44 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ -45 │ │ │ │ -46 extern void │ │ │ │ -47 dCreate_CompCol_Matrix(SuperMatrix *, int, int, int, double *, │ │ │ │ -48 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ -49 │ │ │ │ -50 extern void │ │ │ │ -51 dCreate_Dense_Matrix(SuperMatrix *, int, int, double *, int, │ │ │ │ -52 Stype_t, Dtype_t, Mtype_t); │ │ │ │ -53 │ │ │ │ -54 extern int dQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ -55 │ │ │ │ -56 extern void dPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ -57} │ │ │ │ -58#endif │ │ │ │ -59 │ │ │ │ -60#if __has_include("slu_cdefs.h") │ │ │ │ -61#include "slu_scomplex.h" │ │ │ │ -62 │ │ │ │ -63extern "C" { │ │ │ │ -64 extern void │ │ │ │ -65 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ -66 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ -67 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ -68 float *, float *, float *, float *, │ │ │ │ -69 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ -70 │ │ │ │ -71 │ │ │ │ -72 extern void │ │ │ │ -73 cCreate_Dense_Matrix(SuperMatrix *, int, int, singlecomplex *, int, │ │ │ │ -74 Stype_t, Dtype_t, Mtype_t); │ │ │ │ -75 │ │ │ │ -76 │ │ │ │ -77 extern void │ │ │ │ -78 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, singlecomplex *, │ │ │ │ -79 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ -80 │ │ │ │ -81 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ -82 │ │ │ │ -83 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ -84} │ │ │ │ -85#endif │ │ │ │ -86 │ │ │ │ -87#if __has_include("slu_zdefs.h") │ │ │ │ -88#include "slu_dcomplex.h" │ │ │ │ -89extern "C" { │ │ │ │ -90 extern void │ │ │ │ -91 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ -92 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ -93 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ -94 double *, double *, double *, double *, │ │ │ │ -95 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ -96 │ │ │ │ -97 │ │ │ │ -98 extern void │ │ │ │ -99 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, │ │ │ │ -100 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ -101 │ │ │ │ -102 extern void │ │ │ │ -103 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, │ │ │ │ -104 Stype_t, Dtype_t, Mtype_t); │ │ │ │ -105 │ │ │ │ -106 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ -107 │ │ │ │ -108 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ -109} │ │ │ │ -110#endif │ │ │ │ -111 │ │ │ │ -112 │ │ │ │ -113#endif │ │ │ │ -114#endif │ │ │ │ +33namespace _D_u_n_e { │ │ │ │ +34 namespace { │ │ │ │ +35 template │ │ │ │ +36 struct Registry; │ │ │ │ +37 } │ │ │ │ +38 │ │ │ │ +39 namespace { │ │ │ │ +40 template class Base, class V, class Tag, typename... Args> │ │ │ │ +41 auto registryGet(Tag , std::string name, Args... args) │ │ │ │ +42 { │ │ │ │ +43 constexpr auto count = _D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag); │ │ │ │ +44 std::shared_ptr > result; │ │ │ │ +45 Dune::Hybrid::forEach(std::make_index_sequence{}, │ │ │ │ +46 [&](auto index) { │ │ │ │ +47 using Reg = Registry; │ │ │ │ +48 if(!result && Reg::name() == name) { │ │ │ │ +49 result = Reg::getCreator()(Dune::MetaType{}, args...); │ │ │ │ +50 } │ │ │ │ +51 }); │ │ │ │ +52 return result; │ │ │ │ +53 } │ │ │ │ +54 │ │ │ │ +55 /* │ │ │ │ +56 Register all creators from the registry in the Parameterizedobjectfactory An │ │ │ │ +57 object of V is passed in the creator and should be used to determine the │ │ │ │ +58 template arguments. │ │ │ │ +59 */ │ │ │ │ +60 template │ │ │ │ +61 int addRegistryToFactory(Dune::ParameterizedObjectFactory& factory, │ │ │ │ +62 Tag){ │ │ │ │ +63 constexpr auto count = _D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag); │ │ │ │ +64 Dune::Hybrid::forEach(std::make_index_sequence{}, │ │ │ │ +65 [&](auto index) { │ │ │ │ +66 // we first get the generic lambda │ │ │ │ +67 // and later specialize it with given parameters. │ │ │ │ +68 // doing all at once leads to an ICE with g++-6 │ │ │ │ +69 using Reg = Registry; │ │ │ │ +70 auto genericcreator = Reg::getCreator(); │ │ │ │ +71 factory.define(Reg::name(), [genericcreator](Args... args){ │ │ │ │ +72 return genericcreator(V{}, args...); │ │ │ │ +73 }); │ │ │ │ +74 }); │ │ │ │ +75 return count; │ │ │ │ +76 } │ │ │ │ +77 } // end anonymous namespace │ │ │ │ +78} // end namespace Dune │ │ │ │ +79 │ │ │ │ +80#endif // DUNE_ISTL_COMMON_REGISTRY_HH │ │ │ │ +_c_o_u_n_t_e_r_._h_h │ │ │ │ +_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ +#define DUNE_GET_COUNTER(Tag) │ │ │ │ +DDeeffiinniittiioonn counter.hh:17 │ │ │ │ +_D_u_n_e │ │ │ │ +DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlu.hh File Reference │ │ │ +dune-istl: counter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,87 +65,125 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -Classes | │ │ │ Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Macros | │ │ │ +Variables
│ │ │ +
counter.hh File Reference
│ │ │ │ │ │
│ │ │ - │ │ │ -

Classes for using SuperLU with ISTL matrices. │ │ │ -More...

│ │ │ -
#include "superlufunctions.hh"
│ │ │ -#include "solvers.hh"
│ │ │ -#include "supermatrix.hh"
│ │ │ -#include <algorithm>
│ │ │ -#include <functional>
│ │ │ -#include "bcrsmatrix.hh"
│ │ │ -#include "bvector.hh"
│ │ │ -#include "istlexception.hh"
│ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ -#include <dune/common/fvector.hh>
│ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ -#include <dune/istl/solverfactory.hh>
│ │ │ +
#include <cassert>
│ │ │ +#include <typeinfo>
│ │ │ +#include <iostream>
│ │ │ +#include <memory>
│ │ │ +#include <tuple>
│ │ │ +#include <utility>
│ │ │ +#include <dune/common/typeutilities.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Classes

struct  Dune::SuperLUSolveChooser< T >
 
struct  Dune::SuperLUDenseMatChooser< T >
 
struct  Dune::SuperLUQueryChooser< T >
 
struct  Dune::QuerySpaceChooser< T >
 
class  Dune::SuperLU< M >
 SuperLu Solver. More...
 
struct  Dune::IsDirectSolver< SuperLU< BCRSMatrix< T, A > > >
 
struct  Dune::StoresColumnCompressed< SuperLU< BCRSMatrix< T, A > > >
 
struct  Dune::SuperLUCreator
 
struct  Dune::SuperLUCreator::isValidBlock< class >
 
struct  Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< double, k > >
 
struct  Dune::SuperLUCreator::isValidBlock< Dune::FieldVector< std::complex< double >, k > >
 
struct  Dune::SuperLUCreator::isValidBlock< double >
 
struct  Dune::SuperLUCreator::isValidBlock< std::complex< double > >
 
│ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ + │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::CounterImpl
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +

│ │ │ -Functions

 Dune::DUNE_REGISTER_DIRECT_SOLVER ("superlu", SuperLUCreator())
 

│ │ │ +Macros

#define DUNE_GET_COUNTER(Tag)    (counterFunc(Dune::PriorityTag<maxcount>{}, Tag{}, Dune::CounterImpl::ADLTag{}))
 
#define DUNE_INC_COUNTER(Tag)
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ +

│ │ │ +Variables

constexpr std::size_t maxcount = 100
 
│ │ │ +

Macro Definition Documentation

│ │ │ + │ │ │ +

◆ DUNE_GET_COUNTER

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
#define DUNE_GET_COUNTER( Tag)    (counterFunc(Dune::PriorityTag<maxcount>{}, Tag{}, Dune::CounterImpl::ADLTag{}))
│ │ │ +
│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ +

◆ DUNE_INC_COUNTER

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
#define DUNE_INC_COUNTER( Tag)
│ │ │ +
│ │ │ +Value:
namespace { \
│ │ │ +
namespace CounterImpl { \
│ │ │ +
constexpr std::size_t \
│ │ │ +
counterFunc(Dune::PriorityTag<DUNE_GET_COUNTER(Tag)+1> p, Tag, ADLTag) \
│ │ │ +
{ \
│ │ │ +
return p.value; \
│ │ │ +
} \
│ │ │ +
} \
│ │ │ +
} \
│ │ │ +
static_assert(true, "unfudge indentation")
│ │ │ +
#define DUNE_GET_COUNTER(Tag)
Definition counter.hh:17
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +

Variable Documentation

│ │ │ + │ │ │ +

◆ maxcount

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
constexpr std::size_t maxcount = 100
│ │ │ +
│ │ │ +constexpr
│ │ │ -

Detailed Description

│ │ │ -

Classes for using SuperLU with ISTL matrices.

│ │ │ -
Author
Markus Blatt
│ │ │ -
│ │ │ +
│ │ │ + │ │ │ +
│ │ │ +
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,65 +1,56 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -superlu.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) │ │ │ │ -Classes for using SuperLU with ISTL matrices. _M_o_r_e_._._. │ │ │ │ -#include "_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h" │ │ │ │ -#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ -#include "_s_u_p_e_r_m_a_t_r_i_x_._h_h" │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ -#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ + * _c_o_m_m_o_n │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _V_a_r_i_a_b_l_e_s │ │ │ │ +counter.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ -CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_Q_u_e_r_y_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_S_u_p_e_r_L_U_<_ _M_ _> │ │ │ │ -  SuperLu Solver. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _S_u_p_e_r_L_U_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _S_u_p_e_r_L_U_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _c_l_a_s_s_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_ _d_o_u_b_l_e_,_ _k_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_< │ │ │ │ - _d_o_u_b_l_e_ _>_,_ _k_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _d_o_u_b_l_e_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _> │ │ │ │ -  │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("superlu", _S_u_p_e_r_L_U_C_r_e_a_t_o_r()) │ │ │ │ +namespace   _D_u_n_e_:_:_C_o_u_n_t_e_r_I_m_p_l │ │ │ │   │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Classes for using SuperLU with ISTL matrices. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ +MMaaccrrooss │ │ │ │ +#define  _D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag)    (counterFunc(Dune::PriorityTag<_m_a_x_c_o_u_n_t>{}, │ │ │ │ + Tag{}, Dune::CounterImpl::ADLTag{})) │ │ │ │ +  │ │ │ │ +#define  _D_U_N_E___I_N_C___C_O_U_N_T_E_R(Tag) │ │ │ │ +  │ │ │ │ +VVaarriiaabblleess │ │ │ │ +constexpr std::size_t  _m_a_x_c_o_u_n_t = 100 │ │ │ │ +  │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? DDUUNNEE__GGEETT__CCOOUUNNTTEERR ********** │ │ │ │ +#define DUNE_GET_COUNTER (   Tag )     (counterFunc(Dune::PriorityTag<_m_a_x_c_o_u_n_t> │ │ │ │ + {}, Tag{}, Dune::CounterImpl::ADLTag{})) │ │ │ │ +********** _?◆_? DDUUNNEE__IINNCC__CCOOUUNNTTEERR ********** │ │ │ │ +#define DUNE_INC_COUNTER (   Tag ) │ │ │ │ +VVaalluuee:: │ │ │ │ +namespace { \ │ │ │ │ +namespace CounterImpl { \ │ │ │ │ +constexpr std::size_t \ │ │ │ │ +counterFunc(Dune::PriorityTag<_D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag)+1> p, Tag, ADLTag) \ │ │ │ │ +{ \ │ │ │ │ +return p.value; \ │ │ │ │ +} \ │ │ │ │ +} \ │ │ │ │ +} \ │ │ │ │ +static_assert(true, "unfudge indentation") │ │ │ │ +_D_U_N_E___G_E_T___C_O_U_N_T_E_R │ │ │ │ +#define DUNE_GET_COUNTER(Tag) │ │ │ │ +DDeeffiinniittiioonn counter.hh:17 │ │ │ │ +********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? mmaaxxccoouunntt ********** │ │ │ │ +constexpr std::size_t maxcount = 100 constexpr │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlu.hh Source File │ │ │ +dune-istl: counter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,837 +70,77 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
superlu.hh
│ │ │ +
counter.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ -
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ -
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SUPERLU_HH
│ │ │ -
6#define DUNE_ISTL_SUPERLU_HH
│ │ │ -
7
│ │ │ -
8#if HAVE_SUPERLU
│ │ │ -
9
│ │ │ -
10#include "superlufunctions.hh"
│ │ │ -
11#include "solvers.hh"
│ │ │ -
12#include "supermatrix.hh"
│ │ │ -
13#include <algorithm>
│ │ │ -
14#include <functional>
│ │ │ -
15#include "bcrsmatrix.hh"
│ │ │ -
16#include "bvector.hh"
│ │ │ -
17#include "istlexception.hh"
│ │ │ -
18#include <dune/common/fmatrix.hh>
│ │ │ -
19#include <dune/common/fvector.hh>
│ │ │ -
20#include <dune/common/stdstreams.hh>
│ │ │ - │ │ │ - │ │ │ -
23
│ │ │ -
24namespace Dune
│ │ │ -
25{
│ │ │ -
26
│ │ │ -
37 template<class M, class T, class TM, class TD, class TA>
│ │ │ -
38 class SeqOverlappingSchwarz;
│ │ │ -
39
│ │ │ -
40 template<class T, bool tag>
│ │ │ -
41 struct SeqOverlappingSchwarzAssemblerHelper;
│ │ │ -
42
│ │ │ -
43 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
45 {};
│ │ │ -
│ │ │ -
46
│ │ │ -
47 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
49 {};
│ │ │ -
│ │ │ -
50
│ │ │ -
51 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
53 {};
│ │ │ -
│ │ │ -
54
│ │ │ -
55 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
57 {};
│ │ │ -
│ │ │ -
58
│ │ │ -
59#if __has_include("slu_sdefs.h")
│ │ │ -
60 template<>
│ │ │ -
61 struct SuperLUDenseMatChooser<float>
│ │ │ -
62 {
│ │ │ -
63 static void create(SuperMatrix *mat, int n, int m, float *dat, int n1,
│ │ │ -
64 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
65 {
│ │ │ -
66 sCreate_Dense_Matrix(mat, n, m, dat, n1, stype, dtype, mtype);
│ │ │ -
67
│ │ │ -
68 }
│ │ │ -
69
│ │ │ -
70 static void destroy(SuperMatrix*)
│ │ │ -
71 {}
│ │ │ -
72
│ │ │ -
73 };
│ │ │ -
74 template<>
│ │ │ -
75 struct SuperLUSolveChooser<float>
│ │ │ -
76 {
│ │ │ -
77 static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
│ │ │ -
78 char *equed, float *R, float *C, SuperMatrix *L, SuperMatrix *U,
│ │ │ -
79 void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
│ │ │ -
80 float *rpg, float *rcond, float *ferr, float *berr,
│ │ │ -
81 mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
│ │ │ -
82 {
│ │ │ -
83 GlobalLU_t gLU;
│ │ │ -
84 sgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
│ │ │ -
85 L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
│ │ │ -
86 &gLU, memusage, stat, info);
│ │ │ -
87 }
│ │ │ -
88 };
│ │ │ -
89
│ │ │ -
90 template<>
│ │ │ -
91 struct QuerySpaceChooser<float>
│ │ │ -
92 {
│ │ │ -
93 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
│ │ │ -
94 {
│ │ │ -
95 sQuerySpace(L,U,memusage);
│ │ │ -
96 }
│ │ │ -
97 };
│ │ │ -
98
│ │ │ -
99#endif
│ │ │ -
100
│ │ │ -
101#if __has_include("slu_ddefs.h")
│ │ │ -
102
│ │ │ -
103 template<>
│ │ │ -
104 struct SuperLUDenseMatChooser<double>
│ │ │ -
105 {
│ │ │ -
106 static void create(SuperMatrix *mat, int n, int m, double *dat, int n1,
│ │ │ -
107 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
108 {
│ │ │ -
109 dCreate_Dense_Matrix(mat, n, m, dat, n1, stype, dtype, mtype);
│ │ │ -
110
│ │ │ -
111 }
│ │ │ -
112
│ │ │ -
113 static void destroy(SuperMatrix * /* mat */)
│ │ │ -
114 {}
│ │ │ -
115 };
│ │ │ -
116 template<>
│ │ │ -
117 struct SuperLUSolveChooser<double>
│ │ │ -
118 {
│ │ │ -
119 static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
│ │ │ -
120 char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U,
│ │ │ -
121 void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
│ │ │ -
122 double *rpg, double *rcond, double *ferr, double *berr,
│ │ │ -
123 mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
│ │ │ -
124 {
│ │ │ -
125 GlobalLU_t gLU;
│ │ │ -
126 dgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
│ │ │ -
127 L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
│ │ │ -
128 &gLU, memusage, stat, info);
│ │ │ -
129 }
│ │ │ -
130 };
│ │ │ -
131
│ │ │ -
132 template<>
│ │ │ -
133 struct QuerySpaceChooser<double>
│ │ │ -
134 {
│ │ │ -
135 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
│ │ │ -
136 {
│ │ │ -
137 dQuerySpace(L,U,memusage);
│ │ │ -
138 }
│ │ │ -
139 };
│ │ │ -
140#endif
│ │ │ -
141
│ │ │ -
142#if __has_include("slu_zdefs.h")
│ │ │ -
143 template<>
│ │ │ -
144 struct SuperLUDenseMatChooser<std::complex<double> >
│ │ │ -
145 {
│ │ │ -
146 static void create(SuperMatrix *mat, int n, int m, std::complex<double> *dat, int n1,
│ │ │ -
147 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
148 {
│ │ │ -
149 zCreate_Dense_Matrix(mat, n, m, reinterpret_cast<doublecomplex*>(dat), n1, stype, dtype, mtype);
│ │ │ -
150
│ │ │ -
151 }
│ │ │ -
152
│ │ │ -
153 static void destroy(SuperMatrix*)
│ │ │ -
154 {}
│ │ │ -
155 };
│ │ │ -
156
│ │ │ -
157 template<>
│ │ │ -
158 struct SuperLUSolveChooser<std::complex<double> >
│ │ │ -
159 {
│ │ │ -
160 static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
│ │ │ -
161 char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U,
│ │ │ -
162 void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
│ │ │ -
163 double *rpg, double *rcond, double *ferr, double *berr,
│ │ │ -
164 mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
│ │ │ -
165 {
│ │ │ -
166 GlobalLU_t gLU;
│ │ │ -
167 zgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
│ │ │ -
168 L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
│ │ │ -
169 &gLU, memusage, stat, info);
│ │ │ -
170 }
│ │ │ -
171 };
│ │ │ -
172
│ │ │ -
173 template<>
│ │ │ -
174 struct QuerySpaceChooser<std::complex<double> >
│ │ │ -
175 {
│ │ │ -
176 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
│ │ │ -
177 {
│ │ │ -
178 zQuerySpace(L,U,memusage);
│ │ │ -
179 }
│ │ │ -
180 };
│ │ │ -
181#endif
│ │ │ -
182
│ │ │ -
183#if __has_include("slu_cdefs.h")
│ │ │ -
184 template<>
│ │ │ -
185 struct SuperLUDenseMatChooser<std::complex<float> >
│ │ │ -
186 {
│ │ │ -
187 static void create(SuperMatrix *mat, int n, int m, std::complex<float> *dat, int n1,
│ │ │ -
188 Stype_t stype, Dtype_t dtype, Mtype_t mtype)
│ │ │ -
189 {
│ │ │ -
190 cCreate_Dense_Matrix(mat, n, m, reinterpret_cast<singlecomplex*>(dat), n1, stype, dtype, mtype);
│ │ │ -
191
│ │ │ -
192 }
│ │ │ -
193
│ │ │ -
194 static void destroy(SuperMatrix* /* mat */)
│ │ │ -
195 {}
│ │ │ -
196 };
│ │ │ -
197
│ │ │ -
198 template<>
│ │ │ -
199 struct SuperLUSolveChooser<std::complex<float> >
│ │ │ -
200 {
│ │ │ -
201 static void solve(superlu_options_t *options, SuperMatrix *mat, int *perm_c, int *perm_r, int *etree,
│ │ │ -
202 char *equed, float *R, float *C, SuperMatrix *L, SuperMatrix *U,
│ │ │ -
203 void *work, int lwork, SuperMatrix *B, SuperMatrix *X,
│ │ │ -
204 float *rpg, float *rcond, float *ferr, float *berr,
│ │ │ -
205 mem_usage_t *memusage, SuperLUStat_t *stat, int *info)
│ │ │ -
206 {
│ │ │ -
207 GlobalLU_t gLU;
│ │ │ -
208 cgssvx(options, mat, perm_c, perm_r, etree, equed, R, C,
│ │ │ -
209 L, U, work, lwork, B, X, rpg, rcond, ferr, berr,
│ │ │ -
210 &gLU, memusage, stat, info);
│ │ │ -
211 }
│ │ │ -
212 };
│ │ │ -
213
│ │ │ -
214 template<>
│ │ │ -
215 struct QuerySpaceChooser<std::complex<float> >
│ │ │ -
216 {
│ │ │ -
217 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* memusage)
│ │ │ -
218 {
│ │ │ -
219 cQuerySpace(L,U,memusage);
│ │ │ -
220 }
│ │ │ -
221 };
│ │ │ -
222#endif
│ │ │ -
223
│ │ │ -
224 namespace Impl
│ │ │ -
225 {
│ │ │ -
226 template<class M>
│ │ │ -
227 struct SuperLUVectorChooser
│ │ │ -
228 {};
│ │ │ -
229
│ │ │ -
230 template<typename T, typename A, int n, int m>
│ │ │ -
231 struct SuperLUVectorChooser<BCRSMatrix<FieldMatrix<T,n,m>,A > >
│ │ │ -
232 {
│ │ │ -
234 using domain_type = BlockVector<
│ │ │ -
235 FieldVector<T,m>,
│ │ │ -
236 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > >;
│ │ │ -
238 using range_type = BlockVector<
│ │ │ -
239 FieldVector<T,n>,
│ │ │ -
240 typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > >;
│ │ │ -
241 };
│ │ │ -
242
│ │ │ -
243 template<typename T, typename A>
│ │ │ -
244 struct SuperLUVectorChooser<BCRSMatrix<T,A> >
│ │ │ -
245 {
│ │ │ -
247 using domain_type = BlockVector<T, A>;
│ │ │ -
249 using range_type = BlockVector<T, A>;
│ │ │ -
250 };
│ │ │ -
251 }
│ │ │ -
252
│ │ │ -
266 template<typename M>
│ │ │ -
│ │ │ - │ │ │ -
268 : public InverseOperator<
│ │ │ -
269 typename Impl::SuperLUVectorChooser<M>::domain_type,
│ │ │ -
270 typename Impl::SuperLUVectorChooser<M>::range_type >
│ │ │ -
271 {
│ │ │ -
272 using T = typename M::field_type;
│ │ │ -
273 public:
│ │ │ -
275 using Matrix = M;
│ │ │ -
276 using matrix_type = M;
│ │ │ - │ │ │ - │ │ │ -
282 using domain_type = typename Impl::SuperLUVectorChooser<M>::domain_type;
│ │ │ -
284 using range_type = typename Impl::SuperLUVectorChooser<M>::range_type;
│ │ │ -
285
│ │ │ -
│ │ │ - │ │ │ -
288 {
│ │ │ - │ │ │ -
290 }
│ │ │ -
│ │ │ -
291
│ │ │ -
306 explicit SuperLU(const Matrix& mat, bool verbose=false,
│ │ │ -
307 bool reusevector=true);
│ │ │ -
308
│ │ │ -
309
│ │ │ -
│ │ │ -
320 SuperLU(const Matrix& mat, const ParameterTree& config)
│ │ │ -
321 : SuperLU(mat, config.get<bool>("verbose", false), config.get<bool>("reuseVector", true))
│ │ │ -
322 {}
│ │ │ -
│ │ │ -
323
│ │ │ -
330 SuperLU();
│ │ │ -
331
│ │ │ -
332 ~SuperLU();
│ │ │ -
333
│ │ │ - │ │ │ -
338
│ │ │ -
│ │ │ -
342 void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ -
343 {
│ │ │ -
344 apply(x,b,res);
│ │ │ -
345 }
│ │ │ -
│ │ │ -
346
│ │ │ -
350 void apply(T* x, T* b);
│ │ │ -
351
│ │ │ -
353 void setMatrix(const Matrix& mat);
│ │ │ -
354
│ │ │ -
│ │ │ -
355 typename SuperLUMatrix::size_type nnz() const
│ │ │ -
356 {
│ │ │ -
357 return mat.nonzeroes();
│ │ │ -
358 }
│ │ │ -
│ │ │ -
359
│ │ │ -
360 template<class S>
│ │ │ -
361 void setSubMatrix(const Matrix& mat, const S& rowIndexSet);
│ │ │ -
362
│ │ │ -
363 void setVerbosity(bool v);
│ │ │ -
364
│ │ │ -
369 void free();
│ │ │ -
370
│ │ │ -
371 const char* name() { return "SuperLU"; }
│ │ │ -
372 private:
│ │ │ -
373 template<class Mat,class X, class TM, class TD, class T1>
│ │ │ - │ │ │ - │ │ │ -
376
│ │ │ -
377 SuperLUMatrix& getInternalMatrix() { return mat; }
│ │ │ -
378
│ │ │ -
380 void decompose();
│ │ │ -
381
│ │ │ - │ │ │ -
383 SuperMatrix L, U, B, X;
│ │ │ -
384 int *perm_c, *perm_r, *etree;
│ │ │ -
385 typename GetSuperLUType<T>::float_type *R, *C;
│ │ │ -
386 T *bstore;
│ │ │ -
387 superlu_options_t options;
│ │ │ -
388 char equed;
│ │ │ -
389 void *work;
│ │ │ -
390 int lwork;
│ │ │ -
391 bool first, verbose, reusevector;
│ │ │ -
392 };
│ │ │ -
│ │ │ -
393
│ │ │ -
394 template<typename M>
│ │ │ -
395 SuperLU<M>
│ │ │ -
│ │ │ -
396 ::~SuperLU()
│ │ │ -
397 {
│ │ │ -
398 if(mat.N()+mat.M()>0)
│ │ │ -
399 free();
│ │ │ -
400 }
│ │ │ -
│ │ │ -
401
│ │ │ -
402 template<typename M>
│ │ │ -
│ │ │ - │ │ │ -
404 {
│ │ │ -
405 delete[] perm_c;
│ │ │ -
406 delete[] perm_r;
│ │ │ -
407 delete[] etree;
│ │ │ -
408 delete[] R;
│ │ │ -
409 delete[] C;
│ │ │ -
410 if(lwork>=0) {
│ │ │ -
411 Destroy_SuperNode_Matrix(&L);
│ │ │ -
412 Destroy_CompCol_Matrix(&U);
│ │ │ -
413 }
│ │ │ -
414 lwork=0;
│ │ │ -
415 if(!first && reusevector) {
│ │ │ -
416 SUPERLU_FREE(B.Store);
│ │ │ -
417 SUPERLU_FREE(X.Store);
│ │ │ -
418 }
│ │ │ -
419 mat.free();
│ │ │ -
420 }
│ │ │ -
│ │ │ -
421
│ │ │ -
422 template<typename M>
│ │ │ - │ │ │ -
│ │ │ -
424 ::SuperLU(const Matrix& mat_, bool verbose_, bool reusevector_)
│ │ │ -
425 : work(0), lwork(0), first(true), verbose(verbose_),
│ │ │ -
426 reusevector(reusevector_)
│ │ │ -
427 {
│ │ │ -
428 setMatrix(mat_);
│ │ │ -
429
│ │ │ -
430 }
│ │ │ -
│ │ │ -
431 template<typename M>
│ │ │ -
│ │ │ - │ │ │ -
433 : work(0), lwork(0),verbose(false),
│ │ │ -
434 reusevector(false)
│ │ │ -
435 {}
│ │ │ -
│ │ │ -
436 template<typename M>
│ │ │ -
│ │ │ - │ │ │ -
438 {
│ │ │ -
439 verbose=v;
│ │ │ -
440 }
│ │ │ -
│ │ │ -
441
│ │ │ -
442 template<typename M>
│ │ │ -
│ │ │ - │ │ │ -
444 {
│ │ │ -
445 if(mat.N()+mat.M()>0) {
│ │ │ -
446 free();
│ │ │ -
447 }
│ │ │ -
448 lwork=0;
│ │ │ -
449 work=0;
│ │ │ -
450 //a=&mat_;
│ │ │ -
451 mat=mat_;
│ │ │ -
452 decompose();
│ │ │ -
453 }
│ │ │ -
│ │ │ -
454
│ │ │ -
455 template<typename M>
│ │ │ -
456 template<class S>
│ │ │ -
│ │ │ - │ │ │ -
458 const S& mrs)
│ │ │ -
459 {
│ │ │ -
460 if(mat.N()+mat.M()>0) {
│ │ │ -
461 free();
│ │ │ -
462 }
│ │ │ -
463 lwork=0;
│ │ │ -
464 work=0;
│ │ │ -
465 //a=&mat_;
│ │ │ -
466 mat.setMatrix(mat_,mrs);
│ │ │ -
467 decompose();
│ │ │ -
468 }
│ │ │ -
│ │ │ -
469
│ │ │ -
470 template<typename M>
│ │ │ - │ │ │ -
472 {
│ │ │ -
473
│ │ │ -
474 first = true;
│ │ │ -
475 perm_c = new int[mat.M()];
│ │ │ -
476 perm_r = new int[mat.N()];
│ │ │ -
477 etree = new int[mat.M()];
│ │ │ -
478 R = new typename GetSuperLUType<T>::float_type[mat.N()];
│ │ │ -
479 C = new typename GetSuperLUType<T>::float_type[mat.M()];
│ │ │ -
480
│ │ │ -
481 set_default_options(&options);
│ │ │ -
482 // Do the factorization
│ │ │ -
483 B.ncol=0;
│ │ │ -
484 B.Stype=SLU_DN;
│ │ │ - │ │ │ -
486 B.Mtype= SLU_GE;
│ │ │ -
487 DNformat fakeFormat;
│ │ │ -
488 fakeFormat.lda=mat.N();
│ │ │ -
489 B.Store=&fakeFormat;
│ │ │ -
490 X.Stype=SLU_DN;
│ │ │ - │ │ │ -
492 X.Mtype= SLU_GE;
│ │ │ -
493 X.ncol=0;
│ │ │ -
494 X.Store=&fakeFormat;
│ │ │ -
495
│ │ │ -
496 typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr=1e10;
│ │ │ -
497 int info;
│ │ │ -
498 mem_usage_t memusage;
│ │ │ -
499 SuperLUStat_t stat;
│ │ │ -
500
│ │ │ -
501 StatInit(&stat);
│ │ │ -
502 SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
│ │ │ -
503 &L, &U, work, lwork, &B, &X, &rpg, &rcond, &ferr,
│ │ │ -
504 &berr, &memusage, &stat, &info);
│ │ │ -
505
│ │ │ -
506 if(verbose) {
│ │ │ -
507 dinfo<<"LU factorization: dgssvx() returns info "<< info<<std::endl;
│ │ │ -
508
│ │ │ -
509 auto nSuperLUCol = static_cast<SuperMatrix&>(mat).ncol;
│ │ │ -
510
│ │ │ -
511 if ( info == 0 || info == nSuperLUCol+1 ) {
│ │ │ -
512
│ │ │ -
513 if ( options.PivotGrowth )
│ │ │ -
514 dinfo<<"Recip. pivot growth = "<<rpg<<std::endl;
│ │ │ -
515 if ( options.ConditionNumber )
│ │ │ -
516 dinfo<<"Recip. condition number = %e\n"<< rcond<<std::endl;
│ │ │ -
517 SCformat* Lstore = (SCformat *) L.Store;
│ │ │ -
518 NCformat* Ustore = (NCformat *) U.Store;
│ │ │ -
519 dinfo<<"No of nonzeros in factor L = "<< Lstore->nnz<<std::endl;
│ │ │ -
520 dinfo<<"No of nonzeros in factor U = "<< Ustore->nnz<<std::endl;
│ │ │ -
521 dinfo<<"No of nonzeros in L+U = "<< Lstore->nnz + Ustore->nnz - nSuperLUCol<<std::endl;
│ │ │ -
522 QuerySpaceChooser<T>::querySpace(&L, &U, &memusage);
│ │ │ -
523 dinfo<<"L\\U MB "<<memusage.for_lu/1e6<<" \ttotal MB needed "<<memusage.total_needed/1e6
│ │ │ -
524 <<" \texpansions ";
│ │ │ -
525 std::cout<<stat.expansions<<std::endl;
│ │ │ -
526
│ │ │ -
527 } else if ( info > 0 && lwork == -1 ) { // Memory allocation failed
│ │ │ -
528 dinfo<<"** Estimated memory: "<< info - nSuperLUCol<<std::endl;
│ │ │ -
529 }
│ │ │ -
530 if ( options.PrintStat ) StatPrint(&stat);
│ │ │ -
531 }
│ │ │ -
532 StatFree(&stat);
│ │ │ -
533 /*
│ │ │ -
534 NCformat* Ustore = (NCformat *) U.Store;
│ │ │ -
535 int k=0;
│ │ │ -
536 dPrint_CompCol_Matrix("U", &U);
│ │ │ -
537 for(int i=0; i < U.ncol; ++i, ++k){
│ │ │ -
538 std::cout<<i<<": ";
│ │ │ -
539 for(int c=Ustore->colptr[i]; c < Ustore->colptr[i+1]; ++c)
│ │ │ -
540 //if(Ustore->rowind[c]==i)
│ │ │ -
541 std::cout<<Ustore->rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" ";
│ │ │ -
542 if(k==0){
│ │ │ -
543 //
│ │ │ -
544 k=-1;
│ │ │ -
545 }std::cout<<std::endl;
│ │ │ -
546 }
│ │ │ -
547 dPrint_SuperNode_Matrix("L", &L);
│ │ │ -
548 for(int i=0; i < U.ncol; ++i, ++k){
│ │ │ -
549 std::cout<<i<<": ";
│ │ │ -
550 for(int c=Ustore->colptr[i]; c < Ustore->colptr[i+1]; ++c)
│ │ │ -
551 //if(Ustore->rowind[c]==i)
│ │ │ -
552 std::cout<<Ustore->rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" ";
│ │ │ -
553 if(k==0){
│ │ │ -
554 //
│ │ │ -
555 k=-1;
│ │ │ -
556 }std::cout<<std::endl;
│ │ │ -
557 } */
│ │ │ -
558 options.Fact = FACTORED;
│ │ │ -
559 }
│ │ │ -
560
│ │ │ -
561 template<typename M>
│ │ │ -
562 void SuperLU<M>
│ │ │ -
│ │ │ - │ │ │ -
564 {
│ │ │ -
565 if (mat.N() != b.dim())
│ │ │ -
566 DUNE_THROW(ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
│ │ │ -
567 if (mat.M() != x.dim())
│ │ │ -
568 DUNE_THROW(ISTLError, "Size of solution vector x does not match the number of matrix columns!");
│ │ │ -
569 if (mat.M()+mat.N()==0)
│ │ │ -
570 DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
│ │ │ -
571
│ │ │ -
572 SuperMatrix* mB = &B;
│ │ │ -
573 SuperMatrix* mX = &X;
│ │ │ -
574 SuperMatrix rB, rX;
│ │ │ -
575 if (reusevector) {
│ │ │ -
576 if(first) {
│ │ │ -
577 SuperLUDenseMatChooser<T>::create(&B, (int)mat.N(), 1, reinterpret_cast<T*>(&b[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
578 SuperLUDenseMatChooser<T>::create(&X, (int)mat.N(), 1, reinterpret_cast<T*>(&x[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
579 first=false;
│ │ │ -
580 }else{
│ │ │ -
581 ((DNformat*)B.Store)->nzval=&b[0];
│ │ │ -
582 ((DNformat*)X.Store)->nzval=&x[0];
│ │ │ -
583 }
│ │ │ -
584 } else {
│ │ │ -
585 SuperLUDenseMatChooser<T>::create(&rB, (int)mat.N(), 1, reinterpret_cast<T*>(&b[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
586 SuperLUDenseMatChooser<T>::create(&rX, (int)mat.N(), 1, reinterpret_cast<T*>(&x[0]), (int)mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
587 mB = &rB;
│ │ │ -
588 mX = &rX;
│ │ │ -
589 }
│ │ │ -
590 typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr;
│ │ │ -
591 int info;
│ │ │ -
592 mem_usage_t memusage;
│ │ │ -
593 SuperLUStat_t stat;
│ │ │ -
594 /* Initialize the statistics variables. */
│ │ │ -
595 StatInit(&stat);
│ │ │ -
596 /*
│ │ │ -
597 range_type d=b;
│ │ │ -
598 a->usmv(-1, x, d);
│ │ │ -
599
│ │ │ -
600 double def0=d.two_norm();
│ │ │ -
601 */
│ │ │ -
602 options.IterRefine=SLU_DOUBLE;
│ │ │ -
603
│ │ │ -
604 SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
│ │ │ -
605 &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
│ │ │ -
606 &memusage, &stat, &info);
│ │ │ -
607
│ │ │ -
608 res.iterations=1;
│ │ │ -
609
│ │ │ -
610 /*
│ │ │ -
611 if(options.Equil==YES)
│ │ │ -
612 // undo scaling of right hand side
│ │ │ -
613 std::transform(reinterpret_cast<T*>(&b[0]),reinterpret_cast<T*>(&b[0])+mat.M(),
│ │ │ -
614 C, reinterpret_cast<T*>(&d[0]), std::divides<T>());
│ │ │ -
615 else
│ │ │ -
616 d=b;
│ │ │ -
617 a->usmv(-1, x, d);
│ │ │ -
618 res.reduction=d.two_norm()/def0;
│ │ │ -
619 res.conv_rate = res.reduction;
│ │ │ -
620 res.converged=(res.reduction<1e-10||d.two_norm()<1e-18);
│ │ │ -
621 */
│ │ │ -
622 res.converged=true;
│ │ │ -
623
│ │ │ -
624 if(verbose) {
│ │ │ -
625
│ │ │ -
626 dinfo<<"Triangular solve: dgssvx() returns info "<< info<<std::endl;
│ │ │ -
627
│ │ │ -
628 auto nSuperLUCol = static_cast<SuperMatrix&>(mat).ncol;
│ │ │ -
629
│ │ │ -
630 if ( info == 0 || info == nSuperLUCol+1 ) {
│ │ │ -
631
│ │ │ -
632 if ( options.IterRefine ) {
│ │ │ -
633 std::cout<<"Iterative Refinement: steps="
│ │ │ -
634 <<stat.RefineSteps<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
│ │ │ -
635 }else
│ │ │ -
636 std::cout<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
│ │ │ -
637 } else if ( info > 0 && lwork == -1 ) { // Memory allocation failed
│ │ │ -
638 std::cout<<"** Estimated memory: "<< info - nSuperLUCol<<" bytes"<<std::endl;
│ │ │ -
639 }
│ │ │ -
640
│ │ │ -
641 if ( options.PrintStat ) StatPrint(&stat);
│ │ │ -
642 }
│ │ │ -
643 StatFree(&stat);
│ │ │ -
644 if (!reusevector) {
│ │ │ -
645 SUPERLU_FREE(rB.Store);
│ │ │ -
646 SUPERLU_FREE(rX.Store);
│ │ │ -
647 }
│ │ │ -
648 }
│ │ │ -
│ │ │ -
649
│ │ │ -
650 template<typename M>
│ │ │ -
651 void SuperLU<M>
│ │ │ -
│ │ │ -
652 ::apply(T* x, T* b)
│ │ │ -
653 {
│ │ │ -
654 if(mat.N()+mat.M()==0)
│ │ │ -
655 DUNE_THROW(ISTLError, "Matrix of SuperLU is null!");
│ │ │ -
656
│ │ │ -
657 SuperMatrix* mB = &B;
│ │ │ -
658 SuperMatrix* mX = &X;
│ │ │ -
659 SuperMatrix rB, rX;
│ │ │ -
660 if (reusevector) {
│ │ │ -
661 if(first) {
│ │ │ -
662 SuperLUDenseMatChooser<T>::create(&B, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
663 SuperLUDenseMatChooser<T>::create(&X, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
664 first=false;
│ │ │ -
665 }else{
│ │ │ -
666 ((DNformat*) B.Store)->nzval=b;
│ │ │ -
667 ((DNformat*)X.Store)->nzval=x;
│ │ │ -
668 }
│ │ │ -
669 } else {
│ │ │ -
670 SuperLUDenseMatChooser<T>::create(&rB, mat.N(), 1, b, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
671 SuperLUDenseMatChooser<T>::create(&rX, mat.N(), 1, x, mat.N(), SLU_DN, GetSuperLUType<T>::type, SLU_GE);
│ │ │ -
672 mB = &rB;
│ │ │ -
673 mX = &rX;
│ │ │ -
674 }
│ │ │ -
675
│ │ │ -
676 typename GetSuperLUType<T>::float_type rpg, rcond, ferr=1e10, berr;
│ │ │ -
677 int info;
│ │ │ -
678 mem_usage_t memusage;
│ │ │ -
679 SuperLUStat_t stat;
│ │ │ -
680 /* Initialize the statistics variables. */
│ │ │ -
681 StatInit(&stat);
│ │ │ -
682
│ │ │ -
683 options.IterRefine=SLU_DOUBLE;
│ │ │ -
684
│ │ │ -
685 SuperLUSolveChooser<T>::solve(&options, &static_cast<SuperMatrix&>(mat), perm_c, perm_r, etree, &equed, R, C,
│ │ │ -
686 &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr,
│ │ │ -
687 &memusage, &stat, &info);
│ │ │ -
688
│ │ │ -
689 if(verbose) {
│ │ │ -
690 dinfo<<"Triangular solve: dgssvx() returns info "<< info<<std::endl;
│ │ │ -
691
│ │ │ -
692 auto nSuperLUCol = static_cast<SuperMatrix&>(mat).ncol;
│ │ │ -
693
│ │ │ -
694 if ( info == 0 || info == nSuperLUCol+1 ) { // Factorization has succeeded
│ │ │ -
695
│ │ │ -
696 if ( options.IterRefine ) {
│ │ │ -
697 dinfo<<"Iterative Refinement: steps="
│ │ │ -
698 <<stat.RefineSteps<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
│ │ │ -
699 }else
│ │ │ -
700 dinfo<<" FERR="<<ferr<<" BERR="<<berr<<std::endl;
│ │ │ -
701 } else if ( info > 0 && lwork == -1 ) { // Memory allocation failed
│ │ │ -
702 dinfo<<"** Estimated memory: "<< info - nSuperLUCol<<" bytes"<<std::endl;
│ │ │ -
703 }
│ │ │ -
704 if ( options.PrintStat ) StatPrint(&stat);
│ │ │ -
705 }
│ │ │ -
706
│ │ │ -
707 StatFree(&stat);
│ │ │ -
708 if (!reusevector) {
│ │ │ -
709 SUPERLU_FREE(rB.Store);
│ │ │ -
710 SUPERLU_FREE(rX.Store);
│ │ │ -
711 }
│ │ │ -
712 }
│ │ │ -
│ │ │ -
715 template<typename T, typename A>
│ │ │ -
│ │ │ - │ │ │ -
717 {
│ │ │ -
718 enum { value=true};
│ │ │ -
719 };
│ │ │ -
│ │ │ -
720
│ │ │ -
721 template<typename T, typename A>
│ │ │ -
│ │ │ - │ │ │ -
723 {
│ │ │ -
724 enum { value = true };
│ │ │ -
725 };
│ │ │ -
│ │ │ -
726
│ │ │ -
│ │ │ - │ │ │ -
728 template<class> struct isValidBlock : std::false_type{};
│ │ │ -
729 template<int k> struct isValidBlock<Dune::FieldVector<double,k>> : std::true_type{};
│ │ │ -
730 template<int k> struct isValidBlock<Dune::FieldVector<std::complex<double>,k>> : std::true_type{};
│ │ │ -
731 template<typename TL, typename M>
│ │ │ -
732 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ -
733 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ -
│ │ │ -
734 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
│ │ │ -
735 std::enable_if_t<isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ -
736 {
│ │ │ -
737 int verbose = config.get("verbose", 0);
│ │ │ -
738 return std::make_shared<Dune::SuperLU<M>>(mat,verbose);
│ │ │ -
739 }
│ │ │ -
│ │ │ -
740
│ │ │ -
741 // second version with SFINAE to validate the template parameters of SuperLU
│ │ │ -
742 template<typename TL, typename M>
│ │ │ -
743 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ -
744 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ -
│ │ │ -
745 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ -
746 std::enable_if_t<!isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ -
747 {
│ │ │ -
748 DUNE_THROW(UnsupportedType,
│ │ │ -
749 "Unsupported Type in SuperLU (only double and std::complex<double> supported)");
│ │ │ -
750 }
│ │ │ -
│ │ │ -
751 };
│ │ │ -
│ │ │ -
752 template<> struct SuperLUCreator::isValidBlock<double> : std::true_type{};
│ │ │ -
753 template<> struct SuperLUCreator::isValidBlock<std::complex<double>> : std::true_type{};
│ │ │ -
754
│ │ │ - │ │ │ -
756} // end namespace DUNE
│ │ │ -
757
│ │ │ -
758// undefine macros from SuperLU's slu_util.h
│ │ │ -
759#undef FIRSTCOL_OF_SNODE
│ │ │ -
760#undef NO_MARKER
│ │ │ -
761#undef NUM_TEMPV
│ │ │ -
762#undef USER_ABORT
│ │ │ -
763#undef USER_MALLOC
│ │ │ -
764#undef SUPERLU_MALLOC
│ │ │ -
765#undef USER_FREE
│ │ │ -
766#undef SUPERLU_FREE
│ │ │ -
767#undef CHECK_MALLOC
│ │ │ -
768#undef SUPERLU_MAX
│ │ │ -
769#undef SUPERLU_MIN
│ │ │ -
770#undef L_SUB_START
│ │ │ -
771#undef L_SUB
│ │ │ -
772#undef L_NZ_START
│ │ │ -
773#undef L_FST_SUPC
│ │ │ -
774#undef U_NZ_START
│ │ │ -
775#undef U_SUB
│ │ │ -
776#undef TRUE
│ │ │ -
777#undef FALSE
│ │ │ -
778#undef EMPTY
│ │ │ -
779#undef NODROP
│ │ │ -
780#undef DROP_BASIC
│ │ │ -
781#undef DROP_PROWS
│ │ │ -
782#undef DROP_COLUMN
│ │ │ -
783#undef DROP_AREA
│ │ │ -
784#undef DROP_SECONDARY
│ │ │ -
785#undef DROP_DYNAMIC
│ │ │ -
786#undef DROP_INTERP
│ │ │ -
787#undef MILU_ALPHA
│ │ │ -
788
│ │ │ -
789#endif // HAVE_SUPERLU
│ │ │ -
790#endif // DUNE_SUPERLU_HH
│ │ │ - │ │ │ - │ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ - │ │ │ - │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ -
void setSubMatrix(const Matrix &mat, const S &rowIndexSet)
Definition superlu.hh:457
│ │ │ -
void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition superlu.hh:563
│ │ │ -
void setVerbosity(bool v)
Definition superlu.hh:437
│ │ │ -
void free()
free allocated space.
Definition superlu.hh:403
│ │ │ -
~SuperLU()
Definition superlu.hh:396
│ │ │ -
SuperLU()
Empty default constructor.
Definition superlu.hh:432
│ │ │ -
void setMatrix(const Matrix &mat)
Initialize data from given matrix.
Definition superlu.hh:443
│ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ -
STL namespace.
│ │ │ +
3#ifndef DUNE_ISTL_COMMON_COUNTER_HH
│ │ │ +
4#define DUNE_ISTL_COMMON_COUNTER_HH
│ │ │ +
5
│ │ │ +
6#include <cassert>
│ │ │ +
7#include <typeinfo>
│ │ │ +
8#include <iostream>
│ │ │ +
9#include <memory>
│ │ │ +
10#include <tuple>
│ │ │ +
11#include <utility>
│ │ │ +
12
│ │ │ +
13#include <dune/common/typeutilities.hh>
│ │ │ +
14
│ │ │ +
15constexpr std::size_t maxcount = 100;
│ │ │ +
16
│ │ │ +
│ │ │ +
17#define DUNE_GET_COUNTER(Tag) \
│ │ │ +
18 (counterFunc(Dune::PriorityTag<maxcount>{}, Tag{}, Dune::CounterImpl::ADLTag{}))
│ │ │ +
│ │ │ +
19
│ │ │ +
│ │ │ +
20#define DUNE_INC_COUNTER(Tag) \
│ │ │ +
21 namespace { \
│ │ │ +
22 namespace CounterImpl { \
│ │ │ +
23 constexpr std::size_t \
│ │ │ +
24 counterFunc(Dune::PriorityTag<DUNE_GET_COUNTER(Tag)+1> p, Tag, ADLTag) \
│ │ │ +
25 { \
│ │ │ +
26 return p.value; \
│ │ │ +
27 } \
│ │ │ +
28 } \
│ │ │ +
29 } \
│ │ │ +
30 static_assert(true, "unfudge indentation")
│ │ │ +
│ │ │ +
31
│ │ │ +
32namespace Dune {
│ │ │ +
33 namespace {
│ │ │ +
34
│ │ │ +
│ │ │ +
35 namespace CounterImpl {
│ │ │ +
36
│ │ │ +
37 struct ADLTag {};
│ │ │ +
38
│ │ │ +
39 template<class Tag>
│ │ │ +
40 constexpr std::size_t counterFunc(Dune::PriorityTag<0>, Tag, ADLTag)
│ │ │ +
41 {
│ │ │ +
42 return 0;
│ │ │ +
43 }
│ │ │ +
44
│ │ │ +
45 } // end namespace CounterImpl
│ │ │ +
│ │ │ +
46 } // end empty namespace
│ │ │ +
47} // end namespace Dune
│ │ │ +
48#endif // DUNE_ISTL_COMMON_COUNTER_HH
│ │ │ +
constexpr std::size_t maxcount
Definition counter.hh:15
│ │ │
Definition allocator.hh:11
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ -
Definition overlappingschwarz.hh:694
│ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ -
size_type M() const
Return the number of columns.
Definition matrix.hh:696
│ │ │ -
size_type N() const
Return the number of rows.
Definition matrix.hh:691
│ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
int iterations
Number of iterations.
Definition solver.hh:69
│ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │ -
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
Definition solverregistry.hh:77
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ -
Definition superlu.hh:45
│ │ │ -
Definition superlu.hh:49
│ │ │ -
Definition superlu.hh:53
│ │ │ -
Definition superlu.hh:57
│ │ │ -
SuperLu Solver.
Definition superlu.hh:271
│ │ │ -
SuperLUMatrix::size_type nnz() const
Definition superlu.hh:355
│ │ │ -
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition superlu.hh:342
│ │ │ -
typename Impl::SuperLUVectorChooser< M >::range_type range_type
The type of the range of the solver.
Definition superlu.hh:284
│ │ │ -
M matrix_type
Definition superlu.hh:276
│ │ │ -
SuperMatrixInitializer< Matrix > MatrixInitializer
Type of an associated initializer class.
Definition superlu.hh:280
│ │ │ -
M Matrix
The matrix type.
Definition superlu.hh:275
│ │ │ -
typename Impl::SuperLUVectorChooser< M >::domain_type domain_type
The type of the domain of the solver.
Definition superlu.hh:282
│ │ │ -
const char * name()
Definition superlu.hh:371
│ │ │ -
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition superlu.hh:287
│ │ │ -
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
The corresponding SuperLU Matrix type.
Definition superlu.hh:278
│ │ │ -
SuperLU(const Matrix &mat, const ParameterTree &config)
Constructs the SuperLU solver.
Definition superlu.hh:320
│ │ │ -
Definition superlu.hh:727
│ │ │ -
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
Definition superlu.hh:734
│ │ │ -
Definition superlu.hh:728
│ │ │ -
Definition supermatrix.hh:132
│ │ │ -
Utility class for converting an ISTL Matrix into a SuperLU Matrix.
Definition supermatrix.hh:175
│ │ │ -
Definition supermatrix.hh:179
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,947 +1,66 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -superlu.hh │ │ │ │ + * _c_o_m_m_o_n │ │ │ │ +counter.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ -3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ -4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SUPERLU_HH │ │ │ │ -6#define DUNE_ISTL_SUPERLU_HH │ │ │ │ -7 │ │ │ │ -8#if HAVE_SUPERLU │ │ │ │ -9 │ │ │ │ -10#include "_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h" │ │ │ │ -11#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ -12#include "_s_u_p_e_r_m_a_t_r_i_x_._h_h" │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ -16#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -17#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ -18#include │ │ │ │ -19#include │ │ │ │ -20#include │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -22#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ -23 │ │ │ │ -24namespace _D_u_n_e │ │ │ │ -25{ │ │ │ │ -26 │ │ │ │ -37 template │ │ │ │ -38 class SeqOverlappingSchwarz; │ │ │ │ -39 │ │ │ │ -40 template │ │ │ │ -41 struct SeqOverlappingSchwarzAssemblerHelper; │ │ │ │ -42 │ │ │ │ -43 template │ │ │ │ -_4_4 struct _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r │ │ │ │ -45 {}; │ │ │ │ -46 │ │ │ │ -47 template │ │ │ │ -_4_8 struct _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r │ │ │ │ -49 {}; │ │ │ │ -50 │ │ │ │ -51 template │ │ │ │ -_5_2 struct _S_u_p_e_r_L_U_Q_u_e_r_y_C_h_o_o_s_e_r │ │ │ │ -53 {}; │ │ │ │ -54 │ │ │ │ -55 template │ │ │ │ -_5_6 struct _Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r │ │ │ │ -57 {}; │ │ │ │ -58 │ │ │ │ -59#if __has_include("slu_sdefs.h") │ │ │ │ -60 template<> │ │ │ │ -61 struct _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r │ │ │ │ -62 { │ │ │ │ -63 static void create(SuperMatrix *_m_a_t, int n, int m, float *dat, int n1, │ │ │ │ -64 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -65 { │ │ │ │ -66 sCreate_Dense_Matrix(_m_a_t, n, m, dat, n1, stype, dtype, mtype); │ │ │ │ -67 │ │ │ │ -68 } │ │ │ │ -69 │ │ │ │ -70 static void destroy(SuperMatrix*) │ │ │ │ -71 {} │ │ │ │ -72 │ │ │ │ -73 }; │ │ │ │ -74 template<> │ │ │ │ -75 struct SuperLUSolveChooser │ │ │ │ -76 { │ │ │ │ -77 static void solve(superlu_options_t *options, SuperMatrix *_m_a_t, int *perm_c, │ │ │ │ -int *perm_r, int *etree, │ │ │ │ -78 char *equed, float *R, float *C, SuperMatrix *L, SuperMatrix *U, │ │ │ │ -79 void *work, int lwork, SuperMatrix *B, SuperMatrix *X, │ │ │ │ -80 float *rpg, float *rcond, float *ferr, float *berr, │ │ │ │ -81 mem_usage_t *memusage, SuperLUStat_t *stat, int *info) │ │ │ │ -82 { │ │ │ │ -83 GlobalLU_t gLU; │ │ │ │ -84 sgssvx(options, _m_a_t, perm_c, perm_r, etree, equed, R, C, │ │ │ │ -85 L, U, work, lwork, B, X, rpg, rcond, ferr, berr, │ │ │ │ -86 &gLU, memusage, stat, info); │ │ │ │ -87 } │ │ │ │ -88 }; │ │ │ │ -89 │ │ │ │ -90 template<> │ │ │ │ -91 struct QuerySpaceChooser │ │ │ │ -92 { │ │ │ │ -93 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* │ │ │ │ -memusage) │ │ │ │ -94 { │ │ │ │ -95 sQuerySpace(L,U,memusage); │ │ │ │ -96 } │ │ │ │ -97 }; │ │ │ │ -98 │ │ │ │ -99#endif │ │ │ │ -100 │ │ │ │ -101#if __has_include("slu_ddefs.h") │ │ │ │ -102 │ │ │ │ -103 template<> │ │ │ │ -104 struct SuperLUDenseMatChooser │ │ │ │ -105 { │ │ │ │ -106 static void create(SuperMatrix *_m_a_t, int n, int m, double *dat, int n1, │ │ │ │ -107 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -108 { │ │ │ │ -109 dCreate_Dense_Matrix(_m_a_t, n, m, dat, n1, stype, dtype, mtype); │ │ │ │ -110 │ │ │ │ -111 } │ │ │ │ -112 │ │ │ │ -113 static void destroy(SuperMatrix * /* mat */) │ │ │ │ -114 {} │ │ │ │ -115 }; │ │ │ │ -116 template<> │ │ │ │ -117 struct SuperLUSolveChooser │ │ │ │ -118 { │ │ │ │ -119 static void solve(superlu_options_t *options, SuperMatrix *_m_a_t, int │ │ │ │ -*perm_c, int *perm_r, int *etree, │ │ │ │ -120 char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U, │ │ │ │ -121 void *work, int lwork, SuperMatrix *B, SuperMatrix *X, │ │ │ │ -122 double *rpg, double *rcond, double *ferr, double *berr, │ │ │ │ -123 mem_usage_t *memusage, SuperLUStat_t *stat, int *info) │ │ │ │ -124 { │ │ │ │ -125 GlobalLU_t gLU; │ │ │ │ -126 dgssvx(options, _m_a_t, perm_c, perm_r, etree, equed, R, C, │ │ │ │ -127 L, U, work, lwork, B, X, rpg, rcond, ferr, berr, │ │ │ │ -128 &gLU, memusage, stat, info); │ │ │ │ -129 } │ │ │ │ -130 }; │ │ │ │ -131 │ │ │ │ -132 template<> │ │ │ │ -133 struct QuerySpaceChooser │ │ │ │ -134 { │ │ │ │ -135 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* │ │ │ │ -memusage) │ │ │ │ -136 { │ │ │ │ -137 dQuerySpace(L,U,memusage); │ │ │ │ -138 } │ │ │ │ -139 }; │ │ │ │ -140#endif │ │ │ │ -141 │ │ │ │ -142#if __has_include("slu_zdefs.h") │ │ │ │ -143 template<> │ │ │ │ -144 struct SuperLUDenseMatChooser<_s_t_d::complex > │ │ │ │ -145 { │ │ │ │ -146 static void create(SuperMatrix *_m_a_t, int n, int m, std::complex │ │ │ │ -*dat, int n1, │ │ │ │ -147 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -148 { │ │ │ │ -149 zCreate_Dense_Matrix(_m_a_t, n, m, reinterpret_cast(dat), n1, │ │ │ │ -stype, dtype, mtype); │ │ │ │ -150 │ │ │ │ -151 } │ │ │ │ -152 │ │ │ │ -153 static void destroy(SuperMatrix*) │ │ │ │ -154 {} │ │ │ │ -155 }; │ │ │ │ -156 │ │ │ │ -157 template<> │ │ │ │ -158 struct SuperLUSolveChooser<_s_t_d::complex > │ │ │ │ -159 { │ │ │ │ -160 static void solve(superlu_options_t *options, SuperMatrix *_m_a_t, int │ │ │ │ -*perm_c, int *perm_r, int *etree, │ │ │ │ -161 char *equed, double *R, double *C, SuperMatrix *L, SuperMatrix *U, │ │ │ │ -162 void *work, int lwork, SuperMatrix *B, SuperMatrix *X, │ │ │ │ -163 double *rpg, double *rcond, double *ferr, double *berr, │ │ │ │ -164 mem_usage_t *memusage, SuperLUStat_t *stat, int *info) │ │ │ │ -165 { │ │ │ │ -166 GlobalLU_t gLU; │ │ │ │ -167 zgssvx(options, _m_a_t, perm_c, perm_r, etree, equed, R, C, │ │ │ │ -168 L, U, work, lwork, B, X, rpg, rcond, ferr, berr, │ │ │ │ -169 &gLU, memusage, stat, info); │ │ │ │ -170 } │ │ │ │ -171 }; │ │ │ │ -172 │ │ │ │ -173 template<> │ │ │ │ -174 struct QuerySpaceChooser<_s_t_d::complex > │ │ │ │ -175 { │ │ │ │ -176 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* │ │ │ │ -memusage) │ │ │ │ -177 { │ │ │ │ -178 zQuerySpace(L,U,memusage); │ │ │ │ -179 } │ │ │ │ -180 }; │ │ │ │ -181#endif │ │ │ │ -182 │ │ │ │ -183#if __has_include("slu_cdefs.h") │ │ │ │ -184 template<> │ │ │ │ -185 struct SuperLUDenseMatChooser<_s_t_d::complex > │ │ │ │ -186 { │ │ │ │ -187 static void create(SuperMatrix *_m_a_t, int n, int m, std::complex │ │ │ │ -*dat, int n1, │ │ │ │ -188 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -189 { │ │ │ │ -190 cCreate_Dense_Matrix(_m_a_t, n, m, reinterpret_cast(dat), n1, │ │ │ │ -stype, dtype, mtype); │ │ │ │ -191 │ │ │ │ -192 } │ │ │ │ -193 │ │ │ │ -194 static void destroy(SuperMatrix* /* mat */) │ │ │ │ -195 {} │ │ │ │ -196 }; │ │ │ │ -197 │ │ │ │ -198 template<> │ │ │ │ -199 struct SuperLUSolveChooser<_s_t_d::complex > │ │ │ │ -200 { │ │ │ │ -201 static void solve(superlu_options_t *options, SuperMatrix *_m_a_t, int │ │ │ │ -*perm_c, int *perm_r, int *etree, │ │ │ │ -202 char *equed, float *R, float *C, SuperMatrix *L, SuperMatrix *U, │ │ │ │ -203 void *work, int lwork, SuperMatrix *B, SuperMatrix *X, │ │ │ │ -204 float *rpg, float *rcond, float *ferr, float *berr, │ │ │ │ -205 mem_usage_t *memusage, SuperLUStat_t *stat, int *info) │ │ │ │ -206 { │ │ │ │ -207 GlobalLU_t gLU; │ │ │ │ -208 cgssvx(options, _m_a_t, perm_c, perm_r, etree, equed, R, C, │ │ │ │ -209 L, U, work, lwork, B, X, rpg, rcond, ferr, berr, │ │ │ │ -210 &gLU, memusage, stat, info); │ │ │ │ -211 } │ │ │ │ -212 }; │ │ │ │ -213 │ │ │ │ -214 template<> │ │ │ │ -215 struct QuerySpaceChooser<_s_t_d::complex > │ │ │ │ -216 { │ │ │ │ -217 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* │ │ │ │ -memusage) │ │ │ │ -218 { │ │ │ │ -219 cQuerySpace(L,U,memusage); │ │ │ │ -220 } │ │ │ │ -221 }; │ │ │ │ -222#endif │ │ │ │ -223 │ │ │ │ -224 namespace Impl │ │ │ │ -225 { │ │ │ │ -226 template │ │ │ │ -227 struct SuperLUVectorChooser │ │ │ │ -228 {}; │ │ │ │ -229 │ │ │ │ -230 template │ │ │ │ -231 struct SuperLUVectorChooser,A > > │ │ │ │ -232 { │ │ │ │ -234 using domain_type = BlockVector< │ │ │ │ -235 FieldVector, │ │ │ │ -236 typename std::allocator_traits::template rebind_alloc > │ │ │ │ ->; │ │ │ │ -238 using range_type = BlockVector< │ │ │ │ -239 FieldVector, │ │ │ │ -240 typename std::allocator_traits::template rebind_alloc > │ │ │ │ ->; │ │ │ │ -241 }; │ │ │ │ -242 │ │ │ │ -243 template │ │ │ │ -244 struct SuperLUVectorChooser > │ │ │ │ -245 { │ │ │ │ -247 using domain_type = BlockVector; │ │ │ │ -249 using range_type = BlockVector; │ │ │ │ -250 }; │ │ │ │ -251 } │ │ │ │ -252 │ │ │ │ -266 template │ │ │ │ -_2_6_7 class _S_u_p_e_r_L_U │ │ │ │ -268 : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< │ │ │ │ -269 typename Impl::SuperLUVectorChooser::domain_type, │ │ │ │ -270 typename Impl::SuperLUVectorChooser::range_type > │ │ │ │ -271 { │ │ │ │ -272 using T = typename M::field_type; │ │ │ │ -273 public: │ │ │ │ -_2_7_5 using _M_a_t_r_i_x = M; │ │ │ │ -_2_7_6 using _m_a_t_r_i_x___t_y_p_e = M; │ │ │ │ -_2_7_8 typedef _D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x_<_M_a_t_r_i_x_> _S_u_p_e_r_L_U_M_a_t_r_i_x; │ │ │ │ -_2_8_0 typedef _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r_<_M_a_t_r_i_x_> _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ -_2_8_2 using _d_o_m_a_i_n___t_y_p_e = typename Impl::SuperLUVectorChooser::domain_type; │ │ │ │ -_2_8_4 using _r_a_n_g_e___t_y_p_e = typename Impl::SuperLUVectorChooser::range_type; │ │ │ │ -285 │ │ │ │ -_2_8_7 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -288 { │ │ │ │ -289 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -290 } │ │ │ │ -291 │ │ │ │ -306 explicit _S_u_p_e_r_L_U(const _M_a_t_r_i_x& mat, bool verbose=false, │ │ │ │ -307 bool reusevector=true); │ │ │ │ -308 │ │ │ │ -309 │ │ │ │ -_3_2_0 _S_u_p_e_r_L_U(const _M_a_t_r_i_x& mat, const ParameterTree& config) │ │ │ │ -321 : _S_u_p_e_r_L_U(_m_a_t, config._g_e_t("verbose", false), config._g_e_t │ │ │ │ -("reuseVector", true)) │ │ │ │ -322 {} │ │ │ │ -323 │ │ │ │ -330 _S_u_p_e_r_L_U(); │ │ │ │ -331 │ │ │ │ -332 _~_S_u_p_e_r_L_U(); │ │ │ │ -333 │ │ │ │ -337 void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res); │ │ │ │ -338 │ │ │ │ -_3_4_2 void _a_p_p_l_y (_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, [[maybe_unused]] double │ │ │ │ -reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -343 { │ │ │ │ -344 _a_p_p_l_y(x,b,res); │ │ │ │ -345 } │ │ │ │ -346 │ │ │ │ -350 void _a_p_p_l_y(T* x, T* b); │ │ │ │ -351 │ │ │ │ -353 void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& mat); │ │ │ │ -354 │ │ │ │ -_3_5_5 typename SuperLUMatrix::size_type _n_n_z() const │ │ │ │ -356 { │ │ │ │ -357 return mat.nonzeroes(); │ │ │ │ -358 } │ │ │ │ -359 │ │ │ │ -360 template │ │ │ │ -361 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& mat, const S& rowIndexSet); │ │ │ │ -362 │ │ │ │ -363 void _s_e_t_V_e_r_b_o_s_i_t_y(bool v); │ │ │ │ -364 │ │ │ │ -369 void _f_r_e_e(); │ │ │ │ -370 │ │ │ │ -_3_7_1 const char* _n_a_m_e() { return "SuperLU"; } │ │ │ │ -372 private: │ │ │ │ -373 template │ │ │ │ -_3_7_4 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -375 friend struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r<_S_u_p_e_r_L_U<_M_a_t_r_i_x>,true>; │ │ │ │ -376 │ │ │ │ -377 _S_u_p_e_r_L_U_M_a_t_r_i_x& getInternalMatrix() { return _m_a_t; } │ │ │ │ -378 │ │ │ │ -380 void decompose(); │ │ │ │ -381 │ │ │ │ -382 _S_u_p_e_r_L_U_M_a_t_r_i_x _m_a_t; │ │ │ │ -383 SuperMatrix L, U, B, X; │ │ │ │ -384 int *perm_c, *perm_r, *etree; │ │ │ │ -385 typename _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e *R, *C; │ │ │ │ -386 T *bstore; │ │ │ │ -387 superlu_options_t options; │ │ │ │ -388 char equed; │ │ │ │ -389 void *work; │ │ │ │ -390 int lwork; │ │ │ │ -391 bool first, verbose, reusevector; │ │ │ │ -392 }; │ │ │ │ -393 │ │ │ │ -394 template │ │ │ │ -395 SuperLU │ │ │ │ -_3_9_6 ::~SuperLU() │ │ │ │ -397 { │ │ │ │ -398 if(_m_a_t._N()+_m_a_t._M()>0) │ │ │ │ -399 free(); │ │ │ │ -400 } │ │ │ │ -401 │ │ │ │ -402 template │ │ │ │ -_4_0_3 void _S_u_p_e_r_L_U_<_M_>_:_:_f_r_e_e() │ │ │ │ -404 { │ │ │ │ -405 delete[] perm_c; │ │ │ │ -406 delete[] perm_r; │ │ │ │ -407 delete[] etree; │ │ │ │ -408 delete[] R; │ │ │ │ -409 delete[] C; │ │ │ │ -410 if(lwork>=0) { │ │ │ │ -411 Destroy_SuperNode_Matrix(&L); │ │ │ │ -412 Destroy_CompCol_Matrix(&U); │ │ │ │ -413 } │ │ │ │ -414 lwork=0; │ │ │ │ -415 if(!first && reusevector) { │ │ │ │ -416 SUPERLU_FREE(B.Store); │ │ │ │ -417 SUPERLU_FREE(X.Store); │ │ │ │ -418 } │ │ │ │ -419 _m_a_t.free(); │ │ │ │ -420 } │ │ │ │ -421 │ │ │ │ -422 template │ │ │ │ -423 _S_u_p_e_r_L_U_<_M_> │ │ │ │ -_4_2_4_ _:_:_S_u_p_e_r_L_U(const _M_a_t_r_i_x& mat_, bool verbose_, bool reusevector_) │ │ │ │ -425 : work(0), lwork(0), first(true), verbose(verbose_), │ │ │ │ -426 reusevector(reusevector_) │ │ │ │ -427 { │ │ │ │ -428 _s_e_t_M_a_t_r_i_x(mat_); │ │ │ │ -429 │ │ │ │ -430 } │ │ │ │ -431 template │ │ │ │ -_4_3_2 _S_u_p_e_r_L_U_<_M_>_:_:_S_u_p_e_r_L_U() │ │ │ │ -433 : work(0), lwork(0),verbose(false), │ │ │ │ -434 reusevector(false) │ │ │ │ -435 {} │ │ │ │ -436 template │ │ │ │ -_4_3_7 void _S_u_p_e_r_L_U_<_M_>_:_:_s_e_t_V_e_r_b_o_s_i_t_y(bool v) │ │ │ │ -438 { │ │ │ │ -439 verbose=v; │ │ │ │ -440 } │ │ │ │ -441 │ │ │ │ -442 template │ │ │ │ -_4_4_3 void _S_u_p_e_r_L_U_<_M_>_:_:_s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& mat_) │ │ │ │ -444 { │ │ │ │ -445 if(_m_a_t._N()+_m_a_t._M()>0) { │ │ │ │ -446 free(); │ │ │ │ -447 } │ │ │ │ -448 lwork=0; │ │ │ │ -449 work=0; │ │ │ │ -450 //a=&mat_; │ │ │ │ -451 _m_a_t=mat_; │ │ │ │ -452 decompose(); │ │ │ │ -453 } │ │ │ │ -454 │ │ │ │ -455 template │ │ │ │ -456 template │ │ │ │ -_4_5_7 void _S_u_p_e_r_L_U_<_M_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& mat_, │ │ │ │ -458 const S& mrs) │ │ │ │ -459 { │ │ │ │ -460 if(_m_a_t._N()+_m_a_t._M()>0) { │ │ │ │ -461 free(); │ │ │ │ -462 } │ │ │ │ -463 lwork=0; │ │ │ │ -464 work=0; │ │ │ │ -465 //a=&mat_; │ │ │ │ -466 _m_a_t.setMatrix(mat_,mrs); │ │ │ │ -467 decompose(); │ │ │ │ -468 } │ │ │ │ -469 │ │ │ │ -470 template │ │ │ │ -471 void _S_u_p_e_r_L_U_<_M_>_:_:_d_e_c_o_m_p_o_s_e() │ │ │ │ -472 { │ │ │ │ -473 │ │ │ │ -474 first = true; │ │ │ │ -475 perm_c = new int[_m_a_t._M()]; │ │ │ │ -476 perm_r = new int[_m_a_t._N()]; │ │ │ │ -477 etree = new int[_m_a_t._M()]; │ │ │ │ -478 R = new typename _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e[_m_a_t._N()]; │ │ │ │ -479 C = new typename _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e[_m_a_t._M()]; │ │ │ │ -480 │ │ │ │ -481 set_default_options(&options); │ │ │ │ -482 // Do the factorization │ │ │ │ -483 B.ncol=0; │ │ │ │ -484 B.Stype=SLU_DN; │ │ │ │ -485 B.Dtype=_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e; │ │ │ │ -486 B.Mtype= SLU_GE; │ │ │ │ -487 DNformat fakeFormat; │ │ │ │ -488 fakeFormat.lda=_m_a_t._N(); │ │ │ │ -489 B.Store=&fakeFormat; │ │ │ │ -490 X.Stype=SLU_DN; │ │ │ │ -491 X.Dtype=_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e; │ │ │ │ -492 X.Mtype= SLU_GE; │ │ │ │ -493 X.ncol=0; │ │ │ │ -494 X.Store=&fakeFormat; │ │ │ │ -495 │ │ │ │ -496 typename _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e rpg, rcond, ferr=1e10, berr=1e10; │ │ │ │ -497 int info; │ │ │ │ -498 mem_usage_t memusage; │ │ │ │ -499 SuperLUStat_t stat; │ │ │ │ -500 │ │ │ │ -501 StatInit(&stat); │ │ │ │ -502 _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r_<_T_>_:_:_s_o_l_v_e(&options, &static_cast(_m_a_t), │ │ │ │ -perm_c, perm_r, etree, &equed, R, C, │ │ │ │ -503 &L, &U, work, lwork, &B, &X, &rpg, &rcond, &ferr, │ │ │ │ -504 &berr, &memusage, &stat, &info); │ │ │ │ -505 │ │ │ │ -506 if(verbose) { │ │ │ │ -507 dinfo<<"LU factorization: dgssvx() returns info "<< info<(_m_a_t).ncol; │ │ │ │ -510 │ │ │ │ -511 if ( info == 0 || info == nSuperLUCol+1 ) { │ │ │ │ -512 │ │ │ │ -513 if ( options.PivotGrowth ) │ │ │ │ -514 dinfo<<"Recip. pivot growth = "< 0 && lwork == -1 ) { // Memory allocation failed │ │ │ │ -528 dinfo<<"** Estimated memory: "<< info - nSuperLUCol<colptr[i]; c < Ustore->colptr[i+1]; ++c) │ │ │ │ -540 //if(Ustore->rowind[c]==i) │ │ │ │ -541 std::cout<rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" "; │ │ │ │ -542 if(k==0){ │ │ │ │ -543 // │ │ │ │ -544 k=-1; │ │ │ │ -545 }std::cout<colptr[i]; c < Ustore->colptr[i+1]; ++c) │ │ │ │ -551 //if(Ustore->rowind[c]==i) │ │ │ │ -552 std::cout<rowind[c]<<"->"<<((double*)Ustore->nzval)[c]<<" "; │ │ │ │ -553 if(k==0){ │ │ │ │ -554 // │ │ │ │ -555 k=-1; │ │ │ │ -556 }std::cout< │ │ │ │ -562 void SuperLU │ │ │ │ -_5_6_3 ::apply(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -564 { │ │ │ │ -565 if (_m_a_t._N() != b.dim()) │ │ │ │ -566 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Size of right-hand-side vector b does not match the │ │ │ │ -number of matrix rows!"); │ │ │ │ -567 if (_m_a_t._M() != x.dim()) │ │ │ │ -568 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Size of solution vector x does not match the number │ │ │ │ -of matrix columns!"); │ │ │ │ -569 if (_m_a_t._M()+_m_a_t._N()==0) │ │ │ │ -570 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Matrix of SuperLU is null!"); │ │ │ │ -571 │ │ │ │ -572 SuperMatrix* mB = &B; │ │ │ │ -573 SuperMatrix* mX = &X; │ │ │ │ -574 SuperMatrix rB, rX; │ │ │ │ -575 if (reusevector) { │ │ │ │ -576 if(first) { │ │ │ │ -577 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&B, (int)_m_a_t._N(), 1, reinterpret_cast │ │ │ │ -(&b[0]), (int)_m_a_t._N(), SLU_DN, _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, SLU_GE); │ │ │ │ -578 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&X, (int)_m_a_t._N(), 1, reinterpret_cast │ │ │ │ -(&x[0]), (int)_m_a_t._N(), SLU_DN, _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, SLU_GE); │ │ │ │ -579 first=false; │ │ │ │ -580 }else{ │ │ │ │ -581 ((DNformat*)B.Store)->nzval=&b[0]; │ │ │ │ -582 ((DNformat*)X.Store)->nzval=&x[0]; │ │ │ │ -583 } │ │ │ │ -584 } else { │ │ │ │ -585 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&rB, (int)_m_a_t._N(), 1, │ │ │ │ -reinterpret_cast(&b[0]), (int)_m_a_t._N(), SLU_DN, _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, │ │ │ │ -SLU_GE); │ │ │ │ -586 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&rX, (int)_m_a_t._N(), 1, │ │ │ │ -reinterpret_cast(&x[0]), (int)_m_a_t._N(), SLU_DN, _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, │ │ │ │ -SLU_GE); │ │ │ │ -587 mB = &rB; │ │ │ │ -588 mX = &rX; │ │ │ │ -589 } │ │ │ │ -590 typename _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e rpg, rcond, ferr=1e10, berr; │ │ │ │ -591 int info; │ │ │ │ -592 mem_usage_t memusage; │ │ │ │ -593 SuperLUStat_t stat; │ │ │ │ -594 /* Initialize the statistics variables. */ │ │ │ │ -595 StatInit(&stat); │ │ │ │ -596 /* │ │ │ │ -597 range_type d=b; │ │ │ │ -598 a->usmv(-1, x, d); │ │ │ │ -599 │ │ │ │ -600 double def0=d.two_norm(); │ │ │ │ -601 */ │ │ │ │ -602 options.IterRefine=SLU_DOUBLE; │ │ │ │ -603 │ │ │ │ -604 _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r_<_T_>_:_:_s_o_l_v_e(&options, &static_cast(_m_a_t), │ │ │ │ -perm_c, perm_r, etree, &equed, R, C, │ │ │ │ -605 &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr, │ │ │ │ -606 &memusage, &stat, &info); │ │ │ │ -607 │ │ │ │ -608 res._i_t_e_r_a_t_i_o_n_s=1; │ │ │ │ -609 │ │ │ │ -610 /* │ │ │ │ -611 if(options.Equil==YES) │ │ │ │ -612 // undo scaling of right hand side │ │ │ │ -613 std::transform(reinterpret_cast(&b[0]),reinterpret_cast(&b │ │ │ │ -[0])+mat.M(), │ │ │ │ -614 C, reinterpret_cast(&d[0]), std::divides()); │ │ │ │ -615 else │ │ │ │ -616 d=b; │ │ │ │ -617 a->usmv(-1, x, d); │ │ │ │ -618 res.reduction=d.two_norm()/def0; │ │ │ │ -619 res.conv_rate = res.reduction; │ │ │ │ -620 res.converged=(res.reduction<1e-10||d.two_norm()<1e-18); │ │ │ │ -621 */ │ │ │ │ -622 res._c_o_n_v_e_r_g_e_d=true; │ │ │ │ -623 │ │ │ │ -624 if(verbose) { │ │ │ │ -625 │ │ │ │ -626 dinfo<<"Triangular solve: dgssvx() returns info "<< info<(_m_a_t).ncol; │ │ │ │ -629 │ │ │ │ -630 if ( info == 0 || info == nSuperLUCol+1 ) { │ │ │ │ -631 │ │ │ │ -632 if ( options.IterRefine ) { │ │ │ │ -633 std::cout<<"Iterative Refinement: steps=" │ │ │ │ -634 < │ │ │ │ -651 void _S_u_p_e_r_L_U_<_M_> │ │ │ │ -_6_5_2_ _:_:_a_p_p_l_y(T* x, T* b) │ │ │ │ -653 { │ │ │ │ -654 if(_m_a_t._N()+_m_a_t._M()==0) │ │ │ │ -655 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Matrix of SuperLU is null!"); │ │ │ │ -656 │ │ │ │ -657 SuperMatrix* mB = &B; │ │ │ │ -658 SuperMatrix* mX = &X; │ │ │ │ -659 SuperMatrix rB, rX; │ │ │ │ -660 if (reusevector) { │ │ │ │ -661 if(first) { │ │ │ │ -662 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&B, _m_a_t._N(), 1, b, _m_a_t._N(), SLU_DN, │ │ │ │ -_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, SLU_GE); │ │ │ │ -663 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&X, _m_a_t._N(), 1, x, _m_a_t._N(), SLU_DN, │ │ │ │ -_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, SLU_GE); │ │ │ │ -664 first=false; │ │ │ │ -665 }else{ │ │ │ │ -666 ((DNformat*) B.Store)->nzval=b; │ │ │ │ -667 ((DNformat*)X.Store)->nzval=x; │ │ │ │ -668 } │ │ │ │ -669 } else { │ │ │ │ -670 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&rB, _m_a_t._N(), 1, b, _m_a_t._N(), SLU_DN, │ │ │ │ -_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, SLU_GE); │ │ │ │ -671 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r_<_T_>_:_:_c_r_e_a_t_e(&rX, _m_a_t._N(), 1, x, _m_a_t._N(), SLU_DN, │ │ │ │ -_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_t_y_p_e, SLU_GE); │ │ │ │ -672 mB = &rB; │ │ │ │ -673 mX = &rX; │ │ │ │ -674 } │ │ │ │ -675 │ │ │ │ -676 typename _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e rpg, rcond, ferr=1e10, berr; │ │ │ │ -677 int info; │ │ │ │ -678 mem_usage_t memusage; │ │ │ │ -679 SuperLUStat_t stat; │ │ │ │ -680 /* Initialize the statistics variables. */ │ │ │ │ -681 StatInit(&stat); │ │ │ │ -682 │ │ │ │ -683 options.IterRefine=SLU_DOUBLE; │ │ │ │ -684 │ │ │ │ -685 _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r_<_T_>_:_:_s_o_l_v_e(&options, &static_cast(_m_a_t), │ │ │ │ -perm_c, perm_r, etree, &equed, R, C, │ │ │ │ -686 &L, &U, work, lwork, mB, mX, &rpg, &rcond, &ferr, &berr, │ │ │ │ -687 &memusage, &stat, &info); │ │ │ │ -688 │ │ │ │ -689 if(verbose) { │ │ │ │ -690 dinfo<<"Triangular solve: dgssvx() returns info "<< info<(_m_a_t).ncol; │ │ │ │ -693 │ │ │ │ -694 if ( info == 0 || info == nSuperLUCol+1 ) { // Factorization has succeeded │ │ │ │ -695 │ │ │ │ -696 if ( options.IterRefine ) { │ │ │ │ -697 dinfo<<"Iterative Refinement: steps=" │ │ │ │ -698 < │ │ │ │ -_7_1_6 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_S_u_p_e_r_L_U<_B_C_R_S_M_a_t_r_i_x > > │ │ │ │ -717 { │ │ │ │ -_7_1_8 enum { _v_a_l_u_e=true}; │ │ │ │ -719 }; │ │ │ │ -720 │ │ │ │ -721 template │ │ │ │ -_7_2_2 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d<_S_u_p_e_r_L_U<_B_C_R_S_M_a_t_r_i_x > > │ │ │ │ -723 { │ │ │ │ -_7_2_4 enum { _v_a_l_u_e = true }; │ │ │ │ -725 }; │ │ │ │ -726 │ │ │ │ -_7_2_7 struct _S_u_p_e_r_L_U_C_r_e_a_t_o_r { │ │ │ │ -_7_2_8 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std::false_type{}; │ │ │ │ -_7_2_9 template struct _i_s_V_a_l_i_d_B_l_o_c_k<_D_u_n_e::FieldVector> : std:: │ │ │ │ -true_type{}; │ │ │ │ -_7_3_0 template struct _i_s_V_a_l_i_d_B_l_o_c_k<_D_u_n_e::FieldVector,k>> : std::true_type{}; │ │ │ │ -731 template │ │ │ │ -732 std::shared_ptr::type, │ │ │ │ -733 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ -_7_3_4 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& config, │ │ │ │ -735 std::enable_if_t<_i_s_V_a_l_i_d_B_l_o_c_k::type:: │ │ │ │ -block_type>::value,int> = 0) const │ │ │ │ -736 { │ │ │ │ -737 int verbose = config.get("verbose", 0); │ │ │ │ -738 return std::make_shared>(_m_a_t,verbose); │ │ │ │ -739 } │ │ │ │ -740 │ │ │ │ -741 // second version with SFINAE to validate the template parameters of │ │ │ │ -SuperLU │ │ │ │ -742 template │ │ │ │ -743 std::shared_ptr::type, │ │ │ │ -744 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ -_7_4_5 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ -*config*/, │ │ │ │ -746 std::enable_if_t:: │ │ │ │ -type::block_type>::value,int> = 0) const │ │ │ │ -747 { │ │ │ │ -748 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ -749 "Unsupported Type in SuperLU (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -750 } │ │ │ │ -751 }; │ │ │ │ -_7_5_2 template<> struct _S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k : std::true_type{}; │ │ │ │ -_7_5_3 template<> struct _S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k<_s_t_d::complex> : │ │ │ │ -std::true_type{}; │ │ │ │ -754 │ │ │ │ -_7_5_5 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("superlu", _S_u_p_e_r_L_U_C_r_e_a_t_o_r()); │ │ │ │ -756} // end namespace DUNE │ │ │ │ -757 │ │ │ │ -758// undefine macros from SuperLU's slu_util.h │ │ │ │ -759#undef FIRSTCOL_OF_SNODE │ │ │ │ -760#undef NO_MARKER │ │ │ │ -761#undef NUM_TEMPV │ │ │ │ -762#undef USER_ABORT │ │ │ │ -763#undef USER_MALLOC │ │ │ │ -764#undef SUPERLU_MALLOC │ │ │ │ -765#undef USER_FREE │ │ │ │ -766#undef SUPERLU_FREE │ │ │ │ -767#undef CHECK_MALLOC │ │ │ │ -768#undef SUPERLU_MAX │ │ │ │ -769#undef SUPERLU_MIN │ │ │ │ -770#undef L_SUB_START │ │ │ │ -771#undef L_SUB │ │ │ │ -772#undef L_NZ_START │ │ │ │ -773#undef L_FST_SUPC │ │ │ │ -774#undef U_NZ_START │ │ │ │ -775#undef U_SUB │ │ │ │ -776#undef TRUE │ │ │ │ -777#undef FALSE │ │ │ │ -778#undef EMPTY │ │ │ │ -779#undef NODROP │ │ │ │ -780#undef DROP_BASIC │ │ │ │ -781#undef DROP_PROWS │ │ │ │ -782#undef DROP_COLUMN │ │ │ │ -783#undef DROP_AREA │ │ │ │ -784#undef DROP_SECONDARY │ │ │ │ -785#undef DROP_DYNAMIC │ │ │ │ -786#undef DROP_INTERP │ │ │ │ -787#undef MILU_ALPHA │ │ │ │ -788 │ │ │ │ -789#endif // HAVE_SUPERLU │ │ │ │ -790#endif // DUNE_SUPERLU_HH │ │ │ │ -_s_u_p_e_r_m_a_t_r_i_x_._h_h │ │ │ │ -_s_u_p_e_r_l_u_f_u_n_c_t_i_o_n_s_._h_h │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ -_s_o_l_v_e_r_s_._h_h │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ -_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ -void setSubMatrix(const Matrix &mat, const S &rowIndexSet) │ │ │ │ -DDeeffiinniittiioonn superlu.hh:457 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &x, range_type &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:563 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_s_e_t_V_e_r_b_o_s_i_t_y │ │ │ │ -void setVerbosity(bool v) │ │ │ │ -DDeeffiinniittiioonn superlu.hh:437 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_f_r_e_e │ │ │ │ -void free() │ │ │ │ -free allocated space. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:403 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_~_S_u_p_e_r_L_U │ │ │ │ -~SuperLU() │ │ │ │ -DDeeffiinniittiioonn superlu.hh:396 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_S_u_p_e_r_L_U │ │ │ │ -SuperLU() │ │ │ │ -Empty default constructor. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:432 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -void setMatrix(const Matrix &mat) │ │ │ │ -Initialize data from given matrix. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:443 │ │ │ │ -_m_a_t │ │ │ │ -Matrix & mat │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +3#ifndef DUNE_ISTL_COMMON_COUNTER_HH │ │ │ │ +4#define DUNE_ISTL_COMMON_COUNTER_HH │ │ │ │ +5 │ │ │ │ +6#include │ │ │ │ +7#include │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12 │ │ │ │ +13#include │ │ │ │ +14 │ │ │ │ +_1_5constexpr std::size_t _m_a_x_c_o_u_n_t = 100; │ │ │ │ +16 │ │ │ │ +_1_7#define DUNE_GET_COUNTER(Tag) \ │ │ │ │ +18 (counterFunc(Dune::PriorityTag{}, Tag{}, Dune::CounterImpl::ADLTag │ │ │ │ +{})) │ │ │ │ +19 │ │ │ │ +_2_0#define DUNE_INC_COUNTER(Tag) \ │ │ │ │ +21 namespace { \ │ │ │ │ +22 namespace CounterImpl { \ │ │ │ │ +23 constexpr std::size_t \ │ │ │ │ +24 counterFunc(Dune::PriorityTag p, Tag, ADLTag) \ │ │ │ │ +25 { \ │ │ │ │ +26 return p.value; \ │ │ │ │ +27 } \ │ │ │ │ +28 } \ │ │ │ │ +29 } \ │ │ │ │ +30 static_assert(true, "unfudge indentation") │ │ │ │ +31 │ │ │ │ +32namespace _D_u_n_e { │ │ │ │ +33 namespace { │ │ │ │ +34 │ │ │ │ +_3_5 namespace CounterImpl { │ │ │ │ +36 │ │ │ │ +37 struct ADLTag {}; │ │ │ │ +38 │ │ │ │ +39 template │ │ │ │ +40 constexpr std::size_t counterFunc(Dune::PriorityTag<0>, Tag, ADLTag) │ │ │ │ +41 { │ │ │ │ +42 return 0; │ │ │ │ +43 } │ │ │ │ +44 │ │ │ │ +45 } // end namespace CounterImpl │ │ │ │ +46 } // end empty namespace │ │ │ │ +47} // end namespace Dune │ │ │ │ +48#endif // DUNE_ISTL_COMMON_COUNTER_HH │ │ │ │ +_m_a_x_c_o_u_n_t │ │ │ │ +constexpr std::size_t maxcount │ │ │ │ +DDeeffiinniittiioonn counter.hh:15 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ -derive error class from the base class in common │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -Sequential overlapping Schwarz preconditioner. │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ -size_type M() const │ │ │ │ -Return the number of columns. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:696 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ -size_type N() const │ │ │ │ -Return the number of rows. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:691 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -Statistics about the application of an inverse operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ -int iterations │ │ │ │ -Number of iterations. │ │ │ │ -DDeeffiinniittiioonn solver.hh:69 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ -bool converged │ │ │ │ -True if convergence criterion has been met. │ │ │ │ -DDeeffiinniittiioonn solver.hh:75 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -Abstract base class for all solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:101 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -Whether this is a direct solver. │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -whether the solver internally uses column compressed storage │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn superlu.hh:45 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn superlu.hh:49 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_Q_u_e_r_y_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn superlu.hh:53 │ │ │ │ -_D_u_n_e_:_:_Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn superlu.hh:57 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U │ │ │ │ -SuperLu Solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:271 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_n_n_z │ │ │ │ -SuperLUMatrix::size_type nnz() const │ │ │ │ -DDeeffiinniittiioonn superlu.hh:355 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ -InverseOperatorResult &res) │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:342 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -typename Impl::SuperLUVectorChooser< M >::range_type range_type │ │ │ │ -The type of the range of the solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:284 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -DDeeffiinniittiioonn superlu.hh:276 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -SuperMatrixInitializer< Matrix > MatrixInitializer │ │ │ │ -Type of an associated initializer class. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:280 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_M_a_t_r_i_x │ │ │ │ -M Matrix │ │ │ │ -The matrix type. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:275 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -typename Impl::SuperLUVectorChooser< M >::domain_type domain_type │ │ │ │ -The type of the domain of the solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:282 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_n_a_m_e │ │ │ │ -const char * name() │ │ │ │ -DDeeffiinniittiioonn superlu.hh:371 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn superlu.hh:287 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -Dune::SuperLUMatrix< Matrix > SuperLUMatrix │ │ │ │ -The corresponding SuperLU Matrix type. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:278 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_S_u_p_e_r_L_U │ │ │ │ -SuperLU(const Matrix &mat, const ParameterTree &config) │ │ │ │ -Constructs the SuperLU solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:320 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r │ │ │ │ -DDeeffiinniittiioonn superlu.hh:727 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL │ │ │ │ ->::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const │ │ │ │ -M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< │ │ │ │ -typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) │ │ │ │ -const │ │ │ │ -DDeeffiinniittiioonn superlu.hh:734 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ -DDeeffiinniittiioonn superlu.hh:728 │ │ │ │ -_D_u_n_e_:_:_G_e_t_S_u_p_e_r_L_U_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:132 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_M_a_t_r_i_x │ │ │ │ -Utility class for converting an ISTL Matrix into a SuperLU Matrix. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:175 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:179 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: vbvector.hh File Reference │ │ │ +dune-istl: istlexception.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,52 +72,45 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
vbvector.hh File Reference
│ │ │ +
istlexception.hh File Reference
│ │ │
│ │ │
│ │ │ - │ │ │ -

??? │ │ │ -More...

│ │ │ -
#include <cmath>
│ │ │ -#include <complex>
│ │ │ -#include <iostream>
│ │ │ -#include <iterator>
│ │ │ -#include <memory>
│ │ │ -#include <dune/common/ftraits.hh>
│ │ │ -#include <dune/common/indexediterator.hh>
│ │ │ -#include <dune/common/iteratorfacades.hh>
│ │ │ -#include "istlexception.hh"
│ │ │ -#include "bvector.hh"
│ │ │ -#include <dune/istl/blocklevel.hh>
│ │ │ +
#include <dune/common/exceptions.hh>
│ │ │ +#include <dune/common/fmatrix.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::VariableBlockVector< B, A >
 A Vector of blocks with different blocksizes. More...
class  Dune::ISTLError
 derive error class from the base class in common More...
 
class  Dune::BCRSMatrixError
 Error specific to BCRSMatrix. More...
 
class  Dune::ImplicitModeCompressionBufferExhausted
 Thrown when the compression buffer used by the implicit BCRSMatrix construction is exhausted. More...
 
class  Dune::VariableBlockVector< B, A >::CreateIterator
 Iterator class for sequential creation of blocks. More...
class  Dune::SolverAbort
 Thrown when a solver aborts due to some problem. More...
 
struct  Dune::FieldTraits< VariableBlockVector< B, A > >
class  Dune::MatrixBlockError
 Error when performing an operation on a matrix block. More...
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
 
│ │ │ -

Detailed Description

│ │ │ -

???

│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,37 +1,33 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -vbvector.hh File Reference │ │ │ │ -??? _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ -#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ +istlexception.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ - class   _D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _> │ │ │ │ -  A Vector of blocks with different blocksizes. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ +  derive error class from the base class in common _M_o_r_e_._._. │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ -  Iterator class for sequential creation of blocks. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ +  Error specific to _B_C_R_S_M_a_t_r_i_x. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _> │ │ │ │ +class   _D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_o_d_e_C_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_E_x_h_a_u_s_t_e_d │ │ │ │ +  Thrown when the compression buffer used by the implicit _B_C_R_S_M_a_t_r_i_x │ │ │ │ + construction is exhausted. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_S_o_l_v_e_r_A_b_o_r_t │ │ │ │ +  Thrown when a solver aborts due to some problem. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r │ │ │ │ +  Error when performing an operation on a matrix block. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -??? │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: vbvector.hh Source File │ │ │ +dune-istl: istlexception.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,607 +74,65 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
vbvector.hh
│ │ │ +
istlexception.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_VBVECTOR_HH
│ │ │ -
6#define DUNE_ISTL_VBVECTOR_HH
│ │ │ +
5#ifndef DUNE_ISTL_ISTLEXCEPTION_HH
│ │ │ +
6#define DUNE_ISTL_ISTLEXCEPTION_HH
│ │ │
7
│ │ │ -
8#include <cmath>
│ │ │ -
9#include <complex>
│ │ │ -
10#include <iostream>
│ │ │ -
11#include <iterator>
│ │ │ -
12#include <memory>
│ │ │ -
13
│ │ │ -
14#include <dune/common/ftraits.hh>
│ │ │ -
15#include <dune/common/indexediterator.hh>
│ │ │ -
16#include <dune/common/iteratorfacades.hh>
│ │ │ -
17#include "istlexception.hh"
│ │ │ -
18#include "bvector.hh"
│ │ │ -
19
│ │ │ - │ │ │ -
21
│ │ │ -
26namespace Dune {
│ │ │ -
27
│ │ │ -
43 template<class B, class A=std::allocator<B> >
│ │ │ -
│ │ │ -
44 class VariableBlockVector : public Imp::block_vector_unmanaged<B,typename A::size_type>
│ │ │ -
45 // this derivation gives us all the blas level 1 and norms
│ │ │ -
46 // on the large array. However, access operators have to be
│ │ │ -
47 // overwritten.
│ │ │ -
48 {
│ │ │ -
49 using Base = Imp::block_vector_unmanaged<B,typename A::size_type>;
│ │ │ -
50
│ │ │ -
51 // just a shorthand
│ │ │ -
52 using window_type = Imp::BlockVectorWindow<B,A>;
│ │ │ -
53
│ │ │ -
54 // data-structure holding the windows (but not the actual data)
│ │ │ -
55 using VectorWindows = std::vector<window_type, typename std::allocator_traits<A>::template rebind_alloc<window_type>>;
│ │ │ -
56
│ │ │ -
57 // block type bool is not supported since std::vector<bool> is used for storage
│ │ │ -
58 static_assert(not std::is_same_v<B,bool>, "Block type 'bool' not supported by VariableBlockVector.");
│ │ │ -
59
│ │ │ -
60 public:
│ │ │ -
61
│ │ │ -
62 //===== type definitions and constants
│ │ │ -
63
│ │ │ -
65 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ -
66
│ │ │ -
68 using allocator_type = A;
│ │ │ -
69
│ │ │ -
74 using reference = window_type&;
│ │ │ -
75
│ │ │ -
80 using const_reference = const window_type&;
│ │ │ -
81
│ │ │ -
83 using size_type = typename A::size_type;
│ │ │ -
84
│ │ │ - │ │ │ -
91
│ │ │ - │ │ │ -
95
│ │ │ -
96 //===== constructors and such
│ │ │ -
97
│ │ │ -
│ │ │ - │ │ │ -
103 Base()
│ │ │ -
104 {}
│ │ │ -
│ │ │ -
105
│ │ │ -
│ │ │ -
112 explicit VariableBlockVector (size_type numBlocks) :
│ │ │ -
113 Base(),
│ │ │ -
114 block(numBlocks)
│ │ │ -
115 {}
│ │ │ -
│ │ │ -
116
│ │ │ -
│ │ │ -
125 VariableBlockVector (size_type numBlocks, size_type blockSize) :
│ │ │ -
126 Base(),
│ │ │ -
127 block(numBlocks),
│ │ │ -
128 storage_(numBlocks*blockSize)
│ │ │ -
129 {
│ │ │ -
130 // and we can allocate the big array in the base class
│ │ │ -
131 syncBaseArray();
│ │ │ -
132
│ │ │ -
133 // set the windows into the big array
│ │ │ -
134 for (size_type i=0; i<numBlocks; ++i)
│ │ │ -
135 block[i].set(blockSize,this->p+(i*blockSize));
│ │ │ -
136
│ │ │ -
137 // and the vector is usable
│ │ │ -
138 initialized = true;
│ │ │ -
139 }
│ │ │ -
│ │ │ -
140
│ │ │ -
│ │ │ - │ │ │ -
143 Base(static_cast<const Base&>(a)),
│ │ │ -
144 block(a.block),
│ │ │ -
145 storage_(a.storage_)
│ │ │ -
146 {
│ │ │ -
147 syncBaseArray();
│ │ │ -
148
│ │ │ -
149 // and we must set the windows
│ │ │ -
150 if (block.size()>0) {
│ │ │ -
151 block[0].set(block[0].getsize(),this->p); // first block
│ │ │ -
152 for (size_type i=1; i<block.size(); ++i) // and the rest
│ │ │ -
153 block[i].set(block[i].getsize(),block[i-1].getptr()+block[i-1].getsize());
│ │ │ -
154 }
│ │ │ -
155
│ │ │ -
156 // and we have a usable vector
│ │ │ -
157 initialized = a.initialized;
│ │ │ -
158 }
│ │ │ -
│ │ │ -
159
│ │ │ -
│ │ │ - │ │ │ -
162 Base()
│ │ │ -
163 {
│ │ │ -
164 tmp.swap(*this);
│ │ │ -
165 }
│ │ │ -
│ │ │ -
166
│ │ │ - │ │ │ -
168
│ │ │ -
169
│ │ │ -
│ │ │ - │ │ │ -
172 {
│ │ │ -
173 tmp.swap(*this);
│ │ │ -
174 return *this;
│ │ │ -
175 }
│ │ │ -
│ │ │ -
176
│ │ │ -
│ │ │ -
178 void swap (VariableBlockVector& other) noexcept
│ │ │ -
179 {
│ │ │ -
180 using std::swap;
│ │ │ -
181 swap(storage_, other.storage_);
│ │ │ -
182 swap(block, other.block);
│ │ │ -
183 swap(initialized, other.initialized);
│ │ │ -
184
│ │ │ -
185 other.syncBaseArray();
│ │ │ -
186 syncBaseArray();
│ │ │ -
187 }
│ │ │ -
│ │ │ -
188
│ │ │ -
│ │ │ -
190 friend void swap (VariableBlockVector& lhs, VariableBlockVector& rhs) noexcept
│ │ │ -
191 {
│ │ │ -
192 lhs.swap(rhs);
│ │ │ -
193 }
│ │ │ -
│ │ │ -
194
│ │ │ -
│ │ │ -
196 void resize (size_type numBlocks)
│ │ │ -
197 {
│ │ │ -
198 storage_.clear();
│ │ │ -
199
│ │ │ -
200 syncBaseArray();
│ │ │ -
201
│ │ │ -
202 // we can allocate the windows now
│ │ │ -
203 block.resize(numBlocks);
│ │ │ -
204
│ │ │ -
205 // and the vector not fully usable
│ │ │ -
206 initialized = false;
│ │ │ -
207 }
│ │ │ -
│ │ │ -
208
│ │ │ -
│ │ │ -
210 void resize (size_type numBlocks, size_type blockSize)
│ │ │ -
211 {
│ │ │ -
212 // and we can allocate the big array in the base class
│ │ │ -
213 storage_.resize(numBlocks*blockSize);
│ │ │ -
214 block.resize(numBlocks);
│ │ │ -
215 syncBaseArray();
│ │ │ -
216
│ │ │ -
217 // set the windows into the big array
│ │ │ -
218 for (size_type i=0; i<block.size(); ++i)
│ │ │ -
219 block[i].set(blockSize,this->p+(i*blockSize));
│ │ │ -
220
│ │ │ -
221 // and the vector is usable
│ │ │ -
222 initialized = true;
│ │ │ -
223 }
│ │ │ -
│ │ │ -
224
│ │ │ -
225 //===== assignment from scalar
│ │ │ -
226
│ │ │ -
│ │ │ - │ │ │ -
229 {
│ │ │ -
230 (static_cast<Imp::block_vector_unmanaged<B,size_type>&>(*this)) = k;
│ │ │ -
231 return *this;
│ │ │ -
232 }
│ │ │ -
│ │ │ -
233
│ │ │ -
234
│ │ │ -
235 //===== the creation interface
│ │ │ -
236
│ │ │ -
237 class CreateIterator;
│ │ │ -
238
│ │ │ -
239#ifndef DOXYGEN
│ │ │ -
240
│ │ │ -
241 // The window_type does not hand out a reference to its size,
│ │ │ -
242 // so in order to provide a valid iterator, we need a workaround
│ │ │ -
243 // to make assignment possible. This proxy enables just that by
│ │ │ -
244 // implicitly converting to the stored size for read access and
│ │ │ -
245 // tunneling assignment to the accessor method of the window.
│ │ │ -
246 struct SizeProxy
│ │ │ -
247 {
│ │ │ -
248
│ │ │ -
249 operator size_type () const
│ │ │ -
250 {
│ │ │ -
251 return target->getsize();
│ │ │ -
252 }
│ │ │ -
253
│ │ │ -
254 SizeProxy& operator= (size_type size)
│ │ │ -
255 {
│ │ │ -
256 target->setsize(size);
│ │ │ -
257 return *this;
│ │ │ -
258 }
│ │ │ -
259
│ │ │ -
260 private:
│ │ │ -
261
│ │ │ -
262 friend class CreateIterator;
│ │ │ -
263
│ │ │ -
264 SizeProxy (window_type& t) :
│ │ │ -
265 target(&t)
│ │ │ -
266 {}
│ │ │ -
267
│ │ │ -
268 window_type* target;
│ │ │ -
269 };
│ │ │ -
270
│ │ │ -
271#endif // DOXYGEN
│ │ │ -
272
│ │ │ -
│ │ │ - │ │ │ -
275 {
│ │ │ -
276 public:
│ │ │ -
278 using iterator_category = std::output_iterator_tag;
│ │ │ -
279
│ │ │ - │ │ │ -
282
│ │ │ -
289 using difference_type = void;
│ │ │ -
290
│ │ │ - │ │ │ -
293
│ │ │ -
295 using reference = SizeProxy;
│ │ │ -
296
│ │ │ -
│ │ │ -
298 CreateIterator (VariableBlockVector& _v, int _i, bool _isEnd) :
│ │ │ -
299 v(_v),
│ │ │ -
300 i(_i),
│ │ │ -
301 isEnd(_isEnd)
│ │ │ -
302 {}
│ │ │ -
│ │ │ -
303
│ │ │ -
│ │ │ - │ │ │ -
305 {
│ │ │ -
306 // When the iterator gets destructed, we allocate the memory
│ │ │ -
307 // for the VariableBlockVector if
│ │ │ -
308 // 1. the current iterator was not created as enditerator
│ │ │ -
309 // 2. we're at the last block
│ │ │ -
310 // 3. the vector hasn't been initialized earlier
│ │ │ -
311 if (not isEnd && i==v.block.size() && not v.initialized)
│ │ │ -
312 v.allocate();
│ │ │ -
313 }
│ │ │ -
│ │ │ -
314
│ │ │ -
│ │ │ - │ │ │ -
317 {
│ │ │ -
318 // go to next block
│ │ │ -
319 ++i;
│ │ │ -
320
│ │ │ -
321 return *this;
│ │ │ -
322 }
│ │ │ -
│ │ │ -
323
│ │ │ -
│ │ │ - │ │ │ -
326 {
│ │ │ -
327 CreateIterator tmp(*this);
│ │ │ -
328 this->operator++();
│ │ │ -
329 return tmp;
│ │ │ -
330 }
│ │ │ -
│ │ │ -
331
│ │ │ -
│ │ │ -
333 bool operator!= (const CreateIterator& it) const
│ │ │ -
334 {
│ │ │ -
335 return (i!=it.i) || (&v!=&it.v);
│ │ │ -
336 }
│ │ │ -
│ │ │ -
337
│ │ │ -
│ │ │ -
339 bool operator== (const CreateIterator& it) const
│ │ │ -
340 {
│ │ │ -
341 return (i==it.i) && (&v==&it.v);
│ │ │ -
342 }
│ │ │ -
│ │ │ -
343
│ │ │ -
│ │ │ - │ │ │ -
346 {
│ │ │ -
347 return i;
│ │ │ -
348 }
│ │ │ -
│ │ │ -
349
│ │ │ -
│ │ │ - │ │ │ -
352 {
│ │ │ -
353 v.block[i].setsize(_k);
│ │ │ -
354 }
│ │ │ -
│ │ │ -
355
│ │ │ -
357#ifdef DOXYGEN
│ │ │ -
358 size_type&
│ │ │ -
359#else
│ │ │ -
360 SizeProxy
│ │ │ -
361#endif
│ │ │ -
│ │ │ - │ │ │ -
363 {
│ │ │ -
364 return {v.block[i]};
│ │ │ -
365 }
│ │ │ -
│ │ │ -
366
│ │ │ -
367 private:
│ │ │ -
368 VariableBlockVector& v; // my vector
│ │ │ -
369 size_type i; // current block to be defined
│ │ │ -
370 const bool isEnd; // flag if this object was created as the end iterator.
│ │ │ -
371 };
│ │ │ +
8#include <dune/common/exceptions.hh>
│ │ │ +
9#include <dune/common/fmatrix.hh>
│ │ │ +
10
│ │ │ +
11namespace Dune {
│ │ │ +
12
│ │ │ +
19 class ISTLError : public Dune::MathError {};
│ │ │ +
20
│ │ │ +
│ │ │ + │ │ │ +
23 : public ISTLError
│ │ │ +
24 {};
│ │ │ +
│ │ │ +
25
│ │ │ +
│ │ │ + │ │ │ +
36 : public BCRSMatrixError
│ │ │ +
37 {};
│ │ │ +
│ │ │ +
38
│ │ │ +
40
│ │ │ +
46 class SolverAbort : public ISTLError {};
│ │ │ +
47
│ │ │ +
49
│ │ │ +
│ │ │ +
52 class MatrixBlockError : public virtual Dune::FMatrixError {
│ │ │ +
53 public:
│ │ │ +
54 int r, c; // row and column index of the entry from which the error resulted
│ │ │ +
55 };
│ │ │
│ │ │ -
372
│ │ │ -
373 // CreateIterator wants to set all the arrays ...
│ │ │ -
374 friend class CreateIterator;
│ │ │ -
375
│ │ │ -
│ │ │ - │ │ │ -
378 {
│ │ │ -
379#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
380 if (initialized) DUNE_THROW(ISTLError,"no CreateIterator in initialized state");
│ │ │ -
381#endif
│ │ │ -
382 return CreateIterator(*this, 0, false);
│ │ │ -
383 }
│ │ │ -
│ │ │ -
384
│ │ │ -
│ │ │ - │ │ │ -
387 {
│ │ │ -
388 return CreateIterator(*this, block.size(), true);
│ │ │ -
389 }
│ │ │ -
│ │ │ -
390
│ │ │ -
391
│ │ │ -
392 //===== access to components
│ │ │ -
393 // has to be overwritten from base class because it must
│ │ │ -
394 // return access to the windows
│ │ │ -
395
│ │ │ -
│ │ │ -
397 window_type& operator[] (size_type i)
│ │ │ -
398 {
│ │ │ -
399#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
400 if (i>=block.size()) DUNE_THROW(ISTLError,"index out of range");
│ │ │ -
401#endif
│ │ │ -
402 return block[i];
│ │ │ -
403 }
│ │ │ -
│ │ │ -
404
│ │ │ -
│ │ │ -
406 const window_type& operator[] (size_type i) const
│ │ │ -
407 {
│ │ │ -
408#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
409 if (i<0 || i>=block.size()) DUNE_THROW(ISTLError,"index out of range");
│ │ │ -
410#endif
│ │ │ -
411 return block[i];
│ │ │ -
412 }
│ │ │ -
│ │ │ -
413
│ │ │ -
414 using Iterator = IndexedIterator<typename VectorWindows::iterator>;
│ │ │ -
415
│ │ │ -
│ │ │ - │ │ │ -
418 {
│ │ │ -
419 return Iterator{block.begin()};
│ │ │ -
420 }
│ │ │ -
│ │ │ -
421
│ │ │ -
│ │ │ - │ │ │ -
424 {
│ │ │ -
425 return Iterator{block.end()};
│ │ │ -
426 }
│ │ │ -
│ │ │ -
427
│ │ │ -
│ │ │ - │ │ │ -
431 {
│ │ │ -
432 return Iterator{--block.end()};
│ │ │ -
433 }
│ │ │ -
│ │ │ -
434
│ │ │ -
│ │ │ - │ │ │ -
438 {
│ │ │ -
439 return Iterator{--block.begin()};
│ │ │ -
440 }
│ │ │ -
│ │ │ -
441
│ │ │ - │ │ │ -
444
│ │ │ -
446 using ConstIterator = IndexedIterator<typename VectorWindows::const_iterator>;
│ │ │ -
447
│ │ │ - │ │ │ -
450
│ │ │ -
│ │ │ - │ │ │ -
453 {
│ │ │ -
454 return ConstIterator{block.begin()};
│ │ │ -
455 }
│ │ │ -
│ │ │ -
456
│ │ │ -
│ │ │ - │ │ │ -
459 {
│ │ │ -
460 return ConstIterator{block.end()};
│ │ │ -
461 }
│ │ │ -
│ │ │ -
462
│ │ │ -
│ │ │ - │ │ │ -
466 {
│ │ │ -
467 return ConstIterator{--block.end()};
│ │ │ -
468 }
│ │ │ -
│ │ │ -
469
│ │ │ -
│ │ │ - │ │ │ -
473 {
│ │ │ -
474 return ConstIterator{--block.begin()};
│ │ │ -
475 }
│ │ │ -
│ │ │ -
476
│ │ │ -
│ │ │ - │ │ │ -
479 {
│ │ │ -
480 return ConstIterator{block.rend()};
│ │ │ -
481 }
│ │ │ -
│ │ │ -
482
│ │ │ -
│ │ │ - │ │ │ -
485 {
│ │ │ -
486 Iterator tmp = block.begin();
│ │ │ -
487 tmp+=std::min(i, block.size());
│ │ │ -
488 return tmp;
│ │ │ -
489 }
│ │ │ -
│ │ │ -
490
│ │ │ -
│ │ │ - │ │ │ -
493 {
│ │ │ -
494 ConstIterator tmp = block.begin();
│ │ │ -
495 tmp+=std::min(i, block.size());
│ │ │ -
496 return tmp;
│ │ │ -
497 }
│ │ │ -
│ │ │ -
498
│ │ │ -
499 //===== sizes
│ │ │ -
500
│ │ │ -
│ │ │ -
502 size_type N () const noexcept
│ │ │ -
503 {
│ │ │ -
504 return block.size();
│ │ │ -
505 }
│ │ │ -
│ │ │ -
506
│ │ │ -
│ │ │ -
511 size_type size () const noexcept
│ │ │ -
512 {
│ │ │ -
513 return block.size();
│ │ │ -
514 }
│ │ │ -
│ │ │ -
515
│ │ │ -
516
│ │ │ -
517 private:
│ │ │ -
518
│ │ │ -
519 void allocate ()
│ │ │ -
520 {
│ │ │ -
521 if (this->initialized)
│ │ │ -
522 DUNE_THROW(ISTLError, "Attempt to re-allocate already initialized VariableBlockVector");
│ │ │ -
523
│ │ │ -
524 // calculate space needed:
│ │ │ -
525 size_type storageNeeded = 0;
│ │ │ -
526 for(size_type i = 0; i < block.size(); i++)
│ │ │ -
527 storageNeeded += block[i].size();
│ │ │ -
528
│ │ │ -
529 storage_.resize(storageNeeded);
│ │ │ -
530 syncBaseArray();
│ │ │ -
531
│ │ │ -
532 // and we set the window pointers
│ │ │ -
533 block[0].setptr(this->p); // pointer to first block
│ │ │ -
534 for (size_type j=1; j<block.size(); ++j) // and the rest
│ │ │ -
535 block[j].setptr(block[j-1].getptr()+block[j-1].getsize());
│ │ │ -
536
│ │ │ -
537 // and the vector is ready
│ │ │ -
538 this->initialized = true;
│ │ │ -
539 }
│ │ │ -
540
│ │ │ -
541 void syncBaseArray () noexcept
│ │ │ -
542 {
│ │ │ -
543 this->p = storage_.data();
│ │ │ -
544 this->n = storage_.size();
│ │ │ -
545 }
│ │ │ -
546
│ │ │ -
547 VectorWindows block = {}; // vector of blocks pointing to the array in the base class
│ │ │ -
548 std::vector<B, A> storage_ = {};
│ │ │ -
549 bool initialized = false; // true if vector has been initialized
│ │ │ -
550 };
│ │ │ -
│ │ │ -
551
│ │ │ -
555 template<class B, class A>
│ │ │ -
│ │ │ -
556 struct FieldTraits< VariableBlockVector<B, A> >
│ │ │ -
557 {
│ │ │ -
558 typedef typename FieldTraits<B>::field_type field_type;
│ │ │ -
559 typedef typename FieldTraits<B>::real_type real_type;
│ │ │ -
560 };
│ │ │ -
│ │ │ -
568} // end namespace
│ │ │ -
569
│ │ │ -
570#endif
│ │ │ - │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ -
Helper functions for determining the vector/matrix block level.
│ │ │ +
56
│ │ │ +
59} // end namespace
│ │ │ +
60
│ │ │ +
61#endif
│ │ │
Definition allocator.hh:11
│ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
A Vector of blocks with different blocksizes.
Definition vbvector.hh:48
│ │ │ -
VariableBlockVector(size_type numBlocks, size_type blockSize)
Construct a vector with given number of blocks each having a constant size.
Definition vbvector.hh:125
│ │ │ -
VariableBlockVector()
Constructor without arguments makes an empty vector.
Definition vbvector.hh:102
│ │ │ -
friend void swap(VariableBlockVector &lhs, VariableBlockVector &rhs) noexcept
Free function to swap the storage and internal state of lhs with rhs.
Definition vbvector.hh:190
│ │ │ -
Iterator iterator
Export the iterator type using std naming rules.
Definition vbvector.hh:443
│ │ │ -
VariableBlockVector & operator=(VariableBlockVector tmp)
Copy and move assignment.
Definition vbvector.hh:171
│ │ │ -
VariableBlockVector(size_type numBlocks)
Construct a vector with given number of blocks, but size of each block is not yet known.
Definition vbvector.hh:112
│ │ │ -
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition vbvector.hh:65
│ │ │ -
typename A::size_type size_type
The size type for the index access.
Definition vbvector.hh:83
│ │ │ -
size_type N() const noexcept
number of blocks in the vector (are of variable size here)
Definition vbvector.hh:502
│ │ │ -
VariableBlockVector(const VariableBlockVector &a)
Copy constructor, has copy semantics.
Definition vbvector.hh:142
│ │ │ -
window_type & operator[](size_type i)
random access to blocks
Definition vbvector.hh:397
│ │ │ -
A allocator_type
export the allocator type
Definition vbvector.hh:68
│ │ │ -
CreateIterator createend()
get create iterator pointing to one after the last block
Definition vbvector.hh:386
│ │ │ -
VariableBlockVector(VariableBlockVector &&tmp)
Move constructor:
Definition vbvector.hh:161
│ │ │ -
CreateIterator createbegin()
get initial create iterator
Definition vbvector.hh:377
│ │ │ -
ConstIterator const_iterator
Export the const iterator type using std naming rules.
Definition vbvector.hh:449
│ │ │ -
window_type & reference
Export type used for references to container entries.
Definition vbvector.hh:74
│ │ │ -
ConstIterator rend() const
end ConstIterator
Definition vbvector.hh:478
│ │ │ -
const window_type & const_reference
Export type used for const references to container entries.
Definition vbvector.hh:80
│ │ │ -
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition vbvector.hh:492
│ │ │ -
ConstIterator beforeEnd() const
Definition vbvector.hh:465
│ │ │ -
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition vbvector.hh:484
│ │ │ -
IndexedIterator< typename VectorWindows::const_iterator > ConstIterator
Const iterator.
Definition vbvector.hh:446
│ │ │ - │ │ │ -
ConstIterator beforeBegin() const
Definition vbvector.hh:472
│ │ │ -
void resize(size_type numBlocks)
same effect as constructor with same argument
Definition vbvector.hh:196
│ │ │ -
Iterator end()
end Iterator
Definition vbvector.hh:423
│ │ │ -
void swap(VariableBlockVector &other) noexcept
Exchange the storage and internal state with other.
Definition vbvector.hh:178
│ │ │ -
ConstIterator begin() const
begin ConstIterator
Definition vbvector.hh:452
│ │ │ -
size_type size() const noexcept
Definition vbvector.hh:511
│ │ │ -
void resize(size_type numBlocks, size_type blockSize)
same effect as constructor with same argument
Definition vbvector.hh:210
│ │ │ -
IndexedIterator< typename VectorWindows::iterator > Iterator
Definition vbvector.hh:414
│ │ │ -
ConstIterator end() const
end ConstIterator
Definition vbvector.hh:458
│ │ │ -
Iterator beforeBegin()
Definition vbvector.hh:437
│ │ │ -
Iterator beforeEnd()
Definition vbvector.hh:430
│ │ │ -
Iterator begin()
begin Iterator
Definition vbvector.hh:417
│ │ │ -
Iterator class for sequential creation of blocks.
Definition vbvector.hh:275
│ │ │ -
bool operator==(const CreateIterator &it) const
equality
Definition vbvector.hh:339
│ │ │ -
size_type index() const
dereferencing
Definition vbvector.hh:345
│ │ │ -
SizeProxy reference
reference type
Definition vbvector.hh:295
│ │ │ -
size_type * pointer
pointer type
Definition vbvector.hh:292
│ │ │ -
bool operator!=(const CreateIterator &it) const
inequality
Definition vbvector.hh:333
│ │ │ -
~CreateIterator()
Definition vbvector.hh:304
│ │ │ -
size_type value_type
value type
Definition vbvector.hh:281
│ │ │ -
CreateIterator(VariableBlockVector &_v, int _i, bool _isEnd)
constructor
Definition vbvector.hh:298
│ │ │ -
void setblocksize(size_type _k)
set size of current block
Definition vbvector.hh:351
│ │ │ -
size_type & operator*()
Access size of current block.
Definition vbvector.hh:362
│ │ │ -
std::output_iterator_tag iterator_category
iterator category
Definition vbvector.hh:278
│ │ │ -
CreateIterator & operator++()
prefix increment
Definition vbvector.hh:316
│ │ │ -
void difference_type
difference type (unused)
Definition vbvector.hh:289
│ │ │ -
FieldTraits< B >::real_type real_type
Definition vbvector.hh:559
│ │ │ -
FieldTraits< B >::field_type field_type
Definition vbvector.hh:558
│ │ │ +
Error specific to BCRSMatrix.
Definition istlexception.hh:24
│ │ │ +
Thrown when the compression buffer used by the implicit BCRSMatrix construction is exhausted.
Definition istlexception.hh:37
│ │ │ +
Thrown when a solver aborts due to some problem.
Definition istlexception.hh:46
│ │ │ +
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │ +
int c
Definition istlexception.hh:54
│ │ │ +
int r
Definition istlexception.hh:54
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,685 +1,69 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -vbvector.hh │ │ │ │ +istlexception.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_VBVECTOR_HH │ │ │ │ -6#define DUNE_ISTL_VBVECTOR_HH │ │ │ │ +5#ifndef DUNE_ISTL_ISTLEXCEPTION_HH │ │ │ │ +6#define DUNE_ISTL_ISTLEXCEPTION_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13 │ │ │ │ -14#include │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ -18#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -19 │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ -21 │ │ │ │ -26namespace _D_u_n_e { │ │ │ │ -27 │ │ │ │ -43 template > │ │ │ │ -_4_4 class _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r : public Imp::block_vector_unmanaged │ │ │ │ -45 // this derivation gives us all the blas level 1 and norms │ │ │ │ -46 // on the large array. However, access operators have to be │ │ │ │ -47 // overwritten. │ │ │ │ -48 { │ │ │ │ -49 using Base = Imp::block_vector_unmanaged; │ │ │ │ -50 │ │ │ │ -51 // just a shorthand │ │ │ │ -52 using window_type = Imp::BlockVectorWindow; │ │ │ │ -53 │ │ │ │ -54 // data-structure holding the windows (but not the actual data) │ │ │ │ -55 using VectorWindows = std::vector::template rebind_alloc>; │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10 │ │ │ │ +11namespace _D_u_n_e { │ │ │ │ +12 │ │ │ │ +_1_9 class _I_S_T_L_E_r_r_o_r : public Dune::MathError {}; │ │ │ │ +20 │ │ │ │ +_2_2 class _B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ +23 : public _I_S_T_L_E_r_r_o_r │ │ │ │ +24 {}; │ │ │ │ +25 │ │ │ │ +_3_5 class _I_m_p_l_i_c_i_t_M_o_d_e_C_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_E_x_h_a_u_s_t_e_d │ │ │ │ +36 : public _B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ +37 {}; │ │ │ │ +38 │ │ │ │ +40 │ │ │ │ +_4_6 class _S_o_l_v_e_r_A_b_o_r_t : public _I_S_T_L_E_r_r_o_r {}; │ │ │ │ +47 │ │ │ │ +49 │ │ │ │ +_5_2 class _M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r : public virtual Dune::FMatrixError { │ │ │ │ +53 public: │ │ │ │ +_5_4 int _r, _c; // row and column index of the entry from which the error resulted │ │ │ │ +55 }; │ │ │ │ 56 │ │ │ │ -57 // block type bool is not supported since std::vector is used for │ │ │ │ -storage │ │ │ │ -58 static_assert(not std::is_same_v, "Block type 'bool' not supported │ │ │ │ -by VariableBlockVector."); │ │ │ │ -59 │ │ │ │ -60 public: │ │ │ │ -61 │ │ │ │ -62 //===== type definitions and constants │ │ │ │ -63 │ │ │ │ -_6_5 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ -66 │ │ │ │ -_6_8 using _a_l_l_o_c_a_t_o_r___t_y_p_e = A; │ │ │ │ -69 │ │ │ │ -_7_4 using _r_e_f_e_r_e_n_c_e = window_type&; │ │ │ │ -75 │ │ │ │ -_8_0 using _c_o_n_s_t___r_e_f_e_r_e_n_c_e = const window_type&; │ │ │ │ -81 │ │ │ │ -_8_3 using _s_i_z_e___t_y_p_e = typename A::size_type; │ │ │ │ -84 │ │ │ │ -_9_0 using _v_a_l_u_e___t_y_p_e = _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_>; │ │ │ │ -91 │ │ │ │ -_9_4 using _b_l_o_c_k___t_y_p_e = _B_l_o_c_k_V_e_c_t_o_r_<_B_,_A_>; │ │ │ │ -95 │ │ │ │ -96 //===== constructors and such │ │ │ │ -97 │ │ │ │ -_1_0_2 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r () : │ │ │ │ -103 Base() │ │ │ │ -104 {} │ │ │ │ -105 │ │ │ │ -_1_1_2 explicit _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e numBlocks) : │ │ │ │ -113 Base(), │ │ │ │ -114 block(numBlocks) │ │ │ │ -115 {} │ │ │ │ -116 │ │ │ │ -_1_2_5 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e numBlocks, _s_i_z_e___t_y_p_e blockSize) : │ │ │ │ -126 Base(), │ │ │ │ -127 block(numBlocks), │ │ │ │ -128 storage_(numBlocks*blockSize) │ │ │ │ -129 { │ │ │ │ -130 // and we can allocate the big array in the base class │ │ │ │ -131 syncBaseArray(); │ │ │ │ -132 │ │ │ │ -133 // set the windows into the big array │ │ │ │ -134 for (_s_i_z_e___t_y_p_e i=0; ip+(i*blockSize)); │ │ │ │ -136 │ │ │ │ -137 // and the vector is usable │ │ │ │ -138 initialized = true; │ │ │ │ -139 } │ │ │ │ -140 │ │ │ │ -_1_4_2 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r (const _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& a) : │ │ │ │ -143 Base(static_cast(a)), │ │ │ │ -144 block(a.block), │ │ │ │ -145 storage_(a.storage_) │ │ │ │ -146 { │ │ │ │ -147 syncBaseArray(); │ │ │ │ -148 │ │ │ │ -149 // and we must set the windows │ │ │ │ -150 if (block.size()>0) { │ │ │ │ -151 block[0].set(block[0].getsize(),this->p); // first block │ │ │ │ -152 for (_s_i_z_e___t_y_p_e i=1; ip+(i*blockSize)); │ │ │ │ -220 │ │ │ │ -221 // and the vector is usable │ │ │ │ -222 initialized = true; │ │ │ │ -223 } │ │ │ │ -224 │ │ │ │ -225 //===== assignment from scalar │ │ │ │ -226 │ │ │ │ -_2_2_8 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ -229 { │ │ │ │ -230 (static_cast&>(*this)) = k; │ │ │ │ -231 return *this; │ │ │ │ -232 } │ │ │ │ -233 │ │ │ │ -234 │ │ │ │ -235 //===== the creation interface │ │ │ │ -236 │ │ │ │ -237 class CreateIterator; │ │ │ │ -238 │ │ │ │ -239#ifndef DOXYGEN │ │ │ │ -240 │ │ │ │ -241 // The window_type does not hand out a reference to its size, │ │ │ │ -242 // so in order to provide a valid iterator, we need a workaround │ │ │ │ -243 // to make assignment possible. This proxy enables just that by │ │ │ │ -244 // implicitly converting to the stored size for read access and │ │ │ │ -245 // tunneling assignment to the accessor method of the window. │ │ │ │ -246 struct SizeProxy │ │ │ │ -247 { │ │ │ │ -248 │ │ │ │ -249 operator size_type () const │ │ │ │ -250 { │ │ │ │ -251 return target->getsize(); │ │ │ │ -252 } │ │ │ │ -253 │ │ │ │ -254 SizeProxy& operator= (size_type size) │ │ │ │ -255 { │ │ │ │ -256 target->setsize(size); │ │ │ │ -257 return *this; │ │ │ │ -258 } │ │ │ │ -259 │ │ │ │ -260 private: │ │ │ │ -261 │ │ │ │ -262 friend class CreateIterator; │ │ │ │ -263 │ │ │ │ -264 SizeProxy (window_type& t) : │ │ │ │ -265 target(&t) │ │ │ │ -266 {} │ │ │ │ -267 │ │ │ │ -268 window_type* target; │ │ │ │ -269 }; │ │ │ │ -270 │ │ │ │ -271#endif // DOXYGEN │ │ │ │ -272 │ │ │ │ -_2_7_4 class _C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ -275 { │ │ │ │ -276 public: │ │ │ │ -_2_7_8 using _i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y = std::output_iterator_tag; │ │ │ │ -279 │ │ │ │ -_2_8_1 using _v_a_l_u_e___t_y_p_e = _s_i_z_e___t_y_p_e; │ │ │ │ -282 │ │ │ │ -_2_8_9 using _d_i_f_f_e_r_e_n_c_e___t_y_p_e = void; │ │ │ │ -290 │ │ │ │ -_2_9_2 using _p_o_i_n_t_e_r = _s_i_z_e___t_y_p_e*; │ │ │ │ -293 │ │ │ │ -_2_9_5 using _r_e_f_e_r_e_n_c_e = SizeProxy; │ │ │ │ -296 │ │ │ │ -_2_9_8 _C_r_e_a_t_e_I_t_e_r_a_t_o_r (_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& _v, int _i, bool _isEnd) : │ │ │ │ -299 v(_v), │ │ │ │ -300 i(_i), │ │ │ │ -301 isEnd(_isEnd) │ │ │ │ -302 {} │ │ │ │ -303 │ │ │ │ -_3_0_4 _~_C_r_e_a_t_e_I_t_e_r_a_t_o_r () │ │ │ │ -305 { │ │ │ │ -306 // When the iterator gets destructed, we allocate the memory │ │ │ │ -307 // for the VariableBlockVector if │ │ │ │ -308 // 1. the current iterator was not created as enditerator │ │ │ │ -309 // 2. we're at the last block │ │ │ │ -310 // 3. the vector hasn't been initialized earlier │ │ │ │ -311 if (not isEnd && i==v.block.size() && not v.initialized) │ │ │ │ -312 v.allocate(); │ │ │ │ -313 } │ │ │ │ -314 │ │ │ │ -_3_1_6 _C_r_e_a_t_e_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_+_+() │ │ │ │ -317 { │ │ │ │ -318 // go to next block │ │ │ │ -319 ++i; │ │ │ │ -320 │ │ │ │ -321 return *this; │ │ │ │ -322 } │ │ │ │ -323 │ │ │ │ -_3_2_5 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _o_p_e_r_a_t_o_r_+_+_ (int) │ │ │ │ -326 { │ │ │ │ -327 _C_r_e_a_t_e_I_t_e_r_a_t_o_r tmp(*this); │ │ │ │ -328 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ -329 return tmp; │ │ │ │ -330 } │ │ │ │ -331 │ │ │ │ -_3_3_3 bool _o_p_e_r_a_t_o_r_!_=_ (const _C_r_e_a_t_e_I_t_e_r_a_t_o_r& it) const │ │ │ │ -334 { │ │ │ │ -335 return (i!=it.i) || (&v!=&it.v); │ │ │ │ -336 } │ │ │ │ -337 │ │ │ │ -_3_3_9 bool _o_p_e_r_a_t_o_r_=_=_ (const _C_r_e_a_t_e_I_t_e_r_a_t_o_r& it) const │ │ │ │ -340 { │ │ │ │ -341 return (i==it.i) && (&v==&it.v); │ │ │ │ -342 } │ │ │ │ -343 │ │ │ │ -_3_4_5 _s_i_z_e___t_y_p_e _i_n_d_e_x () const │ │ │ │ -346 { │ │ │ │ -347 return i; │ │ │ │ -348 } │ │ │ │ -349 │ │ │ │ -_3_5_1 void _s_e_t_b_l_o_c_k_s_i_z_e (_s_i_z_e___t_y_p_e _k) │ │ │ │ -352 { │ │ │ │ -353 v.block[i].setsize(_k); │ │ │ │ -354 } │ │ │ │ -355 │ │ │ │ -357#ifdef DOXYGEN │ │ │ │ -358 _s_i_z_e___t_y_p_e& │ │ │ │ -359#else │ │ │ │ -360 SizeProxy │ │ │ │ -361#endif │ │ │ │ -_3_6_2 _o_p_e_r_a_t_o_r_*() │ │ │ │ -363 { │ │ │ │ -364 return {v.block[i]}; │ │ │ │ -365 } │ │ │ │ -366 │ │ │ │ -367 private: │ │ │ │ -368 _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& v; // my vector │ │ │ │ -369 _s_i_z_e___t_y_p_e i; // current block to be defined │ │ │ │ -370 const bool isEnd; // flag if this object was created as the end iterator. │ │ │ │ -371 }; │ │ │ │ -372 │ │ │ │ -373 // CreateIterator wants to set all the arrays ... │ │ │ │ -_3_7_4 friend class _C_r_e_a_t_e_I_t_e_r_a_t_o_r; │ │ │ │ -375 │ │ │ │ -_3_7_7 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _c_r_e_a_t_e_b_e_g_i_n () │ │ │ │ -378 { │ │ │ │ -379#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -380 if (initialized) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"no CreateIterator in initialized │ │ │ │ -state"); │ │ │ │ -381#endif │ │ │ │ -382 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this, 0, false); │ │ │ │ -383 } │ │ │ │ -384 │ │ │ │ -_3_8_6 _C_r_e_a_t_e_I_t_e_r_a_t_o_r _c_r_e_a_t_e_e_n_d () │ │ │ │ -387 { │ │ │ │ -388 return _C_r_e_a_t_e_I_t_e_r_a_t_o_r(*this, block.size(), true); │ │ │ │ -389 } │ │ │ │ -390 │ │ │ │ -391 │ │ │ │ -392 //===== access to components │ │ │ │ -393 // has to be overwritten from base class because it must │ │ │ │ -394 // return access to the windows │ │ │ │ -395 │ │ │ │ -_3_9_7 window_type& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) │ │ │ │ -398 { │ │ │ │ -399#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -400 if (i>=block.size()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ -401#endif │ │ │ │ -402 return block[i]; │ │ │ │ -403 } │ │ │ │ -404 │ │ │ │ -_4_0_6 const window_type& _o_p_e_r_a_t_o_r_[_]_ (_s_i_z_e___t_y_p_e i) const │ │ │ │ -407 { │ │ │ │ -408#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -409 if (i<0 || i>=block.size()) DUNE_THROW(_I_S_T_L_E_r_r_o_r,"index out of range"); │ │ │ │ -410#endif │ │ │ │ -411 return block[i]; │ │ │ │ -412 } │ │ │ │ -413 │ │ │ │ -_4_1_4 using _I_t_e_r_a_t_o_r = IndexedIterator; │ │ │ │ -415 │ │ │ │ -_4_1_7 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ -418 { │ │ │ │ -419 return _I_t_e_r_a_t_o_r{block.begin()}; │ │ │ │ -420 } │ │ │ │ -421 │ │ │ │ -_4_2_3 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ -424 { │ │ │ │ -425 return _I_t_e_r_a_t_o_r{block.end()}; │ │ │ │ -426 } │ │ │ │ -427 │ │ │ │ -_4_3_0 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ -431 { │ │ │ │ -432 return _I_t_e_r_a_t_o_r{--block.end()}; │ │ │ │ -433 } │ │ │ │ -434 │ │ │ │ -_4_3_7 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ -438 { │ │ │ │ -439 return _I_t_e_r_a_t_o_r{--block.begin()}; │ │ │ │ -440 } │ │ │ │ -441 │ │ │ │ -_4_4_3 using _i_t_e_r_a_t_o_r = _I_t_e_r_a_t_o_r; │ │ │ │ -444 │ │ │ │ -_4_4_6 using _C_o_n_s_t_I_t_e_r_a_t_o_r = IndexedIterator; │ │ │ │ -447 │ │ │ │ -_4_4_9 using _c_o_n_s_t___i_t_e_r_a_t_o_r = _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ -450 │ │ │ │ -_4_5_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ -453 { │ │ │ │ -454 return _C_o_n_s_t_I_t_e_r_a_t_o_r{block.begin()}; │ │ │ │ -455 } │ │ │ │ -456 │ │ │ │ -_4_5_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ -459 { │ │ │ │ -460 return _C_o_n_s_t_I_t_e_r_a_t_o_r{block.end()}; │ │ │ │ -461 } │ │ │ │ -462 │ │ │ │ -_4_6_5 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () const │ │ │ │ -466 { │ │ │ │ -467 return _C_o_n_s_t_I_t_e_r_a_t_o_r{--block.end()}; │ │ │ │ -468 } │ │ │ │ -469 │ │ │ │ -_4_7_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ -473 { │ │ │ │ -474 return _C_o_n_s_t_I_t_e_r_a_t_o_r{--block.begin()}; │ │ │ │ -475 } │ │ │ │ -476 │ │ │ │ -_4_7_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _r_e_n_d () const │ │ │ │ -479 { │ │ │ │ -480 return _C_o_n_s_t_I_t_e_r_a_t_o_r{block.rend()}; │ │ │ │ -481 } │ │ │ │ -482 │ │ │ │ -_4_8_4 _I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) │ │ │ │ -485 { │ │ │ │ -486 _I_t_e_r_a_t_o_r tmp = block.begin(); │ │ │ │ -487 tmp+=std::min(i, block.size()); │ │ │ │ -488 return tmp; │ │ │ │ -489 } │ │ │ │ -490 │ │ │ │ -_4_9_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_d (_s_i_z_e___t_y_p_e i) const │ │ │ │ -493 { │ │ │ │ -494 _C_o_n_s_t_I_t_e_r_a_t_o_r tmp = block.begin(); │ │ │ │ -495 tmp+=std::min(i, block.size()); │ │ │ │ -496 return tmp; │ │ │ │ -497 } │ │ │ │ -498 │ │ │ │ -499 //===== sizes │ │ │ │ -500 │ │ │ │ -_5_0_2 _s_i_z_e___t_y_p_e _N () const noexcept │ │ │ │ -503 { │ │ │ │ -504 return block.size(); │ │ │ │ -505 } │ │ │ │ -506 │ │ │ │ -_5_1_1 _s_i_z_e___t_y_p_e _s_i_z_e () const noexcept │ │ │ │ -512 { │ │ │ │ -513 return block.size(); │ │ │ │ -514 } │ │ │ │ -515 │ │ │ │ -516 │ │ │ │ -517 private: │ │ │ │ -518 │ │ │ │ -519 void allocate () │ │ │ │ -520 { │ │ │ │ -521 if (this->initialized) │ │ │ │ -522 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Attempt to re-allocate already initialized │ │ │ │ -VariableBlockVector"); │ │ │ │ -523 │ │ │ │ -524 // calculate space needed: │ │ │ │ -525 _s_i_z_e___t_y_p_e storageNeeded = 0; │ │ │ │ -526 for(_s_i_z_e___t_y_p_e i = 0; i < block.size(); i++) │ │ │ │ -527 storageNeeded += block[i]._s_i_z_e(); │ │ │ │ -528 │ │ │ │ -529 storage_.resize(storageNeeded); │ │ │ │ -530 syncBaseArray(); │ │ │ │ -531 │ │ │ │ -532 // and we set the window pointers │ │ │ │ -533 block[0].setptr(this->p); // pointer to first block │ │ │ │ -534 for (_s_i_z_e___t_y_p_e j=1; jinitialized = true; │ │ │ │ -539 } │ │ │ │ -540 │ │ │ │ -541 void syncBaseArray () noexcept │ │ │ │ -542 { │ │ │ │ -543 this->p = storage_.data(); │ │ │ │ -544 this->n = storage_.size(); │ │ │ │ -545 } │ │ │ │ -546 │ │ │ │ -547 VectorWindows block = {}; // vector of blocks pointing to the array in the │ │ │ │ -base class │ │ │ │ -548 std::vector storage_ = {}; │ │ │ │ -549 bool initialized = false; // true if vector has been initialized │ │ │ │ -550 }; │ │ │ │ -551 │ │ │ │ -555 template │ │ │ │ -_5_5_6 struct FieldTraits< _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ -557 { │ │ │ │ -_5_5_8 typedef typename FieldTraits::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_5_5_9 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ -560 }; │ │ │ │ -568} // end namespace │ │ │ │ -569 │ │ │ │ -570#endif │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ -_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ -Helper functions for determining the vector/matrix block level. │ │ │ │ +59} // end namespace │ │ │ │ +60 │ │ │ │ +61#endif │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -A vector of blocks with memory management. │ │ │ │ -DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ _D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ derive error class from the base class in common │ │ │ │ DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -A Vector of blocks with different blocksizes. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:48 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -VariableBlockVector(size_type numBlocks, size_type blockSize) │ │ │ │ -Construct a vector with given number of blocks each having a constant size. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:125 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -VariableBlockVector() │ │ │ │ -Constructor without arguments makes an empty vector. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:102 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_w_a_p │ │ │ │ -friend void swap(VariableBlockVector &lhs, VariableBlockVector &rhs) noexcept │ │ │ │ -Free function to swap the storage and internal state of lhs with rhs. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:190 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_i_t_e_r_a_t_o_r │ │ │ │ -Iterator iterator │ │ │ │ -Export the iterator type using std naming rules. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:443 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ -VariableBlockVector & operator=(VariableBlockVector tmp) │ │ │ │ -Copy and move assignment. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:171 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -VariableBlockVector(size_type numBlocks) │ │ │ │ -Construct a vector with given number of blocks, but size of each block is not │ │ │ │ -yet known. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:112 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ -export the type representing the field │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:65 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ -typename A::size_type size_type │ │ │ │ -The size type for the index access. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:83 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_N │ │ │ │ -size_type N() const noexcept │ │ │ │ -number of blocks in the vector (are of variable size here) │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:502 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -VariableBlockVector(const VariableBlockVector &a) │ │ │ │ -Copy constructor, has copy semantics. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:142 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -window_type & operator[](size_type i) │ │ │ │ -random access to blocks │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:397 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ -A allocator_type │ │ │ │ -export the allocator type │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:68 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_c_r_e_a_t_e_e_n_d │ │ │ │ -CreateIterator createend() │ │ │ │ -get create iterator pointing to one after the last block │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:386 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -VariableBlockVector(VariableBlockVector &&tmp) │ │ │ │ -Move constructor: │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:161 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_c_r_e_a_t_e_b_e_g_i_n │ │ │ │ -CreateIterator createbegin() │ │ │ │ -get initial create iterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:377 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ -ConstIterator const_iterator │ │ │ │ -Export the const iterator type using std naming rules. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:449 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ -window_type & reference │ │ │ │ -Export type used for references to container entries. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:74 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_n_d │ │ │ │ -ConstIterator rend() const │ │ │ │ -end ConstIterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:478 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ -const window_type & const_reference │ │ │ │ -Export type used for const references to container entries. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:80 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_n_d │ │ │ │ -ConstIterator find(size_type i) const │ │ │ │ -random access returning iterator (end if not contained) │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:492 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ -ConstIterator beforeEnd() const │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:465 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_n_d │ │ │ │ -Iterator find(size_type i) │ │ │ │ -random access returning iterator (end if not contained) │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:484 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ -IndexedIterator< typename VectorWindows::const_iterator > ConstIterator │ │ │ │ -Const iterator. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:446 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_~_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -~VariableBlockVector()=default │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ -ConstIterator beforeBegin() const │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:472 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ -void resize(size_type numBlocks) │ │ │ │ -same effect as constructor with same argument │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:196 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ -Iterator end() │ │ │ │ -end Iterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:423 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_w_a_p │ │ │ │ -void swap(VariableBlockVector &other) noexcept │ │ │ │ -Exchange the storage and internal state with other. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:178 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ -ConstIterator begin() const │ │ │ │ -begin ConstIterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:452 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ -size_type size() const noexcept │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:511 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ -void resize(size_type numBlocks, size_type blockSize) │ │ │ │ -same effect as constructor with same argument │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:210 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ -IndexedIterator< typename VectorWindows::iterator > Iterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:414 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_e_n_d │ │ │ │ -ConstIterator end() const │ │ │ │ -end ConstIterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:458 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ -Iterator beforeBegin() │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:437 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ -Iterator beforeEnd() │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:430 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_b_e_g_i_n │ │ │ │ -Iterator begin() │ │ │ │ -begin Iterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:417 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ -Iterator class for sequential creation of blocks. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:275 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ -bool operator==(const CreateIterator &it) const │ │ │ │ -equality │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:339 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_n_d_e_x │ │ │ │ -size_type index() const │ │ │ │ -dereferencing │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:345 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ -SizeProxy reference │ │ │ │ -reference type │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:295 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_p_o_i_n_t_e_r │ │ │ │ -size_type * pointer │ │ │ │ -pointer type │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:292 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ -bool operator!=(const CreateIterator &it) const │ │ │ │ -inequality │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:333 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_~_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ -~CreateIterator() │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:304 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ -size_type value_type │ │ │ │ -value type │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:281 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ -CreateIterator(VariableBlockVector &_v, int _i, bool _isEnd) │ │ │ │ -constructor │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:298 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_s_e_t_b_l_o_c_k_s_i_z_e │ │ │ │ -void setblocksize(size_type _k) │ │ │ │ -set size of current block │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:351 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ -size_type & operator*() │ │ │ │ -Access size of current block. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:362 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_i_t_e_r_a_t_o_r___c_a_t_e_g_o_r_y │ │ │ │ -std::output_iterator_tag iterator_category │ │ │ │ -iterator category │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:278 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ -CreateIterator & operator++() │ │ │ │ -prefix increment │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:316 │ │ │ │ -_D_u_n_e_:_:_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r_:_:_d_i_f_f_e_r_e_n_c_e___t_y_p_e │ │ │ │ -void difference_type │ │ │ │ -difference type (unused) │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:289 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ -FieldTraits< B >::real_type real_type │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:559 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< B >::field_type field_type │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:558 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_E_r_r_o_r │ │ │ │ +Error specific to BCRSMatrix. │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:24 │ │ │ │ +_D_u_n_e_:_:_I_m_p_l_i_c_i_t_M_o_d_e_C_o_m_p_r_e_s_s_i_o_n_B_u_f_f_e_r_E_x_h_a_u_s_t_e_d │ │ │ │ +Thrown when the compression buffer used by the implicit BCRSMatrix construction │ │ │ │ +is exhausted. │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:37 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_A_b_o_r_t │ │ │ │ +Thrown when a solver aborts due to some problem. │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:46 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r │ │ │ │ +Error when performing an operation on a matrix block. │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:52 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r_:_:_c │ │ │ │ +int c │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:54 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r_:_:_r │ │ │ │ +int r │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:54 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: umfpack.hh File Reference │ │ │ +dune-istl: ilusubdomainsolver.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,72 +71,49 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Namespaces
│ │ │ +
ilusubdomainsolver.hh File Reference
│ │ │ │ │ │
│ │ │ │ │ │ -

Classes for using UMFPack with ISTL matrices. │ │ │ +

Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ More...

│ │ │ -
#include <complex>
│ │ │ -#include <type_traits>
│ │ │ -#include <umfpack.h>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ -#include <dune/common/fvector.hh>
│ │ │ -#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ -#include <dune/istl/foreach.hh>
│ │ │ -#include <dune/istl/multitypeblockmatrix.hh>
│ │ │ -#include <dune/istl/multitypeblockvector.hh>
│ │ │ -#include <dune/istl/solvers.hh>
│ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ -#include <dune/istl/solverfactory.hh>
│ │ │ +
#include <map>
│ │ │ +#include <dune/common/typetraits.hh>
│ │ │ +#include <dune/istl/preconditioners.hh>
│ │ │ +#include "matrix.hh"
│ │ │ +#include <cmath>
│ │ │ +#include <cstdlib>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::UMFPackMethodChooser< T >
class  Dune::ILUSubdomainSolver< M, X, Y >
 base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver. More...
 
struct  Dune::UMFPackMethodChooser< double >
class  Dune::ILU0SubdomainSolver< M, X, Y >
 Exact subdomain solver using ILU(p) with appropriate p. More...
 
struct  Dune::UMFPackMethodChooser< std::complex< double > >
 
class  Dune::UMFPack< M >
 The UMFPack direct sparse solver. More...
 
struct  Dune::IsDirectSolver< UMFPack< BCRSMatrix< FieldMatrix< T, n, m >, A > > >
 
struct  Dune::StoresColumnCompressed< UMFPack< BCRSMatrix< T, A > > >
 
struct  Dune::UMFPackCreator
 
struct  Dune::UMFPackCreator::isValidBlock< TL, M, class >
class  Dune::ILUNSubdomainSolver< M, X, Y >
 
│ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
│ │ │ - │ │ │ - │ │ │ - │ │ │

│ │ │ -Functions

 Dune::DUNE_REGISTER_DIRECT_SOLVER ("umfpack", Dune::UMFPackCreator())
 
│ │ │

Detailed Description

│ │ │ -

Classes for using UMFPack with ISTL matrices.

│ │ │ -
Author
Dominic Kempf
│ │ │ +

Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.

│ │ │ +
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,56 +1,35 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -umfpack.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) │ │ │ │ -Classes for using UMFPack with ISTL matrices. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_f_o_r_e_a_c_h_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +ilusubdomainsolver.hh File Reference │ │ │ │ +Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ +#include "_m_a_t_r_i_x_._h_h" │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _T_ _> │ │ │ │ +class   _D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ +  base class encapsulating common algorithms of _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r and │ │ │ │ + _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _> │ │ │ │ +class   _D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ +  Exact subdomain solver using _I_L_U_(_p_) with appropriate p. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_U_M_F_P_a_c_k_<_ _M_ _> │ │ │ │ -  The UMFPack direct sparse solver. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _U_M_F_P_a_c_k_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _> │ │ │ │ - _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _U_M_F_P_a_c_k_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _T_L_,_ _M_,_ _c_l_a_s_s_ _> │ │ │ │ +class   _D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("umfpack", _D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r()) │ │ │ │ -  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Classes for using UMFPack with ISTL matrices. │ │ │ │ +Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ │ Author │ │ │ │ - Dominic Kempf │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: umfpack.hh Source File │ │ │ +dune-istl: ilusubdomainsolver.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,903 +74,235 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
umfpack.hh
│ │ │ +
ilusubdomainsolver.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_UMFPACK_HH
│ │ │ -
6#define DUNE_ISTL_UMFPACK_HH
│ │ │ +
5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
│ │ │ +
6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
│ │ │
7
│ │ │ -
8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN
│ │ │ -
9
│ │ │ -
10#include<complex>
│ │ │ -
11#include<type_traits>
│ │ │ -
12
│ │ │ -
13#include<umfpack.h>
│ │ │ +
8#include <map>
│ │ │ +
9#include <dune/common/typetraits.hh>
│ │ │ + │ │ │ +
11#include "matrix.hh"
│ │ │ +
12#include <cmath>
│ │ │ +
13#include <cstdlib>
│ │ │
14
│ │ │ -
15#include<dune/common/exceptions.hh>
│ │ │ -
16#include<dune/common/fmatrix.hh>
│ │ │ -
17#include<dune/common/fvector.hh>
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
26
│ │ │ -
27
│ │ │ -
28
│ │ │ -
29namespace Dune {
│ │ │ -
41 // FORWARD DECLARATIONS
│ │ │ -
42 template<class M, class T, class TM, class TD, class TA>
│ │ │ -
43 class SeqOverlappingSchwarz;
│ │ │ +
15namespace Dune {
│ │ │ +
16
│ │ │ +
35 template<class M, class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
37 public:
│ │ │ +
39 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ +
41 typedef X domain_type;
│ │ │ +
43 typedef Y range_type;
│ │ │
44
│ │ │ -
45 template<class T, bool tag>
│ │ │ -
46 struct SeqOverlappingSchwarzAssemblerHelper;
│ │ │ -
47
│ │ │ -
48 // wrapper class for C-Function Calls in the backend. Choose the right function namespace
│ │ │ -
49 // depending on the template parameter used.
│ │ │ -
50 template<typename T>
│ │ │ -
│ │ │ - │ │ │ -
52 {
│ │ │ -
53 static constexpr bool valid = false ;
│ │ │ -
54 };
│ │ │ +
51 virtual void apply (X& v, const Y& d) =0;
│ │ │ +
52
│ │ │ +
│ │ │ + │ │ │ +
54 {}
│ │ │
│ │ │
55
│ │ │ -
56 template<>
│ │ │ -
│ │ │ -
57 struct UMFPackMethodChooser<double>
│ │ │ -
58 {
│ │ │ -
59 static constexpr bool valid = true ;
│ │ │ -
60
│ │ │ -
61 template<typename... A>
│ │ │ -
│ │ │ -
62 static void defaults(A... args)
│ │ │ -
63 {
│ │ │ -
64 umfpack_dl_defaults(args...);
│ │ │ -
65 }
│ │ │ -
│ │ │ -
66 template<typename... A>
│ │ │ -
│ │ │ -
67 static void free_numeric(A... args)
│ │ │ -
68 {
│ │ │ -
69 umfpack_dl_free_numeric(args...);
│ │ │ -
70 }
│ │ │ -
│ │ │ -
71 template<typename... A>
│ │ │ -
│ │ │ -
72 static void free_symbolic(A... args)
│ │ │ -
73 {
│ │ │ -
74 umfpack_dl_free_symbolic(args...);
│ │ │ -
75 }
│ │ │ -
│ │ │ -
76 template<typename... A>
│ │ │ -
│ │ │ -
77 static int load_numeric(A... args)
│ │ │ -
78 {
│ │ │ -
79 return umfpack_dl_load_numeric(args...);
│ │ │ -
80 }
│ │ │ -
│ │ │ -
81 template<typename... A>
│ │ │ -
│ │ │ -
82 static void numeric(A... args)
│ │ │ -
83 {
│ │ │ -
84 umfpack_dl_numeric(args...);
│ │ │ -
85 }
│ │ │ -
│ │ │ -
86 template<typename... A>
│ │ │ -
│ │ │ -
87 static void report_info(A... args)
│ │ │ -
88 {
│ │ │ -
89 umfpack_dl_report_info(args...);
│ │ │ -
90 }
│ │ │ -
│ │ │ -
91 template<typename... A>
│ │ │ -
│ │ │ -
92 static void report_status(A... args)
│ │ │ -
93 {
│ │ │ -
94 umfpack_dl_report_status(args...);
│ │ │ -
95 }
│ │ │ -
│ │ │ -
96 template<typename... A>
│ │ │ -
│ │ │ -
97 static int save_numeric(A... args)
│ │ │ -
98 {
│ │ │ -
99 return umfpack_dl_save_numeric(args...);
│ │ │ -
100 }
│ │ │ -
│ │ │ -
101 template<typename... A>
│ │ │ -
│ │ │ -
102 static void solve(A... args)
│ │ │ -
103 {
│ │ │ -
104 umfpack_dl_solve(args...);
│ │ │ -
105 }
│ │ │ -
│ │ │ -
106 template<typename... A>
│ │ │ -
│ │ │ -
107 static void symbolic(A... args)
│ │ │ -
108 {
│ │ │ -
109 umfpack_dl_symbolic(args...);
│ │ │ -
110 }
│ │ │ -
│ │ │ -
111 };
│ │ │ -
│ │ │ -
112
│ │ │ -
113 template<>
│ │ │ -
│ │ │ -
114 struct UMFPackMethodChooser<std::complex<double> >
│ │ │ -
115 {
│ │ │ -
116 static constexpr bool valid = true ;
│ │ │ -
117 using size_type = SuiteSparse_long;
│ │ │ -
118
│ │ │ -
119 template<typename... A>
│ │ │ -
│ │ │ -
120 static void defaults(A... args)
│ │ │ -
121 {
│ │ │ -
122 umfpack_zl_defaults(args...);
│ │ │ -
123 }
│ │ │ -
│ │ │ -
124 template<typename... A>
│ │ │ +
56 protected:
│ │ │ +
62 template<class S>
│ │ │ +
63 std::size_t copyToLocalMatrix(const M& A, S& rowset);
│ │ │ +
64
│ │ │ +
66 // for ILUN
│ │ │ + │ │ │ +
68 };
│ │ │ +
│ │ │ +
69
│ │ │ +
76 template<class M, class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
78 : public ILUSubdomainSolver<M,X,Y>{
│ │ │ +
79 public:
│ │ │ +
81 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ +
82 typedef typename std::remove_const<M>::type rilu_type;
│ │ │ +
84 typedef X domain_type;
│ │ │ +
86 typedef Y range_type;
│ │ │ +
87
│ │ │ +
88
│ │ │ +
│ │ │ +
93 void apply (X& v, const Y& d)
│ │ │ +
94 {
│ │ │ +
95 ILU::blockILUBacksolve(this->ILU,v,d);
│ │ │ +
96 }
│ │ │ +
│ │ │ +
104 template<class S>
│ │ │ +
105 void setSubMatrix(const M& A, S& rowset);
│ │ │ +
106
│ │ │ +
107 };
│ │ │ +
│ │ │ +
108
│ │ │ +
109 template<class M, class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
111 : public ILUSubdomainSolver<M,X,Y>{
│ │ │ +
112 public:
│ │ │ +
114 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ +
115 typedef typename std::remove_const<M>::type rilu_type;
│ │ │ +
117 typedef X domain_type;
│ │ │ +
119 typedef Y range_type;
│ │ │ +
120
│ │ │
│ │ │ -
125 static void free_numeric(A... args)
│ │ │ +
125 void apply (X& v, const Y& d)
│ │ │
126 {
│ │ │ -
127 umfpack_zl_free_numeric(args...);
│ │ │ +
127 ILU::blockILUBacksolve(RILU,v,d);
│ │ │
128 }
│ │ │
│ │ │ -
129 template<typename... A>
│ │ │ -
│ │ │ -
130 static void free_symbolic(A... args)
│ │ │ -
131 {
│ │ │ -
132 umfpack_zl_free_symbolic(args...);
│ │ │ -
133 }
│ │ │ -
│ │ │ -
134 template<typename... A>
│ │ │ -
│ │ │ -
135 static int load_numeric(A... args)
│ │ │ -
136 {
│ │ │ -
137 return umfpack_zl_load_numeric(args...);
│ │ │ -
138 }
│ │ │ -
│ │ │ -
139 template<typename... A>
│ │ │ -
│ │ │ -
140 static void numeric(const size_type* cs, const size_type* ri, const double* val, A... args)
│ │ │ -
141 {
│ │ │ -
142 umfpack_zl_numeric(cs,ri,val,NULL,args...);
│ │ │ -
143 }
│ │ │ -
│ │ │ -
144 template<typename... A>
│ │ │ -
│ │ │ -
145 static void report_info(A... args)
│ │ │ -
146 {
│ │ │ -
147 umfpack_zl_report_info(args...);
│ │ │ -
148 }
│ │ │ -
│ │ │ -
149 template<typename... A>
│ │ │ -
│ │ │ -
150 static void report_status(A... args)
│ │ │ -
151 {
│ │ │ -
152 umfpack_zl_report_status(args...);
│ │ │ -
153 }
│ │ │ -
│ │ │ -
154 template<typename... A>
│ │ │ -
│ │ │ -
155 static int save_numeric(A... args)
│ │ │ -
156 {
│ │ │ -
157 return umfpack_zl_save_numeric(args...);
│ │ │ -
158 }
│ │ │ -
│ │ │ -
159 template<typename... A>
│ │ │ -
│ │ │ -
160 static void solve(size_type m, const size_type* cs, const size_type* ri, std::complex<double>* val, double* x, const double* b,A... args)
│ │ │ -
161 {
│ │ │ -
162 const double* cval = reinterpret_cast<const double*>(val);
│ │ │ -
163 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...);
│ │ │ -
164 }
│ │ │ -
│ │ │ -
165 template<typename... A>
│ │ │ -
│ │ │ -
166 static void symbolic(size_type m, size_type n, const size_type* cs, const size_type* ri, const double* val, A... args)
│ │ │ -
167 {
│ │ │ -
168 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...);
│ │ │ -
169 }
│ │ │ -
│ │ │ -
170 };
│ │ │ -
│ │ │ -
171
│ │ │ -
172 namespace Impl
│ │ │ -
173 {
│ │ │ -
174 template<class M, class = void>
│ │ │ -
175 struct UMFPackVectorChooser;
│ │ │ -
176
│ │ │ -
178 template<class M> using UMFPackDomainType = typename UMFPackVectorChooser<M>::domain_type;
│ │ │ -
179
│ │ │ -
181 template<class M> using UMFPackRangeType = typename UMFPackVectorChooser<M>::range_type;
│ │ │ +
129
│ │ │ +
137 template<class S>
│ │ │ +
138 void setSubMatrix(const M& A, S& rowset);
│ │ │ +
139
│ │ │ +
140 private:
│ │ │ +
144 rilu_type RILU;
│ │ │ +
145 };
│ │ │ +
│ │ │ +
146
│ │ │ +
147
│ │ │ +
148
│ │ │ +
149 template<class M, class X, class Y>
│ │ │ +
150 template<class S>
│ │ │ +
│ │ │ +
151 std::size_t ILUSubdomainSolver<M,X,Y>::copyToLocalMatrix(const M& A, S& rowSet)
│ │ │ +
152 {
│ │ │ +
153 // Calculate consecutive indices for local problem
│ │ │ +
154 // while preserving the ordering
│ │ │ +
155 typedef typename M::size_type size_type;
│ │ │ +
156 typedef std::map<typename S::value_type,size_type> IndexMap;
│ │ │ +
157 typedef typename IndexMap::iterator IMIter;
│ │ │ +
158 IndexMap indexMap;
│ │ │ +
159 IMIter guess = indexMap.begin();
│ │ │ +
160 size_type localIndex=0;
│ │ │ +
161
│ │ │ +
162 typedef typename S::const_iterator SIter;
│ │ │ +
163 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ +
164 rowIdx!= rowEnd; ++rowIdx, ++localIndex)
│ │ │ +
165 guess = indexMap.insert(guess,
│ │ │ +
166 std::make_pair(*rowIdx,localIndex));
│ │ │ +
167
│ │ │ +
168
│ │ │ +
169 // Build Matrix for local subproblem
│ │ │ +
170 ILU.setSize(rowSet.size(),rowSet.size());
│ │ │ +
171 ILU.setBuildMode(matrix_type::row_wise);
│ │ │ +
172
│ │ │ +
173 // Create sparsity pattern
│ │ │ +
174 typedef typename matrix_type::CreateIterator CIter;
│ │ │ +
175 CIter rowCreator = ILU.createbegin();
│ │ │ +
176 std::size_t offset=0;
│ │ │ +
177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ +
178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) {
│ │ │ +
179 // See which row entries are in our subset and add them to
│ │ │ +
180 // the sparsity pattern
│ │ │ +
181 guess = indexMap.begin();
│ │ │
182
│ │ │ -
183 template<class M>
│ │ │ -
184 struct UMFPackVectorChooser<M,
│ │ │ -
185 std::enable_if_t<(std::is_same<M,double>::value) || (std::is_same<M,std::complex<double> >::value)>>
│ │ │ -
186 {
│ │ │ -
187 using domain_type = M;
│ │ │ -
188 using range_type = M;
│ │ │ -
189 };
│ │ │ -
190
│ │ │ -
191 template<typename T, int n, int m>
│ │ │ -
192 struct UMFPackVectorChooser<FieldMatrix<T,n,m>,
│ │ │ -
193 std::enable_if_t<(std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value)>>
│ │ │ -
194 {
│ │ │ -
196 using domain_type = FieldVector<T,m>;
│ │ │ -
198 using range_type = FieldVector<T,n>;
│ │ │ -
199 };
│ │ │ -
200
│ │ │ -
201 template<typename T, typename A>
│ │ │ -
202 struct UMFPackVectorChooser<BCRSMatrix<T,A>,
│ │ │ -
203 std::void_t<UMFPackDomainType<T>, UMFPackRangeType<T>>>
│ │ │ -
204 {
│ │ │ -
205 // In case of recursive deduction (e.g., BCRSMatrix<FieldMatrix<...>, Allocator<FieldMatrix<...>>>)
│ │ │ -
206 // the allocator needs to be converted to the sub-block allocator type too (e.g., Allocator<FieldVector<...>>).
│ │ │ -
207 // Note that matrix allocator is assumed to be the same as the domain/range type of allocators
│ │ │ -
209 using domain_type = BlockVector<UMFPackDomainType<T>, typename std::allocator_traits<A>::template rebind_alloc<UMFPackDomainType<T>>>;
│ │ │ -
211 using range_type = BlockVector<UMFPackRangeType<T>, typename std::allocator_traits<A>::template rebind_alloc<UMFPackRangeType<T>>>;
│ │ │ -
212 };
│ │ │ -
213
│ │ │ -
214 // to make the `UMFPackVectorChooser` work with `MultiTypeBlockMatrix`, we need to add an intermediate step for the rows, which are typically `MultiTypeBlockVector`
│ │ │ -
215 template<typename FirstBlock, typename... Blocks>
│ │ │ -
216 struct UMFPackVectorChooser<MultiTypeBlockVector<FirstBlock, Blocks...>,
│ │ │ -
217 std::void_t<UMFPackDomainType<FirstBlock>, UMFPackRangeType<FirstBlock>, UMFPackDomainType<Blocks>...>>
│ │ │ -
218 {
│ │ │ -
220 using domain_type = MultiTypeBlockVector<UMFPackDomainType<FirstBlock>, UMFPackDomainType<Blocks>...>;
│ │ │ -
222 using range_type = UMFPackRangeType<FirstBlock>;
│ │ │ -
223 };
│ │ │ -
224
│ │ │ -
225 // specialization for `MultiTypeBlockMatrix` with `MultiTypeBlockVector` rows
│ │ │ -
226 template<typename FirstRow, typename... Rows>
│ │ │ -
227 struct UMFPackVectorChooser<MultiTypeBlockMatrix<FirstRow, Rows...>,
│ │ │ -
228 std::void_t<UMFPackDomainType<FirstRow>, UMFPackRangeType<FirstRow>, UMFPackRangeType<Rows>...>>
│ │ │ -
229 {
│ │ │ -
231 using domain_type = UMFPackDomainType<FirstRow>;
│ │ │ -
233 using range_type = MultiTypeBlockVector< UMFPackRangeType<FirstRow>, UMFPackRangeType<Rows>... >;
│ │ │ -
234 };
│ │ │ -
235
│ │ │ -
236 // dummy class to represent no BitVector
│ │ │ -
237 struct NoBitVector
│ │ │ -
238 {};
│ │ │ +
183 for(typename matrix_type::ConstColIterator col=A[*rowIdx].begin(),
│ │ │ +
184 endcol=A[*rowIdx].end(); col != endcol; ++col) {
│ │ │ +
185 // search for the entry in the row set
│ │ │ +
186 guess = indexMap.find(col.index());
│ │ │ +
187 if(guess!=indexMap.end()) {
│ │ │ +
188 // add local index to row
│ │ │ +
189 rowCreator.insert(guess->second);
│ │ │ +
190 offset=std::max(offset,(std::size_t)std::abs((int)(guess->second-rowCreator.index())));
│ │ │ +
191 }
│ │ │ +
192 }
│ │ │ +
193
│ │ │ +
194 }
│ │ │ +
195
│ │ │ +
196 // Insert the matrix values for the local problem
│ │ │ +
197 typename matrix_type::iterator iluRow=ILU.begin();
│ │ │ +
198
│ │ │ +
199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end();
│ │ │ +
200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) {
│ │ │ +
201 // See which row entries are in our subset and add them to
│ │ │ +
202 // the sparsity pattern
│ │ │ +
203 typename matrix_type::ColIterator localCol=iluRow->begin();
│ │ │ +
204 for(typename matrix_type::ConstColIterator col=A[*rowIdx].begin(),
│ │ │ +
205 endcol=A[*rowIdx].end(); col != endcol; ++col) {
│ │ │ +
206 // search for the entry in the row set
│ │ │ +
207 guess = indexMap.find(col.index());
│ │ │ +
208 if(guess!=indexMap.end()) {
│ │ │ +
209 // set local value
│ │ │ +
210 (*localCol)=(*col);
│ │ │ +
211 ++localCol;
│ │ │ +
212 }
│ │ │ +
213 }
│ │ │ +
214 }
│ │ │ +
215 return offset;
│ │ │ +
216 }
│ │ │ +
│ │ │ +
217
│ │ │ +
218
│ │ │ +
219 template<class M, class X, class Y>
│ │ │ +
220 template<class S>
│ │ │ +
│ │ │ + │ │ │ +
222 {
│ │ │ +
223 this->copyToLocalMatrix(A,rowSet);
│ │ │ + │ │ │ +
225 }
│ │ │ +
│ │ │ +
226
│ │ │ +
227 template<class M, class X, class Y>
│ │ │ +
228 template<class S>
│ │ │ +
│ │ │ + │ │ │ +
230 {
│ │ │ +
231 std::size_t offset=copyToLocalMatrix(A,rowSet);
│ │ │ +
232 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size());
│ │ │ +
233 RILU.setBuildMode(matrix_type::row_wise);
│ │ │ +
234 ILU::blockILUDecomposition(this->ILU, (offset+1)/2, RILU);
│ │ │ +
235 }
│ │ │ +
│ │ │ +
236
│ │ │ +
238} // end name space DUNE
│ │ │
239
│ │ │
240
│ │ │ -
241 }
│ │ │ -
242
│ │ │ -
256 template<typename M>
│ │ │ -
│ │ │ -
257 class UMFPack : public InverseOperator<Impl::UMFPackDomainType<M>,Impl::UMFPackRangeType<M>>
│ │ │ -
258 {
│ │ │ -
259 using T = typename M::field_type;
│ │ │ -
260
│ │ │ -
261 public:
│ │ │ -
262 using size_type = SuiteSparse_long;
│ │ │ -
263
│ │ │ -
265 using Matrix = M;
│ │ │ -
266 using matrix_type = M;
│ │ │ -
268 using UMFPackMatrix = ISTL::Impl::BCCSMatrix<typename Matrix::field_type, size_type>;
│ │ │ -
270 using MatrixInitializer = ISTL::Impl::BCCSMatrixInitializer<M, size_type>;
│ │ │ -
272 using domain_type = Impl::UMFPackDomainType<M>;
│ │ │ -
274 using range_type = Impl::UMFPackRangeType<M>;
│ │ │ -
275
│ │ │ -
│ │ │ - │ │ │ -
278 {
│ │ │ - │ │ │ -
280 }
│ │ │ -
│ │ │ -
281
│ │ │ -
│ │ │ -
290 UMFPack(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false)
│ │ │ -
291 {
│ │ │ -
292 //check whether T is a supported type
│ │ │ -
293 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
294 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
295 Caller::defaults(UMF_Control);
│ │ │ -
296 setVerbosity(verbose);
│ │ │ -
297 setMatrix(matrix);
│ │ │ -
298 }
│ │ │ -
│ │ │ -
299
│ │ │ -
│ │ │ -
308 UMFPack(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false)
│ │ │ -
309 {
│ │ │ -
310 //check whether T is a supported type
│ │ │ -
311 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
312 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
313 Caller::defaults(UMF_Control);
│ │ │ -
314 setVerbosity(verbose);
│ │ │ -
315 setMatrix(matrix);
│ │ │ -
316 }
│ │ │ -
│ │ │ -
317
│ │ │ -
│ │ │ -
327 UMFPack(const Matrix& mat_, const ParameterTree& config)
│ │ │ -
328 : UMFPack(mat_, config.get<int>("verbose", 0))
│ │ │ -
329 {}
│ │ │ -
│ │ │ -
330
│ │ │ -
│ │ │ -
333 UMFPack() : matrixIsLoaded_(false), verbosity_(0)
│ │ │ -
334 {
│ │ │ -
335 //check whether T is a supported type
│ │ │ -
336 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
337 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
338 Caller::defaults(UMF_Control);
│ │ │ -
339 }
│ │ │ -
│ │ │ -
340
│ │ │ -
│ │ │ -
351 UMFPack(const Matrix& mat_, const char* file, int verbose=0)
│ │ │ -
352 {
│ │ │ -
353 //check whether T is a supported type
│ │ │ -
354 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
355 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
356 Caller::defaults(UMF_Control);
│ │ │ -
357 setVerbosity(verbose);
│ │ │ -
358 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ -
359 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == UMFPACK_ERROR_file_IO))
│ │ │ -
360 {
│ │ │ -
361 matrixIsLoaded_ = false;
│ │ │ -
362 setMatrix(mat_);
│ │ │ -
363 saveDecomposition(file);
│ │ │ -
364 }
│ │ │ -
365 else
│ │ │ -
366 {
│ │ │ -
367 matrixIsLoaded_ = true;
│ │ │ -
368 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ -
369 }
│ │ │ -
370 }
│ │ │ -
│ │ │ -
371
│ │ │ -
│ │ │ -
378 UMFPack(const char* file, int verbose=0)
│ │ │ -
379 {
│ │ │ -
380 //check whether T is a supported type
│ │ │ -
381 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
382 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
383 Caller::defaults(UMF_Control);
│ │ │ -
384 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ -
385 if (errcode == UMFPACK_ERROR_out_of_memory)
│ │ │ -
386 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack decomposition");
│ │ │ -
387 if (errcode == UMFPACK_ERROR_file_IO)
│ │ │ -
388 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack decomposition");
│ │ │ -
389 matrixIsLoaded_ = true;
│ │ │ -
390 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ -
391 setVerbosity(verbose);
│ │ │ -
392 }
│ │ │ -
│ │ │ -
393
│ │ │ -
│ │ │ -
394 virtual ~UMFPack()
│ │ │ -
395 {
│ │ │ -
396 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
397 free();
│ │ │ -
398 }
│ │ │ -
│ │ │ -
399
│ │ │ -
│ │ │ - │ │ │ -
404 {
│ │ │ -
405 if (umfpackMatrix_.N() != b.dim())
│ │ │ -
406 DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
│ │ │ -
407 if (umfpackMatrix_.M() != x.dim())
│ │ │ -
408 DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
│ │ │ -
409 if (b.size() == 0)
│ │ │ -
410 return;
│ │ │ -
411
│ │ │ -
412 // we have to convert x and b into flat structures
│ │ │ -
413 // however, this is linear in time
│ │ │ -
414 std::vector<T> xFlat(x.dim()), bFlat(b.dim());
│ │ │ -
415
│ │ │ -
416 flatVectorForEach(x, [&](auto&& entry, auto&& offset)
│ │ │ -
417 {
│ │ │ -
418 xFlat[ offset ] = entry;
│ │ │ -
419 });
│ │ │ -
420
│ │ │ -
421 flatVectorForEach(b, [&](auto&& entry, auto&& offset)
│ │ │ -
422 {
│ │ │ -
423 bFlat[ offset ] = entry;
│ │ │ -
424 });
│ │ │ -
425
│ │ │ -
426 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ -
427 Caller::solve(UMFPACK_A,
│ │ │ -
428 umfpackMatrix_.getColStart(),
│ │ │ -
429 umfpackMatrix_.getRowIndex(),
│ │ │ -
430 umfpackMatrix_.getValues(),
│ │ │ -
431 reinterpret_cast<double*>(&xFlat[0]),
│ │ │ -
432 reinterpret_cast<double*>(&bFlat[0]),
│ │ │ -
433 UMF_Numeric,
│ │ │ -
434 UMF_Control,
│ │ │ -
435 UMF_Apply_Info);
│ │ │ -
436
│ │ │ -
437 // copy back to blocked vector
│ │ │ -
438 flatVectorForEach(x, [&](auto&& entry, auto offset)
│ │ │ -
439 {
│ │ │ -
440 entry = xFlat[offset];
│ │ │ -
441 });
│ │ │ -
442
│ │ │ -
443 //this is a direct solver
│ │ │ -
444 res.iterations = 1;
│ │ │ -
445 res.converged = true;
│ │ │ -
446 res.elapsed = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME];
│ │ │ -
447
│ │ │ -
448 printOnApply(UMF_Apply_Info);
│ │ │ -
449 }
│ │ │ -
│ │ │ -
450
│ │ │ -
│ │ │ -
454 virtual void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ -
455 {
│ │ │ -
456 apply(x,b,res);
│ │ │ -
457 }
│ │ │ -
│ │ │ -
458
│ │ │ -
│ │ │ -
466 void apply(T* x, T* b)
│ │ │ -
467 {
│ │ │ -
468 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ -
469 Caller::solve(UMFPACK_A,
│ │ │ -
470 umfpackMatrix_.getColStart(),
│ │ │ -
471 umfpackMatrix_.getRowIndex(),
│ │ │ -
472 umfpackMatrix_.getValues(),
│ │ │ -
473 x,
│ │ │ -
474 b,
│ │ │ -
475 UMF_Numeric,
│ │ │ -
476 UMF_Control,
│ │ │ -
477 UMF_Apply_Info);
│ │ │ -
478 printOnApply(UMF_Apply_Info);
│ │ │ -
479 }
│ │ │ -
│ │ │ -
480
│ │ │ -
│ │ │ -
492 void setOption(unsigned int option, double value)
│ │ │ -
493 {
│ │ │ -
494 if (option >= UMFPACK_CONTROL)
│ │ │ -
495 DUNE_THROW(RangeError, "Requested non-existing UMFPack option");
│ │ │ -
496
│ │ │ -
497 UMF_Control[option] = value;
│ │ │ -
498 }
│ │ │ -
│ │ │ -
499
│ │ │ -
│ │ │ -
503 void saveDecomposition(const char* file)
│ │ │ -
504 {
│ │ │ -
505 int errcode = Caller::save_numeric(UMF_Numeric, const_cast<char*>(file));
│ │ │ -
506 if (errcode != UMFPACK_OK)
│ │ │ -
507 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack decomposition");
│ │ │ -
508 }
│ │ │ -
│ │ │ -
509
│ │ │ -
519 template<class BitVector = Impl::NoBitVector>
│ │ │ -
│ │ │ -
520 void setMatrix(const Matrix& matrix, const BitVector& bitVector = {})
│ │ │ -
521 {
│ │ │ -
522 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
523 free();
│ │ │ -
524 if (matrix.N() == 0 or matrix.M() == 0)
│ │ │ -
525 return;
│ │ │ -
526
│ │ │ -
527 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ -
528 umfpackMatrix_.free();
│ │ │ -
529
│ │ │ -
530 constexpr bool useBitVector = not std::is_same_v<BitVector,Impl::NoBitVector>;
│ │ │ -
531
│ │ │ -
532 // use a dynamic flat vector for the bitset
│ │ │ -
533 std::vector<bool> flatBitVector;
│ │ │ -
534 // and a mapping from the compressed indices
│ │ │ -
535 std::vector<size_type> subIndices;
│ │ │ -
536
│ │ │ -
537 int numberOfIgnoredDofs = 0;
│ │ │ -
538 int nonZeros = 0;
│ │ │ -
539
│ │ │ -
540 if constexpr ( useBitVector )
│ │ │ -
541 {
│ │ │ -
542 auto flatSize = flatVectorForEach(bitVector, [](auto&&, auto&&){});
│ │ │ -
543 flatBitVector.resize(flatSize);
│ │ │ -
544
│ │ │ -
545 flatVectorForEach(bitVector, [&](auto&& entry, auto&& offset)
│ │ │ -
546 {
│ │ │ -
547 flatBitVector[ offset ] = entry;
│ │ │ -
548 if ( entry )
│ │ │ -
549 {
│ │ │ -
550 numberOfIgnoredDofs++;
│ │ │ -
551 }
│ │ │ -
552 });
│ │ │ -
553 }
│ │ │ -
554
│ │ │ -
555 // compute the flat dimension and the number of nonzeros of the matrix
│ │ │ -
556 auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& row, auto&& col){
│ │ │ -
557 // do not count ignored entries
│ │ │ -
558 if constexpr ( useBitVector )
│ │ │ -
559 if ( flatBitVector[row] or flatBitVector[col] )
│ │ │ -
560 return;
│ │ │ -
561
│ │ │ -
562 nonZeros++;
│ │ │ -
563 });
│ │ │ -
564
│ │ │ -
565 if constexpr ( useBitVector )
│ │ │ -
566 {
│ │ │ -
567 // use the original flatRows!
│ │ │ -
568 subIndices.resize(flatRows,std::numeric_limits<std::size_t>::max());
│ │ │ -
569
│ │ │ -
570 size_type subIndexCounter = 0;
│ │ │ -
571 for ( size_type i=0; i<size_type(flatRows); i++ )
│ │ │ -
572 if ( not flatBitVector[ i ] )
│ │ │ -
573 subIndices[ i ] = subIndexCounter++;
│ │ │ -
574
│ │ │ -
575 // update the original matrix size
│ │ │ -
576 flatRows -= numberOfIgnoredDofs;
│ │ │ -
577 flatCols -= numberOfIgnoredDofs;
│ │ │ -
578 }
│ │ │ -
579
│ │ │ -
580
│ │ │ -
581 umfpackMatrix_.setSize(flatRows,flatCols);
│ │ │ -
582 umfpackMatrix_.Nnz_ = nonZeros;
│ │ │ -
583
│ │ │ -
584 // prepare the arrays
│ │ │ -
585 umfpackMatrix_.colstart = new size_type[flatCols+1];
│ │ │ -
586 umfpackMatrix_.rowindex = new size_type[nonZeros];
│ │ │ -
587 umfpackMatrix_.values = new T[nonZeros];
│ │ │ -
588
│ │ │ -
589 for ( size_type i=0; i<size_type(flatCols+1); i++ )
│ │ │ -
590 {
│ │ │ -
591 umfpackMatrix_.colstart[i] = 0;
│ │ │ -
592 }
│ │ │ -
593
│ │ │ -
594 // at first, we need to compute the column start indices
│ │ │ -
595 // therefore, we count all entries in each column and in the end we accumulate everything
│ │ │ -
596 flatMatrixForEach(matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex)
│ │ │ -
597 {
│ │ │ -
598 // do nothing if entry is excluded
│ │ │ -
599 if constexpr ( useBitVector )
│ │ │ -
600 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] )
│ │ │ -
601 return;
│ │ │ -
602
│ │ │ -
603 // pick compressed or uncompressed index
│ │ │ -
604 // compiler will hopefully do some constexpr optimization here
│ │ │ -
605 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex;
│ │ │ -
606
│ │ │ -
607 umfpackMatrix_.colstart[colIdx+1]++;
│ │ │ -
608 });
│ │ │ -
609
│ │ │ -
610 // now accumulate
│ │ │ -
611 for ( size_type i=0; i<(size_type)flatCols; i++ )
│ │ │ -
612 {
│ │ │ -
613 umfpackMatrix_.colstart[i+1] += umfpackMatrix_.colstart[i];
│ │ │ -
614 }
│ │ │ -
615
│ │ │ -
616 // we need a compressed position counter in each column
│ │ │ -
617 std::vector<size_type> colPosition(flatCols,0);
│ │ │ -
618
│ │ │ -
619 // now we can set the entries: the procedure below works with both row- or column major index ordering
│ │ │ -
620 flatMatrixForEach(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& flatColIndex)
│ │ │ -
621 {
│ │ │ -
622 // do nothing if entry is excluded
│ │ │ -
623 if constexpr ( useBitVector )
│ │ │ -
624 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] )
│ │ │ -
625 return;
│ │ │ -
626
│ │ │ -
627 // pick compressed or uncompressed index
│ │ │ -
628 // compiler will hopefully do some constexpr optimization here
│ │ │ -
629 auto rowIdx = useBitVector ? subIndices[flatRowIndex] : flatRowIndex;
│ │ │ -
630 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex;
│ │ │ -
631
│ │ │ -
632 // the start index of each column is already fixed
│ │ │ -
633 auto colStart = umfpackMatrix_.colstart[colIdx];
│ │ │ -
634 // get the current number of picked elements in this column
│ │ │ -
635 auto colPos = colPosition[colIdx];
│ │ │ -
636 // assign the corresponding row index and the value of this element
│ │ │ -
637 umfpackMatrix_.rowindex[ colStart + colPos ] = rowIdx;
│ │ │ -
638 umfpackMatrix_.values[ colStart + colPos ] = entry;
│ │ │ -
639 // increase the number of picked elements in this column
│ │ │ -
640 colPosition[colIdx]++;
│ │ │ -
641 });
│ │ │ -
642
│ │ │ -
643 decompose();
│ │ │ -
644 }
│ │ │ -
│ │ │ -
645
│ │ │ -
646 // Keep legacy version using a set of scalar indices
│ │ │ -
647 // The new version using a bitVector type for marking the active matrix indices is
│ │ │ -
648 // directly given in `setMatrix` with an additional BitVector argument.
│ │ │ -
649 // The new version is more flexible and allows, e.g., marking single components of a matrix block.
│ │ │ -
650 template<typename S>
│ │ │ -
│ │ │ -
651 void setSubMatrix(const Matrix& _mat, const S& rowIndexSet)
│ │ │ -
652 {
│ │ │ -
653 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
654 free();
│ │ │ -
655
│ │ │ -
656 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ -
657 umfpackMatrix_.free();
│ │ │ -
658
│ │ │ -
659 umfpackMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(_mat) / _mat.N(),
│ │ │ -
660 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(_mat) / _mat.M());
│ │ │ -
661 ISTL::Impl::BCCSMatrixInitializer<Matrix, SuiteSparse_long> initializer(umfpackMatrix_);
│ │ │ -
662
│ │ │ -
663 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(_mat,rowIndexSet));
│ │ │ -
664
│ │ │ -
665 decompose();
│ │ │ -
666 }
│ │ │ -
│ │ │ -
667
│ │ │ -
│ │ │ -
675 void setVerbosity(int v)
│ │ │ -
676 {
│ │ │ -
677 verbosity_ = v;
│ │ │ -
678 // set the verbosity level in UMFPack
│ │ │ -
679 if (verbosity_ == 0)
│ │ │ -
680 UMF_Control[UMFPACK_PRL] = 1;
│ │ │ -
681 if (verbosity_ == 1)
│ │ │ -
682 UMF_Control[UMFPACK_PRL] = 2;
│ │ │ -
683 if (verbosity_ == 2)
│ │ │ -
684 UMF_Control[UMFPACK_PRL] = 4;
│ │ │ -
685 }
│ │ │ -
│ │ │ -
686
│ │ │ -
│ │ │ - │ │ │ -
692 {
│ │ │ -
693 return UMF_Numeric;
│ │ │ -
694 }
│ │ │ -
│ │ │ -
695
│ │ │ -
│ │ │ - │ │ │ -
701 {
│ │ │ -
702 return umfpackMatrix_;
│ │ │ -
703 }
│ │ │ -
│ │ │ -
704
│ │ │ -
│ │ │ -
709 void free()
│ │ │ -
710 {
│ │ │ -
711 if (!matrixIsLoaded_)
│ │ │ -
712 {
│ │ │ -
713 Caller::free_symbolic(&UMF_Symbolic);
│ │ │ -
714 umfpackMatrix_.free();
│ │ │ -
715 }
│ │ │ -
716 Caller::free_numeric(&UMF_Numeric);
│ │ │ -
717 matrixIsLoaded_ = false;
│ │ │ -
718 }
│ │ │ -
│ │ │ -
719
│ │ │ -
720 const char* name() { return "UMFPACK"; }
│ │ │ -
721
│ │ │ -
722 private:
│ │ │ -
723 typedef typename Dune::UMFPackMethodChooser<T> Caller;
│ │ │ -
724
│ │ │ -
725 template<class Mat,class X, class TM, class TD, class T1>
│ │ │ - │ │ │ - │ │ │ -
728
│ │ │ -
730 void decompose()
│ │ │ -
731 {
│ │ │ -
732 double UMF_Decomposition_Info[UMFPACK_INFO];
│ │ │ -
733 Caller::symbolic(static_cast<SuiteSparse_long>(umfpackMatrix_.N()),
│ │ │ -
734 static_cast<SuiteSparse_long>(umfpackMatrix_.N()),
│ │ │ -
735 umfpackMatrix_.getColStart(),
│ │ │ -
736 umfpackMatrix_.getRowIndex(),
│ │ │ -
737 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ -
738 &UMF_Symbolic,
│ │ │ -
739 UMF_Control,
│ │ │ -
740 UMF_Decomposition_Info);
│ │ │ -
741 Caller::numeric(umfpackMatrix_.getColStart(),
│ │ │ -
742 umfpackMatrix_.getRowIndex(),
│ │ │ -
743 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ -
744 UMF_Symbolic,
│ │ │ -
745 &UMF_Numeric,
│ │ │ -
746 UMF_Control,
│ │ │ -
747 UMF_Decomposition_Info);
│ │ │ -
748 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]);
│ │ │ -
749 if (verbosity_ == 1)
│ │ │ -
750 {
│ │ │ -
751 std::cout << "[UMFPack Decomposition]" << std::endl;
│ │ │ -
752 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_TIME] << ")" << std::endl;
│ │ │ -
753 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << std::endl;
│ │ │ -
754 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" << std::endl;
│ │ │ -
755 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info[UMFPACK_RCOND] << std::endl;
│ │ │ -
756 std::cout << "Numbers of non-zeroes in decomposition: L: " << UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info[UMFPACK_UNZ] << std::endl;
│ │ │ -
757 }
│ │ │ -
758 if (verbosity_ == 2)
│ │ │ -
759 {
│ │ │ -
760 Caller::report_info(UMF_Control,UMF_Decomposition_Info);
│ │ │ -
761 }
│ │ │ -
762 }
│ │ │ -
763
│ │ │ -
764 void printOnApply(double* UMF_Info)
│ │ │ -
765 {
│ │ │ -
766 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]);
│ │ │ -
767 if (verbosity_ > 0)
│ │ │ -
768 {
│ │ │ -
769 std::cout << "[UMFPack Solve]" << std::endl;
│ │ │ -
770 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " (CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl;
│ │ │ -
771 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl;
│ │ │ -
772 std::cout << "Iterative Refinement steps taken: " << UMF_Info[UMFPACK_IR_TAKEN] << std::endl;
│ │ │ -
773 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << UMF_Info[UMFPACK_OMEGA2] << std::endl;
│ │ │ -
774 }
│ │ │ -
775 }
│ │ │ -
776
│ │ │ -
777 UMFPackMatrix umfpackMatrix_;
│ │ │ -
778 bool matrixIsLoaded_;
│ │ │ -
779 int verbosity_;
│ │ │ -
780 void *UMF_Symbolic;
│ │ │ -
781 void *UMF_Numeric;
│ │ │ -
782 double UMF_Control[UMFPACK_CONTROL];
│ │ │ -
783 };
│ │ │ -
│ │ │ -
784
│ │ │ -
785 template<typename T, typename A, int n, int m>
│ │ │ -
│ │ │ - │ │ │ -
787 {
│ │ │ -
788 enum { value=true};
│ │ │ -
789 };
│ │ │ -
│ │ │ -
790
│ │ │ -
791 template<typename T, typename A>
│ │ │ -
│ │ │ - │ │ │ -
793 {
│ │ │ -
794 enum { value = true };
│ │ │ -
795 };
│ │ │ -
│ │ │ -
796
│ │ │ -
│ │ │ - │ │ │ -
798
│ │ │ -
799 template<class TL, class M,class=void> struct isValidBlock : std::false_type{};
│ │ │ -
800 template<class TL, class M> struct isValidBlock<TL,M,
│ │ │ -
801 std::enable_if_t<
│ │ │ -
802 std::is_same_v<Impl::UMFPackDomainType<M>, typename Dune::TypeListElement<1,TL>::type>
│ │ │ -
803 && std::is_same_v<Impl::UMFPackRangeType<M>, typename Dune::TypeListElement<2,TL>::type>
│ │ │ -
804 >> : std::true_type {};
│ │ │ -
805
│ │ │ -
806 template<typename TL, typename M>
│ │ │ -
807 std::shared_ptr<Dune::InverseOperator<Impl::UMFPackDomainType<M>,Impl::UMFPackRangeType<M>>>
│ │ │ -
│ │ │ -
808 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
│ │ │ -
809 std::enable_if_t<isValidBlock<TL, M>::value,int> = 0) const
│ │ │ -
810 {
│ │ │ -
811 int verbose = config.get("verbose", 0);
│ │ │ -
812 return std::make_shared<Dune::UMFPack<M>>(mat,verbose);
│ │ │ -
813 }
│ │ │ -
│ │ │ -
814
│ │ │ -
815 // second version with SFINAE to validate the template parameters of UMFPack
│ │ │ -
816 template<typename TL, typename M>
│ │ │ -
817 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ -
818 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ -
│ │ │ -
819 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ -
820 std::enable_if_t<!isValidBlock<TL, M>::value,int> = 0) const
│ │ │ -
821 {
│ │ │ -
822 using D = typename Dune::TypeListElement<1,TL>::type;
│ │ │ -
823 using R = typename Dune::TypeListElement<2,TL>::type;
│ │ │ -
824 using DU = Std::detected_t< Impl::UMFPackDomainType, M>;
│ │ │ -
825 using RU = Std::detected_t< Impl::UMFPackRangeType, M>;
│ │ │ -
826 DUNE_THROW(UnsupportedType,
│ │ │ -
827 "Unsupported Types in UMFPack:\n"
│ │ │ -
828 "Matrix: " << className<M>() << ""
│ │ │ -
829 "Domain provided: " << className<D>() << "\n"
│ │ │ -
830 "Domain required: " << className<DU>() << "\n"
│ │ │ -
831 "Range provided: " << className<R>() << "\n"
│ │ │ -
832 "Range required: " << className<RU>() << "\n"
│ │ │ -
833 );
│ │ │ -
834 }
│ │ │ -
│ │ │ -
835 };
│ │ │ -
│ │ │ - │ │ │ -
837} // end namespace Dune
│ │ │ -
838
│ │ │ -
839#endif // HAVE_SUITESPARSE_UMFPACK
│ │ │ -
840
│ │ │ -
841#endif //DUNE_ISTL_UMFPACK_HH
│ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ - │ │ │ -
void free()
free allocated space.
Definition umfpack.hh:709
│ │ │ -
std::shared_ptr< Dune::InverseOperator< Impl::UMFPackDomainType< M >, Impl::UMFPackRangeType< M > > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< TL, M >::value, int >=0) const
Definition umfpack.hh:808
│ │ │ -
virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition umfpack.hh:403
│ │ │ -
SuiteSparse_long size_type
Definition umfpack.hh:262
│ │ │ -
static void symbolic(size_type m, size_type n, const size_type *cs, const size_type *ri, const double *val, A... args)
Definition umfpack.hh:166
│ │ │ -
static void solve(size_type m, const size_type *cs, const size_type *ri, std::complex< double > *val, double *x, const double *b, A... args)
Definition umfpack.hh:160
│ │ │ -
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition umfpack.hh:277
│ │ │ -
M matrix_type
Definition umfpack.hh:266
│ │ │ -
static void numeric(const size_type *cs, const size_type *ri, const double *val, A... args)
Definition umfpack.hh:140
│ │ │ -
static void report_info(A... args)
Definition umfpack.hh:145
│ │ │ -
UMFPack(const Matrix &mat_, const ParameterTree &config)
Construct a solver object from a matrix.
Definition umfpack.hh:327
│ │ │ -
static int load_numeric(A... args)
Definition umfpack.hh:135
│ │ │ -
static int load_numeric(A... args)
Definition umfpack.hh:77
│ │ │ -
static void report_status(A... args)
Definition umfpack.hh:92
│ │ │ -
UMFPack(const Matrix &mat_, const char *file, int verbose=0)
Try loading a decomposition from file and do a decomposition if unsuccessful.
Definition umfpack.hh:351
│ │ │ -
Impl::UMFPackRangeType< M > range_type
The type of the range of the solver.
Definition umfpack.hh:274
│ │ │ -
UMFPack()
default constructor
Definition umfpack.hh:333
│ │ │ -
static void symbolic(A... args)
Definition umfpack.hh:107
│ │ │ -
static void report_info(A... args)
Definition umfpack.hh:87
│ │ │ -
static void free_symbolic(A... args)
Definition umfpack.hh:72
│ │ │ -
static int save_numeric(A... args)
Definition umfpack.hh:155
│ │ │ -
static void free_numeric(A... args)
Definition umfpack.hh:125
│ │ │ -
void setSubMatrix(const Matrix &_mat, const S &rowIndexSet)
Definition umfpack.hh:651
│ │ │ -
static int save_numeric(A... args)
Definition umfpack.hh:97
│ │ │ -
static void report_status(A... args)
Definition umfpack.hh:150
│ │ │ -
Impl::UMFPackDomainType< M > domain_type
The type of the domain of the solver.
Definition umfpack.hh:272
│ │ │ -
void apply(T *x, T *b)
additional apply method with c-arrays in analogy to superlu
Definition umfpack.hh:466
│ │ │ -
static void defaults(A... args)
Definition umfpack.hh:120
│ │ │ -
static void free_numeric(A... args)
Definition umfpack.hh:67
│ │ │ -
void setVerbosity(int v)
sets the verbosity level for the UMFPack solver
Definition umfpack.hh:675
│ │ │ -
UMFPack(const char *file, int verbose=0)
try loading a decomposition from file
Definition umfpack.hh:378
│ │ │ -
static void numeric(A... args)
Definition umfpack.hh:82
│ │ │ -
static constexpr bool valid
Definition umfpack.hh:53
│ │ │ -
virtual ~UMFPack()
Definition umfpack.hh:394
│ │ │ -
const char * name()
Definition umfpack.hh:720
│ │ │ -
void setMatrix(const Matrix &matrix, const BitVector &bitVector={})
Initialize data from given matrix.
Definition umfpack.hh:520
│ │ │ -
void saveDecomposition(const char *file)
saves a decomposition to a file
Definition umfpack.hh:503
│ │ │ -
UMFPackMatrix & getInternalMatrix()
Return the column compress matrix from UMFPack.
Definition umfpack.hh:700
│ │ │ -
SuiteSparse_long size_type
Definition umfpack.hh:117
│ │ │ -
UMFPack(const Matrix &matrix, int verbose=0)
Construct a solver object from a matrix.
Definition umfpack.hh:290
│ │ │ -
ISTL::Impl::BCCSMatrixInitializer< M, size_type > MatrixInitializer
Type of an associated initializer class.
Definition umfpack.hh:270
│ │ │ -
virtual void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition umfpack.hh:454
│ │ │ -
ISTL::Impl::BCCSMatrix< typename Matrix::field_type, size_type > UMFPackMatrix
The corresponding (scalar) UMFPack matrix type.
Definition umfpack.hh:268
│ │ │ -
void setOption(unsigned int option, double value)
Set UMFPack-specific options.
Definition umfpack.hh:492
│ │ │ -
static void free_symbolic(A... args)
Definition umfpack.hh:130
│ │ │ -
M Matrix
The matrix type.
Definition umfpack.hh:265
│ │ │ -
static void defaults(A... args)
Definition umfpack.hh:62
│ │ │ -
static void solve(A... args)
Definition umfpack.hh:102
│ │ │ -
UMFPack(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition umfpack.hh:308
│ │ │ -
void * getFactorization()
Return the matrix factorization.
Definition umfpack.hh:691
│ │ │ +
241#endif
│ │ │ +
Define general preconditioner interface.
│ │ │ +
A dynamic dense block matrix class.
│ │ │ +
std::size_t copyToLocalMatrix(const M &A, S &rowset)
Copy the local part of the global matrix to ILU.
Definition ilusubdomainsolver.hh:151
│ │ │ +
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition ilusubdomainsolver.hh:229
│ │ │ +
void setSubMatrix(const M &A, S &rowset)
Set the data of the local problem.
Definition ilusubdomainsolver.hh:221
│ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ -
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, std::size_t rowOffset=0, std::size_t colOffset=0)
Traverse a blocked matrix and call a functor at each scalar entry.
Definition foreach.hh:132
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0)
Traverse a blocked vector and call a functor at each scalar entry.
Definition foreach.hh:95
│ │ │ -
Definition matrixutils.hh:211
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ -
Definition overlappingschwarz.hh:694
│ │ │ -
Definition matrixutils.hh:27
│ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
double elapsed
Elapsed time in seconds.
Definition solver.hh:84
│ │ │ -
int iterations
Number of iterations.
Definition solver.hh:69
│ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │ -
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
Definition solverregistry.hh:77
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ -
Definition umfpack.hh:52
│ │ │ -
The UMFPack direct sparse solver.
Definition umfpack.hh:258
│ │ │ -
Definition umfpack.hh:797
│ │ │ -
Definition umfpack.hh:799
│ │ │ +
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ +
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ +
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ +
base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver.
Definition ilusubdomainsolver.hh:36
│ │ │ +
matrix_type ILU
The ILU0 decomposition of the matrix, or the local matrix.
Definition ilusubdomainsolver.hh:67
│ │ │ +
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:41
│ │ │ +
virtual ~ILUSubdomainSolver()
Definition ilusubdomainsolver.hh:53
│ │ │ +
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:43
│ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:39
│ │ │ +
virtual void apply(X &v, const Y &d)=0
Apply the subdomain solver.
│ │ │ +
Exact subdomain solver using ILU(p) with appropriate p.
Definition ilusubdomainsolver.hh:78
│ │ │ +
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:84
│ │ │ +
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:86
│ │ │ +
std::remove_const< M >::type rilu_type
Definition ilusubdomainsolver.hh:82
│ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:81
│ │ │ +
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition ilusubdomainsolver.hh:93
│ │ │ +
Definition ilusubdomainsolver.hh:111
│ │ │ +
X domain_type
The domain type of the preconditioner.
Definition ilusubdomainsolver.hh:117
│ │ │ +
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition ilusubdomainsolver.hh:114
│ │ │ +
std::remove_const< M >::type rilu_type
Definition ilusubdomainsolver.hh:115
│ │ │ +
void apply(X &v, const Y &d)
Apply the subdomain solver.
Definition ilusubdomainsolver.hh:125
│ │ │ +
Y range_type
The range type of the preconditioner.
Definition ilusubdomainsolver.hh:119
│ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:616
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1066 +1,288 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -umfpack.hh │ │ │ │ +ilusubdomainsolver.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_UMFPACK_HH │ │ │ │ -6#define DUNE_ISTL_UMFPACK_HH │ │ │ │ +5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH │ │ │ │ +6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_HH │ │ │ │ 7 │ │ │ │ -8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN │ │ │ │ -9 │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12 │ │ │ │ -13#include │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ +11#include "_m_a_t_r_i_x_._h_h" │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ 14 │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17#include │ │ │ │ -18#include<_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ -19#include<_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ -20#include<_d_u_n_e_/_i_s_t_l_/_f_o_r_e_a_c_h_._h_h> │ │ │ │ -21#include<_d_u_n_e_/_i_s_t_l_/_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h> │ │ │ │ -22#include<_d_u_n_e_/_i_s_t_l_/_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h> │ │ │ │ -23#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -24#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -25#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ -26 │ │ │ │ -27 │ │ │ │ -28 │ │ │ │ -29namespace _D_u_n_e { │ │ │ │ -41 // FORWARD DECLARATIONS │ │ │ │ -42 template │ │ │ │ -43 class SeqOverlappingSchwarz; │ │ │ │ +15namespace _D_u_n_e { │ │ │ │ +16 │ │ │ │ +35 template │ │ │ │ +_3_6 class _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r { │ │ │ │ +37 public: │ │ │ │ +_3_9 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ +_4_1 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ +_4_3 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ 44 │ │ │ │ -45 template │ │ │ │ -46 struct SeqOverlappingSchwarzAssemblerHelper; │ │ │ │ -47 │ │ │ │ -48 // wrapper class for C-Function Calls in the backend. Choose the right │ │ │ │ -function namespace │ │ │ │ -49 // depending on the template parameter used. │ │ │ │ -50 template │ │ │ │ -_5_1 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ -52 { │ │ │ │ -_5_3 static constexpr bool _v_a_l_i_d = false ; │ │ │ │ -54 }; │ │ │ │ +_5_1 virtual void _a_p_p_l_y (X& v, const Y& d) =0; │ │ │ │ +52 │ │ │ │ +_5_3 virtual _~_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r() │ │ │ │ +54 {} │ │ │ │ 55 │ │ │ │ -56 template<> │ │ │ │ -_5_7 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ -58 { │ │ │ │ -_5_9 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ -60 │ │ │ │ -61 template │ │ │ │ -_6_2 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ -63 { │ │ │ │ -64 umfpack_dl_defaults(args...); │ │ │ │ -65 } │ │ │ │ -66 template │ │ │ │ -_6_7 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -68 { │ │ │ │ -69 umfpack_dl_free_numeric(args...); │ │ │ │ -70 } │ │ │ │ -71 template │ │ │ │ -_7_2 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ -73 { │ │ │ │ -74 umfpack_dl_free_symbolic(args...); │ │ │ │ -75 } │ │ │ │ -76 template │ │ │ │ -_7_7 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ -78 { │ │ │ │ -79 return umfpack_dl_load_numeric(args...); │ │ │ │ -80 } │ │ │ │ -81 template │ │ │ │ -_8_2 static void _n_u_m_e_r_i_c(A... args) │ │ │ │ -83 { │ │ │ │ -84 umfpack_dl_numeric(args...); │ │ │ │ -85 } │ │ │ │ -86 template │ │ │ │ -_8_7 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ -88 { │ │ │ │ -89 umfpack_dl_report_info(args...); │ │ │ │ -90 } │ │ │ │ -91 template │ │ │ │ -_9_2 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ -93 { │ │ │ │ -94 umfpack_dl_report_status(args...); │ │ │ │ -95 } │ │ │ │ -96 template │ │ │ │ -_9_7 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -98 { │ │ │ │ -99 return umfpack_dl_save_numeric(args...); │ │ │ │ -100 } │ │ │ │ -101 template │ │ │ │ -_1_0_2 static void _s_o_l_v_e(A... args) │ │ │ │ -103 { │ │ │ │ -104 umfpack_dl_solve(args...); │ │ │ │ -105 } │ │ │ │ -106 template │ │ │ │ -_1_0_7 static void _s_y_m_b_o_l_i_c(A... args) │ │ │ │ -108 { │ │ │ │ -109 umfpack_dl_symbolic(args...); │ │ │ │ -110 } │ │ │ │ -111 }; │ │ │ │ -112 │ │ │ │ -113 template<> │ │ │ │ -_1_1_4 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r<_s_t_d::complex > │ │ │ │ -115 { │ │ │ │ -_1_1_6 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ -_1_1_7 using _s_i_z_e___t_y_p_e = SuiteSparse_long; │ │ │ │ -118 │ │ │ │ -119 template │ │ │ │ -_1_2_0 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ -121 { │ │ │ │ -122 umfpack_zl_defaults(args...); │ │ │ │ -123 } │ │ │ │ -124 template │ │ │ │ -_1_2_5 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ +56 protected: │ │ │ │ +62 template │ │ │ │ +63 std::size_t _c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x(const M& A, S& rowset); │ │ │ │ +64 │ │ │ │ +66 // for ILUN │ │ │ │ +_6_7 _m_a_t_r_i_x___t_y_p_e _I_L_U; │ │ │ │ +68 }; │ │ │ │ +69 │ │ │ │ +76 template │ │ │ │ +_7_7 class _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ +78 : public _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r{ │ │ │ │ +79 public: │ │ │ │ +_8_1 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ +_8_2 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ +_8_4 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ +_8_6 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ +87 │ │ │ │ +88 │ │ │ │ +_9_3 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ +94 { │ │ │ │ +95 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(this->_I_L_U,v,d); │ │ │ │ +96 } │ │ │ │ +104 template │ │ │ │ +105 void _s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowset); │ │ │ │ +106 │ │ │ │ +107 }; │ │ │ │ +108 │ │ │ │ +109 template │ │ │ │ +_1_1_0 class _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ +111 : public _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r{ │ │ │ │ +112 public: │ │ │ │ +_1_1_4 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ +_1_1_5 typedef typename std::remove_const::type _r_i_l_u___t_y_p_e; │ │ │ │ +_1_1_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ +_1_1_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ +120 │ │ │ │ +_1_2_5 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ 126 { │ │ │ │ -127 umfpack_zl_free_numeric(args...); │ │ │ │ +127 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(RILU,v,d); │ │ │ │ 128 } │ │ │ │ -129 template │ │ │ │ -_1_3_0 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ -131 { │ │ │ │ -132 umfpack_zl_free_symbolic(args...); │ │ │ │ -133 } │ │ │ │ -134 template │ │ │ │ -_1_3_5 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ -136 { │ │ │ │ -137 return umfpack_zl_load_numeric(args...); │ │ │ │ -138 } │ │ │ │ -139 template │ │ │ │ -_1_4_0 static void _n_u_m_e_r_i_c(const _s_i_z_e___t_y_p_e* cs, const _s_i_z_e___t_y_p_e* ri, const double* │ │ │ │ -val, A... args) │ │ │ │ -141 { │ │ │ │ -142 umfpack_zl_numeric(cs,ri,val,NULL,args...); │ │ │ │ -143 } │ │ │ │ -144 template │ │ │ │ -_1_4_5 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ -146 { │ │ │ │ -147 umfpack_zl_report_info(args...); │ │ │ │ -148 } │ │ │ │ -149 template │ │ │ │ -_1_5_0 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ -151 { │ │ │ │ -152 umfpack_zl_report_status(args...); │ │ │ │ -153 } │ │ │ │ -154 template │ │ │ │ -_1_5_5 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -156 { │ │ │ │ -157 return umfpack_zl_save_numeric(args...); │ │ │ │ -158 } │ │ │ │ -159 template │ │ │ │ -_1_6_0 static void _s_o_l_v_e(_s_i_z_e___t_y_p_e m, const _s_i_z_e___t_y_p_e* cs, const _s_i_z_e___t_y_p_e* ri, │ │ │ │ -std::complex* val, double* x, const double* b,A... args) │ │ │ │ -161 { │ │ │ │ -162 const double* cval = reinterpret_cast(val); │ │ │ │ -163 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...); │ │ │ │ -164 } │ │ │ │ -165 template │ │ │ │ -_1_6_6 static void _s_y_m_b_o_l_i_c(_s_i_z_e___t_y_p_e m, _s_i_z_e___t_y_p_e n, const _s_i_z_e___t_y_p_e* cs, const │ │ │ │ -_s_i_z_e___t_y_p_e* ri, const double* val, A... args) │ │ │ │ -167 { │ │ │ │ -168 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...); │ │ │ │ -169 } │ │ │ │ -170 }; │ │ │ │ -171 │ │ │ │ -172 namespace Impl │ │ │ │ -173 { │ │ │ │ -174 template │ │ │ │ -175 struct UMFPackVectorChooser; │ │ │ │ -176 │ │ │ │ -178 template using UMFPackDomainType = typename │ │ │ │ -UMFPackVectorChooser::domain_type; │ │ │ │ -179 │ │ │ │ -181 template using UMFPackRangeType = typename │ │ │ │ -UMFPackVectorChooser::range_type; │ │ │ │ +129 │ │ │ │ +137 template │ │ │ │ +138 void _s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowset); │ │ │ │ +139 │ │ │ │ +140 private: │ │ │ │ +144 _r_i_l_u___t_y_p_e RILU; │ │ │ │ +145 }; │ │ │ │ +146 │ │ │ │ +147 │ │ │ │ +148 │ │ │ │ +149 template │ │ │ │ +150 template │ │ │ │ +_1_5_1 std::size_t _I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x(const M& A, S& │ │ │ │ +rowSet) │ │ │ │ +152 { │ │ │ │ +153 // Calculate consecutive indices for local problem │ │ │ │ +154 // while preserving the ordering │ │ │ │ +155 typedef typename M::size_type size_type; │ │ │ │ +156 typedef std::map IndexMap; │ │ │ │ +157 typedef typename IndexMap::iterator IMIter; │ │ │ │ +158 IndexMap indexMap; │ │ │ │ +159 IMIter guess = indexMap.begin(); │ │ │ │ +160 size_type localIndex=0; │ │ │ │ +161 │ │ │ │ +162 typedef typename S::const_iterator SIter; │ │ │ │ +163 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ +164 rowIdx!= rowEnd; ++rowIdx, ++localIndex) │ │ │ │ +165 guess = indexMap.insert(guess, │ │ │ │ +166 std::make_pair(*rowIdx,localIndex)); │ │ │ │ +167 │ │ │ │ +168 │ │ │ │ +169 // Build Matrix for local subproblem │ │ │ │ +170 ILU.setSize(rowSet.size(),rowSet.size()); │ │ │ │ +171 ILU.setBuildMode(matrix_type::row_wise); │ │ │ │ +172 │ │ │ │ +173 // Create sparsity pattern │ │ │ │ +174 typedef typename matrix_type::CreateIterator CIter; │ │ │ │ +175 CIter rowCreator = ILU.createbegin(); │ │ │ │ +176 std::size_t offset=0; │ │ │ │ +177 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ +178 rowIdx!= rowEnd; ++rowIdx, ++rowCreator) { │ │ │ │ +179 // See which row entries are in our subset and add them to │ │ │ │ +180 // the sparsity pattern │ │ │ │ +181 guess = indexMap.begin(); │ │ │ │ 182 │ │ │ │ -183 template │ │ │ │ -184 struct UMFPackVectorChooser::value) || (std::is_same >::value)>> │ │ │ │ -186 { │ │ │ │ -187 using domain_type = M; │ │ │ │ -188 using range_type = M; │ │ │ │ -189 }; │ │ │ │ -190 │ │ │ │ -191 template │ │ │ │ -192 struct UMFPackVectorChooser, │ │ │ │ -193 _s_t_d::enable_if_t<(std::is_same::value) || (std::is_same >::value)>> │ │ │ │ -194 { │ │ │ │ -196 using domain_type = FieldVector; │ │ │ │ -198 using range_type = FieldVector; │ │ │ │ -199 }; │ │ │ │ -200 │ │ │ │ -201 template │ │ │ │ -202 struct UMFPackVectorChooser, │ │ │ │ -203 _s_t_d::void_t, UMFPackRangeType>> │ │ │ │ -204 { │ │ │ │ -205 // In case of recursive deduction (e.g., BCRSMatrix, │ │ │ │ -Allocator>>) │ │ │ │ -206 // the allocator needs to be converted to the sub-block allocator type too │ │ │ │ -(e.g., Allocator>). │ │ │ │ -207 // Note that matrix allocator is assumed to be the same as the domain/range │ │ │ │ -type of allocators │ │ │ │ -209 using domain_type = BlockVector, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc>>; │ │ │ │ -211 using range_type = BlockVector, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc>>; │ │ │ │ -212 }; │ │ │ │ -213 │ │ │ │ -214 // to make the `UMFPackVectorChooser` work with `MultiTypeBlockMatrix`, we │ │ │ │ -need to add an intermediate step for the rows, which are typically │ │ │ │ -`MultiTypeBlockVector` │ │ │ │ -215 template │ │ │ │ -216 struct UMFPackVectorChooser, │ │ │ │ -217 _s_t_d::void_t, UMFPackRangeType, │ │ │ │ -UMFPackDomainType...>> │ │ │ │ -218 { │ │ │ │ -220 using domain_type = MultiTypeBlockVector, │ │ │ │ -UMFPackDomainType...>; │ │ │ │ -222 using range_type = UMFPackRangeType; │ │ │ │ -223 }; │ │ │ │ -224 │ │ │ │ -225 // specialization for `MultiTypeBlockMatrix` with `MultiTypeBlockVector` │ │ │ │ -rows │ │ │ │ -226 template │ │ │ │ -227 struct UMFPackVectorChooser, │ │ │ │ -228 _s_t_d::void_t, UMFPackRangeType, │ │ │ │ -UMFPackRangeType...>> │ │ │ │ -229 { │ │ │ │ -231 using domain_type = UMFPackDomainType; │ │ │ │ -233 using range_type = MultiTypeBlockVector< UMFPackRangeType, │ │ │ │ -UMFPackRangeType... >; │ │ │ │ -234 }; │ │ │ │ -235 │ │ │ │ -236 // dummy class to represent no BitVector │ │ │ │ -237 struct NoBitVector │ │ │ │ -238 {}; │ │ │ │ +183 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ +184 endcol=A[*rowIdx]._e_n_d(); _c_o_l != endcol; ++_c_o_l) { │ │ │ │ +185 // search for the entry in the row set │ │ │ │ +186 guess = indexMap.find(_c_o_l.index()); │ │ │ │ +187 if(guess!=indexMap.end()) { │ │ │ │ +188 // add local index to row │ │ │ │ +189 rowCreator.insert(guess->second); │ │ │ │ +190 offset=std::max(offset,(std::size_t)std::abs((int)(guess->second- │ │ │ │ +rowCreator.index()))); │ │ │ │ +191 } │ │ │ │ +192 } │ │ │ │ +193 │ │ │ │ +194 } │ │ │ │ +195 │ │ │ │ +196 // Insert the matrix values for the local problem │ │ │ │ +197 typename matrix_type::iterator iluRow=ILU.begin(); │ │ │ │ +198 │ │ │ │ +199 for(SIter rowIdx = rowSet.begin(), rowEnd=rowSet.end(); │ │ │ │ +200 rowIdx!= rowEnd; ++rowIdx, ++iluRow) { │ │ │ │ +201 // See which row entries are in our subset and add them to │ │ │ │ +202 // the sparsity pattern │ │ │ │ +203 typename matrix_type::ColIterator localCol=iluRow->begin(); │ │ │ │ +204 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ +205 endcol=A[*rowIdx]._e_n_d(); _c_o_l != endcol; ++_c_o_l) { │ │ │ │ +206 // search for the entry in the row set │ │ │ │ +207 guess = indexMap.find(_c_o_l.index()); │ │ │ │ +208 if(guess!=indexMap.end()) { │ │ │ │ +209 // set local value │ │ │ │ +210 (*localCol)=(*col); │ │ │ │ +211 ++localCol; │ │ │ │ +212 } │ │ │ │ +213 } │ │ │ │ +214 } │ │ │ │ +215 return offset; │ │ │ │ +216 } │ │ │ │ +217 │ │ │ │ +218 │ │ │ │ +219 template │ │ │ │ +220 template │ │ │ │ +_2_2_1 void _I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowSet) │ │ │ │ +222 { │ │ │ │ +223 this->copyToLocalMatrix(A,rowSet); │ │ │ │ +224 _I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n(this->ILU); │ │ │ │ +225 } │ │ │ │ +226 │ │ │ │ +227 template │ │ │ │ +228 template │ │ │ │ +_2_2_9 void _I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_<_M_,_X_,_Y_>_:_:_s_e_t_S_u_b_M_a_t_r_i_x(const M& A, S& rowSet) │ │ │ │ +230 { │ │ │ │ +231 std::size_t offset=copyToLocalMatrix(A,rowSet); │ │ │ │ +232 RILU.setSize(rowSet.size(),rowSet.size(), (1+2*offset)*rowSet.size()); │ │ │ │ +233 RILU.setBuildMode(matrix_type::row_wise); │ │ │ │ +234 _I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n(this->ILU, (offset+1)/2, RILU); │ │ │ │ +235 } │ │ │ │ +236 │ │ │ │ +238} // end name space DUNE │ │ │ │ 239 │ │ │ │ 240 │ │ │ │ -241 } │ │ │ │ -242 │ │ │ │ -256 template │ │ │ │ -_2_5_7 class _U_M_F_P_a_c_k : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r,Impl:: │ │ │ │ -UMFPackRangeType> │ │ │ │ -258 { │ │ │ │ -259 using T = typename M::field_type; │ │ │ │ -260 │ │ │ │ -261 public: │ │ │ │ -_2_6_2 using _s_i_z_e___t_y_p_e = SuiteSparse_long; │ │ │ │ -263 │ │ │ │ -_2_6_5 using _M_a_t_r_i_x = M; │ │ │ │ -_2_6_6 using _m_a_t_r_i_x___t_y_p_e = M; │ │ │ │ -_2_6_8 using _U_M_F_P_a_c_k_M_a_t_r_i_x = ISTL::Impl::BCCSMatrix; │ │ │ │ -_2_7_0 using _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r = ISTL::Impl::BCCSMatrixInitializer; │ │ │ │ -_2_7_2 using _d_o_m_a_i_n___t_y_p_e = Impl::UMFPackDomainType; │ │ │ │ -_2_7_4 using _r_a_n_g_e___t_y_p_e = Impl::UMFPackRangeType; │ │ │ │ -275 │ │ │ │ -_2_7_7 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -278 { │ │ │ │ -279 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -280 } │ │ │ │ -281 │ │ │ │ -_2_9_0 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose=0) : matrixIsLoaded_(false) │ │ │ │ -291 { │ │ │ │ -292 //check whether T is a supported type │ │ │ │ -293 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -294 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -295 Caller::defaults(UMF_Control); │ │ │ │ -296 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -297 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ -298 } │ │ │ │ -299 │ │ │ │ -_3_0_8 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose, bool) : matrixIsLoaded_(false) │ │ │ │ -309 { │ │ │ │ -310 //check whether T is a supported type │ │ │ │ -311 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -312 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -313 Caller::defaults(UMF_Control); │ │ │ │ -314 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -315 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ -316 } │ │ │ │ -317 │ │ │ │ -_3_2_7 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const ParameterTree& config) │ │ │ │ -328 : _U_M_F_P_a_c_k(mat_, config._g_e_t("verbose", 0)) │ │ │ │ -329 {} │ │ │ │ -330 │ │ │ │ -_3_3_3 _U_M_F_P_a_c_k() : matrixIsLoaded_(false), verbosity_(0) │ │ │ │ -334 { │ │ │ │ -335 //check whether T is a supported type │ │ │ │ -336 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -337 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -338 Caller::defaults(UMF_Control); │ │ │ │ -339 } │ │ │ │ -340 │ │ │ │ -_3_5_1 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const char* file, int verbose=0) │ │ │ │ -352 { │ │ │ │ -353 //check whether T is a supported type │ │ │ │ -354 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -355 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -356 Caller::defaults(UMF_Control); │ │ │ │ -357 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -358 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ -359 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == │ │ │ │ -UMFPACK_ERROR_file_IO)) │ │ │ │ -360 { │ │ │ │ -361 matrixIsLoaded_ = false; │ │ │ │ -362 _s_e_t_M_a_t_r_i_x(mat_); │ │ │ │ -363 _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(file); │ │ │ │ -364 } │ │ │ │ -365 else │ │ │ │ -366 { │ │ │ │ -367 matrixIsLoaded_ = true; │ │ │ │ -368 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ -std::endl; │ │ │ │ -369 } │ │ │ │ -370 } │ │ │ │ -371 │ │ │ │ -_3_7_8 _U_M_F_P_a_c_k(const char* file, int verbose=0) │ │ │ │ -379 { │ │ │ │ -380 //check whether T is a supported type │ │ │ │ -381 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -382 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -383 Caller::defaults(UMF_Control); │ │ │ │ -384 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ -385 if (errcode == UMFPACK_ERROR_out_of_memory) │ │ │ │ -386 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack │ │ │ │ -decomposition"); │ │ │ │ -387 if (errcode == UMFPACK_ERROR_file_IO) │ │ │ │ -388 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack │ │ │ │ -decomposition"); │ │ │ │ -389 matrixIsLoaded_ = true; │ │ │ │ -390 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ -std::endl; │ │ │ │ -391 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -392 } │ │ │ │ -393 │ │ │ │ -_3_9_4 virtual _~_U_M_F_P_a_c_k() │ │ │ │ -395 { │ │ │ │ -396 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -397 _f_r_e_e(); │ │ │ │ -398 } │ │ │ │ -399 │ │ │ │ -_4_0_3 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ -res) │ │ │ │ -404 { │ │ │ │ -405 if (umfpackMatrix_.N() != b.dim()) │ │ │ │ -406 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r, "Size of right-hand-side vector b does not │ │ │ │ -match the number of matrix rows!"); │ │ │ │ -407 if (umfpackMatrix_.M() != x.dim()) │ │ │ │ -408 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r, "Size of solution vector x does not match the │ │ │ │ -number of matrix columns!"); │ │ │ │ -409 if (b.size() == 0) │ │ │ │ -410 return; │ │ │ │ -411 │ │ │ │ -412 // we have to convert x and b into flat structures │ │ │ │ -413 // however, this is linear in time │ │ │ │ -414 std::vector xFlat(x.dim()), bFlat(b.dim()); │ │ │ │ -415 │ │ │ │ -416 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(x, [&](auto&& entry, auto&& offset) │ │ │ │ -417 { │ │ │ │ -418 xFlat[ offset ] = entry; │ │ │ │ -419 }); │ │ │ │ -420 │ │ │ │ -421 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(b, [&](auto&& entry, auto&& offset) │ │ │ │ -422 { │ │ │ │ -423 bFlat[ offset ] = entry; │ │ │ │ -424 }); │ │ │ │ -425 │ │ │ │ -426 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ -427 Caller::solve(UMFPACK_A, │ │ │ │ -428 umfpackMatrix_.getColStart(), │ │ │ │ -429 umfpackMatrix_.getRowIndex(), │ │ │ │ -430 umfpackMatrix_.getValues(), │ │ │ │ -431 reinterpret_cast(&xFlat[0]), │ │ │ │ -432 reinterpret_cast(&bFlat[0]), │ │ │ │ -433 UMF_Numeric, │ │ │ │ -434 UMF_Control, │ │ │ │ -435 UMF_Apply_Info); │ │ │ │ -436 │ │ │ │ -437 // copy back to blocked vector │ │ │ │ -438 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(x, [&](auto&& entry, auto offset) │ │ │ │ -439 { │ │ │ │ -440 entry = xFlat[offset]; │ │ │ │ -441 }); │ │ │ │ -442 │ │ │ │ -443 //this is a direct solver │ │ │ │ -444 res._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ -445 res._c_o_n_v_e_r_g_e_d = true; │ │ │ │ -446 res._e_l_a_p_s_e_d = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME]; │ │ │ │ -447 │ │ │ │ -448 printOnApply(UMF_Apply_Info); │ │ │ │ -449 } │ │ │ │ -450 │ │ │ │ -_4_5_4 virtual void _a_p_p_l_y (_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, [[maybe_unused]] double │ │ │ │ -reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -455 { │ │ │ │ -456 _a_p_p_l_y(x,b,res); │ │ │ │ -457 } │ │ │ │ -458 │ │ │ │ -_4_6_6 void _a_p_p_l_y(T* x, T* b) │ │ │ │ -467 { │ │ │ │ -468 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ -469 Caller::solve(UMFPACK_A, │ │ │ │ -470 umfpackMatrix_.getColStart(), │ │ │ │ -471 umfpackMatrix_.getRowIndex(), │ │ │ │ -472 umfpackMatrix_.getValues(), │ │ │ │ -473 x, │ │ │ │ -474 b, │ │ │ │ -475 UMF_Numeric, │ │ │ │ -476 UMF_Control, │ │ │ │ -477 UMF_Apply_Info); │ │ │ │ -478 printOnApply(UMF_Apply_Info); │ │ │ │ -479 } │ │ │ │ -480 │ │ │ │ -_4_9_2 void _s_e_t_O_p_t_i_o_n(unsigned int option, double value) │ │ │ │ -493 { │ │ │ │ -494 if (option >= UMFPACK_CONTROL) │ │ │ │ -495 DUNE_THROW(RangeError, "Requested non-existing UMFPack option"); │ │ │ │ -496 │ │ │ │ -497 UMF_Control[option] = value; │ │ │ │ -498 } │ │ │ │ -499 │ │ │ │ -_5_0_3 void _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(const char* file) │ │ │ │ -504 { │ │ │ │ -505 int errcode = Caller::save_numeric(UMF_Numeric, const_cast(file)); │ │ │ │ -506 if (errcode != UMFPACK_OK) │ │ │ │ -507 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack │ │ │ │ -decomposition"); │ │ │ │ -508 } │ │ │ │ -509 │ │ │ │ -519 template │ │ │ │ -_5_2_0 void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix, const BitVector& bitVector = {}) │ │ │ │ -521 { │ │ │ │ -522 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -523 _f_r_e_e(); │ │ │ │ -524 if (matrix.N() == 0 or matrix.M() == 0) │ │ │ │ -525 return; │ │ │ │ -526 │ │ │ │ -527 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ -0) │ │ │ │ -528 umfpackMatrix_.free(); │ │ │ │ -529 │ │ │ │ -530 constexpr bool useBitVector = not std::is_same_v; │ │ │ │ -531 │ │ │ │ -532 // use a dynamic flat vector for the bitset │ │ │ │ -533 std::vector flatBitVector; │ │ │ │ -534 // and a mapping from the compressed indices │ │ │ │ -535 std::vector subIndices; │ │ │ │ -536 │ │ │ │ -537 int numberOfIgnoredDofs = 0; │ │ │ │ -538 int nonZeros = 0; │ │ │ │ -539 │ │ │ │ -540 if constexpr ( useBitVector ) │ │ │ │ -541 { │ │ │ │ -542 auto flatSize = _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(bitVector, [](auto&&, auto&&){}); │ │ │ │ -543 flatBitVector.resize(flatSize); │ │ │ │ -544 │ │ │ │ -545 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(bitVector, [&](auto&& entry, auto&& offset) │ │ │ │ -546 { │ │ │ │ -547 flatBitVector[ offset ] = entry; │ │ │ │ -548 if ( entry ) │ │ │ │ -549 { │ │ │ │ -550 numberOfIgnoredDofs++; │ │ │ │ -551 } │ │ │ │ -552 }); │ │ │ │ -553 } │ │ │ │ -554 │ │ │ │ -555 // compute the flat dimension and the number of nonzeros of the matrix │ │ │ │ -556 auto [flatRows,flatCols] = _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h( matrix, [&](auto&& /*entry*/, │ │ │ │ -auto&& row, auto&& _c_o_l){ │ │ │ │ -557 // do not count ignored entries │ │ │ │ -558 if constexpr ( useBitVector ) │ │ │ │ -559 if ( flatBitVector[row] or flatBitVector[_c_o_l] ) │ │ │ │ -560 return; │ │ │ │ -561 │ │ │ │ -562 nonZeros++; │ │ │ │ -563 }); │ │ │ │ -564 │ │ │ │ -565 if constexpr ( useBitVector ) │ │ │ │ -566 { │ │ │ │ -567 // use the original flatRows! │ │ │ │ -568 subIndices.resize(flatRows,std::numeric_limits::max()); │ │ │ │ -569 │ │ │ │ -570 _s_i_z_e___t_y_p_e subIndexCounter = 0; │ │ │ │ -571 for ( _s_i_z_e___t_y_p_e i=0; i<_s_i_z_e___t_y_p_e(flatRows); i++ ) │ │ │ │ -572 if ( not flatBitVector[ i ] ) │ │ │ │ -573 subIndices[ i ] = subIndexCounter++; │ │ │ │ -574 │ │ │ │ -575 // update the original matrix size │ │ │ │ -576 flatRows -= numberOfIgnoredDofs; │ │ │ │ -577 flatCols -= numberOfIgnoredDofs; │ │ │ │ -578 } │ │ │ │ -579 │ │ │ │ -580 │ │ │ │ -581 umfpackMatrix_.setSize(flatRows,flatCols); │ │ │ │ -582 umfpackMatrix_.Nnz_ = nonZeros; │ │ │ │ -583 │ │ │ │ -584 // prepare the arrays │ │ │ │ -585 umfpackMatrix_.colstart = new _s_i_z_e___t_y_p_e[flatCols+1]; │ │ │ │ -586 umfpackMatrix_.rowindex = new _s_i_z_e___t_y_p_e[nonZeros]; │ │ │ │ -587 umfpackMatrix_.values = new T[nonZeros]; │ │ │ │ -588 │ │ │ │ -589 for ( _s_i_z_e___t_y_p_e i=0; i<_s_i_z_e___t_y_p_e(flatCols+1); i++ ) │ │ │ │ -590 { │ │ │ │ -591 umfpackMatrix_.colstart[i] = 0; │ │ │ │ -592 } │ │ │ │ -593 │ │ │ │ -594 // at first, we need to compute the column start indices │ │ │ │ -595 // therefore, we count all entries in each column and in the end we │ │ │ │ -accumulate everything │ │ │ │ -596 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& │ │ │ │ -flatColIndex) │ │ │ │ -597 { │ │ │ │ -598 // do nothing if entry is excluded │ │ │ │ -599 if constexpr ( useBitVector ) │ │ │ │ -600 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] ) │ │ │ │ -601 return; │ │ │ │ -602 │ │ │ │ -603 // pick compressed or uncompressed index │ │ │ │ -604 // compiler will hopefully do some constexpr optimization here │ │ │ │ -605 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex; │ │ │ │ -606 │ │ │ │ -607 umfpackMatrix_.colstart[colIdx+1]++; │ │ │ │ -608 }); │ │ │ │ -609 │ │ │ │ -610 // now accumulate │ │ │ │ -611 for ( _s_i_z_e___t_y_p_e i=0; i<(_s_i_z_e___t_y_p_e)flatCols; i++ ) │ │ │ │ -612 { │ │ │ │ -613 umfpackMatrix_.colstart[i+1] += umfpackMatrix_.colstart[i]; │ │ │ │ -614 } │ │ │ │ -615 │ │ │ │ -616 // we need a compressed position counter in each column │ │ │ │ -617 std::vector colPosition(flatCols,0); │ │ │ │ -618 │ │ │ │ -619 // now we can set the entries: the procedure below works with both row- or │ │ │ │ -column major index ordering │ │ │ │ -620 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& │ │ │ │ -flatColIndex) │ │ │ │ -621 { │ │ │ │ -622 // do nothing if entry is excluded │ │ │ │ -623 if constexpr ( useBitVector ) │ │ │ │ -624 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] ) │ │ │ │ -625 return; │ │ │ │ -626 │ │ │ │ -627 // pick compressed or uncompressed index │ │ │ │ -628 // compiler will hopefully do some constexpr optimization here │ │ │ │ -629 auto rowIdx = useBitVector ? subIndices[flatRowIndex] : flatRowIndex; │ │ │ │ -630 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex; │ │ │ │ -631 │ │ │ │ -632 // the start index of each column is already fixed │ │ │ │ -633 auto colStart = umfpackMatrix_.colstart[colIdx]; │ │ │ │ -634 // get the current number of picked elements in this column │ │ │ │ -635 auto colPos = colPosition[colIdx]; │ │ │ │ -636 // assign the corresponding row index and the value of this element │ │ │ │ -637 umfpackMatrix_.rowindex[ colStart + colPos ] = rowIdx; │ │ │ │ -638 umfpackMatrix_.values[ colStart + colPos ] = entry; │ │ │ │ -639 // increase the number of picked elements in this column │ │ │ │ -640 colPosition[colIdx]++; │ │ │ │ -641 }); │ │ │ │ -642 │ │ │ │ -643 decompose(); │ │ │ │ -644 } │ │ │ │ -645 │ │ │ │ -646 // Keep legacy version using a set of scalar indices │ │ │ │ -647 // The new version using a bitVector type for marking the active matrix │ │ │ │ -indices is │ │ │ │ -648 // directly given in `setMatrix` with an additional BitVector argument. │ │ │ │ -649 // The new version is more flexible and allows, e.g., marking single │ │ │ │ -components of a matrix block. │ │ │ │ -650 template │ │ │ │ -_6_5_1 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& _mat, const S& rowIndexSet) │ │ │ │ -652 { │ │ │ │ -653 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -654 _f_r_e_e(); │ │ │ │ -655 │ │ │ │ -656 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ -0) │ │ │ │ -657 umfpackMatrix_.free(); │ │ │ │ -658 │ │ │ │ -659 umfpackMatrix_.setSize(rowIndexSet.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m │ │ │ │ -(_mat) / _mat.N(), │ │ │ │ -660 rowIndexSet.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(_mat) / _mat.M()); │ │ │ │ -661 ISTL::Impl::BCCSMatrixInitializer initializer │ │ │ │ -(umfpackMatrix_); │ │ │ │ -662 │ │ │ │ -663 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ -set >(_mat,rowIndexSet)); │ │ │ │ -664 │ │ │ │ -665 decompose(); │ │ │ │ -666 } │ │ │ │ -667 │ │ │ │ -_6_7_5 void _s_e_t_V_e_r_b_o_s_i_t_y(int v) │ │ │ │ -676 { │ │ │ │ -677 verbosity_ = v; │ │ │ │ -678 // set the verbosity level in UMFPack │ │ │ │ -679 if (verbosity_ == 0) │ │ │ │ -680 UMF_Control[UMFPACK_PRL] = 1; │ │ │ │ -681 if (verbosity_ == 1) │ │ │ │ -682 UMF_Control[UMFPACK_PRL] = 2; │ │ │ │ -683 if (verbosity_ == 2) │ │ │ │ -684 UMF_Control[UMFPACK_PRL] = 4; │ │ │ │ -685 } │ │ │ │ -686 │ │ │ │ -_6_9_1 void* _g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n() │ │ │ │ -692 { │ │ │ │ -693 return UMF_Numeric; │ │ │ │ -694 } │ │ │ │ -695 │ │ │ │ -_7_0_0 _U_M_F_P_a_c_k_M_a_t_r_i_x& _g_e_t_I_n_t_e_r_n_a_l_M_a_t_r_i_x() │ │ │ │ -701 { │ │ │ │ -702 return umfpackMatrix_; │ │ │ │ -703 } │ │ │ │ -704 │ │ │ │ -_7_0_9 void _f_r_e_e() │ │ │ │ -710 { │ │ │ │ -711 if (!matrixIsLoaded_) │ │ │ │ -712 { │ │ │ │ -713 Caller::free_symbolic(&UMF_Symbolic); │ │ │ │ -714 umfpackMatrix_.free(); │ │ │ │ -715 } │ │ │ │ -716 Caller::free_numeric(&UMF_Numeric); │ │ │ │ -717 matrixIsLoaded_ = false; │ │ │ │ -718 } │ │ │ │ -719 │ │ │ │ -_7_2_0 const char* _n_a_m_e() { return "UMFPACK"; } │ │ │ │ -721 │ │ │ │ -722 private: │ │ │ │ -723 typedef typename _D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_T_> Caller; │ │ │ │ -724 │ │ │ │ -725 template │ │ │ │ -_7_2_6 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -727 friend struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r<_U_M_F_P_a_c_k<_M_a_t_r_i_x>,true>; │ │ │ │ -728 │ │ │ │ -730 void decompose() │ │ │ │ -731 { │ │ │ │ -732 double UMF_Decomposition_Info[UMFPACK_INFO]; │ │ │ │ -733 Caller::symbolic(static_cast(umfpackMatrix_.N()), │ │ │ │ -734 static_cast(umfpackMatrix_.N()), │ │ │ │ -735 umfpackMatrix_.getColStart(), │ │ │ │ -736 umfpackMatrix_.getRowIndex(), │ │ │ │ -737 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ -738 &UMF_Symbolic, │ │ │ │ -739 UMF_Control, │ │ │ │ -740 UMF_Decomposition_Info); │ │ │ │ -741 Caller::numeric(umfpackMatrix_.getColStart(), │ │ │ │ -742 umfpackMatrix_.getRowIndex(), │ │ │ │ -743 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ -744 UMF_Symbolic, │ │ │ │ -745 &UMF_Numeric, │ │ │ │ -746 UMF_Control, │ │ │ │ -747 UMF_Decomposition_Info); │ │ │ │ -748 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]); │ │ │ │ -749 if (verbosity_ == 1) │ │ │ │ -750 { │ │ │ │ -751 std::cout << "[UMFPack Decomposition]" << std::endl; │ │ │ │ -752 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_NUMERIC_TIME] << ")" << std::endl; │ │ │ │ -753 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << │ │ │ │ -std::endl; │ │ │ │ -754 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" │ │ │ │ -<< std::endl; │ │ │ │ -755 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info │ │ │ │ -[UMFPACK_RCOND] << std::endl; │ │ │ │ -756 std::cout << "Numbers of non-zeroes in decomposition: L: " << │ │ │ │ -UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_UNZ] << std::endl; │ │ │ │ -757 } │ │ │ │ -758 if (verbosity_ == 2) │ │ │ │ -759 { │ │ │ │ -760 Caller::report_info(UMF_Control,UMF_Decomposition_Info); │ │ │ │ -761 } │ │ │ │ -762 } │ │ │ │ -763 │ │ │ │ -764 void printOnApply(double* UMF_Info) │ │ │ │ -765 { │ │ │ │ -766 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]); │ │ │ │ -767 if (verbosity_ > 0) │ │ │ │ -768 { │ │ │ │ -769 std::cout << "[UMFPack Solve]" << std::endl; │ │ │ │ -770 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " │ │ │ │ -(CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl; │ │ │ │ -771 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl; │ │ │ │ -772 std::cout << "Iterative Refinement steps taken: " << UMF_Info │ │ │ │ -[UMFPACK_IR_TAKEN] << std::endl; │ │ │ │ -773 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << │ │ │ │ -UMF_Info[UMFPACK_OMEGA2] << std::endl; │ │ │ │ -774 } │ │ │ │ -775 } │ │ │ │ -776 │ │ │ │ -777 _U_M_F_P_a_c_k_M_a_t_r_i_x umfpackMatrix_; │ │ │ │ -778 bool matrixIsLoaded_; │ │ │ │ -779 int verbosity_; │ │ │ │ -780 void *UMF_Symbolic; │ │ │ │ -781 void *UMF_Numeric; │ │ │ │ -782 double UMF_Control[UMFPACK_CONTROL]; │ │ │ │ -783 }; │ │ │ │ -784 │ │ │ │ -785 template │ │ │ │ -_7_8_6 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_U_M_F_P_a_c_k<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > > │ │ │ │ -787 { │ │ │ │ -_7_8_8 enum { _v_a_l_u_e=true}; │ │ │ │ -789 }; │ │ │ │ -790 │ │ │ │ -791 template │ │ │ │ -_7_9_2 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d<_U_M_F_P_a_c_k<_B_C_R_S_M_a_t_r_i_x > > │ │ │ │ -793 { │ │ │ │ -_7_9_4 enum { _v_a_l_u_e = true }; │ │ │ │ -795 }; │ │ │ │ -796 │ │ │ │ -_7_9_7 struct _U_M_F_P_a_c_k_C_r_e_a_t_o_r { │ │ │ │ -798 │ │ │ │ -_7_9_9 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std:: │ │ │ │ -false_type{}; │ │ │ │ -800 template struct _i_s_V_a_l_i_d_B_l_o_c_k, typename Dune:: │ │ │ │ -TypeListElement<1,TL>::type> │ │ │ │ -803 && std::is_same_v, typename Dune:: │ │ │ │ -TypeListElement<2,TL>::type> │ │ │ │ -804 >> : std::true_type {}; │ │ │ │ -805 │ │ │ │ -806 template │ │ │ │ -807 std::shared_ptr,Impl:: │ │ │ │ -UMFPackRangeType>> │ │ │ │ -_8_0_8 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& config, │ │ │ │ -809 std::enable_if_t<_i_s_V_a_l_i_d_B_l_o_c_k_<_T_L_,_ _M_>_:_:_v_a_l_u_e,int> = 0) const │ │ │ │ -810 { │ │ │ │ -811 int verbose = config.get("verbose", 0); │ │ │ │ -812 return std::make_shared>(_m_a_t,verbose); │ │ │ │ -813 } │ │ │ │ -814 │ │ │ │ -815 // second version with SFINAE to validate the template parameters of │ │ │ │ -UMFPack │ │ │ │ -816 template │ │ │ │ -817 std::shared_ptr::type, │ │ │ │ -818 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ -_8_1_9 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ -*config*/, │ │ │ │ -820 std::enable_if_t_:_:_v_a_l_u_e,int> = 0) const │ │ │ │ -821 { │ │ │ │ -822 using D = typename Dune::TypeListElement<1,TL>::type; │ │ │ │ -823 using R = typename Dune::TypeListElement<2,TL>::type; │ │ │ │ -824 using DU = Std::detected_t< Impl::UMFPackDomainType, M>; │ │ │ │ -825 using RU = Std::detected_t< Impl::UMFPackRangeType, M>; │ │ │ │ -826 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ -827 "Unsupported Types in UMFPack:\n" │ │ │ │ -828 "Matrix: " << className() << "" │ │ │ │ -829 "Domain provided: " << className() << "\n" │ │ │ │ -830 "Domain required: " << className() << "\n" │ │ │ │ -831 "Range provided: " << className() << "\n" │ │ │ │ -832 "Range required: " << className() << "\n" │ │ │ │ -833 ); │ │ │ │ -834 } │ │ │ │ -835 }; │ │ │ │ -_8_3_6 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("umfpack",_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r()); │ │ │ │ -837} // end namespace Dune │ │ │ │ -838 │ │ │ │ -839#endif // HAVE_SUITESPARSE_UMFPACK │ │ │ │ -840 │ │ │ │ -841#endif //DUNE_ISTL_UMFPACK_HH │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ -_s_o_l_v_e_r_s_._h_h │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ -_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ -_m_u_l_t_i_t_y_p_e_b_l_o_c_k_v_e_c_t_o_r_._h_h │ │ │ │ -_m_u_l_t_i_t_y_p_e_b_l_o_c_k_m_a_t_r_i_x_._h_h │ │ │ │ -_f_o_r_e_a_c_h_._h_h │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ -_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_f_r_e_e │ │ │ │ -void free() │ │ │ │ -free allocated space. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:709 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -std::shared_ptr< Dune::InverseOperator< Impl::UMFPackDomainType< M >, Impl:: │ │ │ │ -UMFPackRangeType< M > > > operator()(TL, const M &mat, const Dune:: │ │ │ │ -ParameterTree &config, std::enable_if_t< isValidBlock< TL, M >::value, int >=0) │ │ │ │ -const │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:808 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:403 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_i_z_e___t_y_p_e │ │ │ │ -SuiteSparse_long size_type │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:262 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_s_y_m_b_o_l_i_c │ │ │ │ -static void symbolic(size_type m, size_type n, const size_type *cs, const │ │ │ │ -size_type *ri, const double *val, A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:166 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_s_o_l_v_e │ │ │ │ -static void solve(size_type m, const size_type *cs, const size_type *ri, std:: │ │ │ │ -complex< double > *val, double *x, const double *b, A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:160 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:277 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:266 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_n_u_m_e_r_i_c │ │ │ │ -static void numeric(const size_type *cs, const size_type *ri, const double │ │ │ │ -*val, A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:140 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_r_e_p_o_r_t___i_n_f_o │ │ │ │ -static void report_info(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:145 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack(const Matrix &mat_, const ParameterTree &config) │ │ │ │ -Construct a solver object from a matrix. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:327 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_l_o_a_d___n_u_m_e_r_i_c │ │ │ │ -static int load_numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:135 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_l_o_a_d___n_u_m_e_r_i_c │ │ │ │ -static int load_numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:77 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_r_e_p_o_r_t___s_t_a_t_u_s │ │ │ │ -static void report_status(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:92 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack(const Matrix &mat_, const char *file, int verbose=0) │ │ │ │ -Try loading a decomposition from file and do a decomposition if unsuccessful. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:351 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Impl::UMFPackRangeType< M > range_type │ │ │ │ -The type of the range of the solver. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:274 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack() │ │ │ │ -default constructor │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:333 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_s_y_m_b_o_l_i_c │ │ │ │ -static void symbolic(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:107 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_r_e_p_o_r_t___i_n_f_o │ │ │ │ -static void report_info(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:87 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_f_r_e_e___s_y_m_b_o_l_i_c │ │ │ │ -static void free_symbolic(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:72 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_s_a_v_e___n_u_m_e_r_i_c │ │ │ │ -static int save_numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:155 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_f_r_e_e___n_u_m_e_r_i_c │ │ │ │ -static void free_numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:125 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ -void setSubMatrix(const Matrix &_mat, const S &rowIndexSet) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:651 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_s_a_v_e___n_u_m_e_r_i_c │ │ │ │ -static int save_numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:97 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_r_e_p_o_r_t___s_t_a_t_u_s │ │ │ │ -static void report_status(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:150 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -Impl::UMFPackDomainType< M > domain_type │ │ │ │ -The type of the domain of the solver. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:272 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ -void apply(T *x, T *b) │ │ │ │ -additional apply method with c-arrays in analogy to superlu │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:466 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_d_e_f_a_u_l_t_s │ │ │ │ -static void defaults(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:120 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_f_r_e_e___n_u_m_e_r_i_c │ │ │ │ -static void free_numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:67 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_e_t_V_e_r_b_o_s_i_t_y │ │ │ │ -void setVerbosity(int v) │ │ │ │ -sets the verbosity level for the UMFPack solver │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:675 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack(const char *file, int verbose=0) │ │ │ │ -try loading a decomposition from file │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:378 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_n_u_m_e_r_i_c │ │ │ │ -static void numeric(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:82 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_:_:_v_a_l_i_d │ │ │ │ -static constexpr bool valid │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:53 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_~_U_M_F_P_a_c_k │ │ │ │ -virtual ~UMFPack() │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:394 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_n_a_m_e │ │ │ │ -const char * name() │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:720 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -void setMatrix(const Matrix &matrix, const BitVector &bitVector={}) │ │ │ │ -Initialize data from given matrix. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:520 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ -void saveDecomposition(const char *file) │ │ │ │ -saves a decomposition to a file │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:503 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_g_e_t_I_n_t_e_r_n_a_l_M_a_t_r_i_x │ │ │ │ -UMFPackMatrix & getInternalMatrix() │ │ │ │ -Return the column compress matrix from UMFPack. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:700 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ -SuiteSparse_long size_type │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:117 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack(const Matrix &matrix, int verbose=0) │ │ │ │ -Construct a solver object from a matrix. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:290 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -ISTL::Impl::BCCSMatrixInitializer< M, size_type > MatrixInitializer │ │ │ │ -Type of an associated initializer class. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:270 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ -InverseOperatorResult &res) │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:454 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k_M_a_t_r_i_x │ │ │ │ -ISTL::Impl::BCCSMatrix< typename Matrix::field_type, size_type > UMFPackMatrix │ │ │ │ -The corresponding (scalar) UMFPack matrix type. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:268 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_s_e_t_O_p_t_i_o_n │ │ │ │ -void setOption(unsigned int option, double value) │ │ │ │ -Set UMFPack-specific options. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:492 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_f_r_e_e___s_y_m_b_o_l_i_c │ │ │ │ -static void free_symbolic(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:130 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_M_a_t_r_i_x │ │ │ │ -M Matrix │ │ │ │ -The matrix type. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:265 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_d_e_f_a_u_l_t_s │ │ │ │ -static void defaults(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:62 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _d_o_u_b_l_e_ _>_:_:_s_o_l_v_e │ │ │ │ -static void solve(A... args) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:102 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack(const Matrix &matrix, int verbose, bool) │ │ │ │ -Constructor for compatibility with SuperLU standard constructor. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:308 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n │ │ │ │ -void * getFactorization() │ │ │ │ -Return the matrix factorization. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:691 │ │ │ │ +241#endif │ │ │ │ +_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ +Define general preconditioner interface. │ │ │ │ +_m_a_t_r_i_x_._h_h │ │ │ │ +A dynamic dense block matrix class. │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x │ │ │ │ +std::size_t copyToLocalMatrix(const M &A, S &rowset) │ │ │ │ +Copy the local part of the global matrix to ILU. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:151 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ +void setSubMatrix(const M &A, S &rowset) │ │ │ │ +Set the data of the local problem. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:229 │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ +void setSubMatrix(const M &A, S &rowset) │ │ │ │ +Set the data of the local problem. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:221 │ │ │ │ _c_o_l │ │ │ │ Col col │ │ │ │ DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ -_m_a_t │ │ │ │ -Matrix & mat │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h │ │ │ │ -std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, │ │ │ │ -std::size_t rowOffset=0, std::size_t colOffset=0) │ │ │ │ -Traverse a blocked matrix and call a functor at each scalar entry. │ │ │ │ -DDeeffiinniittiioonn foreach.hh:132 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h │ │ │ │ -std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0) │ │ │ │ -Traverse a blocked vector and call a functor at each scalar entry. │ │ │ │ -DDeeffiinniittiioonn foreach.hh:95 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ -derive error class from the base class in common │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -Sequential overlapping Schwarz preconditioner. │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -Statistics about the application of an inverse operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_e_l_a_p_s_e_d │ │ │ │ -double elapsed │ │ │ │ -Elapsed time in seconds. │ │ │ │ -DDeeffiinniittiioonn solver.hh:84 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ -int iterations │ │ │ │ -Number of iterations. │ │ │ │ -DDeeffiinniittiioonn solver.hh:69 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ -bool converged │ │ │ │ -True if convergence criterion has been met. │ │ │ │ -DDeeffiinniittiioonn solver.hh:75 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -Abstract base class for all solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:101 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -Whether this is a direct solver. │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -whether the solver internally uses column compressed storage │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:52 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ -The UMFPack direct sparse solver. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:258 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:797 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:799 │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ +void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ +LU backsolve with stored inverse. │ │ │ │ +DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ +void blockILU0Decomposition(M &A) │ │ │ │ +compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ +DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ +_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ +void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ +DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ +base class encapsulating common algorithms of ILU0SubdomainSolver and │ │ │ │ +ILUNSubdomainSolver. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:36 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_I_L_U │ │ │ │ +matrix_type ILU │ │ │ │ +The ILU0 decomposition of the matrix, or the local matrix. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:67 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ +X domain_type │ │ │ │ +The domain type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:41 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_~_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ +virtual ~ILUSubdomainSolver() │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:53 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ +Y range_type │ │ │ │ +The range type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:43 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ +std::remove_const< M >::type matrix_type │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:39 │ │ │ │ +_D_u_n_e_:_:_I_L_U_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ +virtual void apply(X &v, const Y &d)=0 │ │ │ │ +Apply the subdomain solver. │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ +Exact subdomain solver using ILU(p) with appropriate p. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:78 │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ +X domain_type │ │ │ │ +The domain type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:84 │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ +Y range_type │ │ │ │ +The range type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:86 │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_i_l_u___t_y_p_e │ │ │ │ +std::remove_const< M >::type rilu_type │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:82 │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ +std::remove_const< M >::type matrix_type │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:81 │ │ │ │ +_D_u_n_e_:_:_I_L_U_0_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ +void apply(X &v, const Y &d) │ │ │ │ +Apply the subdomain solver. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:93 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:111 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ +X domain_type │ │ │ │ +The domain type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:117 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ +std::remove_const< M >::type matrix_type │ │ │ │ +The matrix type the preconditioner is for. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:114 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_i_l_u___t_y_p_e │ │ │ │ +std::remove_const< M >::type rilu_type │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:115 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ +void apply(X &v, const Y &d) │ │ │ │ +Apply the subdomain solver. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:125 │ │ │ │ +_D_u_n_e_:_:_I_L_U_N_S_u_b_d_o_m_a_i_n_S_o_l_v_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ +Y range_type │ │ │ │ +The range type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn ilusubdomainsolver.hh:119 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ +RowIterator end() │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:616 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: spqr.hh File Reference │ │ │ +dune-istl: owneroverlapcopy.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,63 +73,93 @@ │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ Functions
│ │ │ - │ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

Class for using SPQR with ISTL matrices. │ │ │ +

Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ More...

│ │ │ -
#include <complex>
│ │ │ -#include <type_traits>
│ │ │ -#include <SuiteSparseQR.hpp>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ -#include <dune/istl/solvers.hh>
│ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ -#include <dune/istl/solverfactory.hh>
│ │ │ +
#include <new>
│ │ │ +#include <iostream>
│ │ │ +#include <vector>
│ │ │ +#include <list>
│ │ │ +#include <map>
│ │ │ +#include <set>
│ │ │ +#include <tuple>
│ │ │ +#include <cmath>
│ │ │ +#include <mpi.h>
│ │ │ +#include <dune/common/enumset.hh>
│ │ │ +#include <dune/common/parallel/indexset.hh>
│ │ │ +#include <dune/common/parallel/communicator.hh>
│ │ │ +#include <dune/common/parallel/remoteindices.hh>
│ │ │ +#include <dune/common/parallel/mpicommunication.hh>
│ │ │ +#include "solvercategory.hh"
│ │ │ +#include "istlexception.hh"
│ │ │ +#include <dune/common/parallel/communication.hh>
│ │ │ +#include <dune/istl/matrixmarket.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::SPQR< Matrix >
 Use the SPQR package to directly solve linear systems – empty default class. More...
struct  Dune::OwnerOverlapCopyAttributeSet
 Attribute set for overlapping Schwarz. More...
 
class  Dune::SPQR< BCRSMatrix< FieldMatrix< T, n, m >, A > >
 The SPQR direct sparse solver for matrices of type BCRSMatrix. More...
class  Dune::IndexInfoFromGrid< G, L >
 Information about the index distribution. More...
 
struct  Dune::IsDirectSolver< SPQR< BCRSMatrix< T, A > > >
class  Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >
 A class setting up standard communication for a two-valued attribute set with owner/overlap/copy semantics. More...
 
struct  Dune::StoresColumnCompressed< SPQR< BCRSMatrix< T, A > > >
struct  Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::CopyGatherScatter< T >
 gather/scatter callback for communication More...
 
struct  Dune::SPQRCreator
 
struct  Dune::SPQRCreator::isValidBlock< class >
 
struct  Dune::SPQRCreator::isValidBlock< FieldVector< double, 1 > >
struct  Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::AddGatherScatter< T >
 
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
 
│ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ Functions

 Dune::DUNE_REGISTER_DIRECT_SOLVER ("spqr", Dune::SPQRCreator())
 
template<int dim, template< class, class > class Comm>
void testRedistributed (int s)
 
│ │ │

Detailed Description

│ │ │ -

Class for using SPQR with ISTL matrices.

│ │ │ -
Author
Marco Agnese, Andrea Sacconi
│ │ │ -
│ │ │ +

Classes providing communication interfaces for overlapping Schwarz methods.

│ │ │ +
Author
Peter Bastian
│ │ │ +

Function Documentation

│ │ │ + │ │ │ +

◆ testRedistributed()

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +template<int dim, template< class, class > class Comm>
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
void testRedistributed (int s)
│ │ │ +
│ │ │ + │ │ │ +
│ │ │ +
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,49 +1,65 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -spqr.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) │ │ │ │ -Class for using SPQR with ISTL matrices. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ +owneroverlapcopy.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _C_o_m_m_u_n_i_c_a_t_i_o_n_ _I_n_t_e_r_f_a_c_e │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ +_M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ +#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_m_a_r_k_e_t_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ - class   _D_u_n_e_:_:_S_P_Q_R_<_ _M_a_t_r_i_x_ _> │ │ │ │ -  Use the SPQR package to directly solve linear systems – empty default │ │ │ │ - class. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ +  Attribute set for overlapping Schwarz. _M_o_r_e_._._. │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _> │ │ │ │ -  The SPQR direct sparse solver for matrices of type _B_C_R_S_M_a_t_r_i_x. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_ _G_,_ _L_ _> │ │ │ │ +  Information about the index distribution. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ + class   _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _G_l_o_b_a_l_I_d_T_y_p_e_,_ _L_o_c_a_l_I_d_T_y_p_e_ _> │ │ │ │ +  A class setting up standard communication for a two-valued attribute │ │ │ │ + set with owner/overlap/copy semantics. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _G_l_o_b_a_l_I_d_T_y_p_e_,_ _L_o_c_a_l_I_d_T_y_p_e_ _>_:_: │ │ │ │ + _C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _T_ _> │ │ │ │ +  gather/scatter callback for communication _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _c_l_a_s_s_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _d_o_u_b_l_e_,_ _1_ _>_ _> │ │ │ │ +struct   _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _G_l_o_b_a_l_I_d_T_y_p_e_,_ _L_o_c_a_l_I_d_T_y_p_e_ _>_:_: │ │ │ │ + _A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _T_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ FFuunnccttiioonnss │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("spqr", _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r()) │ │ │ │ +template class Comm> │ │ │ │ +void  _t_e_s_t_R_e_d_i_s_t_r_i_b_u_t_e_d (int s) │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Class for using SPQR with ISTL matrices. │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ Author │ │ │ │ - Marco Agnese, Andrea Sacconi │ │ │ │ + Peter Bastian │ │ │ │ +********** FFuunnccttiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? tteessttRReeddiissttrriibbuutteedd(()) ********** │ │ │ │ +template class Comm> │ │ │ │ +void testRedistributed ( int  ss ) │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: spqr.hh Source File │ │ │ +dune-istl: owneroverlapcopy.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,400 +74,710 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
spqr.hh
│ │ │ +
owneroverlapcopy.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SPQR_HH
│ │ │ -
6#define DUNE_ISTL_SPQR_HH
│ │ │ +
5#ifndef DUNE_ISTL_OWNEROVERLAPCOPY_HH
│ │ │ +
6#define DUNE_ISTL_OWNEROVERLAPCOPY_HH
│ │ │
7
│ │ │ -
8#if HAVE_SUITESPARSE_SPQR || defined DOXYGEN
│ │ │ -
9
│ │ │ -
10#include <complex>
│ │ │ -
11#include <type_traits>
│ │ │ -
12
│ │ │ -
13#include <SuiteSparseQR.hpp>
│ │ │ -
14
│ │ │ -
15#include <dune/common/exceptions.hh>
│ │ │ -
16
│ │ │ - │ │ │ -
18#include <dune/istl/solvers.hh>
│ │ │ - │ │ │ - │ │ │ -
21
│ │ │ -
22namespace Dune {
│ │ │ -
34 // forward declarations
│ │ │ -
35 template<class M, class T, class TM, class TD, class TA>
│ │ │ -
36 class SeqOverlappingSchwarz;
│ │ │ -
37
│ │ │ -
38 template<class T, bool tag>
│ │ │ -
39 struct SeqOverlappingSchwarzAssemblerHelper;
│ │ │ +
8#include <new>
│ │ │ +
9#include <iostream>
│ │ │ +
10#include <vector>
│ │ │ +
11#include <list>
│ │ │ +
12#include <map>
│ │ │ +
13#include <set>
│ │ │ +
14#include <tuple>
│ │ │ +
15
│ │ │ +
16#include <cmath>
│ │ │ +
17
│ │ │ +
18// MPI header
│ │ │ +
19#if HAVE_MPI
│ │ │ +
20#include <mpi.h>
│ │ │ +
21#endif
│ │ │ +
22
│ │ │ +
23#include <dune/common/enumset.hh>
│ │ │ +
24
│ │ │ +
25#if HAVE_MPI
│ │ │ +
26#include <dune/common/parallel/indexset.hh>
│ │ │ +
27#include <dune/common/parallel/communicator.hh>
│ │ │ +
28#include <dune/common/parallel/remoteindices.hh>
│ │ │ +
29#include <dune/common/parallel/mpicommunication.hh>
│ │ │ +
30#endif
│ │ │ +
31
│ │ │ +
32#include "solvercategory.hh"
│ │ │ +
33#include "istlexception.hh"
│ │ │ +
34#include <dune/common/parallel/communication.hh>
│ │ │ + │ │ │ +
36
│ │ │ +
37template<int dim, template<class,class> class Comm>
│ │ │ + │ │ │ +
39
│ │ │
40
│ │ │ -
46 template<class Matrix>
│ │ │ -
│ │ │ -
47 class SPQR
│ │ │ -
48 {};
│ │ │ -
│ │ │ -
49
│ │ │ -
63 template<typename T, typename A, int n, int m>
│ │ │ -
│ │ │ -
64 class SPQR<BCRSMatrix<FieldMatrix<T,n,m>,A > >
│ │ │ -
65 : public InverseOperator<BlockVector<FieldVector<T,m>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > >,
│ │ │ -
66 BlockVector<FieldVector<T,n>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > > >
│ │ │ -
67 {
│ │ │ -
68 public:
│ │ │ - │ │ │ - │ │ │ -
73 typedef ISTL::Impl::BCCSMatrix<T,int> SPQRMatrix;
│ │ │ -
75 typedef ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<FieldMatrix<T,n,m>,A>, int> MatrixInitializer;
│ │ │ -
77 typedef Dune::BlockVector<FieldVector<T,m>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > > domain_type;
│ │ │ -
79 typedef Dune::BlockVector<FieldVector<T,n>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > > range_type;
│ │ │ -
80
│ │ │ -
│ │ │ - │ │ │ -
83 {
│ │ │ - │ │ │ -
85 }
│ │ │ -
│ │ │ -
86
│ │ │ -
│ │ │ -
95 SPQR(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false), verbose_(verbose)
│ │ │ -
96 {
│ │ │ -
97 //check whether T is a supported type
│ │ │ -
98 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
99 "Unsupported Type in SPQR (only double and std::complex<double> supported)");
│ │ │ -
100 cc_ = new cholmod_common();
│ │ │ -
101 cholmod_l_start(cc_);
│ │ │ -
102 setMatrix(matrix);
│ │ │ -
103 }
│ │ │ -
│ │ │ -
104
│ │ │ -
│ │ │ -
113 SPQR(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false), verbose_(verbose)
│ │ │ -
114 {
│ │ │ -
115 //check whether T is a supported type
│ │ │ -
116 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
117 "Unsupported Type in SPQR (only double and std::complex<double> supported)");
│ │ │ -
118 cc_ = new cholmod_common();
│ │ │ -
119 cholmod_l_start(cc_);
│ │ │ -
120 setMatrix(matrix);
│ │ │ -
121 }
│ │ │ -
│ │ │ -
122
│ │ │ -
│ │ │ -
132 SPQR(const Matrix& matrix, const ParameterTree& config)
│ │ │ -
133 : SPQR(matrix, config.get<int>("verbose", 0))
│ │ │ -
134 {}
│ │ │ -
│ │ │ -
135
│ │ │ -
│ │ │ -
137 SPQR() : matrixIsLoaded_(false), verbose_(0)
│ │ │ -
138 {
│ │ │ -
139 //check whether T is a supported type
│ │ │ -
140 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
141 "Unsupported Type in SPQR (only double and std::complex<double> supported)");
│ │ │ -
142 cc_ = new cholmod_common();
│ │ │ -
143 cholmod_l_start(cc_);
│ │ │ -
144 }
│ │ │ -
│ │ │ -
145
│ │ │ -
│ │ │ -
147 virtual ~SPQR()
│ │ │ -
148 {
│ │ │ -
149 if ((spqrMatrix_.N() + spqrMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
150 free();
│ │ │ -
151 cholmod_l_finish(cc_);
│ │ │ -
152 }
│ │ │ -
│ │ │ -
153
│ │ │ -
│ │ │ - │ │ │ -
156 {
│ │ │ -
157 const std::size_t numRows(spqrMatrix_.N());
│ │ │ -
158 // fill B
│ │ │ -
159 for(std::size_t k = 0; k != numRows/n; ++k)
│ │ │ -
160 for (int l = 0; l < n; ++l)
│ │ │ -
161 (static_cast<T*>(B_->x))[n*k+l] = b[k][l];
│ │ │ +
41namespace Dune {
│ │ │ +
42
│ │ │ +
│ │ │ + │ │ │ +
59 {
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
62 };
│ │ │ +
│ │ │ +
63 };
│ │ │ +
│ │ │ +
64
│ │ │ +
76 template <class G, class L>
│ │ │ +
│ │ │ + │ │ │ +
78 {
│ │ │ +
79 public:
│ │ │ +
81 typedef G GlobalIdType;
│ │ │ +
82
│ │ │ +
84 typedef L LocalIdType;
│ │ │ +
85
│ │ │ +
92 typedef std::tuple<GlobalIdType,LocalIdType,int> IndexTripel;
│ │ │ +
99 typedef std::tuple<int,GlobalIdType,int> RemoteIndexTripel;
│ │ │ +
100
│ │ │ +
│ │ │ + │ │ │ +
107 {
│ │ │ +
108 if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner &&
│ │ │ + │ │ │ + │ │ │ +
111 DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
│ │ │ +
112 localindices.insert(x);
│ │ │ +
113 }
│ │ │ +
│ │ │ +
114
│ │ │ +
│ │ │ + │ │ │ +
121 {
│ │ │ +
122 if (std::get<2>(x)!=OwnerOverlapCopyAttributeSet::owner &&
│ │ │ + │ │ │ + │ │ │ +
125 DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
│ │ │ +
126 remoteindices.insert(x);
│ │ │ +
127 }
│ │ │ +
│ │ │ +
128
│ │ │ +
│ │ │ +
133 const std::set<IndexTripel>& localIndices () const
│ │ │ +
134 {
│ │ │ +
135 return localindices;
│ │ │ +
136 }
│ │ │ +
│ │ │ +
137
│ │ │ +
│ │ │ +
142 const std::set<RemoteIndexTripel>& remoteIndices () const
│ │ │ +
143 {
│ │ │ +
144 return remoteindices;
│ │ │ +
145 }
│ │ │ +
│ │ │ +
146
│ │ │ +
│ │ │ +
150 void clear ()
│ │ │ +
151 {
│ │ │ +
152 localindices.clear();
│ │ │ +
153 remoteindices.clear();
│ │ │ +
154 }
│ │ │ +
│ │ │ +
155
│ │ │ +
156 private:
│ │ │ +
158 std::set<IndexTripel> localindices;
│ │ │ +
160 std::set<RemoteIndexTripel> remoteindices;
│ │ │ +
161 };
│ │ │ +
│ │ │
162
│ │ │ -
163 cholmod_dense* BTemp = B_;
│ │ │ -
164 B_ = SuiteSparseQR_qmult<T>(0, spqrfactorization_, B_, cc_);
│ │ │ -
165 cholmod_dense* X = SuiteSparseQR_solve<T>(1, spqrfactorization_, B_, cc_);
│ │ │ -
166 cholmod_l_free_dense(&BTemp, cc_);
│ │ │ -
167
│ │ │ -
168 const std::size_t numCols(spqrMatrix_.M());
│ │ │ -
169 // fill x
│ │ │ -
170 for(std::size_t k = 0; k != numCols/m; ++k)
│ │ │ -
171 for (int l = 0; l < m; ++l)
│ │ │ -
172 x[k][l] = (static_cast<T*>(X->x))[m*k+l];
│ │ │ -
173
│ │ │ -
174 cholmod_l_free_dense(&X, cc_);
│ │ │ -
175 // this is a direct solver
│ │ │ -
176 res.iterations = 1;
│ │ │ -
177 res.converged = true;
│ │ │ -
178 if(verbose_ > 0)
│ │ │ -
179 {
│ │ │ -
180 std::cout<<std::endl<<"Solving with SuiteSparseQR"<<std::endl;
│ │ │ -
181 std::cout<<"Flops Taken: "<<cc_->SPQR_flopcount<<std::endl;
│ │ │ -
182 std::cout<<"Analysis Time: "<<cc_->SPQR_analyze_time<<" s"<<std::endl;
│ │ │ -
183 std::cout<<"Factorize Time: "<<cc_->SPQR_factorize_time<<" s"<<std::endl;
│ │ │ -
184 std::cout<<"Backsolve Time: "<<cc_->SPQR_solve_time<<" s"<<std::endl;
│ │ │ -
185 std::cout<<"Peak Memory Usage: "<<cc_->memory_usage<<" bytes"<<std::endl;
│ │ │ -
186 std::cout<<"Rank Estimate: "<<cc_->SPQR_istat[4]<<std::endl<<std::endl;
│ │ │ -
187 }
│ │ │ -
188 }
│ │ │ -
│ │ │ -
189
│ │ │ -
│ │ │ -
191 virtual void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ -
192 {
│ │ │ -
193 apply(x, b, res);
│ │ │ -
194 }
│ │ │ -
│ │ │ -
195
│ │ │ -
│ │ │ -
196 void setOption([[maybe_unused]] unsigned int option, [[maybe_unused]] double value)
│ │ │ -
197 {}
│ │ │ -
│ │ │ -
198
│ │ │ -
│ │ │ -
200 void setMatrix(const Matrix& matrix)
│ │ │ -
201 {
│ │ │ -
202 if ((spqrMatrix_.N() + spqrMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
203 free();
│ │ │ -
204
│ │ │ -
205 if (spqrMatrix_.N() + spqrMatrix_.M() + spqrMatrix_.nonzeroes() != 0)
│ │ │ -
206 spqrMatrix_.free();
│ │ │ -
207 spqrMatrix_.setSize(MatrixDimension<Matrix>::rowdim(matrix),
│ │ │ - │ │ │ -
209 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(spqrMatrix_);
│ │ │ -
210
│ │ │ -
211 copyToBCCSMatrix(initializer, matrix);
│ │ │ -
212
│ │ │ -
213 decompose();
│ │ │ -
214 }
│ │ │ -
│ │ │ -
215
│ │ │ -
216 template<class S>
│ │ │ -
│ │ │ -
217 void setSubMatrix(const Matrix& matrix, const S& rowIndexSet)
│ │ │ -
218 {
│ │ │ -
219 if ((spqrMatrix_.N() + spqrMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
220 free();
│ │ │ +
163
│ │ │ +
164#if HAVE_MPI
│ │ │ +
165
│ │ │ +
172 template <class GlobalIdType, class LocalIdType=int>
│ │ │ +
│ │ │ + │ │ │ +
174 {
│ │ │ +
175 template<typename M, typename G, typename L>
│ │ │ +
176 friend void loadMatrixMarket(M&,
│ │ │ +
177 const std::string&,
│ │ │ + │ │ │ +
179 bool);
│ │ │ +
180 // used types
│ │ │ + │ │ │ + │ │ │ +
183 typedef typename std::set<IndexTripel>::const_iterator localindex_iterator;
│ │ │ +
184 typedef typename std::set<RemoteIndexTripel>::const_iterator remoteindex_iterator;
│ │ │ + │ │ │ +
186 typedef Dune::ParallelLocalIndex<AttributeSet> LI;
│ │ │ +
187 public:
│ │ │ +
188 typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> PIS;
│ │ │ +
189 typedef Dune::RemoteIndices<PIS> RI;
│ │ │ +
190 typedef Dune::RemoteIndexListModifier<PIS,typename RI::Allocator,false> RILM;
│ │ │ +
191 typedef typename RI::RemoteIndex RX;
│ │ │ +
192 typedef Dune::BufferedCommunicator BC;
│ │ │ +
193 typedef Dune::Interface IF;
│ │ │ +
194 typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner> OwnerSet;
│ │ │ +
195 typedef EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopySet;
│ │ │ +
196 typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> OwnerOverlapSet;
│ │ │ +
197 typedef Dune::AllSet<AttributeSet> AllSet;
│ │ │ +
198 protected:
│ │ │ +
199
│ │ │ +
200
│ │ │ +
202 template<typename T>
│ │ │ +
│ │ │ + │ │ │ +
204 {
│ │ │ +
205 typedef typename CommPolicy<T>::IndexedType V;
│ │ │ +
206
│ │ │ +
│ │ │ +
207 static V gather(const T& a, std::size_t i)
│ │ │ +
208 {
│ │ │ +
209 return a[i];
│ │ │ +
210 }
│ │ │ +
│ │ │ +
211
│ │ │ +
│ │ │ +
212 static void scatter(T& a, V v, std::size_t i)
│ │ │ +
213 {
│ │ │ +
214 a[i] = v;
│ │ │ +
215 }
│ │ │ +
│ │ │ +
216 };
│ │ │ +
│ │ │ +
217 template<typename T>
│ │ │ +
│ │ │ + │ │ │ +
219 {
│ │ │ +
220 typedef typename CommPolicy<T>::IndexedType V;
│ │ │
221
│ │ │ -
222 if (spqrMatrix_.N() + spqrMatrix_.M() + spqrMatrix_.nonzeroes() != 0)
│ │ │ -
223 spqrMatrix_.free();
│ │ │ -
224
│ │ │ -
225 spqrMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(matrix) / matrix.N(),
│ │ │ -
226 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(matrix) / matrix.M());
│ │ │ -
227 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(spqrMatrix_);
│ │ │ -
228
│ │ │ -
229 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(matrix,rowIndexSet));
│ │ │ -
230
│ │ │ -
231 decompose();
│ │ │ -
232 }
│ │ │ -
│ │ │ -
233
│ │ │ -
│ │ │ -
238 inline void setVerbosity(int v)
│ │ │ -
239 {
│ │ │ -
240 verbose_=v;
│ │ │ -
241 }
│ │ │ -
│ │ │ -
242
│ │ │ -
│ │ │ -
247 inline SuiteSparseQR_factorization<T>* getFactorization()
│ │ │ -
248 {
│ │ │ -
249 return spqrfactorization_;
│ │ │ -
250 }
│ │ │ -
│ │ │ -
251
│ │ │ -
│ │ │ - │ │ │ -
257 {
│ │ │ -
258 return spqrMatrix_;
│ │ │ -
259 }
│ │ │ -
│ │ │ -
260
│ │ │ -
│ │ │ -
265 void free()
│ │ │ -
266 {
│ │ │ -
267 cholmod_l_free_sparse(&A_, cc_);
│ │ │ -
268 cholmod_l_free_dense(&B_, cc_);
│ │ │ -
269 SuiteSparseQR_free<T>(&spqrfactorization_, cc_);
│ │ │ -
270 spqrMatrix_.free();
│ │ │ -
271 matrixIsLoaded_ = false;
│ │ │ -
272 }
│ │ │ -
│ │ │ -
273
│ │ │ -
│ │ │ -
275 inline const char* name()
│ │ │ -
276 {
│ │ │ -
277 return "SPQR";
│ │ │ -
278 }
│ │ │ -
│ │ │ -
279
│ │ │ -
280 private:
│ │ │ -
281 template<class M,class X, class TM, class TD, class T1>
│ │ │ - │ │ │ -
283
│ │ │ - │ │ │ -
285
│ │ │ -
287 void decompose()
│ │ │ -
288 {
│ │ │ -
289 const std::size_t nrows(spqrMatrix_.N());
│ │ │ -
290 const std::size_t ncols(spqrMatrix_.M());
│ │ │ -
291 const std::size_t nnz(spqrMatrix_.getColStart()[ncols]);
│ │ │ -
292
│ │ │ -
293 // initialise the matrix A (sorted, packed, unsymmetric, real entries)
│ │ │ -
294 A_ = cholmod_l_allocate_sparse(nrows, ncols, nnz, 1, 1, 0, 1, cc_);
│ │ │ -
295
│ │ │ -
296 // copy all the entries of Ap, Ai, Ax
│ │ │ -
297 for(std::size_t k = 0; k != (ncols+1); ++k)
│ │ │ -
298 (static_cast<long int *>(A_->p))[k] = spqrMatrix_.getColStart()[k];
│ │ │ -
299
│ │ │ -
300 for(std::size_t k = 0; k != nnz; ++k)
│ │ │ -
301 {
│ │ │ -
302 (static_cast<long int*>(A_->i))[k] = spqrMatrix_.getRowIndex()[k];
│ │ │ -
303 (static_cast<T*>(A_->x))[k] = spqrMatrix_.getValues()[k];
│ │ │ -
304 }
│ │ │ -
305
│ │ │ -
306 // initialise the vector B
│ │ │ -
307 B_ = cholmod_l_allocate_dense(nrows, 1, nrows, A_->xtype, cc_);
│ │ │ -
308 // compute factorization of A
│ │ │ -
309 spqrfactorization_=SuiteSparseQR_factorize<T>(SPQR_ORDERING_DEFAULT,SPQR_DEFAULT_TOL,A_,cc_);
│ │ │ -
310 }
│ │ │ -
311
│ │ │ -
312 SPQRMatrix spqrMatrix_;
│ │ │ -
313 bool matrixIsLoaded_;
│ │ │ -
314 int verbose_;
│ │ │ -
315 cholmod_common* cc_;
│ │ │ -
316 cholmod_sparse* A_;
│ │ │ -
317 cholmod_dense* B_;
│ │ │ -
318 SuiteSparseQR_factorization<T>* spqrfactorization_;
│ │ │ -
319 };
│ │ │ +
│ │ │ +
222 static V gather(const T& a, std::size_t i)
│ │ │ +
223 {
│ │ │ +
224 return a[i];
│ │ │ +
225 }
│ │ │ +
│ │ │ +
226
│ │ │ +
│ │ │ +
227 static void scatter(T& a, V v, std::size_t i)
│ │ │ +
228 {
│ │ │ +
229 a[i] += v;
│ │ │ +
230 }
│ │ │ +
│ │ │ +
231 };
│ │ │ +
│ │ │ +
232
│ │ │ +
│ │ │ + │ │ │ +
234 {
│ │ │ +
235 if (OwnerOverlapToAllInterfaceBuilt)
│ │ │ +
236 OwnerOverlapToAllInterface.free();
│ │ │ +
237 OwnerOverlapSet sourceFlags;
│ │ │ +
238 Combine<OwnerOverlapSet,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet>
│ │ │ +
239 destFlags;
│ │ │ +
240 OwnerOverlapToAllInterface.build(ri,sourceFlags,destFlags);
│ │ │ +
241 OwnerOverlapToAllInterfaceBuilt = true;
│ │ │ +
242 }
│ │ │ +
│ │ │ +
243
│ │ │ +
│ │ │ + │ │ │ +
245 {
│ │ │ +
246 if (OwnerToAllInterfaceBuilt)
│ │ │ +
247 OwnerToAllInterface.free();
│ │ │ +
248 OwnerSet sourceFlags;
│ │ │ +
249 AllSet destFlags;
│ │ │ +
250 OwnerToAllInterface.build(ri,sourceFlags,destFlags);
│ │ │ +
251 OwnerToAllInterfaceBuilt = true;
│ │ │ +
252 }
│ │ │ +
│ │ │ +
253
│ │ │ +
│ │ │ + │ │ │ +
255 {
│ │ │ +
256 if (OwnerCopyToAllInterfaceBuilt)
│ │ │ +
257 OwnerCopyToAllInterface.free();
│ │ │ +
258
│ │ │ +
259 typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> OwnerCopySet;
│ │ │ +
260 OwnerCopySet sourceFlags;
│ │ │ +
261 Combine<OwnerCopySet,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::overlap>,AttributeSet> destFlags;
│ │ │ +
262 OwnerCopyToAllInterface.build(ri,sourceFlags,destFlags);
│ │ │ +
263 OwnerCopyToAllInterfaceBuilt = true;
│ │ │ +
264 }
│ │ │ +
│ │ │ +
265
│ │ │ +
│ │ │ + │ │ │ +
267 {
│ │ │ +
268 if (OwnerCopyToOwnerCopyInterfaceBuilt)
│ │ │ +
269 OwnerCopyToOwnerCopyInterface.free();
│ │ │ +
270
│ │ │ +
271
│ │ │ +
272 typedef Combine<EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::owner>,EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy>,AttributeSet> OwnerCopySet;
│ │ │ +
273 OwnerCopySet sourceFlags;
│ │ │ +
274 OwnerCopySet destFlags;
│ │ │ +
275 OwnerCopyToOwnerCopyInterface.build(ri,sourceFlags,destFlags);
│ │ │ +
276 OwnerCopyToOwnerCopyInterfaceBuilt = true;
│ │ │ +
277 }
│ │ │ +
│ │ │ +
278
│ │ │ +
│ │ │ + │ │ │ +
280 {
│ │ │ +
281 if (CopyToAllInterfaceBuilt)
│ │ │ +
282 CopyToAllInterface.free();
│ │ │ +
283 CopySet sourceFlags;
│ │ │ +
284 AllSet destFlags;
│ │ │ +
285 CopyToAllInterface.build(ri,sourceFlags,destFlags);
│ │ │ +
286 CopyToAllInterfaceBuilt = true;
│ │ │ +
287 }
│ │ │ +
│ │ │ +
288
│ │ │ +
289 public:
│ │ │ +
290
│ │ │ +
│ │ │ + │ │ │ +
296 return category_;
│ │ │ +
297 }
│ │ │ +
│ │ │ +
298
│ │ │ +
│ │ │ +
299 const Communication<MPI_Comm>& communicator() const
│ │ │ +
300 {
│ │ │ +
301 return cc;
│ │ │ +
302 }
│ │ │ +
│ │ │ +
303
│ │ │ +
310 template<class T>
│ │ │ +
│ │ │ +
311 void copyOwnerToAll (const T& source, T& dest) const
│ │ │ +
312 {
│ │ │ +
313 if (!OwnerToAllInterfaceBuilt)
│ │ │ + │ │ │ + │ │ │ +
316 communicator.template build<T>(OwnerToAllInterface);
│ │ │ +
317 communicator.template forward<CopyGatherScatter<T> >(source,dest);
│ │ │ +
318 communicator.free();
│ │ │ +
319 }
│ │ │
│ │ │
320
│ │ │ -
321 template<typename T, typename A>
│ │ │ -
│ │ │ - │ │ │ -
323 {
│ │ │ -
324 enum {value = true};
│ │ │ -
325 };
│ │ │ -
│ │ │ -
326
│ │ │ -
327 template<typename T, typename A>
│ │ │ -
│ │ │ - │ │ │ -
329 {
│ │ │ -
330 enum {value = true};
│ │ │ -
331 };
│ │ │ -
│ │ │ -
332
│ │ │ -
│ │ │ -
333 struct SPQRCreator {
│ │ │ -
334 template<class> struct isValidBlock : std::false_type{};
│ │ │ -
335
│ │ │ -
336 template<typename TL, typename M>
│ │ │ -
337 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ -
338 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ -
│ │ │ -
339 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
│ │ │ -
340 std::enable_if_t<
│ │ │ -
341 isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ -
342 {
│ │ │ -
343 int verbose = config.get("verbose", 0);
│ │ │ -
344 return std::make_shared<Dune::SPQR<M>>(mat,verbose);
│ │ │ -
345 }
│ │ │ -
│ │ │ -
346
│ │ │ -
347 // second version with SFINAE to validate the template parameters of SPQR
│ │ │ -
348 template<typename TL, typename M>
│ │ │ -
349 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ -
350 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ -
│ │ │ -
351 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ -
352 std::enable_if_t<!isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ -
353 {
│ │ │ -
354 DUNE_THROW(UnsupportedType,
│ │ │ -
355 "Unsupported Type in SPQR (only double and std::complex<double> supported)");
│ │ │ -
356 }
│ │ │ -
│ │ │ -
357 };
│ │ │ -
│ │ │ -
358 template<> struct SPQRCreator::isValidBlock<FieldVector<double,1>> : std::true_type{};
│ │ │ -
359 // std::complex is temporary disabled, because it fails if libc++ is used
│ │ │ -
360 //template<> struct SPQRCreator::isValidMatrixBlock<FieldMatrix<std::complex<double>,1,1>> : std::true_type{};
│ │ │ - │ │ │ -
362
│ │ │ -
363} // end namespace Dune
│ │ │ -
364
│ │ │ -
365
│ │ │ -
366#endif //HAVE_SUITESPARSE_SPQR
│ │ │ -
367#endif //DUNE_ISTL_SPQR_HH
│ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ - │ │ │ - │ │ │ -
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > matrix_type
Definition spqr.hh:71
│ │ │ -
virtual ~SPQR()
Destructor.
Definition spqr.hh:147
│ │ │ -
SPQR(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition spqr.hh:113
│ │ │ -
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition spqr.hh:82
│ │ │ -
SPQRMatrix & getInternalMatrix()
Return the column coppressed matrix.
Definition spqr.hh:256
│ │ │ -
void setMatrix(const Matrix &matrix)
Initialize data from given matrix.
Definition spqr.hh:200
│ │ │ -
ISTL::Impl::BCCSMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A >, int > MatrixInitializer
Type of an associated initializer class.
Definition spqr.hh:75
│ │ │ -
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
The matrix type.
Definition spqr.hh:70
│ │ │ -
SPQR()
Default constructor.
Definition spqr.hh:137
│ │ │ -
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
Definition spqr.hh:339
│ │ │ -
const char * name()
Get method name.
Definition spqr.hh:275
│ │ │ -
SuiteSparseQR_factorization< T > * getFactorization()
Return the matrix factorization.
Definition spqr.hh:247
│ │ │ -
void setVerbosity(int v)
Sets the verbosity level for the solver.
Definition spqr.hh:238
│ │ │ -
ISTL::Impl::BCCSMatrix< T, int > SPQRMatrix
The corresponding SuperLU Matrix type.
Definition spqr.hh:73
│ │ │ -
virtual void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition spqr.hh:191
│ │ │ -
void free()
Free allocated space.
Definition spqr.hh:265
│ │ │ -
SPQR(const Matrix &matrix, const ParameterTree &config)
Constructs the SPQR solver.
Definition spqr.hh:132
│ │ │ -
Dune::BlockVector< FieldVector< T, n >, typename std::allocator_traits< A >::template rebind_alloc< FieldVector< T, n > > > range_type
The type of the range of the solver.
Definition spqr.hh:79
│ │ │ -
void setSubMatrix(const Matrix &matrix, const S &rowIndexSet)
Definition spqr.hh:217
│ │ │ -
Dune::BlockVector< FieldVector< T, m >, typename std::allocator_traits< A >::template rebind_alloc< FieldVector< T, m > > > domain_type
The type of the domain of the solver.
Definition spqr.hh:77
│ │ │ -
virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition spqr.hh:155
│ │ │ -
void setOption(unsigned int option, double value)
Definition spqr.hh:196
│ │ │ -
SPQR(const Matrix &matrix, int verbose=0)
Construct a solver object from a BCRSMatrix.
Definition spqr.hh:95
│ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ +
327 template<class T>
│ │ │ +
│ │ │ +
328 void copyCopyToAll (const T& source, T& dest) const
│ │ │ +
329 {
│ │ │ +
330 if (!CopyToAllInterfaceBuilt)
│ │ │ + │ │ │ + │ │ │ +
333 communicator.template build<T>(CopyToAllInterface);
│ │ │ +
334 communicator.template forward<CopyGatherScatter<T> >(source,dest);
│ │ │ +
335 communicator.free();
│ │ │ +
336 }
│ │ │ +
│ │ │ +
337
│ │ │ +
344 template<class T>
│ │ │ +
│ │ │ +
345 void addOwnerOverlapToAll (const T& source, T& dest) const
│ │ │ +
346 {
│ │ │ +
347 if (!OwnerOverlapToAllInterfaceBuilt)
│ │ │ + │ │ │ + │ │ │ +
350 communicator.template build<T>(OwnerOverlapToAllInterface);
│ │ │ +
351 communicator.template forward<AddGatherScatter<T> >(source,dest);
│ │ │ +
352 communicator.free();
│ │ │ +
353 }
│ │ │ +
│ │ │ +
354
│ │ │ +
361 template<class T>
│ │ │ +
│ │ │ +
362 void addOwnerCopyToAll (const T& source, T& dest) const
│ │ │ +
363 {
│ │ │ +
364 if (!OwnerCopyToAllInterfaceBuilt)
│ │ │ + │ │ │ + │ │ │ +
367 communicator.template build<T>(OwnerCopyToAllInterface);
│ │ │ +
368 communicator.template forward<AddGatherScatter<T> >(source,dest);
│ │ │ +
369 communicator.free();
│ │ │ +
370 }
│ │ │ +
│ │ │ +
371
│ │ │ +
378 template<class T>
│ │ │ +
│ │ │ +
379 void addOwnerCopyToOwnerCopy (const T& source, T& dest) const
│ │ │ +
380 {
│ │ │ +
381 if (!OwnerCopyToOwnerCopyInterfaceBuilt)
│ │ │ + │ │ │ + │ │ │ +
384 communicator.template build<T>(OwnerCopyToOwnerCopyInterface);
│ │ │ +
385 communicator.template forward<AddGatherScatter<T> >(source,dest);
│ │ │ +
386 communicator.free();
│ │ │ +
387 }
│ │ │ +
│ │ │ +
388
│ │ │ +
389
│ │ │ +
397 template<class T1, class T2>
│ │ │ +
│ │ │ +
398 void dot (const T1& x, const T1& y, T2& result) const
│ │ │ +
399 {
│ │ │ +
400 using real_type = typename FieldTraits<typename T1::field_type>::real_type;
│ │ │ +
401 // set up mask vector
│ │ │ +
402 if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
│ │ │ +
403 {
│ │ │ +
404 mask.resize(x.size());
│ │ │ +
405 for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
│ │ │ +
406 mask[i] = 1;
│ │ │ +
407 for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
│ │ │ +
408 if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
│ │ │ +
409 mask[i->local().local()] = 0;
│ │ │ +
410 }
│ │ │ +
411 result = T2(0.0);
│ │ │ +
412
│ │ │ +
413 for (typename T1::size_type i=0; i<x.size(); i++)
│ │ │ +
414 result += (x[i]*(y[i]))*static_cast<real_type>(mask[i]);
│ │ │ +
415 result = cc.sum(result);
│ │ │ +
416 }
│ │ │ +
│ │ │ +
417
│ │ │ +
424 template<class T1>
│ │ │ +
│ │ │ +
425 typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
│ │ │ +
426 {
│ │ │ +
427 using real_type = typename FieldTraits<typename T1::field_type>::real_type;
│ │ │ +
428
│ │ │ +
429 // set up mask vector
│ │ │ +
430 if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.size()))
│ │ │ +
431 {
│ │ │ +
432 mask.resize(x.size());
│ │ │ +
433 for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
│ │ │ +
434 mask[i] = 1;
│ │ │ +
435 for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
│ │ │ +
436 if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
│ │ │ +
437 mask[i->local().local()] = 0;
│ │ │ +
438 }
│ │ │ +
439 auto result = real_type(0.0);
│ │ │ +
440 for (typename T1::size_type i=0; i<x.size(); i++)
│ │ │ +
441 result += Impl::asVector(x[i]).two_norm2()*mask[i];
│ │ │ +
442 using std::sqrt;
│ │ │ +
443 return sqrt(cc.sum(result));
│ │ │ +
444 }
│ │ │ +
│ │ │ +
445
│ │ │ +
446 typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> CopyFlags;
│ │ │ +
447
│ │ │ +
449 typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> ParallelIndexSet;
│ │ │ +
450
│ │ │ +
452 typedef Dune::RemoteIndices<PIS> RemoteIndices;
│ │ │ +
453
│ │ │ +
456 typedef Dune::GlobalLookupIndexSet<ParallelIndexSet> GlobalLookupIndexSet;
│ │ │ +
457
│ │ │ +
│ │ │ + │ │ │ +
463 {
│ │ │ +
464 return pis;
│ │ │ +
465 }
│ │ │ +
│ │ │ +
466
│ │ │ +
│ │ │ + │ │ │ +
472 {
│ │ │ +
473 return ri;
│ │ │ +
474 }
│ │ │ +
│ │ │ +
475
│ │ │ +
│ │ │ + │ │ │ +
481 {
│ │ │ +
482 return pis;
│ │ │ +
483 }
│ │ │ +
│ │ │ +
484
│ │ │ +
485
│ │ │ +
│ │ │ + │ │ │ +
491 {
│ │ │ +
492 return ri;
│ │ │ +
493 }
│ │ │ +
│ │ │ +
494
│ │ │ +
│ │ │ + │ │ │ +
496 {
│ │ │ +
497 if(globalLookup_) {
│ │ │ +
498 if(pis.seqNo()==oldseqNo)
│ │ │ +
499 // Nothing changed!
│ │ │ +
500 return;
│ │ │ +
501 delete globalLookup_;
│ │ │ +
502 }
│ │ │ +
503
│ │ │ +
504 globalLookup_ = new GlobalLookupIndexSet(pis);
│ │ │ +
505 oldseqNo = pis.seqNo();
│ │ │ +
506 }
│ │ │ +
│ │ │ +
507
│ │ │ +
│ │ │ +
508 void buildGlobalLookup(std::size_t size)
│ │ │ +
509 {
│ │ │ +
510 if(globalLookup_) {
│ │ │ +
511 if(pis.seqNo()==oldseqNo)
│ │ │ +
512 // Nothing changed!
│ │ │ +
513 return;
│ │ │ +
514 delete globalLookup_;
│ │ │ +
515 }
│ │ │ +
516 globalLookup_ = new GlobalLookupIndexSet(pis, size);
│ │ │ +
517 oldseqNo = pis.seqNo();
│ │ │ +
518 }
│ │ │ +
│ │ │ +
519
│ │ │ +
│ │ │ + │ │ │ +
521 {
│ │ │ +
522 delete globalLookup_;
│ │ │ +
523 globalLookup_=0;
│ │ │ +
524 }
│ │ │ +
│ │ │ +
525
│ │ │ +
│ │ │ + │ │ │ +
527 {
│ │ │ +
528 assert(globalLookup_ != 0);
│ │ │ +
529 return *globalLookup_;
│ │ │ +
530 }
│ │ │ +
│ │ │ +
531
│ │ │ +
537 template<class T1>
│ │ │ +
│ │ │ +
538 void project (T1& x) const
│ │ │ +
539 {
│ │ │ +
540 for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
│ │ │ +
541 if (i->local().attribute()==OwnerOverlapCopyAttributeSet::copy)
│ │ │ +
542 x[i->local().local()] = 0;
│ │ │ +
543 }
│ │ │ +
│ │ │ +
544
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
556 bool freecomm_ = false)
│ │ │ +
557 : comm(comm_), cc(comm_), pis(), ri(pis,pis,comm_),
│ │ │ +
558 OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
│ │ │ +
559 OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt(false),
│ │ │ +
560 CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_),
│ │ │ +
561 freecomm(freecomm_)
│ │ │ +
562 {}
│ │ │ +
│ │ │ +
563
│ │ │ +
│ │ │ + │ │ │ +
573 : comm(MPI_COMM_WORLD), cc(MPI_COMM_WORLD), pis(), ri(pis,pis,MPI_COMM_WORLD),
│ │ │ +
574 OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
│ │ │ +
575 OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt(false),
│ │ │ +
576 CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_), freecomm(false)
│ │ │ +
577 {}
│ │ │ +
│ │ │ +
578
│ │ │ +
│ │ │ + │ │ │ +
587 MPI_Comm comm_,
│ │ │ + │ │ │ +
589 bool freecomm_ = false)
│ │ │ +
590 : comm(comm_), cc(comm_), OwnerToAllInterfaceBuilt(false),
│ │ │ +
591 OwnerOverlapToAllInterfaceBuilt(false), OwnerCopyToAllInterfaceBuilt(false),
│ │ │ +
592 OwnerCopyToOwnerCopyInterfaceBuilt(false), CopyToAllInterfaceBuilt(false),
│ │ │ +
593 globalLookup_(0), category_(cat_), freecomm(freecomm_)
│ │ │ +
594 {
│ │ │ +
595 // set up an ISTL index set
│ │ │ +
596 pis.beginResize();
│ │ │ +
597 for (localindex_iterator i=indexinfo.localIndices().begin(); i!=indexinfo.localIndices().end(); ++i)
│ │ │ +
598 {
│ │ │ +
599 if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
│ │ │ +
600 pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::owner,true));
│ │ │ +
601 if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
│ │ │ +
602 pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::overlap,true));
│ │ │ +
603 if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
│ │ │ +
604 pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSet::copy,true));
│ │ │ +
605 // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl;
│ │ │ +
606 }
│ │ │ +
607 pis.endResize();
│ │ │ +
608
│ │ │ +
609 // build remote indices WITHOUT communication
│ │ │ +
610 // std::cout << cc.rank() << ": build remote indices" << std::endl;
│ │ │ +
611 ri.setIndexSets(pis,pis,cc);
│ │ │ +
612 if (indexinfo.remoteIndices().size()>0)
│ │ │ +
613 {
│ │ │ +
614 remoteindex_iterator i=indexinfo.remoteIndices().begin();
│ │ │ +
615 int p = std::get<0>(*i);
│ │ │ +
616 RILM modifier = ri.template getModifier<false,true>(p);
│ │ │ +
617 typename PIS::const_iterator pi=pis.begin();
│ │ │ +
618 for ( ; i!=indexinfo.remoteIndices().end(); ++i)
│ │ │ +
619 {
│ │ │ +
620 // handle processor change
│ │ │ +
621 if (p!=std::get<0>(*i))
│ │ │ +
622 {
│ │ │ +
623 p = std::get<0>(*i);
│ │ │ +
624 modifier = ri.template getModifier<false,true>(p);
│ │ │ +
625 pi=pis.begin();
│ │ │ +
626 }
│ │ │ +
627
│ │ │ +
628 // position to correct entry in parallel index set
│ │ │ +
629 while (pi->global()!=std::get<1>(*i) && pi!=pis.end())
│ │ │ +
630 ++pi;
│ │ │ +
631 if (pi==pis.end())
│ │ │ +
632 DUNE_THROW(ISTLError,"OwnerOverlapCopyCommunication: global index not in index set");
│ │ │ +
633
│ │ │ +
634 // insert entry
│ │ │ +
635 // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << " " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl;
│ │ │ +
636 if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
│ │ │ +
637 modifier.insert(RX(OwnerOverlapCopyAttributeSet::owner,&(*pi)));
│ │ │ +
638 if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
│ │ │ +
639 modifier.insert(RX(OwnerOverlapCopyAttributeSet::overlap,&(*pi)));
│ │ │ +
640 if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
│ │ │ +
641 modifier.insert(RX(OwnerOverlapCopyAttributeSet::copy,&(*pi)));
│ │ │ +
642 }
│ │ │ +
643 }else{
│ │ │ +
644 // Force remote indices to be synced!
│ │ │ +
645 ri.template getModifier<false,true>(0);
│ │ │ +
646 }
│ │ │ +
647 }
│ │ │ +
│ │ │ +
648
│ │ │ +
649 // destructor: free memory in some objects
│ │ │ +
│ │ │ + │ │ │ +
651 {
│ │ │ +
652 ri.free();
│ │ │ +
653 if (OwnerToAllInterfaceBuilt) OwnerToAllInterface.free();
│ │ │ +
654 if (OwnerOverlapToAllInterfaceBuilt) OwnerOverlapToAllInterface.free();
│ │ │ +
655 if (OwnerCopyToAllInterfaceBuilt) OwnerCopyToAllInterface.free();
│ │ │ +
656 if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free();
│ │ │ +
657 if (CopyToAllInterfaceBuilt) CopyToAllInterface.free();
│ │ │ +
658 if (globalLookup_) delete globalLookup_;
│ │ │ +
659 if (freecomm && (comm != MPI_COMM_NULL))
│ │ │ +
660 {
│ │ │ +
661 // If it is possible to query whether MPI_Finalize
│ │ │ +
662 // was called, only free the communicator before
│ │ │ +
663 // calling MPI_Finalize.
│ │ │ +
664 int wasFinalized = 0;
│ │ │ +
665 MPI_Finalized(&wasFinalized);
│ │ │ +
666 if (!wasFinalized) {
│ │ │ +
667 MPI_Comm_free(&comm);
│ │ │ +
668 }
│ │ │ +
669 }
│ │ │ +
670 }
│ │ │ +
│ │ │ +
671
│ │ │ +
672 private:
│ │ │ + │ │ │ +
674 {}
│ │ │ +
675 MPI_Comm comm;
│ │ │ +
676 Communication<MPI_Comm> cc;
│ │ │ +
677 PIS pis;
│ │ │ +
678 RI ri;
│ │ │ +
679 mutable IF OwnerToAllInterface;
│ │ │ +
680 mutable bool OwnerToAllInterfaceBuilt;
│ │ │ +
681 mutable IF OwnerOverlapToAllInterface;
│ │ │ +
682 mutable bool OwnerOverlapToAllInterfaceBuilt;
│ │ │ +
683 mutable IF OwnerCopyToAllInterface;
│ │ │ +
684 mutable bool OwnerCopyToAllInterfaceBuilt;
│ │ │ +
685 mutable IF OwnerCopyToOwnerCopyInterface;
│ │ │ +
686 mutable bool OwnerCopyToOwnerCopyInterfaceBuilt;
│ │ │ +
687 mutable IF CopyToAllInterface;
│ │ │ +
688 mutable bool CopyToAllInterfaceBuilt;
│ │ │ +
689 mutable std::vector<double> mask;
│ │ │ +
690 int oldseqNo;
│ │ │ +
691 GlobalLookupIndexSet* globalLookup_;
│ │ │ +
692 const SolverCategory::Category category_;
│ │ │ +
693 bool freecomm;
│ │ │ +
694 };
│ │ │ +
│ │ │ +
695
│ │ │ +
696#endif
│ │ │ +
697
│ │ │ +
698
│ │ │ +
701} // end namespace
│ │ │ +
702
│ │ │ +
703#endif
│ │ │ + │ │ │ +
void testRedistributed(int s)
│ │ │ +
Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.
│ │ │ + │ │ │
Definition allocator.hh:11
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
Definition matrixutils.hh:211
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ -
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:2007
│ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2001
│ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ -
Definition overlappingschwarz.hh:694
│ │ │ -
Definition matrixutils.hh:27
│ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
int iterations
Number of iterations.
Definition solver.hh:69
│ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │ -
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ +
Attribute set for overlapping Schwarz.
Definition owneroverlapcopy.hh:59
│ │ │ +
AttributeSet
Definition owneroverlapcopy.hh:60
│ │ │ +
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ +
@ copy
Definition owneroverlapcopy.hh:61
│ │ │ +
@ overlap
Definition owneroverlapcopy.hh:61
│ │ │ +
Information about the index distribution.
Definition owneroverlapcopy.hh:78
│ │ │ +
std::tuple< GlobalIdType, LocalIdType, int > IndexTripel
A triple describing a local index.
Definition owneroverlapcopy.hh:92
│ │ │ +
void addRemoteIndex(const RemoteIndexTripel &x)
Add a new remote index triple to the set of remote indices.
Definition owneroverlapcopy.hh:120
│ │ │ +
G GlobalIdType
The type of the global index.
Definition owneroverlapcopy.hh:81
│ │ │ +
const std::set< IndexTripel > & localIndices() const
Get the set of indices local to the process.
Definition owneroverlapcopy.hh:133
│ │ │ +
const std::set< RemoteIndexTripel > & remoteIndices() const
Get the set of remote indices.
Definition owneroverlapcopy.hh:142
│ │ │ +
L LocalIdType
The type of the local index.
Definition owneroverlapcopy.hh:84
│ │ │ +
void clear()
Remove all indices from the sets.
Definition owneroverlapcopy.hh:150
│ │ │ +
void addLocalIndex(const IndexTripel &x)
Add a new index triple to the set of local indices.
Definition owneroverlapcopy.hh:106
│ │ │ +
std::tuple< int, GlobalIdType, int > RemoteIndexTripel
A triple describing a remote index.
Definition owneroverlapcopy.hh:99
│ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet
Definition owneroverlapcopy.hh:195
│ │ │ +
const GlobalLookupIndexSet & globalLookup() const
Definition owneroverlapcopy.hh:526
│ │ │ +
FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const
Compute the global Euclidean norm of a vector.
Definition owneroverlapcopy.hh:425
│ │ │ +
void buildOwnerOverlapToAllInterface() const
Definition owneroverlapcopy.hh:233
│ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS
Definition owneroverlapcopy.hh:188
│ │ │ +
void buildOwnerCopyToAllInterface() const
Definition owneroverlapcopy.hh:254
│ │ │ +
void buildOwnerCopyToOwnerCopyInterface() const
Definition owneroverlapcopy.hh:266
│ │ │ +
OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Constructor.
Definition owneroverlapcopy.hh:586
│ │ │ +
SolverCategory::Category category() const
Get Solver Category.
Definition owneroverlapcopy.hh:295
│ │ │ +
void addOwnerCopyToOwnerCopy(const T &source, T &dest) const
Communicate values from owner and copy data points to owner and copy data points and add them to thos...
Definition owneroverlapcopy.hh:379
│ │ │ +
void buildCopyToAllInterface() const
Definition owneroverlapcopy.hh:279
│ │ │ +
Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags
Definition owneroverlapcopy.hh:446
│ │ │ +
RemoteIndices & remoteIndices()
Get the underlying remote indices.
Definition owneroverlapcopy.hh:490
│ │ │ +
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ +
Dune::RemoteIndices< PIS > RI
Definition owneroverlapcopy.hh:189
│ │ │ +
void buildGlobalLookup(std::size_t size)
Definition owneroverlapcopy.hh:508
│ │ │ +
void addOwnerOverlapToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points and add them to those values.
Definition owneroverlapcopy.hh:345
│ │ │ +
Dune::RemoteIndices< PIS > RemoteIndices
The type of the remote indices.
Definition owneroverlapcopy.hh:452
│ │ │ +
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ +
Dune::AllSet< AttributeSet > AllSet
Definition owneroverlapcopy.hh:197
│ │ │ +
Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > OwnerOverlapSet
Definition owneroverlapcopy.hh:196
│ │ │ +
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ +
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ +
Dune::Interface IF
Definition owneroverlapcopy.hh:193
│ │ │ +
~OwnerOverlapCopyCommunication()
Definition owneroverlapcopy.hh:650
│ │ │ +
void buildGlobalLookup()
Definition owneroverlapcopy.hh:495
│ │ │ +
Dune::BufferedCommunicator BC
Definition owneroverlapcopy.hh:192
│ │ │ +
OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Construct the communication without any indices.
Definition owneroverlapcopy.hh:554
│ │ │ +
ParallelIndexSet & indexSet()
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:480
│ │ │ +
void dot(const T1 &x, const T1 &y, T2 &result) const
Compute a global dot product of two vectors.
Definition owneroverlapcopy.hh:398
│ │ │ +
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ +
OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory::overlapping)
Construct the communication without any indices using MPI_COMM_WORLD.
Definition owneroverlapcopy.hh:572
│ │ │ +
EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet
Definition owneroverlapcopy.hh:194
│ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ +
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ +
friend void loadMatrixMarket(M &, const std::string &, OwnerOverlapCopyCommunication< G, L > &, bool)
Load a parallel matrix/vector stored in matrix market format.
Definition matrixmarket.hh:1269
│ │ │ +
RI::RemoteIndex RX
Definition owneroverlapcopy.hh:191
│ │ │ +
void addOwnerCopyToAll(const T &source, T &dest) const
Communicate values from owner and copy data points to all other data points and add them to those val...
Definition owneroverlapcopy.hh:362
│ │ │ +
void freeGlobalLookup()
Definition owneroverlapcopy.hh:520
│ │ │ +
Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM
Definition owneroverlapcopy.hh:190
│ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ +
void buildOwnerToAllInterface() const
Definition owneroverlapcopy.hh:244
│ │ │ +
gather/scatter callback for communication
Definition owneroverlapcopy.hh:204
│ │ │ +
static V gather(const T &a, std::size_t i)
Definition owneroverlapcopy.hh:207
│ │ │ +
static void scatter(T &a, V v, std::size_t i)
Definition owneroverlapcopy.hh:212
│ │ │ +
CommPolicy< T >::IndexedType V
Definition owneroverlapcopy.hh:205
│ │ │ + │ │ │ +
CommPolicy< T >::IndexedType V
Definition owneroverlapcopy.hh:220
│ │ │ +
static V gather(const T &a, std::size_t i)
Definition owneroverlapcopy.hh:222
│ │ │ +
static void scatter(T &a, V v, std::size_t i)
Definition owneroverlapcopy.hh:227
│ │ │
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
Definition solverregistry.hh:77
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ -
Use the SPQR package to directly solve linear systems – empty default class.
Definition spqr.hh:48
│ │ │ -
Definition spqr.hh:333
│ │ │ -
Definition spqr.hh:334
│ │ │ +
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,502 +1,837 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -spqr.hh │ │ │ │ +owneroverlapcopy.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SPQR_HH │ │ │ │ -6#define DUNE_ISTL_SPQR_HH │ │ │ │ +5#ifndef DUNE_ISTL_OWNEROVERLAPCOPY_HH │ │ │ │ +6#define DUNE_ISTL_OWNEROVERLAPCOPY_HH │ │ │ │ 7 │ │ │ │ -8#if HAVE_SUITESPARSE_SPQR || defined DOXYGEN │ │ │ │ -9 │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12 │ │ │ │ -13#include │ │ │ │ -14 │ │ │ │ -15#include │ │ │ │ -16 │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ -21 │ │ │ │ -22namespace _D_u_n_e { │ │ │ │ -34 // forward declarations │ │ │ │ -35 template │ │ │ │ -36 class SeqOverlappingSchwarz; │ │ │ │ -37 │ │ │ │ -38 template │ │ │ │ -39 struct SeqOverlappingSchwarzAssemblerHelper; │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15 │ │ │ │ +16#include │ │ │ │ +17 │ │ │ │ +18// MPI header │ │ │ │ +19#if HAVE_MPI │ │ │ │ +20#include │ │ │ │ +21#endif │ │ │ │ +22 │ │ │ │ +23#include │ │ │ │ +24 │ │ │ │ +25#if HAVE_MPI │ │ │ │ +26#include │ │ │ │ +27#include │ │ │ │ +28#include │ │ │ │ +29#include │ │ │ │ +30#endif │ │ │ │ +31 │ │ │ │ +32#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ +33#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ +34#include │ │ │ │ +35#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_m_a_r_k_e_t_._h_h> │ │ │ │ +36 │ │ │ │ +37template class Comm> │ │ │ │ +_3_8void _t_e_s_t_R_e_d_i_s_t_r_i_b_u_t_e_d(int s); │ │ │ │ +39 │ │ │ │ 40 │ │ │ │ -46 template │ │ │ │ -_4_7 class _S_P_Q_R │ │ │ │ -48 {}; │ │ │ │ -49 │ │ │ │ -63 template │ │ │ │ -_6_4 class _S_P_Q_R<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A > > │ │ │ │ -65 : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc > >, │ │ │ │ -66 BlockVector, typename std::allocator_traits::template │ │ │ │ -rebind_alloc > > > │ │ │ │ -67 { │ │ │ │ -68 public: │ │ │ │ -_7_0 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_>,A> _M_a_t_r_i_x; │ │ │ │ -_7_1 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_>,A> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_7_3 typedef ISTL::Impl::BCCSMatrix _S_P_Q_R_M_a_t_r_i_x; │ │ │ │ -_7_5 typedef ISTL::Impl::BCCSMatrixInitializer,A>, │ │ │ │ -int> _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ -_7_7 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_T_,_m_>, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc > > _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_7_9 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_T_,_n_>, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc > > _r_a_n_g_e___t_y_p_e; │ │ │ │ -80 │ │ │ │ -_8_2 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -83 { │ │ │ │ -84 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -85 } │ │ │ │ -86 │ │ │ │ -_9_5 _S_P_Q_R(const _M_a_t_r_i_x& matrix, int verbose=0) : matrixIsLoaded_(false), verbose_ │ │ │ │ -(verbose) │ │ │ │ -96 { │ │ │ │ -97 //check whether T is a supported type │ │ │ │ -98 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -99 "Unsupported Type in SPQR (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -100 cc_ = new cholmod_common(); │ │ │ │ -101 cholmod_l_start(cc_); │ │ │ │ -102 setMatrix(matrix); │ │ │ │ -103 } │ │ │ │ -104 │ │ │ │ -_1_1_3 _S_P_Q_R(const _M_a_t_r_i_x& matrix, int verbose, bool) : matrixIsLoaded_(false), │ │ │ │ -verbose_(verbose) │ │ │ │ -114 { │ │ │ │ -115 //check whether T is a supported type │ │ │ │ -116 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -117 "Unsupported Type in SPQR (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -118 cc_ = new cholmod_common(); │ │ │ │ -119 cholmod_l_start(cc_); │ │ │ │ -120 setMatrix(matrix); │ │ │ │ -121 } │ │ │ │ -122 │ │ │ │ -_1_3_2 _S_P_Q_R(const _M_a_t_r_i_x& matrix, const ParameterTree& config) │ │ │ │ -133 : _S_P_Q_R(matrix, config._g_e_t("verbose", 0)) │ │ │ │ -134 {} │ │ │ │ -135 │ │ │ │ -_1_3_7 _S_P_Q_R() : matrixIsLoaded_(false), verbose_(0) │ │ │ │ -138 { │ │ │ │ -139 //check whether T is a supported type │ │ │ │ -140 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -141 "Unsupported Type in SPQR (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -142 cc_ = new cholmod_common(); │ │ │ │ -143 cholmod_l_start(cc_); │ │ │ │ -144 } │ │ │ │ -145 │ │ │ │ -_1_4_7 virtual _~_S_P_Q_R() │ │ │ │ -148 { │ │ │ │ -149 if ((spqrMatrix_.N() + spqrMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -150 free(); │ │ │ │ -151 cholmod_l_finish(cc_); │ │ │ │ -152 } │ │ │ │ -153 │ │ │ │ -_1_5_5 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ -res) │ │ │ │ -156 { │ │ │ │ -157 const std::size_t numRows(spqrMatrix_.N()); │ │ │ │ -158 // fill B │ │ │ │ -159 for(std::size_t k = 0; k != numRows/n; ++k) │ │ │ │ -160 for (int l = 0; l < n; ++l) │ │ │ │ -161 (static_cast(B_->x))[n*k+l] = b[k][l]; │ │ │ │ +41namespace _D_u_n_e { │ │ │ │ +42 │ │ │ │ +_5_8 struct _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ +59 { │ │ │ │ +_6_0 enum _A_t_t_r_i_b_u_t_e_S_e_t { │ │ │ │ +_6_1 _o_w_n_e_r=1, _o_v_e_r_l_a_p=2, _c_o_p_y=3 │ │ │ │ +_6_2 }; │ │ │ │ +63 }; │ │ │ │ +64 │ │ │ │ +76 template │ │ │ │ +_7_7 class _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d │ │ │ │ +78 { │ │ │ │ +79 public: │ │ │ │ +_8_1 typedef G _G_l_o_b_a_l_I_d_T_y_p_e; │ │ │ │ +82 │ │ │ │ +_8_4 typedef L _L_o_c_a_l_I_d_T_y_p_e; │ │ │ │ +85 │ │ │ │ +_9_2 typedef std::tuple _I_n_d_e_x_T_r_i_p_e_l; │ │ │ │ +_9_9 typedef std::tuple _R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l; │ │ │ │ +100 │ │ │ │ +_1_0_6 void _a_d_d_L_o_c_a_l_I_n_d_e_x (const _I_n_d_e_x_T_r_i_p_e_l& x) │ │ │ │ +107 { │ │ │ │ +108 if (std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r && │ │ │ │ +109 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p && │ │ │ │ +110 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ +111 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ +index set"); │ │ │ │ +112 localindices.insert(x); │ │ │ │ +113 } │ │ │ │ +114 │ │ │ │ +_1_2_0 void _a_d_d_R_e_m_o_t_e_I_n_d_e_x (const _R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l& x) │ │ │ │ +121 { │ │ │ │ +122 if (std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r && │ │ │ │ +123 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p && │ │ │ │ +124 std::get<2>(x)!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ +125 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ +index set"); │ │ │ │ +126 remoteindices.insert(x); │ │ │ │ +127 } │ │ │ │ +128 │ │ │ │ +_1_3_3 const std::set& _l_o_c_a_l_I_n_d_i_c_e_s () const │ │ │ │ +134 { │ │ │ │ +135 return localindices; │ │ │ │ +136 } │ │ │ │ +137 │ │ │ │ +_1_4_2 const std::set& _r_e_m_o_t_e_I_n_d_i_c_e_s () const │ │ │ │ +143 { │ │ │ │ +144 return remoteindices; │ │ │ │ +145 } │ │ │ │ +146 │ │ │ │ +_1_5_0 void _c_l_e_a_r () │ │ │ │ +151 { │ │ │ │ +152 localindices.clear(); │ │ │ │ +153 remoteindices.clear(); │ │ │ │ +154 } │ │ │ │ +155 │ │ │ │ +156 private: │ │ │ │ +158 std::set localindices; │ │ │ │ +160 std::set remoteindices; │ │ │ │ +161 }; │ │ │ │ 162 │ │ │ │ -163 cholmod_dense* BTemp = B_; │ │ │ │ -164 B_ = SuiteSparseQR_qmult(0, spqrfactorization_, B_, cc_); │ │ │ │ -165 cholmod_dense* X = SuiteSparseQR_solve(1, spqrfactorization_, B_, cc_); │ │ │ │ -166 cholmod_l_free_dense(&BTemp, cc_); │ │ │ │ -167 │ │ │ │ -168 const std::size_t numCols(spqrMatrix_.M()); │ │ │ │ -169 // fill x │ │ │ │ -170 for(std::size_t k = 0; k != numCols/m; ++k) │ │ │ │ -171 for (int l = 0; l < m; ++l) │ │ │ │ -172 x[k][l] = (static_cast(X->x))[m*k+l]; │ │ │ │ -173 │ │ │ │ -174 cholmod_l_free_dense(&X, cc_); │ │ │ │ -175 // this is a direct solver │ │ │ │ -176 res._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ -177 res._c_o_n_v_e_r_g_e_d = true; │ │ │ │ -178 if(verbose_ > 0) │ │ │ │ -179 { │ │ │ │ -180 std::cout<SPQR_flopcount<SPQR_analyze_time<<" s"<SPQR_factorize_time<<" s"<SPQR_solve_time<<" s"<memory_usage<<" bytes"<SPQR_istat[4]< 0) || matrixIsLoaded_) │ │ │ │ -203 free(); │ │ │ │ -204 │ │ │ │ -205 if (spqrMatrix_.N() + spqrMatrix_.M() + spqrMatrix_.nonzeroes() != 0) │ │ │ │ -206 spqrMatrix_.free(); │ │ │ │ -207 spqrMatrix_.setSize(_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(matrix), │ │ │ │ -208 _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(matrix)); │ │ │ │ -209 ISTL::Impl::BCCSMatrixInitializer initializer(spqrMatrix_); │ │ │ │ -210 │ │ │ │ -211 copyToBCCSMatrix(initializer, matrix); │ │ │ │ -212 │ │ │ │ -213 decompose(); │ │ │ │ -214 } │ │ │ │ -215 │ │ │ │ -216 template │ │ │ │ -_2_1_7 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix, const S& rowIndexSet) │ │ │ │ -218 { │ │ │ │ -219 if ((spqrMatrix_.N() + spqrMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -220 free(); │ │ │ │ +163 │ │ │ │ +164#if HAVE_MPI │ │ │ │ +165 │ │ │ │ +172 template │ │ │ │ +_1_7_3 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +174 { │ │ │ │ +175 template │ │ │ │ +176 friend void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M&, │ │ │ │ +177 const std::string&, │ │ │ │ +178 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>&, │ │ │ │ +179 bool); │ │ │ │ +180 // used types │ │ │ │ +181 typedef typename _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_,_L_o_c_a_l_I_d_T_y_p_e_>_:_:_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ +IndexTripel; │ │ │ │ +182 typedef typename _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_,_L_o_c_a_l_I_d_T_y_p_e_>_:_: │ │ │ │ +_R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l RemoteIndexTripel; │ │ │ │ +183 typedef typename std::set::const_iterator localindex_iterator; │ │ │ │ +184 typedef typename std::set::const_iterator │ │ │ │ +remoteindex_iterator; │ │ │ │ +185 typedef typename _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_A_t_t_r_i_b_u_t_e_S_e_t _A_t_t_r_i_b_u_t_e_S_e_t; │ │ │ │ +186 typedef Dune::ParallelLocalIndex LI; │ │ │ │ +187 public: │ │ │ │ +_1_8_8 typedef Dune::ParallelIndexSet _P_I_S; │ │ │ │ +_1_8_9 typedef Dune::RemoteIndices _R_I; │ │ │ │ +_1_9_0 typedef Dune::RemoteIndexListModifier │ │ │ │ +_R_I_L_M; │ │ │ │ +_1_9_1 typedef typename RI::RemoteIndex _R_X; │ │ │ │ +_1_9_2 typedef Dune::BufferedCommunicator _B_C; │ │ │ │ +_1_9_3 typedef Dune::Interface _I_F; │ │ │ │ +_1_9_4 typedef EnumItem │ │ │ │ +_O_w_n_e_r_S_e_t; │ │ │ │ +_1_9_5 typedef EnumItem _C_o_p_y_S_e_t; │ │ │ │ +_1_9_6 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> _O_w_n_e_r_O_v_e_r_l_a_p_S_e_t; │ │ │ │ +_1_9_7 typedef Dune::AllSet _A_l_l_S_e_t; │ │ │ │ +198 protected: │ │ │ │ +199 │ │ │ │ +200 │ │ │ │ +202 template │ │ │ │ +_2_0_3 struct _C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ +204 { │ │ │ │ +_2_0_5 typedef typename CommPolicy::IndexedType _V; │ │ │ │ +206 │ │ │ │ +_2_0_7 static _V _g_a_t_h_e_r(const T& a, std::size_t i) │ │ │ │ +208 { │ │ │ │ +209 return a[i]; │ │ │ │ +210 } │ │ │ │ +211 │ │ │ │ +_2_1_2 static void _s_c_a_t_t_e_r(T& a, _V v, std::size_t i) │ │ │ │ +213 { │ │ │ │ +214 a[i] = v; │ │ │ │ +215 } │ │ │ │ +216 }; │ │ │ │ +217 template │ │ │ │ +_2_1_8 struct _A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ +219 { │ │ │ │ +_2_2_0 typedef typename CommPolicy::IndexedType _V; │ │ │ │ 221 │ │ │ │ -222 if (spqrMatrix_.N() + spqrMatrix_.M() + spqrMatrix_.nonzeroes() != 0) │ │ │ │ -223 spqrMatrix_.free(); │ │ │ │ -224 │ │ │ │ -225 spqrMatrix_.setSize(rowIndexSet.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m │ │ │ │ -(matrix) / matrix._N(), │ │ │ │ -226 rowIndexSet.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(matrix) / matrix._M()); │ │ │ │ -227 ISTL::Impl::BCCSMatrixInitializer initializer(spqrMatrix_); │ │ │ │ -228 │ │ │ │ -229 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ -set >(matrix,rowIndexSet)); │ │ │ │ -230 │ │ │ │ -231 decompose(); │ │ │ │ -232 } │ │ │ │ -233 │ │ │ │ -_2_3_8 inline void _s_e_t_V_e_r_b_o_s_i_t_y(int v) │ │ │ │ -239 { │ │ │ │ -240 verbose_=v; │ │ │ │ -241 } │ │ │ │ -242 │ │ │ │ -_2_4_7 inline SuiteSparseQR_factorization* _g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n() │ │ │ │ -248 { │ │ │ │ -249 return spqrfactorization_; │ │ │ │ -250 } │ │ │ │ -251 │ │ │ │ -_2_5_6 inline _S_P_Q_R_M_a_t_r_i_x& _g_e_t_I_n_t_e_r_n_a_l_M_a_t_r_i_x() │ │ │ │ -257 { │ │ │ │ -258 return spqrMatrix_; │ │ │ │ -259 } │ │ │ │ -260 │ │ │ │ -_2_6_5 void _f_r_e_e() │ │ │ │ -266 { │ │ │ │ -267 cholmod_l_free_sparse(&A_, cc_); │ │ │ │ -268 cholmod_l_free_dense(&B_, cc_); │ │ │ │ -269 SuiteSparseQR_free(&spqrfactorization_, cc_); │ │ │ │ -270 spqrMatrix_.free(); │ │ │ │ -271 matrixIsLoaded_ = false; │ │ │ │ -272 } │ │ │ │ -273 │ │ │ │ -_2_7_5 inline const char* _n_a_m_e() │ │ │ │ -276 { │ │ │ │ -277 return "SPQR"; │ │ │ │ -278 } │ │ │ │ -279 │ │ │ │ -280 private: │ │ │ │ -281 template │ │ │ │ -_2_8_2 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -283 │ │ │ │ -284 friend struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r<_S_P_Q_R<_M_a_t_r_i_x>,true>; │ │ │ │ -285 │ │ │ │ -287 void decompose() │ │ │ │ -288 { │ │ │ │ -289 const std::size_t nrows(spqrMatrix_.N()); │ │ │ │ -290 const std::size_t ncols(spqrMatrix_.M()); │ │ │ │ -291 const std::size_t nnz(spqrMatrix_.getColStart()[ncols]); │ │ │ │ -292 │ │ │ │ -293 // initialise the matrix A (sorted, packed, unsymmetric, real entries) │ │ │ │ -294 A_ = cholmod_l_allocate_sparse(nrows, ncols, nnz, 1, 1, 0, 1, cc_); │ │ │ │ -295 │ │ │ │ -296 // copy all the entries of Ap, Ai, Ax │ │ │ │ -297 for(std::size_t k = 0; k != (ncols+1); ++k) │ │ │ │ -298 (static_cast(A_->p))[k] = spqrMatrix_.getColStart()[k]; │ │ │ │ -299 │ │ │ │ -300 for(std::size_t k = 0; k != nnz; ++k) │ │ │ │ -301 { │ │ │ │ -302 (static_cast(A_->i))[k] = spqrMatrix_.getRowIndex()[k]; │ │ │ │ -303 (static_cast(A_->x))[k] = spqrMatrix_.getValues()[k]; │ │ │ │ -304 } │ │ │ │ -305 │ │ │ │ -306 // initialise the vector B │ │ │ │ -307 B_ = cholmod_l_allocate_dense(nrows, 1, nrows, A_->xtype, cc_); │ │ │ │ -308 // compute factorization of A │ │ │ │ -309 spqrfactorization_=SuiteSparseQR_factorize │ │ │ │ -(SPQR_ORDERING_DEFAULT,SPQR_DEFAULT_TOL,A_,cc_); │ │ │ │ -310 } │ │ │ │ -311 │ │ │ │ -312 SPQRMatrix spqrMatrix_; │ │ │ │ -313 bool matrixIsLoaded_; │ │ │ │ -314 int verbose_; │ │ │ │ -315 cholmod_common* cc_; │ │ │ │ -316 cholmod_sparse* A_; │ │ │ │ -317 cholmod_dense* B_; │ │ │ │ -318 SuiteSparseQR_factorization* spqrfactorization_; │ │ │ │ -319 }; │ │ │ │ +_2_2_2 static _V _g_a_t_h_e_r(const T& a, std::size_t i) │ │ │ │ +223 { │ │ │ │ +224 return a[i]; │ │ │ │ +225 } │ │ │ │ +226 │ │ │ │ +_2_2_7 static void _s_c_a_t_t_e_r(T& a, _V v, std::size_t i) │ │ │ │ +228 { │ │ │ │ +229 a[i] += v; │ │ │ │ +230 } │ │ │ │ +231 }; │ │ │ │ +232 │ │ │ │ +_2_3_3 void _b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ +234 { │ │ │ │ +235 if (OwnerOverlapToAllInterfaceBuilt) │ │ │ │ +236 OwnerOverlapToAllInterface.free(); │ │ │ │ +237 _O_w_n_e_r_O_v_e_r_l_a_p_S_e_t sourceFlags; │ │ │ │ +238 │ │ │ │ +Combine,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ +239 destFlags; │ │ │ │ +240 OwnerOverlapToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ +241 OwnerOverlapToAllInterfaceBuilt = true; │ │ │ │ +242 } │ │ │ │ +243 │ │ │ │ +_2_4_4 void _b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ +245 { │ │ │ │ +246 if (OwnerToAllInterfaceBuilt) │ │ │ │ +247 OwnerToAllInterface.free(); │ │ │ │ +248 _O_w_n_e_r_S_e_t sourceFlags; │ │ │ │ +249 _A_l_l_S_e_t destFlags; │ │ │ │ +250 OwnerToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ +251 OwnerToAllInterfaceBuilt = true; │ │ │ │ +252 } │ │ │ │ +253 │ │ │ │ +_2_5_4 void _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ +255 { │ │ │ │ +256 if (OwnerCopyToAllInterfaceBuilt) │ │ │ │ +257 OwnerCopyToAllInterface.free(); │ │ │ │ +258 │ │ │ │ +259 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ +OwnerCopySet; │ │ │ │ +260 OwnerCopySet sourceFlags; │ │ │ │ +261 Combine,_A_t_t_r_i_b_u_t_e_S_e_t> destFlags; │ │ │ │ +262 OwnerCopyToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ +263 OwnerCopyToAllInterfaceBuilt = true; │ │ │ │ +264 } │ │ │ │ +265 │ │ │ │ +_2_6_6 void _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e () const │ │ │ │ +267 { │ │ │ │ +268 if (OwnerCopyToOwnerCopyInterfaceBuilt) │ │ │ │ +269 OwnerCopyToOwnerCopyInterface.free(); │ │ │ │ +270 │ │ │ │ +271 │ │ │ │ +272 typedef Combine,EnumItem,_A_t_t_r_i_b_u_t_e_S_e_t> │ │ │ │ +OwnerCopySet; │ │ │ │ +273 OwnerCopySet sourceFlags; │ │ │ │ +274 OwnerCopySet destFlags; │ │ │ │ +275 OwnerCopyToOwnerCopyInterface.build(ri,sourceFlags,destFlags); │ │ │ │ +276 OwnerCopyToOwnerCopyInterfaceBuilt = true; │ │ │ │ +277 } │ │ │ │ +278 │ │ │ │ +_2_7_9 void _b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e () const │ │ │ │ +280 { │ │ │ │ +281 if (CopyToAllInterfaceBuilt) │ │ │ │ +282 CopyToAllInterface.free(); │ │ │ │ +283 _C_o_p_y_S_e_t sourceFlags; │ │ │ │ +284 _A_l_l_S_e_t destFlags; │ │ │ │ +285 CopyToAllInterface.build(ri,sourceFlags,destFlags); │ │ │ │ +286 CopyToAllInterfaceBuilt = true; │ │ │ │ +287 } │ │ │ │ +288 │ │ │ │ +289 public: │ │ │ │ +290 │ │ │ │ +_2_9_5 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y () const { │ │ │ │ +296 return category_; │ │ │ │ +297 } │ │ │ │ +298 │ │ │ │ +_2_9_9 const Communication& _c_o_m_m_u_n_i_c_a_t_o_r() const │ │ │ │ +300 { │ │ │ │ +301 return cc; │ │ │ │ +302 } │ │ │ │ +303 │ │ │ │ +310 template │ │ │ │ +_3_1_1 void _c_o_p_y_O_w_n_e_r_T_o_A_l_l (const T& source, T& dest) const │ │ │ │ +312 { │ │ │ │ +313 if (!OwnerToAllInterfaceBuilt) │ │ │ │ +314 _b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e (); │ │ │ │ +315 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ +316 _c_o_m_m_u_n_i_c_a_t_o_r.template build(OwnerToAllInterface); │ │ │ │ +317 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ +318 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ +319 } │ │ │ │ 320 │ │ │ │ -321 template │ │ │ │ -_3_2_2 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_S_P_Q_R<_B_C_R_S_M_a_t_r_i_x > > │ │ │ │ -323 { │ │ │ │ -_3_2_4 enum {_v_a_l_u_e = true}; │ │ │ │ -325 }; │ │ │ │ -326 │ │ │ │ -327 template │ │ │ │ -_3_2_8 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d<_S_P_Q_R<_B_C_R_S_M_a_t_r_i_x > > │ │ │ │ +327 template │ │ │ │ +_3_2_8 void _c_o_p_y_C_o_p_y_T_o_A_l_l (const T& source, T& dest) const │ │ │ │ 329 { │ │ │ │ -_3_3_0 enum {_v_a_l_u_e = true}; │ │ │ │ -331 }; │ │ │ │ -332 │ │ │ │ -_3_3_3 struct _S_P_Q_R_C_r_e_a_t_o_r { │ │ │ │ -_3_3_4 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std::false_type{}; │ │ │ │ -335 │ │ │ │ -336 template │ │ │ │ -337 std::shared_ptr::type, │ │ │ │ -338 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ -_3_3_9 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& config, │ │ │ │ -340 std::enable_if_t< │ │ │ │ -341 _i_s_V_a_l_i_d_B_l_o_c_k::type::block_type>:: │ │ │ │ -value,int> = 0) const │ │ │ │ -342 { │ │ │ │ -343 int verbose = config.get("verbose", 0); │ │ │ │ -344 return std::make_shared>(_m_a_t,verbose); │ │ │ │ -345 } │ │ │ │ -346 │ │ │ │ -347 // second version with SFINAE to validate the template parameters of SPQR │ │ │ │ -348 template │ │ │ │ -349 std::shared_ptr::type, │ │ │ │ -350 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ -_3_5_1 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& / │ │ │ │ -*config*/, │ │ │ │ -352 std::enable_if_t:: │ │ │ │ -type::block_type>::value,int> = 0) const │ │ │ │ -353 { │ │ │ │ -354 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ -355 "Unsupported Type in SPQR (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -356 } │ │ │ │ -357 }; │ │ │ │ -_3_5_8 template<> struct _S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k> : std:: │ │ │ │ -true_type{}; │ │ │ │ -359 // std::complex is temporary disabled, because it fails if libc++ is used │ │ │ │ -360 //template<> struct SPQRCreator::isValidMatrixBlock,1,1>> : std::true_type{}; │ │ │ │ -_3_6_1 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("spqr", _D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r()); │ │ │ │ -362 │ │ │ │ -363} // end namespace Dune │ │ │ │ -364 │ │ │ │ -365 │ │ │ │ -366#endif //HAVE_SUITESPARSE_SPQR │ │ │ │ -367#endif //DUNE_ISTL_SPQR_HH │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ -_s_o_l_v_e_r_s_._h_h │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ -_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ -_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > matrix_type │ │ │ │ -DDeeffiinniittiioonn spqr.hh:71 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_~_S_P_Q_R │ │ │ │ -virtual ~SPQR() │ │ │ │ -Destructor. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:147 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_S_P_Q_R │ │ │ │ -SPQR(const Matrix &matrix, int verbose, bool) │ │ │ │ -Constructor for compatibility with SuperLU standard constructor. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:113 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn spqr.hh:82 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_I_n_t_e_r_n_a_l_M_a_t_r_i_x │ │ │ │ -SPQRMatrix & getInternalMatrix() │ │ │ │ -Return the column coppressed matrix. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:256 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -void setMatrix(const Matrix &matrix) │ │ │ │ -Initialize data from given matrix. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:200 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ -ISTL::Impl::BCCSMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A >, int │ │ │ │ -> MatrixInitializer │ │ │ │ -Type of an associated initializer class. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:75 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ -Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ -The matrix type. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:70 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_S_P_Q_R │ │ │ │ -SPQR() │ │ │ │ -Default constructor. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:137 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL │ │ │ │ ->::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const │ │ │ │ -M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< │ │ │ │ -typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) │ │ │ │ +330 if (!CopyToAllInterfaceBuilt) │ │ │ │ +331 _b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e (); │ │ │ │ +332 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ +333 _c_o_m_m_u_n_i_c_a_t_o_r.template build(CopyToAllInterface); │ │ │ │ +334 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ +335 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ +336 } │ │ │ │ +337 │ │ │ │ +344 template │ │ │ │ +_3_4_5 void _a_d_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l (const T& source, T& dest) const │ │ │ │ +346 { │ │ │ │ +347 if (!OwnerOverlapToAllInterfaceBuilt) │ │ │ │ +348 _b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e (); │ │ │ │ +349 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ +350 _c_o_m_m_u_n_i_c_a_t_o_r.template build(OwnerOverlapToAllInterface); │ │ │ │ +351 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ +352 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ +353 } │ │ │ │ +354 │ │ │ │ +361 template │ │ │ │ +_3_6_2 void _a_d_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l (const T& source, T& dest) const │ │ │ │ +363 { │ │ │ │ +364 if (!OwnerCopyToAllInterfaceBuilt) │ │ │ │ +365 _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e (); │ │ │ │ +366 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ +367 _c_o_m_m_u_n_i_c_a_t_o_r.template build(OwnerCopyToAllInterface); │ │ │ │ +368 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ +369 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ +370 } │ │ │ │ +371 │ │ │ │ +378 template │ │ │ │ +_3_7_9 void _a_d_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y (const T& source, T& dest) const │ │ │ │ +380 { │ │ │ │ +381 if (!OwnerCopyToOwnerCopyInterfaceBuilt) │ │ │ │ +382 _b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e (); │ │ │ │ +383 _B_C _c_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ +384 _c_o_m_m_u_n_i_c_a_t_o_r.template build(OwnerCopyToOwnerCopyInterface); │ │ │ │ +385 _c_o_m_m_u_n_i_c_a_t_o_r.template forward >(source,dest); │ │ │ │ +386 _c_o_m_m_u_n_i_c_a_t_o_r.free(); │ │ │ │ +387 } │ │ │ │ +388 │ │ │ │ +389 │ │ │ │ +397 template │ │ │ │ +_3_9_8 void _d_o_t (const T1& x, const T1& y, T2& result) const │ │ │ │ +399 { │ │ │ │ +400 using real_type = typename FieldTraits::real_type; │ │ │ │ +401 // set up mask vector │ │ │ │ +402 if (mask.size()!=static_cast::size_type> │ │ │ │ +(x.size())) │ │ │ │ +403 { │ │ │ │ +404 mask.resize(x.size()); │ │ │ │ +405 for (typename std::vector::size_type i=0; ilocal().attribute()!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ +409 mask[i->local().local()] = 0; │ │ │ │ +410 } │ │ │ │ +411 result = T2(0.0); │ │ │ │ +412 │ │ │ │ +413 for (typename T1::size_type i=0; i(mask[i]); │ │ │ │ +415 result = cc.sum(result); │ │ │ │ +416 } │ │ │ │ +417 │ │ │ │ +424 template │ │ │ │ +_4_2_5 typename FieldTraits::real_type _n_o_r_m (const T1& x) │ │ │ │ const │ │ │ │ -DDeeffiinniittiioonn spqr.hh:339 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_n_a_m_e │ │ │ │ -const char * name() │ │ │ │ -Get method name. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:275 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n │ │ │ │ -SuiteSparseQR_factorization< T > * getFactorization() │ │ │ │ -Return the matrix factorization. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:247 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_V_e_r_b_o_s_i_t_y │ │ │ │ -void setVerbosity(int v) │ │ │ │ -Sets the verbosity level for the solver. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:238 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_S_P_Q_R_M_a_t_r_i_x │ │ │ │ -ISTL::Impl::BCCSMatrix< T, int > SPQRMatrix │ │ │ │ -The corresponding SuperLU Matrix type. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:73 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ -InverseOperatorResult &res) │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:191 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_f_r_e_e │ │ │ │ -void free() │ │ │ │ -Free allocated space. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:265 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_S_P_Q_R │ │ │ │ -SPQR(const Matrix &matrix, const ParameterTree &config) │ │ │ │ -Constructs the SPQR solver. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:132 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Dune::BlockVector< FieldVector< T, n >, typename std::allocator_traits< A >:: │ │ │ │ -template rebind_alloc< FieldVector< T, n > > > range_type │ │ │ │ -The type of the range of the solver. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:79 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ -void setSubMatrix(const Matrix &matrix, const S &rowIndexSet) │ │ │ │ -DDeeffiinniittiioonn spqr.hh:217 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -Dune::BlockVector< FieldVector< T, m >, typename std::allocator_traits< A >:: │ │ │ │ -template rebind_alloc< FieldVector< T, m > > > domain_type │ │ │ │ -The type of the domain of the solver. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:77 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:155 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_O_p_t_i_o_n │ │ │ │ -void setOption(unsigned int option, double value) │ │ │ │ -DDeeffiinniittiioonn spqr.hh:196 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_S_P_Q_R │ │ │ │ -SPQR(const Matrix &matrix, int verbose=0) │ │ │ │ -Construct a solver object from a BCRSMatrix. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:95 │ │ │ │ -_m_a_t │ │ │ │ -Matrix & mat │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ +426 { │ │ │ │ +427 using real_type = typename FieldTraits::real_type; │ │ │ │ +428 │ │ │ │ +429 // set up mask vector │ │ │ │ +430 if (mask.size()!=static_cast::size_type> │ │ │ │ +(x.size())) │ │ │ │ +431 { │ │ │ │ +432 mask.resize(x.size()); │ │ │ │ +433 for (typename std::vector::size_type i=0; ilocal().attribute()!=_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ +437 mask[i->local().local()] = 0; │ │ │ │ +438 } │ │ │ │ +439 auto result = real_type(0.0); │ │ │ │ +440 for (typename T1::size_type i=0; i │ │ │ │ +_C_o_p_y_F_l_a_g_s; │ │ │ │ +447 │ │ │ │ +_4_4_9 typedef Dune::ParallelIndexSet _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ +450 │ │ │ │ +_4_5_2 typedef Dune::RemoteIndices _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ +453 │ │ │ │ +_4_5_6 typedef Dune::GlobalLookupIndexSet _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ +457 │ │ │ │ +_4_6_2 const _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& _i_n_d_e_x_S_e_t() const │ │ │ │ +463 { │ │ │ │ +464 return pis; │ │ │ │ +465 } │ │ │ │ +466 │ │ │ │ +_4_7_1 const _R_e_m_o_t_e_I_n_d_i_c_e_s& _r_e_m_o_t_e_I_n_d_i_c_e_s() const │ │ │ │ +472 { │ │ │ │ +473 return ri; │ │ │ │ +474 } │ │ │ │ +475 │ │ │ │ +_4_8_0 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& _i_n_d_e_x_S_e_t() │ │ │ │ +481 { │ │ │ │ +482 return pis; │ │ │ │ +483 } │ │ │ │ +484 │ │ │ │ +485 │ │ │ │ +_4_9_0 _R_e_m_o_t_e_I_n_d_i_c_e_s& _r_e_m_o_t_e_I_n_d_i_c_e_s() │ │ │ │ +491 { │ │ │ │ +492 return ri; │ │ │ │ +493 } │ │ │ │ +494 │ │ │ │ +_4_9_5 void _b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p() │ │ │ │ +496 { │ │ │ │ +497 if(globalLookup_) { │ │ │ │ +498 if(pis.seqNo()==oldseqNo) │ │ │ │ +499 // Nothing changed! │ │ │ │ +500 return; │ │ │ │ +501 delete globalLookup_; │ │ │ │ +502 } │ │ │ │ +503 │ │ │ │ +504 globalLookup_ = new _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t(pis); │ │ │ │ +505 oldseqNo = pis.seqNo(); │ │ │ │ +506 } │ │ │ │ +507 │ │ │ │ +_5_0_8 void _b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(std::size_t size) │ │ │ │ +509 { │ │ │ │ +510 if(globalLookup_) { │ │ │ │ +511 if(pis.seqNo()==oldseqNo) │ │ │ │ +512 // Nothing changed! │ │ │ │ +513 return; │ │ │ │ +514 delete globalLookup_; │ │ │ │ +515 } │ │ │ │ +516 globalLookup_ = new _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t(pis, size); │ │ │ │ +517 oldseqNo = pis.seqNo(); │ │ │ │ +518 } │ │ │ │ +519 │ │ │ │ +_5_2_0 void _f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p() │ │ │ │ +521 { │ │ │ │ +522 delete globalLookup_; │ │ │ │ +523 globalLookup_=0; │ │ │ │ +524 } │ │ │ │ +525 │ │ │ │ +_5_2_6 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& _g_l_o_b_a_l_L_o_o_k_u_p() const │ │ │ │ +527 { │ │ │ │ +528 assert(globalLookup_ != 0); │ │ │ │ +529 return *globalLookup_; │ │ │ │ +530 } │ │ │ │ +531 │ │ │ │ +537 template │ │ │ │ +_5_3_8 void _p_r_o_j_e_c_t (T1& x) const │ │ │ │ +539 { │ │ │ │ +540 for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i) │ │ │ │ +541 if (i->local().attribute()==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ +542 x[i->local().local()] = 0; │ │ │ │ +543 } │ │ │ │ +544 │ │ │ │ +_5_5_4 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n (MPI_Comm comm_, │ │ │ │ +555 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y cat_ = _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g, │ │ │ │ +556 bool freecomm_ = false) │ │ │ │ +557 : comm(comm_), cc(comm_), pis(), ri(pis,pis,comm_), │ │ │ │ +558 OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false), │ │ │ │ +559 OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt │ │ │ │ +(false), │ │ │ │ +560 CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_), │ │ │ │ +561 freecomm(freecomm_) │ │ │ │ +562 {} │ │ │ │ +563 │ │ │ │ +_5_7_2 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y cat_ = │ │ │ │ +_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g) │ │ │ │ +573 : comm(MPI_COMM_WORLD), cc(MPI_COMM_WORLD), pis(), ri │ │ │ │ +(pis,pis,MPI_COMM_WORLD), │ │ │ │ +574 OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false), │ │ │ │ +575 OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt │ │ │ │ +(false), │ │ │ │ +576 CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_), freecomm │ │ │ │ +(false) │ │ │ │ +577 {} │ │ │ │ +578 │ │ │ │ +_5_8_6 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n (const _I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_<_G_l_o_b_a_l_I_d_T_y_p_e_, │ │ │ │ +_L_o_c_a_l_I_d_T_y_p_e_>& indexinfo, │ │ │ │ +587 MPI_Comm comm_, │ │ │ │ +588 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y cat_ = _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g, │ │ │ │ +589 bool freecomm_ = false) │ │ │ │ +590 : comm(comm_), cc(comm_), OwnerToAllInterfaceBuilt(false), │ │ │ │ +591 OwnerOverlapToAllInterfaceBuilt(false), OwnerCopyToAllInterfaceBuilt │ │ │ │ +(false), │ │ │ │ +592 OwnerCopyToOwnerCopyInterfaceBuilt(false), CopyToAllInterfaceBuilt(false), │ │ │ │ +593 globalLookup_(0), category_(cat_), freecomm(freecomm_) │ │ │ │ +594 { │ │ │ │ +595 // set up an ISTL index set │ │ │ │ +596 pis.beginResize(); │ │ │ │ +597 for (localindex_iterator i=indexinfo._l_o_c_a_l_I_n_d_i_c_e_s().begin(); │ │ │ │ +i!=indexinfo._l_o_c_a_l_I_n_d_i_c_e_s().end(); ++i) │ │ │ │ +598 { │ │ │ │ +599 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ +600 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ +_o_w_n_e_r,true)); │ │ │ │ +601 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p) │ │ │ │ +602 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ +_o_v_e_r_l_a_p,true)); │ │ │ │ +603 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ +604 pis.add(std::get<0>(*i),LI(std::get<1>(*i),_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_: │ │ │ │ +_c_o_p_y,true)); │ │ │ │ +605 // std::cout << cc.rank() << ": adding index " << std::get<0>(*i) << " " << │ │ │ │ +std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; │ │ │ │ +606 } │ │ │ │ +607 pis.endResize(); │ │ │ │ +608 │ │ │ │ +609 // build remote indices WITHOUT communication │ │ │ │ +610 // std::cout << cc.rank() << ": build remote indices" << std::endl; │ │ │ │ +611 ri.setIndexSets(pis,pis,cc); │ │ │ │ +612 if (indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().size()>0) │ │ │ │ +613 { │ │ │ │ +614 remoteindex_iterator i=indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().begin(); │ │ │ │ +615 int p = std::get<0>(*i); │ │ │ │ +616 _R_I_L_M modifier = ri.template getModifier(p); │ │ │ │ +617 typename PIS::const_iterator pi=pis.begin(); │ │ │ │ +618 for ( ; i!=indexinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end(); ++i) │ │ │ │ +619 { │ │ │ │ +620 // handle processor change │ │ │ │ +621 if (p!=std::get<0>(*i)) │ │ │ │ +622 { │ │ │ │ +623 p = std::get<0>(*i); │ │ │ │ +624 modifier = ri.template getModifier(p); │ │ │ │ +625 pi=pis.begin(); │ │ │ │ +626 } │ │ │ │ +627 │ │ │ │ +628 // position to correct entry in parallel index set │ │ │ │ +629 while (pi->global()!=std::get<1>(*i) && pi!=pis.end()) │ │ │ │ +630 ++pi; │ │ │ │ +631 if (pi==pis.end()) │ │ │ │ +632 DUNE_THROW(_I_S_T_L_E_r_r_o_r,"OwnerOverlapCopyCommunication: global index not in │ │ │ │ +index set"); │ │ │ │ +633 │ │ │ │ +634 // insert entry │ │ │ │ +635 // std::cout << cc.rank() << ": adding remote index " << std::get<0>(*i) << │ │ │ │ +" " << std::get<1>(*i) << " " << std::get<2>(*i) << std::endl; │ │ │ │ +636 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r) │ │ │ │ +637 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r,&(*pi))); │ │ │ │ +638 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p) │ │ │ │ +639 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p,&(*pi))); │ │ │ │ +640 if (std::get<2>(*i)==_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y) │ │ │ │ +641 modifier.insert(_R_X(_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y,&(*pi))); │ │ │ │ +642 } │ │ │ │ +643 }else{ │ │ │ │ +644 // Force remote indices to be synced! │ │ │ │ +645 ri.template getModifier(0); │ │ │ │ +646 } │ │ │ │ +647 } │ │ │ │ +648 │ │ │ │ +649 // destructor: free memory in some objects │ │ │ │ +_6_5_0 _~_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n () │ │ │ │ +651 { │ │ │ │ +652 ri.free(); │ │ │ │ +653 if (OwnerToAllInterfaceBuilt) OwnerToAllInterface.free(); │ │ │ │ +654 if (OwnerOverlapToAllInterfaceBuilt) OwnerOverlapToAllInterface.free(); │ │ │ │ +655 if (OwnerCopyToAllInterfaceBuilt) OwnerCopyToAllInterface.free(); │ │ │ │ +656 if (OwnerCopyToOwnerCopyInterfaceBuilt) OwnerCopyToOwnerCopyInterface.free │ │ │ │ +(); │ │ │ │ +657 if (CopyToAllInterfaceBuilt) CopyToAllInterface.free(); │ │ │ │ +658 if (globalLookup_) delete globalLookup_; │ │ │ │ +659 if (freecomm && (comm != MPI_COMM_NULL)) │ │ │ │ +660 { │ │ │ │ +661 // If it is possible to query whether MPI_Finalize │ │ │ │ +662 // was called, only free the communicator before │ │ │ │ +663 // calling MPI_Finalize. │ │ │ │ +664 int wasFinalized = 0; │ │ │ │ +665 MPI_Finalized(&wasFinalized); │ │ │ │ +666 if (!wasFinalized) { │ │ │ │ +667 MPI_Comm_free(&comm); │ │ │ │ +668 } │ │ │ │ +669 } │ │ │ │ +670 } │ │ │ │ +671 │ │ │ │ +672 private: │ │ │ │ +673 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n (const _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n&) │ │ │ │ +674 {} │ │ │ │ +675 MPI_Comm comm; │ │ │ │ +676 Communication cc; │ │ │ │ +677 _P_I_S pis; │ │ │ │ +678 _R_I ri; │ │ │ │ +679 mutable _I_F OwnerToAllInterface; │ │ │ │ +680 mutable bool OwnerToAllInterfaceBuilt; │ │ │ │ +681 mutable _I_F OwnerOverlapToAllInterface; │ │ │ │ +682 mutable bool OwnerOverlapToAllInterfaceBuilt; │ │ │ │ +683 mutable _I_F OwnerCopyToAllInterface; │ │ │ │ +684 mutable bool OwnerCopyToAllInterfaceBuilt; │ │ │ │ +685 mutable _I_F OwnerCopyToOwnerCopyInterface; │ │ │ │ +686 mutable bool OwnerCopyToOwnerCopyInterfaceBuilt; │ │ │ │ +687 mutable _I_F CopyToAllInterface; │ │ │ │ +688 mutable bool CopyToAllInterfaceBuilt; │ │ │ │ +689 mutable std::vector mask; │ │ │ │ +690 int oldseqNo; │ │ │ │ +691 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t* globalLookup_; │ │ │ │ +692 const _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ +693 bool freecomm; │ │ │ │ +694 }; │ │ │ │ +695 │ │ │ │ +696#endif │ │ │ │ +697 │ │ │ │ +698 │ │ │ │ +701} // end namespace │ │ │ │ +702 │ │ │ │ +703#endif │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ +_t_e_s_t_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ +void testRedistributed(int s) │ │ │ │ +_m_a_t_r_i_x_m_a_r_k_e_t_._h_h │ │ │ │ +Provides classes for reading and writing MatrixMarket Files with an extension │ │ │ │ +for parallel matrices. │ │ │ │ +_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_M │ │ │ │ -size_type M() const │ │ │ │ -number of columns (counted in blocks) │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2007 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_N │ │ │ │ -size_type N() const │ │ │ │ -number of rows (counted in blocks) │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2001 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -A vector of blocks with memory management. │ │ │ │ -DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -Sequential overlapping Schwarz preconditioner. │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ -_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ -DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -Statistics about the application of an inverse operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ -int iterations │ │ │ │ -Number of iterations. │ │ │ │ -DDeeffiinniittiioonn solver.hh:69 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ -bool converged │ │ │ │ -True if convergence criterion has been met. │ │ │ │ -DDeeffiinniittiioonn solver.hh:75 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -Abstract base class for all solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:101 │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ +derive error class from the base class in common │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ +Attribute set for overlapping Schwarz. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:59 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_A_t_t_r_i_b_u_t_e_S_e_t │ │ │ │ +AttributeSet │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:60 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r │ │ │ │ +@ owner │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_c_o_p_y │ │ │ │ +@ copy │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_v_e_r_l_a_p │ │ │ │ +@ overlap │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d │ │ │ │ +Information about the index distribution. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:78 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ +std::tuple< GlobalIdType, LocalIdType, int > IndexTripel │ │ │ │ +A triple describing a local index. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:92 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_a_d_d_R_e_m_o_t_e_I_n_d_e_x │ │ │ │ +void addRemoteIndex(const RemoteIndexTripel &x) │ │ │ │ +Add a new remote index triple to the set of remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:120 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_G_l_o_b_a_l_I_d_T_y_p_e │ │ │ │ +G GlobalIdType │ │ │ │ +The type of the global index. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:81 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_l_o_c_a_l_I_n_d_i_c_e_s │ │ │ │ +const std::set< IndexTripel > & localIndices() const │ │ │ │ +Get the set of indices local to the process. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:133 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +const std::set< RemoteIndexTripel > & remoteIndices() const │ │ │ │ +Get the set of remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:142 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_L_o_c_a_l_I_d_T_y_p_e │ │ │ │ +L LocalIdType │ │ │ │ +The type of the local index. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:84 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_c_l_e_a_r │ │ │ │ +void clear() │ │ │ │ +Remove all indices from the sets. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:150 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_a_d_d_L_o_c_a_l_I_n_d_e_x │ │ │ │ +void addLocalIndex(const IndexTripel &x) │ │ │ │ +Add a new index triple to the set of local indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:106 │ │ │ │ +_D_u_n_e_:_:_I_n_d_e_x_I_n_f_o_F_r_o_m_G_r_i_d_:_:_R_e_m_o_t_e_I_n_d_e_x_T_r_i_p_e_l │ │ │ │ +std::tuple< int, GlobalIdType, int > RemoteIndexTripel │ │ │ │ +A triple describing a remote index. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:99 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ +owner/overlap/copy sema... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_S_e_t │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopySet │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:195 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +const GlobalLookupIndexSet & globalLookup() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:526 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_n_o_r_m │ │ │ │ +FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const │ │ │ │ +Compute the global Euclidean norm of a vector. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:425 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ +void buildOwnerOverlapToAllInterface() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:233 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_I_S │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > PIS │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:188 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ +void buildOwnerCopyToAllInterface() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:254 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y_I_n_t_e_r_f_a_c_e │ │ │ │ +void buildOwnerCopyToOwnerCopyInterface() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:266 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +OwnerOverlapCopyCommunication(const IndexInfoFromGrid< GlobalIdType, │ │ │ │ +LocalIdType > &indexinfo, MPI_Comm comm_, SolverCategory::Category │ │ │ │ +cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:586 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ +SolverCategory::Category category() const │ │ │ │ +Get Solver Category. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:295 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_C_o_p_y_T_o_O_w_n_e_r_C_o_p_y │ │ │ │ +void addOwnerCopyToOwnerCopy(const T &source, T &dest) const │ │ │ │ +Communicate values from owner and copy data points to owner and copy data │ │ │ │ +points and add them to thos... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:379 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_C_o_p_y_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ +void buildCopyToAllInterface() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:279 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_F_l_a_g_s │ │ │ │ +Dune::EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::copy > CopyFlags │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:446 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +RemoteIndices & remoteIndices() │ │ │ │ +Get the underlying remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:490 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ +const ParallelIndexSet & indexSet() const │ │ │ │ +Get the underlying parallel index set. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_I │ │ │ │ +Dune::RemoteIndices< PIS > RI │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:189 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +void buildGlobalLookup(std::size_t size) │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:508 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_O_v_e_r_l_a_p_T_o_A_l_l │ │ │ │ +void addOwnerOverlapToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from owner data points to all other data points and add them │ │ │ │ +to those values. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:345 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +Dune::RemoteIndices< PIS > RemoteIndices │ │ │ │ +The type of the remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:452 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ +void project(T1 &x) const │ │ │ │ +Set vector to zero at copy dofs. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_l_l_S_e_t │ │ │ │ +Dune::AllSet< AttributeSet > AllSet │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:197 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_S_e_t │ │ │ │ +Combine< EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner >, │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::overlap >, AttributeSet > │ │ │ │ +OwnerOverlapSet │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:196 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ +void copyCopyToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from copy data points to all other data points. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ +The type of the reverse lookup of indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_I_F │ │ │ │ +Dune::Interface IF │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:193 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_~_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +~OwnerOverlapCopyCommunication() │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:650 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +void buildGlobalLookup() │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:495 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_B_C │ │ │ │ +Dune::BufferedCommunicator BC │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:192 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category │ │ │ │ +cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ +Construct the communication without any indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:554 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ +ParallelIndexSet & indexSet() │ │ │ │ +Get the underlying parallel index set. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:480 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_d_o_t │ │ │ │ +void dot(const T1 &x, const T1 &y, T2 &result) const │ │ │ │ +Compute a global dot product of two vectors. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:398 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ +const Communication< MPI_Comm > & communicator() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +OwnerOverlapCopyCommunication(SolverCategory::Category cat_=SolverCategory:: │ │ │ │ +overlapping) │ │ │ │ +Construct the communication without any indices using MPI_COMM_WORLD. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:572 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_O_w_n_e_r_S_e_t │ │ │ │ +EnumItem< AttributeSet, OwnerOverlapCopyAttributeSet::owner > OwnerSet │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:194 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +const RemoteIndices & remoteIndices() const │ │ │ │ +Get the underlying remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ +friend void loadMatrixMarket(M &, const std::string &, │ │ │ │ +OwnerOverlapCopyCommunication< G, L > &, bool) │ │ │ │ +Load a parallel matrix/vector stored in matrix market format. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1269 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_X │ │ │ │ +RI::RemoteIndex RX │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:191 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_a_d_d_O_w_n_e_r_C_o_p_y_T_o_A_l_l │ │ │ │ +void addOwnerCopyToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from owner and copy data points to all other data points and │ │ │ │ +add them to those val... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:362 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +void freeGlobalLookup() │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:520 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_R_I_L_M │ │ │ │ +Dune::RemoteIndexListModifier< PIS, typename RI::Allocator, false > RILM │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:190 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ +The type of the parallel index set. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_O_w_n_e_r_T_o_A_l_l_I_n_t_e_r_f_a_c_e │ │ │ │ +void buildOwnerToAllInterface() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:244 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ +gather/scatter callback for communication │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:204 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ +static V gather(const T &a, std::size_t i) │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:207 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ +static void scatter(T &a, V v, std::size_t i) │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:212 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_C_o_p_y_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_V │ │ │ │ +CommPolicy< T >::IndexedType V │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:205 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:219 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_V │ │ │ │ +CommPolicy< T >::IndexedType V │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:220 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ +static V gather(const T &a, std::size_t i) │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:222 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_A_d_d_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ +static void scatter(T &a, V v, std::size_t i) │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:227 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ Category │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -Whether this is a direct solver. │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -whether the solver internally uses column compressed storage │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R │ │ │ │ -Use the SPQR package to directly solve linear systems – empty default class. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:48 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r │ │ │ │ -DDeeffiinniittiioonn spqr.hh:333 │ │ │ │ -_D_u_n_e_:_:_S_P_Q_R_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ -DDeeffiinniittiioonn spqr.hh:334 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ +@ overlapping │ │ │ │ +Category for overlapping solvers. │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:29 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvertype.hh File Reference │ │ │ +dune-istl: graphcreator.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,44 +65,47 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
solvertype.hh File Reference
│ │ │ +
graphcreator.hh File Reference
│ │ │
│ │ │
│ │ │ - │ │ │ -

Templates characterizing the type of a solver. │ │ │ -More...

│ │ │ - │ │ │ +
#include <tuple>
│ │ │ +#include "graph.hh"
│ │ │ +#include "dependency.hh"
│ │ │ +#include "pinfo.hh"
│ │ │ +#include <dune/istl/operators.hh>
│ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ +
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::IsDirectSolver< Solver >
struct  Dune::Amg::PropertiesGraphCreator< M, PI >
 
struct  Dune::StoresColumnCompressed< Solver >
struct  Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >
 
│ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ + │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ -

Detailed Description

│ │ │ -

Templates characterizing the type of a solver.

│ │ │ -
│ │ │ + │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,22 +1,28 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ + * _p_a_a_m_g │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -solvertype.hh File Reference │ │ │ │ -Templates characterizing the type of a solver. _M_o_r_e_._._. │ │ │ │ +graphcreator.hh File Reference │ │ │ │ +#include │ │ │ │ +#include "_g_r_a_p_h_._h_h" │ │ │ │ +#include "_d_e_p_e_n_d_e_n_c_y_._h_h" │ │ │ │ +#include "_p_i_n_f_o_._h_h" │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _S_o_l_v_e_r_ _> │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _P_I_ _> │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _S_o_l_v_e_r_ _> │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +  │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvertype.hh Source File │ │ │ +dune-istl: graphcreator.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,58 +70,156 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
solvertype.hh
│ │ │ +
graphcreator.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SOLVERTYPE_HH
│ │ │ -
6#define DUNE_ISTL_SOLVERTYPE_HH
│ │ │ +
5#ifndef DUNE_AMG_GRAPHCREATOR_HH
│ │ │ +
6#define DUNE_AMG_GRAPHCREATOR_HH
│ │ │
7
│ │ │ -
12namespace Dune
│ │ │ -
13{
│ │ │ -
14 template<typename Solver>
│ │ │ -
│ │ │ - │ │ │ -
16 {
│ │ │ -
17 enum
│ │ │ -
18 {
│ │ │ -
24 value =false
│ │ │ -
25 };
│ │ │ -
26 };
│ │ │ -
│ │ │ -
27
│ │ │ -
28 template<typename Solver>
│ │ │ -
│ │ │ - │ │ │ -
30 {
│ │ │ -
31 enum
│ │ │ -
32 {
│ │ │ -
36 value = false
│ │ │ -
37 };
│ │ │ -
38 };
│ │ │ -
│ │ │ -
39} // end namespace Dune
│ │ │ -
40#endif
│ │ │ +
8#include <tuple>
│ │ │ +
9
│ │ │ +
10#include "graph.hh"
│ │ │ +
11#include "dependency.hh"
│ │ │ +
12#include "pinfo.hh"
│ │ │ + │ │ │ + │ │ │ +
15
│ │ │ +
16namespace Dune
│ │ │ +
17{
│ │ │ +
18 namespace Amg
│ │ │ +
19 {
│ │ │ +
20 template<class M, class PI>
│ │ │ +
│ │ │ + │ │ │ +
22 {
│ │ │ +
23 typedef typename M::matrix_type Matrix;
│ │ │ + │ │ │ + │ │ │ +
26 std::vector<bool> > SubGraph;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
30 IdentityMap,
│ │ │ + │ │ │ + │ │ │ +
33
│ │ │ +
34 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
│ │ │ +
35
│ │ │ +
36 template<class OF, class T>
│ │ │ +
│ │ │ +
37 static GraphTuple create(const M& matrix, T& excluded,
│ │ │ +
38 PI& pinfo, const OF& of)
│ │ │ +
39 {
│ │ │ +
40 MatrixGraph* mg = new MatrixGraph(matrix.getmat());
│ │ │ +
41 typedef typename PI::ParallelIndexSet ParallelIndexSet;
│ │ │ +
42 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ +
43 IndexIterator iend = pinfo.indexSet().end();
│ │ │ +
44
│ │ │ +
45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
│ │ │ +
46 excluded[index->local()] = of.contains(index->local().attribute());
│ │ │ +
47
│ │ │ +
48 SubGraph* sg= new SubGraph(*mg, excluded);
│ │ │ +
49 PropertiesGraph* pg = new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
│ │ │ +
50 return GraphTuple(mg,pg,sg);
│ │ │ +
51 }
│ │ │ +
│ │ │ +
52
│ │ │ +
│ │ │ +
53 static void free(GraphTuple& graphs)
│ │ │ +
54 {
│ │ │ +
55 delete std::get<2>(graphs);
│ │ │ +
56 delete std::get<1>(graphs);
│ │ │ +
57 }
│ │ │ +
│ │ │ +
58 };
│ │ │ +
│ │ │ +
59
│ │ │ +
60 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
62 {
│ │ │ +
63 typedef typename M::matrix_type Matrix;
│ │ │ +
64
│ │ │ + │ │ │ +
66
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
70 IdentityMap,
│ │ │ +
71 IdentityMap> PropertiesGraph;
│ │ │ +
72
│ │ │ +
73 typedef std::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple;
│ │ │ +
74
│ │ │ +
75 template<class OF, class T>
│ │ │ +
│ │ │ +
76 static GraphTuple create([[maybe_unused]] const M& matrix,
│ │ │ +
77 [[maybe_unused]] T& excluded,
│ │ │ +
78 [[maybe_unused]] const SequentialInformation& pinfo,
│ │ │ +
79 const OF&)
│ │ │ +
80 {
│ │ │ +
81 MatrixGraph* mg = new MatrixGraph(matrix.getmat());
│ │ │ +
82 PropertiesGraph* pg = new PropertiesGraph(*mg, IdentityMap(), IdentityMap());
│ │ │ +
83 return GraphTuple(mg,pg);
│ │ │ +
84 }
│ │ │ +
│ │ │ +
85
│ │ │ +
│ │ │ +
86 static void free(GraphTuple& graphs)
│ │ │ +
87 {
│ │ │ +
88 delete std::get<1>(graphs);
│ │ │ +
89 }
│ │ │ +
│ │ │ +
90
│ │ │ +
91 };
│ │ │ +
│ │ │ +
92
│ │ │ +
93 } //namespace Amg
│ │ │ +
94} // namespace Dune
│ │ │ +
95#endif
│ │ │ +
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ + │ │ │ +
Provides classes for building the matrix graph.
│ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │
Definition allocator.hh:11
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │ +
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ +
A subgraph of a graph.
Definition graph.hh:443
│ │ │ +
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ +
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ +
Definition graphcreator.hh:22
│ │ │ +
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition graphcreator.hh:26
│ │ │ +
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition graphcreator.hh:32
│ │ │ +
M::matrix_type Matrix
Definition graphcreator.hh:23
│ │ │ +
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition graphcreator.hh:37
│ │ │ +
static void free(GraphTuple &graphs)
Definition graphcreator.hh:53
│ │ │ +
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:24
│ │ │ +
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition graphcreator.hh:34
│ │ │ +
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:65
│ │ │ +
M::matrix_type Matrix
Definition graphcreator.hh:63
│ │ │ +
Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, IdentityMap, IdentityMap > PropertiesGraph
Definition graphcreator.hh:71
│ │ │ +
std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple
Definition graphcreator.hh:73
│ │ │ +
static GraphTuple create(const M &matrix, T &excluded, const SequentialInformation &pinfo, const OF &)
Definition graphcreator.hh:76
│ │ │ +
static void free(GraphTuple &graphs)
Definition graphcreator.hh:86
│ │ │ +
Definition pinfo.hh:28
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,53 +1,188 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -solvertype.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +graphcreator.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SOLVERTYPE_HH │ │ │ │ -6#define DUNE_ISTL_SOLVERTYPE_HH │ │ │ │ +5#ifndef DUNE_AMG_GRAPHCREATOR_HH │ │ │ │ +6#define DUNE_AMG_GRAPHCREATOR_HH │ │ │ │ 7 │ │ │ │ -12namespace _D_u_n_e │ │ │ │ -13{ │ │ │ │ -14 template │ │ │ │ -_1_5 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ -16 { │ │ │ │ -17 enum │ │ │ │ -18 { │ │ │ │ -24 _v_a_l_u_e =false │ │ │ │ -_2_5 }; │ │ │ │ -26 }; │ │ │ │ -27 │ │ │ │ -28 template │ │ │ │ -_2_9 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ -30 { │ │ │ │ -31 enum │ │ │ │ -32 { │ │ │ │ -36 _v_a_l_u_e = false │ │ │ │ -_3_7 }; │ │ │ │ -38 }; │ │ │ │ -39} // end namespace Dune │ │ │ │ -40#endif │ │ │ │ +8#include │ │ │ │ +9 │ │ │ │ +10#include "_g_r_a_p_h_._h_h" │ │ │ │ +11#include "_d_e_p_e_n_d_e_n_c_y_._h_h" │ │ │ │ +12#include "_p_i_n_f_o_._h_h" │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +15 │ │ │ │ +16namespace _D_u_n_e │ │ │ │ +17{ │ │ │ │ +18 namespace Amg │ │ │ │ +19 { │ │ │ │ +20 template │ │ │ │ +_2_1 struct _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ +22 { │ │ │ │ +_2_3 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ +_2_4 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_a_t_r_i_x_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +25 typedef _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ +_2_6 std::vector > _S_u_b_G_r_a_p_h; │ │ │ │ +27 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_S_u_b_G_r_a_p_h, │ │ │ │ +28 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +29 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +30 IdentityMap, │ │ │ │ +31 typename _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p> │ │ │ │ +_3_2 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ +33 │ │ │ │ +_3_4 typedef std::tuple _G_r_a_p_h_T_u_p_l_e; │ │ │ │ +35 │ │ │ │ +36 template │ │ │ │ +_3_7 static _G_r_a_p_h_T_u_p_l_e _c_r_e_a_t_e(const M& matrix, T& excluded, │ │ │ │ +38 PI& pinfo, const OF& of) │ │ │ │ +39 { │ │ │ │ +40 _M_a_t_r_i_x_G_r_a_p_h* mg = new _M_a_t_r_i_x_G_r_a_p_h(matrix.getmat()); │ │ │ │ +41 typedef typename PI::ParallelIndexSet ParallelIndexSet; │ │ │ │ +42 typedef typename ParallelIndexSet::const_iterator IndexIterator; │ │ │ │ +43 IndexIterator iend = pinfo.indexSet().end(); │ │ │ │ +44 │ │ │ │ +45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index) │ │ │ │ +46 excluded[index->local()] = of.contains(index->local().attribute()); │ │ │ │ +47 │ │ │ │ +48 _S_u_b_G_r_a_p_h* sg= new _S_u_b_G_r_a_p_h(*mg, excluded); │ │ │ │ +49 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h* pg = new _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(*sg, IdentityMap(), sg- │ │ │ │ +>_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p()); │ │ │ │ +50 return _G_r_a_p_h_T_u_p_l_e(mg,pg,sg); │ │ │ │ +51 } │ │ │ │ +52 │ │ │ │ +_5_3 static void _f_r_e_e(_G_r_a_p_h_T_u_p_l_e& graphs) │ │ │ │ +54 { │ │ │ │ +55 delete std::get<2>(graphs); │ │ │ │ +56 delete std::get<1>(graphs); │ │ │ │ +57 } │ │ │ │ +58 }; │ │ │ │ +59 │ │ │ │ +60 template │ │ │ │ +_6_1 struct _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ +62 { │ │ │ │ +_6_3 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ +64 │ │ │ │ +_6_5 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_a_t_r_i_x_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +66 │ │ │ │ +67 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ +68 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +69 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +70 IdentityMap, │ │ │ │ +_7_1 IdentityMap> _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ +72 │ │ │ │ +_7_3 typedef std::tuple _G_r_a_p_h_T_u_p_l_e; │ │ │ │ +74 │ │ │ │ +75 template │ │ │ │ +_7_6 static _G_r_a_p_h_T_u_p_l_e _c_r_e_a_t_e([[maybe_unused]] const M& matrix, │ │ │ │ +77 [[maybe_unused]] T& excluded, │ │ │ │ +78 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +79 const OF&) │ │ │ │ +80 { │ │ │ │ +81 _M_a_t_r_i_x_G_r_a_p_h* mg = new _M_a_t_r_i_x_G_r_a_p_h(matrix.getmat()); │ │ │ │ +82 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h* pg = new _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(*mg, IdentityMap(), IdentityMap │ │ │ │ +()); │ │ │ │ +83 return _G_r_a_p_h_T_u_p_l_e(mg,pg); │ │ │ │ +84 } │ │ │ │ +85 │ │ │ │ +_8_6 static void _f_r_e_e(_G_r_a_p_h_T_u_p_l_e& graphs) │ │ │ │ +87 { │ │ │ │ +88 delete std::get<1>(graphs); │ │ │ │ +89 } │ │ │ │ +90 │ │ │ │ +91 }; │ │ │ │ +92 │ │ │ │ +93 } //namespace Amg │ │ │ │ +94} // namespace Dune │ │ │ │ +95#endif │ │ │ │ +_d_e_p_e_n_d_e_n_c_y_._h_h │ │ │ │ +Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ +_p_i_n_f_o_._h_h │ │ │ │ +_g_r_a_p_h_._h_h │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ +_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ +Define general, extensible interface for operators. The available │ │ │ │ +implementation wraps a matrix. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -Whether this is a direct solver. │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ -_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -whether the solver internally uses column compressed storage │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +Class representing the properties of an edge in the matrix graph. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +Class representing a node in the matrix graph. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h │ │ │ │ +A subgraph of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:443 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +EdgeIndexMap getEdgeIndexMap() │ │ │ │ +Get an edge index map for the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +An index map for mapping the edges to indices. │ │ │ │ +DDeeffiinniittiioonn graph.hh:470 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_S_u_b_G_r_a_p_h │ │ │ │ +Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:26 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, │ │ │ │ +IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:32 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_M_a_t_r_i_x │ │ │ │ +M::matrix_type Matrix │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:23 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_c_r_e_a_t_e │ │ │ │ +static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of) │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:37 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_f_r_e_e │ │ │ │ +static void free(GraphTuple &graphs) │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:53 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +Dune::Amg::MatrixGraph< const Matrix > MatrixGraph │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:24 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_G_r_a_p_h_T_u_p_l_e │ │ │ │ +std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:34 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +Dune::Amg::MatrixGraph< const Matrix > MatrixGraph │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:65 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_M_a_t_r_i_x │ │ │ │ +M::matrix_type Matrix │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:63 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, │ │ │ │ +IdentityMap, IdentityMap > PropertiesGraph │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:71 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_G_r_a_p_h_T_u_p_l_e │ │ │ │ +std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:73 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_c_r_e_a_t_e │ │ │ │ +static GraphTuple create(const M &matrix, T &excluded, const │ │ │ │ +SequentialInformation &pinfo, const OF &) │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:76 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_f_r_e_e │ │ │ │ +static void free(GraphTuple &graphs) │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:86 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvers.hh File Reference │ │ │ +dune-istl: properties.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,117 +65,50 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Namespaces
│ │ │ + │ │ │ │ │ │
│ │ │ │ │ │ -

Implementations of the inverse operator interface. │ │ │ +

Provides classes for handling internal properties in a graph. │ │ │ More...

│ │ │ -
#include <array>
│ │ │ -#include <cmath>
│ │ │ -#include <complex>
│ │ │ -#include <iostream>
│ │ │ -#include <memory>
│ │ │ -#include <type_traits>
│ │ │ -#include <vector>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include <dune/common/math.hh>
│ │ │ -#include <dune/common/simd/io.hh>
│ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ -#include <dune/common/timer.hh>
│ │ │ -#include <dune/istl/allocator.hh>
│ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ -#include <dune/istl/eigenvalue/arpackpp.hh>
│ │ │ -#include <dune/istl/istlexception.hh>
│ │ │ -#include <dune/istl/operators.hh>
│ │ │ -#include <dune/istl/preconditioner.hh>
│ │ │ -#include <dune/istl/scalarproducts.hh>
│ │ │ -#include <dune/istl/solver.hh>
│ │ │ -#include <dune/istl/solverregistry.hh>
│ │ │ +
#include <dune/common/propertymap.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::LoopSolver< X >
 Preconditioned loop solver. More...
struct  Dune::Amg::VertexVisitedTag
 Tag idnetifying the visited property of a vertex. More...
 
class  Dune::GradientSolver< X >
 gradient method More...
 
class  Dune::CGSolver< X >
 conjugate gradient method More...
 
class  Dune::BiCGSTABSolver< X >
 Bi-conjugate Gradient Stabilized (BiCG-STAB) More...
 
class  Dune::MINRESSolver< X >
 Minimal Residual Method (MINRES) More...
 
class  Dune::RestartedGMResSolver< X, Y, F >
 implements the Generalized Minimal Residual (GMRes) method More...
 
class  Dune::RestartedFlexibleGMResSolver< X, Y, F >
 implements the Flexible Generalized Minimal Residual (FGMRes) method (right preconditioned) More...
 
class  Dune::GeneralizedPCGSolver< X >
 Generalized preconditioned conjugate gradient solver. More...
 
class  Dune::RestartedFCGSolver< X >
 Accelerated flexible conjugate gradient method. More...
 
class  Dune::CompleteFCGSolver< X >
 Complete flexible conjugate gradient method. More...
class  Dune::Amg::RandomAccessBundledPropertyMap< C, K, i, T, R >
 A property map that extracts one property out of a bundle using operator[]() More...
 
│ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ -Functions

 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("loopsolver", defaultIterativeSolverCreator< Dune::LoopSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("gradientsolver", defaultIterativeSolverCreator< Dune::GradientSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("cgsolver", defaultIterativeSolverCreator< Dune::CGSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("bicgstabsolver", defaultIterativeSolverCreator< Dune::BiCGSTABSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("minressolver", defaultIterativeSolverCreator< Dune::MINRESSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("restartedgmressolver", defaultIterativeSolverCreator< Dune::RestartedGMResSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("restartedflexiblegmressolver", defaultIterativeSolverCreator< Dune::RestartedFlexibleGMResSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("generalizedpcgsolver", defaultIterativeSolverCreator< Dune::GeneralizedPCGSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("restartedfcgsolver", defaultIterativeSolverCreator< Dune::RestartedFCGSolver >())
 
 Dune::DUNE_REGISTER_ITERATIVE_SOLVER ("completefcgsolver", defaultIterativeSolverCreator< Dune::CompleteFCGSolver >())
 
namespace  Dune::Amg
 
│ │ │

Detailed Description

│ │ │ -

Implementations of the inverse operator interface.

│ │ │ -

This file provides various preconditioned Krylov methods.

│ │ │ +

Provides classes for handling internal properties in a graph.

│ │ │ +
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,104 +1,33 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -solvers.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s │ │ │ │ -Implementations of the inverse operator interface. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_a_l_l_o_c_a_t_o_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_e_i_g_e_n_v_a_l_u_e_/_a_r_p_a_c_k_p_p_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +properties.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Provides classes for handling internal properties in a graph. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_L_o_o_p_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  Preconditioned loop solver. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ +  Tag idnetifying the visited property of a vertex. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_G_r_a_d_i_e_n_t_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  gradient method _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_C_G_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  conjugate gradient method _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  Bi-conjugate Gradient Stabilized (BiCG-STAB) _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  Minimal Residual Method (MINRES) _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_ _X_,_ _Y_,_ _F_ _> │ │ │ │ -  implements the Generalized Minimal Residual (GMRes) method _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_l_e_x_i_b_l_e_G_M_R_e_s_S_o_l_v_e_r_<_ _X_,_ _Y_,_ _F_ _> │ │ │ │ -  implements the Flexible Generalized Minimal Residual (FGMRes) method │ │ │ │ - (right preconditioned) _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  Generalized preconditioned conjugate gradient solver. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  Accelerated flexible conjugate gradient method. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_C_o_m_p_l_e_t_e_F_C_G_S_o_l_v_e_r_<_ _X_ _> │ │ │ │ -  Complete flexible conjugate gradient method. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_<_ _C_,_ _K_,_ _i_,_ _T_,_ _R_ _> │ │ │ │ +  A property map that extracts one property out of a bundle using │ │ │ │ + _o_p_e_r_a_t_o_r_[_]_(_) _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("loopsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_L_o_o_p_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("gradientsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_G_r_a_d_i_e_n_t_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("cgsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_C_G_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("bicgstabsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("minressolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("restartedgmressolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("restartedflexiblegmressolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_l_e_x_i_b_l_e_G_M_R_e_s_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("generalizedpcgsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("restartedfcgsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R ("completefcgsolver", │ │ │ │ - _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r< _D_u_n_e_:_:_C_o_m_p_l_e_t_e_F_C_G_S_o_l_v_e_r >()) │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ -This file provides various preconditioned Krylov methods. │ │ │ │ +Provides classes for handling internal properties in a graph. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvers.hh Source File │ │ │ +dune-istl: properties.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1673 +70,99 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
solvers.hh
│ │ │ +
properties.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5
│ │ │ -
6#ifndef DUNE_ISTL_SOLVERS_HH
│ │ │ -
7#define DUNE_ISTL_SOLVERS_HH
│ │ │ -
8
│ │ │ -
9#include <array>
│ │ │ -
10#include <cmath>
│ │ │ -
11#include <complex>
│ │ │ -
12#include <iostream>
│ │ │ -
13#include <memory>
│ │ │ -
14#include <type_traits>
│ │ │ -
15#include <vector>
│ │ │ -
16
│ │ │ -
17#include <dune/common/exceptions.hh>
│ │ │ -
18#include <dune/common/math.hh>
│ │ │ -
19#include <dune/common/simd/io.hh>
│ │ │ -
20#include <dune/common/simd/simd.hh>
│ │ │ -
21#include <dune/common/std/type_traits.hh>
│ │ │ -
22#include <dune/common/timer.hh>
│ │ │ -
23
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
31#include <dune/istl/solver.hh>
│ │ │ - │ │ │ -
33
│ │ │ -
34namespace Dune {
│ │ │ -
46 //=====================================================================
│ │ │ -
47 // Implementation of this interface
│ │ │ -
48 //=====================================================================
│ │ │ -
49
│ │ │ -
58 template<class X>
│ │ │ -
│ │ │ -
59 class LoopSolver : public IterativeSolver<X,X> {
│ │ │ -
60 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
65
│ │ │ -
66 // copy base class constructors
│ │ │ -
67 using IterativeSolver<X,X>::IterativeSolver;
│ │ │ -
68
│ │ │ -
69 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
70 using IterativeSolver<X,X>::apply;
│ │ │ -
71
│ │ │ -
│ │ │ -
73 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
74 {
│ │ │ -
75 Iteration iteration(*this, res);
│ │ │ -
76 _prec->pre(x,b);
│ │ │ -
77
│ │ │ -
78 // overwrite b with defect
│ │ │ -
79 _op->applyscaleadd(-1,x,b);
│ │ │ -
80
│ │ │ -
81 // compute norm, \todo parallelization
│ │ │ -
82 real_type def = _sp->norm(b);
│ │ │ -
83 if(iteration.step(0, def)){
│ │ │ -
84 _prec->post(x);
│ │ │ -
85 return;
│ │ │ -
86 }
│ │ │ -
87 // prepare preconditioner
│ │ │ -
88
│ │ │ -
89 // allocate correction vector
│ │ │ -
90 X v(x);
│ │ │ -
91
│ │ │ -
92 // iteration loop
│ │ │ -
93 int i=1;
│ │ │ -
94 for ( ; i<=_maxit; i++ )
│ │ │ -
95 {
│ │ │ -
96 v = 0; // clear correction
│ │ │ -
97 _prec->apply(v,b); // apply preconditioner
│ │ │ -
98 x += v; // update solution
│ │ │ -
99 _op->applyscaleadd(-1,v,b); // update defect
│ │ │ -
100 def=_sp->norm(b); // comp defect norm
│ │ │ -
101 if(iteration.step(i, def))
│ │ │ -
102 break;
│ │ │ -
103 }
│ │ │ -
104
│ │ │ -
105 // postprocess preconditioner
│ │ │ -
106 _prec->post(x);
│ │ │ -
107 }
│ │ │ -
│ │ │ -
108
│ │ │ -
109 protected:
│ │ │ -
110 using IterativeSolver<X,X>::_op;
│ │ │ -
111 using IterativeSolver<X,X>::_prec;
│ │ │ -
112 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
114 using IterativeSolver<X,X>::_maxit;
│ │ │ -
115 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
117 };
│ │ │ -
│ │ │ -
118 DUNE_REGISTER_ITERATIVE_SOLVER("loopsolver", defaultIterativeSolverCreator<Dune::LoopSolver>());
│ │ │ -
119
│ │ │ -
120
│ │ │ -
121 // all these solvers are taken from the SUMO library
│ │ │ -
123 template<class X>
│ │ │ -
│ │ │ -
124 class GradientSolver : public IterativeSolver<X,X> {
│ │ │ -
125 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
129 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
130
│ │ │ -
131 // copy base class constructors
│ │ │ -
132 using IterativeSolver<X,X>::IterativeSolver;
│ │ │ -
133
│ │ │ -
134 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
135 using IterativeSolver<X,X>::apply;
│ │ │ -
136
│ │ │ -
│ │ │ -
142 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
143 {
│ │ │ -
144 Iteration iteration(*this, res);
│ │ │ -
145 _prec->pre(x,b); // prepare preconditioner
│ │ │ -
146
│ │ │ -
147 _op->applyscaleadd(-1,x,b); // overwrite b with defec
│ │ │ -
148
│ │ │ -
149 real_type def = _sp->norm(b); // compute norm
│ │ │ -
150 if(iteration.step(0, def)){
│ │ │ -
151 _prec->post(x);
│ │ │ -
152 return;
│ │ │ -
153 }
│ │ │ -
154
│ │ │ -
155 X p(x); // create local vectors
│ │ │ -
156 X q(b);
│ │ │ -
157
│ │ │ -
158 int i=1; // loop variables
│ │ │ -
159 field_type lambda;
│ │ │ -
160 for ( ; i<=_maxit; i++ )
│ │ │ -
161 {
│ │ │ -
162 p = 0; // clear correction
│ │ │ -
163 _prec->apply(p,b); // apply preconditioner
│ │ │ -
164 _op->apply(p,q); // q=Ap
│ │ │ -
165 auto alpha = _sp->dot(q,p);
│ │ │ -
166 lambda = Simd::cond(def==field_type(0.),
│ │ │ -
167 field_type(0.), // no need for minimization if def is already 0
│ │ │ -
168 _sp->dot(p,b)/alpha); // minimization
│ │ │ -
169 x.axpy(lambda,p); // update solution
│ │ │ -
170 b.axpy(-lambda,q); // update defect
│ │ │ -
171
│ │ │ -
172 def =_sp->norm(b); // comp defect norm
│ │ │ -
173 if(iteration.step(i, def))
│ │ │ -
174 break;
│ │ │ -
175 }
│ │ │ -
176 // postprocess preconditioner
│ │ │ -
177 _prec->post(x);
│ │ │ -
178 }
│ │ │ -
│ │ │ -
179
│ │ │ -
180 protected:
│ │ │ -
181 using IterativeSolver<X,X>::_op;
│ │ │ -
182 using IterativeSolver<X,X>::_prec;
│ │ │ -
183 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
185 using IterativeSolver<X,X>::_maxit;
│ │ │ -
186 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
188 };
│ │ │ -
│ │ │ -
189 DUNE_REGISTER_ITERATIVE_SOLVER("gradientsolver", defaultIterativeSolverCreator<Dune::GradientSolver>());
│ │ │ -
190
│ │ │ -
192 template<class X>
│ │ │ -
│ │ │ -
193 class CGSolver : public IterativeSolver<X,X> {
│ │ │ -
194 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
198 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
199
│ │ │ -
200 // copy base class constructors
│ │ │ -
201 using IterativeSolver<X,X>::IterativeSolver;
│ │ │ -
202
│ │ │ -
203 private:
│ │ │ - │ │ │ -
205
│ │ │ -
206 protected:
│ │ │ -
207
│ │ │ -
208 static constexpr bool enableConditionEstimate = (std::is_same_v<field_type,float> || std::is_same_v<field_type,double>);
│ │ │ -
209
│ │ │ -
210 public:
│ │ │ -
211
│ │ │ -
212 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
213 using IterativeSolver<X,X>::apply;
│ │ │ -
214
│ │ │ -
│ │ │ - │ │ │ -
223 scalar_real_type reduction, int maxit, int verbose, bool condition_estimate) : IterativeSolver<X,X>(op, prec, reduction, maxit, verbose),
│ │ │ -
224 condition_estimate_(condition_estimate)
│ │ │ -
225 {
│ │ │ -
226 if (condition_estimate && !enableConditionEstimate) {
│ │ │ -
227 condition_estimate_ = false;
│ │ │ -
228 std::cerr << "WARNING: Condition estimate was disabled. It is only available for double and float field types!" << std::endl;
│ │ │ -
229 }
│ │ │ -
230 }
│ │ │ -
│ │ │ -
231
│ │ │ -
│ │ │ - │ │ │ -
240 scalar_real_type reduction, int maxit, int verbose, bool condition_estimate) : IterativeSolver<X,X>(op, sp, prec, reduction, maxit, verbose),
│ │ │ -
241 condition_estimate_(condition_estimate)
│ │ │ -
242 {
│ │ │ -
243 if (condition_estimate && !(std::is_same<field_type,float>::value || std::is_same<field_type,double>::value)) {
│ │ │ -
244 condition_estimate_ = false;
│ │ │ -
245 std::cerr << "WARNING: Condition estimate was disabled. It is only available for double and float field types!" << std::endl;
│ │ │ -
246 }
│ │ │ -
247 }
│ │ │ -
│ │ │ -
248
│ │ │ -
│ │ │ -
256 CGSolver (std::shared_ptr<const LinearOperator<X,X>> op, std::shared_ptr<ScalarProduct<X>> sp,
│ │ │ -
257 std::shared_ptr<Preconditioner<X,X>> prec,
│ │ │ -
258 scalar_real_type reduction, int maxit, int verbose, bool condition_estimate)
│ │ │ -
259 : IterativeSolver<X,X>(op, sp, prec, reduction, maxit, verbose),
│ │ │ -
260 condition_estimate_(condition_estimate)
│ │ │ -
261 {
│ │ │ -
262 if (condition_estimate && !(std::is_same<field_type,float>::value || std::is_same<field_type,double>::value)) {
│ │ │ -
263 condition_estimate_ = false;
│ │ │ -
264 std::cerr << "WARNING: Condition estimate was disabled. It is only available for double and float field types!" << std::endl;
│ │ │ -
265 }
│ │ │ -
266 }
│ │ │ -
│ │ │ -
267
│ │ │ -
│ │ │ -
279 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
280 {
│ │ │ -
281 Iteration iteration(*this,res);
│ │ │ -
282 _prec->pre(x,b); // prepare preconditioner
│ │ │ -
283
│ │ │ -
284 _op->applyscaleadd(-1,x,b); // overwrite b with defect
│ │ │ -
285
│ │ │ -
286 real_type def = _sp->norm(b); // compute norm
│ │ │ -
287 if(iteration.step(0, def)){
│ │ │ -
288 _prec->post(x);
│ │ │ -
289 return;
│ │ │ -
290 }
│ │ │ -
291
│ │ │ -
292 X p(x); // the search direction
│ │ │ -
293 X q(x); // a temporary vector
│ │ │ -
294
│ │ │ -
295 // Remember lambda and beta values for condition estimate
│ │ │ -
296 std::vector<real_type> lambdas(0);
│ │ │ -
297 std::vector<real_type> betas(0);
│ │ │ -
298
│ │ │ -
299 // some local variables
│ │ │ -
300 field_type rho,rholast,lambda,alpha,beta;
│ │ │ -
301
│ │ │ -
302 // determine initial search direction
│ │ │ -
303 p = 0; // clear correction
│ │ │ -
304 _prec->apply(p,b); // apply preconditioner
│ │ │ -
305 rholast = _sp->dot(p,b); // orthogonalization
│ │ │ -
306
│ │ │ -
307 // the loop
│ │ │ -
308 int i=1;
│ │ │ -
309 for ( ; i<=_maxit; i++ )
│ │ │ -
310 {
│ │ │ -
311 // minimize in given search direction p
│ │ │ -
312 _op->apply(p,q); // q=Ap
│ │ │ -
313 alpha = _sp->dot(p,q); // scalar product
│ │ │ -
314 lambda = Simd::cond(def==field_type(0.), field_type(0.), rholast/alpha); // minimization
│ │ │ -
315 if constexpr (enableConditionEstimate)
│ │ │ -
316 if (condition_estimate_)
│ │ │ -
317 lambdas.push_back(std::real(lambda));
│ │ │ -
318 x.axpy(lambda,p); // update solution
│ │ │ -
319 b.axpy(-lambda,q); // update defect
│ │ │ -
320
│ │ │ -
321 // convergence test
│ │ │ -
322 def=_sp->norm(b); // comp defect norm
│ │ │ -
323 if(iteration.step(i, def))
│ │ │ -
324 break;
│ │ │ -
325
│ │ │ -
326 // determine new search direction
│ │ │ -
327 q = 0; // clear correction
│ │ │ -
328 _prec->apply(q,b); // apply preconditioner
│ │ │ -
329 rho = _sp->dot(q,b); // orthogonalization
│ │ │ -
330 beta = Simd::cond(def==field_type(0.), field_type(0.), rho/rholast); // scaling factor
│ │ │ -
331 if constexpr (enableConditionEstimate)
│ │ │ -
332 if (condition_estimate_)
│ │ │ -
333 betas.push_back(std::real(beta));
│ │ │ -
334 p *= beta; // scale old search direction
│ │ │ -
335 p += q; // orthogonalization with correction
│ │ │ -
336 rholast = rho; // remember rho for recurrence
│ │ │ -
337 }
│ │ │ -
338
│ │ │ -
339 _prec->post(x); // postprocess preconditioner
│ │ │ -
340
│ │ │ -
341 if (condition_estimate_) {
│ │ │ -
342#if HAVE_ARPACKPP
│ │ │ -
343 if constexpr (enableConditionEstimate) {
│ │ │ -
344 using std::sqrt;
│ │ │ -
345
│ │ │ -
346 // Build T matrix which has extreme eigenvalues approximating
│ │ │ -
347 // those of the original system
│ │ │ -
348 // (see Y. Saad, Iterative methods for sparse linear systems)
│ │ │ -
349
│ │ │ - │ │ │ -
351
│ │ │ -
352 for (auto row = T.createbegin(); row != T.createend(); ++row) {
│ │ │ -
353 if (row.index() > 0)
│ │ │ -
354 row.insert(row.index()-1);
│ │ │ -
355 row.insert(row.index());
│ │ │ -
356 if (row.index() < T.N() - 1)
│ │ │ -
357 row.insert(row.index()+1);
│ │ │ -
358 }
│ │ │ -
359 for (int row = 0; row < i; ++row) {
│ │ │ -
360 if (row > 0) {
│ │ │ -
361 T[row][row-1] = sqrt(betas[row-1]) / lambdas[row-1];
│ │ │ -
362 }
│ │ │ -
363
│ │ │ -
364 T[row][row] = 1.0 / lambdas[row];
│ │ │ -
365 if (row > 0) {
│ │ │ -
366 T[row][row] += betas[row-1] / lambdas[row-1];
│ │ │ -
367 }
│ │ │ -
368
│ │ │ -
369 if (row < i - 1) {
│ │ │ -
370 T[row][row+1] = sqrt(betas[row]) / lambdas[row];
│ │ │ -
371 }
│ │ │ -
372 }
│ │ │ -
373
│ │ │ -
374 // Compute largest and smallest eigenvalue of T matrix and return as estimate
│ │ │ - │ │ │ -
376
│ │ │ -
377 real_type eps = 0.0;
│ │ │ -
378 COND_VEC eigv;
│ │ │ -
379 real_type min_eigv, max_eigv;
│ │ │ -
380 arpack.computeSymMinMagnitude (eps, eigv, min_eigv);
│ │ │ -
381 arpack.computeSymMaxMagnitude (eps, eigv, max_eigv);
│ │ │ -
382
│ │ │ -
383 res.condition_estimate = max_eigv / min_eigv;
│ │ │ -
384
│ │ │ -
385 if (this->_verbose > 0) {
│ │ │ -
386 std::cout << "Min eigv estimate: " << Simd::io(min_eigv) << '\n';
│ │ │ -
387 std::cout << "Max eigv estimate: " << Simd::io(max_eigv) << '\n';
│ │ │ -
388 std::cout << "Condition estimate: "
│ │ │ -
389 << Simd::io(max_eigv / min_eigv) << std::endl;
│ │ │ -
390 }
│ │ │ -
391 }
│ │ │ -
392#else
│ │ │ -
393 std::cerr << "WARNING: Condition estimate was requested. This requires ARPACK, but ARPACK was not found!" << std::endl;
│ │ │ -
394#endif
│ │ │ -
395 }
│ │ │ -
396 }
│ │ │ -
│ │ │ -
397
│ │ │ -
398 private:
│ │ │ -
399 bool condition_estimate_ = false;
│ │ │ -
400
│ │ │ -
401 // Matrix and vector types used for condition estimate
│ │ │ - │ │ │ - │ │ │ -
404
│ │ │ -
405 protected:
│ │ │ -
406 using IterativeSolver<X,X>::_op;
│ │ │ -
407 using IterativeSolver<X,X>::_prec;
│ │ │ -
408 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
410 using IterativeSolver<X,X>::_maxit;
│ │ │ -
411 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
413 };
│ │ │ -
│ │ │ -
414 DUNE_REGISTER_ITERATIVE_SOLVER("cgsolver", defaultIterativeSolverCreator<Dune::CGSolver>());
│ │ │ -
415
│ │ │ -
416 // Ronald Kriemanns BiCG-STAB implementation from Sumo
│ │ │ -
418 template<class X>
│ │ │ -
│ │ │ -
419 class BiCGSTABSolver : public IterativeSolver<X,X> {
│ │ │ -
420 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
424 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
425
│ │ │ -
426 // copy base class constructors
│ │ │ -
427 using IterativeSolver<X,X>::IterativeSolver;
│ │ │ -
428
│ │ │ -
429 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
430 using IterativeSolver<X,X>::apply;
│ │ │ -
431
│ │ │ -
│ │ │ -
439 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
440 {
│ │ │ -
441 using std::abs;
│ │ │ -
442 const Simd::Scalar<real_type> EPSILON=1e-80;
│ │ │ -
443 using std::abs;
│ │ │ -
444 double it;
│ │ │ -
445 field_type rho, rho_new, alpha, beta, h, omega;
│ │ │ -
446 real_type norm;
│ │ │ -
447
│ │ │ -
448 //
│ │ │ -
449 // get vectors and matrix
│ │ │ -
450 //
│ │ │ -
451 X& r=b;
│ │ │ -
452 X p(x);
│ │ │ -
453 X v(x);
│ │ │ -
454 X t(x);
│ │ │ -
455 X y(x);
│ │ │ -
456 X rt(x);
│ │ │ -
457
│ │ │ -
458 //
│ │ │ -
459 // begin iteration
│ │ │ -
460 //
│ │ │ -
461
│ │ │ -
462 // r = r - Ax; rt = r
│ │ │ -
463 Iteration<double> iteration(*this,res);
│ │ │ -
464 _prec->pre(x,r); // prepare preconditioner
│ │ │ -
465
│ │ │ -
466 _op->applyscaleadd(-1,x,r); // overwrite b with defect
│ │ │ -
467
│ │ │ -
468 rt=r;
│ │ │ -
469
│ │ │ -
470 norm = _sp->norm(r);
│ │ │ -
471 if(iteration.step(0, norm)){
│ │ │ -
472 _prec->post(x);
│ │ │ -
473 return;
│ │ │ -
474 }
│ │ │ -
475 p=0;
│ │ │ -
476 v=0;
│ │ │ -
477
│ │ │ -
478 rho = 1;
│ │ │ -
479 alpha = 1;
│ │ │ -
480 omega = 1;
│ │ │ -
481
│ │ │ -
482 //
│ │ │ -
483 // iteration
│ │ │ -
484 //
│ │ │ -
485
│ │ │ -
486 for (it = 0.5; it < _maxit; it+=.5)
│ │ │ -
487 {
│ │ │ -
488 //
│ │ │ -
489 // preprocess, set vecsizes etc.
│ │ │ -
490 //
│ │ │ -
491
│ │ │ -
492 // rho_new = < rt , r >
│ │ │ -
493 rho_new = _sp->dot(rt,r);
│ │ │ -
494
│ │ │ -
495 // look if breakdown occurred
│ │ │ -
496 if (Simd::allTrue(abs(rho) <= EPSILON))
│ │ │ -
497 DUNE_THROW(SolverAbort,"breakdown in BiCGSTAB - rho "
│ │ │ -
498 << Simd::io(rho) << " <= EPSILON " << EPSILON
│ │ │ -
499 << " after " << it << " iterations");
│ │ │ -
500 if (Simd::allTrue(abs(omega) <= EPSILON))
│ │ │ -
501 DUNE_THROW(SolverAbort,"breakdown in BiCGSTAB - omega "
│ │ │ -
502 << Simd::io(omega) << " <= EPSILON " << EPSILON
│ │ │ -
503 << " after " << it << " iterations");
│ │ │ -
504
│ │ │ -
505
│ │ │ -
506 if (it<1)
│ │ │ -
507 p = r;
│ │ │ -
508 else
│ │ │ -
509 {
│ │ │ -
510 beta = Simd::cond(norm==field_type(0.),
│ │ │ -
511 field_type(0.), // no need for orthogonalization if norm is already 0
│ │ │ -
512 ( rho_new / rho ) * ( alpha / omega ));
│ │ │ -
513 p.axpy(-omega,v); // p = r + beta (p - omega*v)
│ │ │ -
514 p *= beta;
│ │ │ -
515 p += r;
│ │ │ -
516 }
│ │ │ -
517
│ │ │ -
518 // y = W^-1 * p
│ │ │ -
519 y = 0;
│ │ │ -
520 _prec->apply(y,p); // apply preconditioner
│ │ │ -
521
│ │ │ -
522 // v = A * y
│ │ │ -
523 _op->apply(y,v);
│ │ │ -
524
│ │ │ -
525 // alpha = rho_new / < rt, v >
│ │ │ -
526 h = _sp->dot(rt,v);
│ │ │ -
527
│ │ │ -
528 if ( Simd::allTrue(abs(h) < EPSILON) )
│ │ │ -
529 DUNE_THROW(SolverAbort,"abs(h) < EPSILON in BiCGSTAB - abs(h) "
│ │ │ -
530 << Simd::io(abs(h)) << " < EPSILON " << EPSILON
│ │ │ -
531 << " after " << it << " iterations");
│ │ │ -
532
│ │ │ -
533 alpha = Simd::cond(norm==field_type(0.),
│ │ │ -
534 field_type(0.),
│ │ │ -
535 rho_new / h);
│ │ │ -
536
│ │ │ -
537 // apply first correction to x
│ │ │ -
538 // x <- x + alpha y
│ │ │ -
539 x.axpy(alpha,y);
│ │ │ -
540
│ │ │ -
541 // r = r - alpha*v
│ │ │ -
542 r.axpy(-alpha,v);
│ │ │ -
543
│ │ │ -
544 //
│ │ │ -
545 // test stop criteria
│ │ │ -
546 //
│ │ │ -
547
│ │ │ -
548 norm = _sp->norm(r);
│ │ │ -
549 if(iteration.step(it, norm)){
│ │ │ -
550 break;
│ │ │ -
551 }
│ │ │ -
552
│ │ │ -
553 it+=.5;
│ │ │ -
554
│ │ │ -
555 // y = W^-1 * r
│ │ │ -
556 y = 0;
│ │ │ -
557 _prec->apply(y,r);
│ │ │ -
558
│ │ │ -
559 // t = A * y
│ │ │ -
560 _op->apply(y,t);
│ │ │ -
561
│ │ │ -
562 // omega = < t, r > / < t, t >
│ │ │ -
563 h = _sp->dot(t,t);
│ │ │ -
564 omega = Simd::cond(norm==field_type(0.),
│ │ │ -
565 field_type(0.),
│ │ │ -
566 _sp->dot(t,r)/h);
│ │ │ -
567
│ │ │ -
568 // apply second correction to x
│ │ │ -
569 // x <- x + omega y
│ │ │ -
570 x.axpy(omega,y);
│ │ │ -
571
│ │ │ -
572 // r = s - omega*t (remember : r = s)
│ │ │ -
573 r.axpy(-omega,t);
│ │ │ -
574
│ │ │ -
575 rho = rho_new;
│ │ │ -
576
│ │ │ -
577 //
│ │ │ -
578 // test stop criteria
│ │ │ -
579 //
│ │ │ -
580
│ │ │ -
581 norm = _sp->norm(r);
│ │ │ -
582 if(iteration.step(it, norm)){
│ │ │ -
583 break;
│ │ │ -
584 }
│ │ │ -
585 } // end for
│ │ │ -
586
│ │ │ -
587 _prec->post(x); // postprocess preconditioner
│ │ │ -
588 }
│ │ │ -
│ │ │ -
589
│ │ │ -
590 protected:
│ │ │ -
591 using IterativeSolver<X,X>::_op;
│ │ │ -
592 using IterativeSolver<X,X>::_prec;
│ │ │ -
593 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
595 using IterativeSolver<X,X>::_maxit;
│ │ │ -
596 using IterativeSolver<X,X>::_verbose;
│ │ │ -
597 template<class CountType>
│ │ │ - │ │ │ -
599 };
│ │ │ -
│ │ │ -
600 DUNE_REGISTER_ITERATIVE_SOLVER("bicgstabsolver", defaultIterativeSolverCreator<Dune::BiCGSTABSolver>());
│ │ │ -
601
│ │ │ -
608 template<class X>
│ │ │ -
│ │ │ -
609 class MINRESSolver : public IterativeSolver<X,X> {
│ │ │ -
610 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
614 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
615
│ │ │ -
616 // copy base class constructors
│ │ │ -
617 using IterativeSolver<X,X>::IterativeSolver;
│ │ │ -
618
│ │ │ -
619 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
620 using IterativeSolver<X,X>::apply;
│ │ │ -
621
│ │ │ -
│ │ │ -
627 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
628 {
│ │ │ -
629 using std::sqrt;
│ │ │ -
630 using std::abs;
│ │ │ -
631 Iteration iteration(*this, res);
│ │ │ -
632 // prepare preconditioner
│ │ │ -
633 _prec->pre(x,b);
│ │ │ -
634
│ │ │ -
635 // overwrite rhs with defect
│ │ │ -
636 _op->applyscaleadd(-1.0,x,b); // b -= Ax
│ │ │ -
637
│ │ │ -
638 // some temporary vectors
│ │ │ -
639 X z(b), dummy(b);
│ │ │ -
640 z = 0.0;
│ │ │ -
641
│ │ │ -
642 // calculate preconditioned defect
│ │ │ -
643 _prec->apply(z,b); // r = W^-1 (b - Ax)
│ │ │ -
644 real_type def = _sp->norm(z);
│ │ │ -
645 if (iteration.step(0, def)){
│ │ │ -
646 _prec->post(x);
│ │ │ -
647 return;
│ │ │ -
648 }
│ │ │ -
649
│ │ │ -
650 // recurrence coefficients as computed in Lanczos algorithm
│ │ │ -
651 field_type alpha, beta;
│ │ │ -
652 // diagonal entries of givens rotation
│ │ │ -
653 std::array<real_type,2> c{{0.0,0.0}};
│ │ │ -
654 // off-diagonal entries of givens rotation
│ │ │ -
655 std::array<field_type,2> s{{0.0,0.0}};
│ │ │ -
656
│ │ │ -
657 // recurrence coefficients (column k of tridiag matrix T_k)
│ │ │ -
658 std::array<field_type,3> T{{0.0,0.0,0.0}};
│ │ │ -
659
│ │ │ -
660 // the rhs vector of the min problem
│ │ │ -
661 std::array<field_type,2> xi{{1.0,0.0}};
│ │ │ -
662
│ │ │ -
663 // beta is real and positive in exact arithmetic
│ │ │ -
664 // since it is the norm of the basis vectors (in unpreconditioned case)
│ │ │ -
665 beta = sqrt(_sp->dot(b,z));
│ │ │ -
666 field_type beta0 = beta;
│ │ │ -
667
│ │ │ -
668 // the search directions
│ │ │ -
669 std::array<X,3> p{{b,b,b}};
│ │ │ -
670 p[0] = 0.0;
│ │ │ -
671 p[1] = 0.0;
│ │ │ -
672 p[2] = 0.0;
│ │ │ -
673
│ │ │ -
674 // orthonormal basis vectors (in unpreconditioned case)
│ │ │ -
675 std::array<X,3> q{{b,b,b}};
│ │ │ -
676 q[0] = 0.0;
│ │ │ -
677 q[1] *= Simd::cond(def==field_type(0.),
│ │ │ -
678 field_type(0.),
│ │ │ -
679 real_type(1.0)/beta);
│ │ │ -
680 q[2] = 0.0;
│ │ │ -
681
│ │ │ -
682 z *= Simd::cond(def==field_type(0.),
│ │ │ -
683 field_type(0.),
│ │ │ -
684 real_type(1.0)/beta);
│ │ │ -
685
│ │ │ -
686 // the loop
│ │ │ -
687 int i = 1;
│ │ │ -
688 for( ; i<=_maxit; i++) {
│ │ │ -
689
│ │ │ -
690 dummy = z;
│ │ │ -
691 int i1 = i%3,
│ │ │ -
692 i0 = (i1+2)%3,
│ │ │ -
693 i2 = (i1+1)%3;
│ │ │ -
694
│ │ │ -
695 // symmetrically preconditioned Lanczos algorithm (see Greenbaum p.121)
│ │ │ -
696 _op->apply(z,q[i2]); // q[i2] = Az
│ │ │ -
697 q[i2].axpy(-beta,q[i0]);
│ │ │ -
698 // alpha is real since it is the diagonal entry of the hermitian tridiagonal matrix
│ │ │ -
699 // from the Lanczos Algorithm
│ │ │ -
700 // so the order in the scalar product doesn't matter even for the complex case
│ │ │ -
701 alpha = _sp->dot(z,q[i2]);
│ │ │ -
702 q[i2].axpy(-alpha,q[i1]);
│ │ │ -
703
│ │ │ -
704 z = 0.0;
│ │ │ -
705 _prec->apply(z,q[i2]);
│ │ │ -
706
│ │ │ -
707 // beta is real and positive in exact arithmetic
│ │ │ -
708 // since it is the norm of the basis vectors (in unpreconditioned case)
│ │ │ -
709 beta = sqrt(_sp->dot(q[i2],z));
│ │ │ -
710
│ │ │ -
711 q[i2] *= Simd::cond(def==field_type(0.),
│ │ │ -
712 field_type(0.),
│ │ │ -
713 real_type(1.0)/beta);
│ │ │ -
714 z *= Simd::cond(def==field_type(0.),
│ │ │ -
715 field_type(0.),
│ │ │ -
716 real_type(1.0)/beta);
│ │ │ -
717
│ │ │ -
718 // QR Factorization of recurrence coefficient matrix
│ │ │ -
719 // apply previous givens rotations to last column of T
│ │ │ -
720 T[1] = T[2];
│ │ │ -
721 if(i>2) {
│ │ │ -
722 T[0] = s[i%2]*T[1];
│ │ │ -
723 T[1] = c[i%2]*T[1];
│ │ │ -
724 }
│ │ │ -
725 if(i>1) {
│ │ │ -
726 T[2] = c[(i+1)%2]*alpha - s[(i+1)%2]*T[1];
│ │ │ -
727 T[1] = c[(i+1)%2]*T[1] + s[(i+1)%2]*alpha;
│ │ │ -
728 }
│ │ │ -
729 else
│ │ │ -
730 T[2] = alpha;
│ │ │ -
731
│ │ │ -
732 // update QR factorization
│ │ │ -
733 generateGivensRotation(T[2],beta,c[i%2],s[i%2]);
│ │ │ -
734 // to last column of T_k
│ │ │ -
735 T[2] = c[i%2]*T[2] + s[i%2]*beta;
│ │ │ -
736 // and to the rhs xi of the min problem
│ │ │ -
737 xi[i%2] = -s[i%2]*xi[(i+1)%2];
│ │ │ -
738 xi[(i+1)%2] *= c[i%2];
│ │ │ -
739
│ │ │ -
740 // compute correction direction
│ │ │ -
741 p[i2] = dummy;
│ │ │ -
742 p[i2].axpy(-T[1],p[i1]);
│ │ │ -
743 p[i2].axpy(-T[0],p[i0]);
│ │ │ -
744 p[i2] *= real_type(1.0)/T[2];
│ │ │ -
745
│ │ │ -
746 // apply correction/update solution
│ │ │ -
747 x.axpy(beta0*xi[(i+1)%2],p[i2]);
│ │ │ -
748
│ │ │ -
749 // remember beta_old
│ │ │ -
750 T[2] = beta;
│ │ │ -
751
│ │ │ -
752 // check for convergence
│ │ │ -
753 // the last entry in the rhs of the min-problem is the residual
│ │ │ -
754 def = abs(beta0*xi[i%2]);
│ │ │ -
755 if(iteration.step(i, def)){
│ │ │ -
756 break;
│ │ │ -
757 }
│ │ │ -
758 } // end for
│ │ │ -
759
│ │ │ -
760 // postprocess preconditioner
│ │ │ -
761 _prec->post(x);
│ │ │ -
762 }
│ │ │ -
│ │ │ -
763
│ │ │ -
764 private:
│ │ │ -
765
│ │ │ -
766 void generateGivensRotation(field_type &dx, field_type &dy, real_type &cs, field_type &sn)
│ │ │ -
767 {
│ │ │ -
768 using std::sqrt;
│ │ │ -
769 using std::abs;
│ │ │ -
770 using std::max;
│ │ │ -
771 using std::min;
│ │ │ -
772 const real_type eps = 1e-15;
│ │ │ -
773 real_type norm_dx = abs(dx);
│ │ │ -
774 real_type norm_dy = abs(dy);
│ │ │ -
775 real_type norm_max = max(norm_dx, norm_dy);
│ │ │ -
776 real_type norm_min = min(norm_dx, norm_dy);
│ │ │ -
777 real_type temp = norm_min/norm_max;
│ │ │ -
778 // we rewrite the code in a vectorizable fashion
│ │ │ -
779 cs = Simd::cond(norm_dy < eps,
│ │ │ -
780 real_type(1.0),
│ │ │ -
781 Simd::cond(norm_dx < eps,
│ │ │ -
782 real_type(0.0),
│ │ │ -
783 Simd::cond(norm_dy > norm_dx,
│ │ │ -
784 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)*temp,
│ │ │ -
785 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)
│ │ │ -
786 )));
│ │ │ -
787 sn = Simd::cond(norm_dy < eps,
│ │ │ -
788 field_type(0.0),
│ │ │ -
789 Simd::cond(norm_dx < eps,
│ │ │ -
790 field_type(1.0),
│ │ │ -
791 Simd::cond(norm_dy > norm_dx,
│ │ │ -
792 // dy and dx are real in exact arithmetic
│ │ │ -
793 // thus dx*dy is real so we can explicitly enforce it
│ │ │ -
794 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*dx*dy/norm_dx/norm_dy,
│ │ │ -
795 // dy and dx is real in exact arithmetic
│ │ │ -
796 // so we don't have to conjugate both of them
│ │ │ -
797 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*dy/dx
│ │ │ -
798 )));
│ │ │ -
799 }
│ │ │ -
800
│ │ │ -
801 protected:
│ │ │ -
802 using IterativeSolver<X,X>::_op;
│ │ │ -
803 using IterativeSolver<X,X>::_prec;
│ │ │ -
804 using IterativeSolver<X,X>::_sp;
│ │ │ -
805 using IterativeSolver<X,X>::_reduction;
│ │ │ -
806 using IterativeSolver<X,X>::_maxit;
│ │ │ -
807 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
809 };
│ │ │ -
│ │ │ -
810 DUNE_REGISTER_ITERATIVE_SOLVER("minressolver", defaultIterativeSolverCreator<Dune::MINRESSolver>());
│ │ │ -
811
│ │ │ -
825 template<class X, class Y=X, class F = Y>
│ │ │ -
│ │ │ - │ │ │ -
827 {
│ │ │ -
828 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
832 using typename IterativeSolver<X,Y>::real_type;
│ │ │ -
833
│ │ │ -
834 protected:
│ │ │ - │ │ │ -
836
│ │ │ - │ │ │ - │ │ │ -
841
│ │ │ -
842 public:
│ │ │ -
843
│ │ │ -
│ │ │ -
850 RestartedGMResSolver (const LinearOperator<X,Y>& op, Preconditioner<X,Y>& prec, scalar_real_type reduction, int restart, int maxit, int verbose) :
│ │ │ -
851 IterativeSolver<X,Y>::IterativeSolver(op,prec,reduction,maxit,verbose),
│ │ │ -
852 _restart(restart)
│ │ │ -
853 {}
│ │ │ -
│ │ │ -
854
│ │ │ -
│ │ │ -
861 RestartedGMResSolver (const LinearOperator<X,Y>& op, const ScalarProduct<X>& sp, Preconditioner<X,Y>& prec, scalar_real_type reduction, int restart, int maxit, int verbose) :
│ │ │ -
862 IterativeSolver<X,Y>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
863 _restart(restart)
│ │ │ -
864 {}
│ │ │ -
│ │ │ -
865
│ │ │ -
│ │ │ -
878 RestartedGMResSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
879 IterativeSolver<X,Y>::IterativeSolver(op,prec,configuration),
│ │ │ -
880 _restart(configuration.get<int>("restart"))
│ │ │ -
881 {}
│ │ │ -
│ │ │ -
882
│ │ │ -
│ │ │ -
883 RestartedGMResSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<const ScalarProduct<X> > sp, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
884 IterativeSolver<X,Y>::IterativeSolver(op,sp,prec,configuration),
│ │ │ -
885 _restart(configuration.get<int>("restart"))
│ │ │ -
886 {}
│ │ │ -
│ │ │ -
887
│ │ │ -
│ │ │ -
894 RestartedGMResSolver (std::shared_ptr<const LinearOperator<X,Y>> op,
│ │ │ -
895 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ -
896 std::shared_ptr<Preconditioner<X,Y>> prec,
│ │ │ -
897 scalar_real_type reduction, int restart, int maxit, int verbose) :
│ │ │ -
898 IterativeSolver<X,Y>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
899 _restart(restart)
│ │ │ -
900 {}
│ │ │ -
│ │ │ -
901
│ │ │ -
│ │ │ -
910 virtual void apply (X& x, Y& b, InverseOperatorResult& res)
│ │ │ -
911 {
│ │ │ -
912 apply(x,b,Simd::max(_reduction),res);
│ │ │ -
913 }
│ │ │ -
│ │ │ -
914
│ │ │ -
│ │ │ -
923 virtual void apply (X& x, Y& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ -
924 {
│ │ │ -
925 using std::abs;
│ │ │ -
926 const Simd::Scalar<real_type> EPSILON = 1e-80;
│ │ │ -
927 const int m = _restart;
│ │ │ -
928 real_type norm = 0.0;
│ │ │ -
929 int j = 1;
│ │ │ -
930 std::vector<field_type,fAlloc> s(m+1), sn(m);
│ │ │ -
931 std::vector<real_type,rAlloc> cs(m);
│ │ │ -
932 // need copy of rhs if GMRes has to be restarted
│ │ │ -
933 Y b2(b);
│ │ │ -
934 // helper vector
│ │ │ -
935 Y w(b);
│ │ │ -
936 std::vector< std::vector<field_type,fAlloc> > H(m+1,s);
│ │ │ -
937 std::vector<F> v(m+1,b);
│ │ │ -
938
│ │ │ -
939 Iteration iteration(*this,res);
│ │ │ -
940
│ │ │ -
941 // clear solver statistics and set res.converged to false
│ │ │ -
942 _prec->pre(x,b);
│ │ │ -
943
│ │ │ -
944 // calculate defect and overwrite rhs with it
│ │ │ -
945 _op->applyscaleadd(-1.0,x,b); // b -= Ax
│ │ │ -
946 // calculate preconditioned defect
│ │ │ -
947 v[0] = 0.0; _prec->apply(v[0],b); // r = W^-1 b
│ │ │ -
948 norm = _sp->norm(v[0]);
│ │ │ -
949 if(iteration.step(0, norm)){
│ │ │ -
950 _prec->post(x);
│ │ │ -
951 return;
│ │ │ -
952 }
│ │ │ -
953
│ │ │ -
954 while(j <= _maxit && res.converged != true) {
│ │ │ -
955
│ │ │ -
956 int i = 0;
│ │ │ -
957 v[0] *= Simd::cond(norm==real_type(0.),
│ │ │ -
958 real_type(0.),
│ │ │ -
959 real_type(1.0)/norm);
│ │ │ -
960 s[0] = norm;
│ │ │ -
961 for(i=1; i<m+1; i++)
│ │ │ -
962 s[i] = 0.0;
│ │ │ -
963
│ │ │ -
964 for(i=0; i < m && j <= _maxit && res.converged != true; i++, j++) {
│ │ │ -
965 w = 0.0;
│ │ │ -
966 // use v[i+1] as temporary vector
│ │ │ -
967 v[i+1] = 0.0;
│ │ │ -
968 // do Arnoldi algorithm
│ │ │ -
969 _op->apply(v[i],v[i+1]);
│ │ │ -
970 _prec->apply(w,v[i+1]);
│ │ │ -
971 for(int k=0; k<i+1; k++) {
│ │ │ -
972 // notice that _sp->dot(v[k],w) = v[k]\adjoint w
│ │ │ -
973 // so one has to pay attention to the order
│ │ │ -
974 // in the scalar product for the complex case
│ │ │ -
975 // doing the modified Gram-Schmidt algorithm
│ │ │ -
976 H[k][i] = _sp->dot(v[k],w);
│ │ │ -
977 // w -= H[k][i] * v[k]
│ │ │ -
978 w.axpy(-H[k][i],v[k]);
│ │ │ -
979 }
│ │ │ -
980 H[i+1][i] = _sp->norm(w);
│ │ │ -
981 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON))
│ │ │ -
982 DUNE_THROW(SolverAbort,
│ │ │ -
983 "breakdown in GMRes - |w| == 0.0 after " << j << " iterations");
│ │ │ -
984
│ │ │ -
985 // normalize new vector
│ │ │ -
986 v[i+1] = w;
│ │ │ -
987 v[i+1] *= Simd::cond(norm==real_type(0.),
│ │ │ -
988 field_type(0.),
│ │ │ -
989 real_type(1.0)/H[i+1][i]);
│ │ │ -
990
│ │ │ -
991 // update QR factorization
│ │ │ -
992 for(int k=0; k<i; k++)
│ │ │ -
993 applyPlaneRotation(H[k][i],H[k+1][i],cs[k],sn[k]);
│ │ │ -
994
│ │ │ -
995 // compute new givens rotation
│ │ │ -
996 generatePlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
997 // finish updating QR factorization
│ │ │ -
998 applyPlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
999 applyPlaneRotation(s[i],s[i+1],cs[i],sn[i]);
│ │ │ -
1000
│ │ │ -
1001 // norm of the defect is the last component the vector s
│ │ │ -
1002 norm = abs(s[i+1]);
│ │ │ -
1003
│ │ │ -
1004 iteration.step(j, norm);
│ │ │ -
1005
│ │ │ -
1006 } // end for
│ │ │ -
1007
│ │ │ -
1008 // calculate update vector
│ │ │ -
1009 w = 0.0;
│ │ │ -
1010 update(w,i,H,s,v);
│ │ │ -
1011 // and current iterate
│ │ │ -
1012 x += w;
│ │ │ -
1013
│ │ │ -
1014 // restart GMRes if convergence was not achieved,
│ │ │ -
1015 // i.e. linear defect has not reached desired reduction
│ │ │ -
1016 // and if j < _maxit (do not restart on last iteration)
│ │ │ -
1017 if( res.converged != true && j < _maxit ) {
│ │ │ -
1018
│ │ │ -
1019 if(_verbose > 0)
│ │ │ -
1020 std::cout << "=== GMRes::restart" << std::endl;
│ │ │ -
1021 // get saved rhs
│ │ │ -
1022 b = b2;
│ │ │ -
1023 // calculate new defect
│ │ │ -
1024 _op->applyscaleadd(-1.0,x,b); // b -= Ax;
│ │ │ -
1025 // calculate preconditioned defect
│ │ │ -
1026 v[0] = 0.0;
│ │ │ -
1027 _prec->apply(v[0],b);
│ │ │ -
1028 norm = _sp->norm(v[0]);
│ │ │ -
1029 }
│ │ │ -
1030
│ │ │ -
1031 } //end while
│ │ │ -
1032
│ │ │ -
1033 // postprocess preconditioner
│ │ │ -
1034 _prec->post(x);
│ │ │ -
1035 }
│ │ │ -
│ │ │ -
1036
│ │ │ -
1037 protected :
│ │ │ -
1038
│ │ │ -
│ │ │ -
1039 void update(X& w, int i,
│ │ │ -
1040 const std::vector<std::vector<field_type,fAlloc> >& H,
│ │ │ -
1041 const std::vector<field_type,fAlloc>& s,
│ │ │ -
1042 const std::vector<X>& v) {
│ │ │ -
1043 // solution vector of the upper triangular system
│ │ │ -
1044 std::vector<field_type,fAlloc> y(s);
│ │ │ -
1045
│ │ │ -
1046 // backsolve
│ │ │ -
1047 for(int a=i-1; a>=0; a--) {
│ │ │ -
1048 field_type rhs(s[a]);
│ │ │ -
1049 for(int b=a+1; b<i; b++)
│ │ │ -
1050 rhs -= H[a][b]*y[b];
│ │ │ -
1051 y[a] = Simd::cond(rhs==field_type(0.),
│ │ │ -
1052 field_type(0.),
│ │ │ -
1053 rhs/H[a][a]);
│ │ │ -
1054
│ │ │ -
1055 // compute update on the fly
│ │ │ -
1056 // w += y[a]*v[a]
│ │ │ -
1057 w.axpy(y[a],v[a]);
│ │ │ -
1058 }
│ │ │ -
1059 }
│ │ │ -
│ │ │ -
1060
│ │ │ -
1061 template<typename T>
│ │ │ -
│ │ │ -
1062 typename std::enable_if<std::is_same<field_type,real_type>::value,T>::type conjugate(const T& t) {
│ │ │ -
1063 return t;
│ │ │ -
1064 }
│ │ │ -
│ │ │ -
1065
│ │ │ -
1066 template<typename T>
│ │ │ -
│ │ │ -
1067 typename std::enable_if<!std::is_same<field_type,real_type>::value,T>::type conjugate(const T& t) {
│ │ │ -
1068 using std::conj;
│ │ │ -
1069 return conj(t);
│ │ │ -
1070 }
│ │ │ -
│ │ │ -
1071
│ │ │ -
1072 void
│ │ │ -
│ │ │ - │ │ │ -
1074 {
│ │ │ -
1075 using std::sqrt;
│ │ │ -
1076 using std::abs;
│ │ │ -
1077 using std::max;
│ │ │ -
1078 using std::min;
│ │ │ -
1079 const real_type eps = 1e-15;
│ │ │ -
1080 real_type norm_dx = abs(dx);
│ │ │ -
1081 real_type norm_dy = abs(dy);
│ │ │ -
1082 real_type norm_max = max(norm_dx, norm_dy);
│ │ │ -
1083 real_type norm_min = min(norm_dx, norm_dy);
│ │ │ -
1084 real_type temp = norm_min/norm_max;
│ │ │ -
1085 // we rewrite the code in a vectorizable fashion
│ │ │ -
1086 cs = Simd::cond(norm_dy < eps,
│ │ │ -
1087 real_type(1.0),
│ │ │ -
1088 Simd::cond(norm_dx < eps,
│ │ │ -
1089 real_type(0.0),
│ │ │ -
1090 Simd::cond(norm_dy > norm_dx,
│ │ │ -
1091 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)*temp,
│ │ │ -
1092 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)
│ │ │ -
1093 )));
│ │ │ -
1094 sn = Simd::cond(norm_dy < eps,
│ │ │ -
1095 field_type(0.0),
│ │ │ -
1096 Simd::cond(norm_dx < eps,
│ │ │ -
1097 field_type(1.0),
│ │ │ -
1098 Simd::cond(norm_dy > norm_dx,
│ │ │ -
1099 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*dx*conjugate(dy)/norm_dx/norm_dy,
│ │ │ -
1100 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*conjugate(dy/dx)
│ │ │ -
1101 )));
│ │ │ -
1102 }
│ │ │ -
│ │ │ -
1103
│ │ │ -
1104
│ │ │ -
1105 void
│ │ │ -
│ │ │ - │ │ │ -
1107 {
│ │ │ -
1108 field_type temp = cs * dx + sn * dy;
│ │ │ -
1109 dy = -conjugate(sn) * dx + cs * dy;
│ │ │ -
1110 dx = temp;
│ │ │ -
1111 }
│ │ │ -
│ │ │ -
1112
│ │ │ -
1113 using IterativeSolver<X,Y>::_op;
│ │ │ -
1114 using IterativeSolver<X,Y>::_prec;
│ │ │ -
1115 using IterativeSolver<X,Y>::_sp;
│ │ │ -
1116 using IterativeSolver<X,Y>::_reduction;
│ │ │ -
1117 using IterativeSolver<X,Y>::_maxit;
│ │ │ -
1118 using IterativeSolver<X,Y>::_verbose;
│ │ │ - │ │ │ - │ │ │ -
1121 };
│ │ │ -
│ │ │ -
1122 DUNE_REGISTER_ITERATIVE_SOLVER("restartedgmressolver", defaultIterativeSolverCreator<Dune::RestartedGMResSolver>());
│ │ │ -
1123
│ │ │ -
1137 template<class X, class Y=X, class F = Y>
│ │ │ -
│ │ │ - │ │ │ -
1139 {
│ │ │ -
1140 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
1145
│ │ │ -
1146 private:
│ │ │ - │ │ │ -
1148
│ │ │ -
1150 using fAlloc = typename RestartedGMResSolver<X,Y>::fAlloc;
│ │ │ -
1152 using rAlloc = typename RestartedGMResSolver<X,Y>::rAlloc;
│ │ │ -
1153
│ │ │ -
1154 public:
│ │ │ -
1155 // copy base class constructors
│ │ │ -
1156 using RestartedGMResSolver<X,Y>::RestartedGMResSolver;
│ │ │ -
1157
│ │ │ -
1158 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
1159 using RestartedGMResSolver<X,Y>::apply;
│ │ │ -
1160
│ │ │ -
│ │ │ -
1169 void apply (X& x, Y& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ -
1170 {
│ │ │ -
1171 using std::abs;
│ │ │ -
1172 const Simd::Scalar<real_type> EPSILON = 1e-80;
│ │ │ -
1173 const int m = _restart;
│ │ │ -
1174 real_type norm = 0.0;
│ │ │ -
1175 int i, j = 1, k;
│ │ │ -
1176 std::vector<field_type,fAlloc> s(m+1), sn(m);
│ │ │ -
1177 std::vector<real_type,rAlloc> cs(m);
│ │ │ -
1178 // helper vector
│ │ │ -
1179 Y tmp(b);
│ │ │ -
1180 std::vector< std::vector<field_type,fAlloc> > H(m+1,s);
│ │ │ -
1181 std::vector<F> v(m+1,b);
│ │ │ -
1182 std::vector<X> w(m+1,b);
│ │ │ -
1183
│ │ │ -
1184 Iteration iteration(*this,res);
│ │ │ -
1185 // setup preconditioner if it does something in pre
│ │ │ -
1186
│ │ │ -
1187 // calculate residual and overwrite a copy of the rhs with it
│ │ │ -
1188 _prec->pre(x, b);
│ │ │ -
1189 v[0] = b;
│ │ │ -
1190 _op->applyscaleadd(-1.0, x, v[0]); // b -= Ax
│ │ │ -
1191
│ │ │ -
1192 norm = _sp->norm(v[0]); // the residual norm
│ │ │ -
1193 if(iteration.step(0, norm)){
│ │ │ -
1194 _prec->post(x);
│ │ │ -
1195 return;
│ │ │ -
1196 }
│ │ │ -
1197
│ │ │ -
1198 // start iterations
│ │ │ -
1199 res.converged = false;;
│ │ │ -
1200 while(j <= _maxit && res.converged != true)
│ │ │ -
1201 {
│ │ │ -
1202 v[0] *= (1.0 / norm);
│ │ │ -
1203 s[0] = norm;
│ │ │ -
1204 for(i=1; i<m+1; ++i)
│ │ │ -
1205 s[i] = 0.0;
│ │ │ -
1206
│ │ │ -
1207 // inner loop
│ │ │ -
1208 for(i=0; i < m && j <= _maxit && res.converged != true; i++, j++)
│ │ │ -
1209 {
│ │ │ -
1210 w[i] = 0.0;
│ │ │ -
1211 // compute wi = M^-1*vi (also called zi)
│ │ │ -
1212 _prec->apply(w[i], v[i]);
│ │ │ -
1213 // compute vi = A*wi
│ │ │ -
1214 // use v[i+1] as temporary vector for w
│ │ │ -
1215 _op->apply(w[i], v[i+1]);
│ │ │ -
1216 // do Arnoldi algorithm
│ │ │ -
1217 for(int kk=0; kk<i+1; kk++)
│ │ │ -
1218 {
│ │ │ -
1219 // notice that _sp->dot(v[k],v[i+1]) = v[k]\adjoint v[i+1]
│ │ │ -
1220 // so one has to pay attention to the order
│ │ │ -
1221 // in the scalar product for the complex case
│ │ │ -
1222 // doing the modified Gram-Schmidt algorithm
│ │ │ -
1223 H[kk][i] = _sp->dot(v[kk],v[i+1]);
│ │ │ -
1224 // w -= H[k][i] * v[kk]
│ │ │ -
1225 v[i+1].axpy(-H[kk][i], v[kk]);
│ │ │ -
1226 }
│ │ │ -
1227 H[i+1][i] = _sp->norm(v[i+1]);
│ │ │ -
1228 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON))
│ │ │ -
1229 DUNE_THROW(SolverAbort, "breakdown in fGMRes - |w| (-> "
│ │ │ -
1230 << w[i] << ") == 0.0 after "
│ │ │ -
1231 << j << " iterations");
│ │ │ -
1232
│ │ │ -
1233 // v[i+1] = w*1/H[i+1][i]
│ │ │ -
1234 v[i+1] *= real_type(1.0)/H[i+1][i];
│ │ │ -
1235
│ │ │ -
1236 // update QR factorization
│ │ │ -
1237 for(k=0; k<i; k++)
│ │ │ -
1238 this->applyPlaneRotation(H[k][i],H[k+1][i],cs[k],sn[k]);
│ │ │ -
1239
│ │ │ -
1240 // compute new givens rotation
│ │ │ -
1241 this->generatePlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
1242
│ │ │ -
1243 // finish updating QR factorization
│ │ │ -
1244 this->applyPlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
1245 this->applyPlaneRotation(s[i],s[i+1],cs[i],sn[i]);
│ │ │ -
1246
│ │ │ -
1247 // norm of the residual is the last component of vector s
│ │ │ -
1248 using std::abs;
│ │ │ -
1249 norm = abs(s[i+1]);
│ │ │ -
1250 iteration.step(j, norm);
│ │ │ -
1251 } // end inner for loop
│ │ │ -
1252
│ │ │ -
1253 // calculate update vector
│ │ │ -
1254 tmp = 0.0;
│ │ │ -
1255 this->update(tmp, i, H, s, w);
│ │ │ -
1256 // and update current iterate
│ │ │ -
1257 x += tmp;
│ │ │ -
1258
│ │ │ -
1259 // restart fGMRes if convergence was not achieved,
│ │ │ -
1260 // i.e. linear residual has not reached desired reduction
│ │ │ -
1261 // and if still j < _maxit (do not restart on last iteration)
│ │ │ -
1262 if( res.converged != true && j < _maxit)
│ │ │ -
1263 {
│ │ │ -
1264 if (_verbose > 0)
│ │ │ -
1265 std::cout << "=== fGMRes::restart" << std::endl;
│ │ │ -
1266 // get rhs
│ │ │ -
1267 v[0] = b;
│ │ │ -
1268 // calculate new defect
│ │ │ -
1269 _op->applyscaleadd(-1.0, x,v[0]); // b -= Ax;
│ │ │ -
1270 // calculate preconditioned defect
│ │ │ -
1271 norm = _sp->norm(v[0]); // update the residual norm
│ │ │ -
1272 }
│ │ │ -
1273
│ │ │ -
1274 } // end outer while loop
│ │ │ -
1275
│ │ │ -
1276 // post-process preconditioner
│ │ │ -
1277 _prec->post(x);
│ │ │ -
1278 }
│ │ │ -
│ │ │ -
1279
│ │ │ -
1280private:
│ │ │ -
1281 using RestartedGMResSolver<X,Y>::_op;
│ │ │ -
1282 using RestartedGMResSolver<X,Y>::_prec;
│ │ │ -
1283 using RestartedGMResSolver<X,Y>::_sp;
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
1288 using Iteration = typename IterativeSolver<X,X>::template Iteration<unsigned int>;
│ │ │ -
1289 };
│ │ │ -
│ │ │ -
1290 DUNE_REGISTER_ITERATIVE_SOLVER("restartedflexiblegmressolver", defaultIterativeSolverCreator<Dune::RestartedFlexibleGMResSolver>());
│ │ │ -
1291
│ │ │ -
1305 template<class X>
│ │ │ -
│ │ │ - │ │ │ -
1307 {
│ │ │ -
1308 public:
│ │ │ -
1309 using typename IterativeSolver<X,X>::domain_type;
│ │ │ -
1310 using typename IterativeSolver<X,X>::range_type;
│ │ │ -
1311 using typename IterativeSolver<X,X>::field_type;
│ │ │ -
1312 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
1313
│ │ │ -
1314 private:
│ │ │ - │ │ │ -
1316
│ │ │ - │ │ │ -
1319
│ │ │ -
1320 public:
│ │ │ -
1321
│ │ │ -
1322 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
1323 using IterativeSolver<X,X>::apply;
│ │ │ -
1324
│ │ │ -
│ │ │ -
1331 GeneralizedPCGSolver (const LinearOperator<X,X>& op, Preconditioner<X,X>& prec, scalar_real_type reduction, int maxit, int verbose, int restart = 10) :
│ │ │ -
1332 IterativeSolver<X,X>::IterativeSolver(op,prec,reduction,maxit,verbose),
│ │ │ -
1333 _restart(restart)
│ │ │ -
1334 {}
│ │ │ -
│ │ │ -
1335
│ │ │ -
│ │ │ -
1343 GeneralizedPCGSolver (const LinearOperator<X,X>& op, const ScalarProduct<X>& sp, Preconditioner<X,X>& prec, scalar_real_type reduction, int maxit, int verbose, int restart = 10) :
│ │ │ -
1344 IterativeSolver<X,X>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
1345 _restart(restart)
│ │ │ -
1346 {}
│ │ │ -
│ │ │ -
1347
│ │ │ -
1348
│ │ │ -
│ │ │ -
1361 GeneralizedPCGSolver (std::shared_ptr<const LinearOperator<X,X> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
1362 IterativeSolver<X,X>::IterativeSolver(op,prec,configuration),
│ │ │ -
1363 _restart(configuration.get<int>("restart"))
│ │ │ -
1364 {}
│ │ │ -
│ │ │ -
1365
│ │ │ -
│ │ │ -
1366 GeneralizedPCGSolver (std::shared_ptr<const LinearOperator<X,X> > op, std::shared_ptr<const ScalarProduct<X> > sp, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
1367 IterativeSolver<X,X>::IterativeSolver(op,sp,prec,configuration),
│ │ │ -
1368 _restart(configuration.get<int>("restart"))
│ │ │ -
1369 {}
│ │ │ -
│ │ │ -
│ │ │ -
1377 GeneralizedPCGSolver (std::shared_ptr<const LinearOperator<X,X>> op,
│ │ │ -
1378 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ -
1379 std::shared_ptr<Preconditioner<X,X>> prec,
│ │ │ -
1380 scalar_real_type reduction, int maxit, int verbose,
│ │ │ -
1381 int restart = 10) :
│ │ │ -
1382 IterativeSolver<X,X>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
1383 _restart(restart)
│ │ │ -
1384 {}
│ │ │ -
│ │ │ -
1385
│ │ │ -
│ │ │ -
1391 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
1392 {
│ │ │ -
1393 Iteration iteration(*this, res);
│ │ │ -
1394 _prec->pre(x,b); // prepare preconditioner
│ │ │ -
1395 _op->applyscaleadd(-1,x,b); // overwrite b with defect
│ │ │ -
1396
│ │ │ -
1397 std::vector<std::shared_ptr<X> > p(_restart);
│ │ │ -
1398 std::vector<field_type,fAlloc> pp(_restart);
│ │ │ -
1399 X q(x); // a temporary vector
│ │ │ -
1400 X prec_res(x); // a temporary vector for preconditioner output
│ │ │ -
1401
│ │ │ -
1402 p[0].reset(new X(x));
│ │ │ -
1403
│ │ │ -
1404 real_type def = _sp->norm(b); // compute norm
│ │ │ -
1405 if(iteration.step(0, def)){
│ │ │ -
1406 _prec->post(x);
│ │ │ -
1407 return;
│ │ │ -
1408 }
│ │ │ -
1409 // some local variables
│ │ │ -
1410 field_type rho, lambda;
│ │ │ -
1411
│ │ │ -
1412 int i=0;
│ │ │ -
1413 // determine initial search direction
│ │ │ -
1414 *(p[0]) = 0; // clear correction
│ │ │ -
1415 _prec->apply(*(p[0]),b); // apply preconditioner
│ │ │ -
1416 rho = _sp->dot(*(p[0]),b); // orthogonalization
│ │ │ -
1417 _op->apply(*(p[0]),q); // q=Ap
│ │ │ -
1418 pp[0] = _sp->dot(*(p[0]),q); // scalar product
│ │ │ -
1419 lambda = rho/pp[0]; // minimization
│ │ │ -
1420 x.axpy(lambda,*(p[0])); // update solution
│ │ │ -
1421 b.axpy(-lambda,q); // update defect
│ │ │ -
1422
│ │ │ -
1423 // convergence test
│ │ │ -
1424 def=_sp->norm(b); // comp defect norm
│ │ │ -
1425 ++i;
│ │ │ -
1426 if(iteration.step(i, def)){
│ │ │ -
1427 _prec->post(x);
│ │ │ -
1428 return;
│ │ │ -
1429 }
│ │ │ -
1430
│ │ │ -
1431 while(i<_maxit) {
│ │ │ -
1432 // the loop
│ │ │ -
1433 int end=std::min(_restart, _maxit-i+1);
│ │ │ -
1434 for (int ii = 1; ii < end; ++ii)
│ │ │ -
1435 {
│ │ │ -
1436 //std::cout<<" ii="<<ii<<" i="<<i<<std::endl;
│ │ │ -
1437 // compute next conjugate direction
│ │ │ -
1438 prec_res = 0; // clear correction
│ │ │ -
1439 _prec->apply(prec_res,b); // apply preconditioner
│ │ │ -
1440
│ │ │ -
1441 p[ii].reset(new X(prec_res));
│ │ │ -
1442 _op->apply(prec_res, q);
│ │ │ -
1443
│ │ │ -
1444 for(int j=0; j<ii; ++j) {
│ │ │ -
1445 rho =_sp->dot(q,*(p[j]))/pp[j];
│ │ │ -
1446 p[ii]->axpy(-rho, *(p[j]));
│ │ │ -
1447 }
│ │ │ -
1448
│ │ │ -
1449 // minimize in given search direction
│ │ │ -
1450 _op->apply(*(p[ii]),q); // q=Ap
│ │ │ -
1451 pp[ii] = _sp->dot(*(p[ii]),q); // scalar product
│ │ │ -
1452 rho = _sp->dot(*(p[ii]),b); // orthogonalization
│ │ │ -
1453 lambda = rho/pp[ii]; // minimization
│ │ │ -
1454 x.axpy(lambda,*(p[ii])); // update solution
│ │ │ -
1455 b.axpy(-lambda,q); // update defect
│ │ │ -
1456
│ │ │ -
1457 // convergence test
│ │ │ -
1458 def = _sp->norm(b); // comp defect norm
│ │ │ -
1459
│ │ │ -
1460 ++i;
│ │ │ -
1461 iteration.step(i, def);
│ │ │ -
1462 }
│ │ │ -
1463 if(res.converged)
│ │ │ -
1464 break;
│ │ │ -
1465 if(end==_restart) {
│ │ │ -
1466 *(p[0])=*(p[_restart-1]);
│ │ │ -
1467 pp[0]=pp[_restart-1];
│ │ │ -
1468 }
│ │ │ -
1469 }
│ │ │ -
1470
│ │ │ -
1471 // postprocess preconditioner
│ │ │ -
1472 _prec->post(x);
│ │ │ -
1473
│ │ │ -
1474 }
│ │ │ -
│ │ │ -
1475
│ │ │ -
1476 private:
│ │ │ -
1477 using IterativeSolver<X,X>::_op;
│ │ │ -
1478 using IterativeSolver<X,X>::_prec;
│ │ │ -
1479 using IterativeSolver<X,X>::_sp;
│ │ │ -
1480 using IterativeSolver<X,X>::_reduction;
│ │ │ -
1481 using IterativeSolver<X,X>::_maxit;
│ │ │ -
1482 using IterativeSolver<X,X>::_verbose;
│ │ │ -
1483 using Iteration = typename IterativeSolver<X,X>::template Iteration<unsigned int>;
│ │ │ -
1484 int _restart;
│ │ │ -
1485 };
│ │ │ -
│ │ │ -
1486 DUNE_REGISTER_ITERATIVE_SOLVER("generalizedpcgsolver", defaultIterativeSolverCreator<Dune::GeneralizedPCGSolver>());
│ │ │ -
1487
│ │ │ -
1499 template<class X>
│ │ │ -
│ │ │ - │ │ │ -
1501 public:
│ │ │ -
1502 using typename IterativeSolver<X,X>::domain_type;
│ │ │ -
1503 using typename IterativeSolver<X,X>::range_type;
│ │ │ -
1504 using typename IterativeSolver<X,X>::field_type;
│ │ │ -
1505 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
1506
│ │ │ -
1507 private:
│ │ │ - │ │ │ -
1509
│ │ │ -
1510 public:
│ │ │ -
1511 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
1512 using IterativeSolver<X,X>::apply;
│ │ │ -
│ │ │ - │ │ │ -
1519 scalar_real_type reduction, int maxit, int verbose, int mmax = 10) : IterativeSolver<X,X>(op, prec, reduction, maxit, verbose), _mmax(mmax)
│ │ │ -
1520 {
│ │ │ -
1521 }
│ │ │ -
│ │ │ -
1522
│ │ │ -
│ │ │ - │ │ │ -
1529 scalar_real_type reduction, int maxit, int verbose, int mmax = 10) : IterativeSolver<X,X>(op, sp, prec, reduction, maxit, verbose), _mmax(mmax)
│ │ │ -
1530 {
│ │ │ -
1531 }
│ │ │ -
│ │ │ -
1532
│ │ │ -
│ │ │ -
1538 RestartedFCGSolver (std::shared_ptr<const LinearOperator<X,X>> op,
│ │ │ -
1539 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ -
1540 std::shared_ptr<Preconditioner<X,X>> prec,
│ │ │ -
1541 scalar_real_type reduction, int maxit, int verbose,
│ │ │ -
1542 int mmax = 10)
│ │ │ -
1543 : IterativeSolver<X,X>(op, sp, prec, reduction, maxit, verbose), _mmax(mmax)
│ │ │ -
1544 {}
│ │ │ -
│ │ │ -
1545
│ │ │ -
│ │ │ -
1558 RestartedFCGSolver (std::shared_ptr<const LinearOperator<X,X>> op,
│ │ │ -
1559 std::shared_ptr<Preconditioner<X,X>> prec,
│ │ │ -
1560 const ParameterTree& config)
│ │ │ -
1561 : IterativeSolver<X,X>(op, prec, config), _mmax(config.get("mmax", 10))
│ │ │ -
1562 {}
│ │ │ -
│ │ │ -
1563
│ │ │ -
│ │ │ -
1564 RestartedFCGSolver (std::shared_ptr<const LinearOperator<X,X>> op,
│ │ │ -
1565 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ -
1566 std::shared_ptr<Preconditioner<X,X>> prec,
│ │ │ -
1567 const ParameterTree& config)
│ │ │ -
1568 : IterativeSolver<X,X>(op, sp, prec, config), _mmax(config.get("mmax", 10))
│ │ │ -
1569 {}
│ │ │ -
│ │ │ -
1570
│ │ │ -
│ │ │ -
1583 virtual void apply (X& x, X& b, InverseOperatorResult& res)
│ │ │ -
1584 {
│ │ │ - │ │ │ -
1586 res.clear();
│ │ │ -
1587 Iteration iteration(*this,res);
│ │ │ -
1588 _prec->pre(x,b); // prepare preconditioner
│ │ │ -
1589 _op->applyscaleadd(-1,x,b); // overwrite b with defect
│ │ │ -
1590
│ │ │ -
1591 //arrays for interim values:
│ │ │ -
1592 std::vector<X> d(_mmax+1, x); // array for directions
│ │ │ -
1593 std::vector<X> Ad(_mmax+1, x); // array for Ad[i]
│ │ │ -
1594 std::vector<field_type,rAlloc> ddotAd(_mmax+1,0); // array for <d[i],Ad[i]>
│ │ │ -
1595 X w(x);
│ │ │ -
1596
│ │ │ -
1597 real_type def = _sp->norm(b); // compute norm
│ │ │ -
1598 if(iteration.step(0, def)){
│ │ │ -
1599 _prec->post(x);
│ │ │ -
1600 return;
│ │ │ -
1601 }
│ │ │ -
1602
│ │ │ -
1603 // some local variables
│ │ │ -
1604 field_type alpha;
│ │ │ -
1605
│ │ │ -
1606 // the loop
│ │ │ -
1607 int i=1;
│ │ │ -
1608 int i_bounded=0;
│ │ │ -
1609 while(i<=_maxit && !res.converged) {
│ │ │ -
1610 for (; i_bounded <= _mmax && i<= _maxit; i_bounded++) {
│ │ │ -
1611 d[i_bounded] = 0; // reset search direction
│ │ │ -
1612 _prec->apply(d[i_bounded], b); // apply preconditioner
│ │ │ -
1613 w = d[i_bounded]; // copy of current d[i]
│ │ │ -
1614 // orthogonalization with previous directions
│ │ │ -
1615 orthogonalizations(i_bounded,Ad,w,ddotAd,d);
│ │ │ -
1616
│ │ │ -
1617 //saving interim values for future calculating
│ │ │ -
1618 _op->apply(d[i_bounded], Ad[i_bounded]); // save Ad[i]
│ │ │ -
1619 ddotAd[i_bounded]=_sp->dot(d[i_bounded],Ad[i_bounded]); // save <d[i],Ad[i]>
│ │ │ -
1620 alpha = _sp->dot(d[i_bounded], b)/ddotAd[i_bounded]; // <d[i],b>/<d[i],Ad[i]>
│ │ │ -
1621
│ │ │ -
1622 //update solution and defect
│ │ │ -
1623 x.axpy(alpha, d[i_bounded]);
│ │ │ -
1624 b.axpy(-alpha, Ad[i_bounded]);
│ │ │ -
1625
│ │ │ -
1626 // convergence test
│ │ │ -
1627 def = _sp->norm(b); // comp defect norm
│ │ │ -
1628
│ │ │ -
1629 iteration.step(i, def);
│ │ │ -
1630 i++;
│ │ │ -
1631 }
│ │ │ -
1632 //restart: exchange first and last stored values
│ │ │ -
1633 cycle(Ad,d,ddotAd,i_bounded);
│ │ │ -
1634 }
│ │ │ -
1635
│ │ │ -
1636 //correct i which is wrong if convergence was not achieved.
│ │ │ -
1637 i=std::min(_maxit,i);
│ │ │ -
1638
│ │ │ -
1639 _prec->post(x); // postprocess preconditioner
│ │ │ -
1640 }
│ │ │ -
│ │ │ -
1641
│ │ │ -
1642 private:
│ │ │ -
1643 //This function is called every iteration to orthogonalize against the last search directions
│ │ │ -
1644 virtual void orthogonalizations(const int& i_bounded,const std::vector<X>& Ad, const X& w, const std::vector<field_type,ReboundAllocatorType<X,field_type>>& ddotAd,std::vector<X>& d) {
│ │ │ -
1645 // The RestartedFCGSolver uses only values with lower array index;
│ │ │ -
1646 for (int k = 0; k < i_bounded; k++) {
│ │ │ -
1647 d[i_bounded].axpy(-_sp->dot(Ad[k], w) / ddotAd[k], d[k]); // d[i] -= <<Ad[k],w>/<d[k],Ad[k]>>d[k]
│ │ │ -
1648 }
│ │ │ -
1649 }
│ │ │ -
1650
│ │ │ -
1651 // This function is called every mmax iterations to handle limited array sizes.
│ │ │ -
1652 virtual void cycle(std::vector<X>& Ad,std::vector<X>& d,std::vector<field_type,ReboundAllocatorType<X,field_type> >& ddotAd,int& i_bounded) {
│ │ │ -
1653 // Reset loop index and exchange the first and last arrays
│ │ │ -
1654 i_bounded = 1;
│ │ │ -
1655 std::swap(Ad[0], Ad[_mmax]);
│ │ │ -
1656 std::swap(d[0], d[_mmax]);
│ │ │ -
1657 std::swap(ddotAd[0], ddotAd[_mmax]);
│ │ │ -
1658 }
│ │ │ -
1659
│ │ │ -
1660 protected:
│ │ │ - │ │ │ -
1662 using IterativeSolver<X,X>::_op;
│ │ │ -
1663 using IterativeSolver<X,X>::_prec;
│ │ │ -
1664 using IterativeSolver<X,X>::_sp;
│ │ │ -
1665 using IterativeSolver<X,X>::_reduction;
│ │ │ -
1666 using IterativeSolver<X,X>::_maxit;
│ │ │ -
1667 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
1669 };
│ │ │ -
│ │ │ -
1670 DUNE_REGISTER_ITERATIVE_SOLVER("restartedfcgsolver", defaultIterativeSolverCreator<Dune::RestartedFCGSolver>());
│ │ │ -
1671
│ │ │ -
1678 template<class X>
│ │ │ -
│ │ │ - │ │ │ -
1680 public:
│ │ │ - │ │ │ -
1682 using typename RestartedFCGSolver<X>::range_type;
│ │ │ -
1683 using typename RestartedFCGSolver<X>::field_type;
│ │ │ -
1684 using typename RestartedFCGSolver<X>::real_type;
│ │ │ -
1685
│ │ │ -
1686 // copy base class constructors
│ │ │ -
1687 using RestartedFCGSolver<X>::RestartedFCGSolver;
│ │ │ -
1688
│ │ │ -
1689 // don't shadow four-argument version of apply defined in the base class
│ │ │ - │ │ │ -
1691
│ │ │ -
1692 // just a minor part of the RestartedFCGSolver apply method will be modified
│ │ │ -
│ │ │ -
1693 virtual void apply (X& x, X& b, InverseOperatorResult& res) override {
│ │ │ -
1694 // reset limiter of orthogonalization loop
│ │ │ -
1695 _k_limit = 0;
│ │ │ -
1696 this->RestartedFCGSolver<X>::apply(x,b,res);
│ │ │ -
1697 };
│ │ │ -
│ │ │ -
1698
│ │ │ -
1699 private:
│ │ │ -
1700 // This function is called every iteration to orthogonalize against the last search directions.
│ │ │ -
1701 virtual void orthogonalizations(const int& i_bounded,const std::vector<X>& Ad, const X& w, const std::vector<field_type,ReboundAllocatorType<X,field_type>>& ddotAd,std::vector<X>& d) override {
│ │ │ -
1702 // This FCGSolver uses values with higher array indexes too, if existent.
│ │ │ -
1703 for (int k = 0; k < _k_limit; k++) {
│ │ │ -
1704 if(i_bounded!=k)
│ │ │ -
1705 d[i_bounded].axpy(-_sp->dot(Ad[k], w) / ddotAd[k], d[k]); // d[i] -= <<Ad[k],w>/<d[k],Ad[k]>>d[k]
│ │ │ -
1706 }
│ │ │ -
1707 // The loop limit increase, if array is not completely filled.
│ │ │ -
1708 if(_k_limit<=i_bounded)
│ │ │ -
1709 _k_limit++;
│ │ │ -
1710
│ │ │ -
1711 };
│ │ │ -
1712
│ │ │ -
1713 // This function is called every mmax iterations to handle limited array sizes.
│ │ │ -
1714 virtual void cycle(std::vector<X>& Ad, [[maybe_unused]] std::vector<X>& d, [[maybe_unused]] std::vector<field_type,ReboundAllocatorType<X,field_type> >& ddotAd,int& i_bounded) override {
│ │ │ -
1715 // Only the loop index i_bounded return to 0, if it reached mmax.
│ │ │ -
1716 i_bounded = 0;
│ │ │ -
1717 // Now all arrays are filled and the loop in void orthogonalizations can use the whole arrays.
│ │ │ -
1718 _k_limit = Ad.size();
│ │ │ -
1719 };
│ │ │ -
1720
│ │ │ -
1721 int _k_limit = 0;
│ │ │ -
1722
│ │ │ -
1723 protected:
│ │ │ - │ │ │ -
1725 using RestartedFCGSolver<X>::_op;
│ │ │ - │ │ │ -
1727 using RestartedFCGSolver<X>::_sp;
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
1731 };
│ │ │ -
│ │ │ -
1732 DUNE_REGISTER_ITERATIVE_SOLVER("completefcgsolver", defaultIterativeSolverCreator<Dune::CompleteFCGSolver>());
│ │ │ -
1734} // end namespace
│ │ │ -
1735
│ │ │ -
1736#endif
│ │ │ - │ │ │ -
#define DUNE_REGISTER_ITERATIVE_SOLVER(name,...)
Definition solverregistry.hh:19
│ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ -
Define base class for scalar product and norm.
│ │ │ - │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ - │ │ │ - │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ - │ │ │ +
5#ifndef DUNE_ISTL_AMG_PROPERTIES_HH
│ │ │ +
6#define DUNE_ISTL_AMG_PROPERTIES_HH
│ │ │ +
7
│ │ │ +
8#include <dune/common/propertymap.hh>
│ │ │ +
9
│ │ │ +
10namespace Dune
│ │ │ +
11{
│ │ │ +
12
│ │ │ +
13 namespace Amg
│ │ │ +
14 {
│ │ │ +
│ │ │ + │ │ │ +
29 {};
│ │ │ +
│ │ │ +
30
│ │ │ +
31
│ │ │ +
38 template<typename C, typename K, std::size_t i,typename T=typename C::ValueType,
│ │ │ +
39 typename R = typename C::Reference>
│ │ │ +
│ │ │ + │ │ │ +
41 : public RAPropertyMapHelper<R,
│ │ │ +
42 RandomAccessBundledPropertyMap<C,K,i,T,R> >
│ │ │ +
43 {
│ │ │ +
44 public:
│ │ │ +
46 typedef C Container;
│ │ │ +
47
│ │ │ +
49 typedef R Reference;
│ │ │ +
50
│ │ │ +
52 typedef K Key;
│ │ │ +
53
│ │ │ +
57 typedef LvaluePropertyMapTag Category;
│ │ │ +
58
│ │ │ +
59 enum {
│ │ │ +
61 index = i
│ │ │ +
62 };
│ │ │ +
63
│ │ │ +
│ │ │ +
69 Reference operator[](const Key& key) const
│ │ │ +
70 {
│ │ │ +
71 return container_[key][index];
│ │ │ +
72 }
│ │ │ +
│ │ │ +
73
│ │ │ +
│ │ │ + │ │ │ +
79 : container_(&container)
│ │ │ +
80 {}
│ │ │ +
│ │ │ +
81
│ │ │ +
│ │ │ + │ │ │ +
84 : container_(0)
│ │ │ +
85 {}
│ │ │ +
│ │ │ +
86
│ │ │ +
87 private:
│ │ │ +
89 Container* container_;
│ │ │ +
90 };
│ │ │ +
│ │ │ +
91 }
│ │ │ +
92}
│ │ │ +
93
│ │ │ +
94#endif
│ │ │ +
Reference operator[](const Key &key) const
Get the property for a key.
Definition properties.hh:69
│ │ │ +
RandomAccessBundledPropertyMap()
The default constructor.
Definition properties.hh:83
│ │ │ +
R Reference
The reference type of the container.
Definition properties.hh:49
│ │ │ +
RandomAccessBundledPropertyMap(Container &container)
Constructor.
Definition properties.hh:78
│ │ │ +
K Key
The key of the property map.
Definition properties.hh:52
│ │ │ +
LvaluePropertyMapTag Category
The category of the property map.
Definition properties.hh:57
│ │ │ +
C Container
The container that holds the properties.
Definition properties.hh:46
│ │ │ +
@ index
The index of the property in the bundle.
Definition properties.hh:61
│ │ │
Definition allocator.hh:11
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
typename std::allocator_traits< typename AllocatorTraits< T >::type >::template rebind_alloc< X > ReboundAllocatorType
Definition allocator.hh:37
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ -
@ row_wise
Build in a row-wise manner.
Definition bcrsmatrix.hh:517
│ │ │ -
CreateIterator createend()
get create iterator pointing to one after the last block
Definition bcrsmatrix.hh:1100
│ │ │ -
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1094
│ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2001
│ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ -
Wrapper to use a range of ARPACK++ eigenvalue solvers.
Definition arpackpp.hh:245
│ │ │ -
void computeSymMaxMagnitude(const Real &epsilon, BlockVector &x, Real &lambda) const
Assume the matrix to be square, symmetric and perform IRLM to compute an approximation lambda of its ...
Definition arpackpp.hh:289
│ │ │ -
void computeSymMinMagnitude(const Real &epsilon, BlockVector &x, Real &lambda) const
Assume the matrix to be square, symmetric and perform IRLM to compute an approximation lambda of its ...
Definition arpackpp.hh:391
│ │ │ -
Thrown when a solver aborts due to some problem.
Definition istlexception.hh:46
│ │ │ -
A linear operator.
Definition operators.hh:69
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
double condition_estimate
Estimate of condition number.
Definition solver.hh:81
│ │ │ -
void clear()
Resets all data.
Definition solver.hh:58
│ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │ -
Simd::Scalar< real_type > scalar_real_type
scalar type underlying the field_type
Definition solver.hh:116
│ │ │ -
Y range_type
Type of the range of the operator to be inverted.
Definition solver.hh:107
│ │ │ -
X domain_type
Type of the domain of the operator to be inverted.
Definition solver.hh:104
│ │ │ -
X::field_type field_type
The field type of the operator.
Definition solver.hh:110
│ │ │ -
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solver.hh:113
│ │ │ -
Base class for all implementations of iterative solvers.
Definition solver.hh:205
│ │ │ -
std::shared_ptr< const ScalarProduct< X > > _sp
Definition solver.hh:508
│ │ │ -
std::shared_ptr< const LinearOperator< X, X > > _op
Definition solver.hh:506
│ │ │ -
int _maxit
Definition solver.hh:510
│ │ │ -
int _verbose
Definition solver.hh:511
│ │ │ -
scalar_real_type _reduction
Definition solver.hh:509
│ │ │ -
std::shared_ptr< Preconditioner< X, X > > _prec
Definition solver.hh:507
│ │ │ -
Preconditioned loop solver.
Definition solvers.hh:59
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition solvers.hh:73
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:116
│ │ │ -
gradient method
Definition solvers.hh:124
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:142
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:187
│ │ │ -
conjugate gradient method
Definition solvers.hh:193
│ │ │ -
CGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, scalar_real_type reduction, int maxit, int verbose, bool condition_estimate)
Constructor to initialize a CG solver.
Definition solvers.hh:256
│ │ │ -
static constexpr bool enableConditionEstimate
Definition solvers.hh:208
│ │ │ -
CGSolver(const LinearOperator< X, X > &op, const ScalarProduct< X > &sp, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose, bool condition_estimate)
Constructor to initialize a CG solver.
Definition solvers.hh:239
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:279
│ │ │ -
CGSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose, bool condition_estimate)
Constructor to initialize a CG solver.
Definition solvers.hh:222
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:412
│ │ │ -
Bi-conjugate Gradient Stabilized (BiCG-STAB)
Definition solvers.hh:419
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< CountType > Iteration
Definition solvers.hh:598
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:439
│ │ │ -
Minimal Residual Method (MINRES)
Definition solvers.hh:609
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:627
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:808
│ │ │ -
implements the Generalized Minimal Residual (GMRes) method
Definition solvers.hh:827
│ │ │ -
RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solvers.hh:878
│ │ │ -
std::enable_if<!std::is_same< field_type, real_type >::value, T >::type conjugate(const T &t)
Definition solvers.hh:1067
│ │ │ -
RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Definition solvers.hh:883
│ │ │ -
void update(X &w, int i, const std::vector< std::vector< field_type, fAlloc > > &H, const std::vector< field_type, fAlloc > &s, const std::vector< X > &v)
Definition solvers.hh:1039
│ │ │ -
std::enable_if< std::is_same< field_type, real_type >::value, T >::type conjugate(const T &t)
Definition solvers.hh:1062
│ │ │ -
ReboundAllocatorType< X, field_type > fAlloc
field_type Allocator retrieved from domain type
Definition solvers.hh:838
│ │ │ -
int _restart
Definition solvers.hh:1120
│ │ │ -
ReboundAllocatorType< X, real_type > rAlloc
real_type Allocator retrieved from domain type
Definition solvers.hh:840
│ │ │ -
virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:923
│ │ │ -
RestartedGMResSolver(const LinearOperator< X, Y > &op, Preconditioner< X, Y > &prec, scalar_real_type reduction, int restart, int maxit, int verbose)
Set up RestartedGMResSolver solver.
Definition solvers.hh:850
│ │ │ -
RestartedGMResSolver(const LinearOperator< X, Y > &op, const ScalarProduct< X > &sp, Preconditioner< X, Y > &prec, scalar_real_type reduction, int restart, int maxit, int verbose)
Set up RestartedGMResSolver solver.
Definition solvers.hh:861
│ │ │ -
void generatePlaneRotation(field_type &dx, field_type &dy, real_type &cs, field_type &sn)
Definition solvers.hh:1073
│ │ │ -
RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, Y > > prec, scalar_real_type reduction, int restart, int maxit, int verbose)
Set up RestartedGMResSolver solver.
Definition solvers.hh:894
│ │ │ -
virtual void apply(X &x, Y &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:910
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:1119
│ │ │ -
void applyPlaneRotation(field_type &dx, field_type &dy, real_type &cs, field_type &sn)
Definition solvers.hh:1106
│ │ │ -
implements the Flexible Generalized Minimal Residual (FGMRes) method (right preconditioned)
Definition solvers.hh:1139
│ │ │ -
void apply(X &x, Y &b, double reduction, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:1169
│ │ │ -
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1307
│ │ │ -
GeneralizedPCGSolver(const LinearOperator< X, X > &op, const ScalarProduct< X > &sp, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose, int restart=10)
Set up nonlinear preconditioned conjugate gradient solver.
Definition solvers.hh:1343
│ │ │ -
GeneralizedPCGSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose, int restart=10)
Set up nonlinear preconditioned conjugate gradient solver.
Definition solvers.hh:1331
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:1391
│ │ │ -
GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solvers.hh:1361
│ │ │ -
GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, scalar_real_type reduction, int maxit, int verbose, int restart=10)
Set up nonlinear preconditioned conjugate gradient solver.
Definition solvers.hh:1377
│ │ │ -
GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Definition solvers.hh:1366
│ │ │ -
Accelerated flexible conjugate gradient method.
Definition solvers.hh:1500
│ │ │ -
RestartedFCGSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose, int mmax=10)
Constructor to initialize a RestartedFCG solver.
Definition solvers.hh:1518
│ │ │ -
RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &config)
Constructor.
Definition solvers.hh:1558
│ │ │ -
RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, scalar_real_type reduction, int maxit, int verbose, int mmax=10)
Constructor to initialize a RestartedFCG solver.
Definition solvers.hh:1538
│ │ │ -
int _mmax
Definition solvers.hh:1661
│ │ │ -
RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &config)
Definition solvers.hh:1564
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:1668
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)
Apply inverse operator.
Definition solvers.hh:1583
│ │ │ -
RestartedFCGSolver(const LinearOperator< X, X > &op, const ScalarProduct< X > &sp, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose, int mmax=10)
Constructor to initialize a RestartedFCG solver.
Definition solvers.hh:1528
│ │ │ -
Complete flexible conjugate gradient method.
Definition solvers.hh:1679
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:1693
│ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ +
A property map that extracts one property out of a bundle using operator[]()
Definition properties.hh:43
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1928 +1,110 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -solvers.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +properties.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5 │ │ │ │ -6#ifndef DUNE_ISTL_SOLVERS_HH │ │ │ │ -7#define DUNE_ISTL_SOLVERS_HH │ │ │ │ -8 │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15#include │ │ │ │ -16 │ │ │ │ -17#include │ │ │ │ -18#include │ │ │ │ -19#include │ │ │ │ -20#include │ │ │ │ -21#include │ │ │ │ -22#include │ │ │ │ -23 │ │ │ │ -24#include <_d_u_n_e_/_i_s_t_l_/_a_l_l_o_c_a_t_o_r_._h_h> │ │ │ │ -25#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ -26#include <_d_u_n_e_/_i_s_t_l_/_e_i_g_e_n_v_a_l_u_e_/_a_r_p_a_c_k_p_p_._h_h> │ │ │ │ -27#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ -28#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ -29#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h> │ │ │ │ -30#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ -31#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -32#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ -33 │ │ │ │ -34namespace _D_u_n_e { │ │ │ │ -46 //===================================================================== │ │ │ │ -47 // Implementation of this interface │ │ │ │ -48 //===================================================================== │ │ │ │ -49 │ │ │ │ -58 template │ │ │ │ -_5_9 class _L_o_o_p_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r { │ │ │ │ -60 public: │ │ │ │ -61 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -62 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -63 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -64 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -65 │ │ │ │ -66 // copy base class constructors │ │ │ │ -67 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::IterativeSolver; │ │ │ │ -68 │ │ │ │ -69 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -70 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -71 │ │ │ │ -_7_3 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -74 { │ │ │ │ -75 _I_t_e_r_a_t_i_o_n iteration(*this, res); │ │ │ │ -76 ___p_r_e_c->pre(x,b); │ │ │ │ -77 │ │ │ │ -78 // overwrite b with defect │ │ │ │ -79 ___o_p->applyscaleadd(-1,x,b); │ │ │ │ -80 │ │ │ │ -81 // compute norm, \todo parallelization │ │ │ │ -82 _r_e_a_l___t_y_p_e def = ___s_p->norm(b); │ │ │ │ -83 if(iteration.step(0, def)){ │ │ │ │ -84 ___p_r_e_c->post(x); │ │ │ │ -85 return; │ │ │ │ -86 } │ │ │ │ -87 // prepare preconditioner │ │ │ │ -88 │ │ │ │ -89 // allocate correction vector │ │ │ │ -90 X v(x); │ │ │ │ -91 │ │ │ │ -92 // iteration loop │ │ │ │ -93 int i=1; │ │ │ │ -94 for ( ; i<=___m_a_x_i_t; i++ ) │ │ │ │ -95 { │ │ │ │ -96 v = 0; // clear correction │ │ │ │ -97 ___p_r_e_c->apply(v,b); // apply preconditioner │ │ │ │ -98 x += v; // update solution │ │ │ │ -99 ___o_p->applyscaleadd(-1,v,b); // update defect │ │ │ │ -100 def=___s_p->norm(b); // comp defect norm │ │ │ │ -101 if(iteration.step(i, def)) │ │ │ │ -102 break; │ │ │ │ -103 } │ │ │ │ -104 │ │ │ │ -105 // postprocess preconditioner │ │ │ │ -106 ___p_r_e_c->post(x); │ │ │ │ -107 } │ │ │ │ -108 │ │ │ │ -109 protected: │ │ │ │ -110 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -111 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -112 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -113 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -114 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -115 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -_1_1_6 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_u_n_s_i_g_n_e_d_ _i_n_t_>; │ │ │ │ -117 }; │ │ │ │ -_1_1_8 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("loopsolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -119 │ │ │ │ -120 │ │ │ │ -121 // all these solvers are taken from the SUMO library │ │ │ │ -123 template │ │ │ │ -_1_2_4 class _G_r_a_d_i_e_n_t_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r { │ │ │ │ -125 public: │ │ │ │ -126 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -127 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -128 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -129 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -130 │ │ │ │ -131 // copy base class constructors │ │ │ │ -132 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::IterativeSolver; │ │ │ │ -133 │ │ │ │ -134 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -135 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -136 │ │ │ │ -_1_4_2 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -143 { │ │ │ │ -144 _I_t_e_r_a_t_i_o_n iteration(*this, res); │ │ │ │ -145 ___p_r_e_c->pre(x,b); // prepare preconditioner │ │ │ │ -146 │ │ │ │ -147 ___o_p->applyscaleadd(-1,x,b); // overwrite b with defec │ │ │ │ -148 │ │ │ │ -149 _r_e_a_l___t_y_p_e def = ___s_p->norm(b); // compute norm │ │ │ │ -150 if(iteration.step(0, def)){ │ │ │ │ -151 ___p_r_e_c->post(x); │ │ │ │ -152 return; │ │ │ │ -153 } │ │ │ │ -154 │ │ │ │ -155 X p(x); // create local vectors │ │ │ │ -156 X q(b); │ │ │ │ -157 │ │ │ │ -158 int i=1; // loop variables │ │ │ │ -159 _f_i_e_l_d___t_y_p_e lambda; │ │ │ │ -160 for ( ; i<=___m_a_x_i_t; i++ ) │ │ │ │ -161 { │ │ │ │ -162 p = 0; // clear correction │ │ │ │ -163 ___p_r_e_c->apply(p,b); // apply preconditioner │ │ │ │ -164 ___o_p->apply(p,q); // q=Ap │ │ │ │ -165 auto alpha = ___s_p->dot(q,p); │ │ │ │ -166 lambda = Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -167 _f_i_e_l_d___t_y_p_e(0.), // no need for minimization if def is already 0 │ │ │ │ -168 ___s_p->dot(p,b)/alpha); // minimization │ │ │ │ -169 x.axpy(lambda,p); // update solution │ │ │ │ -170 b.axpy(-lambda,q); // update defect │ │ │ │ -171 │ │ │ │ -172 def =___s_p->norm(b); // comp defect norm │ │ │ │ -173 if(iteration.step(i, def)) │ │ │ │ -174 break; │ │ │ │ -175 } │ │ │ │ -176 // postprocess preconditioner │ │ │ │ -177 ___p_r_e_c->post(x); │ │ │ │ -178 } │ │ │ │ -179 │ │ │ │ -180 protected: │ │ │ │ -181 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -182 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -183 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -184 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -185 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -186 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -_1_8_7 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_u_n_s_i_g_n_e_d_ _i_n_t_>; │ │ │ │ -188 }; │ │ │ │ -_1_8_9 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("gradientsolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -190 │ │ │ │ -192 template │ │ │ │ -_1_9_3 class _C_G_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r { │ │ │ │ -194 public: │ │ │ │ -195 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -196 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -197 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -198 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -199 │ │ │ │ -200 // copy base class constructors │ │ │ │ -201 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::IterativeSolver; │ │ │ │ -202 │ │ │ │ -203 private: │ │ │ │ -204 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ -205 │ │ │ │ -206 protected: │ │ │ │ -207 │ │ │ │ -_2_0_8 static constexpr bool _e_n_a_b_l_e_C_o_n_d_i_t_i_o_n_E_s_t_i_m_a_t_e = (std:: │ │ │ │ -is_same_v || std::is_same_v); │ │ │ │ -209 │ │ │ │ -210 public: │ │ │ │ -211 │ │ │ │ -212 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -213 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -214 │ │ │ │ -_2_2_2 _C_G_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_X_>& op, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>& prec, │ │ │ │ -223 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, bool │ │ │ │ -condition_estimate) : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, prec, reduction, maxit, │ │ │ │ -verbose), │ │ │ │ -224 condition_estimate_(condition_estimate) │ │ │ │ -225 { │ │ │ │ -226 if (condition_estimate && !_e_n_a_b_l_e_C_o_n_d_i_t_i_o_n_E_s_t_i_m_a_t_e) { │ │ │ │ -227 condition_estimate_ = false; │ │ │ │ -228 std::cerr << "WARNING: Condition estimate was disabled. It is only │ │ │ │ -available for double and float field types!" << std::endl; │ │ │ │ -229 } │ │ │ │ -230 } │ │ │ │ -231 │ │ │ │ -_2_3_9 _C_G_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_X_>& op, const _S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>& sp, │ │ │ │ -_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>& prec, │ │ │ │ -240 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, bool │ │ │ │ -condition_estimate) : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, sp, prec, reduction, maxit, │ │ │ │ -verbose), │ │ │ │ -241 condition_estimate_(condition_estimate) │ │ │ │ -242 { │ │ │ │ -243 if (condition_estimate && !(std::is_same::value || std:: │ │ │ │ -is_same::value)) { │ │ │ │ -244 condition_estimate_ = false; │ │ │ │ -245 std::cerr << "WARNING: Condition estimate was disabled. It is only │ │ │ │ -available for double and float field types!" << std::endl; │ │ │ │ -246 } │ │ │ │ -247 } │ │ │ │ -248 │ │ │ │ -_2_5_6 _C_G_S_o_l_v_e_r (std::shared_ptr> op, std:: │ │ │ │ -shared_ptr<_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>> sp, │ │ │ │ -257 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>> prec, │ │ │ │ -258 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, bool │ │ │ │ -condition_estimate) │ │ │ │ -259 : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, sp, prec, reduction, maxit, verbose), │ │ │ │ -260 condition_estimate_(condition_estimate) │ │ │ │ -261 { │ │ │ │ -262 if (condition_estimate && !(std::is_same::value || std:: │ │ │ │ -is_same::value)) { │ │ │ │ -263 condition_estimate_ = false; │ │ │ │ -264 std::cerr << "WARNING: Condition estimate was disabled. It is only │ │ │ │ -available for double and float field types!" << std::endl; │ │ │ │ -265 } │ │ │ │ -266 } │ │ │ │ -267 │ │ │ │ -_2_7_9 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -280 { │ │ │ │ -281 _I_t_e_r_a_t_i_o_n iteration(*this,res); │ │ │ │ -282 ___p_r_e_c->pre(x,b); // prepare preconditioner │ │ │ │ -283 │ │ │ │ -284 ___o_p->applyscaleadd(-1,x,b); // overwrite b with defect │ │ │ │ -285 │ │ │ │ -286 _r_e_a_l___t_y_p_e def = ___s_p->norm(b); // compute norm │ │ │ │ -287 if(iteration.step(0, def)){ │ │ │ │ -288 ___p_r_e_c->post(x); │ │ │ │ -289 return; │ │ │ │ -290 } │ │ │ │ -291 │ │ │ │ -292 X p(x); // the search direction │ │ │ │ -293 X q(x); // a temporary vector │ │ │ │ -294 │ │ │ │ -295 // Remember lambda and beta values for condition estimate │ │ │ │ -296 std::vector lambdas(0); │ │ │ │ -297 std::vector betas(0); │ │ │ │ -298 │ │ │ │ -299 // some local variables │ │ │ │ -300 _f_i_e_l_d___t_y_p_e rho,rholast,lambda,alpha,beta; │ │ │ │ -301 │ │ │ │ -302 // determine initial search direction │ │ │ │ -303 p = 0; // clear correction │ │ │ │ -304 ___p_r_e_c->apply(p,b); // apply preconditioner │ │ │ │ -305 rholast = ___s_p->dot(p,b); // orthogonalization │ │ │ │ -306 │ │ │ │ -307 // the loop │ │ │ │ -308 int i=1; │ │ │ │ -309 for ( ; i<=___m_a_x_i_t; i++ ) │ │ │ │ -310 { │ │ │ │ -311 // minimize in given search direction p │ │ │ │ -312 ___o_p->apply(p,q); // q=Ap │ │ │ │ -313 alpha = ___s_p->dot(p,q); // scalar product │ │ │ │ -314 lambda = Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), _f_i_e_l_d___t_y_p_e(0.), rholast/alpha); / │ │ │ │ -/ minimization │ │ │ │ -315 if constexpr (_e_n_a_b_l_e_C_o_n_d_i_t_i_o_n_E_s_t_i_m_a_t_e) │ │ │ │ -316 if (condition_estimate_) │ │ │ │ -317 lambdas.push_back(std::real(lambda)); │ │ │ │ -318 x.axpy(lambda,p); // update solution │ │ │ │ -319 b.axpy(-lambda,q); // update defect │ │ │ │ -320 │ │ │ │ -321 // convergence test │ │ │ │ -322 def=___s_p->norm(b); // comp defect norm │ │ │ │ -323 if(iteration.step(i, def)) │ │ │ │ -324 break; │ │ │ │ -325 │ │ │ │ -326 // determine new search direction │ │ │ │ -327 q = 0; // clear correction │ │ │ │ -328 ___p_r_e_c->apply(q,b); // apply preconditioner │ │ │ │ -329 rho = ___s_p->dot(q,b); // orthogonalization │ │ │ │ -330 beta = Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), _f_i_e_l_d___t_y_p_e(0.), rho/rholast); / │ │ │ │ -/ scaling factor │ │ │ │ -331 if constexpr (_e_n_a_b_l_e_C_o_n_d_i_t_i_o_n_E_s_t_i_m_a_t_e) │ │ │ │ -332 if (condition_estimate_) │ │ │ │ -333 betas.push_back(std::real(beta)); │ │ │ │ -334 p *= beta; // scale old search direction │ │ │ │ -335 p += q; // orthogonalization with correction │ │ │ │ -336 rholast = rho; // remember rho for recurrence │ │ │ │ -337 } │ │ │ │ -338 │ │ │ │ -339 ___p_r_e_c->post(x); // postprocess preconditioner │ │ │ │ -340 │ │ │ │ -341 if (condition_estimate_) { │ │ │ │ -342#if HAVE_ARPACKPP │ │ │ │ -343 if constexpr (_e_n_a_b_l_e_C_o_n_d_i_t_i_o_n_E_s_t_i_m_a_t_e) { │ │ │ │ -344 using std::sqrt; │ │ │ │ -345 │ │ │ │ -346 // Build T matrix which has extreme eigenvalues approximating │ │ │ │ -347 // those of the original system │ │ │ │ -348 // (see Y. Saad, Iterative methods for sparse linear systems) │ │ │ │ -349 │ │ │ │ -350 _C_O_N_D___M_A_T T(i, i, _C_O_N_D___M_A_T_:_:_r_o_w___w_i_s_e); │ │ │ │ -351 │ │ │ │ -352 for (auto row = T._c_r_e_a_t_e_b_e_g_i_n(); row != T._c_r_e_a_t_e_e_n_d(); ++row) { │ │ │ │ -353 if (row.index() > 0) │ │ │ │ -354 row.insert(row.index()-1); │ │ │ │ -355 row.insert(row.index()); │ │ │ │ -356 if (row.index() < T._N() - 1) │ │ │ │ -357 row.insert(row.index()+1); │ │ │ │ -358 } │ │ │ │ -359 for (int row = 0; row < i; ++row) { │ │ │ │ -360 if (row > 0) { │ │ │ │ -361 T[row][row-1] = sqrt(betas[row-1]) / lambdas[row-1]; │ │ │ │ -362 } │ │ │ │ -363 │ │ │ │ -364 T[row][row] = 1.0 / lambdas[row]; │ │ │ │ -365 if (row > 0) { │ │ │ │ -366 T[row][row] += betas[row-1] / lambdas[row-1]; │ │ │ │ -367 } │ │ │ │ -368 │ │ │ │ -369 if (row < i - 1) { │ │ │ │ -370 T[row][row+1] = sqrt(betas[row]) / lambdas[row]; │ │ │ │ -371 } │ │ │ │ -372 } │ │ │ │ -373 │ │ │ │ -374 // Compute largest and smallest eigenvalue of T matrix and return as │ │ │ │ -estimate │ │ │ │ -375 _D_u_n_e_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s_<_C_O_N_D___M_A_T_,_ _C_O_N_D___V_E_C_> arpack(T); │ │ │ │ -376 │ │ │ │ -377 _r_e_a_l___t_y_p_e eps = 0.0; │ │ │ │ -378 _C_O_N_D___V_E_C eigv; │ │ │ │ -379 _r_e_a_l___t_y_p_e min_eigv, max_eigv; │ │ │ │ -380 arpack._c_o_m_p_u_t_e_S_y_m_M_i_n_M_a_g_n_i_t_u_d_e (eps, eigv, min_eigv); │ │ │ │ -381 arpack._c_o_m_p_u_t_e_S_y_m_M_a_x_M_a_g_n_i_t_u_d_e (eps, eigv, max_eigv); │ │ │ │ -382 │ │ │ │ -383 res._c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e = max_eigv / min_eigv; │ │ │ │ -384 │ │ │ │ -385 if (this->___v_e_r_b_o_s_e > 0) { │ │ │ │ -386 std::cout << "Min eigv estimate: " << Simd::io(min_eigv) << '\n'; │ │ │ │ -387 std::cout << "Max eigv estimate: " << Simd::io(max_eigv) << '\n'; │ │ │ │ -388 std::cout << "Condition estimate: " │ │ │ │ -389 << Simd::io(max_eigv / min_eigv) << std::endl; │ │ │ │ -390 } │ │ │ │ -391 } │ │ │ │ -392#else │ │ │ │ -393 std::cerr << "WARNING: Condition estimate was requested. This requires │ │ │ │ -ARPACK, but ARPACK was not found!" << std::endl; │ │ │ │ -394#endif │ │ │ │ -395 } │ │ │ │ -396 } │ │ │ │ -397 │ │ │ │ -398 private: │ │ │ │ -399 bool condition_estimate_ = false; │ │ │ │ -400 │ │ │ │ -401 // Matrix and vector types used for condition estimate │ │ │ │ -402 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x_<_r_e_a_l___t_y_p_e_,_1_,_1_> > COND_MAT; │ │ │ │ -403 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_D_u_n_e_:_:_F_i_e_l_d_V_e_c_t_o_r_<_r_e_a_l___t_y_p_e_,_1_> > COND_VEC; │ │ │ │ -404 │ │ │ │ -405 protected: │ │ │ │ -406 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -407 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -408 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -409 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -410 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -411 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -_4_1_2 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_u_n_s_i_g_n_e_d_ _i_n_t_>; │ │ │ │ -413 }; │ │ │ │ -_4_1_4 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("cgsolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -415 │ │ │ │ -416 // Ronald Kriemanns BiCG-STAB implementation from Sumo │ │ │ │ -418 template │ │ │ │ -_4_1_9 class _B_i_C_G_S_T_A_B_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r { │ │ │ │ -420 public: │ │ │ │ -421 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -422 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -423 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -424 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -425 │ │ │ │ -426 // copy base class constructors │ │ │ │ -427 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::IterativeSolver; │ │ │ │ -428 │ │ │ │ -429 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -430 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -431 │ │ │ │ -_4_3_9 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -440 { │ │ │ │ -441 using std::abs; │ │ │ │ -442 const Simd::Scalar EPSILON=1e-80; │ │ │ │ -443 using std::abs; │ │ │ │ -444 double it; │ │ │ │ -445 _f_i_e_l_d___t_y_p_e rho, rho_new, alpha, beta, h, omega; │ │ │ │ -446 _r_e_a_l___t_y_p_e norm; │ │ │ │ -447 │ │ │ │ -448 // │ │ │ │ -449 // get vectors and matrix │ │ │ │ -450 // │ │ │ │ -451 X& r=b; │ │ │ │ -452 X p(x); │ │ │ │ -453 X v(x); │ │ │ │ -454 X t(x); │ │ │ │ -455 X y(x); │ │ │ │ -456 X rt(x); │ │ │ │ -457 │ │ │ │ -458 // │ │ │ │ -459 // begin iteration │ │ │ │ -460 // │ │ │ │ -461 │ │ │ │ -462 // r = r - Ax; rt = r │ │ │ │ -463 _I_t_e_r_a_t_i_o_n_<_d_o_u_b_l_e_> iteration(*this,res); │ │ │ │ -464 ___p_r_e_c->pre(x,r); // prepare preconditioner │ │ │ │ -465 │ │ │ │ -466 ___o_p->applyscaleadd(-1,x,r); // overwrite b with defect │ │ │ │ -467 │ │ │ │ -468 rt=r; │ │ │ │ -469 │ │ │ │ -470 norm = ___s_p->norm(r); │ │ │ │ -471 if(iteration.step(0, norm)){ │ │ │ │ -472 ___p_r_e_c->post(x); │ │ │ │ -473 return; │ │ │ │ -474 } │ │ │ │ -475 p=0; │ │ │ │ -476 v=0; │ │ │ │ -477 │ │ │ │ -478 rho = 1; │ │ │ │ -479 alpha = 1; │ │ │ │ -480 omega = 1; │ │ │ │ -481 │ │ │ │ -482 // │ │ │ │ -483 // iteration │ │ │ │ -484 // │ │ │ │ -485 │ │ │ │ -486 for (it = 0.5; it < ___m_a_x_i_t; it+=.5) │ │ │ │ -487 { │ │ │ │ -488 // │ │ │ │ -489 // preprocess, set vecsizes etc. │ │ │ │ -490 // │ │ │ │ -491 │ │ │ │ -492 // rho_new = < rt , r > │ │ │ │ -493 rho_new = ___s_p->dot(rt,r); │ │ │ │ -494 │ │ │ │ -495 // look if breakdown occurred │ │ │ │ -496 if (Simd::allTrue(abs(rho) <= EPSILON)) │ │ │ │ -497 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t,"breakdown in BiCGSTAB - rho " │ │ │ │ -498 << Simd::io(rho) << " <= EPSILON " << EPSILON │ │ │ │ -499 << " after " << it << " iterations"); │ │ │ │ -500 if (Simd::allTrue(abs(omega) <= EPSILON)) │ │ │ │ -501 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t,"breakdown in BiCGSTAB - omega " │ │ │ │ -502 << Simd::io(omega) << " <= EPSILON " << EPSILON │ │ │ │ -503 << " after " << it << " iterations"); │ │ │ │ -504 │ │ │ │ -505 │ │ │ │ -506 if (it<1) │ │ │ │ -507 p = r; │ │ │ │ -508 else │ │ │ │ -509 { │ │ │ │ -510 beta = Simd::cond(norm==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -511 _f_i_e_l_d___t_y_p_e(0.), // no need for orthogonalization if norm is already 0 │ │ │ │ -512 ( rho_new / rho ) * ( alpha / omega )); │ │ │ │ -513 p.axpy(-omega,v); // p = r + beta (p - omega*v) │ │ │ │ -514 p *= beta; │ │ │ │ -515 p += r; │ │ │ │ -516 } │ │ │ │ -517 │ │ │ │ -518 // y = W^-1 * p │ │ │ │ -519 y = 0; │ │ │ │ -520 ___p_r_e_c->apply(y,p); // apply preconditioner │ │ │ │ -521 │ │ │ │ -522 // v = A * y │ │ │ │ -523 ___o_p->apply(y,v); │ │ │ │ -524 │ │ │ │ -525 // alpha = rho_new / < rt, v > │ │ │ │ -526 h = ___s_p->dot(rt,v); │ │ │ │ -527 │ │ │ │ -528 if ( Simd::allTrue(abs(h) < EPSILON) ) │ │ │ │ -529 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t,"abs(h) < EPSILON in BiCGSTAB - abs(h) " │ │ │ │ -530 << Simd::io(abs(h)) << " < EPSILON " << EPSILON │ │ │ │ -531 << " after " << it << " iterations"); │ │ │ │ -532 │ │ │ │ -533 alpha = Simd::cond(norm==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -534 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -535 rho_new / h); │ │ │ │ -536 │ │ │ │ -537 // apply first correction to x │ │ │ │ -538 // x <- x + alpha y │ │ │ │ -539 x.axpy(alpha,y); │ │ │ │ -540 │ │ │ │ -541 // r = r - alpha*v │ │ │ │ -542 r.axpy(-alpha,v); │ │ │ │ -543 │ │ │ │ -544 // │ │ │ │ -545 // test stop criteria │ │ │ │ -546 // │ │ │ │ -547 │ │ │ │ -548 norm = ___s_p->norm(r); │ │ │ │ -549 if(iteration.step(it, norm)){ │ │ │ │ -550 break; │ │ │ │ -551 } │ │ │ │ -552 │ │ │ │ -553 it+=.5; │ │ │ │ -554 │ │ │ │ -555 // y = W^-1 * r │ │ │ │ -556 y = 0; │ │ │ │ -557 ___p_r_e_c->apply(y,r); │ │ │ │ -558 │ │ │ │ -559 // t = A * y │ │ │ │ -560 ___o_p->apply(y,t); │ │ │ │ -561 │ │ │ │ -562 // omega = < t, r > / < t, t > │ │ │ │ -563 h = ___s_p->dot(t,t); │ │ │ │ -564 omega = Simd::cond(norm==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -565 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -566 ___s_p->dot(t,r)/h); │ │ │ │ -567 │ │ │ │ -568 // apply second correction to x │ │ │ │ -569 // x <- x + omega y │ │ │ │ -570 x.axpy(omega,y); │ │ │ │ -571 │ │ │ │ -572 // r = s - omega*t (remember : r = s) │ │ │ │ -573 r.axpy(-omega,t); │ │ │ │ -574 │ │ │ │ -575 rho = rho_new; │ │ │ │ -576 │ │ │ │ -577 // │ │ │ │ -578 // test stop criteria │ │ │ │ -579 // │ │ │ │ -580 │ │ │ │ -581 norm = ___s_p->norm(r); │ │ │ │ -582 if(iteration.step(it, norm)){ │ │ │ │ -583 break; │ │ │ │ -584 } │ │ │ │ -585 } // end for │ │ │ │ -586 │ │ │ │ -587 ___p_r_e_c->post(x); // postprocess preconditioner │ │ │ │ -588 } │ │ │ │ -589 │ │ │ │ -590 protected: │ │ │ │ -591 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -592 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -593 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -594 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -595 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -596 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -597 template │ │ │ │ -_5_9_8 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_C_o_u_n_t_T_y_p_e_>; │ │ │ │ -599 }; │ │ │ │ -_6_0_0 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("bicgstabsolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -601 │ │ │ │ -608 template │ │ │ │ -_6_0_9 class _M_I_N_R_E_S_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r { │ │ │ │ -610 public: │ │ │ │ -611 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -612 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -613 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -614 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -615 │ │ │ │ -616 // copy base class constructors │ │ │ │ -617 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::IterativeSolver; │ │ │ │ -618 │ │ │ │ -619 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -620 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -621 │ │ │ │ -_6_2_7 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -628 { │ │ │ │ -629 using std::sqrt; │ │ │ │ -630 using std::abs; │ │ │ │ -631 _I_t_e_r_a_t_i_o_n iteration(*this, res); │ │ │ │ -632 // prepare preconditioner │ │ │ │ -633 ___p_r_e_c->pre(x,b); │ │ │ │ -634 │ │ │ │ -635 // overwrite rhs with defect │ │ │ │ -636 ___o_p->applyscaleadd(-1.0,x,b); // b -= Ax │ │ │ │ -637 │ │ │ │ -638 // some temporary vectors │ │ │ │ -639 X z(b), dummy(b); │ │ │ │ -640 z = 0.0; │ │ │ │ -641 │ │ │ │ -642 // calculate preconditioned defect │ │ │ │ -643 ___p_r_e_c->apply(z,b); // r = W^-1 (b - Ax) │ │ │ │ -644 _r_e_a_l___t_y_p_e def = ___s_p->norm(z); │ │ │ │ -645 if (iteration.step(0, def)){ │ │ │ │ -646 ___p_r_e_c->post(x); │ │ │ │ -647 return; │ │ │ │ -648 } │ │ │ │ -649 │ │ │ │ -650 // recurrence coefficients as computed in Lanczos algorithm │ │ │ │ -651 _f_i_e_l_d___t_y_p_e alpha, beta; │ │ │ │ -652 // diagonal entries of givens rotation │ │ │ │ -653 std::array c{{0.0,0.0}}; │ │ │ │ -654 // off-diagonal entries of givens rotation │ │ │ │ -655 std::array s{{0.0,0.0}}; │ │ │ │ -656 │ │ │ │ -657 // recurrence coefficients (column k of tridiag matrix T_k) │ │ │ │ -658 std::array T{{0.0,0.0,0.0}}; │ │ │ │ -659 │ │ │ │ -660 // the rhs vector of the min problem │ │ │ │ -661 std::array xi{{1.0,0.0}}; │ │ │ │ -662 │ │ │ │ -663 // beta is real and positive in exact arithmetic │ │ │ │ -664 // since it is the norm of the basis vectors (in unpreconditioned case) │ │ │ │ -665 beta = sqrt(___s_p->dot(b,z)); │ │ │ │ -666 _f_i_e_l_d___t_y_p_e beta0 = beta; │ │ │ │ -667 │ │ │ │ -668 // the search directions │ │ │ │ -669 std::array p{{b,b,b}}; │ │ │ │ -670 p[0] = 0.0; │ │ │ │ -671 p[1] = 0.0; │ │ │ │ -672 p[2] = 0.0; │ │ │ │ -673 │ │ │ │ -674 // orthonormal basis vectors (in unpreconditioned case) │ │ │ │ -675 std::array q{{b,b,b}}; │ │ │ │ -676 q[0] = 0.0; │ │ │ │ -677 q[1] *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -678 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -679 _r_e_a_l___t_y_p_e(1.0)/beta); │ │ │ │ -680 q[2] = 0.0; │ │ │ │ -681 │ │ │ │ -682 z *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -683 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -684 _r_e_a_l___t_y_p_e(1.0)/beta); │ │ │ │ -685 │ │ │ │ -686 // the loop │ │ │ │ -687 int i = 1; │ │ │ │ -688 for( ; i<=___m_a_x_i_t; i++) { │ │ │ │ -689 │ │ │ │ -690 dummy = z; │ │ │ │ -691 int i1 = i%3, │ │ │ │ -692 i0 = (i1+2)%3, │ │ │ │ -693 i2 = (i1+1)%3; │ │ │ │ -694 │ │ │ │ -695 // symmetrically preconditioned Lanczos algorithm (see Greenbaum p.121) │ │ │ │ -696 ___o_p->apply(z,q[i2]); // q[i2] = Az │ │ │ │ -697 q[i2].axpy(-beta,q[i0]); │ │ │ │ -698 // alpha is real since it is the diagonal entry of the hermitian │ │ │ │ -tridiagonal matrix │ │ │ │ -699 // from the Lanczos Algorithm │ │ │ │ -700 // so the order in the scalar product doesn't matter even for the complex │ │ │ │ -case │ │ │ │ -701 alpha = ___s_p->dot(z,q[i2]); │ │ │ │ -702 q[i2].axpy(-alpha,q[i1]); │ │ │ │ -703 │ │ │ │ -704 z = 0.0; │ │ │ │ -705 ___p_r_e_c->apply(z,q[i2]); │ │ │ │ -706 │ │ │ │ -707 // beta is real and positive in exact arithmetic │ │ │ │ -708 // since it is the norm of the basis vectors (in unpreconditioned case) │ │ │ │ -709 beta = sqrt(___s_p->dot(q[i2],z)); │ │ │ │ -710 │ │ │ │ -711 q[i2] *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -712 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -713 _r_e_a_l___t_y_p_e(1.0)/beta); │ │ │ │ -714 z *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -715 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -716 _r_e_a_l___t_y_p_e(1.0)/beta); │ │ │ │ -717 │ │ │ │ -718 // QR Factorization of recurrence coefficient matrix │ │ │ │ -719 // apply previous givens rotations to last column of T │ │ │ │ -720 T[1] = T[2]; │ │ │ │ -721 if(i>2) { │ │ │ │ -722 T[0] = s[i%2]*T[1]; │ │ │ │ -723 T[1] = c[i%2]*T[1]; │ │ │ │ -724 } │ │ │ │ -725 if(i>1) { │ │ │ │ -726 T[2] = c[(i+1)%2]*alpha - s[(i+1)%2]*T[1]; │ │ │ │ -727 T[1] = c[(i+1)%2]*T[1] + s[(i+1)%2]*alpha; │ │ │ │ -728 } │ │ │ │ -729 else │ │ │ │ -730 T[2] = alpha; │ │ │ │ -731 │ │ │ │ -732 // update QR factorization │ │ │ │ -733 generateGivensRotation(T[2],beta,c[i%2],s[i%2]); │ │ │ │ -734 // to last column of T_k │ │ │ │ -735 T[2] = c[i%2]*T[2] + s[i%2]*beta; │ │ │ │ -736 // and to the rhs xi of the min problem │ │ │ │ -737 xi[i%2] = -s[i%2]*xi[(i+1)%2]; │ │ │ │ -738 xi[(i+1)%2] *= c[i%2]; │ │ │ │ -739 │ │ │ │ -740 // compute correction direction │ │ │ │ -741 p[i2] = dummy; │ │ │ │ -742 p[i2].axpy(-T[1],p[i1]); │ │ │ │ -743 p[i2].axpy(-T[0],p[i0]); │ │ │ │ -744 p[i2] *= _r_e_a_l___t_y_p_e(1.0)/T[2]; │ │ │ │ -745 │ │ │ │ -746 // apply correction/update solution │ │ │ │ -747 x.axpy(beta0*xi[(i+1)%2],p[i2]); │ │ │ │ -748 │ │ │ │ -749 // remember beta_old │ │ │ │ -750 T[2] = beta; │ │ │ │ -751 │ │ │ │ -752 // check for convergence │ │ │ │ -753 // the last entry in the rhs of the min-problem is the residual │ │ │ │ -754 def = abs(beta0*xi[i%2]); │ │ │ │ -755 if(iteration.step(i, def)){ │ │ │ │ -756 break; │ │ │ │ -757 } │ │ │ │ -758 } // end for │ │ │ │ -759 │ │ │ │ -760 // postprocess preconditioner │ │ │ │ -761 ___p_r_e_c->post(x); │ │ │ │ -762 } │ │ │ │ -763 │ │ │ │ -764 private: │ │ │ │ -765 │ │ │ │ -766 void generateGivensRotation(_f_i_e_l_d___t_y_p_e &dx, _f_i_e_l_d___t_y_p_e &dy, _r_e_a_l___t_y_p_e &cs, │ │ │ │ -_f_i_e_l_d___t_y_p_e &sn) │ │ │ │ -767 { │ │ │ │ -768 using std::sqrt; │ │ │ │ -769 using std::abs; │ │ │ │ -770 using std::max; │ │ │ │ -771 using std::min; │ │ │ │ -772 const _r_e_a_l___t_y_p_e eps = 1e-15; │ │ │ │ -773 _r_e_a_l___t_y_p_e norm_dx = abs(dx); │ │ │ │ -774 _r_e_a_l___t_y_p_e norm_dy = abs(dy); │ │ │ │ -775 _r_e_a_l___t_y_p_e norm_max = max(norm_dx, norm_dy); │ │ │ │ -776 _r_e_a_l___t_y_p_e norm_min = min(norm_dx, norm_dy); │ │ │ │ -777 _r_e_a_l___t_y_p_e temp = norm_min/norm_max; │ │ │ │ -778 // we rewrite the code in a vectorizable fashion │ │ │ │ -779 cs = Simd::cond(norm_dy < eps, │ │ │ │ -780 _r_e_a_l___t_y_p_e(1.0), │ │ │ │ -781 Simd::cond(norm_dx < eps, │ │ │ │ -782 _r_e_a_l___t_y_p_e(0.0), │ │ │ │ -783 Simd::cond(norm_dy > norm_dx, │ │ │ │ -784 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*temp, │ │ │ │ -785 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp) │ │ │ │ -786 ))); │ │ │ │ -787 sn = Simd::cond(norm_dy < eps, │ │ │ │ -788 _f_i_e_l_d___t_y_p_e(0.0), │ │ │ │ -789 Simd::cond(norm_dx < eps, │ │ │ │ -790 _f_i_e_l_d___t_y_p_e(1.0), │ │ │ │ -791 Simd::cond(norm_dy > norm_dx, │ │ │ │ -792 // dy and dx are real in exact arithmetic │ │ │ │ -793 // thus dx*dy is real so we can explicitly enforce it │ │ │ │ -794 _f_i_e_l_d___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*dx*dy/norm_dx/norm_dy, │ │ │ │ -795 // dy and dx is real in exact arithmetic │ │ │ │ -796 // so we don't have to conjugate both of them │ │ │ │ -797 _f_i_e_l_d___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*dy/dx │ │ │ │ -798 ))); │ │ │ │ -799 } │ │ │ │ -800 │ │ │ │ -801 protected: │ │ │ │ -802 using IterativeSolver_:_:___o_p; │ │ │ │ -803 using IterativeSolver_:_:___p_r_e_c; │ │ │ │ -804 using IterativeSolver_:_:___s_p; │ │ │ │ -805 using IterativeSolver_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -806 using IterativeSolver_:_:___m_a_x_i_t; │ │ │ │ -807 using IterativeSolver_:_:___v_e_r_b_o_s_e; │ │ │ │ -_8_0_8 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_u_n_s_i_g_n_e_d_ _i_n_t_>; │ │ │ │ -809 }; │ │ │ │ -_8_1_0 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("minressolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -811 │ │ │ │ -825 template │ │ │ │ -_8_2_6 class _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -827 { │ │ │ │ -828 public: │ │ │ │ -829 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_Y_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -830 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_Y_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -831 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_Y_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -832 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_Y_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -833 │ │ │ │ -834 protected: │ │ │ │ -835 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ -836 │ │ │ │ -_8_3_8 using _f_A_l_l_o_c = _R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e_<_X_,_f_i_e_l_d___t_y_p_e_>; │ │ │ │ -_8_4_0 using _r_A_l_l_o_c = _R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e_<_X_,_r_e_a_l___t_y_p_e_>; │ │ │ │ -841 │ │ │ │ -842 public: │ │ │ │ -843 │ │ │ │ -_8_5_0 _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_Y_>& op, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>& │ │ │ │ -prec, _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int restart, int maxit, int verbose) : │ │ │ │ -851 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,prec,reduction,maxit,verbose), │ │ │ │ -852 ___r_e_s_t_a_r_t(restart) │ │ │ │ -853 {} │ │ │ │ -854 │ │ │ │ -_8_6_1 _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_Y_>& op, const │ │ │ │ -_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>& sp, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>& prec, _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, │ │ │ │ -int restart, int maxit, int verbose) : │ │ │ │ -862 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec,reduction,maxit,verbose), │ │ │ │ -863 ___r_e_s_t_a_r_t(restart) │ │ │ │ -864 {} │ │ │ │ -865 │ │ │ │ -_8_7_8 _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r (std::shared_ptr > op, std:: │ │ │ │ -shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_> > prec, const ParameterTree& configuration) : │ │ │ │ -879 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,prec,configuration), │ │ │ │ -880 ___r_e_s_t_a_r_t(configuration._g_e_t("restart")) │ │ │ │ -881 {} │ │ │ │ -882 │ │ │ │ -_8_8_3 _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r (std::shared_ptr > op, std:: │ │ │ │ -shared_ptr > sp, std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_> > │ │ │ │ -prec, const ParameterTree& configuration) : │ │ │ │ -884 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec,configuration), │ │ │ │ -885 ___r_e_s_t_a_r_t(configuration._g_e_t("restart")) │ │ │ │ -886 {} │ │ │ │ -887 │ │ │ │ -_8_9_4 _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -895 std::shared_ptr> sp, │ │ │ │ -896 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>> prec, │ │ │ │ -897 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int restart, int maxit, int verbose) : │ │ │ │ -898 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec,reduction,maxit,verbose), │ │ │ │ -899 ___r_e_s_t_a_r_t(restart) │ │ │ │ -900 {} │ │ │ │ -901 │ │ │ │ -_9_1_0 virtual void _a_p_p_l_y (X& x, Y& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -911 { │ │ │ │ -912 _a_p_p_l_y(x,b,Simd::max(___r_e_d_u_c_t_i_o_n),res); │ │ │ │ -913 } │ │ │ │ -914 │ │ │ │ -_9_2_3 virtual void _a_p_p_l_y (X& x, Y& b, [[maybe_unused]] double reduction, │ │ │ │ -_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -924 { │ │ │ │ -925 using std::abs; │ │ │ │ -926 const Simd::Scalar EPSILON = 1e-80; │ │ │ │ -927 const int m = ___r_e_s_t_a_r_t; │ │ │ │ -928 _r_e_a_l___t_y_p_e norm = 0.0; │ │ │ │ -929 int j = 1; │ │ │ │ -930 std::vector s(m+1), sn(m); │ │ │ │ -931 std::vector cs(m); │ │ │ │ -932 // need copy of rhs if GMRes has to be restarted │ │ │ │ -933 Y b2(b); │ │ │ │ -934 // helper vector │ │ │ │ -935 Y w(b); │ │ │ │ -936 std::vector< std::vector > H(m+1,s); │ │ │ │ -937 std::vector v(m+1,b); │ │ │ │ -938 │ │ │ │ -939 _I_t_e_r_a_t_i_o_n iteration(*this,res); │ │ │ │ -940 │ │ │ │ -941 // clear solver statistics and set res.converged to false │ │ │ │ -942 ___p_r_e_c->pre(x,b); │ │ │ │ -943 │ │ │ │ -944 // calculate defect and overwrite rhs with it │ │ │ │ -945 ___o_p->applyscaleadd(-1.0,x,b); // b -= Ax │ │ │ │ -946 // calculate preconditioned defect │ │ │ │ -947 v[0] = 0.0; ___p_r_e_c->apply(v[0],b); // r = W^-1 b │ │ │ │ -948 norm = ___s_p->norm(v[0]); │ │ │ │ -949 if(iteration.step(0, norm)){ │ │ │ │ -950 ___p_r_e_c->post(x); │ │ │ │ -951 return; │ │ │ │ -952 } │ │ │ │ -953 │ │ │ │ -954 while(j <= ___m_a_x_i_t && res._c_o_n_v_e_r_g_e_d != true) { │ │ │ │ -955 │ │ │ │ -956 int i = 0; │ │ │ │ -957 v[0] *= Simd::cond(norm==_r_e_a_l___t_y_p_e(0.), │ │ │ │ -958 _r_e_a_l___t_y_p_e(0.), │ │ │ │ -959 _r_e_a_l___t_y_p_e(1.0)/norm); │ │ │ │ -960 s[0] = norm; │ │ │ │ -961 for(i=1; iapply(v[i],v[i+1]); │ │ │ │ -970 ___p_r_e_c->apply(w,v[i+1]); │ │ │ │ -971 for(int k=0; kdot(v[k],w) = v[k]\adjoint w │ │ │ │ -973 // so one has to pay attention to the order │ │ │ │ -974 // in the scalar product for the complex case │ │ │ │ -975 // doing the modified Gram-Schmidt algorithm │ │ │ │ -976 H[k][i] = ___s_p->dot(v[k],w); │ │ │ │ -977 // w -= H[k][i] * v[k] │ │ │ │ -978 w.axpy(-H[k][i],v[k]); │ │ │ │ -979 } │ │ │ │ -980 H[i+1][i] = ___s_p->norm(w); │ │ │ │ -981 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON)) │ │ │ │ -982 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t, │ │ │ │ -983 "breakdown in GMRes - |w| == 0.0 after " << j << " iterations"); │ │ │ │ -984 │ │ │ │ -985 // normalize new vector │ │ │ │ -986 v[i+1] = w; │ │ │ │ -987 v[i+1] *= Simd::cond(norm==_r_e_a_l___t_y_p_e(0.), │ │ │ │ -988 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -989 _r_e_a_l___t_y_p_e(1.0)/H[i+1][i]); │ │ │ │ -990 │ │ │ │ -991 // update QR factorization │ │ │ │ -992 for(int k=0; k 0) │ │ │ │ -1020 std::cout << "=== GMRes::restart" << std::endl; │ │ │ │ -1021 // get saved rhs │ │ │ │ -1022 b = b2; │ │ │ │ -1023 // calculate new defect │ │ │ │ -1024 ___o_p->applyscaleadd(-1.0,x,b); // b -= Ax; │ │ │ │ -1025 // calculate preconditioned defect │ │ │ │ -1026 v[0] = 0.0; │ │ │ │ -1027 ___p_r_e_c->apply(v[0],b); │ │ │ │ -1028 norm = ___s_p->norm(v[0]); │ │ │ │ -1029 } │ │ │ │ -1030 │ │ │ │ -1031 } //end while │ │ │ │ -1032 │ │ │ │ -1033 // postprocess preconditioner │ │ │ │ -1034 ___p_r_e_c->post(x); │ │ │ │ -1035 } │ │ │ │ -1036 │ │ │ │ -1037 protected : │ │ │ │ -1038 │ │ │ │ -_1_0_3_9 void _u_p_d_a_t_e(X& w, int i, │ │ │ │ -1040 const std::vector >& H, │ │ │ │ -1041 const std::vector& s, │ │ │ │ -1042 const std::vector& v) { │ │ │ │ -1043 // solution vector of the upper triangular system │ │ │ │ -1044 std::vector y(s); │ │ │ │ -1045 │ │ │ │ -1046 // backsolve │ │ │ │ -1047 for(int a=i-1; a>=0; a--) { │ │ │ │ -1048 _f_i_e_l_d___t_y_p_e rhs(s[a]); │ │ │ │ -1049 for(int b=a+1; b │ │ │ │ -_1_0_6_2 typename std::enable_if::value,T>::type │ │ │ │ -_c_o_n_j_u_g_a_t_e(const T& t) { │ │ │ │ -1063 return t; │ │ │ │ -1064 } │ │ │ │ -1065 │ │ │ │ -1066 template │ │ │ │ -_1_0_6_7 typename std::enable_if::value,T>:: │ │ │ │ -type _c_o_n_j_u_g_a_t_e(const T& t) { │ │ │ │ -1068 using std::conj; │ │ │ │ -1069 return conj(t); │ │ │ │ -1070 } │ │ │ │ -1071 │ │ │ │ -1072 void │ │ │ │ -_1_0_7_3 _g_e_n_e_r_a_t_e_P_l_a_n_e_R_o_t_a_t_i_o_n(_f_i_e_l_d___t_y_p_e &dx, _f_i_e_l_d___t_y_p_e &dy, _r_e_a_l___t_y_p_e &cs, │ │ │ │ -_f_i_e_l_d___t_y_p_e &sn) │ │ │ │ -1074 { │ │ │ │ -1075 using std::sqrt; │ │ │ │ -1076 using std::abs; │ │ │ │ -1077 using std::max; │ │ │ │ -1078 using std::min; │ │ │ │ -1079 const _r_e_a_l___t_y_p_e eps = 1e-15; │ │ │ │ -1080 _r_e_a_l___t_y_p_e norm_dx = abs(dx); │ │ │ │ -1081 _r_e_a_l___t_y_p_e norm_dy = abs(dy); │ │ │ │ -1082 _r_e_a_l___t_y_p_e norm_max = max(norm_dx, norm_dy); │ │ │ │ -1083 _r_e_a_l___t_y_p_e norm_min = min(norm_dx, norm_dy); │ │ │ │ -1084 _r_e_a_l___t_y_p_e temp = norm_min/norm_max; │ │ │ │ -1085 // we rewrite the code in a vectorizable fashion │ │ │ │ -1086 cs = Simd::cond(norm_dy < eps, │ │ │ │ -1087 _r_e_a_l___t_y_p_e(1.0), │ │ │ │ -1088 Simd::cond(norm_dx < eps, │ │ │ │ -1089 _r_e_a_l___t_y_p_e(0.0), │ │ │ │ -1090 Simd::cond(norm_dy > norm_dx, │ │ │ │ -1091 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*temp, │ │ │ │ -1092 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp) │ │ │ │ -1093 ))); │ │ │ │ -1094 sn = Simd::cond(norm_dy < eps, │ │ │ │ -1095 _f_i_e_l_d___t_y_p_e(0.0), │ │ │ │ -1096 Simd::cond(norm_dx < eps, │ │ │ │ -1097 _f_i_e_l_d___t_y_p_e(1.0), │ │ │ │ -1098 Simd::cond(norm_dy > norm_dx, │ │ │ │ -1099 _f_i_e_l_d___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*dx*_c_o_n_j_u_g_a_t_e(dy)/norm_dx/ │ │ │ │ -norm_dy, │ │ │ │ -1100 _f_i_e_l_d___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*_c_o_n_j_u_g_a_t_e(dy/dx) │ │ │ │ -1101 ))); │ │ │ │ -1102 } │ │ │ │ -1103 │ │ │ │ -1104 │ │ │ │ -1105 void │ │ │ │ -_1_1_0_6 _a_p_p_l_y_P_l_a_n_e_R_o_t_a_t_i_o_n(_f_i_e_l_d___t_y_p_e &dx, _f_i_e_l_d___t_y_p_e &dy, _r_e_a_l___t_y_p_e &cs, │ │ │ │ -_f_i_e_l_d___t_y_p_e &sn) │ │ │ │ -1107 { │ │ │ │ -1108 _f_i_e_l_d___t_y_p_e temp = cs * dx + sn * dy; │ │ │ │ -1109 dy = -_c_o_n_j_u_g_a_t_e(sn) * dx + cs * dy; │ │ │ │ -1110 dx = temp; │ │ │ │ -1111 } │ │ │ │ -1112 │ │ │ │ -1113 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1114 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -1115 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1116 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -1117 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -1118 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -_1_1_1_9 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_u_n_s_i_g_n_e_d_ _i_n_t_>; │ │ │ │ -_1_1_2_0 int ___r_e_s_t_a_r_t; │ │ │ │ -1121 }; │ │ │ │ -_1_1_2_2 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("restartedgmressolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -1123 │ │ │ │ -1137 template │ │ │ │ -_1_1_3_8 class _R_e_s_t_a_r_t_e_d_F_l_e_x_i_b_l_e_G_M_R_e_s_S_o_l_v_e_r : public _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -1139 { │ │ │ │ -1140 public: │ │ │ │ -1141 using typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -1142 using typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -1143 using typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -1144 using typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -1145 │ │ │ │ -1146 private: │ │ │ │ -1147 using typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ -1148 │ │ │ │ -1150 using fAlloc = typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_f_A_l_l_o_c; │ │ │ │ -1152 using rAlloc = typename _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_<_X_,_Y_>_:_:_r_A_l_l_o_c; │ │ │ │ -1153 │ │ │ │ -1154 public: │ │ │ │ -1155 // copy base class constructors │ │ │ │ -1156 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r::RestartedGMResSolver; │ │ │ │ -1157 │ │ │ │ -1158 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -1159 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -1160 │ │ │ │ -_1_1_6_9 void _a_p_p_l_y (X& x, Y& b, [[maybe_unused]] double reduction, │ │ │ │ -_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) override │ │ │ │ -1170 { │ │ │ │ -1171 using std::abs; │ │ │ │ -1172 const Simd::Scalar EPSILON = 1e-80; │ │ │ │ -1173 const int m = ___r_e_s_t_a_r_t; │ │ │ │ -1174 _r_e_a_l___t_y_p_e norm = 0.0; │ │ │ │ -1175 int i, j = 1, k; │ │ │ │ -1176 std::vector s(m+1), sn(m); │ │ │ │ -1177 std::vector cs(m); │ │ │ │ -1178 // helper vector │ │ │ │ -1179 Y tmp(b); │ │ │ │ -1180 std::vector< std::vector > H(m+1,s); │ │ │ │ -1181 std::vector v(m+1,b); │ │ │ │ -1182 std::vector w(m+1,b); │ │ │ │ -1183 │ │ │ │ -1184 Iteration iteration(*this,res); │ │ │ │ -1185 // setup preconditioner if it does something in pre │ │ │ │ -1186 │ │ │ │ -1187 // calculate residual and overwrite a copy of the rhs with it │ │ │ │ -1188 ___p_r_e_c->pre(x, b); │ │ │ │ -1189 v[0] = b; │ │ │ │ -1190 ___o_p->applyscaleadd(-1.0, x, v[0]); // b -= Ax │ │ │ │ -1191 │ │ │ │ -1192 norm = ___s_p->norm(v[0]); // the residual norm │ │ │ │ -1193 if(iteration.step(0, norm)){ │ │ │ │ -1194 ___p_r_e_c->post(x); │ │ │ │ -1195 return; │ │ │ │ -1196 } │ │ │ │ -1197 │ │ │ │ -1198 // start iterations │ │ │ │ -1199 res._c_o_n_v_e_r_g_e_d = false;; │ │ │ │ -1200 while(j <= ___m_a_x_i_t && res._c_o_n_v_e_r_g_e_d != true) │ │ │ │ -1201 { │ │ │ │ -1202 v[0] *= (1.0 / norm); │ │ │ │ -1203 s[0] = norm; │ │ │ │ -1204 for(i=1; iapply(w[i], v[i]); │ │ │ │ -1213 // compute vi = A*wi │ │ │ │ -1214 // use v[i+1] as temporary vector for w │ │ │ │ -1215 ___o_p->apply(w[i], v[i+1]); │ │ │ │ -1216 // do Arnoldi algorithm │ │ │ │ -1217 for(int kk=0; kkdot(v[k],v[i+1]) = v[k]\adjoint v[i+1] │ │ │ │ -1220 // so one has to pay attention to the order │ │ │ │ -1221 // in the scalar product for the complex case │ │ │ │ -1222 // doing the modified Gram-Schmidt algorithm │ │ │ │ -1223 H[kk][i] = ___s_p->dot(v[kk],v[i+1]); │ │ │ │ -1224 // w -= H[k][i] * v[kk] │ │ │ │ -1225 v[i+1].axpy(-H[kk][i], v[kk]); │ │ │ │ -1226 } │ │ │ │ -1227 H[i+1][i] = ___s_p->norm(v[i+1]); │ │ │ │ -1228 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON)) │ │ │ │ -1229 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t, "breakdown in fGMRes - |w| (-> " │ │ │ │ -1230 << w[i] << ") == 0.0 after " │ │ │ │ -1231 << j << " iterations"); │ │ │ │ -1232 │ │ │ │ -1233 // v[i+1] = w*1/H[i+1][i] │ │ │ │ -1234 v[i+1] *= _r_e_a_l___t_y_p_e(1.0)/H[i+1][i]; │ │ │ │ -1235 │ │ │ │ -1236 // update QR factorization │ │ │ │ -1237 for(k=0; k_a_p_p_l_y_P_l_a_n_e_R_o_t_a_t_i_o_n(H[k][i],H[k+1][i],cs[k],sn[k]); │ │ │ │ -1239 │ │ │ │ -1240 // compute new givens rotation │ │ │ │ -1241 this->_g_e_n_e_r_a_t_e_P_l_a_n_e_R_o_t_a_t_i_o_n(H[i][i],H[i+1][i],cs[i],sn[i]); │ │ │ │ -1242 │ │ │ │ -1243 // finish updating QR factorization │ │ │ │ -1244 this->_a_p_p_l_y_P_l_a_n_e_R_o_t_a_t_i_o_n(H[i][i],H[i+1][i],cs[i],sn[i]); │ │ │ │ -1245 this->_a_p_p_l_y_P_l_a_n_e_R_o_t_a_t_i_o_n(s[i],s[i+1],cs[i],sn[i]); │ │ │ │ -1246 │ │ │ │ -1247 // norm of the residual is the last component of vector s │ │ │ │ -1248 using std::abs; │ │ │ │ -1249 norm = abs(s[i+1]); │ │ │ │ -1250 iteration.step(j, norm); │ │ │ │ -1251 } // end inner for loop │ │ │ │ -1252 │ │ │ │ -1253 // calculate update vector │ │ │ │ -1254 tmp = 0.0; │ │ │ │ -1255 this->_u_p_d_a_t_e(tmp, i, H, s, w); │ │ │ │ -1256 // and update current iterate │ │ │ │ -1257 x += tmp; │ │ │ │ -1258 │ │ │ │ -1259 // restart fGMRes if convergence was not achieved, │ │ │ │ -1260 // i.e. linear residual has not reached desired reduction │ │ │ │ -1261 // and if still j < _maxit (do not restart on last iteration) │ │ │ │ -1262 if( res._c_o_n_v_e_r_g_e_d != true && j < ___m_a_x_i_t) │ │ │ │ -1263 { │ │ │ │ -1264 if (___v_e_r_b_o_s_e > 0) │ │ │ │ -1265 std::cout << "=== fGMRes::restart" << std::endl; │ │ │ │ -1266 // get rhs │ │ │ │ -1267 v[0] = b; │ │ │ │ -1268 // calculate new defect │ │ │ │ -1269 ___o_p->applyscaleadd(-1.0, x,v[0]); // b -= Ax; │ │ │ │ -1270 // calculate preconditioned defect │ │ │ │ -1271 norm = ___s_p->norm(v[0]); // update the residual norm │ │ │ │ -1272 } │ │ │ │ -1273 │ │ │ │ -1274 } // end outer while loop │ │ │ │ -1275 │ │ │ │ -1276 // post-process preconditioner │ │ │ │ -1277 ___p_r_e_c->post(x); │ │ │ │ -1278 } │ │ │ │ -1279 │ │ │ │ -1280private: │ │ │ │ -1281 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1282 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -1283 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1284 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -1285 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -1286 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -1287 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___r_e_s_t_a_r_t; │ │ │ │ -1288 using Iteration = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -Iteration; │ │ │ │ -1289 }; │ │ │ │ -_1_2_9_0 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("restartedflexiblegmressolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -1291 │ │ │ │ -1305 template │ │ │ │ -_1_3_0_6 class _G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -1307 { │ │ │ │ -1308 public: │ │ │ │ -1309 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -1310 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -1311 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -1312 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -1313 │ │ │ │ -1314 private: │ │ │ │ -1315 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ -1316 │ │ │ │ -1318 using fAlloc = _R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e_<_X_,_f_i_e_l_d___t_y_p_e_>; │ │ │ │ -1319 │ │ │ │ -1320 public: │ │ │ │ -1321 │ │ │ │ -1322 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -1323 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -1324 │ │ │ │ -_1_3_3_1 _G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_X_>& op, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>& │ │ │ │ -prec, _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, int restart = 10) : │ │ │ │ -1332 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,prec,reduction,maxit,verbose), │ │ │ │ -1333 _restart(restart) │ │ │ │ -1334 {} │ │ │ │ -1335 │ │ │ │ -_1_3_4_3 _G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_X_>& op, const │ │ │ │ -_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>& sp, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>& prec, _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, │ │ │ │ -int maxit, int verbose, int restart = 10) : │ │ │ │ -1344 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec,reduction,maxit,verbose), │ │ │ │ -1345 _restart(restart) │ │ │ │ -1346 {} │ │ │ │ -1347 │ │ │ │ -1348 │ │ │ │ -_1_3_6_1 _G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r (std::shared_ptr > op, │ │ │ │ -std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_> > prec, const ParameterTree& configuration) │ │ │ │ -: │ │ │ │ -1362 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,prec,configuration), │ │ │ │ -1363 _restart(configuration._g_e_t("restart")) │ │ │ │ -1364 {} │ │ │ │ -1365 │ │ │ │ -_1_3_6_6 _G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r (std::shared_ptr > op, │ │ │ │ -std::shared_ptr > sp, std:: │ │ │ │ -shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_> > prec, const ParameterTree& configuration) : │ │ │ │ -1367 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec,configuration), │ │ │ │ -1368 _restart(configuration._g_e_t("restart")) │ │ │ │ -1369 {} │ │ │ │ -_1_3_7_7 _G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -1378 std::shared_ptr> sp, │ │ │ │ -1379 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>> prec, │ │ │ │ -1380 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, │ │ │ │ -1381 int restart = 10) : │ │ │ │ -1382 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r::_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec,reduction,maxit,verbose), │ │ │ │ -1383 _restart(restart) │ │ │ │ -1384 {} │ │ │ │ -1385 │ │ │ │ -_1_3_9_1 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -1392 { │ │ │ │ -1393 Iteration iteration(*this, res); │ │ │ │ -1394 ___p_r_e_c->pre(x,b); // prepare preconditioner │ │ │ │ -1395 ___o_p->applyscaleadd(-1,x,b); // overwrite b with defect │ │ │ │ -1396 │ │ │ │ -1397 std::vector > p(_restart); │ │ │ │ -1398 std::vector pp(_restart); │ │ │ │ -1399 X q(x); // a temporary vector │ │ │ │ -1400 X prec_res(x); // a temporary vector for preconditioner output │ │ │ │ -1401 │ │ │ │ -1402 p[0].reset(new X(x)); │ │ │ │ -1403 │ │ │ │ -1404 _r_e_a_l___t_y_p_e def = ___s_p->norm(b); // compute norm │ │ │ │ -1405 if(iteration.step(0, def)){ │ │ │ │ -1406 ___p_r_e_c->post(x); │ │ │ │ -1407 return; │ │ │ │ -1408 } │ │ │ │ -1409 // some local variables │ │ │ │ -1410 _f_i_e_l_d___t_y_p_e rho, lambda; │ │ │ │ -1411 │ │ │ │ -1412 int i=0; │ │ │ │ -1413 // determine initial search direction │ │ │ │ -1414 *(p[0]) = 0; // clear correction │ │ │ │ -1415 ___p_r_e_c->apply(*(p[0]),b); // apply preconditioner │ │ │ │ -1416 rho = ___s_p->dot(*(p[0]),b); // orthogonalization │ │ │ │ -1417 ___o_p->apply(*(p[0]),q); // q=Ap │ │ │ │ -1418 pp[0] = ___s_p->dot(*(p[0]),q); // scalar product │ │ │ │ -1419 lambda = rho/pp[0]; // minimization │ │ │ │ -1420 x.axpy(lambda,*(p[0])); // update solution │ │ │ │ -1421 b.axpy(-lambda,q); // update defect │ │ │ │ -1422 │ │ │ │ -1423 // convergence test │ │ │ │ -1424 def=___s_p->norm(b); // comp defect norm │ │ │ │ -1425 ++i; │ │ │ │ -1426 if(iteration.step(i, def)){ │ │ │ │ -1427 ___p_r_e_c->post(x); │ │ │ │ -1428 return; │ │ │ │ -1429 } │ │ │ │ -1430 │ │ │ │ -1431 while(i<___m_a_x_i_t) { │ │ │ │ -1432 // the loop │ │ │ │ -1433 int end=std::min(_restart, ___m_a_x_i_t-i+1); │ │ │ │ -1434 for (int ii = 1; ii < end; ++ii) │ │ │ │ -1435 { │ │ │ │ -1436 //std::cout<<" ii="<()); │ │ │ │ -1487 │ │ │ │ -1499 template │ │ │ │ -_1_5_0_0 class _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r : public _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r { │ │ │ │ -1501 public: │ │ │ │ -1502 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -1503 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -1504 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -1505 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -1506 │ │ │ │ -1507 private: │ │ │ │ -1508 using typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ -1509 │ │ │ │ -1510 public: │ │ │ │ -1511 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -1512 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -_1_5_1_8 _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_X_>& op, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>& │ │ │ │ -prec, │ │ │ │ -1519 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, int mmax = 10) : │ │ │ │ -_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, prec, reduction, maxit, verbose), ___m_m_a_x(mmax) │ │ │ │ -1520 { │ │ │ │ -1521 } │ │ │ │ -1522 │ │ │ │ -_1_5_2_8 _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_X_>& op, const _S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>& │ │ │ │ -sp, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>& prec, │ │ │ │ -1529 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, int mmax = 10) : │ │ │ │ -_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, sp, prec, reduction, maxit, verbose), ___m_m_a_x(mmax) │ │ │ │ -1530 { │ │ │ │ -1531 } │ │ │ │ -1532 │ │ │ │ -_1_5_3_8 _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -1539 std::shared_ptr> sp, │ │ │ │ -1540 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>> prec, │ │ │ │ -1541 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, │ │ │ │ -1542 int mmax = 10) │ │ │ │ -1543 : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, sp, prec, reduction, maxit, verbose), ___m_m_a_x │ │ │ │ -(mmax) │ │ │ │ -1544 {} │ │ │ │ -1545 │ │ │ │ -_1_5_5_8 _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -1559 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>> prec, │ │ │ │ -1560 const ParameterTree& config) │ │ │ │ -1561 : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, prec, config), ___m_m_a_x(config._g_e_t("mmax", 10)) │ │ │ │ -1562 {} │ │ │ │ -1563 │ │ │ │ -_1_5_6_4 _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -1565 std::shared_ptr> sp, │ │ │ │ -1566 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>> prec, │ │ │ │ -1567 const ParameterTree& config) │ │ │ │ -1568 : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, sp, prec, config), ___m_m_a_x(config._g_e_t("mmax", │ │ │ │ -10)) │ │ │ │ -1569 {} │ │ │ │ -1570 │ │ │ │ -_1_5_8_3 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -1584 { │ │ │ │ -1585 using rAlloc = _R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e_<_X_,_f_i_e_l_d___t_y_p_e_>; │ │ │ │ -1586 res._c_l_e_a_r(); │ │ │ │ -1587 _I_t_e_r_a_t_i_o_n iteration(*this,res); │ │ │ │ -1588 ___p_r_e_c->pre(x,b); // prepare preconditioner │ │ │ │ -1589 ___o_p->applyscaleadd(-1,x,b); // overwrite b with defect │ │ │ │ -1590 │ │ │ │ -1591 //arrays for interim values: │ │ │ │ -1592 std::vector d(___m_m_a_x+1, x); // array for directions │ │ │ │ -1593 std::vector Ad(___m_m_a_x+1, x); // array for Ad[i] │ │ │ │ -1594 std::vector ddotAd(___m_m_a_x+1,0); // array for │ │ │ │ -1595 X w(x); │ │ │ │ -1596 │ │ │ │ -1597 _r_e_a_l___t_y_p_e def = ___s_p->norm(b); // compute norm │ │ │ │ -1598 if(iteration.step(0, def)){ │ │ │ │ -1599 ___p_r_e_c->post(x); │ │ │ │ -1600 return; │ │ │ │ -1601 } │ │ │ │ -1602 │ │ │ │ -1603 // some local variables │ │ │ │ -1604 _f_i_e_l_d___t_y_p_e alpha; │ │ │ │ -1605 │ │ │ │ -1606 // the loop │ │ │ │ -1607 int i=1; │ │ │ │ -1608 int i_bounded=0; │ │ │ │ -1609 while(i<=___m_a_x_i_t && !res._c_o_n_v_e_r_g_e_d) { │ │ │ │ -1610 for (; i_bounded <= ___m_m_a_x && i<= ___m_a_x_i_t; i_bounded++) { │ │ │ │ -1611 d[i_bounded] = 0; // reset search direction │ │ │ │ -1612 ___p_r_e_c->apply(d[i_bounded], b); // apply preconditioner │ │ │ │ -1613 w = d[i_bounded]; // copy of current d[i] │ │ │ │ -1614 // orthogonalization with previous directions │ │ │ │ -1615 orthogonalizations(i_bounded,Ad,w,ddotAd,d); │ │ │ │ -1616 │ │ │ │ -1617 //saving interim values for future calculating │ │ │ │ -1618 ___o_p->apply(d[i_bounded], Ad[i_bounded]); // save Ad[i] │ │ │ │ -1619 ddotAd[i_bounded]=___s_p->dot(d[i_bounded],Ad[i_bounded]); // save │ │ │ │ -1620 alpha = ___s_p->dot(d[i_bounded], b)/ddotAd[i_bounded]; // / │ │ │ │ -1621 │ │ │ │ -1622 //update solution and defect │ │ │ │ -1623 x.axpy(alpha, d[i_bounded]); │ │ │ │ -1624 b.axpy(-alpha, Ad[i_bounded]); │ │ │ │ -1625 │ │ │ │ -1626 // convergence test │ │ │ │ -1627 def = ___s_p->norm(b); // comp defect norm │ │ │ │ -1628 │ │ │ │ -1629 iteration.step(i, def); │ │ │ │ -1630 i++; │ │ │ │ -1631 } │ │ │ │ -1632 //restart: exchange first and last stored values │ │ │ │ -1633 cycle(Ad,d,ddotAd,i_bounded); │ │ │ │ -1634 } │ │ │ │ -1635 │ │ │ │ -1636 //correct i which is wrong if convergence was not achieved. │ │ │ │ -1637 i=std::min(___m_a_x_i_t,i); │ │ │ │ -1638 │ │ │ │ -1639 ___p_r_e_c->post(x); // postprocess preconditioner │ │ │ │ -1640 } │ │ │ │ -1641 │ │ │ │ -1642 private: │ │ │ │ -1643 //This function is called every iteration to orthogonalize against the │ │ │ │ -last search directions │ │ │ │ -1644 virtual void orthogonalizations(const int& i_bounded,const std::vector& │ │ │ │ -Ad, const X& w, const std:: │ │ │ │ -vector<_f_i_e_l_d___t_y_p_e,_R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e_<_X_,_f_i_e_l_d___t_y_p_e_>>& ddotAd,std::vector& │ │ │ │ -d) { │ │ │ │ -1645 // The RestartedFCGSolver uses only values with lower array index; │ │ │ │ -1646 for (int k = 0; k < i_bounded; k++) { │ │ │ │ -1647 d[i_bounded].axpy(-___s_p->dot(Ad[k], w) / ddotAd[k], d[k]); // d[i] -= </>d[k] │ │ │ │ -1648 } │ │ │ │ -1649 } │ │ │ │ -1650 │ │ │ │ -1651 // This function is called every mmax iterations to handle limited array │ │ │ │ -sizes. │ │ │ │ -1652 virtual void cycle(std::vector& Ad,std::vector& d,std:: │ │ │ │ -vector<_f_i_e_l_d___t_y_p_e,ReboundAllocatorType >& ddotAd,int& i_bounded) │ │ │ │ -{ │ │ │ │ -1653 // Reset loop index and exchange the first and last arrays │ │ │ │ -1654 i_bounded = 1; │ │ │ │ -1655 std::swap(Ad[0], Ad[___m_m_a_x]); │ │ │ │ -1656 std::swap(d[0], d[___m_m_a_x]); │ │ │ │ -1657 std::swap(ddotAd[0], ddotAd[___m_m_a_x]); │ │ │ │ -1658 } │ │ │ │ -1659 │ │ │ │ -1660 protected: │ │ │ │ -_1_6_6_1 int ___m_m_a_x; │ │ │ │ -1662 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1663 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -1664 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1665 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -1666 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -1667 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -_1_6_6_8 using _I_t_e_r_a_t_i_o_n = typename _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_X_,_X_>_:_:_t_e_m_p_l_a_t_e │ │ │ │ -_I_t_e_r_a_t_i_o_n_<_u_n_s_i_g_n_e_d_ _i_n_t_>; │ │ │ │ -1669 }; │ │ │ │ -_1_6_7_0 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("restartedfcgsolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -1671 │ │ │ │ -1678 template │ │ │ │ -_1_6_7_9 class _C_o_m_p_l_e_t_e_F_C_G_S_o_l_v_e_r : public _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r { │ │ │ │ -1680 public: │ │ │ │ -1681 using typename _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_<_X_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -1682 using typename _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_<_X_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -1683 using typename _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_<_X_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -1684 using typename _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_<_X_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -1685 │ │ │ │ -1686 // copy base class constructors │ │ │ │ -1687 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r::RestartedFCGSolver; │ │ │ │ -1688 │ │ │ │ -1689 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -1690 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -1691 │ │ │ │ -1692 // just a minor part of the RestartedFCGSolver apply method will be │ │ │ │ -modified │ │ │ │ -_1_6_9_3 virtual void _a_p_p_l_y (X& x, X& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) override { │ │ │ │ -1694 // reset limiter of orthogonalization loop │ │ │ │ -1695 _k_limit = 0; │ │ │ │ -1696 this->_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_<_X_>_:_:_a_p_p_l_y(x,b,res); │ │ │ │ -1697 }; │ │ │ │ -1698 │ │ │ │ -1699 private: │ │ │ │ -1700 // This function is called every iteration to orthogonalize against the │ │ │ │ -last search directions. │ │ │ │ -1701 virtual void orthogonalizations(const int& i_bounded,const std::vector& │ │ │ │ -Ad, const X& w, const std:: │ │ │ │ -vector<_f_i_e_l_d___t_y_p_e,_R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e_<_X_,_f_i_e_l_d___t_y_p_e_>>& ddotAd,std::vector& │ │ │ │ -d) override { │ │ │ │ -1702 // This FCGSolver uses values with higher array indexes too, if existent. │ │ │ │ -1703 for (int k = 0; k < _k_limit; k++) { │ │ │ │ -1704 if(i_bounded!=k) │ │ │ │ -1705 d[i_bounded].axpy(-___s_p->dot(Ad[k], w) / ddotAd[k], d[k]); // d[i] -= </>d[k] │ │ │ │ -1706 } │ │ │ │ -1707 // The loop limit increase, if array is not completely filled. │ │ │ │ -1708 if(_k_limit<=i_bounded) │ │ │ │ -1709 _k_limit++; │ │ │ │ -1710 │ │ │ │ -1711 }; │ │ │ │ -1712 │ │ │ │ -1713 // This function is called every mmax iterations to handle limited array │ │ │ │ -sizes. │ │ │ │ -1714 virtual void cycle(std::vector& Ad, [[maybe_unused]] std::vector& d, │ │ │ │ -[[maybe_unused]] std::vector<_f_i_e_l_d___t_y_p_e,ReboundAllocatorType >& │ │ │ │ -ddotAd,int& i_bounded) override { │ │ │ │ -1715 // Only the loop index i_bounded return to 0, if it reached mmax. │ │ │ │ -1716 i_bounded = 0; │ │ │ │ -1717 // Now all arrays are filled and the loop in void orthogonalizations can │ │ │ │ -use the whole arrays. │ │ │ │ -1718 _k_limit = Ad.size(); │ │ │ │ -1719 }; │ │ │ │ -1720 │ │ │ │ -1721 int _k_limit = 0; │ │ │ │ -1722 │ │ │ │ -1723 protected: │ │ │ │ -1724 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___m_m_a_x; │ │ │ │ -1725 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1726 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -1727 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1728 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n; │ │ │ │ -1729 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -1730 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -1731 }; │ │ │ │ -_1_7_3_2 _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R("completefcgsolver", │ │ │ │ -defaultIterativeSolverCreator()); │ │ │ │ -1734} // end namespace │ │ │ │ -1735 │ │ │ │ -1736#endif │ │ │ │ -_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_ITERATIVE_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:19 │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ -_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h │ │ │ │ -_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ -implementation wraps a matrix. │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ -_a_r_p_a_c_k_p_p_._h_h │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ -_a_l_l_o_c_a_t_o_r_._h_h │ │ │ │ +5#ifndef DUNE_ISTL_AMG_PROPERTIES_HH │ │ │ │ +6#define DUNE_ISTL_AMG_PROPERTIES_HH │ │ │ │ +7 │ │ │ │ +8#include │ │ │ │ +9 │ │ │ │ +10namespace _D_u_n_e │ │ │ │ +11{ │ │ │ │ +12 │ │ │ │ +13 namespace Amg │ │ │ │ +14 { │ │ │ │ +_2_8 struct _V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ +29 {}; │ │ │ │ +30 │ │ │ │ +31 │ │ │ │ +38 template │ │ │ │ +_4_0 class _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +41 : public RAPropertyMapHelper > │ │ │ │ +43 { │ │ │ │ +44 public: │ │ │ │ +_4_6 typedef C _C_o_n_t_a_i_n_e_r; │ │ │ │ +47 │ │ │ │ +_4_9 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ +50 │ │ │ │ +_5_2 typedef K _K_e_y; │ │ │ │ +53 │ │ │ │ +_5_7 typedef LvaluePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ +58 │ │ │ │ +59 enum { │ │ │ │ +61 _i_n_d_e_x = i │ │ │ │ +_6_2 }; │ │ │ │ +63 │ │ │ │ +_6_9 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](const _K_e_y& key) const │ │ │ │ +70 { │ │ │ │ +71 return container_[key][_i_n_d_e_x]; │ │ │ │ +72 } │ │ │ │ +73 │ │ │ │ +_7_8 _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p(_C_o_n_t_a_i_n_e_r& container) │ │ │ │ +79 : container_(&container) │ │ │ │ +80 {} │ │ │ │ +81 │ │ │ │ +_8_3 _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ +84 : container_(0) │ │ │ │ +85 {} │ │ │ │ +86 │ │ │ │ +87 private: │ │ │ │ +89 _C_o_n_t_a_i_n_e_r* container_; │ │ │ │ +90 }; │ │ │ │ +91 } │ │ │ │ +92} │ │ │ │ +93 │ │ │ │ +94#endif │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +Reference operator[](const Key &key) const │ │ │ │ +Get the property for a key. │ │ │ │ +DDeeffiinniittiioonn properties.hh:69 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +RandomAccessBundledPropertyMap() │ │ │ │ +The default constructor. │ │ │ │ +DDeeffiinniittiioonn properties.hh:83 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ +R Reference │ │ │ │ +The reference type of the container. │ │ │ │ +DDeeffiinniittiioonn properties.hh:49 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +RandomAccessBundledPropertyMap(Container &container) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn properties.hh:78 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_K_e_y │ │ │ │ +K Key │ │ │ │ +The key of the property map. │ │ │ │ +DDeeffiinniittiioonn properties.hh:52 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ +LvaluePropertyMapTag Category │ │ │ │ +The category of the property map. │ │ │ │ +DDeeffiinniittiioonn properties.hh:57 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ +C Container │ │ │ │ +The container that holds the properties. │ │ │ │ +DDeeffiinniittiioonn properties.hh:46 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_i_n_d_e_x │ │ │ │ +@ index │ │ │ │ +The index of the property in the bundle. │ │ │ │ +DDeeffiinniittiioonn properties.hh:61 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_R_e_b_o_u_n_d_A_l_l_o_c_a_t_o_r_T_y_p_e │ │ │ │ -typename std::allocator_traits< typename AllocatorTraits< T >::type >::template │ │ │ │ -rebind_alloc< X > ReboundAllocatorType │ │ │ │ -DDeeffiinniittiioonn allocator.hh:37 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_r_o_w___w_i_s_e │ │ │ │ -@ row_wise │ │ │ │ -Build in a row-wise manner. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:517 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_r_e_a_t_e_e_n_d │ │ │ │ -CreateIterator createend() │ │ │ │ -get create iterator pointing to one after the last block │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1100 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_r_e_a_t_e_b_e_g_i_n │ │ │ │ -CreateIterator createbegin() │ │ │ │ -get initial create iterator │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:1094 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_N │ │ │ │ -size_type N() const │ │ │ │ -number of rows (counted in blocks) │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:2001 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -A vector of blocks with memory management. │ │ │ │ -DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ -_D_u_n_e_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s │ │ │ │ -Wrapper to use a range of ARPACK++ eigenvalue solvers. │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:245 │ │ │ │ -_D_u_n_e_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s_:_:_c_o_m_p_u_t_e_S_y_m_M_a_x_M_a_g_n_i_t_u_d_e │ │ │ │ -void computeSymMaxMagnitude(const Real &epsilon, BlockVector &x, Real &lambda) │ │ │ │ -const │ │ │ │ -Assume the matrix to be square, symmetric and perform IRLM to compute an │ │ │ │ -approximation lambda of its ... │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:289 │ │ │ │ -_D_u_n_e_:_:_A_r_P_a_c_k_P_l_u_s_P_l_u_s___A_l_g_o_r_i_t_h_m_s_:_:_c_o_m_p_u_t_e_S_y_m_M_i_n_M_a_g_n_i_t_u_d_e │ │ │ │ -void computeSymMinMagnitude(const Real &epsilon, BlockVector &x, Real &lambda) │ │ │ │ -const │ │ │ │ -Assume the matrix to be square, symmetric and perform IRLM to compute an │ │ │ │ -approximation lambda of its ... │ │ │ │ -DDeeffiinniittiioonn arpackpp.hh:391 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_A_b_o_r_t │ │ │ │ -Thrown when a solver aborts due to some problem. │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:46 │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ -A linear operator. │ │ │ │ -DDeeffiinniittiioonn operators.hh:69 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Base class for scalar product and norm computation. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:52 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -Statistics about the application of an inverse operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e │ │ │ │ -double condition_estimate │ │ │ │ -Estimate of condition number. │ │ │ │ -DDeeffiinniittiioonn solver.hh:81 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_l_e_a_r │ │ │ │ -void clear() │ │ │ │ -Resets all data. │ │ │ │ -DDeeffiinniittiioonn solver.hh:58 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ -bool converged │ │ │ │ -True if convergence criterion has been met. │ │ │ │ -DDeeffiinniittiioonn solver.hh:75 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e │ │ │ │ -Simd::Scalar< real_type > scalar_real_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn solver.hh:116 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -Type of the range of the operator to be inverted. │ │ │ │ -DDeeffiinniittiioonn solver.hh:107 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -Type of the domain of the operator to be inverted. │ │ │ │ -DDeeffiinniittiioonn solver.hh:104 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:110 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_r_e_a_l___t_y_p_e │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ -The real type of the field type (is the same if using real numbers, but differs │ │ │ │ -for std::complex) │ │ │ │ -DDeeffiinniittiioonn solver.hh:113 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -Base class for all implementations of iterative solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:205 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _X_ _>_:_:___s_p │ │ │ │ -std::shared_ptr< const ScalarProduct< X > > _sp │ │ │ │ -DDeeffiinniittiioonn solver.hh:508 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _X_ _>_:_:___o_p │ │ │ │ -std::shared_ptr< const LinearOperator< X, X > > _op │ │ │ │ -DDeeffiinniittiioonn solver.hh:506 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _X_ _>_:_:___m_a_x_i_t │ │ │ │ -int _maxit │ │ │ │ -DDeeffiinniittiioonn solver.hh:510 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _X_ _>_:_:___v_e_r_b_o_s_e │ │ │ │ -int _verbose │ │ │ │ -DDeeffiinniittiioonn solver.hh:511 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _X_ _>_:_:___r_e_d_u_c_t_i_o_n │ │ │ │ -scalar_real_type _reduction │ │ │ │ -DDeeffiinniittiioonn solver.hh:509 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _X_ _>_:_:___p_r_e_c │ │ │ │ -std::shared_ptr< Preconditioner< X, X > > _prec │ │ │ │ -DDeeffiinniittiioonn solver.hh:507 │ │ │ │ -_D_u_n_e_:_:_L_o_o_p_S_o_l_v_e_r │ │ │ │ -Preconditioned loop solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:59 │ │ │ │ -_D_u_n_e_:_:_L_o_o_p_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:73 │ │ │ │ -_D_u_n_e_:_:_L_o_o_p_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:116 │ │ │ │ -_D_u_n_e_:_:_G_r_a_d_i_e_n_t_S_o_l_v_e_r │ │ │ │ -gradient method │ │ │ │ -DDeeffiinniittiioonn solvers.hh:124 │ │ │ │ -_D_u_n_e_:_:_G_r_a_d_i_e_n_t_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:142 │ │ │ │ -_D_u_n_e_:_:_G_r_a_d_i_e_n_t_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:187 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r │ │ │ │ -conjugate gradient method │ │ │ │ -DDeeffiinniittiioonn solvers.hh:193 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r_:_:_C_G_S_o_l_v_e_r │ │ │ │ -CGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< │ │ │ │ -ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, │ │ │ │ -scalar_real_type reduction, int maxit, int verbose, bool condition_estimate) │ │ │ │ -Constructor to initialize a CG solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:256 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r_:_:_e_n_a_b_l_e_C_o_n_d_i_t_i_o_n_E_s_t_i_m_a_t_e │ │ │ │ -static constexpr bool enableConditionEstimate │ │ │ │ -DDeeffiinniittiioonn solvers.hh:208 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r_:_:_C_G_S_o_l_v_e_r │ │ │ │ -CGSolver(const LinearOperator< X, X > &op, const ScalarProduct< X > &sp, │ │ │ │ -Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int │ │ │ │ -verbose, bool condition_estimate) │ │ │ │ -Constructor to initialize a CG solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:239 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:279 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r_:_:_C_G_S_o_l_v_e_r │ │ │ │ -CGSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > &prec, │ │ │ │ -scalar_real_type reduction, int maxit, int verbose, bool condition_estimate) │ │ │ │ -Constructor to initialize a CG solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:222 │ │ │ │ -_D_u_n_e_:_:_C_G_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:412 │ │ │ │ -_D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r │ │ │ │ -Bi-conjugate Gradient Stabilized (BiCG-STAB) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:419 │ │ │ │ -_D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< CountType > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:598 │ │ │ │ -_D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:439 │ │ │ │ -_D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r │ │ │ │ -Minimal Residual Method (MINRES) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:609 │ │ │ │ -_D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:627 │ │ │ │ -_D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:808 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -implements the Generalized Minimal Residual (GMRes) method │ │ │ │ -DDeeffiinniittiioonn solvers.hh:827 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std:: │ │ │ │ -shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:878 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_c_o_n_j_u_g_a_t_e │ │ │ │ -std::enable_if::value, T >::type │ │ │ │ -conjugate(const T &t) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1067 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -X > > prec, const ParameterTree &configuration) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:883 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_u_p_d_a_t_e │ │ │ │ -void update(X &w, int i, const std::vector< std::vector< field_type, fAlloc > > │ │ │ │ -&H, const std::vector< field_type, fAlloc > &s, const std::vector< X > &v) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1039 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_c_o_n_j_u_g_a_t_e │ │ │ │ -std::enable_if< std::is_same< field_type, real_type >::value, T >::type │ │ │ │ -conjugate(const T &t) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1062 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_f_A_l_l_o_c │ │ │ │ -ReboundAllocatorType< X, field_type > fAlloc │ │ │ │ -field_type Allocator retrieved from domain type │ │ │ │ -DDeeffiinniittiioonn solvers.hh:838 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___r_e_s_t_a_r_t │ │ │ │ -int _restart │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1120 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_r_A_l_l_o_c │ │ │ │ -ReboundAllocatorType< X, real_type > rAlloc │ │ │ │ -real_type Allocator retrieved from domain type │ │ │ │ -DDeeffiinniittiioonn solvers.hh:840 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:923 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -RestartedGMResSolver(const LinearOperator< X, Y > &op, Preconditioner< X, Y > │ │ │ │ -&prec, scalar_real_type reduction, int restart, int maxit, int verbose) │ │ │ │ -Set up RestartedGMResSolver solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:850 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -RestartedGMResSolver(const LinearOperator< X, Y > &op, const ScalarProduct< X > │ │ │ │ -&sp, Preconditioner< X, Y > &prec, scalar_real_type reduction, int restart, int │ │ │ │ -maxit, int verbose) │ │ │ │ -Set up RestartedGMResSolver solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:861 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_g_e_n_e_r_a_t_e_P_l_a_n_e_R_o_t_a_t_i_o_n │ │ │ │ -void generatePlaneRotation(field_type &dx, field_type &dy, real_type &cs, │ │ │ │ -field_type &sn) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1073 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -Y > > prec, scalar_real_type reduction, int restart, int maxit, int verbose) │ │ │ │ -Set up RestartedGMResSolver solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:894 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, Y &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:910 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1119 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:_a_p_p_l_y_P_l_a_n_e_R_o_t_a_t_i_o_n │ │ │ │ -void applyPlaneRotation(field_type &dx, field_type &dy, real_type &cs, │ │ │ │ -field_type &sn) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1106 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_l_e_x_i_b_l_e_G_M_R_e_s_S_o_l_v_e_r │ │ │ │ -implements the Flexible Generalized Minimal Residual (FGMRes) method (right │ │ │ │ -preconditioned) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1139 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_l_e_x_i_b_l_e_G_M_R_e_s_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -void apply(X &x, Y &b, double reduction, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1169 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -Generalized preconditioned conjugate gradient solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1307 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -GeneralizedPCGSolver(const LinearOperator< X, X > &op, const ScalarProduct< X > │ │ │ │ -&sp, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int │ │ │ │ -verbose, int restart=10) │ │ │ │ -Set up nonlinear preconditioned conjugate gradient solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1343 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -GeneralizedPCGSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > │ │ │ │ -&prec, scalar_real_type reduction, int maxit, int verbose, int restart=10) │ │ │ │ -Set up nonlinear preconditioned conjugate gradient solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1331 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1391 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1361 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -X > > prec, scalar_real_type reduction, int maxit, int verbose, int restart=10) │ │ │ │ -Set up nonlinear preconditioned conjugate gradient solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1377 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -X > > prec, const ParameterTree &configuration) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1366 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r │ │ │ │ -Accelerated flexible conjugate gradient method. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1500 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r │ │ │ │ -RestartedFCGSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > │ │ │ │ -&prec, scalar_real_type reduction, int maxit, int verbose, int mmax=10) │ │ │ │ -Constructor to initialize a RestartedFCG solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1518 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r │ │ │ │ -RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &config) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1558 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r │ │ │ │ -RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -X > > prec, scalar_real_type reduction, int maxit, int verbose, int mmax=10) │ │ │ │ -Constructor to initialize a RestartedFCG solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1538 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___m_m_a_x │ │ │ │ -int _mmax │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1661 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r │ │ │ │ -RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -X > > prec, const ParameterTree &config) │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1564 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1668 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1583 │ │ │ │ -_D_u_n_e_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r │ │ │ │ -RestartedFCGSolver(const LinearOperator< X, X > &op, const ScalarProduct< X > │ │ │ │ -&sp, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int │ │ │ │ -verbose, int mmax=10) │ │ │ │ -Constructor to initialize a RestartedFCG solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1528 │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_l_e_t_e_F_C_G_S_o_l_v_e_r │ │ │ │ -Complete flexible conjugate gradient method. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1679 │ │ │ │ -_D_u_n_e_:_:_C_o_m_p_l_e_t_e_F_C_G_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1693 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ +Tag idnetifying the visited property of a vertex. │ │ │ │ +DDeeffiinniittiioonn properties.hh:29 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +A property map that extracts one property out of a bundle using operator[]() │ │ │ │ +DDeeffiinniittiioonn properties.hh:43 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverregistry.hh File Reference │ │ │ +dune-istl: transfer.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,150 +65,55 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Macros | │ │ │ -Functions
│ │ │ -
solverregistry.hh File Reference
│ │ │ +Namespaces
│ │ │ + │ │ │ │ │ │
│ │ │ -
#include <dune/istl/common/registry.hh>
│ │ │ -#include <dune/istl/preconditioner.hh>
│ │ │ -#include <dune/istl/solver.hh>
│ │ │ + │ │ │ +

Prolongation and restriction for amg. │ │ │ +More...

│ │ │ +
#include <dune/istl/bvector.hh>
│ │ │ +#include <dune/istl/matrixredistribute.hh>
│ │ │ +#include <dune/istl/paamg/pinfo.hh>
│ │ │ +#include <dune/istl/owneroverlapcopy.hh>
│ │ │ +#include <dune/istl/paamg/aggregates.hh>
│ │ │ +#include <dune/common/exceptions.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::UnsupportedType
class  Dune::Amg::Transfer< V1, V2, T >
 
class  Dune::Amg::Transfer< V, V1, SequentialInformation >
 
class  Dune::InvalidSolverFactoryConfiguration
class  Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > >
 
│ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Macros

#define DUNE_REGISTER_DIRECT_SOLVER(name, ...)    DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
 
#define DUNE_REGISTER_PRECONDITIONER(name, ...)    DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
 
#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...)    DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ -Functions

template<template< class, class, class, int >class Preconditioner, int blockLevel = 1>
auto Dune::defaultPreconditionerBlockLevelCreator ()
 
template<template< class, class, class >class Preconditioner>
auto Dune::defaultPreconditionerCreator ()
 
template<template< class... >class Solver>
auto Dune::defaultIterativeSolverCreator ()
 
namespace  Dune::Amg
 
│ │ │ -

Macro Definition Documentation

│ │ │ - │ │ │ -

◆ DUNE_REGISTER_DIRECT_SOLVER

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define DUNE_REGISTER_DIRECT_SOLVER( name,
 ... 
)    DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ DUNE_REGISTER_ITERATIVE_SOLVER

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define DUNE_REGISTER_ITERATIVE_SOLVER( name,
 ... 
)    DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ DUNE_REGISTER_PRECONDITIONER

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define DUNE_REGISTER_PRECONDITIONER( name,
 ... 
)    DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Prolongation and restriction for amg.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,60 +1,37 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -solverregistry.hh File Reference │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_c_o_m_m_o_n_/_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +transfer.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Prolongation and restriction for amg. _M_o_r_e_._._. │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_p_i_n_f_o_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_1_,_ _V_2_,_ _T_ _> │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -MMaaccrrooss │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ - (DirectSolverTag, name, __VA_ARGS__) │ │ │ │ -  │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ - (PreconditionerTag, name, __VA_ARGS__) │ │ │ │ -  │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___I_T_E_R_A_T_I_V_E___S_O_L_V_E_R(name, ...)    _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ - (IterativeSolverTag, name, __VA_ARGS__) │ │ │ │ -  │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -templateclass Preconditioner, int │ │ │ │ -blockLevel = 1> │ │ │ │ -auto  _D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r () │ │ │ │ -  │ │ │ │ -templateclass Preconditioner> │ │ │ │ -auto  _D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r () │ │ │ │ -  │ │ │ │ -templateclass Solver> │ │ │ │ -auto  _D_u_n_e_:_:_d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r () │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__DDIIRREECCTT__SSOOLLVVEERR ********** │ │ │ │ -#define DUNE_REGISTER_DIRECT_SOLVER (   name, │ │ │ │ -   ......  │ │ │ │ - )     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(DirectSolverTag, │ │ │ │ - name, __VA_ARGS__) │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__IITTEERRAATTIIVVEE__SSOOLLVVEERR ********** │ │ │ │ -#define DUNE_REGISTER_ITERATIVE_SOLVER (   name, │ │ │ │ -   ......  │ │ │ │ -     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ - ) (IterativeSolverTag, name, │ │ │ │ - __VA_ARGS__) │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__PPRREECCOONNDDIITTIIOONNEERR ********** │ │ │ │ -#define DUNE_REGISTER_PRECONDITIONER (   name, │ │ │ │ -   ......  │ │ │ │ - )     _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ - (PreconditionerTag, name, __VA_ARGS__) │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverregistry.hh Source File │ │ │ +dune-istl: transfer.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,122 +70,250 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
solverregistry.hh
│ │ │ +
transfer.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5
│ │ │ -
6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ -
7#define DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ -
8
│ │ │ - │ │ │ - │ │ │ -
11#include <dune/istl/solver.hh>
│ │ │ -
12
│ │ │ -
│ │ │ -
13#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \
│ │ │ -
14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ -
15
│ │ │ -
│ │ │ -
16#define DUNE_REGISTER_PRECONDITIONER(name, ...) \
│ │ │ -
17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ -
18
│ │ │ -
│ │ │ -
19#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \
│ │ │ -
20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ -
21
│ │ │ -
22namespace Dune{
│ │ │ -
27 namespace {
│ │ │ -
28 struct DirectSolverTag {};
│ │ │ -
29 struct PreconditionerTag {};
│ │ │ -
30 struct IterativeSolverTag {};
│ │ │ -
31 }
│ │ │ -
32 template<template<class,class,class,int>class Preconditioner, int blockLevel=1>
│ │ │ -
│ │ │ - │ │ │ -
34 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& config)
│ │ │ -
35 {
│ │ │ -
36 using Matrix = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ -
37 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ -
38 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type;
│ │ │ -
39 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
│ │ │ -
40 = std::make_shared<Preconditioner<Matrix, Domain, Range, blockLevel>>(matrix, config);
│ │ │ -
41 return preconditioner;
│ │ │ -
42 };
│ │ │ -
43 }
│ │ │ -
│ │ │ -
44
│ │ │ -
45 template<template<class,class,class>class Preconditioner>
│ │ │ -
│ │ │ - │ │ │ -
47 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& config)
│ │ │ -
48 {
│ │ │ -
49 using Matrix = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ -
50 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ -
51 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type;
│ │ │ -
52 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner
│ │ │ -
53 = std::make_shared<Preconditioner<Matrix, Domain, Range>>(matrix, config);
│ │ │ -
54 return preconditioner;
│ │ │ -
55 };
│ │ │ -
56 }
│ │ │ -
│ │ │ -
57
│ │ │ -
58 template<template<class...>class Solver>
│ │ │ -
│ │ │ - │ │ │ -
60 return [](auto typeList,
│ │ │ -
61 const auto& linearOperator,
│ │ │ -
62 const auto& scalarProduct,
│ │ │ -
63 const auto& preconditioner,
│ │ │ -
64 const Dune::ParameterTree& config)
│ │ │ -
65 {
│ │ │ -
66 using Domain = typename Dune::TypeListElement<0, decltype(typeList)>::type;
│ │ │ -
67 using Range = typename Dune::TypeListElement<1, decltype(typeList)>::type;
│ │ │ -
68 std::shared_ptr<Dune::InverseOperator<Domain, Range>> solver
│ │ │ -
69 = std::make_shared<Solver<Domain>>(linearOperator, scalarProduct, preconditioner, config);
│ │ │ -
70 return solver;
│ │ │ -
71 };
│ │ │ -
72 }
│ │ │ +
5#ifndef DUNE_AMGTRANSFER_HH
│ │ │ +
6#define DUNE_AMGTRANSFER_HH
│ │ │ +
7
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
13#include <dune/common/exceptions.hh>
│ │ │ +
14
│ │ │ +
15namespace Dune
│ │ │ +
16{
│ │ │ +
17 namespace Amg
│ │ │ +
18 {
│ │ │ +
19
│ │ │ +
30 template<class V1, class V2, class T>
│ │ │ +
│ │ │ + │ │ │ +
32 {
│ │ │ +
33
│ │ │ +
34 public:
│ │ │ +
35 typedef V1 Vertex;
│ │ │ +
36 typedef V2 Vector;
│ │ │ +
37
│ │ │ +
38 template<typename T1, typename R>
│ │ │ +
39 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ +
40 Vector& fineRedist,T1 damp, R& redistributor=R());
│ │ │ +
41
│ │ │ +
42 template<typename T1, typename R>
│ │ │ +
43 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ +
44 T1 damp);
│ │ │ +
45
│ │ │ +
46 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ +
47 T& comm);
│ │ │ +
48 };
│ │ │ +
│ │ │ +
49
│ │ │ +
50 template<class V,class V1>
│ │ │ +
│ │ │ + │ │ │ +
52 {
│ │ │ +
53 public:
│ │ │ +
54 typedef V Vertex;
│ │ │ +
55 typedef V1 Vector;
│ │ │ + │ │ │ +
57 template<typename T1>
│ │ │ +
58 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ +
59 Vector& fineRedist, T1 damp,
│ │ │ + │ │ │ +
61 const Redist& redist=Redist());
│ │ │ +
62 template<typename T1>
│ │ │ +
63 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ +
64 T1 damp,
│ │ │ + │ │ │ +
66
│ │ │ +
67
│ │ │ +
68 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ +
69 const SequentialInformation& comm);
│ │ │ +
70 };
│ │ │
│ │ │ +
71
│ │ │ +
72#if HAVE_MPI
│ │ │
73
│ │ │ -
74 /* This exception is thrown, when the requested solver is in the factory but
│ │ │ -
75 cannot be instantiated for the required template parameters
│ │ │ -
76 */
│ │ │ -
77 class UnsupportedType : public NotImplemented {};
│ │ │ -
78
│ │ │ -
79 class InvalidSolverFactoryConfiguration : public InvalidStateException{};
│ │ │ -
80} // end namespace Dune
│ │ │ -
81
│ │ │ -
82#endif // DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ - │ │ │ - │ │ │ -
auto defaultIterativeSolverCreator()
Definition solverregistry.hh:59
│ │ │ -
auto defaultPreconditionerBlockLevelCreator()
Definition solverregistry.hh:33
│ │ │ -
auto defaultPreconditionerCreator()
Definition solverregistry.hh:46
│ │ │ +
74 template<class V,class V1, class T1, class T2>
│ │ │ +
│ │ │ + │ │ │ +
76 {
│ │ │ +
77 public:
│ │ │ +
78 typedef V Vertex;
│ │ │ +
79 typedef V1 Vector;
│ │ │ + │ │ │ +
81 template<typename T3>
│ │ │ +
82 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ +
83 Vector& fineRedist, T3 damp, OwnerOverlapCopyCommunication<T1,T2>& comm,
│ │ │ +
84 const Redist& redist);
│ │ │ +
85 template<typename T3>
│ │ │ +
86 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ + │ │ │ +
88
│ │ │ +
89 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ + │ │ │ +
91 };
│ │ │ +
│ │ │ +
92
│ │ │ +
93#endif
│ │ │ +
94
│ │ │ +
95 template<class V, class V1>
│ │ │ +
96 template<typename T>
│ │ │ +
97 inline void
│ │ │ +
│ │ │ + │ │ │ +
99 Vector& coarse, Vector& fine,
│ │ │ +
100 [[maybe_unused]] Vector& fineRedist,
│ │ │ +
101 T damp,
│ │ │ +
102 [[maybe_unused]] const SequentialInformation& comm,
│ │ │ +
103 [[maybe_unused]] const Redist& redist)
│ │ │ +
104 {
│ │ │ +
105 prolongateVector(aggregates, coarse, fine, damp);
│ │ │ +
106 }
│ │ │ +
│ │ │ +
107 template<class V, class V1>
│ │ │ +
108 template<typename T>
│ │ │ +
109 inline void
│ │ │ +
│ │ │ + │ │ │ +
111 Vector& coarse, Vector& fine,
│ │ │ +
112 T damp,
│ │ │ +
113 [[maybe_unused]] const SequentialInformation& comm)
│ │ │ +
114 {
│ │ │ +
115 typedef typename Vector::iterator Iterator;
│ │ │ +
116
│ │ │ +
117 Iterator end = coarse.end();
│ │ │ +
118 Iterator begin= coarse.begin();
│ │ │ +
119 for(; begin!=end; ++begin)
│ │ │ +
120 *begin*=damp;
│ │ │ +
121 end=fine.end();
│ │ │ +
122 begin=fine.begin();
│ │ │ +
123
│ │ │ +
124 for(Iterator block=begin; block != end; ++block) {
│ │ │ +
125 std::ptrdiff_t index=block-begin;
│ │ │ +
126 const Vertex& vertex = aggregates[index];
│ │ │ + │ │ │ +
128 *block += coarse[aggregates[index]];
│ │ │ +
129 }
│ │ │ +
130 }
│ │ │ +
│ │ │ +
131
│ │ │ +
132 template<class V, class V1>
│ │ │ +
133 inline void
│ │ │ +
│ │ │ + │ │ │ +
135 Vector& coarse,
│ │ │ +
136 const Vector& fine,
│ │ │ +
137 [[maybe_unused]] const SequentialInformation& comm)
│ │ │ +
138 {
│ │ │ +
139 // Set coarse vector to zero
│ │ │ +
140 coarse=0;
│ │ │ +
141
│ │ │ +
142 typedef typename Vector::const_iterator Iterator;
│ │ │ +
143 Iterator end = fine.end();
│ │ │ +
144 Iterator begin=fine.begin();
│ │ │ +
145
│ │ │ +
146 for(Iterator block=begin; block != end; ++block) {
│ │ │ +
147 const Vertex& vertex = aggregates[block-begin];
│ │ │ + │ │ │ +
149 coarse[vertex] += *block;
│ │ │ +
150 }
│ │ │ +
151 }
│ │ │ +
│ │ │ +
152
│ │ │ +
153#if HAVE_MPI
│ │ │ +
154 template<class V, class V1, class T1, class T2>
│ │ │ +
155 template<typename T3>
│ │ │ +
│ │ │ +
156 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::prolongateVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ +
157 Vector& coarse, Vector& fine,
│ │ │ +
158 Vector& fineRedist, T3 damp,
│ │ │ + │ │ │ +
160 const Redist& redist)
│ │ │ +
161 {
│ │ │ +
162 if(fineRedist.size()>0)
│ │ │ +
163 // we operated on the coarse level
│ │ │ +
164 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fineRedist, damp);
│ │ │ +
165
│ │ │ +
166 // TODO This could be accomplished with one communication, too!
│ │ │ +
167 redist.redistributeBackward(fine, fineRedist);
│ │ │ +
168 comm.copyOwnerToAll(fine,fine);
│ │ │ +
169 }
│ │ │ +
│ │ │ +
170
│ │ │ +
171 template<class V, class V1, class T1, class T2>
│ │ │ +
172 template<typename T3>
│ │ │ +
│ │ │ + │ │ │ +
174 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
175 Vector& coarse, Vector& fine, T3 damp,
│ │ │ +
176 [[maybe_unused]] OwnerOverlapCopyCommunication<T1,T2>& comm)
│ │ │ +
177 {
│ │ │ +
178 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fine, damp);
│ │ │ +
179 }
│ │ │ +
│ │ │ +
180 template<class V, class V1, class T1, class T2>
│ │ │ +
│ │ │ +
181 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::restrictVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ +
182 Vector& coarse, const Vector& fine,
│ │ │ + │ │ │ +
184 {
│ │ │ + │ │ │ +
186 // We need this here to avoid it in the smoothers on the coarse level.
│ │ │ +
187 // There (in the preconditioner d is const.
│ │ │ +
188 comm.project(coarse);
│ │ │ +
189 }
│ │ │ +
│ │ │ +
190#endif
│ │ │ +
192 } // namspace Amg
│ │ │ +
193} // namspace Dune
│ │ │ +
194#endif
│ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ + │ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ +
Functionality for redistributing a sparse matrix.
│ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │
Definition allocator.hh:11
│ │ │ -
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:176
│ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ -
Definition solverregistry.hh:77
│ │ │ -
Definition solverregistry.hh:79
│ │ │ +
Definition matrixredistribute.hh:22
│ │ │ +
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:32
│ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
Definition transfer.hh:32
│ │ │ +
static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, const Vector &fine, T &comm)
│ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp)
│ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R())
│ │ │ +
V1 Vertex
Definition transfer.hh:35
│ │ │ +
V2 Vector
Definition transfer.hh:36
│ │ │ +
RedistributeInformation< SequentialInformation > Redist
Definition transfer.hh:56
│ │ │ + │ │ │ + │ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation &comm=SequentialInformation(), const Redist &redist=Redist())
│ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp, const SequentialInformation &comm=SequentialInformation())
│ │ │ + │ │ │ +
RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist
Definition transfer.hh:80
│ │ │ + │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,120 +1,294 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -solverregistry.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +transfer.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5 │ │ │ │ -6#ifndef DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ -7#define DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ -8 │ │ │ │ -9#include <_d_u_n_e_/_i_s_t_l_/_c_o_m_m_o_n_/_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h> │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -12 │ │ │ │ -_1_3#define DUNE_REGISTER_DIRECT_SOLVER(name, ...) \ │ │ │ │ -14 DUNE_REGISTRY_PUT(DirectSolverTag, name, __VA_ARGS__) │ │ │ │ -15 │ │ │ │ -_1_6#define DUNE_REGISTER_PRECONDITIONER(name, ...) \ │ │ │ │ -17 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__) │ │ │ │ -18 │ │ │ │ -_1_9#define DUNE_REGISTER_ITERATIVE_SOLVER(name, ...) \ │ │ │ │ -20 DUNE_REGISTRY_PUT(IterativeSolverTag, name, __VA_ARGS__) │ │ │ │ -21 │ │ │ │ -22namespace _D_u_n_e{ │ │ │ │ -27 namespace { │ │ │ │ -28 struct DirectSolverTag {}; │ │ │ │ -29 struct PreconditionerTag {}; │ │ │ │ -30 struct IterativeSolverTag {}; │ │ │ │ -31 } │ │ │ │ -32 templateclass Preconditioner, int │ │ │ │ -_b_l_o_c_k_L_e_v_e_l=1> │ │ │ │ -_3_3 auto _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r(){ │ │ │ │ -34 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& │ │ │ │ -config) │ │ │ │ -35 { │ │ │ │ -36 using _M_a_t_r_i_x = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ -37 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ -38 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type; │ │ │ │ -39 std::shared_ptr> preconditioner │ │ │ │ -40 = std::make_shared> │ │ │ │ -(matrix, config); │ │ │ │ -41 return preconditioner; │ │ │ │ -42 }; │ │ │ │ -43 } │ │ │ │ -44 │ │ │ │ -45 templateclass Preconditioner> │ │ │ │ -_4_6 auto _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r(){ │ │ │ │ -47 return [](auto typeList, const auto& matrix, const Dune::ParameterTree& │ │ │ │ -config) │ │ │ │ -48 { │ │ │ │ -49 using _M_a_t_r_i_x = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ -50 using Domain = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ -51 using Range = typename Dune::TypeListElement<2, decltype(typeList)>::type; │ │ │ │ -52 std::shared_ptr> preconditioner │ │ │ │ -53 = std::make_shared>(matrix, config); │ │ │ │ -54 return preconditioner; │ │ │ │ -55 }; │ │ │ │ -56 } │ │ │ │ -57 │ │ │ │ -58 templateclass Solver> │ │ │ │ -_5_9 auto _d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r(){ │ │ │ │ -60 return [](auto typeList, │ │ │ │ -61 const auto& linearOperator, │ │ │ │ -62 const auto& scalarProduct, │ │ │ │ -63 const auto& preconditioner, │ │ │ │ -64 const Dune::ParameterTree& config) │ │ │ │ -65 { │ │ │ │ -66 using Domain = typename Dune::TypeListElement<0, decltype(typeList)>::type; │ │ │ │ -67 using Range = typename Dune::TypeListElement<1, decltype(typeList)>::type; │ │ │ │ -68 std::shared_ptr> solver │ │ │ │ -69 = std::make_shared>(linearOperator, scalarProduct, │ │ │ │ -preconditioner, config); │ │ │ │ -70 return solver; │ │ │ │ -71 }; │ │ │ │ -72 } │ │ │ │ +5#ifndef DUNE_AMGTRANSFER_HH │ │ │ │ +6#define DUNE_AMGTRANSFER_HH │ │ │ │ +7 │ │ │ │ +8#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +9#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_p_i_n_f_o_._h_h> │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ +13#include │ │ │ │ +14 │ │ │ │ +15namespace _D_u_n_e │ │ │ │ +16{ │ │ │ │ +17 namespace Amg │ │ │ │ +18 { │ │ │ │ +19 │ │ │ │ +30 template │ │ │ │ +_3_1 class _T_r_a_n_s_f_e_r │ │ │ │ +32 { │ │ │ │ +33 │ │ │ │ +34 public: │ │ │ │ +_3_5 typedef V1 _V_e_r_t_e_x; │ │ │ │ +_3_6 typedef V2 _V_e_c_t_o_r; │ │ │ │ +37 │ │ │ │ +38 template │ │ │ │ +_3_9 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +40 _V_e_c_t_o_r& fineRedist,T1 damp, R& redistributor=R()); │ │ │ │ +41 │ │ │ │ +42 template │ │ │ │ +_4_3 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +44 T1 damp); │ │ │ │ +45 │ │ │ │ +_4_6 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ +coarse, const _V_e_c_t_o_r& fine, │ │ │ │ +47 T& comm); │ │ │ │ +48 }; │ │ │ │ +49 │ │ │ │ +50 template │ │ │ │ +_5_1 class _T_r_a_n_s_f_e_r │ │ │ │ +52 { │ │ │ │ +53 public: │ │ │ │ +_5_4 typedef V _V_e_r_t_e_x; │ │ │ │ +_5_5 typedef V1 _V_e_c_t_o_r; │ │ │ │ +_5_6 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_> _R_e_d_i_s_t; │ │ │ │ +57 template │ │ │ │ +_5_8 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +59 _V_e_c_t_o_r& fineRedist, T1 damp, │ │ │ │ +60 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm=_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(), │ │ │ │ +61 const _R_e_d_i_s_t& redist=_R_e_d_i_s_t()); │ │ │ │ +62 template │ │ │ │ +_6_3 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +64 T1 damp, │ │ │ │ +65 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm=_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ +66 │ │ │ │ +67 │ │ │ │ +68 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ +coarse, const _V_e_c_t_o_r& fine, │ │ │ │ +69 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm); │ │ │ │ +70 }; │ │ │ │ +71 │ │ │ │ +72#if HAVE_MPI │ │ │ │ 73 │ │ │ │ -74 /* This exception is thrown, when the requested solver is in the factory but │ │ │ │ -75 cannot be instantiated for the required template parameters │ │ │ │ -76 */ │ │ │ │ -_7_7 class _U_n_s_u_p_p_o_r_t_e_d_T_y_p_e : public NotImplemented {}; │ │ │ │ -78 │ │ │ │ -_7_9 class _I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n : public InvalidStateException{}; │ │ │ │ -80} // end namespace Dune │ │ │ │ -81 │ │ │ │ -82#endif // DUNE_ISTL_SOLVERREGISTRY_HH │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h │ │ │ │ -_r_e_g_i_s_t_r_y_._h_h │ │ │ │ -_D_u_n_e_:_:_d_e_f_a_u_l_t_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_C_r_e_a_t_o_r │ │ │ │ -auto defaultIterativeSolverCreator() │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:59 │ │ │ │ -_D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r │ │ │ │ -auto defaultPreconditionerBlockLevelCreator() │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:33 │ │ │ │ -_D_u_n_e_:_:_d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r │ │ │ │ -auto defaultPreconditionerCreator() │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:46 │ │ │ │ +74 template │ │ │ │ +_7_5 class _T_r_a_n_s_f_e_r > │ │ │ │ +76 { │ │ │ │ +77 public: │ │ │ │ +_7_8 typedef V _V_e_r_t_e_x; │ │ │ │ +_7_9 typedef V1 _V_e_c_t_o_r; │ │ │ │ +_8_0 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> > │ │ │ │ +_R_e_d_i_s_t; │ │ │ │ +81 template │ │ │ │ +82 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +83 _V_e_c_t_o_r& fineRedist, T3 damp, _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ +84 const _R_e_d_i_s_t& redist); │ │ │ │ +85 template │ │ │ │ +86 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +87 T3 damp, _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm); │ │ │ │ +88 │ │ │ │ +89 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ +coarse, const _V_e_c_t_o_r& fine, │ │ │ │ +90 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm); │ │ │ │ +91 }; │ │ │ │ +92 │ │ │ │ +93#endif │ │ │ │ +94 │ │ │ │ +95 template │ │ │ │ +96 template │ │ │ │ +97 inline void │ │ │ │ +_9_8 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +99 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +100 [[maybe_unused]] _V_e_c_t_o_r& fineRedist, │ │ │ │ +101 T damp, │ │ │ │ +102 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm, │ │ │ │ +103 [[maybe_unused]] const _R_e_d_i_s_t& redist) │ │ │ │ +104 { │ │ │ │ +105 prolongateVector(aggregates, coarse, fine, damp); │ │ │ │ +106 } │ │ │ │ +107 template │ │ │ │ +108 template │ │ │ │ +109 inline void │ │ │ │ +_1_1_0 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +111 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +112 T damp, │ │ │ │ +113 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ +114 { │ │ │ │ +115 typedef typename Vector::iterator Iterator; │ │ │ │ +116 │ │ │ │ +117 Iterator end = coarse.end(); │ │ │ │ +118 Iterator begin= coarse.begin(); │ │ │ │ +119 for(; begin!=end; ++begin) │ │ │ │ +120 *begin*=damp; │ │ │ │ +121 end=fine.end(); │ │ │ │ +122 begin=fine.begin(); │ │ │ │ +123 │ │ │ │ +124 for(Iterator block=begin; block != end; ++block) { │ │ │ │ +125 std::ptrdiff_t index=block-begin; │ │ │ │ +126 const _V_e_r_t_e_x& vertex = aggregates[index]; │ │ │ │ +127 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ +128 *block += coarse[aggregates[index]]; │ │ │ │ +129 } │ │ │ │ +130 } │ │ │ │ +131 │ │ │ │ +132 template │ │ │ │ +133 inline void │ │ │ │ +_1_3_4 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(const │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +135 _V_e_c_t_o_r& coarse, │ │ │ │ +136 const _V_e_c_t_o_r& fine, │ │ │ │ +137 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ +138 { │ │ │ │ +139 // Set coarse vector to zero │ │ │ │ +140 coarse=0; │ │ │ │ +141 │ │ │ │ +142 typedef typename Vector::const_iterator Iterator; │ │ │ │ +143 Iterator end = fine._e_n_d(); │ │ │ │ +144 Iterator begin=fine.begin(); │ │ │ │ +145 │ │ │ │ +146 for(Iterator block=begin; block != end; ++block) { │ │ │ │ +147 const _V_e_r_t_e_x& vertex = aggregates[block-begin]; │ │ │ │ +148 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ +149 coarse[vertex] += *block; │ │ │ │ +150 } │ │ │ │ +151 } │ │ │ │ +152 │ │ │ │ +153#if HAVE_MPI │ │ │ │ +154 template │ │ │ │ +155 template │ │ │ │ +_1_5_6 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ +prolongateVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +157 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ +158 _V_e_c_t_o_r& fineRedist, T3 damp, │ │ │ │ +159 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ +160 const _R_e_d_i_s_t& redist) │ │ │ │ +161 { │ │ │ │ +162 if(fineRedist.size()>0) │ │ │ │ +163 // we operated on the coarse level │ │ │ │ +164 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ +fineRedist, damp); │ │ │ │ +165 │ │ │ │ +166 // TODO This could be accomplished with one communication, too! │ │ │ │ +167 redist._r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(fine, fineRedist); │ │ │ │ +168 comm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(fine,fine); │ │ │ │ +169 } │ │ │ │ +170 │ │ │ │ +171 template │ │ │ │ +172 template │ │ │ │ +_1_7_3 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ +prolongateVector( │ │ │ │ +174 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +175 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, T3 damp, │ │ │ │ +176 [[maybe_unused]] _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ +177 { │ │ │ │ +178 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ +fine, damp); │ │ │ │ +179 } │ │ │ │ +180 template │ │ │ │ +_1_8_1 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ +restrictVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +182 _V_e_c_t_o_r& coarse, const _V_e_c_t_o_r& fine, │ │ │ │ +183 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ +184 { │ │ │ │ +185 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ +fine, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ +186 // We need this here to avoid it in the smoothers on the coarse level. │ │ │ │ +187 // There (in the preconditioner d is const. │ │ │ │ +188 comm._p_r_o_j_e_c_t(coarse); │ │ │ │ +189 } │ │ │ │ +190#endif │ │ │ │ +192 } // namspace Amg │ │ │ │ +193} // namspace Dune │ │ │ │ +194#endif │ │ │ │ +_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ +_p_i_n_f_o_._h_h │ │ │ │ +_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ +Provides classes for the Coloring process of AMG. │ │ │ │ +_b_v_e_c_t_o_r_._h_h │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ +space. The number of compon... │ │ │ │ +_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h │ │ │ │ +Functionality for redistributing a sparse matrix. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ +const_iterator end() const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_b_l_o_c_k_L_e_v_e_l │ │ │ │ -constexpr std::size_t blockLevel() │ │ │ │ -Determine the block level of a possibly nested vector/matrix type. │ │ │ │ -DDeeffiinniittiioonn blocklevel.hh:176 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ -_D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_F_a_c_t_o_r_y_C_o_n_f_i_g_u_r_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:79 │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_:_:_r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d │ │ │ │ +void redistributeBackward(D &from, const D &to) const │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:32 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ +owner/overlap/copy sema... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ +void project(T1 &x) const │ │ │ │ +Set vector to zero at copy dofs. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ +DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r │ │ │ │ +static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ +&coarse, const Vector &fine, T &comm) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ +&coarse, Vector &fine, T1 damp) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ +&coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R()) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_r_t_e_x │ │ │ │ +V1 Vertex │ │ │ │ +DDeeffiinniittiioonn transfer.hh:35 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_c_t_o_r │ │ │ │ +V2 Vector │ │ │ │ +DDeeffiinniittiioonn transfer.hh:36 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_R_e_d_i_s_t │ │ │ │ +RedistributeInformation< SequentialInformation > Redist │ │ │ │ +DDeeffiinniittiioonn transfer.hh:56 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_r_t_e_x │ │ │ │ +V Vertex │ │ │ │ +DDeeffiinniittiioonn transfer.hh:54 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_c_t_o_r │ │ │ │ +V1 Vector │ │ │ │ +DDeeffiinniittiioonn transfer.hh:55 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ +&coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation │ │ │ │ +&comm=SequentialInformation(), const Redist &redist=Redist()) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ +static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ +&coarse, Vector &fine, T1 damp, const SequentialInformation │ │ │ │ +&comm=SequentialInformation()) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_r_t_e_x │ │ │ │ +V Vertex │ │ │ │ +DDeeffiinniittiioonn transfer.hh:78 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_R_e_d_i_s_t │ │ │ │ +RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist │ │ │ │ +DDeeffiinniittiioonn transfer.hh:80 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_c_t_o_r │ │ │ │ +V1 Vector │ │ │ │ +DDeeffiinniittiioonn transfer.hh:79 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverfactory.hh File Reference │ │ │ +dune-istl: construction.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,95 +65,68 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Typedefs | │ │ │ -Functions
│ │ │ -
solverfactory.hh File Reference
│ │ │ +Namespaces
│ │ │ + │ │ │ │ │ │
│ │ │ -
#include <unordered_map>
│ │ │ -#include <functional>
│ │ │ -#include <memory>
│ │ │ -#include <dune/common/parametertree.hh>
│ │ │ -#include <dune/common/singleton.hh>
│ │ │ -#include "solverregistry.hh"
│ │ │ -#include <dune/istl/solver.hh>
│ │ │ -#include <dune/istl/schwarz.hh>
│ │ │ -#include <dune/istl/novlpschwarz.hh>
│ │ │ + │ │ │ +

Helper classes for the construction of classes without empty constructor. │ │ │ +More...

│ │ │ +
#include <dune/istl/bvector.hh>
│ │ │ +#include <dune/istl/operators.hh>
│ │ │ +#include <dune/istl/owneroverlapcopy.hh>
│ │ │ +#include <dune/istl/solvercategory.hh>
│ │ │ +#include "pinfo.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::SolverFactory< Operator >
 Factory to assembly solvers configured by a ParameterTree. More...
struct  Dune::Amg::ConstructionTraits< BlockVector< T, A > >
 
struct  Dune::Amg::ParallelOperatorArgs< M, C >
 
struct  Dune::Amg::OwnerOverlapCopyCommunicationArgs
 
struct  Dune::Amg::SequentialCommunicationArgs
 
struct  Dune::Amg::ConstructionTraits< OverlappingSchwarzOperator< M, X, Y, C > >
 
struct  Dune::Amg::ConstructionTraits< NonoverlappingSchwarzOperator< M, X, Y, C > >
 
struct  Dune::Amg::MatrixAdapterArgs< M, X, Y >
 
struct  Dune::Amg::ConstructionTraits< MatrixAdapter< M, X, Y > >
 
struct  Dune::Amg::ConstructionTraits< SequentialInformation >
 
struct  Dune::Amg::ConstructionTraits< OwnerOverlapCopyCommunication< T1, T2 > >
 
│ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Typedefs

template<class M , class X , class Y >
using Dune::DirectSolverSignature = std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &)
 
template<class M , class X , class Y >
using Dune::DirectSolverFactory = Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > >
 
template<class M , class X , class Y >
using Dune::PreconditionerSignature = std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const ParameterTree &)
 
template<class M , class X , class Y >
using Dune::PreconditionerFactory = Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > >
 
template<class X , class Y >
using Dune::IterativeSolverSignature = std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &)
 
template<class X , class Y >
using Dune::IterativeSolverFactory = Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > >
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ -Functions

template<class O , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const O &)
 
template<class M , class X , class Y , class C , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y , class C , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< MatrixAdapter< M, X, Y > > &)
 
template<class M , class X , class Y , class C >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y , class C >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class Operator >
std::shared_ptr< InverseOperator< typename Operator::domain_type, typename Operator::range_type > > Dune::getSolverFromFactory (std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > prec=nullptr)
 Instantiates an InverseOperator from an Operator and a configuration given as a ParameterTree.
 
namespace  Dune::Amg
 
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Helper classes for the construction of classes without empty constructor.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,101 +1,54 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -solverfactory.hh File Reference │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +construction.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ +_M_o_r_e_._._. │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ +#include "_p_i_n_f_o_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_<_ _O_p_e_r_a_t_o_r_ _> │ │ │ │ -  Factory to assembly solvers configured by a ParameterTree. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_ _M_,_ _C_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_,_ _C │ │ │ │ + _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_, │ │ │ │ + _C_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _M_a_t_r_i_x_A_d_a_p_t_e_r_<_ _M_,_ _X_,_ _Y_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ + _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -TTyyppeeddeeffss │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y > > │ │ │ │ - (const M &, const ParameterTree &) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ - _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ -  │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ - >(const std::shared_ptr< M > &, const ParameterTree &) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ - _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ -  │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y │ │ │ │ - > >(const std::shared_ptr< _L_i_n_e_a_r_O_p_e_r_a_t_o_r< X, Y > > &, const std:: │ │ │ │ - shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > > &, const std::shared_ptr< │ │ │ │ - _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > >, const ParameterTree &) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ - _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< X, Y > > > │ │ │ │ -  │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ - const O &) │ │ │ │ -  │ │ │ │ -template │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ - const std::shared_ptr< │ │ │ │ - _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, C > │ │ │ │ - > &op) │ │ │ │ -  │ │ │ │ -template │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ - const std::shared_ptr< │ │ │ │ - _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ - C > > &op) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ - shared_ptr< _M_a_t_r_i_x_A_d_a_p_t_e_r< M, X, Y > > │ │ │ │ - &) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ - shared_ptr< _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< │ │ │ │ - M, X, Y, C > > &op) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ - shared_ptr< │ │ │ │ - _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ - C > > &op) │ │ │ │ -  │ │ │ │ -template │ │ │ │ - std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< _D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y (std:: │ │ │ │ - typename Operator::domain_type, shared_ptr< Operator > op, const │ │ │ │ - typename Operator::range_type > >  ParameterTree &config, std::shared_ptr< │ │ │ │ - _P_r_e_c_o_n_d_i_t_i_o_n_e_r< typename Operator:: │ │ │ │ - domain_type, typename Operator:: │ │ │ │ - range_type > > prec=nullptr) │ │ │ │ - Instantiates an _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r from an │ │ │ │ -  Operator and a configuration given as a │ │ │ │ - ParameterTree. │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solverfactory.hh Source File │ │ │ +dune-istl: construction.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,244 +70,260 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
solverfactory.hh
│ │ │ +
construction.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5
│ │ │ -
6#ifndef DUNE_ISTL_SOLVERFACTORY_HH
│ │ │ -
7#define DUNE_ISTL_SOLVERFACTORY_HH
│ │ │ -
8
│ │ │ -
9#include <unordered_map>
│ │ │ -
10#include <functional>
│ │ │ -
11#include <memory>
│ │ │ -
12
│ │ │ -
13#include <dune/common/parametertree.hh>
│ │ │ -
14#include <dune/common/singleton.hh>
│ │ │ -
15
│ │ │ -
16#include "solverregistry.hh"
│ │ │ -
17#include <dune/istl/solver.hh>
│ │ │ -
18#include <dune/istl/schwarz.hh>
│ │ │ - │ │ │ -
20
│ │ │ -
21namespace Dune{
│ │ │ -
26 // Direct solver factory:
│ │ │ -
27 template<class M, class X, class Y>
│ │ │ -
28 using DirectSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const M&, const ParameterTree&);
│ │ │ -
29 template<class M, class X, class Y>
│ │ │ -
30 using DirectSolverFactory = Singleton<ParameterizedObjectFactory<DirectSolverSignature<M,X,Y>>>;
│ │ │ -
31
│ │ │ -
32 // Preconditioner factory:
│ │ │ -
33 template<class M, class X, class Y>
│ │ │ -
34 using PreconditionerSignature = std::shared_ptr<Preconditioner<X,Y>>(const std::shared_ptr<M>&, const ParameterTree&);
│ │ │ -
35 template<class M, class X, class Y>
│ │ │ -
36 using PreconditionerFactory = Singleton<ParameterizedObjectFactory<PreconditionerSignature<M,X,Y>>>;
│ │ │ -
37
│ │ │ -
38 // Iterative solver factory
│ │ │ -
39 template<class X, class Y>
│ │ │ -
40 using IterativeSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const std::shared_ptr<LinearOperator<X,Y>>&, const std::shared_ptr<ScalarProduct<X>>&, const std::shared_ptr<Preconditioner<X,Y>>, const ParameterTree&);
│ │ │ -
41 template<class X, class Y>
│ │ │ -
42 using IterativeSolverFactory = Singleton<ParameterizedObjectFactory<IterativeSolverSignature<X,Y>>>;
│ │ │ -
43
│ │ │ -
44 // initSolverFactories differs in different compilation units, so we have it
│ │ │ -
45 // in an anonymous namespace
│ │ │ -
46 namespace {
│ │ │ -
47
│ │ │ -
53 template<class O>
│ │ │ -
54 int initSolverFactories(){
│ │ │ -
55 using M = typename O::matrix_type;
│ │ │ -
56 using X = typename O::range_type;
│ │ │ -
57 using Y = typename O::domain_type;
│ │ │ -
58 using TL = Dune::TypeList<M,X,Y>;
│ │ │ - │ │ │ -
60 addRegistryToFactory<TL>(dsfac, DirectSolverTag{});
│ │ │ - │ │ │ -
62 addRegistryToFactory<TL>(pfac, PreconditionerTag{});
│ │ │ -
63 using TLS = Dune::TypeList<X,Y>;
│ │ │ - │ │ │ -
65 return addRegistryToFactory<TLS>(isfac, IterativeSolverTag{});
│ │ │ -
66 }
│ │ │ -
67 } // end anonymous namespace
│ │ │ -
68
│ │ │ -
69
│ │ │ -
70 template<class O, class Preconditioner>
│ │ │ +
5#ifndef DUNE_AMGCONSTRUCTION_HH
│ │ │ +
6#define DUNE_AMGCONSTRUCTION_HH
│ │ │ +
7
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
12#include "pinfo.hh"
│ │ │ +
13
│ │ │ +
14namespace Dune
│ │ │ +
15{
│ │ │ +
16 namespace Amg
│ │ │ +
17 {
│ │ │ +
18
│ │ │ +
37 template<typename T>
│ │ │ +
38 struct ConstructionTraits
│ │ │ +
39 {
│ │ │ +
44 typedef const void* Arguments;
│ │ │ +
45
│ │ │ +
│ │ │ +
52 static inline std::shared_ptr<T> construct(Arguments& args)
│ │ │ +
53 {
│ │ │ +
54 return std::make_shared<T>();
│ │ │ +
55 }
│ │ │ +
│ │ │ +
56 };
│ │ │ +
57
│ │ │ +
58 template<class T, class A>
│ │ │ +
│ │ │ +
59 struct ConstructionTraits<BlockVector<T,A> >
│ │ │ +
60 {
│ │ │ +
61 typedef const int Arguments;
│ │ │ +
│ │ │ +
62 static inline std::shared_ptr<BlockVector<T,A>> construct(Arguments& n)
│ │ │ +
63 {
│ │ │ +
64 return std::make_shared<BlockVector<T,A>>(n);
│ │ │ +
65 }
│ │ │ +
│ │ │ +
66 };
│ │ │ +
│ │ │ +
67
│ │ │ +
68 template<class M, class C>
│ │ │ +
│ │ │ + │ │ │ +
70 {
│ │ │
│ │ │ -
71 std::shared_ptr<Preconditioner> wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ -
72 const O&)
│ │ │ -
73 {
│ │ │ -
74 return prec;
│ │ │ -
75 }
│ │ │ -
│ │ │ -
76
│ │ │ -
77 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ -
78 std::shared_ptr<Preconditioner>
│ │ │ -
│ │ │ -
79 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ -
80 const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ -
81 {
│ │ │ -
82 return std::make_shared<BlockPreconditioner<X,Y,C,Preconditioner> >(prec, op->getCommunication());
│ │ │ -
83 }
│ │ │ -
│ │ │ -
84
│ │ │ -
85 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ -
86 std::shared_ptr<Preconditioner>
│ │ │ -
│ │ │ -
87 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ -
88 const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ -
89 {
│ │ │ -
90 return std::make_shared<NonoverlappingBlockPreconditioner<C,Preconditioner> >(prec, op->getCommunication());
│ │ │ -
91 }
│ │ │ -
│ │ │ -
92
│ │ │ -
93 template<class M, class X, class Y>
│ │ │ -
│ │ │ -
94 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<MatrixAdapter<M,X,Y> >&)
│ │ │ -
95 {
│ │ │ -
96 return std::make_shared<SeqScalarProduct<X>>();
│ │ │ -
97 }
│ │ │ -
│ │ │ -
98 template<class M, class X, class Y, class C>
│ │ │ -
│ │ │ -
99 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ -
100 {
│ │ │ -
101 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ -
102 }
│ │ │ -
│ │ │ -
103
│ │ │ -
104 template<class M, class X, class Y, class C>
│ │ │ -
│ │ │ -
105 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ -
106 {
│ │ │ -
107 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ -
108 }
│ │ │ -
│ │ │ -
109
│ │ │ -
129 template<class Operator>
│ │ │ -
│ │ │ - │ │ │ -
131 using Domain = typename Operator::domain_type;
│ │ │ -
132 using Range = typename Operator::range_type;
│ │ │ - │ │ │ - │ │ │ -
135
│ │ │ -
136 template<class O>
│ │ │ -
137 using _matrix_type = typename O::matrix_type;
│ │ │ -
138 using matrix_type = Std::detected_or_t<int, _matrix_type, Operator>;
│ │ │ -
139 static constexpr bool isAssembled = !std::is_same<matrix_type, int>::value;
│ │ │ -
140
│ │ │ -
141 static const matrix_type* getmat(std::shared_ptr<Operator> op){
│ │ │ -
142 std::shared_ptr<AssembledLinearOperator<matrix_type, Domain, Range>> aop
│ │ │ -
143 = std::dynamic_pointer_cast<AssembledLinearOperator<matrix_type, Domain, Range>>(op);
│ │ │ -
144 if(aop)
│ │ │ -
145 return &aop->getmat();
│ │ │ -
146 return nullptr;
│ │ │ -
147 }
│ │ │ -
148
│ │ │ -
149 public:
│ │ │ -
150
│ │ │ -
│ │ │ -
153 static std::shared_ptr<Solver> get(std::shared_ptr<Operator> op,
│ │ │ -
154 const ParameterTree& config,
│ │ │ -
155 std::shared_ptr<Preconditioner> prec = nullptr){
│ │ │ -
156 std::string type = config.get<std::string>("type");
│ │ │ -
157 std::shared_ptr<Solver> result;
│ │ │ -
158 const matrix_type* mat = getmat(op);
│ │ │ -
159 if(mat){
│ │ │ - │ │ │ -
161 if(op->category()!=SolverCategory::sequential){
│ │ │ -
162 DUNE_THROW(NotImplemented, "The solver factory does not support parallel direct solvers!");
│ │ │ -
163 }
│ │ │ -
164 result = DirectSolverFactory<matrix_type, Domain, Range>::instance().create(type, *mat, config);
│ │ │ -
165 return result;
│ │ │ -
166 }
│ │ │ -
167 }
│ │ │ -
168 // if no direct solver is found it might be an iterative solver
│ │ │ - │ │ │ -
170 DUNE_THROW(Dune::InvalidStateException, "Solver not found in the factory.");
│ │ │ -
171 }
│ │ │ -
172 if(!prec){
│ │ │ -
173 const ParameterTree& precConfig = config.sub("preconditioner");
│ │ │ -
174 std::string prec_type = precConfig.get<std::string>("type");
│ │ │ -
175 prec = PreconditionerFactory<Operator, Domain, Range>::instance().create(prec_type, op, precConfig);
│ │ │ -
176 if (prec->category() != op->category() && prec->category() == SolverCategory::sequential)
│ │ │ -
177 // try to wrap to a parallel preconditioner
│ │ │ -
178 prec = wrapPreconditioner4Parallel(prec, op);
│ │ │ -
179 }
│ │ │ -
180 std::shared_ptr<ScalarProduct<Domain>> sp = createScalarProduct(op);
│ │ │ -
181 result = IterativeSolverFactory<Domain, Range>::instance().create(type, op, sp, prec, config);
│ │ │ -
182 return result;
│ │ │ -
183 }
│ │ │ -
│ │ │ -
184
│ │ │ -
│ │ │ -
188 static std::shared_ptr<Preconditioner> getPreconditioner(std::shared_ptr<Operator> op,
│ │ │ -
189 const ParameterTree& config){
│ │ │ -
190 const matrix_type* mat = getmat(op);
│ │ │ -
191 if(mat){
│ │ │ -
192 std::string prec_type = config.get<std::string>("type");
│ │ │ -
193 return PreconditionerFactory<Operator, Domain, Range>::instance().create(prec_type, op, config);
│ │ │ -
194 }else{
│ │ │ -
195 DUNE_THROW(InvalidStateException, "Could not obtain matrix from operator. Please pass in an AssembledLinearOperator.");
│ │ │ -
196 }
│ │ │ -
197 }
│ │ │ -
│ │ │ -
198 };
│ │ │ -
│ │ │ -
199
│ │ │ -
210 template<class Operator>
│ │ │ -
211 std::shared_ptr<InverseOperator<typename Operator::domain_type,
│ │ │ -
│ │ │ -
212 typename Operator::range_type>> getSolverFromFactory(std::shared_ptr<Operator> op,
│ │ │ -
213 const ParameterTree& config,
│ │ │ -
214 std::shared_ptr<Preconditioner<typename Operator::domain_type,
│ │ │ -
215 typename Operator::range_type>> prec = nullptr){
│ │ │ -
216 return SolverFactory<Operator>::get(op, config, prec);
│ │ │ -
217 }
│ │ │ -
│ │ │ -
218
│ │ │ -
222} // end namespace Dune
│ │ │ -
223
│ │ │ -
224
│ │ │ -
225#endif
│ │ │ - │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ - │ │ │ - │ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ -
Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > > PreconditionerFactory
Definition solverfactory.hh:36
│ │ │ -
Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > > DirectSolverFactory
Definition solverfactory.hh:30
│ │ │ -
std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &) IterativeSolverSignature
Definition solverfactory.hh:40
│ │ │ -
std::shared_ptr< Preconditioner > wrapPreconditioner4Parallel(const std::shared_ptr< Preconditioner > &prec, const O &)
Definition solverfactory.hh:71
│ │ │ -
std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &) DirectSolverSignature
Definition solverfactory.hh:28
│ │ │ -
std::shared_ptr< InverseOperator< typename Operator::domain_type, typename Operator::range_type > > getSolverFromFactory(std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > prec=nullptr)
Instantiates an InverseOperator from an Operator and a configuration given as a ParameterTree.
Definition solverfactory.hh:212
│ │ │ -
Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > > IterativeSolverFactory
Definition solverfactory.hh:42
│ │ │ -
std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const ParameterTree &) PreconditionerSignature
Definition solverfactory.hh:34
│ │ │ +
71 ParallelOperatorArgs(std::shared_ptr<M> matrix, const C& comm)
│ │ │ +
72 : matrix_(matrix), comm_(comm)
│ │ │ +
73 {}
│ │ │ +
│ │ │ +
74
│ │ │ +
75 std::shared_ptr<M> matrix_;
│ │ │ +
76 const C& comm_;
│ │ │ +
77 };
│ │ │ +
│ │ │ +
78
│ │ │ +
79#if HAVE_MPI
│ │ │ +
│ │ │ + │ │ │ +
81 {
│ │ │ +
│ │ │ + │ │ │ +
83 : comm_(comm), cat_(cat)
│ │ │ +
84 {}
│ │ │ +
│ │ │ +
85
│ │ │ +
86 MPI_Comm comm_;
│ │ │ + │ │ │ +
88 };
│ │ │ +
│ │ │ +
89#endif
│ │ │ +
90
│ │ │ +
│ │ │ + │ │ │ +
92 {
│ │ │ +
│ │ │ +
93 SequentialCommunicationArgs(Communication<void*> comm, [[maybe_unused]] int cat)
│ │ │ +
94 : comm_(comm)
│ │ │ +
95 {}
│ │ │ +
│ │ │ +
96
│ │ │ +
97 Communication<void*> comm_;
│ │ │ +
98 };
│ │ │ +
│ │ │ +
99
│ │ │ +
100 } // end Amg namspace
│ │ │ +
101
│ │ │ +
102 // forward declaration
│ │ │ +
103 template<class M, class X, class Y, class C>
│ │ │ + │ │ │ +
105
│ │ │ +
106 template<class M, class X, class Y, class C>
│ │ │ + │ │ │ +
108
│ │ │ +
109 namespace Amg
│ │ │ +
110 {
│ │ │ +
111 template<class M, class X, class Y, class C>
│ │ │ +
│ │ │ +
112 struct ConstructionTraits<OverlappingSchwarzOperator<M,X,Y,C> >
│ │ │ +
113 {
│ │ │ + │ │ │ +
115
│ │ │ +
│ │ │ +
116 static inline std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
│ │ │ +
117 {
│ │ │ +
118 return std::make_shared<OverlappingSchwarzOperator<M,X,Y,C>>
│ │ │ +
119 (args.matrix_, args.comm_);
│ │ │ +
120 }
│ │ │ +
│ │ │ +
121 };
│ │ │ +
│ │ │ +
122
│ │ │ +
123 template<class M, class X, class Y, class C>
│ │ │ +
│ │ │ +
124 struct ConstructionTraits<NonoverlappingSchwarzOperator<M,X,Y,C> >
│ │ │ +
125 {
│ │ │ + │ │ │ +
127
│ │ │ +
│ │ │ +
128 static inline std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>> construct(const Arguments& args)
│ │ │ +
129 {
│ │ │ +
130 return std::make_shared<NonoverlappingSchwarzOperator<M,X,Y,C>>
│ │ │ +
131 (args.matrix_, args.comm_);
│ │ │ +
132 }
│ │ │ +
│ │ │ +
133 };
│ │ │ +
│ │ │ +
134
│ │ │ +
135 template<class M, class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
137 {
│ │ │ +
│ │ │ +
138 MatrixAdapterArgs(std::shared_ptr<M> matrix, const SequentialInformation)
│ │ │ +
139 : matrix_(matrix)
│ │ │ +
140 {}
│ │ │ +
│ │ │ +
141
│ │ │ +
142 std::shared_ptr<M> matrix_;
│ │ │ +
143 };
│ │ │ +
│ │ │ +
144
│ │ │ +
145 template<class M, class X, class Y>
│ │ │ +
│ │ │ +
146 struct ConstructionTraits<MatrixAdapter<M,X,Y> >
│ │ │ +
147 {
│ │ │ + │ │ │ +
149
│ │ │ +
│ │ │ +
150 static inline std::shared_ptr<MatrixAdapter<M,X,Y>> construct(Arguments& args)
│ │ │ +
151 {
│ │ │ +
152 return std::make_shared<MatrixAdapter<M,X,Y>>(args.matrix_);
│ │ │ +
153 }
│ │ │ +
│ │ │ +
154 };
│ │ │ +
│ │ │ +
155
│ │ │ +
156 template<>
│ │ │ +
│ │ │ +
157 struct ConstructionTraits<SequentialInformation>
│ │ │ +
158 {
│ │ │ + │ │ │ +
│ │ │ +
160 static inline std::shared_ptr<SequentialInformation> construct(Arguments& args)
│ │ │ +
161 {
│ │ │ +
162 return std::make_shared<SequentialInformation>(args.comm_);
│ │ │ +
163 }
│ │ │ +
│ │ │ +
164 };
│ │ │ +
│ │ │ +
165
│ │ │ +
166
│ │ │ +
167#if HAVE_MPI
│ │ │ +
168
│ │ │ +
169 template<class T1, class T2>
│ │ │ +
│ │ │ +
170 struct ConstructionTraits<OwnerOverlapCopyCommunication<T1,T2> >
│ │ │ +
171 {
│ │ │ + │ │ │ +
173
│ │ │ +
│ │ │ +
174 static inline std::shared_ptr<OwnerOverlapCopyCommunication<T1,T2>> construct(Arguments& args)
│ │ │ +
175 {
│ │ │ +
176 return std::make_shared<OwnerOverlapCopyCommunication<T1,T2>>(args.comm_, args.cat_);
│ │ │ +
177 }
│ │ │ +
│ │ │ +
178 };
│ │ │ +
│ │ │ +
179
│ │ │ +
180#endif
│ │ │ +
181
│ │ │ +
183 } // namespace Amg
│ │ │ +
184} // namespace Dune
│ │ │ +
185#endif
│ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ + │ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ + │ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ +
const int Arguments
Definition construction.hh:61
│ │ │ +
SequentialCommunicationArgs(Communication< void * > comm, int cat)
Definition construction.hh:93
│ │ │ +
OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat)
Definition construction.hh:82
│ │ │ +
MPI_Comm comm_
Definition construction.hh:86
│ │ │ +
SolverCategory::Category cat_
Definition construction.hh:87
│ │ │ +
const C & comm_
Definition construction.hh:76
│ │ │ +
ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm)
Definition construction.hh:71
│ │ │ +
std::shared_ptr< M > matrix_
Definition construction.hh:75
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
Communication< void * > comm_
Definition construction.hh:97
│ │ │ +
static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n)
Definition construction.hh:62
│ │ │
Definition allocator.hh:11
│ │ │ -
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │
Adapter to turn a matrix into a linear operator.
Definition operators.hh:136
│ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
Definition construction.hh:70
│ │ │ + │ │ │ +
Definition construction.hh:92
│ │ │
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ - │ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
Factory to assembly solvers configured by a ParameterTree.
Definition solverfactory.hh:130
│ │ │ -
static std::shared_ptr< Solver > get(std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr)
get a solver from the factory
Definition solverfactory.hh:153
│ │ │ -
static std::shared_ptr< Preconditioner > getPreconditioner(std::shared_ptr< Operator > op, const ParameterTree &config)
Construct a Preconditioner for a given Operator.
Definition solverfactory.hh:188
│ │ │ +
ParallelOperatorArgs< M, C > Arguments
Definition construction.hh:114
│ │ │ +
static std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > construct(const Arguments &args)
Definition construction.hh:116
│ │ │ +
ParallelOperatorArgs< M, C > Arguments
Definition construction.hh:126
│ │ │ +
static std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > construct(const Arguments &args)
Definition construction.hh:128
│ │ │ +
Definition construction.hh:137
│ │ │ +
MatrixAdapterArgs(std::shared_ptr< M > matrix, const SequentialInformation)
Definition construction.hh:138
│ │ │ +
std::shared_ptr< M > matrix_
Definition construction.hh:142
│ │ │ +
static std::shared_ptr< MatrixAdapter< M, X, Y > > construct(Arguments &args)
Definition construction.hh:150
│ │ │ +
const MatrixAdapterArgs< M, X, Y > Arguments
Definition construction.hh:148
│ │ │ +
const SequentialCommunicationArgs Arguments
Definition construction.hh:159
│ │ │ +
static std::shared_ptr< SequentialInformation > construct(Arguments &args)
Definition construction.hh:160
│ │ │ +
static std::shared_ptr< OwnerOverlapCopyCommunication< T1, T2 > > construct(Arguments &args)
Definition construction.hh:174
│ │ │ +
const OwnerOverlapCopyCommunicationArgs Arguments
Definition construction.hh:172
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
Category
Definition solvercategory.hh:23
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,298 +1,300 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -solverfactory.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +construction.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5 │ │ │ │ -6#ifndef DUNE_ISTL_SOLVERFACTORY_HH │ │ │ │ -7#define DUNE_ISTL_SOLVERFACTORY_HH │ │ │ │ -8 │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12 │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15 │ │ │ │ -16#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ -20 │ │ │ │ -21namespace _D_u_n_e{ │ │ │ │ -26 // Direct solver factory: │ │ │ │ -27 template │ │ │ │ -_2_8 using _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ -M&, const ParameterTree&); │ │ │ │ -29 template │ │ │ │ -_3_0 using _D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ -Singleton>>; │ │ │ │ -31 │ │ │ │ -32 // Preconditioner factory: │ │ │ │ -33 template │ │ │ │ -_3_4 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ -std::shared_ptr&, const ParameterTree&); │ │ │ │ -35 template │ │ │ │ -_3_6 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = │ │ │ │ -Singleton>>; │ │ │ │ -37 │ │ │ │ -38 // Iterative solver factory │ │ │ │ -39 template │ │ │ │ -_4_0 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const │ │ │ │ -std::shared_ptr>&, const std:: │ │ │ │ -shared_ptr>&, const std::shared_ptr>, │ │ │ │ -const ParameterTree&); │ │ │ │ -41 template │ │ │ │ -_4_2 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ -Singleton>>; │ │ │ │ -43 │ │ │ │ -44 // initSolverFactories differs in different compilation units, so we have it │ │ │ │ -45 // in an anonymous namespace │ │ │ │ -46 namespace { │ │ │ │ -47 │ │ │ │ -53 template │ │ │ │ -54 int initSolverFactories(){ │ │ │ │ -55 using M = typename O::matrix_type; │ │ │ │ -56 using X = typename O::range_type; │ │ │ │ -57 using Y = typename O::domain_type; │ │ │ │ -58 using TL = Dune::TypeList; │ │ │ │ -59 auto& dsfac=_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_M_,_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ -60 addRegistryToFactory(dsfac, DirectSolverTag{}); │ │ │ │ -61 auto& pfac=_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_,_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ -62 addRegistryToFactory(pfac, PreconditionerTag{}); │ │ │ │ -63 using TLS = Dune::TypeList; │ │ │ │ -64 auto& isfac=_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_X_,_Y_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ -65 return addRegistryToFactory(isfac, IterativeSolverTag{}); │ │ │ │ -66 } │ │ │ │ -67 } // end anonymous namespace │ │ │ │ -68 │ │ │ │ -69 │ │ │ │ -70 template │ │ │ │ -_7_1 std::shared_ptr _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std:: │ │ │ │ -shared_ptr& prec, │ │ │ │ -72 const O&) │ │ │ │ -73 { │ │ │ │ -74 return prec; │ │ │ │ -75 } │ │ │ │ -76 │ │ │ │ -77 template │ │ │ │ -78 std::shared_ptr │ │ │ │ -_7_9 _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std::shared_ptr& prec, │ │ │ │ -80 const std::shared_ptr<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_> >& op) │ │ │ │ +5#ifndef DUNE_AMGCONSTRUCTION_HH │ │ │ │ +6#define DUNE_AMGCONSTRUCTION_HH │ │ │ │ +7 │ │ │ │ +8#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +9#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ +12#include "_p_i_n_f_o_._h_h" │ │ │ │ +13 │ │ │ │ +14namespace _D_u_n_e │ │ │ │ +15{ │ │ │ │ +16 namespace Amg │ │ │ │ +17 { │ │ │ │ +18 │ │ │ │ +37 template │ │ │ │ +38 struct ConstructionTraits │ │ │ │ +39 { │ │ │ │ +_4_4 typedef const void* _A_r_g_u_m_e_n_t_s; │ │ │ │ +45 │ │ │ │ +_5_2 static inline std::shared_ptr _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +53 { │ │ │ │ +54 return std::make_shared(); │ │ │ │ +55 } │ │ │ │ +56 }; │ │ │ │ +57 │ │ │ │ +58 template │ │ │ │ +_5_9 struct ConstructionTraits<_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ +60 { │ │ │ │ +_6_1 typedef const int _A_r_g_u_m_e_n_t_s; │ │ │ │ +_6_2 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& n) │ │ │ │ +63 { │ │ │ │ +64 return std::make_shared>(n); │ │ │ │ +65 } │ │ │ │ +66 }; │ │ │ │ +67 │ │ │ │ +68 template │ │ │ │ +_6_9 struct _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s │ │ │ │ +70 { │ │ │ │ +_7_1 _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s(std::shared_ptr matrix, const C& comm) │ │ │ │ +72 : _m_a_t_r_i_x__(matrix), _c_o_m_m__(comm) │ │ │ │ +73 {} │ │ │ │ +74 │ │ │ │ +_7_5 std::shared_ptr _m_a_t_r_i_x__; │ │ │ │ +_7_6 const C& _c_o_m_m__; │ │ │ │ +77 }; │ │ │ │ +78 │ │ │ │ +79#if HAVE_MPI │ │ │ │ +_8_0 struct _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ 81 { │ │ │ │ -82 return std::make_shared >(prec, │ │ │ │ -op->getCommunication()); │ │ │ │ -83 } │ │ │ │ -84 │ │ │ │ -85 template │ │ │ │ -86 std::shared_ptr │ │ │ │ -_8_7 _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(const std::shared_ptr& prec, │ │ │ │ -88 const std::shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_> >& op) │ │ │ │ -89 { │ │ │ │ -90 return std::make_shared │ │ │ │ ->(prec, op->getCommunication()); │ │ │ │ -91 } │ │ │ │ -92 │ │ │ │ -93 template │ │ │ │ -_9_4 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ -shared_ptr<_M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_> >&) │ │ │ │ -95 { │ │ │ │ -96 return std::make_shared>(); │ │ │ │ -97 } │ │ │ │ -98 template │ │ │ │ -_9_9 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ -shared_ptr<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_> >& op) │ │ │ │ -100 { │ │ │ │ -101 return createScalarProduct(op->getCommunication(), op->category()); │ │ │ │ -102 } │ │ │ │ -103 │ │ │ │ -104 template │ │ │ │ -_1_0_5 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const std:: │ │ │ │ -shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_> >& op) │ │ │ │ -106 { │ │ │ │ -107 return createScalarProduct(op->getCommunication(), op->category()); │ │ │ │ -108 } │ │ │ │ -109 │ │ │ │ -129 template │ │ │ │ -_1_3_0 class _S_o_l_v_e_r_F_a_c_t_o_r_y { │ │ │ │ -131 using Domain = typename Operator::domain_type; │ │ │ │ -132 using Range = typename Operator::range_type; │ │ │ │ -133 using _S_o_l_v_e_r = _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_>; │ │ │ │ -134 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r = _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>; │ │ │ │ -135 │ │ │ │ -136 template │ │ │ │ -137 using _matrix_type = typename O::matrix_type; │ │ │ │ -138 using matrix_type = Std::detected_or_t; │ │ │ │ -139 static constexpr bool isAssembled = !std::is_same::value; │ │ │ │ -140 │ │ │ │ -141 static const matrix_type* getmat(std::shared_ptr op){ │ │ │ │ -142 std::shared_ptr> aop │ │ │ │ -143 = std::dynamic_pointer_cast>(op); │ │ │ │ -144 if(aop) │ │ │ │ -145 return &aop->getmat(); │ │ │ │ -146 return nullptr; │ │ │ │ -147 } │ │ │ │ -148 │ │ │ │ -149 public: │ │ │ │ -150 │ │ │ │ -_1_5_3 static std::shared_ptr _g_e_t(std::shared_ptr op, │ │ │ │ -154 const ParameterTree& config, │ │ │ │ -155 std::shared_ptr prec = nullptr){ │ │ │ │ -156 std::string type = config.get("type"); │ │ │ │ -157 std::shared_ptr result; │ │ │ │ -158 const matrix_type* _m_a_t = getmat(op); │ │ │ │ -159 if(_m_a_t){ │ │ │ │ -160 if (_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_m_a_t_r_i_x___t_y_p_e_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().contains │ │ │ │ -(type)) { │ │ │ │ -161 if(op->category()!=_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l){ │ │ │ │ -162 DUNE_THROW(NotImplemented, "The solver factory does not support parallel │ │ │ │ -direct solvers!"); │ │ │ │ +_8_2 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s(MPI_Comm comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ +cat) │ │ │ │ +83 : _c_o_m_m__(comm), _c_a_t__(cat) │ │ │ │ +84 {} │ │ │ │ +85 │ │ │ │ +_8_6 MPI_Comm _c_o_m_m__; │ │ │ │ +_8_7 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t__; │ │ │ │ +88 }; │ │ │ │ +89#endif │ │ │ │ +90 │ │ │ │ +_9_1 struct _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +92 { │ │ │ │ +_9_3 _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s(Communication comm, [[maybe_unused]] int │ │ │ │ +cat) │ │ │ │ +94 : _c_o_m_m__(comm) │ │ │ │ +95 {} │ │ │ │ +96 │ │ │ │ +_9_7 Communication _c_o_m_m__; │ │ │ │ +98 }; │ │ │ │ +99 │ │ │ │ +100 } // end Amg namspace │ │ │ │ +101 │ │ │ │ +102 // forward declaration │ │ │ │ +103 template │ │ │ │ +104 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r; │ │ │ │ +105 │ │ │ │ +106 template │ │ │ │ +107 class _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r; │ │ │ │ +108 │ │ │ │ +109 namespace Amg │ │ │ │ +110 { │ │ │ │ +111 template │ │ │ │ +_1_1_2 struct ConstructionTraits<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r > │ │ │ │ +113 { │ │ │ │ +_1_1_4 typedef _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +115 │ │ │ │ +_1_1_6 static inline std::shared_ptr> │ │ │ │ +_c_o_n_s_t_r_u_c_t(const _A_r_g_u_m_e_n_t_s& args) │ │ │ │ +117 { │ │ │ │ +118 return std::make_shared> │ │ │ │ +119 (args._m_a_t_r_i_x__, args._c_o_m_m__); │ │ │ │ +120 } │ │ │ │ +121 }; │ │ │ │ +122 │ │ │ │ +123 template │ │ │ │ +_1_2_4 struct ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r > │ │ │ │ +125 { │ │ │ │ +_1_2_6 typedef _P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +127 │ │ │ │ +_1_2_8 static inline std::shared_ptr> │ │ │ │ +_c_o_n_s_t_r_u_c_t(const _A_r_g_u_m_e_n_t_s& args) │ │ │ │ +129 { │ │ │ │ +130 return std::make_shared> │ │ │ │ +131 (args._m_a_t_r_i_x__, args._c_o_m_m__); │ │ │ │ +132 } │ │ │ │ +133 }; │ │ │ │ +134 │ │ │ │ +135 template │ │ │ │ +_1_3_6 struct _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s │ │ │ │ +137 { │ │ │ │ +_1_3_8 _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s(std::shared_ptr matrix, const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n) │ │ │ │ +139 : _m_a_t_r_i_x__(matrix) │ │ │ │ +140 {} │ │ │ │ +141 │ │ │ │ +_1_4_2 std::shared_ptr _m_a_t_r_i_x__; │ │ │ │ +143 }; │ │ │ │ +144 │ │ │ │ +145 template │ │ │ │ +_1_4_6 struct ConstructionTraits<_M_a_t_r_i_x_A_d_a_p_t_e_r > │ │ │ │ +147 { │ │ │ │ +_1_4_8 typedef const _M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s_<_M_,_X_,_Y_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +149 │ │ │ │ +_1_5_0 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& │ │ │ │ +args) │ │ │ │ +151 { │ │ │ │ +152 return std::make_shared>(args._m_a_t_r_i_x__); │ │ │ │ +153 } │ │ │ │ +154 }; │ │ │ │ +155 │ │ │ │ +156 template<> │ │ │ │ +_1_5_7 struct ConstructionTraits<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ +158 { │ │ │ │ +_1_5_9 typedef const _S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s _A_r_g_u_m_e_n_t_s; │ │ │ │ +_1_6_0 static inline std::shared_ptr _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& │ │ │ │ +args) │ │ │ │ +161 { │ │ │ │ +162 return std::make_shared(args._c_o_m_m__); │ │ │ │ 163 } │ │ │ │ -164 result = _D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y_<_m_a_t_r_i_x___t_y_p_e_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ -(type, *_m_a_t, config); │ │ │ │ -165 return result; │ │ │ │ -166 } │ │ │ │ -167 } │ │ │ │ -168 // if no direct solver is found it might be an iterative solver │ │ │ │ -169 if (!_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().contains(type)) { │ │ │ │ -170 DUNE_THROW(Dune::InvalidStateException, "Solver not found in the │ │ │ │ -factory."); │ │ │ │ -171 } │ │ │ │ -172 if(!prec){ │ │ │ │ -173 const ParameterTree& precConfig = config.sub("preconditioner"); │ │ │ │ -174 std::string prec_type = precConfig.get("type"); │ │ │ │ -175 prec = _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ -(prec_type, op, precConfig); │ │ │ │ -176 if (prec->category() != op->category() && prec->category() == │ │ │ │ -_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l) │ │ │ │ -177 // try to wrap to a parallel preconditioner │ │ │ │ -178 prec = _w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l(prec, op); │ │ │ │ -179 } │ │ │ │ -180 std::shared_ptr> sp = _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(op); │ │ │ │ -181 result = _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y_<_D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create(type, op, │ │ │ │ -sp, prec, config); │ │ │ │ -182 return result; │ │ │ │ -183 } │ │ │ │ -184 │ │ │ │ -_1_8_8 static std::shared_ptr _g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r(std:: │ │ │ │ -shared_ptr op, │ │ │ │ -189 const ParameterTree& config){ │ │ │ │ -190 const matrix_type* _m_a_t = getmat(op); │ │ │ │ -191 if(_m_a_t){ │ │ │ │ -192 std::string prec_type = config.get("type"); │ │ │ │ -193 return _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_,_ _D_o_m_a_i_n_,_ _R_a_n_g_e_>_:_:_i_n_s_t_a_n_c_e().create │ │ │ │ -(prec_type, op, config); │ │ │ │ -194 }else{ │ │ │ │ -195 DUNE_THROW(InvalidStateException, "Could not obtain matrix from operator. │ │ │ │ -Please pass in an AssembledLinearOperator."); │ │ │ │ -196 } │ │ │ │ -197 } │ │ │ │ -198 }; │ │ │ │ -199 │ │ │ │ -210 template │ │ │ │ -211 std::shared_ptr> _g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y(std:: │ │ │ │ -shared_ptr op, │ │ │ │ -213 const ParameterTree& config, │ │ │ │ -214 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r> prec = nullptr){ │ │ │ │ -216 return _S_o_l_v_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_>_:_:_g_e_t(op, config, prec); │ │ │ │ -217 } │ │ │ │ -218 │ │ │ │ -222} // end namespace Dune │ │ │ │ -223 │ │ │ │ -224 │ │ │ │ -225#endif │ │ │ │ -_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ -_s_c_h_w_a_r_z_._h_h │ │ │ │ -_n_o_v_l_p_s_c_h_w_a_r_z_._h_h │ │ │ │ -_m_a_t │ │ │ │ -Matrix & mat │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y │ │ │ │ -Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > > │ │ │ │ -PreconditionerFactory │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:36 │ │ │ │ -_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ -Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > > │ │ │ │ -DirectSolverFactory │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:30 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ -std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< │ │ │ │ -LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, │ │ │ │ -const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &) │ │ │ │ -IterativeSolverSignature │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:40 │ │ │ │ -_D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l │ │ │ │ -std::shared_ptr< Preconditioner > wrapPreconditioner4Parallel(const std:: │ │ │ │ -shared_ptr< Preconditioner > &prec, const O &) │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:71 │ │ │ │ -_D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ -std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &) │ │ │ │ -DirectSolverSignature │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:28 │ │ │ │ -_D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y │ │ │ │ -std::shared_ptr< InverseOperator< typename Operator::domain_type, typename │ │ │ │ -Operator::range_type > > getSolverFromFactory(std::shared_ptr< Operator > op, │ │ │ │ -const ParameterTree &config, std::shared_ptr< Preconditioner< typename │ │ │ │ -Operator::domain_type, typename Operator::range_type > > prec=nullptr) │ │ │ │ -Instantiates an InverseOperator from an Operator and a configuration given as a │ │ │ │ -ParameterTree. │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:212 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ -Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > > │ │ │ │ -IterativeSolverFactory │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:42 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ -std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const │ │ │ │ -ParameterTree &) PreconditionerSignature │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:34 │ │ │ │ +164 }; │ │ │ │ +165 │ │ │ │ +166 │ │ │ │ +167#if HAVE_MPI │ │ │ │ +168 │ │ │ │ +169 template │ │ │ │ +_1_7_0 struct ConstructionTraits<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n > │ │ │ │ +171 { │ │ │ │ +_1_7_2 typedef const _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s _A_r_g_u_m_e_n_t_s; │ │ │ │ +173 │ │ │ │ +_1_7_4 static inline std::shared_ptr> │ │ │ │ +_c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +175 { │ │ │ │ +176 return std::make_shared>(args._c_o_m_m__, │ │ │ │ +args._c_a_t__); │ │ │ │ +177 } │ │ │ │ +178 }; │ │ │ │ +179 │ │ │ │ +180#endif │ │ │ │ +181 │ │ │ │ +183 } // namespace Amg │ │ │ │ +184} // namespace Dune │ │ │ │ +185#endif │ │ │ │ +_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ +_p_i_n_f_o_._h_h │ │ │ │ +_b_v_e_c_t_o_r_._h_h │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ +space. The number of compon... │ │ │ │ +_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ +_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ +Define general, extensible interface for operators. The available │ │ │ │ +implementation wraps a matrix. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const int Arguments │ │ │ │ +DDeeffiinniittiioonn construction.hh:61 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +SequentialCommunicationArgs(Communication< void * > comm, int cat) │ │ │ │ +DDeeffiinniittiioonn construction.hh:93 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +OwnerOverlapCopyCommunicationArgs(MPI_Comm comm, SolverCategory::Category cat) │ │ │ │ +DDeeffiinniittiioonn construction.hh:82 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ +MPI_Comm comm_ │ │ │ │ +DDeeffiinniittiioonn construction.hh:86 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_a_t__ │ │ │ │ +SolverCategory::Category cat_ │ │ │ │ +DDeeffiinniittiioonn construction.hh:87 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ +const C & comm_ │ │ │ │ +DDeeffiinniittiioonn construction.hh:76 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s │ │ │ │ +ParallelOperatorArgs(std::shared_ptr< M > matrix, const C &comm) │ │ │ │ +DDeeffiinniittiioonn construction.hh:71 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s_:_:_m_a_t_r_i_x__ │ │ │ │ +std::shared_ptr< M > matrix_ │ │ │ │ +DDeeffiinniittiioonn construction.hh:75 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const void * Arguments │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s_:_:_c_o_m_m__ │ │ │ │ +Communication< void * > comm_ │ │ │ │ +DDeeffiinniittiioonn construction.hh:97 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< BlockVector< T, A > > construct(Arguments &n) │ │ │ │ +DDeeffiinniittiioonn construction.hh:62 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, │ │ │ │ -SolverCategory::Category category) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:242 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +A vector of blocks with memory management. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ _D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ A nonoverlapping operator with communication object. │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:61 │ │ │ │ _D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ Adapter to turn a matrix into a linear operator. │ │ │ │ DDeeffiinniittiioonn operators.hh:136 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ +owner/overlap/copy sema... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_O_p_e_r_a_t_o_r_A_r_g_s │ │ │ │ +DDeeffiinniittiioonn construction.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +DDeeffiinniittiioonn construction.hh:81 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_C_o_m_m_u_n_i_c_a_t_i_o_n_A_r_g_s │ │ │ │ +DDeeffiinniittiioonn construction.hh:92 │ │ │ │ _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ An overlapping Schwarz operator. │ │ │ │ DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _D_o_m_a_i_n_,_ _R_a_n_g_e_ _> │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ -Factory to assembly solvers configured by a ParameterTree. │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:130 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_:_:_g_e_t │ │ │ │ -static std::shared_ptr< Solver > get(std::shared_ptr< Operator > op, const │ │ │ │ -ParameterTree &config, std::shared_ptr< Preconditioner > prec=nullptr) │ │ │ │ -get a solver from the factory │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:153 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_:_:_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -static std::shared_ptr< Preconditioner > getPreconditioner(std::shared_ptr< │ │ │ │ -Operator > op, const ParameterTree &config) │ │ │ │ -Construct a Preconditioner for a given Operator. │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:188 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_,_ _C_ _>_ _>_:_: │ │ │ │ +_A_r_g_u_m_e_n_t_s │ │ │ │ +ParallelOperatorArgs< M, C > Arguments │ │ │ │ +DDeeffiinniittiioonn construction.hh:114 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_,_ _C_ _>_ _>_:_: │ │ │ │ +_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > construct │ │ │ │ +(const Arguments &args) │ │ │ │ +DDeeffiinniittiioonn construction.hh:116 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_,_ _C_ _>_ _>_:_: │ │ │ │ +_A_r_g_u_m_e_n_t_s │ │ │ │ +ParallelOperatorArgs< M, C > Arguments │ │ │ │ +DDeeffiinniittiioonn construction.hh:126 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_,_ _C_ _>_ _>_:_: │ │ │ │ +_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > construct │ │ │ │ +(const Arguments &args) │ │ │ │ +DDeeffiinniittiioonn construction.hh:128 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s │ │ │ │ +DDeeffiinniittiioonn construction.hh:137 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s │ │ │ │ +MatrixAdapterArgs(std::shared_ptr< M > matrix, const SequentialInformation) │ │ │ │ +DDeeffiinniittiioonn construction.hh:138 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r_A_r_g_s_:_:_m_a_t_r_i_x__ │ │ │ │ +std::shared_ptr< M > matrix_ │ │ │ │ +DDeeffiinniittiioonn construction.hh:142 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _M_a_t_r_i_x_A_d_a_p_t_e_r_<_ _M_,_ _X_,_ _Y_ _>_ _>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< MatrixAdapter< M, X, Y > > construct(Arguments &args) │ │ │ │ +DDeeffiinniittiioonn construction.hh:150 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _M_a_t_r_i_x_A_d_a_p_t_e_r_<_ _M_,_ _X_,_ _Y_ _>_ _>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const MatrixAdapterArgs< M, X, Y > Arguments │ │ │ │ +DDeeffiinniittiioonn construction.hh:148 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const SequentialCommunicationArgs Arguments │ │ │ │ +DDeeffiinniittiioonn construction.hh:159 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< SequentialInformation > construct(Arguments &args) │ │ │ │ +DDeeffiinniittiioonn construction.hh:160 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_: │ │ │ │ +_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< OwnerOverlapCopyCommunication< T1, T2 > > construct │ │ │ │ +(Arguments &args) │ │ │ │ +DDeeffiinniittiioonn construction.hh:174 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_: │ │ │ │ +_A_r_g_u_m_e_n_t_s │ │ │ │ +const OwnerOverlapCopyCommunicationArgs Arguments │ │ │ │ +DDeeffiinniittiioonn construction.hh:172 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ +Category │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvercategory.hh File Reference │ │ │ +dune-istl: galerkin.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,41 +65,74 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
solvercategory.hh File Reference
│ │ │ + │ │ │
│ │ │
│ │ │ -
#include <dune/common/exceptions.hh>
│ │ │ + │ │ │ +

Provides a class for building the galerkin product based on a aggregation scheme. │ │ │ +More...

│ │ │ +
#include "aggregates.hh"
│ │ │ +#include "pinfo.hh"
│ │ │ +#include <dune/common/poolallocator.hh>
│ │ │ +#include <dune/common/enumset.hh>
│ │ │ +#include <set>
│ │ │ +#include <limits>
│ │ │ +#include <algorithm>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::SolverCategory
 Categories for the solvers. More...
struct  Dune::Amg::OverlapVertex< T >
 
class  Dune::Amg::SparsityBuilder< M >
 Functor for building the sparsity pattern of the matrix using examineConnectivity. More...
 
class  Dune::Amg::BaseGalerkinProduct
 
class  Dune::Amg::GalerkinProduct< T >
 
class  Dune::Amg::GalerkinProduct< SequentialInformation >
 
struct  Dune::Amg::BaseConnectivityConstructor
 
class  Dune::InvalidSolverCategory
class  Dune::Amg::BaseConnectivityConstructor::ConnectedBuilder< G, S, V >
 Visitor for identifying connected aggregates during a breadthFirstSearch. More...
 
struct  Dune::Amg::ConnectivityConstructor< G, T >
 
struct  Dune::Amg::ConnectivityConstructor< G, SequentialInformation >
 
struct  Dune::Amg::DirichletBoundarySetter< T >
 
struct  Dune::Amg::DirichletBoundarySetter< SequentialInformation >
 
│ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ + │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Provides a class for building the galerkin product based on a aggregation scheme.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,21 +1,60 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ + * _p_a_a_m_g │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -solvercategory.hh File Reference │ │ │ │ -#include │ │ │ │ +galerkin.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Provides a class for building the galerkin product based on a aggregation │ │ │ │ +scheme. _M_o_r_e_._._. │ │ │ │ +#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +#include "_p_i_n_f_o_._h_h" │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ -  Categories for the solvers. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x_<_ _T_ _> │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_ _M_ _> │ │ │ │ +  Functor for building the sparsity pattern of the matrix using │ │ │ │ + examineConnectivity. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_ _T_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_ _G_,_ _S_,_ _V_ _> │ │ │ │ +  Visitor for identifying connected aggregates during a │ │ │ │ + breadthFirstSearch. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_ _G_,_ _T_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_ _G_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r_<_ _T_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +  │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Provides a class for building the galerkin product based on a aggregation │ │ │ │ +scheme. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solvercategory.hh Source File │ │ │ +dune-istl: galerkin.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,81 +70,742 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
solvercategory.hh
│ │ │ +
galerkin.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SOLVERCATEGORY_HH
│ │ │ -
6#define DUNE_ISTL_SOLVERCATEGORY_HH
│ │ │ +
5#ifndef DUNE_GALERKIN_HH
│ │ │ +
6#define DUNE_GALERKIN_HH
│ │ │
7
│ │ │ -
8#include <dune/common/exceptions.hh>
│ │ │ -
9
│ │ │ -
10
│ │ │ -
11namespace Dune {
│ │ │ -
12
│ │ │ -
│ │ │ - │ │ │ -
22 {
│ │ │ -
│ │ │ -
23 enum Category {
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
30 };
│ │ │ -
│ │ │ -
31
│ │ │ -
33 template<typename OP>
│ │ │ -
│ │ │ -
34 static Category category(const OP& op, decltype(op.category())* = nullptr)
│ │ │ -
35 {
│ │ │ -
36 return op.category();
│ │ │ -
37 }
│ │ │ -
│ │ │ +
8#include "aggregates.hh"
│ │ │ +
9#include "pinfo.hh"
│ │ │ +
10#include <dune/common/poolallocator.hh>
│ │ │ +
11#include <dune/common/enumset.hh>
│ │ │ +
12#include <set>
│ │ │ +
13#include <limits>
│ │ │ +
14#include <algorithm>
│ │ │ +
15
│ │ │ +
16namespace Dune
│ │ │ +
17{
│ │ │ +
18 namespace Amg
│ │ │ +
19 {
│ │ │ +
31 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
33 {
│ │ │ +
37 typedef T Aggregate;
│ │ │
38
│ │ │ -
39#ifndef DOXYGEN
│ │ │ -
40 // template<typename OP>
│ │ │ -
41 // static Category category(const OP& op, decltype(op.getSolverCategory())* = nullptr)
│ │ │ -
42 // {
│ │ │ -
43 // return op.getSolverCategory();
│ │ │ -
44 // }
│ │ │ -
45
│ │ │ -
46 template<typename OP>
│ │ │ -
47 static Category category(const OP& op, decltype(op.category)* = nullptr)
│ │ │ -
48 {
│ │ │ -
49 return OP::category;
│ │ │ -
50 }
│ │ │ -
51#endif
│ │ │ -
52 };
│ │ │ +
42 typedef T Vertex;
│ │ │ +
43
│ │ │ + │ │ │ +
48
│ │ │ + │ │ │ +
53 };
│ │ │
│ │ │ -
53
│ │ │ -
54 class InvalidSolverCategory : public InvalidStateException{};
│ │ │ +
54
│ │ │
55
│ │ │ -
58} // end namespace
│ │ │ -
59
│ │ │ -
60#endif
│ │ │ +
56
│ │ │ +
61 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
63 {
│ │ │ +
64 public:
│ │ │ +
70 SparsityBuilder(M& matrix);
│ │ │ +
71
│ │ │ +
72 void insert(const typename M::size_type& index);
│ │ │ +
73
│ │ │ +
74 void operator++();
│ │ │ +
75
│ │ │ +
76 std::size_t minRowSize();
│ │ │ +
77
│ │ │ +
78 std::size_t maxRowSize();
│ │ │ +
79
│ │ │ +
80 std::size_t sumRowSize();
│ │ │ +
│ │ │ +
81 std::size_t index()
│ │ │ +
82 {
│ │ │ +
83 return row_.index();
│ │ │ +
84 }
│ │ │ +
│ │ │ +
85 private:
│ │ │ +
87 typename M::CreateIterator row_;
│ │ │ +
89 std::size_t minRowSize_;
│ │ │ +
91 std::size_t maxRowSize_;
│ │ │ +
92 std::size_t sumRowSize_;
│ │ │ +
93#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
94 bool diagonalInserted;
│ │ │ +
95#endif
│ │ │ +
96 };
│ │ │ +
│ │ │ +
97
│ │ │ +
│ │ │ + │ │ │ +
99 {
│ │ │ +
100 public:
│ │ │ +
109 template<class M, class V, class I, class O>
│ │ │ +
110 void calculate(const M& fine, const AggregatesMap<V>& aggregates, M& coarse,
│ │ │ +
111 const I& pinfo, const O& copy);
│ │ │ +
112
│ │ │ +
113 };
│ │ │ +
│ │ │ +
114
│ │ │ +
115 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
117 : public BaseGalerkinProduct
│ │ │ +
118 {
│ │ │ +
119 public:
│ │ │ + │ │ │ +
121
│ │ │ +
131 template<class G, class V, class Set>
│ │ │ +
132 typename G::MutableMatrix* build(G& fineGraph, V& visitedMap,
│ │ │ +
133 const ParallelInformation& pinfo,
│ │ │ + │ │ │ +
135 const typename G::Matrix::size_type& size,
│ │ │ +
136 const Set& copy);
│ │ │ +
137 private:
│ │ │ +
138
│ │ │ +
145 template<class G, class I, class Set>
│ │ │ + │ │ │ +
147 buildOverlapVertices(const G& graph, const I& pinfo,
│ │ │ + │ │ │ +
149 const Set& overlap,
│ │ │ +
150 std::size_t& overlapCount);
│ │ │ +
151
│ │ │ +
152 template<class A>
│ │ │ +
153 struct OVLess
│ │ │ +
154 {
│ │ │ +
│ │ │ + │ │ │ +
156 {
│ │ │ +
157 return *o1.aggregate < *o2.aggregate;
│ │ │ +
158 }
│ │ │ +
│ │ │ +
159 };
│ │ │ +
160 };
│ │ │ +
│ │ │ +
161
│ │ │ +
162 template<>
│ │ │ +
│ │ │ + │ │ │ +
164 : public BaseGalerkinProduct
│ │ │ +
165 {
│ │ │ +
166 public:
│ │ │ +
176 template<class G, class V, class Set>
│ │ │ +
177 typename G::MutableMatrix* build(G& fineGraph, V& visitedMap,
│ │ │ +
178 const SequentialInformation& pinfo,
│ │ │ + │ │ │ +
180 const typename G::Matrix::size_type& size,
│ │ │ +
181 const Set& copy);
│ │ │ +
182 };
│ │ │ +
│ │ │ +
183
│ │ │ +
│ │ │ + │ │ │ +
185 {
│ │ │ +
186 template<class R, class G, class V>
│ │ │ +
187 static void constructOverlapConnectivity(R& row, G& graph, V& visitedMap,
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
191
│ │ │ +
195 template<class R, class G, class V>
│ │ │ +
196 static void constructNonOverlapConnectivity(R& row, G& graph, V& visitedMap,
│ │ │ + │ │ │ +
198 const typename G::VertexDescriptor& seed);
│ │ │ +
199
│ │ │ +
200
│ │ │ +
204 template<class G, class S, class V>
│ │ │ +
│ │ │ + │ │ │ +
206 {
│ │ │ +
207 public:
│ │ │ +
211 typedef G Graph;
│ │ │ +
215 typedef typename Graph::ConstEdgeIterator ConstEdgeIterator;
│ │ │ +
216
│ │ │ +
220 typedef S Set;
│ │ │ +
221
│ │ │ +
225 typedef V VisitedMap;
│ │ │ +
226
│ │ │ +
230 typedef typename Graph::VertexDescriptor Vertex;
│ │ │ +
231
│ │ │ +
239 ConnectedBuilder(const AggregatesMap<Vertex>& aggregates, Graph& graph,
│ │ │ +
240 VisitedMap& visitedMap, Set& connected);
│ │ │ +
241
│ │ │ +
246 void operator()(const ConstEdgeIterator& edge);
│ │ │ +
247
│ │ │ +
248 private:
│ │ │ +
252 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
253
│ │ │ +
254 Graph& graph_;
│ │ │ +
255
│ │ │ +
259 VisitedMap& visitedMap_;
│ │ │ +
260
│ │ │ +
264 Set& connected_;
│ │ │ +
265 };
│ │ │ +
│ │ │ +
266
│ │ │ +
267 };
│ │ │ +
│ │ │ +
268
│ │ │ +
269 template<class G, class T>
│ │ │ +
│ │ │ + │ │ │ +
271 {
│ │ │ +
272 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
273
│ │ │ +
274 template<class V, class O, class R>
│ │ │ +
275 static void examine(G& graph,
│ │ │ +
276 V& visitedMap,
│ │ │ +
277 const T& pinfo,
│ │ │ +
278 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
279 const O& overlap,
│ │ │ +
280 const OverlapVertex<Vertex>* overlapVertices,
│ │ │ +
281 const OverlapVertex<Vertex>* overlapEnd,
│ │ │ +
282 R& row);
│ │ │ +
283 };
│ │ │ +
│ │ │ +
284
│ │ │ +
285 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
287 {
│ │ │ +
288 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
289
│ │ │ +
290 template<class V, class R>
│ │ │ +
291 static void examine(G& graph,
│ │ │ +
292 V& visitedMap,
│ │ │ +
293 const SequentialInformation& pinfo,
│ │ │ +
294 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
295 R& row);
│ │ │ +
296 };
│ │ │ +
│ │ │ +
297
│ │ │ +
298 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
300 {
│ │ │ +
301 template<class M, class O>
│ │ │ +
302 static void set(M& coarse, const T& pinfo, const O& copy);
│ │ │ +
303 };
│ │ │ +
│ │ │ +
304
│ │ │ +
305 template<>
│ │ │ +
│ │ │ + │ │ │ +
307 {
│ │ │ +
308 template<class M, class O>
│ │ │ +
309 static void set(M& coarse, const SequentialInformation& pinfo, const O& copy);
│ │ │ +
310 };
│ │ │ +
│ │ │ +
311
│ │ │ +
312 template<class R, class G, class V>
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
315 const typename G::VertexDescriptor& seed)
│ │ │ +
316 {
│ │ │ +
317 assert(row.index()==aggregates[seed]);
│ │ │ +
318 row.insert(aggregates[seed]);
│ │ │ +
319 ConnectedBuilder<G,R,V> conBuilder(aggregates, graph, visitedMap, row);
│ │ │ +
320 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
321 typedef std::allocator<Vertex> Allocator;
│ │ │ +
322 typedef SLList<Vertex,Allocator> VertexList;
│ │ │ +
323 typedef typename AggregatesMap<Vertex>::DummyEdgeVisitor DummyVisitor;
│ │ │ +
324 VertexList vlist;
│ │ │ +
325 DummyVisitor dummy;
│ │ │ +
326 aggregates.template breadthFirstSearch<true,false>(seed,aggregates[seed], graph, vlist, dummy,
│ │ │ +
327 conBuilder, visitedMap);
│ │ │ +
328 }
│ │ │ +
│ │ │ +
329
│ │ │ +
330 template<class R, class G, class V>
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
335 {
│ │ │ +
336 ConnectedBuilder<G,R,V> conBuilder(aggregates, graph, visitedMap, row);
│ │ │ +
337 const typename G::VertexDescriptor aggregate=*seed->aggregate;
│ │ │ +
338
│ │ │ +
339 if (row.index()==*seed->aggregate) {
│ │ │ +
340 while(seed != overlapEnd && aggregate == *seed->aggregate) {
│ │ │ +
341 row.insert(*seed->aggregate);
│ │ │ +
342 // Walk over all neighbours and add them to the connected array.
│ │ │ +
343 visitNeighbours(graph, seed->vertex, conBuilder);
│ │ │ +
344 // Mark vertex as visited
│ │ │ +
345 put(visitedMap, seed->vertex, true);
│ │ │ +
346 ++seed;
│ │ │ +
347 }
│ │ │ +
348 }
│ │ │ +
349 }
│ │ │ +
│ │ │ +
350
│ │ │ +
351 template<class G, class S, class V>
│ │ │ +
│ │ │ + │ │ │ +
353 Graph& graph, VisitedMap& visitedMap,
│ │ │ +
354 Set& connected)
│ │ │ +
355 : aggregates_(aggregates), graph_(graph), visitedMap_(visitedMap), connected_(connected)
│ │ │ +
356 {}
│ │ │ +
│ │ │ +
357
│ │ │ +
358 template<class G, class S, class V>
│ │ │ +
│ │ │ + │ │ │ +
360 {
│ │ │ +
361 const Vertex& vertex = aggregates_[edge.target()];
│ │ │ + │ │ │ + │ │ │ +
364 connected_.insert(vertex);
│ │ │ +
365 }
│ │ │ +
│ │ │ +
366
│ │ │ +
367 template<class T>
│ │ │ +
368 template<class G, class I, class Set>
│ │ │ + │ │ │ +
370 GalerkinProduct<T>::buildOverlapVertices(const G& graph, const I& pinfo,
│ │ │ + │ │ │ +
372 const Set& overlap,
│ │ │ +
373 std::size_t& overlapCount)
│ │ │ +
374 {
│ │ │ +
375 // count the overlap vertices.
│ │ │ +
376 typedef typename G::ConstVertexIterator ConstIterator;
│ │ │ +
377 typedef typename I::GlobalLookupIndexSet GlobalLookup;
│ │ │ +
378 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ +
379
│ │ │ +
380 const ConstIterator end = graph.end();
│ │ │ +
381 overlapCount = 0;
│ │ │ +
382
│ │ │ +
383 const GlobalLookup& lookup=pinfo.globalLookup();
│ │ │ +
384
│ │ │ +
385 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) {
│ │ │ +
386 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ +
387
│ │ │ +
388 if(pair!=0 && overlap.contains(pair->local().attribute()))
│ │ │ +
389 ++overlapCount;
│ │ │ +
390 }
│ │ │ +
391 // Allocate space
│ │ │ +
392 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
393
│ │ │ +
394 OverlapVertex<Vertex>* overlapVertices = new OverlapVertex<Vertex>[overlapCount=0 ? 1 : overlapCount];
│ │ │ +
395 if(overlapCount==0)
│ │ │ +
396 return overlapVertices;
│ │ │ +
397
│ │ │ +
398 // Initialize them
│ │ │ +
399 overlapCount=0;
│ │ │ +
400 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) {
│ │ │ +
401 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ +
402
│ │ │ +
403 if(pair!=0 && overlap.contains(pair->local().attribute())) {
│ │ │ +
404 overlapVertices[overlapCount].aggregate = &aggregates[pair->local()];
│ │ │ +
405 overlapVertices[overlapCount].vertex = pair->local();
│ │ │ +
406 ++overlapCount;
│ │ │ +
407 }
│ │ │ +
408 }
│ │ │ +
409
│ │ │ +
410 dverb << overlapCount<<" overlap vertices"<<std::endl;
│ │ │ +
411
│ │ │ +
412 std::sort(overlapVertices, overlapVertices+overlapCount, OVLess<Vertex>());
│ │ │ +
413 // due to the sorting the isolated aggregates (to be skipped) are at the end.
│ │ │ +
414
│ │ │ +
415 return overlapVertices;
│ │ │ +
416 }
│ │ │ +
417
│ │ │ +
418 template<class G, class T>
│ │ │ +
419 template<class V, class O, class R>
│ │ │ +
│ │ │ + │ │ │ +
421 V& visitedMap,
│ │ │ +
422 const T& pinfo,
│ │ │ +
423 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
424 const O& overlap,
│ │ │ +
425 const OverlapVertex<Vertex>* overlapVertices,
│ │ │ +
426 const OverlapVertex<Vertex>* overlapEnd,
│ │ │ +
427 R& row)
│ │ │ +
428 {
│ │ │ +
429 typedef typename T::GlobalLookupIndexSet GlobalLookup;
│ │ │ +
430 const GlobalLookup& lookup = pinfo.globalLookup();
│ │ │ +
431
│ │ │ +
432 typedef typename G::VertexIterator VertexIterator;
│ │ │ +
433
│ │ │ +
434 VertexIterator vend=graph.end();
│ │ │ +
435
│ │ │ +
436#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
437 std::set<Vertex> examined;
│ │ │ +
438#endif
│ │ │ +
439
│ │ │ +
440 // The aggregates owned by the process have lower local indices
│ │ │ +
441 // then those not owned. We process them in the first pass.
│ │ │ +
442 // They represent the rows 0, 1, ..., n of the coarse matrix
│ │ │ +
443 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex)
│ │ │ +
444 if(!get(visitedMap, *vertex)) {
│ │ │ +
445 // In the first pass we only process owner nodes
│ │ │ +
446 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ +
447 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ +
448 if(pair==0 || !overlap.contains(pair->local().attribute())) {
│ │ │ +
449#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
450 assert(examined.find(aggregates[*vertex])==examined.end());
│ │ │ +
451 examined.insert(aggregates[*vertex]);
│ │ │ +
452#endif
│ │ │ +
453 constructNonOverlapConnectivity(row, graph, visitedMap, aggregates, *vertex);
│ │ │ +
454
│ │ │ +
455 // only needed for ALU
│ │ │ +
456 // (ghosts with same global id as owners on the same process)
│ │ │ +
457 if (SolverCategory::category(pinfo) == static_cast<int>(SolverCategory::nonoverlapping)) {
│ │ │ +
458 if(overlapVertices != overlapEnd) {
│ │ │ +
459 if(*overlapVertices->aggregate!=AggregatesMap<Vertex>::ISOLATED) {
│ │ │ +
460 constructOverlapConnectivity(row, graph, visitedMap, aggregates, overlapVertices, overlapEnd);
│ │ │ +
461 }
│ │ │ +
462 else{
│ │ │ +
463 ++overlapVertices;
│ │ │ +
464 }
│ │ │ +
465 }
│ │ │ +
466 }
│ │ │ +
467 ++row;
│ │ │ +
468 }
│ │ │ +
469 }
│ │ │ +
470
│ │ │ +
471 dvverb<<"constructed "<<row.index()<<" non-overlapping rows"<<std::endl;
│ │ │ +
472
│ │ │ +
473 // Now come the aggregates not owned by use.
│ │ │ +
474 // They represent the rows n+1, ..., N
│ │ │ +
475 while(overlapVertices != overlapEnd)
│ │ │ +
476 if(*overlapVertices->aggregate!=AggregatesMap<Vertex>::ISOLATED) {
│ │ │ +
477
│ │ │ +
478#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
479 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ +
480 const IndexPair* pair = lookup.pair(overlapVertices->vertex);
│ │ │ +
481 assert(pair!=0 && overlap.contains(pair->local().attribute()));
│ │ │ +
482 assert(examined.find(aggregates[overlapVertices->vertex])==examined.end());
│ │ │ +
483 examined.insert(aggregates[overlapVertices->vertex]);
│ │ │ +
484#endif
│ │ │ +
485 constructOverlapConnectivity(row, graph, visitedMap, aggregates, overlapVertices, overlapEnd);
│ │ │ +
486 ++row;
│ │ │ +
487 }else{
│ │ │ +
488 ++overlapVertices;
│ │ │ +
489 }
│ │ │ +
490 }
│ │ │ +
│ │ │ +
491
│ │ │ +
492 template<class G>
│ │ │ +
493 template<class V, class R>
│ │ │ +
│ │ │ + │ │ │ +
495 V& visitedMap,
│ │ │ +
496 [[maybe_unused]] const SequentialInformation& pinfo,
│ │ │ +
497 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
498 R& row)
│ │ │ +
499 {
│ │ │ +
500 typedef typename G::VertexIterator VertexIterator;
│ │ │ +
501
│ │ │ +
502 VertexIterator vend=graph.end();
│ │ │ +
503 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ +
504 if(!get(visitedMap, *vertex)) {
│ │ │ +
505 constructNonOverlapConnectivity(row, graph, visitedMap, aggregates, *vertex);
│ │ │ +
506 ++row;
│ │ │ +
507 }
│ │ │ +
508 }
│ │ │ +
509
│ │ │ +
510 }
│ │ │ +
│ │ │ +
511
│ │ │ +
512 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
514 : row_(matrix.createbegin()),
│ │ │ +
515 minRowSize_(std::numeric_limits<std::size_t>::max()),
│ │ │ +
516 maxRowSize_(0), sumRowSize_(0)
│ │ │ +
517 {
│ │ │ +
518#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
519 diagonalInserted = false;
│ │ │ +
520#endif
│ │ │ +
521 }
│ │ │ +
│ │ │ +
522 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
524 {
│ │ │ +
525 return maxRowSize_;
│ │ │ +
526 }
│ │ │ +
│ │ │ +
527 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
529 {
│ │ │ +
530 return minRowSize_;
│ │ │ +
531 }
│ │ │ +
│ │ │ +
532
│ │ │ +
533 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
535 {
│ │ │ +
536 return sumRowSize_;
│ │ │ +
537 }
│ │ │ +
│ │ │ +
538 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
540 {
│ │ │ +
541 sumRowSize_ += row_.size();
│ │ │ +
542 minRowSize_=std::min(minRowSize_, row_.size());
│ │ │ +
543 maxRowSize_=std::max(maxRowSize_, row_.size());
│ │ │ +
544 ++row_;
│ │ │ +
545#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
546 assert(diagonalInserted);
│ │ │ +
547 diagonalInserted = false;
│ │ │ +
548#endif
│ │ │ +
549 }
│ │ │ +
│ │ │ +
550
│ │ │ +
551 template<class M>
│ │ │ +
│ │ │ +
552 void SparsityBuilder<M>::insert(const typename M::size_type& index)
│ │ │ +
553 {
│ │ │ +
554 row_.insert(index);
│ │ │ +
555#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
556 diagonalInserted = diagonalInserted || row_.index()==index;
│ │ │ +
557#endif
│ │ │ +
558 }
│ │ │ +
│ │ │ +
559
│ │ │ +
560 template<class T>
│ │ │ +
561 template<class G, class V, class Set>
│ │ │ +
562 typename G::MutableMatrix*
│ │ │ +
│ │ │ +
563 GalerkinProduct<T>::build(G& fineGraph, V& visitedMap,
│ │ │ +
564 const ParallelInformation& pinfo,
│ │ │ + │ │ │ +
566 const typename G::Matrix::size_type& size,
│ │ │ +
567 const Set& overlap)
│ │ │ +
568 {
│ │ │ + │ │ │ +
570
│ │ │ +
571 std::size_t count;
│ │ │ +
572
│ │ │ +
573 const OverlapVertex* overlapVertices = buildOverlapVertices(fineGraph,
│ │ │ +
574 pinfo,
│ │ │ +
575 aggregates,
│ │ │ +
576 overlap,
│ │ │ +
577 count);
│ │ │ +
578 typedef typename G::MutableMatrix M;
│ │ │ +
579 M* coarseMatrix = new M(size, size, M::row_wise);
│ │ │ +
580
│ │ │ +
581 // Reset the visited flags of all vertices.
│ │ │ +
582 // As the isolated nodes will be skipped we simply mark them as visited
│ │ │ +
583
│ │ │ +
584 typedef typename G::VertexIterator Vertex;
│ │ │ +
585 Vertex vend = fineGraph.end();
│ │ │ +
586 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) {
│ │ │ + │ │ │ +
588 put(visitedMap, *vertex, aggregates[*vertex]==AggregatesMap<typename G::VertexDescriptor>::ISOLATED);
│ │ │ +
589 }
│ │ │ +
590
│ │ │ +
591 typedef typename G::MutableMatrix M;
│ │ │ +
592 SparsityBuilder<M> sparsityBuilder(*coarseMatrix);
│ │ │ +
593
│ │ │ +
594 ConnectivityConstructor<G,T>::examine(fineGraph, visitedMap, pinfo,
│ │ │ +
595 aggregates, overlap,
│ │ │ +
596 overlapVertices,
│ │ │ +
597 overlapVertices+count,
│ │ │ +
598 sparsityBuilder);
│ │ │ +
599
│ │ │ +
600 dinfo<<pinfo.communicator().rank()<<": Matrix ("<<coarseMatrix->N()<<"x"<<coarseMatrix->M()<<" row: min="<<sparsityBuilder.minRowSize()<<" max="
│ │ │ +
601 <<sparsityBuilder.maxRowSize()<<" avg="
│ │ │ +
602 <<static_cast<double>(sparsityBuilder.sumRowSize())/coarseMatrix->N()
│ │ │ +
603 <<std::endl;
│ │ │ +
604
│ │ │ +
605 delete[] overlapVertices;
│ │ │ +
606
│ │ │ +
607 return coarseMatrix;
│ │ │ +
608 }
│ │ │ +
│ │ │ +
609
│ │ │ +
610 template<class G, class V, class Set>
│ │ │ +
611 typename G::MutableMatrix*
│ │ │ +
│ │ │ + │ │ │ +
613 const SequentialInformation& pinfo,
│ │ │ + │ │ │ +
615 const typename G::Matrix::size_type& size,
│ │ │ +
616 [[maybe_unused]] const Set& overlap)
│ │ │ +
617 {
│ │ │ +
618 typedef typename G::MutableMatrix M;
│ │ │ +
619 M* coarseMatrix = new M(size, size, M::row_wise);
│ │ │ +
620
│ │ │ +
621 // Reset the visited flags of all vertices.
│ │ │ +
622 // As the isolated nodes will be skipped we simply mark them as visited
│ │ │ +
623
│ │ │ +
624 typedef typename G::VertexIterator Vertex;
│ │ │ +
625 Vertex vend = fineGraph.end();
│ │ │ +
626 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) {
│ │ │ + │ │ │ +
628 put(visitedMap, *vertex, aggregates[*vertex]==AggregatesMap<typename G::VertexDescriptor>::ISOLATED);
│ │ │ +
629 }
│ │ │ +
630
│ │ │ +
631 SparsityBuilder<M> sparsityBuilder(*coarseMatrix);
│ │ │ +
632
│ │ │ + │ │ │ +
634 aggregates, sparsityBuilder);
│ │ │ +
635 dinfo<<"Matrix row: min="<<sparsityBuilder.minRowSize()<<" max="
│ │ │ +
636 <<sparsityBuilder.maxRowSize()<<" average="
│ │ │ +
637 <<static_cast<double>(sparsityBuilder.sumRowSize())/coarseMatrix->N()<<std::endl;
│ │ │ +
638 return coarseMatrix;
│ │ │ +
639 }
│ │ │ +
│ │ │ +
640
│ │ │ +
641 template<class M, class V, class P, class O>
│ │ │ +
│ │ │ +
642 void BaseGalerkinProduct::calculate(const M& fine, const AggregatesMap<V>& aggregates, M& coarse,
│ │ │ +
643 const P& pinfo, [[maybe_unused]] const O& copy)
│ │ │ +
644 {
│ │ │ +
645 coarse = static_cast<typename M::field_type>(0);
│ │ │ +
646
│ │ │ +
647 typedef typename M::ConstIterator RowIterator;
│ │ │ +
648 RowIterator endRow = fine.end();
│ │ │ +
649
│ │ │ +
650 for(RowIterator row = fine.begin(); row != endRow; ++row)
│ │ │ +
651 if(aggregates[row.index()] != AggregatesMap<V>::ISOLATED) {
│ │ │ +
652 assert(aggregates[row.index()]!=AggregatesMap<V>::UNAGGREGATED);
│ │ │ +
653 typedef typename M::ConstColIterator ColIterator;
│ │ │ +
654 ColIterator endCol = row->end();
│ │ │ +
655
│ │ │ +
656 for(ColIterator col = row->begin(); col != endCol; ++col)
│ │ │ +
657 if(aggregates[col.index()] != AggregatesMap<V>::ISOLATED) {
│ │ │ +
658 assert(aggregates[row.index()]!=AggregatesMap<V>::UNAGGREGATED);
│ │ │ +
659 coarse[aggregates[row.index()]][aggregates[col.index()]]+=*col;
│ │ │ +
660 }
│ │ │ +
661 }
│ │ │ +
662
│ │ │ +
663 // get the right diagonal matrix values on copy lines from owner processes
│ │ │ +
664 typedef typename M::block_type BlockType;
│ │ │ +
665 std::vector<BlockType> rowsize(coarse.N(),BlockType(0));
│ │ │ +
666 for (RowIterator row = coarse.begin(); row != coarse.end(); ++row)
│ │ │ +
667 rowsize[row.index()]=coarse[row.index()][row.index()];
│ │ │ +
668 pinfo.copyOwnerToAll(rowsize,rowsize);
│ │ │ +
669 for (RowIterator row = coarse.begin(); row != coarse.end(); ++row)
│ │ │ +
670 coarse[row.index()][row.index()] = rowsize[row.index()];
│ │ │ +
671
│ │ │ +
672 // don't set dirichlet boundaries for copy lines to make novlp case work,
│ │ │ +
673 // the preconditioner yields slightly different results now.
│ │ │ +
674
│ │ │ +
675 // Set the dirichlet border
│ │ │ +
676 //DirichletBoundarySetter<P>::template set<M>(coarse, pinfo, copy);
│ │ │ +
677
│ │ │ +
678 }
│ │ │ +
│ │ │ +
679
│ │ │ +
680 template<class T>
│ │ │ +
681 template<class M, class O>
│ │ │ +
│ │ │ +
682 void DirichletBoundarySetter<T>::set(M& coarse, const T& pinfo, const O& copy)
│ │ │ +
683 {
│ │ │ +
684 typedef typename T::ParallelIndexSet::const_iterator ConstIterator;
│ │ │ +
685 ConstIterator end = pinfo.indexSet().end();
│ │ │ +
686 typedef typename M::block_type Block;
│ │ │ +
687 Block identity=Block(0.0);
│ │ │ +
688 for(typename Block::RowIterator b=identity.begin(); b != identity.end(); ++b)
│ │ │ +
689 b->operator[](b.index())=1.0;
│ │ │ +
690
│ │ │ +
691 for(ConstIterator index = pinfo.indexSet().begin();
│ │ │ +
692 index != end; ++index) {
│ │ │ +
693 if(copy.contains(index->local().attribute())) {
│ │ │ +
694 typedef typename M::ColIterator ColIterator;
│ │ │ +
695 typedef typename M::row_type Row;
│ │ │ +
696 Row row = coarse[index->local()];
│ │ │ +
697 ColIterator cend = row.find(index->local());
│ │ │ +
698 ColIterator col = row.begin();
│ │ │ +
699 for(; col != cend; ++col)
│ │ │ +
700 *col = 0;
│ │ │ +
701
│ │ │ +
702 cend = row.end();
│ │ │ +
703
│ │ │ +
704 assert(col != cend); // There should be a diagonal entry
│ │ │ +
705 *col = identity;
│ │ │ +
706
│ │ │ +
707 for(++col; col != cend; ++col)
│ │ │ +
708 *col = 0;
│ │ │ +
709 }
│ │ │ +
710 }
│ │ │ +
711 }
│ │ │ +
│ │ │ +
712
│ │ │ +
713 template<class M, class O>
│ │ │ +
│ │ │ + │ │ │ +
715 const SequentialInformation& pinfo,
│ │ │ +
716 const O& overlap)
│ │ │ +
717 {}
│ │ │ +
│ │ │ +
718
│ │ │ +
719 } // namespace Amg
│ │ │ +
720} // namespace Dune
│ │ │ +
721#endif
│ │ │ + │ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ +
bool operator()(const OverlapVertex< A > &o1, const OverlapVertex< A > &o2)
Definition galerkin.hh:155
│ │ │ +
static void constructNonOverlapConnectivity(R &row, G &graph, V &visitedMap, const AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::VertexDescriptor &seed)
Construct the connectivity of an aggregate in the overlap.
Definition galerkin.hh:313
│ │ │ +
G Graph
The type of the graph.
Definition galerkin.hh:211
│ │ │ +
void operator++()
Definition galerkin.hh:539
│ │ │ +
void operator()(const ConstEdgeIterator &edge)
Process an edge pointing to another aggregate.
Definition galerkin.hh:359
│ │ │ +
void insert(const typename M::size_type &index)
Definition galerkin.hh:552
│ │ │ +
static void constructOverlapConnectivity(R &row, G &graph, V &visitedMap, const AggregatesMap< typename G::VertexDescriptor > &aggregates, const OverlapVertex< typename G::VertexDescriptor > *&seed, const OverlapVertex< typename G::VertexDescriptor > *overlapEnd)
Definition galerkin.hh:331
│ │ │ +
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ +
std::size_t index()
Definition galerkin.hh:81
│ │ │ +
T ParallelInformation
Definition galerkin.hh:120
│ │ │ +
G::VertexDescriptor Vertex
Definition galerkin.hh:272
│ │ │ +
T Aggregate
The aggregate descriptor.
Definition galerkin.hh:37
│ │ │ +
SparsityBuilder(M &matrix)
Constructor.
Definition galerkin.hh:513
│ │ │ +
ConnectedBuilder(const AggregatesMap< Vertex > &aggregates, Graph &graph, VisitedMap &visitedMap, Set &connected)
Constructor.
Definition galerkin.hh:352
│ │ │ +
Graph::ConstEdgeIterator ConstEdgeIterator
The constant edge iterator.
Definition galerkin.hh:215
│ │ │ +
T Vertex
The vertex descriptor.
Definition galerkin.hh:42
│ │ │ +
G::VertexDescriptor Vertex
Definition galerkin.hh:288
│ │ │ +
static void examine(G &graph, V &visitedMap, const T &pinfo, const AggregatesMap< Vertex > &aggregates, const O &overlap, const OverlapVertex< Vertex > *overlapVertices, const OverlapVertex< Vertex > *overlapEnd, R &row)
Definition galerkin.hh:420
│ │ │ +
V VisitedMap
The type of the map for marking vertices as visited.
Definition galerkin.hh:225
│ │ │ +
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ +
S Set
The type of the connected set.
Definition galerkin.hh:220
│ │ │ +
Aggregate * aggregate
The aggregate the vertex belongs to.
Definition galerkin.hh:47
│ │ │ +
std::size_t sumRowSize()
Definition galerkin.hh:534
│ │ │ +
Vertex vertex
The vertex descriptor.
Definition galerkin.hh:52
│ │ │ +
std::size_t minRowSize()
Definition galerkin.hh:528
│ │ │ +
static void set(M &coarse, const T &pinfo, const O &copy)
Definition galerkin.hh:682
│ │ │ +
Graph::VertexDescriptor Vertex
The vertex descriptor of the graph.
Definition galerkin.hh:230
│ │ │ +
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ +
std::size_t maxRowSize()
Definition galerkin.hh:523
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
Categories for the solvers.
Definition solvercategory.hh:22
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:598
│ │ │ +
Definition galerkin.hh:33
│ │ │ +
Functor for building the sparsity pattern of the matrix using examineConnectivity.
Definition galerkin.hh:63
│ │ │ +
Definition galerkin.hh:99
│ │ │ +
Definition galerkin.hh:118
│ │ │ +
Definition galerkin.hh:185
│ │ │ +
Visitor for identifying connected aggregates during a breadthFirstSearch.
Definition galerkin.hh:206
│ │ │ +
Definition galerkin.hh:271
│ │ │ +
Definition galerkin.hh:300
│ │ │ +
Definition pinfo.hh:28
│ │ │
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │ -
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ -
Definition solvercategory.hh:54
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,85 +1,816 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -solvercategory.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +galerkin.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SOLVERCATEGORY_HH │ │ │ │ -6#define DUNE_ISTL_SOLVERCATEGORY_HH │ │ │ │ +5#ifndef DUNE_GALERKIN_HH │ │ │ │ +6#define DUNE_GALERKIN_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9 │ │ │ │ -10 │ │ │ │ -11namespace _D_u_n_e { │ │ │ │ -12 │ │ │ │ -_2_1 struct _S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ -22 { │ │ │ │ -_2_3 enum _C_a_t_e_g_o_r_y { │ │ │ │ -_2_5 _s_e_q_u_e_n_t_i_a_l, │ │ │ │ -_2_7 _n_o_n_o_v_e_r_l_a_p_p_i_n_g, │ │ │ │ -29 _o_v_e_r_l_a_p_p_i_n_g │ │ │ │ -_3_0 }; │ │ │ │ -31 │ │ │ │ -33 template │ │ │ │ -_3_4 static _C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y(const OP& op, decltype(op.category())* = nullptr) │ │ │ │ -35 { │ │ │ │ -36 return op.category(); │ │ │ │ -37 } │ │ │ │ +8#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +9#include "_p_i_n_f_o_._h_h" │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15 │ │ │ │ +16namespace _D_u_n_e │ │ │ │ +17{ │ │ │ │ +18 namespace Amg │ │ │ │ +19 { │ │ │ │ +31 template │ │ │ │ +_3_2 struct _O_v_e_r_l_a_p_V_e_r_t_e_x │ │ │ │ +33 { │ │ │ │ +_3_7 typedef T _A_g_g_r_e_g_a_t_e; │ │ │ │ 38 │ │ │ │ -39#ifndef DOXYGEN │ │ │ │ -40 // template │ │ │ │ -41 // static Category category(const OP& op, decltype(op.getSolverCategory())* │ │ │ │ -= nullptr) │ │ │ │ -42 // { │ │ │ │ -43 // return op.getSolverCategory(); │ │ │ │ -44 // } │ │ │ │ -45 │ │ │ │ -46 template │ │ │ │ -47 static _C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y(const OP& op, decltype(op.category)* = nullptr) │ │ │ │ -48 { │ │ │ │ -49 return OP::category; │ │ │ │ -50 } │ │ │ │ -51#endif │ │ │ │ -52 }; │ │ │ │ -53 │ │ │ │ -_5_4 class _I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y : public InvalidStateException{}; │ │ │ │ +_4_2 typedef T _V_e_r_t_e_x; │ │ │ │ +43 │ │ │ │ +_4_7 _A_g_g_r_e_g_a_t_e* _a_g_g_r_e_g_a_t_e; │ │ │ │ +48 │ │ │ │ +_5_2 _V_e_r_t_e_x _v_e_r_t_e_x; │ │ │ │ +53 }; │ │ │ │ +54 │ │ │ │ 55 │ │ │ │ -58} // end namespace │ │ │ │ -59 │ │ │ │ -60#endif │ │ │ │ +56 │ │ │ │ +61 template │ │ │ │ +_6_2 class _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r │ │ │ │ +63 { │ │ │ │ +64 public: │ │ │ │ +70 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r(M& matrix); │ │ │ │ +71 │ │ │ │ +72 void _i_n_s_e_r_t(const typename M::size_type& _i_n_d_e_x); │ │ │ │ +73 │ │ │ │ +74 void _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ +75 │ │ │ │ +76 std::size_t _m_i_n_R_o_w_S_i_z_e(); │ │ │ │ +77 │ │ │ │ +78 std::size_t _m_a_x_R_o_w_S_i_z_e(); │ │ │ │ +79 │ │ │ │ +80 std::size_t _s_u_m_R_o_w_S_i_z_e(); │ │ │ │ +_8_1 std::size_t _i_n_d_e_x() │ │ │ │ +82 { │ │ │ │ +83 return row_.index(); │ │ │ │ +84 } │ │ │ │ +85 private: │ │ │ │ +87 typename M::CreateIterator row_; │ │ │ │ +89 std::size_t minRowSize_; │ │ │ │ +91 std::size_t maxRowSize_; │ │ │ │ +92 std::size_t sumRowSize_; │ │ │ │ +93#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +94 bool diagonalInserted; │ │ │ │ +95#endif │ │ │ │ +96 }; │ │ │ │ +97 │ │ │ │ +_9_8 class _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +99 { │ │ │ │ +100 public: │ │ │ │ +109 template │ │ │ │ +_1_1_0 void _c_a_l_c_u_l_a_t_e(const M& fine, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>& aggregates, M& │ │ │ │ +coarse, │ │ │ │ +111 const I& pinfo, const O& copy); │ │ │ │ +112 │ │ │ │ +113 }; │ │ │ │ +114 │ │ │ │ +115 template │ │ │ │ +_1_1_6 class _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +117 : public _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +118 { │ │ │ │ +119 public: │ │ │ │ +_1_2_0 typedef T _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +121 │ │ │ │ +131 template │ │ │ │ +132 typename G::MutableMatrix* _b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ +133 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +134 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +135 const typename G::Matrix::size_type& size, │ │ │ │ +136 const Set& copy); │ │ │ │ +137 private: │ │ │ │ +138 │ │ │ │ +145 template │ │ │ │ +146 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* │ │ │ │ +147 buildOverlapVertices(const G& graph, const I& pinfo, │ │ │ │ +148 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +149 const Set& overlap, │ │ │ │ +150 std::size_t& overlapCount); │ │ │ │ +151 │ │ │ │ +152 template │ │ │ │ +153 struct OVLess │ │ │ │ +154 { │ │ │ │ +_1_5_5 bool _o_p_e_r_a_t_o_r_(_)(const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_A_>& o1, const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_A_>& o2) │ │ │ │ +156 { │ │ │ │ +157 return *o1._a_g_g_r_e_g_a_t_e < *o2._a_g_g_r_e_g_a_t_e; │ │ │ │ +158 } │ │ │ │ +159 }; │ │ │ │ +160 }; │ │ │ │ +161 │ │ │ │ +162 template<> │ │ │ │ +_1_6_3 class _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ +164 : public _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +165 { │ │ │ │ +166 public: │ │ │ │ +176 template │ │ │ │ +177 typename G::MutableMatrix* _b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ +178 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +180 const typename G::Matrix::size_type& size, │ │ │ │ +181 const Set& copy); │ │ │ │ +182 }; │ │ │ │ +183 │ │ │ │ +_1_8_4 struct _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ +185 { │ │ │ │ +186 template │ │ │ │ +187 static void _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& graph, V& visitedMap, │ │ │ │ +188 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +189 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>*& seed, │ │ │ │ +190 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* overlapEnd); │ │ │ │ +191 │ │ │ │ +195 template │ │ │ │ +196 static void _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& graph, V& │ │ │ │ +visitedMap, │ │ │ │ +197 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +198 const typename G::VertexDescriptor& seed); │ │ │ │ +199 │ │ │ │ +200 │ │ │ │ +204 template │ │ │ │ +_2_0_5 class _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ +206 { │ │ │ │ +207 public: │ │ │ │ +_2_1_1 typedef G _G_r_a_p_h; │ │ │ │ +_2_1_5 typedef typename Graph::ConstEdgeIterator _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +216 │ │ │ │ +_2_2_0 typedef S _S_e_t; │ │ │ │ +221 │ │ │ │ +_2_2_5 typedef V _V_i_s_i_t_e_d_M_a_p; │ │ │ │ +226 │ │ │ │ +_2_3_0 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +231 │ │ │ │ +239 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _G_r_a_p_h& graph, │ │ │ │ +240 _V_i_s_i_t_e_d_M_a_p& visitedMap, _S_e_t& connected); │ │ │ │ +241 │ │ │ │ +246 void _o_p_e_r_a_t_o_r_(_)(const _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +247 │ │ │ │ +248 private: │ │ │ │ +252 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +253 │ │ │ │ +254 _G_r_a_p_h& graph_; │ │ │ │ +255 │ │ │ │ +259 _V_i_s_i_t_e_d_M_a_p& visitedMap_; │ │ │ │ +260 │ │ │ │ +264 _S_e_t& connected_; │ │ │ │ +265 }; │ │ │ │ +266 │ │ │ │ +267 }; │ │ │ │ +268 │ │ │ │ +269 template │ │ │ │ +_2_7_0 struct _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r : public _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ +271 { │ │ │ │ +_2_7_2 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +273 │ │ │ │ +274 template │ │ │ │ +275 static void _e_x_a_m_i_n_e(G& graph, │ │ │ │ +276 V& visitedMap, │ │ │ │ +277 const T& pinfo, │ │ │ │ +278 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +279 const O& overlap, │ │ │ │ +280 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapVertices, │ │ │ │ +281 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapEnd, │ │ │ │ +282 R& row); │ │ │ │ +283 }; │ │ │ │ +284 │ │ │ │ +285 template │ │ │ │ +_2_8_6 struct _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r : public │ │ │ │ +_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ +287 { │ │ │ │ +_2_8_8 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +289 │ │ │ │ +290 template │ │ │ │ +291 static void _e_x_a_m_i_n_e(G& graph, │ │ │ │ +292 V& visitedMap, │ │ │ │ +293 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +294 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +295 R& row); │ │ │ │ +296 }; │ │ │ │ +297 │ │ │ │ +298 template │ │ │ │ +_2_9_9 struct _D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r │ │ │ │ +300 { │ │ │ │ +301 template │ │ │ │ +302 static void _s_e_t(M& coarse, const T& pinfo, const O& copy); │ │ │ │ +303 }; │ │ │ │ +304 │ │ │ │ +305 template<> │ │ │ │ +_3_0_6 struct _D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ +307 { │ │ │ │ +308 template │ │ │ │ +309 static void _s_e_t(M& coarse, const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, const O& │ │ │ │ +copy); │ │ │ │ +310 }; │ │ │ │ +311 │ │ │ │ +312 template │ │ │ │ +_3_1_3 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, │ │ │ │ +G& graph, V& visitedMap, │ │ │ │ +314 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +315 const typename G::VertexDescriptor& seed) │ │ │ │ +316 { │ │ │ │ +317 assert(row.index()==aggregates[seed]); │ │ │ │ +318 row.insert(aggregates[seed]); │ │ │ │ +319 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_R_,_V_> conBuilder(aggregates, graph, visitedMap, row); │ │ │ │ +320 typedef typename G::VertexDescriptor Vertex; │ │ │ │ +321 typedef std::allocator Allocator; │ │ │ │ +322 typedef SLList VertexList; │ │ │ │ +323 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r DummyVisitor; │ │ │ │ +324 VertexList vlist; │ │ │ │ +325 DummyVisitor dummy; │ │ │ │ +326 aggregates.template breadthFirstSearch(seed,aggregates[seed], │ │ │ │ +graph, vlist, dummy, │ │ │ │ +327 conBuilder, visitedMap); │ │ │ │ +328 } │ │ │ │ +329 │ │ │ │ +330 template │ │ │ │ +_3_3_1 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& │ │ │ │ +graph, V& visitedMap, │ │ │ │ +332 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +333 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>*& seed, │ │ │ │ +334 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* overlapEnd) │ │ │ │ +335 { │ │ │ │ +336 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_R_,_V_> conBuilder(aggregates, graph, visitedMap, row); │ │ │ │ +337 const typename G::VertexDescriptor aggregate=*seed->_a_g_g_r_e_g_a_t_e; │ │ │ │ +338 │ │ │ │ +339 if (row.index()==*seed->_a_g_g_r_e_g_a_t_e) { │ │ │ │ +340 while(seed != overlapEnd && aggregate == *seed->_a_g_g_r_e_g_a_t_e) { │ │ │ │ +341 row.insert(*seed->_a_g_g_r_e_g_a_t_e); │ │ │ │ +342 // Walk over all neighbours and add them to the connected array. │ │ │ │ +343 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(graph, seed->_v_e_r_t_e_x, conBuilder); │ │ │ │ +344 // Mark vertex as visited │ │ │ │ +345 put(visitedMap, seed->_v_e_r_t_e_x, true); │ │ │ │ +346 ++seed; │ │ │ │ +347 } │ │ │ │ +348 } │ │ │ │ +349 } │ │ │ │ +350 │ │ │ │ +351 template │ │ │ │ +_3_5_2 _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_S_,_V_>_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ +(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +353 _G_r_a_p_h& graph, _V_i_s_i_t_e_d_M_a_p& visitedMap, │ │ │ │ +354 _S_e_t& connected) │ │ │ │ +355 : aggregates_(aggregates), graph_(graph), visitedMap_(visitedMap), │ │ │ │ +connected_(connected) │ │ │ │ +356 {} │ │ │ │ +357 │ │ │ │ +358 template │ │ │ │ +_3_5_9 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_S_,_V_>_:_:_o_p_e_r_a_t_o_r_(_)(const │ │ │ │ +_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +360 { │ │ │ │ +361 const _V_e_r_t_e_x& vertex = aggregates_[edge.target()]; │ │ │ │ +362 assert(vertex!= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ +363 if(vertex!= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ +364 connected_.insert(vertex); │ │ │ │ +365 } │ │ │ │ +366 │ │ │ │ +367 template │ │ │ │ +368 template │ │ │ │ +369 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* │ │ │ │ +370 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_T_>_:_:_b_u_i_l_d_O_v_e_r_l_a_p_V_e_r_t_i_c_e_s(const G& graph, const I& pinfo, │ │ │ │ +371 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +372 const Set& overlap, │ │ │ │ +373 std::size_t& overlapCount) │ │ │ │ +374 { │ │ │ │ +375 // count the overlap vertices. │ │ │ │ +376 typedef typename G::ConstVertexIterator ConstIterator; │ │ │ │ +377 typedef typename I::GlobalLookupIndexSet GlobalLookup; │ │ │ │ +378 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ +379 │ │ │ │ +380 const ConstIterator end = graph.end(); │ │ │ │ +381 overlapCount = 0; │ │ │ │ +382 │ │ │ │ +383 const GlobalLookup& lookup=pinfo.globalLookup(); │ │ │ │ +384 │ │ │ │ +385 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) { │ │ │ │ +386 const IndexPair* pair = lookup.pair(*vertex); │ │ │ │ +387 │ │ │ │ +388 if(pair!=0 && overlap.contains(pair->local().attribute())) │ │ │ │ +389 ++overlapCount; │ │ │ │ +390 } │ │ │ │ +391 // Allocate space │ │ │ │ +392 typedef typename G::VertexDescriptor Vertex; │ │ │ │ +393 │ │ │ │ +394 _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapVertices = new _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_> │ │ │ │ +[overlapCount=0 ? 1 : overlapCount]; │ │ │ │ +395 if(overlapCount==0) │ │ │ │ +396 return overlapVertices; │ │ │ │ +397 │ │ │ │ +398 // Initialize them │ │ │ │ +399 overlapCount=0; │ │ │ │ +400 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) { │ │ │ │ +401 const IndexPair* pair = lookup.pair(*vertex); │ │ │ │ +402 │ │ │ │ +403 if(pair!=0 && overlap.contains(pair->local().attribute())) { │ │ │ │ +404 overlapVertices[overlapCount]._a_g_g_r_e_g_a_t_e = &aggregates[pair->local()]; │ │ │ │ +405 overlapVertices[overlapCount]._v_e_r_t_e_x = pair->local(); │ │ │ │ +406 ++overlapCount; │ │ │ │ +407 } │ │ │ │ +408 } │ │ │ │ +409 │ │ │ │ +410 dverb << overlapCount<<" overlap vertices"<()); │ │ │ │ +413 // due to the sorting the isolated aggregates (to be skipped) are at the │ │ │ │ +end. │ │ │ │ +414 │ │ │ │ +415 return overlapVertices; │ │ │ │ +416 } │ │ │ │ +417 │ │ │ │ +418 template │ │ │ │ +419 template │ │ │ │ +_4_2_0 void _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_G_,_T_>_:_:_e_x_a_m_i_n_e(G& graph, │ │ │ │ +421 V& visitedMap, │ │ │ │ +422 const T& pinfo, │ │ │ │ +423 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +424 const O& overlap, │ │ │ │ +425 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapVertices, │ │ │ │ +426 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapEnd, │ │ │ │ +427 R& row) │ │ │ │ +428 { │ │ │ │ +429 typedef typename T::GlobalLookupIndexSet GlobalLookup; │ │ │ │ +430 const GlobalLookup& lookup = pinfo.globalLookup(); │ │ │ │ +431 │ │ │ │ +432 typedef typename G::VertexIterator VertexIterator; │ │ │ │ +433 │ │ │ │ +434 VertexIterator vend=graph.end(); │ │ │ │ +435 │ │ │ │ +436#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +437 std::set examined; │ │ │ │ +438#endif │ │ │ │ +439 │ │ │ │ +440 // The aggregates owned by the process have lower local indices │ │ │ │ +441 // then those not owned. We process them in the first pass. │ │ │ │ +442 // They represent the rows 0, 1, ..., n of the coarse matrix │ │ │ │ +443 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) │ │ │ │ +444 if(!_g_e_t(visitedMap, *vertex)) { │ │ │ │ +445 // In the first pass we only process owner nodes │ │ │ │ +446 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ +447 const IndexPair* pair = lookup.pair(*vertex); │ │ │ │ +448 if(pair==0 || !overlap.contains(pair->local().attribute())) { │ │ │ │ +449#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +450 assert(examined.find(aggregates[*vertex])==examined.end()); │ │ │ │ +451 examined.insert(aggregates[*vertex]); │ │ │ │ +452#endif │ │ │ │ +453 _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ +*vertex); │ │ │ │ +454 │ │ │ │ +455 // only needed for ALU │ │ │ │ +456 // (ghosts with same global id as owners on the same process) │ │ │ │ +457 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo) == static_cast(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ +_n_o_n_o_v_e_r_l_a_p_p_i_n_g)) { │ │ │ │ +458 if(overlapVertices != overlapEnd) { │ │ │ │ +459 if(*overlapVertices->_a_g_g_r_e_g_a_t_e!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ +460 _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ +overlapVertices, overlapEnd); │ │ │ │ +461 } │ │ │ │ +462 else{ │ │ │ │ +463 ++overlapVertices; │ │ │ │ +464 } │ │ │ │ +465 } │ │ │ │ +466 } │ │ │ │ +467 ++row; │ │ │ │ +468 } │ │ │ │ +469 } │ │ │ │ +470 │ │ │ │ +471 dvverb<<"constructed "<_a_g_g_r_e_g_a_t_e!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ +477 │ │ │ │ +478#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +479 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ +480 const IndexPair* pair = lookup.pair(overlapVertices->_v_e_r_t_e_x); │ │ │ │ +481 assert(pair!=0 && overlap.contains(pair->local().attribute())); │ │ │ │ +482 assert(examined.find(aggregates[overlapVertices->_v_e_r_t_e_x])==examined.end()); │ │ │ │ +483 examined.insert(aggregates[overlapVertices->_v_e_r_t_e_x]); │ │ │ │ +484#endif │ │ │ │ +485 _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ +overlapVertices, overlapEnd); │ │ │ │ +486 ++row; │ │ │ │ +487 }else{ │ │ │ │ +488 ++overlapVertices; │ │ │ │ +489 } │ │ │ │ +490 } │ │ │ │ +491 │ │ │ │ +492 template │ │ │ │ +493 template │ │ │ │ +_4_9_4 void _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_G_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_e_x_a_m_i_n_e(G& graph, │ │ │ │ +495 V& visitedMap, │ │ │ │ +496 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +497 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +498 R& row) │ │ │ │ +499 { │ │ │ │ +500 typedef typename G::VertexIterator VertexIterator; │ │ │ │ +501 │ │ │ │ +502 VertexIterator vend=graph.end(); │ │ │ │ +503 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) { │ │ │ │ +504 if(!_g_e_t(visitedMap, *vertex)) { │ │ │ │ +505 _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ +*vertex); │ │ │ │ +506 ++row; │ │ │ │ +507 } │ │ │ │ +508 } │ │ │ │ +509 │ │ │ │ +510 } │ │ │ │ +511 │ │ │ │ +512 template │ │ │ │ +_5_1_3 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r(M& matrix) │ │ │ │ +514 : row_(matrix.createbegin()), │ │ │ │ +515 minRowSize_(_s_t_d::numeric_limits<_s_t_d::size_t>::max()), │ │ │ │ +516 maxRowSize_(0), sumRowSize_(0) │ │ │ │ +517 { │ │ │ │ +518#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +519 diagonalInserted = false; │ │ │ │ +520#endif │ │ │ │ +521 } │ │ │ │ +522 template │ │ │ │ +_5_2_3 std::size_t _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_m_a_x_R_o_w_S_i_z_e() │ │ │ │ +524 { │ │ │ │ +525 return maxRowSize_; │ │ │ │ +526 } │ │ │ │ +527 template │ │ │ │ +_5_2_8 std::size_t _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_m_i_n_R_o_w_S_i_z_e() │ │ │ │ +529 { │ │ │ │ +530 return minRowSize_; │ │ │ │ +531 } │ │ │ │ +532 │ │ │ │ +533 template │ │ │ │ +_5_3_4 std::size_t _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_s_u_m_R_o_w_S_i_z_e() │ │ │ │ +535 { │ │ │ │ +536 return sumRowSize_; │ │ │ │ +537 } │ │ │ │ +538 template │ │ │ │ +_5_3_9 void _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_o_p_e_r_a_t_o_r_+_+() │ │ │ │ +540 { │ │ │ │ +541 sumRowSize_ += row_.size(); │ │ │ │ +542 minRowSize_=std::min(minRowSize_, row_.size()); │ │ │ │ +543 maxRowSize_=std::max(maxRowSize_, row_.size()); │ │ │ │ +544 ++row_; │ │ │ │ +545#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +546 assert(diagonalInserted); │ │ │ │ +547 diagonalInserted = false; │ │ │ │ +548#endif │ │ │ │ +549 } │ │ │ │ +550 │ │ │ │ +551 template │ │ │ │ +_5_5_2 void _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_i_n_s_e_r_t(const typename M::size_type& index) │ │ │ │ +553 { │ │ │ │ +554 row_.insert(index); │ │ │ │ +555#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +556 diagonalInserted = diagonalInserted || row_.index()==index; │ │ │ │ +557#endif │ │ │ │ +558 } │ │ │ │ +559 │ │ │ │ +560 template │ │ │ │ +561 template │ │ │ │ +562 typename G::MutableMatrix* │ │ │ │ +_5_6_3 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_T_>_:_:_b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ +564 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +565 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +566 const typename G::Matrix::size_type& size, │ │ │ │ +567 const Set& overlap) │ │ │ │ +568 { │ │ │ │ +569 typedef _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_> _O_v_e_r_l_a_p_V_e_r_t_e_x; │ │ │ │ +570 │ │ │ │ +571 std::size_t count; │ │ │ │ +572 │ │ │ │ +573 const _O_v_e_r_l_a_p_V_e_r_t_e_x* overlapVertices = buildOverlapVertices(fineGraph, │ │ │ │ +574 pinfo, │ │ │ │ +575 aggregates, │ │ │ │ +576 overlap, │ │ │ │ +577 count); │ │ │ │ +578 typedef typename G::MutableMatrix M; │ │ │ │ +579 M* coarseMatrix = new M(size, size, M::row_wise); │ │ │ │ +580 │ │ │ │ +581 // Reset the visited flags of all vertices. │ │ │ │ +582 // As the isolated nodes will be skipped we simply mark them as visited │ │ │ │ +583 │ │ │ │ +584 typedef typename G::VertexIterator Vertex; │ │ │ │ +585 Vertex vend = fineGraph.end(); │ │ │ │ +586 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) { │ │ │ │ +587 assert(aggregates[*vertex] != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ +_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ +588 put(visitedMap, *vertex, aggregates[*vertex]==_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_: │ │ │ │ +_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_:_I_S_O_L_A_T_E_D); │ │ │ │ +589 } │ │ │ │ +590 │ │ │ │ +591 typedef typename G::MutableMatrix M; │ │ │ │ +592 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_> sparsityBuilder(*coarseMatrix); │ │ │ │ +593 │ │ │ │ +594 _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_G_,_T_>_:_:_e_x_a_m_i_n_e(fineGraph, visitedMap, pinfo, │ │ │ │ +595 aggregates, overlap, │ │ │ │ +596 overlapVertices, │ │ │ │ +597 overlapVertices+count, │ │ │ │ +598 sparsityBuilder); │ │ │ │ +599 │ │ │ │ +600 dinfo<N │ │ │ │ +()<<"x"<M()<<" row: min="< │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solver.hh File Reference │ │ │ +dune-istl: amg.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,77 +65,79 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Functions
│ │ │ + │ │ │ │ │ │
│ │ │ │ │ │ -

Define general, extensible interface for inverse operators. │ │ │ +

The AMG preconditioner. │ │ │ More...

│ │ │ -
#include <dune-istl-config.hh>
│ │ │ -#include <iomanip>
│ │ │ -#include <ostream>
│ │ │ -#include <string>
│ │ │ -#include <functional>
│ │ │ +
#include <memory>
│ │ │ +#include <sstream>
│ │ │ #include <dune/common/exceptions.hh>
│ │ │ -#include <dune/common/shared_ptr.hh>
│ │ │ -#include <dune/common/simd/io.hh>
│ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ +#include <dune/istl/paamg/smoother.hh>
│ │ │ +#include <dune/istl/paamg/transfer.hh>
│ │ │ +#include <dune/istl/paamg/matrixhierarchy.hh>
│ │ │ +#include <dune/istl/solvers.hh>
│ │ │ +#include <dune/istl/scalarproducts.hh>
│ │ │ +#include <dune/istl/superlu.hh>
│ │ │ +#include <dune/istl/umfpack.hh>
│ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ +#include <dune/common/typetraits.hh>
│ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ #include <dune/common/parametertree.hh>
│ │ │ -#include <dune/common/timer.hh>
│ │ │ -#include "solvertype.hh"
│ │ │ -#include "preconditioner.hh"
│ │ │ -#include "operators.hh"
│ │ │ -#include "scalarproducts.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::InverseOperatorResult
 Statistics about the application of an inverse operator. More...
class  Dune::Amg::AMG< M, X, S, PI, A >
 Parallel algebraic multigrid based on agglomeration. More...
 
class  Dune::InverseOperator< X, Y >
 Abstract base class for all solvers. More...
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >
 
class  Dune::IterativeSolver< X, Y >
 Base class for all implementations of iterative solvers. More...
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, SolverType >
 
class  Dune::IterativeSolver< X, Y >::Iteration< CountType >
 Class for controlling iterative methods. More...
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, superlu >
 
class  Dune::SolverHelper< ISTLLinearSolver, BCRSMatrix >
 Helper class for notifying a DUNE-ISTL linear solver about a change of the iteration matrix object in a unified way, i.e. independent from the solver's type (direct/iterative). More...
struct  Dune::AMGCreator
 
struct  Dune::SolverHelper< ISTLLinearSolver, BCRSMatrix >::Implementation< is_direct_solver, Dummy >
 Implementation that works together with iterative ISTL solvers, e.g. Dune::CGSolver or Dune::BiCGSTABSolver. More...
struct  Dune::AMGCreator::isValidBlockType< class >
 
struct  Dune::SolverHelper< ISTLLinearSolver, BCRSMatrix >::Implementation< true, Dummy >
 Implementation that works together with direct ISTL solvers, e.g. Dune::SuperLU or Dune::UMFPack. More...
struct  Dune::AMGCreator::isValidBlockType< FieldMatrix< T, n, m > >
 
│ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ + │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

 Dune::DUNE_REGISTER_PRECONDITIONER ("amg", AMGCreator())
 
│ │ │

Detailed Description

│ │ │ -

Define general, extensible interface for inverse operators.

│ │ │ -

Implementation here covers only inversion of linear operators, but the implementation might be used for nonlinear operators as well.

│ │ │ +

The AMG preconditioner.

│ │ │ +
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,63 +1,60 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -solver.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s │ │ │ │ -Define general, extensible interface for inverse operators. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +amg.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +The AMG preconditioner. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ #include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ #include │ │ │ │ -#include │ │ │ │ -#include "_s_o_l_v_e_r_t_y_p_e_._h_h" │ │ │ │ -#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h" │ │ │ │ -#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ -#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -  Statistics about the application of an inverse operator. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _> │ │ │ │ +  Parallel algebraic multigrid based on agglomeration. _M_o_r_e_._._. │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _X_,_ _Y_ _> │ │ │ │ -  Abstract base class for all solvers. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_<_ _M_a_t_r_i_x_,_ _V_e_c_t_o_r_ _> │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _Y_ _> │ │ │ │ -  Base class for all implementations of iterative solvers. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_<_ _M_a_t_r_i_x_,_ _V_e_c_t_o_r_ _>_:_:_S_o_l_v_e_r_<_ _M_, │ │ │ │ + _S_o_l_v_e_r_T_y_p_e_ _> │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_<_ _X_,_ _Y_ _>_:_:_I_t_e_r_a_t_i_o_n_<_ _C_o_u_n_t_T_y_p_e_ _> │ │ │ │ -  Class for controlling iterative methods. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_<_ _I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_ _B_C_R_S_M_a_t_r_i_x_ _> │ │ │ │ - Helper class for notifying a DUNE-ISTL linear solver about a change of │ │ │ │ -  the iteration matrix object in a unified way, i.e. independent from │ │ │ │ - the solver's type (direct/iterative). _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_<_ _I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_ _B_C_R_S_M_a_t_r_i_x_ _>_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_< │ │ │ │ - _i_s___d_i_r_e_c_t___s_o_l_v_e_r_,_ _D_u_m_m_y_ _> │ │ │ │ -  _I_m_p_l_e_m_e_n_t_a_t_i_o_n that works together with iterative _I_S_T_L solvers, e.g. │ │ │ │ - _D_u_n_e_:_:_C_G_S_o_l_v_e_r or _D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_<_ _I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_ _B_C_R_S_M_a_t_r_i_x_ _>_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_< │ │ │ │ - _t_r_u_e_,_ _D_u_m_m_y_ _> │ │ │ │ -  _I_m_p_l_e_m_e_n_t_a_t_i_o_n that works together with direct _I_S_T_L solvers, e.g. │ │ │ │ - _D_u_n_e_:_:_S_u_p_e_r_L_U or _D_u_n_e_:_:_U_M_F_P_a_c_k. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_<_ _M_a_t_r_i_x_,_ _V_e_c_t_o_r_ _>_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u │ │ │ │ + _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_ _c_l_a_s_s_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +  │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("amg", _A_M_G_C_r_e_a_t_o_r()) │ │ │ │ +  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ -Implementation here covers only inversion of linear operators, but the │ │ │ │ -implementation might be used for nonlinear operators as well. │ │ │ │ +The AMG preconditioner. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: solver.hh Source File │ │ │ +dune-istl: amg.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,501 +70,1279 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
solver.hh
│ │ │ +
amg.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5
│ │ │ -
6#ifndef DUNE_ISTL_SOLVER_HH
│ │ │ -
7#define DUNE_ISTL_SOLVER_HH
│ │ │ -
8
│ │ │ -
9#include <dune-istl-config.hh> // DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ -
10
│ │ │ -
11#include <iomanip>
│ │ │ -
12#include <ostream>
│ │ │ -
13#include <string>
│ │ │ -
14#include <functional>
│ │ │ -
15
│ │ │ -
16#include <dune/common/exceptions.hh>
│ │ │ -
17#include <dune/common/shared_ptr.hh>
│ │ │ -
18#include <dune/common/simd/io.hh>
│ │ │ -
19#include <dune/common/simd/simd.hh>
│ │ │ -
20#include <dune/common/parametertree.hh>
│ │ │ -
21#include <dune/common/timer.hh>
│ │ │ -
22
│ │ │ -
23#include "solvertype.hh"
│ │ │ -
24#include "preconditioner.hh"
│ │ │ -
25#include "operators.hh"
│ │ │ -
26#include "scalarproducts.hh"
│ │ │ -
27
│ │ │ -
28namespace Dune
│ │ │ -
29{
│ │ │ -
│ │ │ - │ │ │ -
50 {
│ │ │ -
│ │ │ - │ │ │ -
53 {
│ │ │ -
54 clear();
│ │ │ -
55 }
│ │ │ -
│ │ │ -
56
│ │ │ -
│ │ │ -
58 void clear ()
│ │ │ -
59 {
│ │ │ -
60 iterations = 0;
│ │ │ -
61 reduction = 0;
│ │ │ -
62 converged = false;
│ │ │ -
63 conv_rate = 1;
│ │ │ -
64 elapsed = 0;
│ │ │ - │ │ │ -
66 }
│ │ │ -
│ │ │ -
67
│ │ │ - │ │ │ +
5#ifndef DUNE_AMG_AMG_HH
│ │ │ +
6#define DUNE_AMG_AMG_HH
│ │ │ +
7
│ │ │ +
8#include <memory>
│ │ │ +
9#include <sstream>
│ │ │ +
10#include <dune/common/exceptions.hh>
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
14#include <dune/istl/solvers.hh>
│ │ │ + │ │ │ +
16#include <dune/istl/superlu.hh>
│ │ │ +
17#include <dune/istl/umfpack.hh>
│ │ │ + │ │ │ +
19#include <dune/common/typetraits.hh>
│ │ │ +
20#include <dune/common/exceptions.hh>
│ │ │ +
21#include <dune/common/scalarvectorview.hh>
│ │ │ +
22#include <dune/common/scalarmatrixview.hh>
│ │ │ +
23#include <dune/common/parametertree.hh>
│ │ │ +
24
│ │ │ +
25namespace Dune
│ │ │ +
26{
│ │ │ +
27 namespace Amg
│ │ │ +
28 {
│ │ │ +
46 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
47 class KAMG;
│ │ │ +
48
│ │ │ +
49 template<class T>
│ │ │ +
50 class KAmgTwoGrid;
│ │ │ +
51
│ │ │ +
62 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ +
63 class A=std::allocator<X> >
│ │ │ +
│ │ │ +
64 class AMG : public Preconditioner<X,X>
│ │ │ +
65 {
│ │ │ +
66 template<class M1, class X1, class S1, class P1, class K1, class A1>
│ │ │ +
67 friend class KAMG;
│ │ │ +
68
│ │ │ +
69 friend class KAmgTwoGrid<AMG>;
│ │ │
70
│ │ │ -
72 double reduction;
│ │ │ -
73
│ │ │ - │ │ │ -
76
│ │ │ -
78 double conv_rate;
│ │ │ -
79
│ │ │ -
81 double condition_estimate = -1;
│ │ │ -
82
│ │ │ -
84 double elapsed;
│ │ │ -
85 };
│ │ │ -
│ │ │ -
86
│ │ │ -
87
│ │ │ -
88 //=====================================================================
│ │ │ -
100 template<class X, class Y>
│ │ │ -
│ │ │ - │ │ │ -
102 public:
│ │ │ -
104 typedef X domain_type;
│ │ │ -
105
│ │ │ -
107 typedef Y range_type;
│ │ │ -
108
│ │ │ -
110 typedef typename X::field_type field_type;
│ │ │ -
111
│ │ │ -
113 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ -
114
│ │ │ -
116 typedef Simd::Scalar<real_type> scalar_real_type;
│ │ │ -
117
│ │ │ -
130 virtual void apply (X& x, Y& b, InverseOperatorResult& res) = 0;
│ │ │ -
131
│ │ │ -
145 virtual void apply (X& x, Y& b, double reduction, InverseOperatorResult& res) = 0;
│ │ │ -
146
│ │ │ - │ │ │ -
149#ifdef DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ -
150 {
│ │ │ -
151 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
│ │ │ -
152 }
│ │ │ -
153#else
│ │ │ -
154 = 0;
│ │ │ -
155#endif
│ │ │ -
156
│ │ │ -
158 virtual ~InverseOperator () {}
│ │ │ -
159
│ │ │ -
160 protected:
│ │ │ -
161 // spacing values
│ │ │ -
162 enum { iterationSpacing = 5 , normSpacing = 16 };
│ │ │ -
163
│ │ │ -
│ │ │ -
165 void printHeader(std::ostream& s) const
│ │ │ -
166 {
│ │ │ -
167 s << std::setw(iterationSpacing) << " Iter";
│ │ │ -
168 s << std::setw(normSpacing) << "Defect";
│ │ │ -
169 s << std::setw(normSpacing) << "Rate" << std::endl;
│ │ │ -
170 }
│ │ │ -
│ │ │ -
171
│ │ │ -
173 template <typename CountType, typename DataType>
│ │ │ -
│ │ │ -
174 void printOutput(std::ostream& s,
│ │ │ -
175 const CountType& iter,
│ │ │ -
176 const DataType& norm,
│ │ │ -
177 const DataType& norm_old) const
│ │ │ -
178 {
│ │ │ -
179 const DataType rate = norm/norm_old;
│ │ │ -
180 s << std::setw(iterationSpacing) << iter << " ";
│ │ │ -
181 s << std::setw(normSpacing) << Simd::io(norm) << " ";
│ │ │ -
182 s << std::setw(normSpacing) << Simd::io(rate) << std::endl;
│ │ │ -
183 }
│ │ │ -
│ │ │ -
184
│ │ │ -
186 template <typename CountType, typename DataType>
│ │ │ -
│ │ │ -
187 void printOutput(std::ostream& s,
│ │ │ -
188 const CountType& iter,
│ │ │ -
189 const DataType& norm) const
│ │ │ -
190 {
│ │ │ -
191 s << std::setw(iterationSpacing) << iter << " ";
│ │ │ -
192 s << std::setw(normSpacing) << Simd::io(norm) << std::endl;
│ │ │ -
193 }
│ │ │ -
│ │ │ -
194 };
│ │ │ -
│ │ │ -
195
│ │ │ -
204 template<class X, class Y>
│ │ │ -
│ │ │ -
205 class IterativeSolver : public InverseOperator<X,Y>{
│ │ │ -
206 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
210 using typename InverseOperator<X,Y>::real_type;
│ │ │ - │ │ │ +
71 public:
│ │ │ +
73 typedef M Operator;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
85
│ │ │ +
87 typedef X Domain;
│ │ │ +
89 typedef X Range;
│ │ │ + │ │ │ +
97 typedef S Smoother;
│ │ │ +
98
│ │ │ + │ │ │ +
101
│ │ │ +
│ │ │ +
111 AMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ +
112 const SmootherArgs& smootherArgs, const Parameters& parms);
│ │ │ +
113
│ │ │ +
125 template<class C>
│ │ │ +
│ │ │ +
126 AMG(const Operator& fineOperator, const C& criterion,
│ │ │ +
127 const SmootherArgs& smootherArgs=SmootherArgs(),
│ │ │ + │ │ │ +
129
│ │ │ +
│ │ │ +
180 AMG(std::shared_ptr<const Operator> fineOperator, const ParameterTree& configuration, const ParallelInformation& pinfo=ParallelInformation());
│ │ │ +
181
│ │ │ +
│ │ │ +
185 AMG(const AMG& amg);
│ │ │ +
186
│ │ │ +
│ │ │ +
188 void pre(Domain& x, Range& b);
│ │ │ +
189
│ │ │ +
│ │ │ +
191 void apply(Domain& v, const Range& d);
│ │ │ +
192
│ │ │ +
│ │ │ + │ │ │ +
195 {
│ │ │ +
196 return category_;
│ │ │ +
197 }
│ │ │ +
│ │ │ +
198
│ │ │ +
│ │ │ +
200 void post(Domain& x);
│ │ │ +
201
│ │ │ +
206 template<class A1>
│ │ │ +
│ │ │ +
207 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ +
208
│ │ │ +
│ │ │ +
209 std::size_t levels();
│ │ │ +
210
│ │ │ +
│ │ │ +
211 std::size_t maxlevels();
│ │ │
212
│ │ │ -
│ │ │ -
232 IterativeSolver (const LinearOperator<X,Y>& op, Preconditioner<X,Y>& prec, scalar_real_type reduction, int maxit, int verbose) :
│ │ │ -
233 _op(stackobject_to_shared_ptr(op)),
│ │ │ -
234 _prec(stackobject_to_shared_ptr(prec)),
│ │ │ -
235 _sp(new SeqScalarProduct<X>),
│ │ │ -
236 _reduction(reduction), _maxit(maxit), _verbose(verbose), _category(SolverCategory::sequential)
│ │ │ -
237 {
│ │ │ - │ │ │ -
239 DUNE_THROW(InvalidSolverCategory, "LinearOperator has to be sequential!");
│ │ │ - │ │ │ -
241 DUNE_THROW(InvalidSolverCategory, "Preconditioner has to be sequential!");
│ │ │ -
242 }
│ │ │ -
│ │ │ -
243
│ │ │ -
│ │ │ - │ │ │ -
265 scalar_real_type reduction, int maxit, int verbose) :
│ │ │ -
266 _op(stackobject_to_shared_ptr(op)),
│ │ │ -
267 _prec(stackobject_to_shared_ptr(prec)),
│ │ │ -
268 _sp(stackobject_to_shared_ptr(sp)),
│ │ │ -
269 _reduction(reduction), _maxit(maxit), _verbose(verbose), _category(SolverCategory::category(op))
│ │ │ -
270 {
│ │ │ - │ │ │ -
272 DUNE_THROW(InvalidSolverCategory, "LinearOperator and Preconditioner must have the same SolverCategory!");
│ │ │ - │ │ │ -
274 DUNE_THROW(InvalidSolverCategory, "LinearOperator and ScalarProduct must have the same SolverCategory!");
│ │ │ -
275 }
│ │ │ -
│ │ │ -
276
│ │ │ -
│ │ │ -
292 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
293 IterativeSolver(op,std::make_shared<SeqScalarProduct<X>>(),prec,
│ │ │ -
294 configuration.get<real_type>("reduction"),
│ │ │ -
295 configuration.get<int>("maxit"),
│ │ │ -
296 configuration.get<int>("verbose"))
│ │ │ -
297 {}
│ │ │ -
│ │ │ -
298
│ │ │ -
│ │ │ -
315 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<const ScalarProduct<X> > sp, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
316 IterativeSolver(op,sp,prec,
│ │ │ -
317 configuration.get<scalar_real_type>("reduction"),
│ │ │ -
318 configuration.get<int>("maxit"),
│ │ │ -
319 configuration.get<int>("verbose"))
│ │ │ -
320 {}
│ │ │ -
│ │ │ -
321
│ │ │ -
│ │ │ -
342 IterativeSolver (std::shared_ptr<const LinearOperator<X,Y>> op,
│ │ │ -
343 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ -
344 std::shared_ptr<Preconditioner<X,Y>> prec,
│ │ │ -
345 scalar_real_type reduction, int maxit, int verbose) :
│ │ │ -
346 _op(op),
│ │ │ -
347 _prec(prec),
│ │ │ -
348 _sp(sp),
│ │ │ -
349 _reduction(reduction), _maxit(maxit), _verbose(verbose),
│ │ │ - │ │ │ -
351 {
│ │ │ - │ │ │ -
353 DUNE_THROW(InvalidSolverCategory, "LinearOperator and Preconditioner must have the same SolverCategory!");
│ │ │ - │ │ │ -
355 DUNE_THROW(InvalidSolverCategory, "LinearOperator and ScalarProduct must have the same SolverCategory!");
│ │ │ -
356 }
│ │ │ -
│ │ │ -
357
│ │ │ -
358 // #warning actually we want to have this as the default and just implement the second one
│ │ │ -
359 // //! \copydoc InverseOperator::apply(X&,Y&,InverseOperatorResult&)
│ │ │ -
360 // virtual void apply (X& x, Y& b, InverseOperatorResult& res)
│ │ │ -
361 // {
│ │ │ -
362 // apply(x,b,_reduction,res);
│ │ │ -
363 // }
│ │ │ -
364
│ │ │ -
365#ifndef DOXYGEN
│ │ │ -
366 // make sure the three-argument apply from the base class does not get shadowed
│ │ │ -
367 // by the redefined four-argument version below
│ │ │ -
368 using InverseOperator<X,Y>::apply;
│ │ │ -
369#endif
│ │ │ -
370
│ │ │ -
│ │ │ -
376 virtual void apply (X& x, X& b, double reduction, InverseOperatorResult& res)
│ │ │ -
377 {
│ │ │ -
378 scalar_real_type saved_reduction = _reduction;
│ │ │ -
379 _reduction = reduction;
│ │ │ -
380 this->apply(x,b,res);
│ │ │ -
381 _reduction = saved_reduction;
│ │ │ -
382 }
│ │ │ -
│ │ │ -
383
│ │ │ -
│ │ │ - │ │ │ -
386 {
│ │ │ -
387 return _category;
│ │ │ -
388 }
│ │ │ -
│ │ │ -
389
│ │ │ -
│ │ │ -
390 std::string name() const{
│ │ │ -
391 std::string name = className(*this);
│ │ │ -
392 return name.substr(0, name.find("<"));
│ │ │ -
393 }
│ │ │ -
│ │ │ -
394
│ │ │ -
412 template<class CountType = unsigned int>
│ │ │ -
│ │ │ -
413 class Iteration {
│ │ │ -
414 public:
│ │ │ -
│ │ │ - │ │ │ -
416 : _i(0)
│ │ │ -
417 , _res(res)
│ │ │ -
418 , _parent(parent)
│ │ │ -
419 , _valid(true)
│ │ │ -
420 {
│ │ │ -
421 res.clear();
│ │ │ -
422 if(_parent._verbose>0){
│ │ │ -
423 std::cout << "=== " << parent.name() << std::endl;
│ │ │ -
424 if(_parent._verbose > 1)
│ │ │ -
425 _parent.printHeader(std::cout);
│ │ │ -
426 }
│ │ │ -
427 }
│ │ │ -
│ │ │ -
428
│ │ │ -
429 Iteration(const Iteration&) = delete;
│ │ │ -
│ │ │ - │ │ │ -
431 : _def0(other._def0)
│ │ │ -
432 , _def(other._def)
│ │ │ -
433 , _i(other._i)
│ │ │ -
434 , _watch(other._watch)
│ │ │ -
435 , _res(other._res)
│ │ │ -
436 , _parent(other._parent)
│ │ │ -
437 , _valid(other._valid)
│ │ │ -
438 {
│ │ │ -
439 other._valid = false;
│ │ │ -
440 }
│ │ │ -
│ │ │ -
441
│ │ │ -
│ │ │ - │ │ │ -
443 if(_valid)
│ │ │ -
444 finalize();
│ │ │ -
445 }
│ │ │ -
│ │ │ -
446
│ │ │ -
│ │ │ -
457 bool step(CountType i, real_type def){
│ │ │ -
458 if (!Simd::allTrue(isFinite(def))) // check for inf or NaN
│ │ │ -
459 {
│ │ │ -
460 if (_parent._verbose>0)
│ │ │ -
461 std::cout << "=== " << _parent.name() << ": abort due to infinite or NaN defect"
│ │ │ -
462 << std::endl;
│ │ │ -
463 DUNE_THROW(SolverAbort,
│ │ │ -
464 _parent.name() << ": defect=" << Simd::io(def)
│ │ │ -
465 << " is infinite or NaN");
│ │ │ -
466 }
│ │ │ -
467 if(i == 0)
│ │ │ -
468 _def0 = def;
│ │ │ -
469 if(_parent._verbose > 1){
│ │ │ -
470 if(i!=0)
│ │ │ -
471 _parent.printOutput(std::cout,i,def,_def);
│ │ │ -
472 else
│ │ │ -
473 _parent.printOutput(std::cout,i,def);
│ │ │ -
474 }
│ │ │ -
475 _def = def;
│ │ │ -
476 _i = i;
│ │ │ -
477 _res.converged = (Simd::allTrue(def<_def0*_parent._reduction || def<real_type(1E-30))); // convergence check
│ │ │ -
478 return _res.converged;
│ │ │ -
479 }
│ │ │ -
│ │ │ -
480
│ │ │ -
481 protected:
│ │ │ -
│ │ │ -
482 void finalize(){
│ │ │ -
483 _res.converged = (Simd::allTrue(_def<_def0*_parent._reduction || _def<real_type(1E-30)));
│ │ │ - │ │ │ -
485 _res.reduction = static_cast<double>(Simd::max(_def/_def0));
│ │ │ -
486 _res.conv_rate = pow(_res.reduction,1.0/_i);
│ │ │ -
487 _res.elapsed = _watch.elapsed();
│ │ │ -
488 if (_parent._verbose>0) // final print
│ │ │ -
489 {
│ │ │ -
490 std::cout << "=== rate=" << _res.conv_rate
│ │ │ -
491 << ", T=" << _res.elapsed
│ │ │ -
492 << ", TIT=" << _res.elapsed/_res.iterations
│ │ │ -
493 << ", IT=" << _res.iterations << std::endl;
│ │ │ -
494 }
│ │ │ -
495 }
│ │ │ -
│ │ │ -
496
│ │ │ -
497 real_type _def0 = 0.0, _def = 0.0;
│ │ │ -
498 CountType _i;
│ │ │ -
499 Timer _watch;
│ │ │ - │ │ │ - │ │ │ -
502 bool _valid;
│ │ │ -
503 };
│ │ │ -
│ │ │ -
504
│ │ │ -
505 protected:
│ │ │ -
506 std::shared_ptr<const LinearOperator<X,Y>> _op;
│ │ │ -
507 std::shared_ptr<Preconditioner<X,Y>> _prec;
│ │ │ -
508 std::shared_ptr<const ScalarProduct<X>> _sp;
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
513 };
│ │ │ -
│ │ │ -
514
│ │ │ -
522 template <typename ISTLLinearSolver, typename BCRSMatrix>
│ │ │ -
│ │ │ - │ │ │ -
524 {
│ │ │ -
525 public:
│ │ │ -
│ │ │ -
526 static void setMatrix (ISTLLinearSolver& solver,
│ │ │ -
527 const BCRSMatrix& matrix)
│ │ │ -
528 {
│ │ │ -
529 static const bool is_direct_solver
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
533 }
│ │ │ -
│ │ │ -
534
│ │ │ -
535 protected:
│ │ │ -
540 template <bool is_direct_solver, typename Dummy = void>
│ │ │ -
│ │ │ - │ │ │ -
542 {
│ │ │ -
│ │ │ -
543 static void setMatrix (ISTLLinearSolver&,
│ │ │ -
544 const BCRSMatrix&)
│ │ │ -
545 {}
│ │ │ -
│ │ │ -
546 };
│ │ │ -
│ │ │ -
547
│ │ │ -
552 template <typename Dummy>
│ │ │ -
│ │ │ -
553 struct Implementation<true,Dummy>
│ │ │ -
554 {
│ │ │ -
│ │ │ -
555 static void setMatrix (ISTLLinearSolver& solver,
│ │ │ -
556 const BCRSMatrix& matrix)
│ │ │ -
557 {
│ │ │ -
558 solver.setMatrix(matrix);
│ │ │ -
559 }
│ │ │ +
│ │ │ + │ │ │ +
222 {
│ │ │ +
223 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ +
224 }
│ │ │ +
│ │ │ +
225
│ │ │ +
│ │ │ + │ │ │ +
231
│ │ │ +
232 private:
│ │ │ +
233 /*
│ │ │ +
234 * @brief Helper function to create hierarchies with parameter tree.
│ │ │ +
235 *
│ │ │ +
236 * Will create the coarsen criterion with the norm and create the
│ │ │ +
237 * Hierarchies
│ │ │ +
238 * \tparam Norm Type of the norm to use.
│ │ │ +
239 */
│ │ │ +
240 template<class Norm>
│ │ │ +
241 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ +
242 const PI& pinfo, const Norm&,
│ │ │ +
243 const ParameterTree& configuration,
│ │ │ +
244 std::true_type compiles = std::true_type());
│ │ │ +
245 template<class Norm>
│ │ │ +
246 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ +
247 const PI& pinfo, const Norm&,
│ │ │ +
248 const ParameterTree& configuration,
│ │ │ +
249 std::false_type);
│ │ │ +
254 template<class C>
│ │ │ +
255 void createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr,
│ │ │ +
256 const PI& pinfo, const ParameterTree& configuration);
│ │ │ +
263 template<class C>
│ │ │ +
264 void createHierarchies(C& criterion,
│ │ │ +
265 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ +
266 const PI& pinfo);
│ │ │ +
273 struct LevelContext
│ │ │ +
274 {
│ │ │ + │ │ │ + │ │ │ +
283 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ + │ │ │ +
291 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ +
295 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
311 std::size_t level;
│ │ │ +
312 };
│ │ │ +
313
│ │ │ +
314
│ │ │ +
319 void mgc(LevelContext& levelContext);
│ │ │ +
320
│ │ │ +
321 void additiveMgc();
│ │ │ +
322
│ │ │ +
329 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel);
│ │ │ +
330
│ │ │ +
335 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ +
336
│ │ │ +
341 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ +
342
│ │ │ +
344 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ +
346 SmootherArgs smootherArgs_;
│ │ │ +
348 std::shared_ptr<Hierarchy<Smoother,A> > smoothers_;
│ │ │ +
350 std::shared_ptr<CoarseSolver> solver_;
│ │ │ +
352 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ +
354 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ +
356 std::shared_ptr<Hierarchy<Domain,A>> update_;
│ │ │ + │ │ │ +
360 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ +
362 std::size_t gamma_;
│ │ │ +
364 std::size_t preSteps_;
│ │ │ +
366 std::size_t postSteps_;
│ │ │ +
367 bool buildHierarchy_;
│ │ │ +
368 bool additive;
│ │ │ +
369 bool coarsesolverconverged;
│ │ │ +
370 std::shared_ptr<Smoother> coarseSmoother_;
│ │ │ +
372 SolverCategory::Category category_;
│ │ │ +
374 std::size_t verbosity_;
│ │ │ +
375
│ │ │ +
376 struct ToLower
│ │ │ +
377 {
│ │ │ +
│ │ │ +
378 std::string operator()(const std::string& str)
│ │ │ +
379 {
│ │ │ +
380 std::stringstream retval;
│ │ │ +
381 std::ostream_iterator<char> out(retval);
│ │ │ +
382 std::transform(str.begin(), str.end(), out,
│ │ │ +
383 [](char c){
│ │ │ +
384 return std::tolower(c, std::locale::classic());
│ │ │ +
385 });
│ │ │ +
386 return retval.str();
│ │ │ +
387 }
│ │ │ +
│ │ │ +
388 };
│ │ │ +
389 };
│ │ │ +
390
│ │ │ +
391 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ +
392 inline AMG<M,X,S,PI,A>::AMG(const AMG& amg)
│ │ │ +
393 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_),
│ │ │ +
394 smoothers_(amg.smoothers_), solver_(amg.solver_),
│ │ │ +
395 rhs_(), lhs_(), update_(),
│ │ │ +
396 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_),
│ │ │ +
397 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ +
398 buildHierarchy_(amg.buildHierarchy_),
│ │ │ +
399 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ +
400 coarseSmoother_(amg.coarseSmoother_),
│ │ │ +
401 category_(amg.category_),
│ │ │ +
402 verbosity_(amg.verbosity_)
│ │ │ +
403 {}
│ │ │ +
│ │ │ +
404
│ │ │ +
405 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
407 const SmootherArgs& smootherArgs,
│ │ │ +
408 const Parameters& parms)
│ │ │ +
409 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_(smootherArgs),
│ │ │ +
410 smoothers_(new Hierarchy<Smoother,A>), solver_(&coarseSolver),
│ │ │ +
411 rhs_(), lhs_(), update_(), scalarProduct_(0),
│ │ │ +
412 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ +
413 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ +
414 additive(parms.getAdditive()), coarsesolverconverged(true),
│ │ │ +
415 coarseSmoother_(),
│ │ │ +
416// #warning should category be retrieved from matrices?
│ │ │ +
417 category_(SolverCategory::category(*smoothers_->coarsest())),
│ │ │ +
418 verbosity_(parms.debugLevel())
│ │ │ +
419 {
│ │ │ +
420 assert(matrices_->isBuilt());
│ │ │ +
421
│ │ │ +
422 // build the necessary smoother hierarchies
│ │ │ +
423 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ +
424 }
│ │ │ +
│ │ │ +
425
│ │ │ +
426 template<class M, class X, class S, class PI, class A>
│ │ │ +
427 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
429 const C& criterion,
│ │ │ +
430 const SmootherArgs& smootherArgs,
│ │ │ +
431 const PI& pinfo)
│ │ │ +
432 : smootherArgs_(smootherArgs),
│ │ │ +
433 smoothers_(new Hierarchy<Smoother,A>), solver_(),
│ │ │ +
434 rhs_(), lhs_(), update_(), scalarProduct_(),
│ │ │ +
435 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()),
│ │ │ +
436 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
│ │ │ +
437 additive(criterion.getAdditive()), coarsesolverconverged(true),
│ │ │ +
438 coarseSmoother_(),
│ │ │ +
439 category_(SolverCategory::category(pinfo)),
│ │ │ +
440 verbosity_(criterion.debugLevel())
│ │ │ +
441 {
│ │ │ + │ │ │ +
443 DUNE_THROW(InvalidSolverCategory, "Matrix and Communication must have the same SolverCategory!");
│ │ │ +
444 // TODO: reestablish compile time checks.
│ │ │ +
445 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ +
446 // "Matrix and Solver must match in terms of category!");
│ │ │ +
447 auto matrixptr = stackobject_to_shared_ptr(matrix);
│ │ │ +
448 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ +
449 }
│ │ │ +
│ │ │ +
450
│ │ │ +
451 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ +
452 AMG<M,X,S,PI,A>::AMG(std::shared_ptr<const Operator> matrixptr,
│ │ │ +
453 const ParameterTree& configuration,
│ │ │ +
454 const ParallelInformation& pinfo) :
│ │ │ +
455 smoothers_(new Hierarchy<Smoother,A>),
│ │ │ +
456 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_(true),
│ │ │ +
457 coarsesolverconverged(true), coarseSmoother_(),
│ │ │ +
458 category_(SolverCategory::category(pinfo))
│ │ │ +
459 {
│ │ │ +
460
│ │ │ +
461 if (configuration.hasKey ("smootherIterations"))
│ │ │ +
462 smootherArgs_.iterations = configuration.get<int>("smootherIterations");
│ │ │ +
463
│ │ │ +
464 if (configuration.hasKey ("smootherRelaxation"))
│ │ │ +
465 smootherArgs_.relaxationFactor = configuration.get<typename SmootherArgs::RelaxationFactor>("smootherRelaxation");
│ │ │ +
466
│ │ │ +
467 auto normName = ToLower()(configuration.get("strengthMeasure", "diagonal"));
│ │ │ +
468 auto index = configuration.get<int>("diagonalRowIndex", 0);
│ │ │ +
469
│ │ │ +
470 if ( normName == "diagonal")
│ │ │ +
471 {
│ │ │ +
472 using field_type = typename M::field_type;
│ │ │ +
473 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ +
474 std::is_convertible<field_type, real_type> compiles;
│ │ │ +
475
│ │ │ +
476 switch (index)
│ │ │ +
477 {
│ │ │ +
478 case 0:
│ │ │ +
479 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<0>(), configuration, compiles);
│ │ │ +
480 break;
│ │ │ +
481 case 1:
│ │ │ +
482 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<1>(), configuration, compiles);
│ │ │ +
483 break;
│ │ │ +
484 case 2:
│ │ │ +
485 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<2>(), configuration, compiles);
│ │ │ +
486 break;
│ │ │ +
487 case 3:
│ │ │ +
488 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<3>(), configuration, compiles);
│ │ │ +
489 break;
│ │ │ +
490 case 4:
│ │ │ +
491 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<4>(), configuration, compiles);
│ │ │ +
492 break;
│ │ │ +
493 default:
│ │ │ +
494 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not supported.");
│ │ │ +
495 }
│ │ │ +
496 }
│ │ │ +
497 else if (normName == "rowsum")
│ │ │ +
498 createCriterionAndHierarchies(matrixptr, pinfo, RowSum(), configuration);
│ │ │ +
499 else if (normName == "frobenius")
│ │ │ +
500 createCriterionAndHierarchies(matrixptr, pinfo, FrobeniusNorm(), configuration);
│ │ │ +
501 else if (normName == "one")
│ │ │ +
502 createCriterionAndHierarchies(matrixptr, pinfo, AlwaysOneNorm(), configuration);
│ │ │ +
503 else
│ │ │ +
504 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure "<<normName<<" is not supported by AMG");
│ │ │ +
505 }
│ │ │ +
│ │ │ +
506
│ │ │ +
507 template<class M, class X, class S, class PI, class A>
│ │ │ +
508 template<class Norm>
│ │ │ +
509 void AMG<M,X,S,PI,A>::createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const Norm&, const ParameterTree& configuration, std::false_type)
│ │ │ +
510 {
│ │ │ +
511 DUNE_THROW(InvalidStateException, "Strength of connection measure does not support this type ("
│ │ │ +
512 << className<typename M::field_type>() << ") as it is lacking a conversion to"
│ │ │ +
513 << className<typename FieldTraits<typename M::field_type>::real_type>() << ".");
│ │ │ +
514 }
│ │ │ +
515
│ │ │ +
516 template<class M, class X, class S, class PI, class A>
│ │ │ +
517 template<class Norm>
│ │ │ +
518 void AMG<M,X,S,PI,A>::createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const Norm&, const ParameterTree& configuration, std::true_type)
│ │ │ +
519 {
│ │ │ +
520 if (configuration.get<bool>("criterionSymmetric", true))
│ │ │ +
521 {
│ │ │ +
522 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ + │ │ │ +
524 Criterion criterion;
│ │ │ +
525 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ +
526 }
│ │ │ +
527 else
│ │ │ +
528 {
│ │ │ +
529 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ + │ │ │ +
531 Criterion criterion;
│ │ │ +
532 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ +
533 }
│ │ │ +
534 }
│ │ │ +
535
│ │ │ +
536 template<class M, class X, class S, class PI, class A>
│ │ │ +
537 template<class C>
│ │ │ +
538 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const ParameterTree& configuration)
│ │ │ +
539 {
│ │ │ +
540 if (configuration.hasKey ("maxLevel"))
│ │ │ +
541 criterion.setMaxLevel(configuration.get<int>("maxLevel"));
│ │ │ +
542
│ │ │ +
543 if (configuration.hasKey ("minCoarseningRate"))
│ │ │ +
544 criterion.setMinCoarsenRate(configuration.get<int>("minCoarseningRate"));
│ │ │ +
545
│ │ │ +
546 if (configuration.hasKey ("coarsenTarget"))
│ │ │ +
547 criterion.setCoarsenTarget (configuration.get<int>("coarsenTarget"));
│ │ │ +
548
│ │ │ +
549 if (configuration.hasKey ("accumulationMode"))
│ │ │ +
550 {
│ │ │ +
551 std::string mode = ToLower()(configuration.get<std::string>("accumulationMode"));
│ │ │ +
552 if ( mode == "none")
│ │ │ +
553 criterion.setAccumulate(AccumulationMode::noAccu);
│ │ │ +
554 else if ( mode == "atonce" )
│ │ │ +
555 criterion.setAccumulate(AccumulationMode::atOnceAccu);
│ │ │ +
556 else if ( mode == "successive")
│ │ │ +
557 criterion.setCoarsenTarget (AccumulationMode::successiveAccu);
│ │ │ +
558 else
│ │ │ +
559 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ +
560 << mode <<".");
│ │ │ +
561 }
│ │ │ +
562
│ │ │ +
563 if (configuration.hasKey ("prolongationDampingFactor"))
│ │ │ +
564 criterion.setProlongationDampingFactor (configuration.get<double>("prolongationDampingFactor"));
│ │ │ +
565
│ │ │ +
566 if (configuration.hasKey("defaultAggregationSizeMode"))
│ │ │ +
567 {
│ │ │ +
568 auto mode = ToLower()(configuration.get<std::string>("defaultAggregationSizeMode"));
│ │ │ +
569 auto dim = configuration.get<std::size_t>("defaultAggregationDimension");
│ │ │ +
570 std::size_t maxDistance = 2;
│ │ │ +
571 if (configuration.hasKey("MaxAggregateDistance"))
│ │ │ +
572 maxDistance = configuration.get<std::size_t>("maxAggregateDistance");
│ │ │ +
573 if (mode == "isotropic")
│ │ │ +
574 criterion.setDefaultValuesIsotropic(dim, maxDistance);
│ │ │ +
575 else if(mode == "anisotropic")
│ │ │ +
576 criterion.setDefaultValuesAnisotropic(dim, maxDistance);
│ │ │ +
577 else
│ │ │ +
578 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ +
579 << mode <<".");
│ │ │ +
580 }
│ │ │ +
581
│ │ │ +
582 if (configuration.hasKey("maxAggregateDistance"))
│ │ │ +
583 criterion.setMaxDistance(configuration.get<std::size_t>("maxAggregateDistance"));
│ │ │ +
584
│ │ │ +
585 if (configuration.hasKey("minAggregateSize"))
│ │ │ +
586 criterion.setMinAggregateSize(configuration.get<std::size_t>("minAggregateSize"));
│ │ │ +
587
│ │ │ +
588 if (configuration.hasKey("maxAggregateSize"))
│ │ │ +
589 criterion.setMaxAggregateSize(configuration.get<std::size_t>("maxAggregateSize"));
│ │ │ +
590
│ │ │ +
591 if (configuration.hasKey("maxAggregateConnectivity"))
│ │ │ +
592 criterion.setMaxConnectivity(configuration.get<std::size_t>("maxAggregateConnectivity"));
│ │ │ +
593
│ │ │ +
594 if (configuration.hasKey ("alpha"))
│ │ │ +
595 criterion.setAlpha (configuration.get<double> ("alpha"));
│ │ │ +
596
│ │ │ +
597 if (configuration.hasKey ("beta"))
│ │ │ +
598 criterion.setBeta (configuration.get<double> ("beta"));
│ │ │ +
599
│ │ │ +
600 if (configuration.hasKey ("gamma"))
│ │ │ +
601 criterion.setGamma (configuration.get<std::size_t> ("gamma"));
│ │ │ +
602 gamma_ = criterion.getGamma();
│ │ │ +
603
│ │ │ +
604 if (configuration.hasKey ("additive"))
│ │ │ +
605 criterion.setAdditive (configuration.get<bool>("additive"));
│ │ │ +
606 additive = criterion.getAdditive();
│ │ │ +
607
│ │ │ +
608 if (configuration.hasKey ("preSteps"))
│ │ │ +
609 criterion.setNoPreSmoothSteps (configuration.get<std::size_t> ("preSteps"));
│ │ │ +
610 preSteps_ = criterion.getNoPreSmoothSteps ();
│ │ │ +
611
│ │ │ +
612 if (configuration.hasKey ("postSteps"))
│ │ │ +
613 criterion.setNoPostSmoothSteps (configuration.get<std::size_t> ("postSteps"));
│ │ │ +
614 postSteps_ = criterion.getNoPostSmoothSteps ();
│ │ │ +
615
│ │ │ +
616 verbosity_ = configuration.get("verbosity", 0);
│ │ │ +
617 criterion.setDebugLevel (verbosity_);
│ │ │ +
618
│ │ │ +
619 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ +
620 }
│ │ │ +
621
│ │ │ +
622 template <class Matrix,
│ │ │ +
623 class Vector>
│ │ │ +
│ │ │ + │ │ │ +
625 {
│ │ │ +
626 typedef typename Matrix :: field_type field_type;
│ │ │ + │ │ │ +
628
│ │ │ +
629 static constexpr SolverType solver =
│ │ │ +
630#if DISABLE_AMG_DIRECTSOLVER
│ │ │ +
631 none;
│ │ │ +
632#elif HAVE_SUITESPARSE_UMFPACK
│ │ │ + │ │ │ +
634#elif HAVE_SUPERLU
│ │ │ +
635 superlu ;
│ │ │ +
636#else
│ │ │ +
637 none;
│ │ │ +
638#endif
│ │ │ +
639
│ │ │ +
640 template <class M, SolverType>
│ │ │ +
│ │ │ +
641 struct Solver
│ │ │ +
642 {
│ │ │ + │ │ │ +
│ │ │ +
644 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ +
645 {
│ │ │ +
646 DUNE_THROW(NotImplemented,"DirectSolver not selected");
│ │ │ +
647 return nullptr;
│ │ │ +
648 }
│ │ │ +
│ │ │ +
649 static std::string name () { return "None"; }
│ │ │ +
650 };
│ │ │ +
│ │ │ +
651#if HAVE_SUITESPARSE_UMFPACK
│ │ │ +
652 template <class M>
│ │ │ +
653 struct Solver< M, umfpack >
│ │ │ +
654 {
│ │ │ +
655 typedef UMFPack< M > type;
│ │ │ +
656 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ +
657 {
│ │ │ +
658 return new type(mat, verbose, reusevector );
│ │ │ +
659 }
│ │ │ +
660 static std::string name () { return "UMFPack"; }
│ │ │ +
661 };
│ │ │ +
662#endif
│ │ │ +
663#if HAVE_SUPERLU
│ │ │ +
664 template <class M>
│ │ │ +
│ │ │ +
665 struct Solver< M, superlu >
│ │ │ +
666 {
│ │ │ + │ │ │ +
│ │ │ +
668 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ +
669 {
│ │ │ +
670 return new type(mat, verbose, reusevector );
│ │ │ +
671 }
│ │ │ +
│ │ │ +
672 static std::string name () { return "SuperLU"; }
│ │ │ +
673 };
│ │ │ +
│ │ │ +
674#endif
│ │ │ +
675
│ │ │ +
676 // define direct solver type to be used
│ │ │ + │ │ │ +
678 typedef typename SelectedSolver :: type DirectSolver;
│ │ │ +
679 static constexpr bool isDirectSolver = solver != none;
│ │ │ +
680 static std::string name() { return SelectedSolver :: name (); }
│ │ │ +
│ │ │ +
681 static DirectSolver* create(const Matrix& mat, bool verbose, bool reusevector )
│ │ │ +
682 {
│ │ │ +
683 return SelectedSolver :: create( mat, verbose, reusevector );
│ │ │ +
684 }
│ │ │ +
│ │ │ +
685 };
│ │ │ +
│ │ │ +
686
│ │ │ +
687 template<class M, class X, class S, class PI, class A>
│ │ │ +
688 template<class C>
│ │ │ +
689 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion,
│ │ │ +
690 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ +
691 const PI& pinfo)
│ │ │ +
692 {
│ │ │ +
693 Timer watch;
│ │ │ +
694 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ +
695 std::const_pointer_cast<Operator>(matrixptr),
│ │ │ +
696 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ +
697
│ │ │ +
698 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ +
699
│ │ │ +
700 // build the necessary smoother hierarchies
│ │ │ +
701 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ +
702
│ │ │ +
703 // test whether we should solve on the coarse level. That is the case if we
│ │ │ +
704 // have that level and if there was a redistribution on this level then our
│ │ │ +
705 // communicator has to be valid (size()>0) as the smoother might try to communicate
│ │ │ +
706 // in the constructor.
│ │ │ +
707 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
│ │ │ +
708 && ( ! matrices_->redistributeInformation().back().isSetup() ||
│ │ │ +
709 matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
│ │ │ +
710 {
│ │ │ +
711 // We have the carsest level. Create the coarse Solver
│ │ │ +
712 SmootherArgs sargs(smootherArgs_);
│ │ │ +
713 sargs.iterations = 1;
│ │ │ +
714
│ │ │ + │ │ │ +
716 cargs.setArgs(sargs);
│ │ │ +
717 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ +
718 // Solve on the redistributed partitioning
│ │ │ +
719 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ +
720 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ +
721 }else{
│ │ │ +
722 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ +
723 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ +
724 }
│ │ │ +
725
│ │ │ +
726 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ +
727 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ +
728
│ │ │ +
729 typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector;
│ │ │ +
730
│ │ │ +
731 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ +
732 if( SolverSelector::isDirectSolver &&
│ │ │ +
733 (std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ +
734 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ +
735 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ +
736 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ +
737 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0) )
│ │ │ +
738 )
│ │ │ +
739 { // redistribute and 1 proc
│ │ │ +
740 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ +
741 {
│ │ │ +
742 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ +
743 {
│ │ │ +
744 // We are still participating on this level
│ │ │ +
745 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ +
746 }
│ │ │ +
747 else
│ │ │ +
748 solver_.reset();
│ │ │ +
749 }
│ │ │ +
750 else
│ │ │ +
751 {
│ │ │ +
752 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ +
753 }
│ │ │ +
754 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ +
755 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << ")" << std::endl;
│ │ │ +
756 }
│ │ │ +
757 else
│ │ │ +
758 {
│ │ │ +
759 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ +
760 {
│ │ │ +
761 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ +
762 // We are still participating on this level
│ │ │ +
763
│ │ │ +
764 // we have to allocate these types using the rebound allocator
│ │ │ +
765 // in order to ensure that we fulfill the alignment requirements
│ │ │ +
766 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ +
767 *scalarProduct_,
│ │ │ +
768 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ +
769 else
│ │ │ +
770 solver_.reset();
│ │ │ +
771 }else
│ │ │ +
772 {
│ │ │ +
773 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ +
774 *scalarProduct_,
│ │ │ +
775 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ +
776 // // we have to allocate these types using the rebound allocator
│ │ │ +
777 // // in order to ensure that we fulfill the alignment requirements
│ │ │ +
778 // using Alloc = typename std::allocator_traits<A>::template rebind_alloc<BiCGSTABSolver<X>>;
│ │ │ +
779 // Alloc alloc;
│ │ │ +
780 // auto p = alloc.allocate(1);
│ │ │ +
781 // std::allocator_traits<Alloc>::construct(alloc, p,
│ │ │ +
782 // const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ +
783 // *scalarProduct_,
│ │ │ +
784 // *coarseSmoother_, 1E-2, 1000, 0);
│ │ │ +
785 // solver_.reset(p,[](BiCGSTABSolver<X>* p){
│ │ │ +
786 // Alloc alloc;
│ │ │ +
787 // std::allocator_traits<Alloc>::destroy(alloc, p);
│ │ │ +
788 // alloc.deallocate(p,1);
│ │ │ +
789 // });
│ │ │ +
790 }
│ │ │ +
791 }
│ │ │ +
792 }
│ │ │ +
793
│ │ │ +
794 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ +
795 std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
│ │ │ +
796 <<"(including coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
797 }
│ │ │ +
798
│ │ │ +
799
│ │ │ +
800 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
802 {
│ │ │ +
803 // Detect Matrix rows where all offdiagonal entries are
│ │ │ +
804 // zero and set x such that A_dd*x_d=b_d
│ │ │ +
805 // Thus users can be more careless when setting up their linear
│ │ │ +
806 // systems.
│ │ │ +
807 typedef typename M::matrix_type Matrix;
│ │ │ +
808 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ +
809 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ +
810 typedef typename Matrix::block_type Block;
│ │ │ +
811 Block zero;
│ │ │ +
812 zero=typename Matrix::field_type();
│ │ │ +
813
│ │ │ +
814 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ +
815 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ +
816 bool isDirichlet = true;
│ │ │ +
817 bool hasDiagonal = false;
│ │ │ +
818 Block diagonal{};
│ │ │ +
819 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ +
820 if(row.index()==col.index()) {
│ │ │ +
821 diagonal = *col;
│ │ │ +
822 hasDiagonal = true;
│ │ │ +
823 }else{
│ │ │ +
824 if(*col!=zero)
│ │ │ +
825 isDirichlet = false;
│ │ │ +
826 }
│ │ │ +
827 }
│ │ │ +
828 if(isDirichlet && hasDiagonal)
│ │ │ +
829 {
│ │ │ +
830 auto&& xEntry = Impl::asVector(x[row.index()]);
│ │ │ +
831 auto&& bEntry = Impl::asVector(b[row.index()]);
│ │ │ +
832 Impl::asMatrix(diagonal).solve(xEntry, bEntry);
│ │ │ +
833 }
│ │ │ +
834 }
│ │ │ +
835
│ │ │ +
836 if(smoothers_->levels()>0)
│ │ │ +
837 smoothers_->finest()->pre(x,b);
│ │ │ +
838 else
│ │ │ +
839 // No smoother to make x consistent! Do it by hand
│ │ │ +
840 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ +
841 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ +
842 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
843 update_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
844 matrices_->coarsenVector(*rhs_);
│ │ │ +
845 matrices_->coarsenVector(*lhs_);
│ │ │ +
846 matrices_->coarsenVector(*update_);
│ │ │ +
847
│ │ │ +
848 // Preprocess all smoothers
│ │ │ +
849 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ +
850 typedef typename Hierarchy<Range,A>::Iterator RIterator;
│ │ │ +
851 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ +
852 Iterator coarsest = smoothers_->coarsest();
│ │ │ +
853 Iterator smoother = smoothers_->finest();
│ │ │ +
854 RIterator rhs = rhs_->finest();
│ │ │ +
855 DIterator lhs = lhs_->finest();
│ │ │ +
856 if(smoothers_->levels()>1) {
│ │ │ +
857
│ │ │ +
858 assert(lhs_->levels()==rhs_->levels());
│ │ │ +
859 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels()==matrices_->maxlevels());
│ │ │ +
860 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels()<matrices_->maxlevels());
│ │ │ +
861
│ │ │ +
862 if(smoother!=coarsest)
│ │ │ +
863 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, ++rhs)
│ │ │ +
864 smoother->pre(*lhs,*rhs);
│ │ │ +
865 smoother->pre(*lhs,*rhs);
│ │ │ +
866 }
│ │ │ +
867
│ │ │ +
868
│ │ │ +
869 // The preconditioner might change x and b. So we have to
│ │ │ +
870 // copy the changes to the original vectors.
│ │ │ +
871 x = *lhs_->finest();
│ │ │ +
872 b = *rhs_->finest();
│ │ │ +
873
│ │ │ +
874 }
│ │ │ +
│ │ │ +
875 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
877 {
│ │ │ +
878 return matrices_->levels();
│ │ │ +
879 }
│ │ │ +
│ │ │ +
880 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
882 {
│ │ │ +
883 return matrices_->maxlevels();
│ │ │ +
884 }
│ │ │ +
│ │ │ +
885
│ │ │ +
887 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
889 {
│ │ │ +
890 LevelContext levelContext;
│ │ │ +
891
│ │ │ +
892 if(additive) {
│ │ │ +
893 *(rhs_->finest())=d;
│ │ │ +
894 additiveMgc();
│ │ │ +
895 v=*lhs_->finest();
│ │ │ +
896 }else{
│ │ │ +
897 // Init all iterators for the current level
│ │ │ +
898 initIteratorsWithFineLevel(levelContext);
│ │ │ +
899
│ │ │ +
900
│ │ │ +
901 *levelContext.lhs = v;
│ │ │ +
902 *levelContext.rhs = d;
│ │ │ +
903 *levelContext.update=0;
│ │ │ +
904 levelContext.level=0;
│ │ │ +
905
│ │ │ +
906 mgc(levelContext);
│ │ │ +
907
│ │ │ +
908 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ +
909 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ +
910
│ │ │ +
911 v=*levelContext.update;
│ │ │ +
912 }
│ │ │ +
913
│ │ │ +
914 }
│ │ │ +
│ │ │ +
915
│ │ │ +
916 template<class M, class X, class S, class PI, class A>
│ │ │ +
917 void AMG<M,X,S,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ +
918 {
│ │ │ +
919 levelContext.smoother = smoothers_->finest();
│ │ │ +
920 levelContext.matrix = matrices_->matrices().finest();
│ │ │ +
921 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ +
922 levelContext.redist =
│ │ │ +
923 matrices_->redistributeInformation().begin();
│ │ │ +
924 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ +
925 levelContext.lhs = lhs_->finest();
│ │ │ +
926 levelContext.update = update_->finest();
│ │ │ +
927 levelContext.rhs = rhs_->finest();
│ │ │ +
928 }
│ │ │ +
929
│ │ │ +
930 template<class M, class X, class S, class PI, class A>
│ │ │ +
931 bool AMG<M,X,S,PI,A>
│ │ │ +
932 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ +
933 {
│ │ │ +
934
│ │ │ +
935 bool processNextLevel=true;
│ │ │ +
936
│ │ │ +
937 if(levelContext.redist->isSetup()) {
│ │ │ +
938 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.rhs),
│ │ │ +
939 levelContext.rhs.getRedistributed());
│ │ │ +
940 processNextLevel = levelContext.rhs.getRedistributed().size()>0;
│ │ │ +
941 if(processNextLevel) {
│ │ │ +
942 //restrict defect to coarse level right hand side.
│ │ │ +
943 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ +
944 ++levelContext.pinfo;
│ │ │ +
945 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
946 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ +
947 static_cast<const Range&>(fineRhs.getRedistributed()),
│ │ │ +
948 *levelContext.pinfo);
│ │ │ +
949 }
│ │ │ +
950 }else{
│ │ │ +
951 //restrict defect to coarse level right hand side.
│ │ │ +
952 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ +
953 ++levelContext.pinfo;
│ │ │ +
954 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
955 ::restrictVector(*(*levelContext.aggregates),
│ │ │ +
956 *levelContext.rhs, static_cast<const Range&>(*fineRhs),
│ │ │ +
957 *levelContext.pinfo);
│ │ │ +
958 }
│ │ │ +
959
│ │ │ +
960 if(processNextLevel) {
│ │ │ +
961 // prepare coarse system
│ │ │ +
962 ++levelContext.lhs;
│ │ │ +
963 ++levelContext.update;
│ │ │ +
964 ++levelContext.matrix;
│ │ │ +
965 ++levelContext.level;
│ │ │ +
966 ++levelContext.redist;
│ │ │ +
967
│ │ │ +
968 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
969 // next level is not the globally coarsest one
│ │ │ +
970 ++levelContext.smoother;
│ │ │ +
971 ++levelContext.aggregates;
│ │ │ +
972 }
│ │ │ +
973 // prepare the update on the next level
│ │ │ +
974 *levelContext.update=0;
│ │ │ +
975 }
│ │ │ +
976 return processNextLevel;
│ │ │ +
977 }
│ │ │ +
978
│ │ │ +
979 template<class M, class X, class S, class PI, class A>
│ │ │ +
980 void AMG<M,X,S,PI,A>
│ │ │ +
981 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel)
│ │ │ +
982 {
│ │ │ +
983 if(processNextLevel) {
│ │ │ +
984 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
985 // previous level is not the globally coarsest one
│ │ │ +
986 --levelContext.smoother;
│ │ │ +
987 --levelContext.aggregates;
│ │ │ +
988 }
│ │ │ +
989 --levelContext.redist;
│ │ │ +
990 --levelContext.level;
│ │ │ +
991 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ +
992 --levelContext.matrix;
│ │ │ +
993
│ │ │ +
994 //typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--;
│ │ │ +
995 --levelContext.lhs;
│ │ │ +
996 --levelContext.pinfo;
│ │ │ +
997 }
│ │ │ +
998 if(levelContext.redist->isSetup()) {
│ │ │ +
999 // Need to redistribute during prolongateVector
│ │ │ +
1000 levelContext.lhs.getRedistributed()=0;
│ │ │ +
1001 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
1002 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ +
1003 levelContext.lhs.getRedistributed(),
│ │ │ +
1004 matrices_->getProlongationDampingFactor(),
│ │ │ +
1005 *levelContext.pinfo, *levelContext.redist);
│ │ │ +
1006 }else{
│ │ │ +
1007 *levelContext.lhs=0;
│ │ │ +
1008 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
1009 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ +
1010 matrices_->getProlongationDampingFactor(),
│ │ │ +
1011 *levelContext.pinfo);
│ │ │ +
1012 }
│ │ │ +
1013
│ │ │ +
1014
│ │ │ +
1015 if(processNextLevel) {
│ │ │ +
1016 --levelContext.update;
│ │ │ +
1017 --levelContext.rhs;
│ │ │ +
1018 }
│ │ │ +
1019
│ │ │ +
1020 *levelContext.update += *levelContext.lhs;
│ │ │ +
1021 }
│ │ │ +
1022
│ │ │ +
1023 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
1025 {
│ │ │ + │ │ │ +
1027 }
│ │ │ +
│ │ │ +
│ │ │ +
1028
│ │ │ +
1029 template<class M, class X, class S, class PI, class A>
│ │ │ +
1030 void AMG<M,X,S,PI,A>::mgc(LevelContext& levelContext){
│ │ │ +
1031 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ +
1032 // Solve directly
│ │ │ + │ │ │ +
1034 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ +
1035 if(levelContext.redist->isSetup()) {
│ │ │ +
1036 levelContext.redist->redistribute(*levelContext.rhs, levelContext.rhs.getRedistributed());
│ │ │ +
1037 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ +
1038 // We are still participating in the computation
│ │ │ +
1039 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ +
1040 levelContext.rhs.getRedistributed());
│ │ │ +
1041 solver_->apply(levelContext.update.getRedistributed(),
│ │ │ +
1042 levelContext.rhs.getRedistributed(), res);
│ │ │ +
1043 }
│ │ │ +
1044 levelContext.redist->redistributeBackward(*levelContext.update, levelContext.update.getRedistributed());
│ │ │ +
1045 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ +
1046 }else{
│ │ │ +
1047 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs);
│ │ │ +
1048 solver_->apply(*levelContext.update, *levelContext.rhs, res);
│ │ │ +
1049 }
│ │ │ +
1050
│ │ │ +
1051 if (!res.converged)
│ │ │ +
1052 coarsesolverconverged = false;
│ │ │ +
1053 }else{
│ │ │ +
1054 // presmoothing
│ │ │ +
1055 presmooth(levelContext, preSteps_);
│ │ │ +
1056
│ │ │ +
1057#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ +
1058 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ +
1059
│ │ │ +
1060 if(processNextLevel) {
│ │ │ +
1061 // next level
│ │ │ +
1062 for(std::size_t i=0; i<gamma_; i++){
│ │ │ +
1063 mgc(levelContext);
│ │ │ +
1064 if (levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels())
│ │ │ +
1065 break;
│ │ │ +
1066 if(i+1 < gamma_){
│ │ │ +
1067 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, *levelContext.rhs);
│ │ │ +
1068 }
│ │ │ +
1069 }
│ │ │ +
1070 }
│ │ │ +
1071
│ │ │ +
1072 moveToFineLevel(levelContext, processNextLevel);
│ │ │ +
1073#else
│ │ │ +
1074 *lhs=0;
│ │ │ +
1075#endif
│ │ │ +
1076
│ │ │ +
1077 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ +
1078 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ +
1079 if(!coarsesolverconverged)
│ │ │ +
1080 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ +
1081 }
│ │ │ +
1082 // postsmoothing
│ │ │ +
1083 postsmooth(levelContext, postSteps_);
│ │ │ +
1084
│ │ │ +
1085 }
│ │ │ +
1086 }
│ │ │ +
1087
│ │ │ +
1088 template<class M, class X, class S, class PI, class A>
│ │ │ +
1089 void AMG<M,X,S,PI,A>::additiveMgc(){
│ │ │ +
1090
│ │ │ +
1091 // restrict residual to all levels
│ │ │ +
1092 typename ParallelInformationHierarchy::Iterator pinfo=matrices_->parallelInformation().finest();
│ │ │ +
1093 typename Hierarchy<Range,A>::Iterator rhs=rhs_->finest();
│ │ │ +
1094 typename Hierarchy<Domain,A>::Iterator lhs = lhs_->finest();
│ │ │ +
1095 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates=matrices_->aggregatesMaps().begin();
│ │ │ +
1096
│ │ │ +
1097 for(typename Hierarchy<Range,A>::Iterator fineRhs=rhs++; fineRhs != rhs_->coarsest(); fineRhs=rhs++, ++aggregates) {
│ │ │ +
1098 ++pinfo;
│ │ │ +
1099 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
1100 ::restrictVector(*(*aggregates), *rhs, static_cast<const Range&>(*fineRhs), *pinfo);
│ │ │ +
1101 }
│ │ │ +
1102
│ │ │ +
1103 // pinfo is invalid, set to coarsest level
│ │ │ +
1104 //pinfo = matrices_->parallelInformation().coarsest
│ │ │ +
1105 // calculate correction for all levels
│ │ │ +
1106 lhs = lhs_->finest();
│ │ │ +
1107 typename Hierarchy<Smoother,A>::Iterator smoother = smoothers_->finest();
│ │ │ +
1108
│ │ │ +
1109 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) {
│ │ │ +
1110 // presmoothing
│ │ │ +
1111 *lhs=0;
│ │ │ +
1112 smoother->apply(*lhs, *rhs);
│ │ │ +
1113 }
│ │ │ +
1114
│ │ │ +
1115 // Coarse level solve
│ │ │ +
1116#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ +
1117 InverseOperatorResult res;
│ │ │ +
1118 pinfo->copyOwnerToAll(*rhs, *rhs);
│ │ │ +
1119 solver_->apply(*lhs, *rhs, res);
│ │ │ +
1120
│ │ │ +
1121 if(!res.converged)
│ │ │ +
1122 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ +
1123#else
│ │ │ +
1124 *lhs=0;
│ │ │ +
1125#endif
│ │ │ +
1126 // Prologate and add up corrections from all levels
│ │ │ +
1127 --pinfo;
│ │ │ +
1128 --aggregates;
│ │ │ +
1129
│ │ │ +
1130 for(typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--; coarseLhs != lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) {
│ │ │ +
1131 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
1132 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo);
│ │ │ +
1133 }
│ │ │ +
1134 }
│ │ │ +
1135
│ │ │ +
1136
│ │ │ +
1138 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ +
1139 void AMG<M,X,S,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ +
1140 {
│ │ │ +
1141 // Postprocess all smoothers
│ │ │ +
1142 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ +
1143 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ +
1144 Iterator coarsest = smoothers_->coarsest();
│ │ │ +
1145 Iterator smoother = smoothers_->finest();
│ │ │ +
1146 DIterator lhs = lhs_->finest();
│ │ │ +
1147 if(smoothers_->levels()>0) {
│ │ │ +
1148 if(smoother != coarsest || matrices_->levels()<matrices_->maxlevels())
│ │ │ +
1149 smoother->post(*lhs);
│ │ │ +
1150 if(smoother!=coarsest)
│ │ │ +
1151 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs)
│ │ │ +
1152 smoother->post(*lhs);
│ │ │ +
1153 smoother->post(*lhs);
│ │ │ +
1154 }
│ │ │ +
1155 lhs_ = nullptr;
│ │ │ +
1156 update_ = nullptr;
│ │ │ +
1157 rhs_ = nullptr;
│ │ │ +
1158 }
│ │ │ +
│ │ │ +
1159
│ │ │ +
1160 template<class M, class X, class S, class PI, class A>
│ │ │ +
1161 template<class A1>
│ │ │ +
│ │ │ +
1162 void AMG<M,X,S,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ +
1163 {
│ │ │ +
1164 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ +
1165 }
│ │ │ +
│ │ │ +
1166
│ │ │ +
1167 } // end namespace Amg
│ │ │ +
1168
│ │ │ +
│ │ │ + │ │ │ +
1170 template<class> struct isValidBlockType : std::false_type{};
│ │ │ +
1171 template<class T, int n, int m> struct isValidBlockType<FieldMatrix<T,n,m>> : std::true_type{};
│ │ │ +
1172
│ │ │ +
1173 template<class OP>
│ │ │ +
1174 std::shared_ptr<Dune::Preconditioner<typename OP::element_type::domain_type, typename OP::element_type::range_type> >
│ │ │ +
│ │ │ +
1175 makeAMG(const OP& op, const std::string& smoother, const Dune::ParameterTree& config) const
│ │ │ +
1176 {
│ │ │ +
1177 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG");
│ │ │ +
1178 }
│ │ │ +
│ │ │ +
1179
│ │ │ +
1180 template<class M, class X, class Y>
│ │ │ +
1181 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ +
│ │ │ +
1182 makeAMG(const std::shared_ptr<MatrixAdapter<M,X,Y>>& op, const std::string& smoother,
│ │ │ +
1183 const Dune::ParameterTree& config) const
│ │ │ +
1184 {
│ │ │ +
1185 using OP = MatrixAdapter<M,X,Y>;
│ │ │ +
1186
│ │ │ +
1187 if(smoother == "ssor")
│ │ │ +
1188 return std::make_shared<Amg::AMG<OP, X, SeqSSOR<M,X,Y>>>(op, config);
│ │ │ +
1189 if(smoother == "sor")
│ │ │ +
1190 return std::make_shared<Amg::AMG<OP, X, SeqSOR<M,X,Y>>>(op, config);
│ │ │ +
1191 if(smoother == "jac")
│ │ │ +
1192 return std::make_shared<Amg::AMG<OP, X, SeqJac<M,X,Y>>>(op, config);
│ │ │ +
1193 if(smoother == "gs")
│ │ │ +
1194 return std::make_shared<Amg::AMG<OP, X, SeqGS<M,X,Y>>>(op, config);
│ │ │ +
1195 if(smoother == "ilu")
│ │ │ +
1196 return std::make_shared<Amg::AMG<OP, X, SeqILU<M,X,Y>>>(op, config);
│ │ │ +
1197 else
│ │ │ +
1198 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ +
1199 }
│ │ │ +
│ │ │ +
1200
│ │ │ +
1201 template<class M, class X, class Y, class C>
│ │ │ +
1202 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ +
│ │ │ +
1203 makeAMG(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ +
1204 const Dune::ParameterTree& config) const
│ │ │ +
1205 {
│ │ │ + │ │ │ +
1207
│ │ │ +
1208 auto cop = std::static_pointer_cast<const OP>(op);
│ │ │ +
1209
│ │ │ +
1210 if(smoother == "ssor")
│ │ │ +
1211 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1212 if(smoother == "sor")
│ │ │ +
1213 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1214 if(smoother == "jac")
│ │ │ +
1215 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqJac<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1216 if(smoother == "gs")
│ │ │ +
1217 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqGS<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1218 if(smoother == "ilu")
│ │ │ +
1219 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqILU<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1220 else
│ │ │ +
1221 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ +
1222 }
│ │ │ +
│ │ │ +
1223
│ │ │ +
1224 template<class M, class X, class Y, class C>
│ │ │ +
1225 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ +
│ │ │ +
1226 makeAMG(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ +
1227 const Dune::ParameterTree& config) const
│ │ │ +
1228 {
│ │ │ + │ │ │ +
1230
│ │ │ +
1231 if(smoother == "ssor")
│ │ │ +
1232 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1233 if(smoother == "sor")
│ │ │ +
1234 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1235 if(smoother == "jac")
│ │ │ +
1236 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqJac<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1237 if(smoother == "gs")
│ │ │ +
1238 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqGS<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1239 if(smoother == "ilu")
│ │ │ +
1240 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqILU<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1241 else
│ │ │ +
1242 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ +
1243 }
│ │ │ +
│ │ │ +
1244
│ │ │ +
1245 template<typename TL, typename OP>
│ │ │ +
1246 std::shared_ptr<Dune::Preconditioner<typename Dune::TypeListElement<1, TL>::type,
│ │ │ +
1247 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ +
│ │ │ +
1248 operator() (TL tl, const std::shared_ptr<OP>& op, const Dune::ParameterTree& config,
│ │ │ + │ │ │ +
1250 {
│ │ │ +
1251 using field_type = typename OP::matrix_type::field_type;
│ │ │ +
1252 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ +
1253 if (!std::is_convertible<field_type, real_type>())
│ │ │ +
1254 DUNE_THROW(UnsupportedType, "AMG needs field_type(" <<
│ │ │ +
1255 className<field_type>() <<
│ │ │ +
1256 ") to be convertible to its real_type (" <<
│ │ │ +
1257 className<real_type>() <<
│ │ │ +
1258 ").");
│ │ │ +
1259 std::string smoother = config.get("smoother", "ssor");
│ │ │ +
1260 return makeAMG(op, smoother, config);
│ │ │ +
1261 }
│ │ │ +
│ │ │ +
1262
│ │ │ +
1263 template<typename TL, typename OP>
│ │ │ +
1264 std::shared_ptr<Dune::Preconditioner<typename Dune::TypeListElement<1, TL>::type,
│ │ │ +
1265 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ +
│ │ │ +
1266 operator() (TL /*tl*/, const std::shared_ptr<OP>& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ + │ │ │ +
1268 {
│ │ │ +
1269 DUNE_THROW(UnsupportedType, "AMG needs a FieldMatrix as Matrix block_type");
│ │ │ +
1270 }
│ │ │ +
│ │ │ +
1271 };
│ │ │ +
│ │ │ +
1272
│ │ │ + │ │ │ +
1274} // end namespace Dune
│ │ │ +
1275
│ │ │ +
1276#endif
│ │ │
│ │ │ -
560 };
│ │ │
│ │ │ -
561 };
│ │ │
│ │ │ -
562
│ │ │ -
566}
│ │ │ -
567
│ │ │ -
568#endif
│ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Define base class for scalar product and norm.
│ │ │ - │ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ -
STL namespace.
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
Prolongation and restriction for amg.
│ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ +
Classes for the generic construction and application of the smoothers.
│ │ │ +
Define base class for scalar product and norm.
│ │ │ +
Classes for using UMFPack with ISTL matrices.
│ │ │ +
Templates characterizing the type of a solver.
│ │ │ +
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:16
│ │ │ +
Implementations of the inverse operator interface.
│ │ │ +
Classes for using SuperLU with ISTL matrices.
│ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ +
AMG(const AMG &amg)
Copy constructor.
Definition amg.hh:392
│ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition amg.hh:801
│ │ │ +
static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector)
Definition amg.hh:681
│ │ │ +
static std::string name()
Definition amg.hh:680
│ │ │ +
Hierarchy< Domain, A >::Iterator update
The iterator over the updates.
Definition amg.hh:303
│ │ │ +
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition amg.hh:307
│ │ │ +
static std::string name()
Definition amg.hh:672
│ │ │ +
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition amg.hh:1024
│ │ │ +
X Domain
The domain type.
Definition amg.hh:87
│ │ │ +
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:644
│ │ │ +
AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms)
Construct a new amg with a specific coarse solver.
Definition amg.hh:406
│ │ │ +
AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree &configuration, const ParallelInformation &pinfo=ParallelInformation())
Constructor an AMG via ParameterTree.
Definition amg.hh:452
│ │ │ +
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition amg.hh:287
│ │ │ +
SolverType
Definition amg.hh:627
│ │ │ +
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition amg.hh:295
│ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ +
Solver< Matrix, solver > SelectedSolver
Definition amg.hh:677
│ │ │ +
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< MatrixAdapter< M, X, Y > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1182
│ │ │ +
std::string operator()(const std::string &str)
Definition amg.hh:378
│ │ │ +
std::shared_ptr< Dune::Preconditioner< typename OP::element_type::domain_type, typename OP::element_type::range_type > > makeAMG(const OP &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1175
│ │ │ +
S Smoother
The type of the smoother.
Definition amg.hh:97
│ │ │ +
static std::string name()
Definition amg.hh:649
│ │ │ +
Hierarchy< Smoother, A >::Iterator smoother
The iterator over the smoothers.
Definition amg.hh:279
│ │ │ +
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ +
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition amg.hh:283
│ │ │ + │ │ │ +
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:668
│ │ │ +
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition amg.hh:291
│ │ │ +
X Range
The range type.
Definition amg.hh:89
│ │ │ +
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ +
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition amg.hh:1162
│ │ │ +
std::size_t levels()
Definition amg.hh:876
│ │ │ +
InverseOperator< Vector, Vector > type
Definition amg.hh:643
│ │ │ +
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1203
│ │ │ +
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition amg.hh:299
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ +
static constexpr SolverType solver
Definition amg.hh:629
│ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
static constexpr bool isDirectSolver
Definition amg.hh:679
│ │ │ +
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition amg.hh:221
│ │ │ +
Matrix::field_type field_type
Definition amg.hh:626
│ │ │ +
SelectedSolver::type DirectSolver
Definition amg.hh:678
│ │ │ +
std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL tl, const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std::enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, int >=0) const
Definition amg.hh:1248
│ │ │ +
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition amg.hh:84
│ │ │ +
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition amg.hh:91
│ │ │ +
void post(Domain &x)
Clean up.
Definition amg.hh:1139
│ │ │ +
std::size_t maxlevels()
Definition amg.hh:881
│ │ │ +
std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, const Dune::ParameterTree &config) const
Definition amg.hh:1226
│ │ │ +
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ +
std::size_t level
The level index.
Definition amg.hh:311
│ │ │ +
AMG(const Operator &fineOperator, const C &criterion, const SmootherArgs &smootherArgs=SmootherArgs(), const ParallelInformation &pinfo=ParallelInformation())
Construct an AMG with an inexact coarse solver based on the smoother.
Definition amg.hh:428
│ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition amg.hh:888
│ │ │ +
Smoother SmootherType
Definition amg.hh:275
│ │ │ +
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition amg.hh:82
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ +
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │ +
@ none
Definition amg.hh:627
│ │ │ +
@ umfpack
Definition amg.hh:627
│ │ │ +
@ superlu
Definition amg.hh:627
│ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ +
@ noAccu
No data accumulution.
Definition parameters.hh:237
│ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │
Definition allocator.hh:11
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ -
Thrown when a solver aborts due to some problem.
Definition istlexception.hh:46
│ │ │ -
A linear operator.
Definition operators.hh:69
│ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ +
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ +
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ +
Definition matrixutils.hh:27
│ │ │ +
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ +
Adapter to turn a matrix into a linear operator.
Definition operators.hh:136
│ │ │ +
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:379
│ │ │ +
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:463
│ │ │ +
Definition aggregates.hh:480
│ │ │ +
Definition aggregates.hh:496
│ │ │ +
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:519
│ │ │ +
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:539
│ │ │ +
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ +
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ +
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ +
Definition amg.hh:625
│ │ │ + │ │ │ +
Definition amg.hh:1169
│ │ │ + │ │ │ +
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ + │ │ │ +
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ +
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ +
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ +
X::field_type field_type
The field type of the preconditioner.
Definition preconditioner.hh:40
│ │ │
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ -
Default implementation for the scalar case.
Definition scalarproducts.hh:168
│ │ │
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
InverseOperatorResult()
Default constructor.
Definition solver.hh:52
│ │ │ -
double condition_estimate
Estimate of condition number.
Definition solver.hh:81
│ │ │ -
double elapsed
Elapsed time in seconds.
Definition solver.hh:84
│ │ │ -
int iterations
Number of iterations.
Definition solver.hh:69
│ │ │ -
double reduction
Reduction achieved: .
Definition solver.hh:72
│ │ │ -
void clear()
Resets all data.
Definition solver.hh:58
│ │ │ -
double conv_rate
Convergence rate (average reduction per step)
Definition solver.hh:78
│ │ │
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
void printHeader(std::ostream &s) const
helper function for printing header of solver output
Definition solver.hh:165
│ │ │ -
virtual ~InverseOperator()
Destructor.
Definition solver.hh:158
│ │ │ -
void printOutput(std::ostream &s, const CountType &iter, const DataType &norm) const
helper function for printing solver output
Definition solver.hh:187
│ │ │ -
void printOutput(std::ostream &s, const CountType &iter, const DataType &norm, const DataType &norm_old) const
helper function for printing solver output
Definition solver.hh:174
│ │ │ -
virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)=0
apply inverse operator, with given convergence criteria.
│ │ │ -
Simd::Scalar< real_type > scalar_real_type
scalar type underlying the field_type
Definition solver.hh:116
│ │ │ -
Y range_type
Type of the range of the operator to be inverted.
Definition solver.hh:107
│ │ │ -
@ normSpacing
Definition solver.hh:162
│ │ │ -
@ iterationSpacing
Definition solver.hh:162
│ │ │ -
X domain_type
Type of the domain of the operator to be inverted.
Definition solver.hh:104
│ │ │ -
virtual void apply(X &x, Y &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │ -
X::field_type field_type
The field type of the operator.
Definition solver.hh:110
│ │ │ -
FieldTraits< field_type >::real_type real_type
The real type of the field type (is the same if using real numbers, but differs for std::complex)
Definition solver.hh:113
│ │ │ -
virtual SolverCategory::Category category() const =0
Category of the solver (see SolverCategory::Category)
│ │ │ -
Base class for all implementations of iterative solvers.
Definition solver.hh:205
│ │ │ -
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solver.hh:315
│ │ │ -
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solver.hh:292
│ │ │ -
virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res)
Apply inverse operator with given reduction factor.
Definition solver.hh:376
│ │ │ -
std::shared_ptr< const ScalarProduct< X > > _sp
Definition solver.hh:508
│ │ │ -
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, Y > > prec, scalar_real_type reduction, int maxit, int verbose)
General constructor to initialize an iterative solver.
Definition solver.hh:342
│ │ │ -
std::string name() const
Definition solver.hh:390
│ │ │ -
IterativeSolver(const LinearOperator< X, Y > &op, Preconditioner< X, Y > &prec, scalar_real_type reduction, int maxit, int verbose)
General constructor to initialize an iterative solver.
Definition solver.hh:232
│ │ │ -
std::shared_ptr< const LinearOperator< X, Y > > _op
Definition solver.hh:506
│ │ │ -
int _maxit
Definition solver.hh:510
│ │ │ -
int _verbose
Definition solver.hh:511
│ │ │ -
scalar_real_type _reduction
Definition solver.hh:509
│ │ │ -
IterativeSolver(const LinearOperator< X, Y > &op, const ScalarProduct< X > &sp, Preconditioner< X, Y > &prec, scalar_real_type reduction, int maxit, int verbose)
General constructor to initialize an iterative solver.
Definition solver.hh:264
│ │ │ -
SolverCategory::Category _category
Definition solver.hh:512
│ │ │ -
std::shared_ptr< Preconditioner< X, Y > > _prec
Definition solver.hh:507
│ │ │ -
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition solver.hh:385
│ │ │ -
Class for controlling iterative methods.
Definition solver.hh:413
│ │ │ -
Iteration(const IterativeSolver &parent, InverseOperatorResult &res)
Definition solver.hh:415
│ │ │ -
Iteration(Iteration &&other)
Definition solver.hh:430
│ │ │ -
InverseOperatorResult & _res
Definition solver.hh:500
│ │ │ -
const IterativeSolver & _parent
Definition solver.hh:501
│ │ │ -
Timer _watch
Definition solver.hh:499
│ │ │ -
Iteration(const Iteration &)=delete
│ │ │ -
CountType _i
Definition solver.hh:498
│ │ │ -
real_type _def0
Definition solver.hh:497
│ │ │ -
bool step(CountType i, real_type def)
registers the iteration step, checks for invalid defect norm and convergence.
Definition solver.hh:457
│ │ │ -
void finalize()
Definition solver.hh:482
│ │ │ -
real_type _def
Definition solver.hh:497
│ │ │ -
~Iteration()
Definition solver.hh:442
│ │ │ -
bool _valid
Definition solver.hh:502
│ │ │ -
Helper class for notifying a DUNE-ISTL linear solver about a change of the iteration matrix object in...
Definition solver.hh:524
│ │ │ -
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:526
│ │ │ -
Implementation that works together with iterative ISTL solvers, e.g. Dune::CGSolver or Dune::BiCGSTAB...
Definition solver.hh:542
│ │ │ -
static void setMatrix(ISTLLinearSolver &, const BCRSMatrix &)
Definition solver.hh:543
│ │ │ -
static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix)
Definition solver.hh:555
│ │ │
Categories for the solvers.
Definition solvercategory.hh:22
│ │ │
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │
Definition solvercategory.hh:54
│ │ │ +
Definition solverregistry.hh:77
│ │ │
Definition solvertype.hh:16
│ │ │ +
SuperLu Solver.
Definition superlu.hh:271
│ │ │ +
Definition umfpack.hh:52
│ │ │ +
The UMFPack direct sparse solver.
Definition umfpack.hh:258
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,644 +1,1593 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -solver.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +amg.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5 │ │ │ │ -6#ifndef DUNE_ISTL_SOLVER_HH │ │ │ │ -7#define DUNE_ISTL_SOLVER_HH │ │ │ │ -8 │ │ │ │ -9#include // DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ -10 │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15 │ │ │ │ -16#include │ │ │ │ -17#include │ │ │ │ -18#include │ │ │ │ -19#include │ │ │ │ -20#include │ │ │ │ -21#include │ │ │ │ -22 │ │ │ │ -23#include "_s_o_l_v_e_r_t_y_p_e_._h_h" │ │ │ │ -24#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h" │ │ │ │ -25#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ -26#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ -27 │ │ │ │ -28namespace _D_u_n_e │ │ │ │ -29{ │ │ │ │ -_4_9 struct _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -50 { │ │ │ │ -_5_2 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t () │ │ │ │ -53 { │ │ │ │ -54 _c_l_e_a_r(); │ │ │ │ -55 } │ │ │ │ -56 │ │ │ │ -_5_8 void _c_l_e_a_r () │ │ │ │ -59 { │ │ │ │ -60 _i_t_e_r_a_t_i_o_n_s = 0; │ │ │ │ -61 _r_e_d_u_c_t_i_o_n = 0; │ │ │ │ -62 _c_o_n_v_e_r_g_e_d = false; │ │ │ │ -63 _c_o_n_v___r_a_t_e = 1; │ │ │ │ -64 _e_l_a_p_s_e_d = 0; │ │ │ │ -65 _c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e = -1; │ │ │ │ -66 } │ │ │ │ -67 │ │ │ │ -_6_9 int _i_t_e_r_a_t_i_o_n_s; │ │ │ │ +5#ifndef DUNE_AMG_AMG_HH │ │ │ │ +6#define DUNE_AMG_AMG_HH │ │ │ │ +7 │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ +15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ +16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ +17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ +19#include │ │ │ │ +20#include │ │ │ │ +21#include │ │ │ │ +22#include │ │ │ │ +23#include │ │ │ │ +24 │ │ │ │ +25namespace _D_u_n_e │ │ │ │ +26{ │ │ │ │ +27 namespace Amg │ │ │ │ +28 { │ │ │ │ +46 template │ │ │ │ +47 class KAMG; │ │ │ │ +48 │ │ │ │ +49 template │ │ │ │ +50 class KAmgTwoGrid; │ │ │ │ +51 │ │ │ │ +62 template > │ │ │ │ +_6_4 class _A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +65 { │ │ │ │ +66 template │ │ │ │ +_6_7 friend class _K_A_M_G; │ │ │ │ +68 │ │ │ │ +69 friend class _K_A_m_g_T_w_o_G_r_i_d<_A_M_G>; │ │ │ │ 70 │ │ │ │ -_7_2 double _r_e_d_u_c_t_i_o_n; │ │ │ │ -73 │ │ │ │ -_7_5 bool _c_o_n_v_e_r_g_e_d; │ │ │ │ -76 │ │ │ │ -_7_8 double _c_o_n_v___r_a_t_e; │ │ │ │ -79 │ │ │ │ -_8_1 double _c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e = -1; │ │ │ │ -82 │ │ │ │ -_8_4 double _e_l_a_p_s_e_d; │ │ │ │ -85 }; │ │ │ │ -86 │ │ │ │ -87 │ │ │ │ -88 //===================================================================== │ │ │ │ -100 template │ │ │ │ -_1_0_1 class _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r { │ │ │ │ -102 public: │ │ │ │ -_1_0_4 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -105 │ │ │ │ -_1_0_7 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -108 │ │ │ │ -_1_1_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -111 │ │ │ │ -_1_1_3 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ -114 │ │ │ │ -_1_1_6 typedef Simd::Scalar _s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ -117 │ │ │ │ -_1_3_0 virtual void _a_p_p_l_y (X& x, Y& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) = 0; │ │ │ │ -131 │ │ │ │ -_1_4_5 virtual void _a_p_p_l_y (X& x, Y& b, double reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ -res) = 0; │ │ │ │ -146 │ │ │ │ -_1_4_8 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -149#ifdef DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ -150 { │ │ │ │ -151 DUNE_THROW(Dune::Exception,"It is necessary to implement the category │ │ │ │ -method in a derived classes, in the future this method will pure virtual."); │ │ │ │ -152 } │ │ │ │ -153#else │ │ │ │ -154 = 0; │ │ │ │ -155#endif │ │ │ │ -156 │ │ │ │ -_1_5_8 virtual _~_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r () {} │ │ │ │ -159 │ │ │ │ -160 protected: │ │ │ │ -161 // spacing values │ │ │ │ -_1_6_2 enum { _i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g = 5 , _n_o_r_m_S_p_a_c_i_n_g = 16 }; │ │ │ │ -163 │ │ │ │ -_1_6_5 void _p_r_i_n_t_H_e_a_d_e_r(std::ostream& s) const │ │ │ │ -166 { │ │ │ │ -167 s << std::setw(_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g) << " Iter"; │ │ │ │ -168 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << "Defect"; │ │ │ │ -169 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << "Rate" << std::endl; │ │ │ │ -170 } │ │ │ │ -171 │ │ │ │ -173 template │ │ │ │ -_1_7_4 void _p_r_i_n_t_O_u_t_p_u_t(std::ostream& s, │ │ │ │ -175 const CountType& iter, │ │ │ │ -176 const DataType& norm, │ │ │ │ -177 const DataType& norm_old) const │ │ │ │ -178 { │ │ │ │ -179 const DataType rate = norm/norm_old; │ │ │ │ -180 s << std::setw(_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g) << iter << " "; │ │ │ │ -181 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << Simd::io(norm) << " "; │ │ │ │ -182 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << Simd::io(rate) << std::endl; │ │ │ │ -183 } │ │ │ │ -184 │ │ │ │ -186 template │ │ │ │ -_1_8_7 void _p_r_i_n_t_O_u_t_p_u_t(std::ostream& s, │ │ │ │ -188 const CountType& iter, │ │ │ │ -189 const DataType& norm) const │ │ │ │ -190 { │ │ │ │ -191 s << std::setw(_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g) << iter << " "; │ │ │ │ -192 s << std::setw(_n_o_r_m_S_p_a_c_i_n_g) << Simd::io(norm) << std::endl; │ │ │ │ -193 } │ │ │ │ -194 }; │ │ │ │ -195 │ │ │ │ -204 template │ │ │ │ -_2_0_5 class _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r{ │ │ │ │ -206 public: │ │ │ │ -207 using typename _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_Y_>_:_:_d_o_m_a_i_n___t_y_p_e; │ │ │ │ -208 using typename _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_Y_>_:_:_r_a_n_g_e___t_y_p_e; │ │ │ │ -209 using typename _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_Y_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -210 using typename _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_Y_>_:_:_r_e_a_l___t_y_p_e; │ │ │ │ -211 using typename _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_Y_>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e; │ │ │ │ +71 public: │ │ │ │ +_7_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ +_8_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +_8_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ +_8_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ +85 │ │ │ │ +_8_7 typedef X _D_o_m_a_i_n; │ │ │ │ +_8_9 typedef X _R_a_n_g_e; │ │ │ │ +_9_1 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_X_> _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ +_9_7 typedef S _S_m_o_o_t_h_e_r; │ │ │ │ +98 │ │ │ │ +_1_0_0 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ +101 │ │ │ │ +_1_1_1 _A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ +112 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& parms); │ │ │ │ +113 │ │ │ │ +125 template │ │ │ │ +_1_2_6 _A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ +127 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs=_S_m_o_o_t_h_e_r_A_r_g_s(), │ │ │ │ +128 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ +129 │ │ │ │ +_1_8_0 _A_M_G(std::shared_ptr fineOperator, const ParameterTree& │ │ │ │ +configuration, const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ +181 │ │ │ │ +_1_8_5 _A_M_G(const _A_M_G& amg); │ │ │ │ +186 │ │ │ │ +_1_8_8 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ +189 │ │ │ │ +_1_9_1 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ +192 │ │ │ │ +_1_9_4 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ +195 { │ │ │ │ +196 return category_; │ │ │ │ +197 } │ │ │ │ +198 │ │ │ │ +_2_0_0 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ +201 │ │ │ │ +206 template │ │ │ │ +_2_0_7 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont); │ │ │ │ +208 │ │ │ │ +_2_0_9 std::size_t _l_e_v_e_l_s(); │ │ │ │ +210 │ │ │ │ +_2_1_1 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ 212 │ │ │ │ -_2_3_2 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_Y_>& op, _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>& prec, │ │ │ │ -_s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose) : │ │ │ │ -233 ___o_p(stackobject_to_shared_ptr(op)), │ │ │ │ -234 ___p_r_e_c(stackobject_to_shared_ptr(prec)), │ │ │ │ -235 ___s_p(new _S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t), │ │ │ │ -236 ___r_e_d_u_c_t_i_o_n(reduction), ___m_a_x_i_t(maxit), ___v_e_r_b_o_s_e(verbose), ___c_a_t_e_g_o_r_y │ │ │ │ -(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::sequential) │ │ │ │ -237 { │ │ │ │ -238 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(op) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l) │ │ │ │ -239 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "LinearOperator has to be sequential!"); │ │ │ │ -240 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(prec) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l) │ │ │ │ -241 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "Preconditioner has to be sequential!"); │ │ │ │ -242 } │ │ │ │ -243 │ │ │ │ -_2_6_4 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r (const _L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_X_,_Y_>& op, const _S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>& sp, │ │ │ │ -_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>& prec, │ │ │ │ -265 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose) : │ │ │ │ -266 ___o_p(stackobject_to_shared_ptr(op)), │ │ │ │ -267 ___p_r_e_c(stackobject_to_shared_ptr(prec)), │ │ │ │ -268 ___s_p(stackobject_to_shared_ptr(sp)), │ │ │ │ -269 ___r_e_d_u_c_t_i_o_n(reduction), ___m_a_x_i_t(maxit), ___v_e_r_b_o_s_e(verbose), ___c_a_t_e_g_o_r_y │ │ │ │ -(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::_c_a_t_e_g_o_r_y(op)) │ │ │ │ -270 { │ │ │ │ -271 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(op) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(prec)) │ │ │ │ -272 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "LinearOperator and Preconditioner must │ │ │ │ -have the same SolverCategory!"); │ │ │ │ -273 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(op) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(sp)) │ │ │ │ -274 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "LinearOperator and ScalarProduct must │ │ │ │ -have the same SolverCategory!"); │ │ │ │ -275 } │ │ │ │ -276 │ │ │ │ -_2_9_2 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r (std::shared_ptr > op, std:: │ │ │ │ -shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_> > prec, const ParameterTree& configuration) : │ │ │ │ -293 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,_s_t_d::make_shared<_S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t>(),prec, │ │ │ │ -294 configuration._g_e_t<_r_e_a_l___t_y_p_e>("reduction"), │ │ │ │ -295 configuration._g_e_t("maxit"), │ │ │ │ -296 configuration._g_e_t("verbose")) │ │ │ │ -297 {} │ │ │ │ -298 │ │ │ │ -_3_1_5 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r (std::shared_ptr > op, std:: │ │ │ │ -shared_ptr > sp, std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_> > │ │ │ │ -prec, const ParameterTree& configuration) : │ │ │ │ -316 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op,sp,prec, │ │ │ │ -317 configuration._g_e_t<_s_c_a_l_a_r___r_e_a_l___t_y_p_e>("reduction"), │ │ │ │ -318 configuration._g_e_t("maxit"), │ │ │ │ -319 configuration._g_e_t("verbose")) │ │ │ │ -320 {} │ │ │ │ -321 │ │ │ │ -_3_4_2 _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -343 std::shared_ptr> sp, │ │ │ │ -344 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>> prec, │ │ │ │ -345 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose) : │ │ │ │ -346 ___o_p(op), │ │ │ │ -347 ___p_r_e_c(prec), │ │ │ │ -348 ___s_p(sp), │ │ │ │ -349 ___r_e_d_u_c_t_i_o_n(reduction), ___m_a_x_i_t(maxit), ___v_e_r_b_o_s_e(verbose), │ │ │ │ -350 ___c_a_t_e_g_o_r_y(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::_c_a_t_e_g_o_r_y(*op)) │ │ │ │ -351 { │ │ │ │ -352 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(*op) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(*prec)) │ │ │ │ -353 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "LinearOperator and Preconditioner must │ │ │ │ -have the same SolverCategory!"); │ │ │ │ -354 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(*op) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(*sp)) │ │ │ │ -355 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "LinearOperator and ScalarProduct must │ │ │ │ -have the same SolverCategory!"); │ │ │ │ -356 } │ │ │ │ -357 │ │ │ │ -358 // #warning actually we want to have this as the default and just implement │ │ │ │ -the second one │ │ │ │ -359 // //! \copydoc InverseOperator::apply(X&,Y&,InverseOperatorResult&) │ │ │ │ -360 // virtual void apply (X& x, Y& b, InverseOperatorResult& res) │ │ │ │ -361 // { │ │ │ │ -362 // apply(x,b,_reduction,res); │ │ │ │ -363 // } │ │ │ │ -364 │ │ │ │ -365#ifndef DOXYGEN │ │ │ │ -366 // make sure the three-argument apply from the base class does not get │ │ │ │ -shadowed │ │ │ │ -367 // by the redefined four-argument version below │ │ │ │ -368 using _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y; │ │ │ │ -369#endif │ │ │ │ -370 │ │ │ │ -_3_7_6 virtual void _a_p_p_l_y (X& x, X& b, double reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ -res) │ │ │ │ +_2_2_1 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ +222 { │ │ │ │ +223 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ +224 } │ │ │ │ +225 │ │ │ │ +_2_3_0 bool _u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const; │ │ │ │ +231 │ │ │ │ +232 private: │ │ │ │ +233 /* │ │ │ │ +234 * @brief Helper function to create hierarchies with parameter tree. │ │ │ │ +235 * │ │ │ │ +236 * Will create the coarsen criterion with the norm and create the │ │ │ │ +237 * Hierarchies │ │ │ │ +238 * \tparam Norm Type of the norm to use. │ │ │ │ +239 */ │ │ │ │ +240 template │ │ │ │ +241 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ +matrixptr, │ │ │ │ +242 const PI& pinfo, const Norm&, │ │ │ │ +243 const ParameterTree& configuration, │ │ │ │ +244 std::true_type compiles = std::true_type()); │ │ │ │ +245 template │ │ │ │ +246 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ +matrixptr, │ │ │ │ +247 const PI& pinfo, const Norm&, │ │ │ │ +248 const ParameterTree& configuration, │ │ │ │ +249 std::false_type); │ │ │ │ +254 template │ │ │ │ +255 void createHierarchies(C& criterion, std::shared_ptr │ │ │ │ +matrixptr, │ │ │ │ +256 const PI& pinfo, const ParameterTree& configuration); │ │ │ │ +263 template │ │ │ │ +264 void createHierarchies(C& criterion, │ │ │ │ +265 const std::shared_ptr& matrixptr, │ │ │ │ +266 const PI& pinfo); │ │ │ │ +273 struct LevelContext │ │ │ │ +274 { │ │ │ │ +_2_7_5 typedef _S_m_o_o_t_h_e_r _S_m_o_o_t_h_e_r_T_y_p_e; │ │ │ │ +_2_7_9 typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r _s_m_o_o_t_h_e_r; │ │ │ │ +_2_8_3 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ +_2_8_7 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r _p_i_n_f_o; │ │ │ │ +_2_9_1 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ +_2_9_5 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ +_2_9_9 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _l_h_s; │ │ │ │ +_3_0_3 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _u_p_d_a_t_e; │ │ │ │ +_3_0_7 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r _r_h_s; │ │ │ │ +_3_1_1 std::size_t _l_e_v_e_l; │ │ │ │ +312 }; │ │ │ │ +313 │ │ │ │ +314 │ │ │ │ +319 void mgc(LevelContext& levelContext); │ │ │ │ +320 │ │ │ │ +321 void additiveMgc(); │ │ │ │ +322 │ │ │ │ +329 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel); │ │ │ │ +330 │ │ │ │ +335 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ +336 │ │ │ │ +341 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ +342 │ │ │ │ +344 std::shared_ptr matrices_; │ │ │ │ +346 _S_m_o_o_t_h_e_r_A_r_g_s smootherArgs_; │ │ │ │ +348 std::shared_ptr > smoothers_; │ │ │ │ +350 std::shared_ptr solver_; │ │ │ │ +352 std::shared_ptr> rhs_; │ │ │ │ +354 std::shared_ptr> lhs_; │ │ │ │ +356 std::shared_ptr> update_; │ │ │ │ +358 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ +360 std::shared_ptr scalarProduct_; │ │ │ │ +362 std::size_t gamma_; │ │ │ │ +364 std::size_t preSteps_; │ │ │ │ +366 std::size_t postSteps_; │ │ │ │ +367 bool buildHierarchy_; │ │ │ │ +368 bool additive; │ │ │ │ +369 bool coarsesolverconverged; │ │ │ │ +370 std::shared_ptr coarseSmoother_; │ │ │ │ +372 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ +374 std::size_t verbosity_; │ │ │ │ +375 │ │ │ │ +376 struct ToLower │ │ │ │ 377 { │ │ │ │ -378 _s_c_a_l_a_r___r_e_a_l___t_y_p_e saved_reduction = ___r_e_d_u_c_t_i_o_n; │ │ │ │ -379 ___r_e_d_u_c_t_i_o_n = reduction; │ │ │ │ -380 this->_a_p_p_l_y(x,b,res); │ │ │ │ -381 ___r_e_d_u_c_t_i_o_n = saved_reduction; │ │ │ │ -382 } │ │ │ │ -383 │ │ │ │ -_3_8_5 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -386 { │ │ │ │ -387 return ___c_a_t_e_g_o_r_y; │ │ │ │ -388 } │ │ │ │ -389 │ │ │ │ -_3_9_0 std::string _n_a_m_e() const{ │ │ │ │ -391 std::string _n_a_m_e = className(*this); │ │ │ │ -392 return _n_a_m_e.substr(0, _n_a_m_e.find("<")); │ │ │ │ -393 } │ │ │ │ -394 │ │ │ │ -412 template │ │ │ │ -_4_1_3 class _I_t_e_r_a_t_i_o_n { │ │ │ │ -414 public: │ │ │ │ -_4_1_5 _I_t_e_r_a_t_i_o_n(const _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r& parent, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ -416 : ___i(0) │ │ │ │ -417 , ___r_e_s(res) │ │ │ │ -418 , ___p_a_r_e_n_t(parent) │ │ │ │ -419 , ___v_a_l_i_d(true) │ │ │ │ -420 { │ │ │ │ -421 res._c_l_e_a_r(); │ │ │ │ -422 if(___p_a_r_e_n_t.___v_e_r_b_o_s_e>0){ │ │ │ │ -423 std::cout << "=== " << parent._n_a_m_e() << std::endl; │ │ │ │ -424 if(___p_a_r_e_n_t.___v_e_r_b_o_s_e > 1) │ │ │ │ -425 ___p_a_r_e_n_t._p_r_i_n_t_H_e_a_d_e_r(std::cout); │ │ │ │ -426 } │ │ │ │ -427 } │ │ │ │ -428 │ │ │ │ -_4_2_9 _I_t_e_r_a_t_i_o_n(const _I_t_e_r_a_t_i_o_n&) = delete; │ │ │ │ -_4_3_0 _I_t_e_r_a_t_i_o_n(_I_t_e_r_a_t_i_o_n&& other) │ │ │ │ -431 : ___d_e_f_0(other.___d_e_f_0) │ │ │ │ -432 , ___d_e_f(other.___d_e_f) │ │ │ │ -433 , ___i(other.___i) │ │ │ │ -434 , ___w_a_t_c_h(other.___w_a_t_c_h) │ │ │ │ -435 , ___r_e_s(other.___r_e_s) │ │ │ │ -436 , ___p_a_r_e_n_t(other.___p_a_r_e_n_t) │ │ │ │ -437 , ___v_a_l_i_d(other.___v_a_l_i_d) │ │ │ │ -438 { │ │ │ │ -439 other._valid = false; │ │ │ │ -440 } │ │ │ │ -441 │ │ │ │ -_4_4_2 _~_I_t_e_r_a_t_i_o_n(){ │ │ │ │ -443 if(___v_a_l_i_d) │ │ │ │ -444 _f_i_n_a_l_i_z_e(); │ │ │ │ -445 } │ │ │ │ -446 │ │ │ │ -_4_5_7 bool _s_t_e_p(CountType i, _r_e_a_l___t_y_p_e def){ │ │ │ │ -458 if (!Simd::allTrue(isFinite(def))) // check for inf or NaN │ │ │ │ +_3_7_8 std::string _o_p_e_r_a_t_o_r_(_)(const std::string& str) │ │ │ │ +379 { │ │ │ │ +380 std::stringstream retval; │ │ │ │ +381 std::ostream_iterator out(retval); │ │ │ │ +382 std::transform(str.begin(), str.end(), out, │ │ │ │ +383 [](char c){ │ │ │ │ +384 return std::tolower(c, std::locale::classic()); │ │ │ │ +385 }); │ │ │ │ +386 return retval.str(); │ │ │ │ +387 } │ │ │ │ +388 }; │ │ │ │ +389 }; │ │ │ │ +390 │ │ │ │ +391 template │ │ │ │ +_3_9_2 inline _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _A_M_G& amg) │ │ │ │ +393 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_), │ │ │ │ +394 smoothers_(amg.smoothers_), solver_(amg.solver_), │ │ │ │ +395 rhs_(), lhs_(), update_(), │ │ │ │ +396 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_), │ │ │ │ +397 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ +398 buildHierarchy_(amg.buildHierarchy_), │ │ │ │ +399 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ +400 coarseSmoother_(amg.coarseSmoother_), │ │ │ │ +401 category_(amg.category_), │ │ │ │ +402 verbosity_(amg.verbosity_) │ │ │ │ +403 {} │ │ │ │ +404 │ │ │ │ +405 template │ │ │ │ +_4_0_6 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ +coarseSolver, │ │ │ │ +407 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ +408 const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +409 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_ │ │ │ │ +(smootherArgs), │ │ │ │ +410 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(&coarseSolver), │ │ │ │ +411 rhs_(), lhs_(), update_(), scalarProduct_(0), │ │ │ │ +412 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ +413 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ +414 additive(parms.getAdditive()), coarsesolverconverged(true), │ │ │ │ +415 coarseSmoother_(), │ │ │ │ +416// #warning should category be retrieved from matrices? │ │ │ │ +417 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(*smoothers_->coarsest())), │ │ │ │ +418 verbosity_(parms.debugLevel()) │ │ │ │ +419 { │ │ │ │ +420 assert(matrices_->isBuilt()); │ │ │ │ +421 │ │ │ │ +422 // build the necessary smoother hierarchies │ │ │ │ +423 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ +424 } │ │ │ │ +425 │ │ │ │ +426 template │ │ │ │ +427 template │ │ │ │ +_4_2_8 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _O_p_e_r_a_t_o_r& matrix, │ │ │ │ +429 const C& criterion, │ │ │ │ +430 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ +431 const PI& pinfo) │ │ │ │ +432 : smootherArgs_(smootherArgs), │ │ │ │ +433 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(), │ │ │ │ +434 rhs_(), lhs_(), update_(), scalarProduct_(), │ │ │ │ +435 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()), │ │ │ │ +436 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true), │ │ │ │ +437 additive(criterion.getAdditive()), coarsesolverconverged(true), │ │ │ │ +438 coarseSmoother_(), │ │ │ │ +439 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(pinfo)), │ │ │ │ +440 verbosity_(criterion.debugLevel()) │ │ │ │ +441 { │ │ │ │ +442 if(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(matrix) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo)) │ │ │ │ +443 DUNE_THROW(_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y, "Matrix and Communication must have the │ │ │ │ +same SolverCategory!"); │ │ │ │ +444 // TODO: reestablish compile time checks. │ │ │ │ +445 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ +category), │ │ │ │ +446 // "Matrix and Solver must match in terms of category!"); │ │ │ │ +447 auto matrixptr = stackobject_to_shared_ptr(matrix); │ │ │ │ +448 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ +449 } │ │ │ │ +450 │ │ │ │ +451 template │ │ │ │ +_4_5_2 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(std::shared_ptr matrixptr, │ │ │ │ +453 const ParameterTree& configuration, │ │ │ │ +454 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) : │ │ │ │ +455 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), │ │ │ │ +456 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_ │ │ │ │ +(true), │ │ │ │ +457 coarsesolverconverged(true), coarseSmoother_(), │ │ │ │ +458 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::category(pinfo)) │ │ │ │ 459 { │ │ │ │ -460 if (___p_a_r_e_n_t.___v_e_r_b_o_s_e>0) │ │ │ │ -461 std::cout << "=== " << ___p_a_r_e_n_t._n_a_m_e() << ": abort due to infinite or NaN │ │ │ │ -defect" │ │ │ │ -462 << std::endl; │ │ │ │ -463 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t, │ │ │ │ -464 ___p_a_r_e_n_t._n_a_m_e() << ": defect=" << Simd::io(def) │ │ │ │ -465 << " is infinite or NaN"); │ │ │ │ -466 } │ │ │ │ -467 if(i == 0) │ │ │ │ -468 ___d_e_f_0 = def; │ │ │ │ -469 if(___p_a_r_e_n_t.___v_e_r_b_o_s_e > 1){ │ │ │ │ -470 if(i!=0) │ │ │ │ -471 ___p_a_r_e_n_t._p_r_i_n_t_O_u_t_p_u_t(std::cout,i,def,___d_e_f); │ │ │ │ -472 else │ │ │ │ -473 ___p_a_r_e_n_t._p_r_i_n_t_O_u_t_p_u_t(std::cout,i,def); │ │ │ │ -474 } │ │ │ │ -475 ___d_e_f = def; │ │ │ │ -476 ___i = i; │ │ │ │ -477 ___r_e_s._c_o_n_v_e_r_g_e_d = (Simd::allTrue(def<___d_e_f_0*___p_a_r_e_n_t.___r_e_d_u_c_t_i_o_n || │ │ │ │ -def<_r_e_a_l___t_y_p_e(1E-30))); // convergence check │ │ │ │ -478 return ___r_e_s._c_o_n_v_e_r_g_e_d; │ │ │ │ -479 } │ │ │ │ -480 │ │ │ │ -481 protected: │ │ │ │ -_4_8_2 void _f_i_n_a_l_i_z_e(){ │ │ │ │ -483 ___r_e_s._c_o_n_v_e_r_g_e_d = (Simd::allTrue(___d_e_f<___d_e_f_0*___p_a_r_e_n_t.___r_e_d_u_c_t_i_o_n || │ │ │ │ -___d_e_f<_r_e_a_l___t_y_p_e(1E-30))); │ │ │ │ -484 ___r_e_s._i_t_e_r_a_t_i_o_n_s = ___i; │ │ │ │ -485 ___r_e_s._r_e_d_u_c_t_i_o_n = static_cast(Simd::max(___d_e_f/___d_e_f_0)); │ │ │ │ -486 ___r_e_s._c_o_n_v___r_a_t_e = pow(___r_e_s._r_e_d_u_c_t_i_o_n,1.0/___i); │ │ │ │ -487 ___r_e_s._e_l_a_p_s_e_d = ___w_a_t_c_h.elapsed(); │ │ │ │ -488 if (___p_a_r_e_n_t.___v_e_r_b_o_s_e>0) // final print │ │ │ │ -489 { │ │ │ │ -490 std::cout << "=== rate=" << ___r_e_s._c_o_n_v___r_a_t_e │ │ │ │ -491 << ", T=" << ___r_e_s._e_l_a_p_s_e_d │ │ │ │ -492 << ", TIT=" << ___r_e_s._e_l_a_p_s_e_d/___r_e_s._i_t_e_r_a_t_i_o_n_s │ │ │ │ -493 << ", IT=" << ___r_e_s._i_t_e_r_a_t_i_o_n_s << std::endl; │ │ │ │ -494 } │ │ │ │ +460 │ │ │ │ +461 if (configuration.hasKey ("smootherIterations")) │ │ │ │ +462 smootherArgs_.iterations = configuration.get("smootherIterations"); │ │ │ │ +463 │ │ │ │ +464 if (configuration.hasKey ("smootherRelaxation")) │ │ │ │ +465 smootherArgs_.relaxationFactor = configuration.get("smootherRelaxation"); │ │ │ │ +466 │ │ │ │ +467 auto normName = ToLower()(configuration.get("strengthMeasure", │ │ │ │ +"diagonal")); │ │ │ │ +468 auto index = configuration.get("diagonalRowIndex", 0); │ │ │ │ +469 │ │ │ │ +470 if ( normName == "diagonal") │ │ │ │ +471 { │ │ │ │ +472 using _f_i_e_l_d___t_y_p_e = typename M::field_type; │ │ │ │ +473 using real_type = typename FieldTraits::real_type; │ │ │ │ +474 std::is_convertible compiles; │ │ │ │ +475 │ │ │ │ +476 switch (index) │ │ │ │ +477 { │ │ │ │ +478 case 0: │ │ │ │ +479 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_0_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +480 break; │ │ │ │ +481 case 1: │ │ │ │ +482 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_1_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +483 break; │ │ │ │ +484 case 2: │ │ │ │ +485 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_2_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +486 break; │ │ │ │ +487 case 3: │ │ │ │ +488 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_3_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +489 break; │ │ │ │ +490 case 4: │ │ │ │ +491 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_4_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +492 break; │ │ │ │ +493 default: │ │ │ │ +494 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not │ │ │ │ +supported."); │ │ │ │ 495 } │ │ │ │ -496 │ │ │ │ -_4_9_7 _r_e_a_l___t_y_p_e ___d_e_f_0 = 0.0, ___d_e_f = 0.0; │ │ │ │ -_4_9_8 CountType ___i; │ │ │ │ -_4_9_9 Timer ___w_a_t_c_h; │ │ │ │ -_5_0_0 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& ___r_e_s; │ │ │ │ -_5_0_1 const _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r& ___p_a_r_e_n_t; │ │ │ │ -_5_0_2 bool ___v_a_l_i_d; │ │ │ │ -503 }; │ │ │ │ -504 │ │ │ │ -505 protected: │ │ │ │ -_5_0_6 std::shared_ptr> ___o_p; │ │ │ │ -_5_0_7 std::shared_ptr> ___p_r_e_c; │ │ │ │ -_5_0_8 std::shared_ptr> ___s_p; │ │ │ │ -_5_0_9 _s_c_a_l_a_r___r_e_a_l___t_y_p_e ___r_e_d_u_c_t_i_o_n; │ │ │ │ -_5_1_0 int ___m_a_x_i_t; │ │ │ │ -_5_1_1 int ___v_e_r_b_o_s_e; │ │ │ │ -_5_1_2 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y ___c_a_t_e_g_o_r_y; │ │ │ │ -513 }; │ │ │ │ -514 │ │ │ │ -522 template │ │ │ │ -_5_2_3 class _S_o_l_v_e_r_H_e_l_p_e_r │ │ │ │ -524 { │ │ │ │ -525 public: │ │ │ │ -_5_2_6 static void _s_e_t_M_a_t_r_i_x (ISTLLinearSolver& solver, │ │ │ │ -527 const _B_C_R_S_M_a_t_r_i_x& matrix) │ │ │ │ +496 } │ │ │ │ +497 else if (normName == "rowsum") │ │ │ │ +498 createCriterionAndHierarchies(matrixptr, pinfo, _R_o_w_S_u_m(), configuration); │ │ │ │ +499 else if (normName == "frobenius") │ │ │ │ +500 createCriterionAndHierarchies(matrixptr, pinfo, _F_r_o_b_e_n_i_u_s_N_o_r_m(), │ │ │ │ +configuration); │ │ │ │ +501 else if (normName == "one") │ │ │ │ +502 createCriterionAndHierarchies(matrixptr, pinfo, _A_l_w_a_y_s_O_n_e_N_o_r_m(), │ │ │ │ +configuration); │ │ │ │ +503 else │ │ │ │ +504 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure │ │ │ │ +"< │ │ │ │ +508 template │ │ │ │ +509 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_c_r_e_a_t_e_C_r_i_t_e_r_i_o_n_A_n_d_H_i_e_r_a_r_c_h_i_e_s(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ +configuration, std::false_type) │ │ │ │ +510 { │ │ │ │ +511 DUNE_THROW(InvalidStateException, "Strength of connection measure does not │ │ │ │ +support this type (" │ │ │ │ +512 << className() << ") as it is lacking a conversion │ │ │ │ +to" │ │ │ │ +513 << className::real_type>() << │ │ │ │ +"."); │ │ │ │ +514 } │ │ │ │ +515 │ │ │ │ +516 template │ │ │ │ +517 template │ │ │ │ +518 void AMG::createCriterionAndHierarchies(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ +configuration, std::true_type) │ │ │ │ +519 { │ │ │ │ +520 if (configuration.get("criterionSymmetric", true)) │ │ │ │ +521 { │ │ │ │ +522 using Criterion = _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n< │ │ │ │ +523 _D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_N_o_r_m_> >; │ │ │ │ +524 Criterion criterion; │ │ │ │ +525 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ +526 } │ │ │ │ +527 else │ │ │ │ 528 { │ │ │ │ -529 static const bool is_direct_solver │ │ │ │ -530 = _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_>_:_:_v_a_l_u_e; │ │ │ │ -531 _S_o_l_v_e_r_H_e_l_p_e_r_<_I_S_T_L_L_i_n_e_a_r_S_o_l_v_e_r_,_B_C_R_S_M_a_t_r_i_x_>_:_: │ │ │ │ -532_ _I_m_p_l_e_m_e_n_t_a_t_i_o_n_<_i_s___d_i_r_e_c_t___s_o_l_v_e_r_>_:_:_s_e_t_M_a_t_r_i_x(solver,matrix); │ │ │ │ +529 using Criterion = _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n< │ │ │ │ +530 _D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_N_o_r_m_> >; │ │ │ │ +531 Criterion criterion; │ │ │ │ +532 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ 533 } │ │ │ │ -534 │ │ │ │ -535 protected: │ │ │ │ -540 template │ │ │ │ -_5_4_1 struct _I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ -542 { │ │ │ │ -_5_4_3 static void _s_e_t_M_a_t_r_i_x (ISTLLinearSolver&, │ │ │ │ -544 const _B_C_R_S_M_a_t_r_i_x&) │ │ │ │ -545 {} │ │ │ │ -546 }; │ │ │ │ -547 │ │ │ │ -552 template │ │ │ │ -_5_5_3 struct _I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ -554 { │ │ │ │ -_5_5_5 static void _s_e_t_M_a_t_r_i_x (ISTLLinearSolver& solver, │ │ │ │ -556 const _B_C_R_S_M_a_t_r_i_x& matrix) │ │ │ │ -557 { │ │ │ │ -558 solver.setMatrix(matrix); │ │ │ │ -559 } │ │ │ │ -560 }; │ │ │ │ -561 }; │ │ │ │ +534 } │ │ │ │ +535 │ │ │ │ +536 template │ │ │ │ +537 template │ │ │ │ +538 void AMG::createHierarchies(C& criterion, std::shared_ptr matrixptr, const PI& pinfo, const ParameterTree& configuration) │ │ │ │ +539 { │ │ │ │ +540 if (configuration.hasKey ("maxLevel")) │ │ │ │ +541 criterion.setMaxLevel(configuration.get("maxLevel")); │ │ │ │ +542 │ │ │ │ +543 if (configuration.hasKey ("minCoarseningRate")) │ │ │ │ +544 criterion.setMinCoarsenRate(configuration.get("minCoarseningRate")); │ │ │ │ +545 │ │ │ │ +546 if (configuration.hasKey ("coarsenTarget")) │ │ │ │ +547 criterion.setCoarsenTarget (configuration.get("coarsenTarget")); │ │ │ │ +548 │ │ │ │ +549 if (configuration.hasKey ("accumulationMode")) │ │ │ │ +550 { │ │ │ │ +551 std::string mode = ToLower()(configuration.get │ │ │ │ +("accumulationMode")); │ │ │ │ +552 if ( mode == "none") │ │ │ │ +553 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_n_o_A_c_c_u); │ │ │ │ +554 else if ( mode == "atonce" ) │ │ │ │ +555 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_a_t_O_n_c_e_A_c_c_u); │ │ │ │ +556 else if ( mode == "successive") │ │ │ │ +557 criterion.setCoarsenTarget (_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u); │ │ │ │ +558 else │ │ │ │ +559 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ +does not allow value " │ │ │ │ +560 << mode <<"."); │ │ │ │ +561 } │ │ │ │ 562 │ │ │ │ -566} │ │ │ │ -567 │ │ │ │ -568#endif │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ +563 if (configuration.hasKey ("prolongationDampingFactor")) │ │ │ │ +564 criterion.setProlongationDampingFactor (configuration.get │ │ │ │ +("prolongationDampingFactor")); │ │ │ │ +565 │ │ │ │ +566 if (configuration.hasKey("defaultAggregationSizeMode")) │ │ │ │ +567 { │ │ │ │ +568 auto mode = ToLower()(configuration.get │ │ │ │ +("defaultAggregationSizeMode")); │ │ │ │ +569 auto dim = configuration.get("defaultAggregationDimension"); │ │ │ │ +570 std::size_t maxDistance = 2; │ │ │ │ +571 if (configuration.hasKey("MaxAggregateDistance")) │ │ │ │ +572 maxDistance = configuration.get("maxAggregateDistance"); │ │ │ │ +573 if (mode == "isotropic") │ │ │ │ +574 criterion.setDefaultValuesIsotropic(dim, maxDistance); │ │ │ │ +575 else if(mode == "anisotropic") │ │ │ │ +576 criterion.setDefaultValuesAnisotropic(dim, maxDistance); │ │ │ │ +577 else │ │ │ │ +578 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ +does not allow value " │ │ │ │ +579 << mode <<"."); │ │ │ │ +580 } │ │ │ │ +581 │ │ │ │ +582 if (configuration.hasKey("maxAggregateDistance")) │ │ │ │ +583 criterion.setMaxDistance(configuration.get │ │ │ │ +("maxAggregateDistance")); │ │ │ │ +584 │ │ │ │ +585 if (configuration.hasKey("minAggregateSize")) │ │ │ │ +586 criterion.setMinAggregateSize(configuration.get │ │ │ │ +("minAggregateSize")); │ │ │ │ +587 │ │ │ │ +588 if (configuration.hasKey("maxAggregateSize")) │ │ │ │ +589 criterion.setMaxAggregateSize(configuration.get │ │ │ │ +("maxAggregateSize")); │ │ │ │ +590 │ │ │ │ +591 if (configuration.hasKey("maxAggregateConnectivity")) │ │ │ │ +592 criterion.setMaxConnectivity(configuration.get │ │ │ │ +("maxAggregateConnectivity")); │ │ │ │ +593 │ │ │ │ +594 if (configuration.hasKey ("alpha")) │ │ │ │ +595 criterion.setAlpha (configuration.get ("alpha")); │ │ │ │ +596 │ │ │ │ +597 if (configuration.hasKey ("beta")) │ │ │ │ +598 criterion.setBeta (configuration.get ("beta")); │ │ │ │ +599 │ │ │ │ +600 if (configuration.hasKey ("gamma")) │ │ │ │ +601 criterion.setGamma (configuration.get ("gamma")); │ │ │ │ +602 gamma_ = criterion.getGamma(); │ │ │ │ +603 │ │ │ │ +604 if (configuration.hasKey ("additive")) │ │ │ │ +605 criterion.setAdditive (configuration.get("additive")); │ │ │ │ +606 additive = criterion.getAdditive(); │ │ │ │ +607 │ │ │ │ +608 if (configuration.hasKey ("preSteps")) │ │ │ │ +609 criterion.setNoPreSmoothSteps (configuration.get │ │ │ │ +("preSteps")); │ │ │ │ +610 preSteps_ = criterion.getNoPreSmoothSteps (); │ │ │ │ +611 │ │ │ │ +612 if (configuration.hasKey ("postSteps")) │ │ │ │ +613 criterion.setNoPostSmoothSteps (configuration.get │ │ │ │ +("postSteps")); │ │ │ │ +614 postSteps_ = criterion.getNoPostSmoothSteps (); │ │ │ │ +615 │ │ │ │ +616 verbosity_ = configuration.get("verbosity", 0); │ │ │ │ +617 criterion.setDebugLevel (verbosity_); │ │ │ │ +618 │ │ │ │ +619 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ +620 } │ │ │ │ +621 │ │ │ │ +622 template │ │ │ │ +_6_2_4 struct _D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ +625 { │ │ │ │ +_6_2_6 typedef typename Matrix :: field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ +_6_2_7 enum _S_o_l_v_e_r_T_y_p_e { _u_m_f_p_a_c_k, _s_u_p_e_r_l_u, _n_o_n_e }; │ │ │ │ +628 │ │ │ │ +_6_2_9 static constexpr _S_o_l_v_e_r_T_y_p_e _s_o_l_v_e_r = │ │ │ │ +630#if DISABLE_AMG_DIRECTSOLVER │ │ │ │ +631 _n_o_n_e; │ │ │ │ +632#elif HAVE_SUITESPARSE_UMFPACK │ │ │ │ +633 _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r_<_ _f_i_e_l_d___t_y_p_e_ _> :: valid ? _u_m_f_p_a_c_k : _n_o_n_e ; │ │ │ │ +634#elif HAVE_SUPERLU │ │ │ │ +635 _s_u_p_e_r_l_u ; │ │ │ │ +636#else │ │ │ │ +637 _n_o_n_e; │ │ │ │ +638#endif │ │ │ │ +639 │ │ │ │ +640 template │ │ │ │ +_6_4_1 struct _S_o_l_v_e_r │ │ │ │ +642 { │ │ │ │ +_6_4_3 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_V_e_c_t_o_r_,_V_e_c_t_o_r_> _t_y_p_e; │ │ │ │ +_6_4_4 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ +645 { │ │ │ │ +646 DUNE_THROW(NotImplemented,"DirectSolver not selected"); │ │ │ │ +647 return nullptr; │ │ │ │ +648 } │ │ │ │ +_6_4_9 static std::string _n_a_m_e () { return "None"; } │ │ │ │ +650 }; │ │ │ │ +651#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ +652 template │ │ │ │ +653 struct Solver< M, _u_m_f_p_a_c_k > │ │ │ │ +654 { │ │ │ │ +655 typedef _U_M_F_P_a_c_k_<_ _M_ _> _t_y_p_e; │ │ │ │ +656 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ +657 { │ │ │ │ +658 return new _t_y_p_e(_m_a_t, verbose, reusevector ); │ │ │ │ +659 } │ │ │ │ +660 static std::string _n_a_m_e () { return "UMFPack"; } │ │ │ │ +661 }; │ │ │ │ +662#endif │ │ │ │ +663#if HAVE_SUPERLU │ │ │ │ +664 template │ │ │ │ +_6_6_5 struct _S_o_l_v_e_r< M, _s_u_p_e_r_l_u > │ │ │ │ +666 { │ │ │ │ +_6_6_7 typedef _S_u_p_e_r_L_U_<_ _M_ _> _t_y_p_e; │ │ │ │ +_6_6_8 static _t_y_p_e* _c_r_e_a_t_e(const M& _m_a_t, bool verbose, bool reusevector ) │ │ │ │ +669 { │ │ │ │ +670 return new _t_y_p_e(_m_a_t, verbose, reusevector ); │ │ │ │ +671 } │ │ │ │ +_6_7_2 static std::string _n_a_m_e () { return "SuperLU"; } │ │ │ │ +673 }; │ │ │ │ +674#endif │ │ │ │ +675 │ │ │ │ +676 // define direct solver type to be used │ │ │ │ +_6_7_7 typedef _S_o_l_v_e_r_<_ _M_a_t_r_i_x_,_ _s_o_l_v_e_r_ _> _S_e_l_e_c_t_e_d_S_o_l_v_e_r ; │ │ │ │ +_6_7_8 typedef typename SelectedSolver :: type _D_i_r_e_c_t_S_o_l_v_e_r; │ │ │ │ +_6_7_9 static constexpr bool _i_s_D_i_r_e_c_t_S_o_l_v_e_r = _s_o_l_v_e_r != _n_o_n_e; │ │ │ │ +_6_8_0 static std::string _n_a_m_e() { return SelectedSolver :: name (); } │ │ │ │ +_6_8_1 static _D_i_r_e_c_t_S_o_l_v_e_r* _c_r_e_a_t_e(const _M_a_t_r_i_x& _m_a_t, bool verbose, bool │ │ │ │ +reusevector ) │ │ │ │ +682 { │ │ │ │ +683 return SelectedSolver :: create( _m_a_t, verbose, reusevector ); │ │ │ │ +684 } │ │ │ │ +685 }; │ │ │ │ +686 │ │ │ │ +687 template │ │ │ │ +688 template │ │ │ │ +689 void AMG::createHierarchies(C& criterion, │ │ │ │ +690 const std::shared_ptr& matrixptr, │ │ │ │ +691 const PI& pinfo) │ │ │ │ +692 { │ │ │ │ +693 Timer watch; │ │ │ │ +694 matrices_ = std::make_shared( │ │ │ │ +695 std::const_pointer_cast(matrixptr), │ │ │ │ +696 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ +697 │ │ │ │ +698 matrices_->template build >(criterion); │ │ │ │ +699 │ │ │ │ +700 // build the necessary smoother hierarchies │ │ │ │ +701 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ +702 │ │ │ │ +703 // test whether we should solve on the coarse level. That is the case if we │ │ │ │ +704 // have that level and if there was a redistribution on this level then our │ │ │ │ +705 // communicator has to be valid (size()>0) as the smoother might try to │ │ │ │ +communicate │ │ │ │ +706 // in the constructor. │ │ │ │ +707 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels() │ │ │ │ +708 && ( ! matrices_->redistributeInformation().back().isSetup() || │ │ │ │ +709 matrices_->parallelInformation().coarsest().getRedistributed().communicator │ │ │ │ +().size() ) ) │ │ │ │ +710 { │ │ │ │ +711 // We have the carsest level. Create the coarse Solver │ │ │ │ +712 SmootherArgs sargs(smootherArgs_); │ │ │ │ +713 sargs.iterations = 1; │ │ │ │ +714 │ │ │ │ +715 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ +716 cargs.setArgs(sargs); │ │ │ │ +717 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ +718 // Solve on the redistributed partitioning │ │ │ │ +719 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ +()); │ │ │ │ +720 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +()); │ │ │ │ +721 }else{ │ │ │ │ +722 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ +723 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ +724 } │ │ │ │ +725 │ │ │ │ +726 coarseSmoother_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_c_o_n_s_t_r_u_c_t(cargs); │ │ │ │ +727 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ +728 │ │ │ │ +729 typedef DirectSolverSelector< typename M::matrix_type, X > SolverSelector; │ │ │ │ +730 │ │ │ │ +731 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ +the coarsest level. │ │ │ │ +732 if( SolverSelector::isDirectSolver && │ │ │ │ +733 (std::is_same::value / │ │ │ │ +/ sequential mode │ │ │ │ +734 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ +parallel mode and only one processor │ │ │ │ +735 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ +736 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +().communicator().size()==1 │ │ │ │ +737 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +().communicator().size()>0) ) │ │ │ │ +738 ) │ │ │ │ +739 { // redistribute and 1 proc │ │ │ │ +740 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ +741 { │ │ │ │ +742 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ +743 { │ │ │ │ +744 // We are still participating on this level │ │ │ │ +745 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest │ │ │ │ +().getRedistributed().getmat(), false, false)); │ │ │ │ +746 } │ │ │ │ +747 else │ │ │ │ +748 solver_.reset(); │ │ │ │ +749 } │ │ │ │ +750 else │ │ │ │ +751 { │ │ │ │ +752 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()- │ │ │ │ +>getmat(), false, false)); │ │ │ │ +753 } │ │ │ │ +754 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ +>communicator().rank()==0) │ │ │ │ +755 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << │ │ │ │ +")" << std::endl; │ │ │ │ +756 } │ │ │ │ +757 else │ │ │ │ +758 { │ │ │ │ +759 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ +760 { │ │ │ │ +761 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ +762 // We are still participating on this level │ │ │ │ +763 │ │ │ │ +764 // we have to allocate these types using the rebound allocator │ │ │ │ +765 // in order to ensure that we fulfill the alignment requirements │ │ │ │ +766 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ +().coarsest().getRedistributed()), │ │ │ │ +767 *scalarProduct_, │ │ │ │ +768 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ +769 else │ │ │ │ +770 solver_.reset(); │ │ │ │ +771 }else │ │ │ │ +772 { │ │ │ │ +773 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ +().coarsest()), │ │ │ │ +774 *scalarProduct_, │ │ │ │ +775 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ +776 // // we have to allocate these types using the rebound allocator │ │ │ │ +777 // // in order to ensure that we fulfill the alignment requirements │ │ │ │ +778 // using Alloc = typename std::allocator_traits::template │ │ │ │ +rebind_alloc>; │ │ │ │ +779 // Alloc alloc; │ │ │ │ +780 // auto p = alloc.allocate(1); │ │ │ │ +781 // std::allocator_traits::construct(alloc, p, │ │ │ │ +782 // const_cast(*matrices_->matrices().coarsest()), │ │ │ │ +783 // *scalarProduct_, │ │ │ │ +784 // *coarseSmoother_, 1E-2, 1000, 0); │ │ │ │ +785 // solver_.reset(p,[](BiCGSTABSolver* p){ │ │ │ │ +786 // Alloc alloc; │ │ │ │ +787 // std::allocator_traits::destroy(alloc, p); │ │ │ │ +788 // alloc.deallocate(p,1); │ │ │ │ +789 // }); │ │ │ │ +790 } │ │ │ │ +791 } │ │ │ │ +792 } │ │ │ │ +793 │ │ │ │ +794 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ +().rank()==0) │ │ │ │ +795 std::cout<<"Building hierarchy of "<maxlevels()<<" levels " │ │ │ │ +796 <<"(including coarse solver) took "< │ │ │ │ +_8_0_1 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ +802 { │ │ │ │ +803 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ +804 // zero and set x such that A_dd*x_d=b_d │ │ │ │ +805 // Thus users can be more careless when setting up their linear │ │ │ │ +806 // systems. │ │ │ │ +807 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ +808 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r RowIter; │ │ │ │ +809 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIter; │ │ │ │ +810 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ +811 Block zero; │ │ │ │ +812 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ +813 │ │ │ │ +814 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ +815 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ +816 bool isDirichlet = true; │ │ │ │ +817 bool hasDiagonal = false; │ │ │ │ +818 Block diagonal{}; │ │ │ │ +819 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ +820 if(row.index()==_c_o_l.index()) { │ │ │ │ +821 diagonal = *_c_o_l; │ │ │ │ +822 hasDiagonal = true; │ │ │ │ +823 }else{ │ │ │ │ +824 if(*_c_o_l!=zero) │ │ │ │ +825 isDirichlet = false; │ │ │ │ +826 } │ │ │ │ +827 } │ │ │ │ +828 if(isDirichlet && hasDiagonal) │ │ │ │ +829 { │ │ │ │ +830 auto&& xEntry = Impl::asVector(x[row.index()]); │ │ │ │ +831 auto&& bEntry = Impl::asVector(b[row.index()]); │ │ │ │ +832 Impl::asMatrix(diagonal).solve(xEntry, bEntry); │ │ │ │ +833 } │ │ │ │ +834 } │ │ │ │ +835 │ │ │ │ +836 if(smoothers_->levels()>0) │ │ │ │ +837 smoothers_->finest()->pre(x,b); │ │ │ │ +838 else │ │ │ │ +839 // No smoother to make x consistent! Do it by hand │ │ │ │ +840 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ +841 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ +842 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ +843 update_ = std::make_shared>(std::make_shared │ │ │ │ +(x)); │ │ │ │ +844 matrices_->coarsenVector(*rhs_); │ │ │ │ +845 matrices_->coarsenVector(*lhs_); │ │ │ │ +846 matrices_->coarsenVector(*update_); │ │ │ │ +847 │ │ │ │ +848 // Preprocess all smoothers │ │ │ │ +849 typedef typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +850 typedef typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r RIterator; │ │ │ │ +851 typedef typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r DIterator; │ │ │ │ +852 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ +853 Iterator smoother = smoothers_->finest(); │ │ │ │ +854 RIterator rhs = rhs_->finest(); │ │ │ │ +855 DIterator lhs = lhs_->finest(); │ │ │ │ +856 if(smoothers_->levels()>1) { │ │ │ │ +857 │ │ │ │ +858 assert(lhs_->levels()==rhs_->levels()); │ │ │ │ +859 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels │ │ │ │ +()==matrices_->maxlevels()); │ │ │ │ +860 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels │ │ │ │ +()maxlevels()); │ │ │ │ +861 │ │ │ │ +862 if(smoother!=coarsest) │ │ │ │ +863 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, │ │ │ │ +++rhs) │ │ │ │ +864 smoother->pre(*lhs,*rhs); │ │ │ │ +865 smoother->pre(*lhs,*rhs); │ │ │ │ +866 } │ │ │ │ +867 │ │ │ │ +868 │ │ │ │ +869 // The preconditioner might change x and b. So we have to │ │ │ │ +870 // copy the changes to the original vectors. │ │ │ │ +871 x = *lhs_->finest(); │ │ │ │ +872 b = *rhs_->finest(); │ │ │ │ +873 │ │ │ │ +874 } │ │ │ │ +875 template │ │ │ │ +_8_7_6 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ +877 { │ │ │ │ +878 return matrices_->levels(); │ │ │ │ +879 } │ │ │ │ +880 template │ │ │ │ +_8_8_1 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ +882 { │ │ │ │ +883 return matrices_->maxlevels(); │ │ │ │ +884 } │ │ │ │ +885 │ │ │ │ +887 template │ │ │ │ +_8_8_8 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ +889 { │ │ │ │ +890 LevelContext levelContext; │ │ │ │ +891 │ │ │ │ +892 if(additive) { │ │ │ │ +893 *(rhs_->finest())=d; │ │ │ │ +894 additiveMgc(); │ │ │ │ +895 v=*lhs_->finest(); │ │ │ │ +896 }else{ │ │ │ │ +897 // Init all iterators for the current level │ │ │ │ +898 initIteratorsWithFineLevel(levelContext); │ │ │ │ +899 │ │ │ │ +900 │ │ │ │ +901 *levelContext.lhs = v; │ │ │ │ +902 *levelContext.rhs = d; │ │ │ │ +903 *levelContext.update=0; │ │ │ │ +904 levelContext.level=0; │ │ │ │ +905 │ │ │ │ +906 mgc(levelContext); │ │ │ │ +907 │ │ │ │ +908 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ +909 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ +*levelContext.update); │ │ │ │ +910 │ │ │ │ +911 v=*levelContext.update; │ │ │ │ +912 } │ │ │ │ +913 │ │ │ │ +914 } │ │ │ │ +915 │ │ │ │ +916 template │ │ │ │ +917 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ +levelContext) │ │ │ │ +918 { │ │ │ │ +919 levelContext.smoother = smoothers_->finest(); │ │ │ │ +920 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ +921 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ +922 levelContext.redist = │ │ │ │ +923 matrices_->redistributeInformation().begin(); │ │ │ │ +924 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ +925 levelContext.lhs = lhs_->finest(); │ │ │ │ +926 levelContext.update = update_->finest(); │ │ │ │ +927 levelContext.rhs = rhs_->finest(); │ │ │ │ +928 } │ │ │ │ +929 │ │ │ │ +930 template │ │ │ │ +931 bool AMG │ │ │ │ +932 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ +933 { │ │ │ │ +934 │ │ │ │ +935 bool processNextLevel=true; │ │ │ │ +936 │ │ │ │ +937 if(levelContext.redist->isSetup()) { │ │ │ │ +938 levelContext.redist->redistribute(static_cast │ │ │ │ +(*levelContext.rhs), │ │ │ │ +939 levelContext.rhs.getRedistributed()); │ │ │ │ +940 processNextLevel = levelContext.rhs.getRedistributed().size()>0; │ │ │ │ +941 if(processNextLevel) { │ │ │ │ +942 //restrict defect to coarse level right hand side. │ │ │ │ +943 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ +944 ++levelContext.pinfo; │ │ │ │ +945 Transfer │ │ │ │ +946 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ +947 static_cast(fineRhs.getRedistributed()), │ │ │ │ +948 *levelContext.pinfo); │ │ │ │ +949 } │ │ │ │ +950 }else{ │ │ │ │ +951 //restrict defect to coarse level right hand side. │ │ │ │ +952 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ +953 ++levelContext.pinfo; │ │ │ │ +954 Transfer │ │ │ │ +955 ::restrictVector(*(*levelContext.aggregates), │ │ │ │ +956 *levelContext.rhs, static_cast(*fineRhs), │ │ │ │ +957 *levelContext.pinfo); │ │ │ │ +958 } │ │ │ │ +959 │ │ │ │ +960 if(processNextLevel) { │ │ │ │ +961 // prepare coarse system │ │ │ │ +962 ++levelContext.lhs; │ │ │ │ +963 ++levelContext.update; │ │ │ │ +964 ++levelContext.matrix; │ │ │ │ +965 ++levelContext.level; │ │ │ │ +966 ++levelContext.redist; │ │ │ │ +967 │ │ │ │ +968 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +969 // next level is not the globally coarsest one │ │ │ │ +970 ++levelContext.smoother; │ │ │ │ +971 ++levelContext.aggregates; │ │ │ │ +972 } │ │ │ │ +973 // prepare the update on the next level │ │ │ │ +974 *levelContext.update=0; │ │ │ │ +975 } │ │ │ │ +976 return processNextLevel; │ │ │ │ +977 } │ │ │ │ +978 │ │ │ │ +979 template │ │ │ │ +980 void AMG │ │ │ │ +981 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel) │ │ │ │ +982 { │ │ │ │ +983 if(processNextLevel) { │ │ │ │ +984 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +985 // previous level is not the globally coarsest one │ │ │ │ +986 --levelContext.smoother; │ │ │ │ +987 --levelContext.aggregates; │ │ │ │ +988 } │ │ │ │ +989 --levelContext.redist; │ │ │ │ +990 --levelContext.level; │ │ │ │ +991 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ +992 --levelContext.matrix; │ │ │ │ +993 │ │ │ │ +994 //typename Hierarchy::Iterator coarseLhs = lhs--; │ │ │ │ +995 --levelContext.lhs; │ │ │ │ +996 --levelContext.pinfo; │ │ │ │ +997 } │ │ │ │ +998 if(levelContext.redist->isSetup()) { │ │ │ │ +999 // Need to redistribute during prolongateVector │ │ │ │ +1000 levelContext.lhs.getRedistributed()=0; │ │ │ │ +1001 Transfer │ │ │ │ +1002 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ +*levelContext.lhs, │ │ │ │ +1003 levelContext.lhs.getRedistributed(), │ │ │ │ +1004 matrices_->getProlongationDampingFactor(), │ │ │ │ +1005 *levelContext.pinfo, *levelContext.redist); │ │ │ │ +1006 }else{ │ │ │ │ +1007 *levelContext.lhs=0; │ │ │ │ +1008 Transfer │ │ │ │ +1009 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ +*levelContext.lhs, │ │ │ │ +1010 matrices_->getProlongationDampingFactor(), │ │ │ │ +1011 *levelContext.pinfo); │ │ │ │ +1012 } │ │ │ │ +1013 │ │ │ │ +1014 │ │ │ │ +1015 if(processNextLevel) { │ │ │ │ +1016 --levelContext.update; │ │ │ │ +1017 --levelContext.rhs; │ │ │ │ +1018 } │ │ │ │ +1019 │ │ │ │ +1020 *levelContext.update += *levelContext.lhs; │ │ │ │ +1021 } │ │ │ │ +1022 │ │ │ │ +1023 template │ │ │ │ +_1_0_2_4 bool _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const │ │ │ │ +1025 { │ │ │ │ +1026 return _I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _C_o_a_r_s_e_S_o_l_v_e_r_>_:_:_v_a_l_u_e; │ │ │ │ +1027 } │ │ │ │ +1028 │ │ │ │ +1029 template │ │ │ │ +1030 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext){ │ │ │ │ +1031 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ +()==maxlevels()) { │ │ │ │ +1032 // Solve directly │ │ │ │ +1033 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ +1034 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ +1035 if(levelContext.redist->isSetup()) { │ │ │ │ +1036 levelContext.redist->redistribute(*levelContext.rhs, │ │ │ │ +levelContext.rhs.getRedistributed()); │ │ │ │ +1037 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ +1038 // We are still participating in the computation │ │ │ │ +1039 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ +(levelContext.rhs.getRedistributed(), │ │ │ │ +1040 levelContext.rhs.getRedistributed()); │ │ │ │ +1041 solver_->apply(levelContext.update.getRedistributed(), │ │ │ │ +1042 levelContext.rhs.getRedistributed(), res); │ │ │ │ +1043 } │ │ │ │ +1044 levelContext.redist->redistributeBackward(*levelContext.update, │ │ │ │ +levelContext.update.getRedistributed()); │ │ │ │ +1045 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ +*levelContext.update); │ │ │ │ +1046 }else{ │ │ │ │ +1047 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs); │ │ │ │ +1048 solver_->apply(*levelContext.update, *levelContext.rhs, res); │ │ │ │ +1049 } │ │ │ │ +1050 │ │ │ │ +1051 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ +1052 coarsesolverconverged = false; │ │ │ │ +1053 }else{ │ │ │ │ +1054 // presmoothing │ │ │ │ +1055 _p_r_e_s_m_o_o_t_h(levelContext, preSteps_); │ │ │ │ +1056 │ │ │ │ +1057#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ +1058 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ +1059 │ │ │ │ +1060 if(processNextLevel) { │ │ │ │ +1061 // next level │ │ │ │ +1062 for(std::size_t i=0; imatrices().coarsest() && levels │ │ │ │ +()==maxlevels()) │ │ │ │ +1065 break; │ │ │ │ +1066 if(i+1 < gamma_){ │ │ │ │ +1067 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, │ │ │ │ +*levelContext.rhs); │ │ │ │ +1068 } │ │ │ │ +1069 } │ │ │ │ +1070 } │ │ │ │ +1071 │ │ │ │ +1072 moveToFineLevel(levelContext, processNextLevel); │ │ │ │ +1073#else │ │ │ │ +1074 *lhs=0; │ │ │ │ +1075#endif │ │ │ │ +1076 │ │ │ │ +1077 if(levelContext.matrix == matrices_->matrices().finest()) { │ │ │ │ +1078 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ +>communicator().prod(coarsesolverconverged); │ │ │ │ +1079 if(!coarsesolverconverged) │ │ │ │ +1080 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ +1081 } │ │ │ │ +1082 // postsmoothing │ │ │ │ +1083 _p_o_s_t_s_m_o_o_t_h(levelContext, postSteps_); │ │ │ │ +1084 │ │ │ │ +1085 } │ │ │ │ +1086 } │ │ │ │ +1087 │ │ │ │ +1088 template │ │ │ │ +1089 void AMG::additiveMgc(){ │ │ │ │ +1090 │ │ │ │ +1091 // restrict residual to all levels │ │ │ │ +1092 typename ParallelInformationHierarchy::Iterator pinfo=matrices_- │ │ │ │ +>parallelInformation().finest(); │ │ │ │ +1093 typename Hierarchy::Iterator rhs=rhs_->finest(); │ │ │ │ +1094 typename Hierarchy::Iterator lhs = lhs_->finest(); │ │ │ │ +1095 typename OperatorHierarchy::AggregatesMapList::const_iterator │ │ │ │ +aggregates=matrices_->aggregatesMaps().begin(); │ │ │ │ +1096 │ │ │ │ +1097 for(typename Hierarchy::Iterator fineRhs=rhs++; fineRhs != rhs_- │ │ │ │ +>coarsest(); fineRhs=rhs++, ++aggregates) { │ │ │ │ +1098 ++pinfo; │ │ │ │ +1099 Transfer │ │ │ │ +1100 ::restrictVector(*(*aggregates), *rhs, static_cast │ │ │ │ +(*fineRhs), *pinfo); │ │ │ │ +1101 } │ │ │ │ +1102 │ │ │ │ +1103 // pinfo is invalid, set to coarsest level │ │ │ │ +1104 //pinfo = matrices_->parallelInformation().coarsest │ │ │ │ +1105 // calculate correction for all levels │ │ │ │ +1106 lhs = lhs_->finest(); │ │ │ │ +1107 typename Hierarchy::Iterator smoother = smoothers_->finest(); │ │ │ │ +1108 │ │ │ │ +1109 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) │ │ │ │ +{ │ │ │ │ +1110 // presmoothing │ │ │ │ +1111 *lhs=0; │ │ │ │ +1112 smoother->apply(*lhs, *rhs); │ │ │ │ +1113 } │ │ │ │ +1114 │ │ │ │ +1115 // Coarse level solve │ │ │ │ +1116#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ +1117 InverseOperatorResult res; │ │ │ │ +1118 pinfo->copyOwnerToAll(*rhs, *rhs); │ │ │ │ +1119 solver_->apply(*lhs, *rhs, res); │ │ │ │ +1120 │ │ │ │ +1121 if(!res.converged) │ │ │ │ +1122 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ +1123#else │ │ │ │ +1124 *lhs=0; │ │ │ │ +1125#endif │ │ │ │ +1126 // Prologate and add up corrections from all levels │ │ │ │ +1127 --pinfo; │ │ │ │ +1128 --aggregates; │ │ │ │ +1129 │ │ │ │ +1130 for(typename Hierarchy::Iterator coarseLhs = lhs--; coarseLhs != │ │ │ │ +lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) { │ │ │ │ +1131 Transfer │ │ │ │ +1132 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo); │ │ │ │ +1133 } │ │ │ │ +1134 } │ │ │ │ +1135 │ │ │ │ +1136 │ │ │ │ +1138 template │ │ │ │ +_1_1_3_9 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_o_s_t([[maybe_unused]] _D_o_m_a_i_n& x) │ │ │ │ +1140 { │ │ │ │ +1141 // Postprocess all smoothers │ │ │ │ +1142 typedef typename _H_i_e_r_a_r_c_h_y_<_S_m_o_o_t_h_e_r_,_A_>_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +1143 typedef typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r DIterator; │ │ │ │ +1144 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ +1145 Iterator smoother = smoothers_->finest(); │ │ │ │ +1146 DIterator lhs = lhs_->finest(); │ │ │ │ +1147 if(smoothers_->levels()>0) { │ │ │ │ +1148 if(smoother != coarsest || matrices_->levels()maxlevels()) │ │ │ │ +1149 smoother->post(*lhs); │ │ │ │ +1150 if(smoother!=coarsest) │ │ │ │ +1151 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs) │ │ │ │ +1152 smoother->post(*lhs); │ │ │ │ +1153 smoother->post(*lhs); │ │ │ │ +1154 } │ │ │ │ +1155 lhs_ = nullptr; │ │ │ │ +1156 update_ = nullptr; │ │ │ │ +1157 rhs_ = nullptr; │ │ │ │ +1158 } │ │ │ │ +1159 │ │ │ │ +1160 template │ │ │ │ +1161 template │ │ │ │ +_1_1_6_2 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont) │ │ │ │ +1163 { │ │ │ │ +1164 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ +1165 } │ │ │ │ +1166 │ │ │ │ +1167 } // end namespace Amg │ │ │ │ +1168 │ │ │ │ +_1_1_6_9 struct _A_M_G_C_r_e_a_t_o_r{ │ │ │ │ +_1_1_7_0 template struct _i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e : std::false_type{}; │ │ │ │ +_1_1_7_1 template struct │ │ │ │ +_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e<_F_i_e_l_d_M_a_t_r_i_x> : std::true_type{}; │ │ │ │ +1172 │ │ │ │ +1173 template │ │ │ │ +1174 std::shared_ptr > │ │ │ │ +_1_1_7_5 _m_a_k_e_A_M_G(const OP& op, const std::string& smoother, const Dune:: │ │ │ │ +ParameterTree& config) const │ │ │ │ +1176 { │ │ │ │ +1177 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG"); │ │ │ │ +1178 } │ │ │ │ +1179 │ │ │ │ +1180 template │ │ │ │ +1181 std::shared_ptr > │ │ │ │ +_1_1_8_2 _m_a_k_e_A_M_G(const std::shared_ptr<_M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>>& op, const std:: │ │ │ │ +string& smoother, │ │ │ │ +1183 const Dune::ParameterTree& config) const │ │ │ │ +1184 { │ │ │ │ +1185 using OP = _M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>; │ │ │ │ +1186 │ │ │ │ +1187 if(smoother == "ssor") │ │ │ │ +1188 return std::make_shared>>(op, config); │ │ │ │ +1189 if(smoother == "sor") │ │ │ │ +1190 return std::make_shared>>(op, config); │ │ │ │ +1191 if(smoother == "jac") │ │ │ │ +1192 return std::make_shared>>(op, config); │ │ │ │ +1193 if(smoother == "gs") │ │ │ │ +1194 return std::make_shared>>(op, config); │ │ │ │ +1195 if(smoother == "ilu") │ │ │ │ +1196 return std::make_shared>>(op, config); │ │ │ │ +1197 else │ │ │ │ +1198 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ +1199 } │ │ │ │ +1200 │ │ │ │ +1201 template │ │ │ │ +1202 std::shared_ptr > │ │ │ │ +_1_2_0_3 _m_a_k_e_A_M_G(const std::shared_ptr<_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>>& op, │ │ │ │ +const std::string& smoother, │ │ │ │ +1204 const Dune::ParameterTree& config) const │ │ │ │ +1205 { │ │ │ │ +1206 using OP = _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>; │ │ │ │ +1207 │ │ │ │ +1208 auto cop = std::static_pointer_cast(op); │ │ │ │ +1209 │ │ │ │ +1210 if(smoother == "ssor") │ │ │ │ +1211 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1212 if(smoother == "sor") │ │ │ │ +1213 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1214 if(smoother == "jac") │ │ │ │ +1215 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1216 if(smoother == "gs") │ │ │ │ +1217 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1218 if(smoother == "ilu") │ │ │ │ +1219 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1220 else │ │ │ │ +1221 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ +1222 } │ │ │ │ +1223 │ │ │ │ +1224 template │ │ │ │ +1225 std::shared_ptr > │ │ │ │ +_1_2_2_6 _m_a_k_e_A_M_G(const std::shared_ptr<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>>& op, │ │ │ │ +const std::string& smoother, │ │ │ │ +1227 const Dune::ParameterTree& config) const │ │ │ │ +1228 { │ │ │ │ +1229 using OP = _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_M_,_X_,_Y_,_C_>; │ │ │ │ +1230 │ │ │ │ +1231 if(smoother == "ssor") │ │ │ │ +1232 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1233 if(smoother == "sor") │ │ │ │ +1234 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1235 if(smoother == "jac") │ │ │ │ +1236 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1237 if(smoother == "gs") │ │ │ │ +1238 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1239 if(smoother == "ilu") │ │ │ │ +1240 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1241 else │ │ │ │ +1242 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ +1243 } │ │ │ │ +1244 │ │ │ │ +1245 template │ │ │ │ +1246 std::shared_ptr::type, │ │ │ │ +1247 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ +_1_2_4_8 _o_p_e_r_a_t_o_r_(_)_ (TL tl, const std::shared_ptr& op, const Dune:: │ │ │ │ +ParameterTree& config, │ │ │ │ +1249 std::enable_if_t<_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e_<_t_y_p_e_n_a_m_e_ _O_P_:_:_m_a_t_r_i_x___t_y_p_e_:_:_b_l_o_c_k___t_y_p_e_>_:_: │ │ │ │ +_v_a_l_u_e,int> = 0) const │ │ │ │ +1250 { │ │ │ │ +1251 using field_type = typename OP::matrix_type::field_type; │ │ │ │ +1252 using real_type = typename FieldTraits::real_type; │ │ │ │ +1253 if (!std::is_convertible()) │ │ │ │ +1254 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "AMG needs field_type(" << │ │ │ │ +1255 className() << │ │ │ │ +1256 ") to be convertible to its real_type (" << │ │ │ │ +1257 className() << │ │ │ │ +1258 ")."); │ │ │ │ +1259 std::string smoother = config.get("smoother", "ssor"); │ │ │ │ +1260 return _m_a_k_e_A_M_G(op, smoother, config); │ │ │ │ +1261 } │ │ │ │ +1262 │ │ │ │ +1263 template │ │ │ │ +1264 std::shared_ptr::type, │ │ │ │ +1265 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ +_1_2_6_6 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const std::shared_ptr& /*mat*/, const Dune:: │ │ │ │ +ParameterTree& /*config*/, │ │ │ │ +1267 std::enable_if_t_:_: │ │ │ │ +_v_a_l_u_e,int> = 0) const │ │ │ │ +1268 { │ │ │ │ +1269 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "AMG needs a FieldMatrix as Matrix │ │ │ │ +block_type"); │ │ │ │ +1270 } │ │ │ │ +1271 }; │ │ │ │ +1272 │ │ │ │ +_1_2_7_3 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("amg", _A_M_G_C_r_e_a_t_o_r()); │ │ │ │ +1274} // end namespace Dune │ │ │ │ +1275 │ │ │ │ +1276#endif │ │ │ │ +_t_r_a_n_s_f_e_r_._h_h │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ +_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ +_s_m_o_o_t_h_e_r_._h_h │ │ │ │ +Classes for the generic construction and application of the smoothers. │ │ │ │ _s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ Define base class for scalar product and norm. │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h │ │ │ │ -_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ -implementation wraps a matrix. │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +_u_m_f_p_a_c_k_._h_h │ │ │ │ +Classes for using UMFPack with ISTL matrices. │ │ │ │ +_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ +_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R │ │ │ │ +#define DUNE_REGISTER_PRECONDITIONER(name,...) │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ +_s_o_l_v_e_r_s_._h_h │ │ │ │ +Implementations of the inverse operator interface. │ │ │ │ +_s_u_p_e_r_l_u_._h_h │ │ │ │ +Classes for using SuperLU with ISTL matrices. │ │ │ │ +_c_o_l │ │ │ │ +Col col │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ +_m_a_t │ │ │ │ +Matrix & mat │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ +AMG(const AMG &amg) │ │ │ │ +Copy constructor. │ │ │ │ +DDeeffiinniittiioonn amg.hh:392 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_r_e │ │ │ │ +void pre(Domain &x, Range &b) │ │ │ │ +Prepare the preconditioner. │ │ │ │ +DDeeffiinniittiioonn amg.hh:801 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_c_r_e_a_t_e │ │ │ │ +static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector) │ │ │ │ +DDeeffiinniittiioonn amg.hh:681 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_n_a_m_e │ │ │ │ +static std::string name() │ │ │ │ +DDeeffiinniittiioonn amg.hh:680 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_u_p_d_a_t_e │ │ │ │ +Hierarchy< Domain, A >::Iterator update │ │ │ │ +The iterator over the updates. │ │ │ │ +DDeeffiinniittiioonn amg.hh:303 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_h_s │ │ │ │ +Hierarchy< Range, A >::Iterator rhs │ │ │ │ +The iterator over the right hand sided. │ │ │ │ +DDeeffiinniittiioonn amg.hh:307 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_n_a_m_e │ │ │ │ +static std::string name() │ │ │ │ +DDeeffiinniittiioonn amg.hh:672 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r │ │ │ │ +bool usesDirectCoarseLevelSolver() const │ │ │ │ +Check whether the coarse solver used is a direct solver. │ │ │ │ +DDeeffiinniittiioonn amg.hh:1024 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ +X Domain │ │ │ │ +The domain type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:87 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_c_r_e_a_t_e │ │ │ │ +static type * create(const M &mat, bool verbose, bool reusevector) │ │ │ │ +DDeeffiinniittiioonn amg.hh:644 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ +AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs │ │ │ │ +&smootherArgs, const Parameters &parms) │ │ │ │ +Construct a new amg with a specific coarse solver. │ │ │ │ +DDeeffiinniittiioonn amg.hh:406 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ +AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree │ │ │ │ +&configuration, const ParallelInformation &pinfo=ParallelInformation()) │ │ │ │ +Constructor an AMG via ParameterTree. │ │ │ │ +DDeeffiinniittiioonn amg.hh:452 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_p_i_n_f_o │ │ │ │ +ParallelInformationHierarchy::Iterator pinfo │ │ │ │ +The iterator over the parallel information. │ │ │ │ +DDeeffiinniittiioonn amg.hh:287 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_T_y_p_e │ │ │ │ +SolverType │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_a_g_g_r_e_g_a_t_e_s │ │ │ │ +OperatorHierarchy::AggregatesMapList::const_iterator aggregates │ │ │ │ +The iterator over the aggregates maps. │ │ │ │ +DDeeffiinniittiioonn amg.hh:295 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ +The argument type for the construction of the smoother. │ │ │ │ +DDeeffiinniittiioonn amg.hh:100 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_e_l_e_c_t_e_d_S_o_l_v_e_r │ │ │ │ +Solver< Matrix, solver > SelectedSolver │ │ │ │ +DDeeffiinniittiioonn amg.hh:677 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ +std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ +MatrixAdapter< M, X, Y > > &op, const std::string &smoother, const Dune:: │ │ │ │ +ParameterTree &config) const │ │ │ │ +DDeeffiinniittiioonn amg.hh:1182 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_T_o_L_o_w_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +std::string operator()(const std::string &str) │ │ │ │ +DDeeffiinniittiioonn amg.hh:378 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ +std::shared_ptr< Dune::Preconditioner< typename OP::element_type::domain_type, │ │ │ │ +typename OP::element_type::range_type > > makeAMG(const OP &op, const std:: │ │ │ │ +string &smoother, const Dune::ParameterTree &config) const │ │ │ │ +DDeeffiinniittiioonn amg.hh:1175 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r │ │ │ │ +S Smoother │ │ │ │ +The type of the smoother. │ │ │ │ +DDeeffiinniittiioonn amg.hh:97 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_n_a_m_e │ │ │ │ +static std::string name() │ │ │ │ +DDeeffiinniittiioonn amg.hh:649 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_s_m_o_o_t_h_e_r │ │ │ │ +Hierarchy< Smoother, A >::Iterator smoother │ │ │ │ +The iterator over the smoothers. │ │ │ │ +DDeeffiinniittiioonn amg.hh:279 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ +M Operator │ │ │ │ +The matrix operator type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:73 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ +OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ +The iterator over the matrices. │ │ │ │ +DDeeffiinniittiioonn amg.hh:283 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_t_y_p_e │ │ │ │ +SuperLU< M > type │ │ │ │ +DDeeffiinniittiioonn amg.hh:667 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_<_ _M_,_ _s_u_p_e_r_l_u_ _>_:_:_c_r_e_a_t_e │ │ │ │ +static type * create(const M &mat, bool verbose, bool reusevector) │ │ │ │ +DDeeffiinniittiioonn amg.hh:668 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ +OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ +The iterator over the redistribution information. │ │ │ │ +DDeeffiinniittiioonn amg.hh:291 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ +X Range │ │ │ │ +The range type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:89 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h │ │ │ │ +void presmooth(LevelContext &levelContext, size_t steps) │ │ │ │ +Apply pre smoothing on the current level. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:406 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s │ │ │ │ +void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont) │ │ │ │ +Get the aggregate number of each unknown on the coarsest level. │ │ │ │ +DDeeffiinniittiioonn amg.hh:1162 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() │ │ │ │ +DDeeffiinniittiioonn amg.hh:876 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r_:_:_t_y_p_e │ │ │ │ +InverseOperator< Vector, Vector > type │ │ │ │ +DDeeffiinniittiioonn amg.hh:643 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ +std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ +OverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, │ │ │ │ +const Dune::ParameterTree &config) const │ │ │ │ +DDeeffiinniittiioonn amg.hh:1203 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_h_s │ │ │ │ +Hierarchy< Domain, A >::Iterator lhs │ │ │ │ +The iterator over the left hand side. │ │ │ │ +DDeeffiinniittiioonn amg.hh:299 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const void * Arguments │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_s_o_l_v_e_r │ │ │ │ +static constexpr SolverType solver │ │ │ │ +DDeeffiinniittiioonn amg.hh:629 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_i_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ +static constexpr bool isDirectSolver │ │ │ │ +DDeeffiinniittiioonn amg.hh:679 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y │ │ │ │ +void recalculateHierarchy() │ │ │ │ +Recalculate the matrix hierarchy. │ │ │ │ +DDeeffiinniittiioonn amg.hh:221 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +Matrix::field_type field_type │ │ │ │ +DDeeffiinniittiioonn amg.hh:626 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ +SelectedSolver::type DirectSolver │ │ │ │ +DDeeffiinniittiioonn amg.hh:678 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +std::shared_ptr< Dune::Preconditioner< typename Dune::TypeListElement< 1, TL │ │ │ │ +>::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL tl, │ │ │ │ +const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std:: │ │ │ │ +enable_if_t< isValidBlockType< typename OP::matrix_type::block_type >::value, │ │ │ │ +int >=0) const │ │ │ │ +DDeeffiinniittiioonn amg.hh:1248 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ +OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ +The parallal data distribution hierarchy type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:84 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ +InverseOperator< X, X > CoarseSolver │ │ │ │ +the type of the coarse solver. │ │ │ │ +DDeeffiinniittiioonn amg.hh:91 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_o_s_t │ │ │ │ +void post(Domain &x) │ │ │ │ +Clean up. │ │ │ │ +DDeeffiinniittiioonn amg.hh:1139 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ +std::size_t maxlevels() │ │ │ │ +DDeeffiinniittiioonn amg.hh:881 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_m_a_k_e_A_M_G │ │ │ │ +std::shared_ptr< Dune::Preconditioner< X, Y > > makeAMG(const std::shared_ptr< │ │ │ │ +NonoverlappingSchwarzOperator< M, X, Y, C > > &op, const std::string &smoother, │ │ │ │ +const Dune::ParameterTree &config) const │ │ │ │ +DDeeffiinniittiioonn amg.hh:1226 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ +void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ +Apply post smoothing on the current level. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_e_v_e_l │ │ │ │ +std::size_t level │ │ │ │ +The level index. │ │ │ │ +DDeeffiinniittiioonn amg.hh:311 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ +AMG(const Operator &fineOperator, const C &criterion, const SmootherArgs │ │ │ │ +&smootherArgs=SmootherArgs(), const ParallelInformation │ │ │ │ +&pinfo=ParallelInformation()) │ │ │ │ +Construct an AMG with an inexact coarse solver based on the smoother. │ │ │ │ +DDeeffiinniittiioonn amg.hh:428 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_a_p_p_l_y │ │ │ │ +void apply(Domain &v, const Range &d) │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ +DDeeffiinniittiioonn amg.hh:888 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e │ │ │ │ +Smoother SmootherType │ │ │ │ +DDeeffiinniittiioonn amg.hh:275 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ +MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ +The operator hierarchy type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:82 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ +Category of the preconditioner (see SolverCategory::Category) │ │ │ │ +DDeeffiinniittiioonn amg.hh:194 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +PI ParallelInformation │ │ │ │ +The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ +another type describing the... │ │ │ │ +DDeeffiinniittiioonn amg.hh:80 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_n_o_n_e │ │ │ │ +@ none │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_u_m_f_p_a_c_k │ │ │ │ +@ umfpack │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_s_u_p_e_r_l_u │ │ │ │ +@ superlu │ │ │ │ +DDeeffiinniittiioonn amg.hh:627 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ +@ atOnceAccu │ │ │ │ +Accumulate data to one process at once. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:243 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ +@ noAccu │ │ │ │ +No data accumulution. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:237 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u │ │ │ │ +@ successiveAccu │ │ │ │ +Successively accumulate to fewer processes. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:247 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ -A sparse block matrix with compressed row storage. │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_A_b_o_r_t │ │ │ │ -Thrown when a solver aborts due to some problem. │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:46 │ │ │ │ -_D_u_n_e_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ -A linear operator. │ │ │ │ -DDeeffiinniittiioonn operators.hh:69 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ +Export the type representing the underlying field. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ +row_type::const_iterator ConstColIterator │ │ │ │ +Const iterator for the entries of each row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ +T block_type │ │ │ │ +Export the type representing the components. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ +_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ +A nonoverlapping operator with communication object. │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:61 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_A_d_a_p_t_e_r │ │ │ │ +Adapter to turn a matrix into a linear operator. │ │ │ │ +DDeeffiinniittiioonn operators.hh:136 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l │ │ │ │ +Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:379 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ +Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:463 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:480 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:496 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +Criterion taking advantage of symmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:519 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +Criterion suitable for unsymmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:539 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G │ │ │ │ +an algebraic multigrid method using a Krylov-cycle. │ │ │ │ +DDeeffiinniittiioonn kamg.hh:140 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ +Two grid operator for AMG with Krylov cycle. │ │ │ │ +DDeeffiinniittiioonn kamg.hh:33 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G │ │ │ │ +Parallel algebraic multigrid based on agglomeration. │ │ │ │ +DDeeffiinniittiioonn amg.hh:65 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ +DDeeffiinniittiioonn amg.hh:625 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_:_:_S_o_l_v_e_r │ │ │ │ +DDeeffiinniittiioonn amg.hh:642 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r │ │ │ │ +DDeeffiinniittiioonn amg.hh:1169 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_T_y_p_e │ │ │ │ +DDeeffiinniittiioonn amg.hh:1170 │ │ │ │ +_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ +An overlapping Schwarz operator. │ │ │ │ +DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ +> Iterator │ │ │ │ +Type of the mutable iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +Iterator over the levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +The hierarchies build by the coarsening process. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ +The criterion describing the stop criteria for the coarsening process. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +All parameters for AMG. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +The default class for the smoother arguments. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ Base class for matrix free definition of preconditioners. │ │ │ │ DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ +_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _X_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +X::field_type field_type │ │ │ │ +The field type of the preconditioner. │ │ │ │ +DDeeffiinniittiioonn preconditioner.hh:40 │ │ │ │ _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ Base class for scalar product and norm computation. │ │ │ │ DDeeffiinniittiioonn scalarproducts.hh:52 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Default implementation for the scalar case. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:168 │ │ │ │ _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ Statistics about the application of an inverse operator. │ │ │ │ DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -InverseOperatorResult() │ │ │ │ -Default constructor. │ │ │ │ -DDeeffiinniittiioonn solver.hh:52 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e │ │ │ │ -double condition_estimate │ │ │ │ -Estimate of condition number. │ │ │ │ -DDeeffiinniittiioonn solver.hh:81 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_e_l_a_p_s_e_d │ │ │ │ -double elapsed │ │ │ │ -Elapsed time in seconds. │ │ │ │ -DDeeffiinniittiioonn solver.hh:84 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ -int iterations │ │ │ │ -Number of iterations. │ │ │ │ -DDeeffiinniittiioonn solver.hh:69 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_r_e_d_u_c_t_i_o_n │ │ │ │ -double reduction │ │ │ │ -Reduction achieved: . │ │ │ │ -DDeeffiinniittiioonn solver.hh:72 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_l_e_a_r │ │ │ │ -void clear() │ │ │ │ -Resets all data. │ │ │ │ -DDeeffiinniittiioonn solver.hh:58 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v___r_a_t_e │ │ │ │ -double conv_rate │ │ │ │ -Convergence rate (average reduction per step) │ │ │ │ -DDeeffiinniittiioonn solver.hh:78 │ │ │ │ _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ bool converged │ │ │ │ True if convergence criterion has been met. │ │ │ │ DDeeffiinniittiioonn solver.hh:75 │ │ │ │ _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ Abstract base class for all solvers. │ │ │ │ DDeeffiinniittiioonn solver.hh:101 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_p_r_i_n_t_H_e_a_d_e_r │ │ │ │ -void printHeader(std::ostream &s) const │ │ │ │ -helper function for printing header of solver output │ │ │ │ -DDeeffiinniittiioonn solver.hh:165 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_~_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -virtual ~InverseOperator() │ │ │ │ -Destructor. │ │ │ │ -DDeeffiinniittiioonn solver.hh:158 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_p_r_i_n_t_O_u_t_p_u_t │ │ │ │ -void printOutput(std::ostream &s, const CountType &iter, const DataType &norm) │ │ │ │ -const │ │ │ │ -helper function for printing solver output │ │ │ │ -DDeeffiinniittiioonn solver.hh:187 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_p_r_i_n_t_O_u_t_p_u_t │ │ │ │ -void printOutput(std::ostream &s, const CountType &iter, const DataType &norm, │ │ │ │ -const DataType &norm_old) const │ │ │ │ -helper function for printing solver output │ │ │ │ -DDeeffiinniittiioonn solver.hh:174 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, Y &b, double reduction, InverseOperatorResult &res)=0 │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e │ │ │ │ -Simd::Scalar< real_type > scalar_real_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn solver.hh:116 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -Type of the range of the operator to be inverted. │ │ │ │ -DDeeffiinniittiioonn solver.hh:107 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_n_o_r_m_S_p_a_c_i_n_g │ │ │ │ -@ normSpacing │ │ │ │ -DDeeffiinniittiioonn solver.hh:162 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_i_t_e_r_a_t_i_o_n_S_p_a_c_i_n_g │ │ │ │ -@ iterationSpacing │ │ │ │ -DDeeffiinniittiioonn solver.hh:162 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -Type of the domain of the operator to be inverted. │ │ │ │ -DDeeffiinniittiioonn solver.hh:104 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, Y &b, InverseOperatorResult &res)=0 │ │ │ │ -Apply inverse operator,. │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:110 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_r_e_a_l___t_y_p_e │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ -The real type of the field type (is the same if using real numbers, but differs │ │ │ │ -for std::complex) │ │ │ │ -DDeeffiinniittiioonn solver.hh:113 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const =0 │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -Base class for all implementations of iterative solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:205 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -X > > prec, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn solver.hh:315 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std:: │ │ │ │ -shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn solver.hh:292 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &x, X &b, double reduction, InverseOperatorResult &res) │ │ │ │ -Apply inverse operator with given reduction factor. │ │ │ │ -DDeeffiinniittiioonn solver.hh:376 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p │ │ │ │ -std::shared_ptr< const ScalarProduct< X > > _sp │ │ │ │ -DDeeffiinniittiioonn solver.hh:508 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std:: │ │ │ │ -shared_ptr< const ScalarProduct< X > > sp, std::shared_ptr< Preconditioner< X, │ │ │ │ -Y > > prec, scalar_real_type reduction, int maxit, int verbose) │ │ │ │ -General constructor to initialize an iterative solver. │ │ │ │ -DDeeffiinniittiioonn solver.hh:342 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_n_a_m_e │ │ │ │ -std::string name() const │ │ │ │ -DDeeffiinniittiioonn solver.hh:390 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -IterativeSolver(const LinearOperator< X, Y > &op, Preconditioner< X, Y > &prec, │ │ │ │ -scalar_real_type reduction, int maxit, int verbose) │ │ │ │ -General constructor to initialize an iterative solver. │ │ │ │ -DDeeffiinniittiioonn solver.hh:232 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p │ │ │ │ -std::shared_ptr< const LinearOperator< X, Y > > _op │ │ │ │ -DDeeffiinniittiioonn solver.hh:506 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t │ │ │ │ -int _maxit │ │ │ │ -DDeeffiinniittiioonn solver.hh:510 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e │ │ │ │ -int _verbose │ │ │ │ -DDeeffiinniittiioonn solver.hh:511 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___r_e_d_u_c_t_i_o_n │ │ │ │ -scalar_real_type _reduction │ │ │ │ -DDeeffiinniittiioonn solver.hh:509 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -IterativeSolver(const LinearOperator< X, Y > &op, const ScalarProduct< X > &sp, │ │ │ │ -Preconditioner< X, Y > &prec, scalar_real_type reduction, int maxit, int │ │ │ │ -verbose) │ │ │ │ -General constructor to initialize an iterative solver. │ │ │ │ -DDeeffiinniittiioonn solver.hh:264 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category _category │ │ │ │ -DDeeffiinniittiioonn solver.hh:512 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c │ │ │ │ -std::shared_ptr< Preconditioner< X, Y > > _prec │ │ │ │ -DDeeffiinniittiioonn solver.hh:507 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the solver (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn solver.hh:385 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -Class for controlling iterative methods. │ │ │ │ -DDeeffiinniittiioonn solver.hh:413 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -Iteration(const IterativeSolver &parent, InverseOperatorResult &res) │ │ │ │ -DDeeffiinniittiioonn solver.hh:415 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -Iteration(Iteration &&other) │ │ │ │ -DDeeffiinniittiioonn solver.hh:430 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___r_e_s │ │ │ │ -InverseOperatorResult & _res │ │ │ │ -DDeeffiinniittiioonn solver.hh:500 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___p_a_r_e_n_t │ │ │ │ -const IterativeSolver & _parent │ │ │ │ -DDeeffiinniittiioonn solver.hh:501 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___w_a_t_c_h │ │ │ │ -Timer _watch │ │ │ │ -DDeeffiinniittiioonn solver.hh:499 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_I_t_e_r_a_t_i_o_n │ │ │ │ -Iteration(const Iteration &)=delete │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___i │ │ │ │ -CountType _i │ │ │ │ -DDeeffiinniittiioonn solver.hh:498 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___d_e_f_0 │ │ │ │ -real_type _def0 │ │ │ │ -DDeeffiinniittiioonn solver.hh:497 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_s_t_e_p │ │ │ │ -bool step(CountType i, real_type def) │ │ │ │ -registers the iteration step, checks for invalid defect norm and convergence. │ │ │ │ -DDeeffiinniittiioonn solver.hh:457 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_f_i_n_a_l_i_z_e │ │ │ │ -void finalize() │ │ │ │ -DDeeffiinniittiioonn solver.hh:482 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___d_e_f │ │ │ │ -real_type _def │ │ │ │ -DDeeffiinniittiioonn solver.hh:497 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:_~_I_t_e_r_a_t_i_o_n │ │ │ │ -~Iteration() │ │ │ │ -DDeeffiinniittiioonn solver.hh:442 │ │ │ │ -_D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_I_t_e_r_a_t_i_o_n_:_:___v_a_l_i_d │ │ │ │ -bool _valid │ │ │ │ -DDeeffiinniittiioonn solver.hh:502 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r │ │ │ │ -Helper class for notifying a DUNE-ISTL linear solver about a change of the │ │ │ │ -iteration matrix object in... │ │ │ │ -DDeeffiinniittiioonn solver.hh:524 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix) │ │ │ │ -DDeeffiinniittiioonn solver.hh:526 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n │ │ │ │ -Implementation that works together with iterative ISTL solvers, e.g. Dune:: │ │ │ │ -CGSolver or Dune::BiCGSTAB... │ │ │ │ -DDeeffiinniittiioonn solver.hh:542 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -static void setMatrix(ISTLLinearSolver &, const BCRSMatrix &) │ │ │ │ -DDeeffiinniittiioonn solver.hh:543 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_H_e_l_p_e_r_:_:_I_m_p_l_e_m_e_n_t_a_t_i_o_n_<_ _t_r_u_e_,_ _D_u_m_m_y_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ -static void setMatrix(ISTLLinearSolver &solver, const BCRSMatrix &matrix) │ │ │ │ -DDeeffiinniittiioonn solver.hh:555 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ Categories for the solvers. │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:22 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ Category │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ newly introduced virtu... │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ _D_u_n_e_:_:_I_n_v_a_l_i_d_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:54 │ │ │ │ +_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ +_D_u_n_e_:_:_S_u_p_e_r_L_U │ │ │ │ +SuperLu Solver. │ │ │ │ +DDeeffiinniittiioonn superlu.hh:271 │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:52 │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ +The UMFPack direct sparse solver. │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:258 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: schwarz.hh File Reference │ │ │ +dune-istl: dependency.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,63 +65,69 @@ │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ -
schwarz.hh File Reference
│ │ │ +Namespaces | │ │ │ +Functions
│ │ │ + │ │ │ │ │ │
│ │ │ -
#include <iostream>
│ │ │ -#include <fstream>
│ │ │ -#include <vector>
│ │ │ -#include <sstream>
│ │ │ -#include <cmath>
│ │ │ -#include <dune/common/timer.hh>
│ │ │ -#include "io.hh"
│ │ │ -#include "bvector.hh"
│ │ │ -#include "vbvector.hh"
│ │ │ -#include "bcrsmatrix.hh"
│ │ │ -#include "gsetc.hh"
│ │ │ -#include "ilu.hh"
│ │ │ -#include "operators.hh"
│ │ │ -#include "solvers.hh"
│ │ │ -#include "preconditioners.hh"
│ │ │ -#include "scalarproducts.hh"
│ │ │ -#include "owneroverlapcopy.hh"
│ │ │ + │ │ │ +

Provides classes for initializing the link attributes of a matrix graph. │ │ │ +More...

│ │ │ +
#include <bitset>
│ │ │ +#include <ostream>
│ │ │ +#include "graph.hh"
│ │ │ +#include "properties.hh"
│ │ │ +#include <dune/common/propertymap.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::OverlappingSchwarzOperator< M, X, Y, C >
 An overlapping Schwarz operator. More...
class  Dune::Amg::EdgeProperties
 Class representing the properties of an edge in the matrix graph. More...
 
class  Dune::Amg::VertexProperties
 Class representing a node in the matrix graph. More...
 
class  Dune::ParSSOR< M, X, Y, C >
 A parallel SSOR preconditioner. More...
class  Dune::Amg::PropertyGraphVertexPropertyMap< G, i >
 
class  Dune::BlockPreconditioner< X, Y, C, P >
 Block parallel preconditioner. More...
struct  Dune::PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<typename G , typename EP , typename VM , typename EM >
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type Dune::get (const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
 
std::ostream & Dune::Amg::operator<< (std::ostream &os, const EdgeProperties &props)
 
std::ostream & Dune::Amg::operator<< (std::ostream &os, const VertexProperties &props)
 
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Provides classes for initializing the link attributes of a matrix graph.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,43 +1,56 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -schwarz.hh File Reference │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_i_o_._h_h" │ │ │ │ -#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -#include "_v_b_v_e_c_t_o_r_._h_h" │ │ │ │ -#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ -#include "_g_s_e_t_c_._h_h" │ │ │ │ -#include "_i_l_u_._h_h" │ │ │ │ -#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ -#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ -#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ -#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ -#include "_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h" │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +dependency.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ +_M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_g_r_a_p_h_._h_h" │ │ │ │ +#include "_p_r_o_p_e_r_t_i_e_s_._h_h" │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_<_ _M_,_ _X_,_ _Y_,_ _C_ _> │ │ │ │ -  An overlapping Schwarz operator. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +  Class representing the properties of an edge in the matrix graph. │ │ │ │ + _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_P_a_r_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _C_ _> │ │ │ │ -  A parallel SSOR preconditioner. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +  Class representing a node in the matrix graph. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _P_ _> │ │ │ │ -  Block parallel preconditioner. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_ _G_,_ _i_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_y_p_e_S_e_l_e_c_t_o_r_<_ _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g_,_ _A_m_g_:_: │ │ │ │ + _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_P_,_ _V_M_,_ _E_M_ _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ + PropertyMapTypeSelector< _A_m_g_:_: │ │ │ │ +_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g, _A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h< _D_u_n_e_:_:_g_e_t (const _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ + G, _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, EP, VM, EM > &tag, _A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h< G, _A_m_g_:_: │ │ │ │ + >::Type  _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, EP, VM, EM > &graph) │ │ │ │ +  │ │ │ │ + std::ostream &  _D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream │ │ │ │ + &os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s &props) │ │ │ │ +  │ │ │ │ + std::ostream &  _D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream │ │ │ │ + &os, const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s &props) │ │ │ │ +  │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: schwarz.hh Source File │ │ │ +dune-istl: dependency.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,302 +70,490 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
schwarz.hh
│ │ │ +
dependency.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SCHWARZ_HH
│ │ │ -
6#define DUNE_ISTL_SCHWARZ_HH
│ │ │ +
5#ifndef DUNE_AMG_DEPENDENCY_HH
│ │ │ +
6#define DUNE_AMG_DEPENDENCY_HH
│ │ │
7
│ │ │ -
8#include <iostream> // for input/output to shell
│ │ │ -
9#include <fstream> // for input/output to files
│ │ │ -
10#include <vector> // STL vector class
│ │ │ -
11#include <sstream>
│ │ │ -
12
│ │ │ -
13#include <cmath> // Yes, we do some math here
│ │ │ -
14
│ │ │ -
15#include <dune/common/timer.hh>
│ │ │ +
8
│ │ │ +
9#include <bitset>
│ │ │ +
10#include <ostream>
│ │ │ +
11
│ │ │ +
12#include "graph.hh"
│ │ │ +
13#include "properties.hh"
│ │ │ +
14#include <dune/common/propertymap.hh>
│ │ │ +
15
│ │ │
16
│ │ │ -
17#include "io.hh"
│ │ │ -
18#include "bvector.hh"
│ │ │ -
19#include "vbvector.hh"
│ │ │ -
20#include "bcrsmatrix.hh"
│ │ │ -
21#include "io.hh"
│ │ │ -
22#include "gsetc.hh"
│ │ │ -
23#include "ilu.hh"
│ │ │ -
24#include "operators.hh"
│ │ │ -
25#include "solvers.hh"
│ │ │ -
26#include "preconditioners.hh"
│ │ │ -
27#include "scalarproducts.hh"
│ │ │ -
28#include "owneroverlapcopy.hh"
│ │ │ -
29
│ │ │ -
30namespace Dune {
│ │ │ -
31
│ │ │ -
73 template<class M, class X, class Y, class C>
│ │ │ -
│ │ │ - │ │ │ -
75 {
│ │ │ -
76 public:
│ │ │ -
81 typedef M matrix_type;
│ │ │ -
86 typedef X domain_type;
│ │ │ -
91 typedef Y range_type;
│ │ │ -
93 typedef typename X::field_type field_type;
│ │ │ - │ │ │ -
99
│ │ │ -
│ │ │ - │ │ │ -
108 : _A_(stackobject_to_shared_ptr(A)), communication(com)
│ │ │ -
109 {}
│ │ │ -
│ │ │ -
110
│ │ │ -
│ │ │ -
111 OverlappingSchwarzOperator (const std::shared_ptr<matrix_type> A, const communication_type& com)
│ │ │ -
112 : _A_(A), communication(com)
│ │ │ -
113 {}
│ │ │ -
│ │ │ +
17namespace Dune
│ │ │ +
18{
│ │ │ +
19 namespace Amg
│ │ │ +
20 {
│ │ │ +
│ │ │ + │ │ │ +
39 {
│ │ │ +
40 friend std::ostream& operator<<(std::ostream& os, const EdgeProperties& props);
│ │ │ +
41 public:
│ │ │ + │ │ │ +
44
│ │ │ +
45 private:
│ │ │ +
46
│ │ │ +
47 std::bitset<SIZE> flags_;
│ │ │ +
48 public:
│ │ │ + │ │ │ +
51
│ │ │ +
53 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ +
54
│ │ │ +
56 bool operator[](std::size_t v) const;
│ │ │ +
57
│ │ │ +
63 bool depends() const;
│ │ │ +
64
│ │ │ +
69 void setDepends();
│ │ │ +
70
│ │ │ +
74 void resetDepends();
│ │ │ +
75
│ │ │ +
80 bool influences() const;
│ │ │ +
81
│ │ │ +
85 void setInfluences();
│ │ │ +
86
│ │ │ +
90 void resetInfluences();
│ │ │ +
91
│ │ │ +
96 bool isOneWay() const;
│ │ │ +
97
│ │ │ +
102 bool isTwoWay() const;
│ │ │ +
103
│ │ │ +
108 bool isStrong() const;
│ │ │ +
109
│ │ │ +
113 void reset();
│ │ │
114
│ │ │ -
│ │ │ -
116 virtual void apply (const X& x, Y& y) const
│ │ │ -
117 {
│ │ │ -
118 y = 0;
│ │ │ -
119 _A_->umv(x,y); // result is consistent on interior+border
│ │ │ -
120 communication.project(y); // we want this here to avoid it before the preconditioner
│ │ │ -
121 // since there d is const!
│ │ │ -
122 }
│ │ │ -
│ │ │ -
123
│ │ │ -
│ │ │ -
125 virtual void applyscaleadd (field_type alpha, const X& x, Y& y) const
│ │ │ -
126 {
│ │ │ -
127 _A_->usmv(alpha,x,y); // result is consistent on interior+border
│ │ │ -
128 communication.project(y); // we want this here to avoid it before the preconditioner
│ │ │ -
129 // since there d is const!
│ │ │ -
130 }
│ │ │ +
118 void printFlags() const;
│ │ │ +
119 };
│ │ │
│ │ │ +
120
│ │ │ +
│ │ │ + │ │ │ +
127 friend std::ostream& operator<<(std::ostream& os, const VertexProperties& props);
│ │ │ +
128 public:
│ │ │ + │ │ │ +
130 private:
│ │ │
131
│ │ │ -
│ │ │ -
133 virtual const matrix_type& getmat () const
│ │ │ -
134 {
│ │ │ -
135 return *_A_;
│ │ │ -
136 }
│ │ │ -
│ │ │ -
137
│ │ │ -
│ │ │ - │ │ │ -
140 {
│ │ │ - │ │ │ -
142 }
│ │ │ -
│ │ │ -
143
│ │ │ +
133 std::bitset<SIZE> flags_;
│ │ │ +
134
│ │ │ +
135 public:
│ │ │ + │ │ │ +
138
│ │ │ +
140 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ +
141
│ │ │ +
143 bool operator[](std::size_t v) const;
│ │ │
144
│ │ │ -
│ │ │ - │ │ │ -
147 {
│ │ │ -
148 return communication;
│ │ │ -
149 }
│ │ │ -
│ │ │ -
150 private:
│ │ │ -
151 const std::shared_ptr<const matrix_type>_A_;
│ │ │ -
152 const communication_type& communication;
│ │ │ -
153 };
│ │ │ -
│ │ │ -
154
│ │ │ -
174 template<class M, class X, class Y, class C>
│ │ │ -
│ │ │ -
175 class ParSSOR : public Preconditioner<X,Y> {
│ │ │ -
176 public:
│ │ │ -
178 typedef M matrix_type;
│ │ │ -
180 typedef X domain_type;
│ │ │ -
182 typedef Y range_type;
│ │ │ -
184 typedef typename X::field_type field_type;
│ │ │ - │ │ │ +
151 void setIsolated();
│ │ │ +
152
│ │ │ +
156 bool isolated() const;
│ │ │ +
157
│ │ │ +
161 void resetIsolated();
│ │ │ +
162
│ │ │ +
166 void setVisited();
│ │ │ +
167
│ │ │ +
171 bool visited() const;
│ │ │ +
172
│ │ │ +
176 void resetVisited();
│ │ │ +
177
│ │ │ +
181 void setFront();
│ │ │ +
182
│ │ │ +
186 bool front() const;
│ │ │
187
│ │ │ -
│ │ │ -
197 ParSSOR (const matrix_type& A, int n, field_type w, const communication_type& c)
│ │ │ -
198 : _A_(A), _n(n), _w(w), communication(c)
│ │ │ -
199 { }
│ │ │ -
│ │ │ -
200
│ │ │ -
│ │ │ -
206 virtual void pre (X& x, [[maybe_unused]] Y& b)
│ │ │ -
207 {
│ │ │ -
208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ -
209 }
│ │ │ -
│ │ │ -
210
│ │ │ -
│ │ │ -
216 virtual void apply (X& v, const Y& d)
│ │ │ -
217 {
│ │ │ -
218 for (int i=0; i<_n; i++) {
│ │ │ -
219 bsorf(_A_,v,d,_w);
│ │ │ -
220 bsorb(_A_,v,d,_w);
│ │ │ -
221 }
│ │ │ -
222 communication.copyOwnerToAll(v,v);
│ │ │ -
223 }
│ │ │ -
│ │ │ +
191 void resetFront();
│ │ │ +
192
│ │ │ +
196 void setExcludedBorder();
│ │ │ +
197
│ │ │ +
202 bool excludedBorder() const;
│ │ │ +
203
│ │ │ +
207 void resetExcludedBorder();
│ │ │ +
208
│ │ │ +
212 void reset();
│ │ │ +
213
│ │ │ +
214 };
│ │ │ +
│ │ │ +
215
│ │ │ +
216 template<typename G, std::size_t i>
│ │ │ +
│ │ │ + │ │ │ +
218 : public RAPropertyMapHelper<typename std::bitset<VertexProperties::SIZE>::reference,
│ │ │ +
219 PropertyGraphVertexPropertyMap<G,i> >
│ │ │ +
220 {
│ │ │ +
221 public:
│ │ │ +
222
│ │ │ +
223 typedef ReadWritePropertyMapTag Category;
│ │ │
224
│ │ │ -
230 virtual void post ([[maybe_unused]] X& x) {}
│ │ │ -
231
│ │ │ -
│ │ │ - │ │ │ -
234 {
│ │ │ - │ │ │ -
236 }
│ │ │ -
│ │ │ -
237
│ │ │ -
238 private:
│ │ │ -
240 const matrix_type& _A_;
│ │ │ -
242 int _n;
│ │ │ -
244 field_type _w;
│ │ │ -
246 const communication_type& communication;
│ │ │ -
247 };
│ │ │ -
│ │ │ -
248
│ │ │ -
249 namespace Amg
│ │ │ -
250 {
│ │ │ -
251 template<class T> struct ConstructionTraits;
│ │ │ -
252 }
│ │ │ -
253
│ │ │ -
277 template<class X, class Y, class C, class P=Preconditioner<X,Y> >
│ │ │ -
│ │ │ - │ │ │ -
279 friend struct Amg::ConstructionTraits<BlockPreconditioner<X,Y,C,P> >;
│ │ │ -
280 public:
│ │ │ -
285 typedef X domain_type;
│ │ │ -
290 typedef Y range_type;
│ │ │ -
292 typedef typename X::field_type field_type;
│ │ │ - │ │ │ -
298
│ │ │ -
│ │ │ - │ │ │ -
307 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c)
│ │ │ -
308 { }
│ │ │ -
│ │ │ -
309
│ │ │ -
│ │ │ -
317 BlockPreconditioner (const std::shared_ptr<P>& p, const communication_type& c)
│ │ │ -
318 : _preconditioner(p), _communication(c)
│ │ │ -
319 { }
│ │ │ -
│ │ │ -
320
│ │ │ -
│ │ │ -
326 virtual void pre (X& x, Y& b)
│ │ │ -
327 {
│ │ │ -
328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ -
329 _preconditioner->pre(x,b);
│ │ │ +
225 enum {
│ │ │ +
227 index = i
│ │ │ +
228 };
│ │ │ +
229
│ │ │ +
233 typedef G Graph;
│ │ │ +
234
│ │ │ +
238 typedef std::bitset<VertexProperties::SIZE> BitSet;
│ │ │ +
239
│ │ │ +
243 typedef typename BitSet::reference Reference;
│ │ │ +
244
│ │ │ +
248 typedef bool ValueType;
│ │ │ +
249
│ │ │ +
253 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
254
│ │ │ +
│ │ │ + │ │ │ +
260 : graph_(&g)
│ │ │ +
261 {}
│ │ │ +
│ │ │ +
262
│ │ │ +
│ │ │ + │ │ │ +
267 : graph_(0)
│ │ │ +
268 {}
│ │ │ +
│ │ │ +
269
│ │ │ +
270
│ │ │ +
│ │ │ +
275 Reference operator[](const Vertex& vertex) const
│ │ │ +
276 {
│ │ │ +
277 return graph_->getVertexProperties(vertex)[index];
│ │ │ +
278 }
│ │ │ +
│ │ │ +
279 private:
│ │ │ +
280 Graph* graph_;
│ │ │ +
281 };
│ │ │ +
│ │ │ +
282
│ │ │ +
283 } // end namespace Amg
│ │ │ +
284
│ │ │ +
285 template<typename G, typename EP, typename VM, typename EM>
│ │ │ +
│ │ │ +
286 struct PropertyMapTypeSelector<Amg::VertexVisitedTag,Amg::PropertiesGraph<G,Amg::VertexProperties,EP,VM,EM> >
│ │ │ +
287 {
│ │ │ + │ │ │ +
289 };
│ │ │ +
│ │ │ +
290
│ │ │ +
291 template<typename G, typename EP, typename VM, typename EM>
│ │ │ +
292 typename PropertyMapTypeSelector<Amg::VertexVisitedTag,Amg::PropertiesGraph<G,Amg::VertexProperties,EP,VM,EM> >::Type
│ │ │ +
│ │ │ + │ │ │ +
294 {
│ │ │ + │ │ │ +
296 }
│ │ │ +
│ │ │ +
297
│ │ │ +
298 namespace Amg
│ │ │ +
299 {
│ │ │ +
│ │ │ +
300 inline std::ostream& operator<<(std::ostream& os, const EdgeProperties& props)
│ │ │ +
301 {
│ │ │ +
302 return os << props.flags_;
│ │ │ +
303 }
│ │ │ +
│ │ │ +
304
│ │ │ +
│ │ │ + │ │ │ +
306 : flags_()
│ │ │ +
307 {}
│ │ │ +
│ │ │ +
308
│ │ │ +
309 inline std::bitset<EdgeProperties::SIZE>::reference
│ │ │ +
│ │ │ + │ │ │ +
311 {
│ │ │ +
312 return flags_[v];
│ │ │ +
313 }
│ │ │ +
│ │ │ +
314
│ │ │ +
│ │ │ +
315 inline bool EdgeProperties::operator[](std::size_t i) const
│ │ │ +
316 {
│ │ │ +
317 return flags_[i];
│ │ │ +
318 }
│ │ │ +
│ │ │ +
319
│ │ │ +
│ │ │ + │ │ │ +
321 {
│ │ │ +
322 flags_.reset();
│ │ │ +
323 }
│ │ │ +
│ │ │ +
324
│ │ │ +
│ │ │ + │ │ │ +
326 {
│ │ │ +
327 // Set the INFLUENCE bit
│ │ │ +
328 //flags_ |= (1<<INFLUENCE);
│ │ │ +
329 flags_.set(INFLUENCE);
│ │ │
330 }
│ │ │
│ │ │
331
│ │ │ -
│ │ │ -
337 virtual void apply (X& v, const Y& d)
│ │ │ -
338 {
│ │ │ -
339 _preconditioner->apply(v,d);
│ │ │ -
340 _communication.copyOwnerToAll(v,v);
│ │ │ -
341 }
│ │ │ -
│ │ │ -
342
│ │ │ -
343 template<bool forward>
│ │ │ -
│ │ │ -
344 void apply (X& v, const Y& d)
│ │ │ -
345 {
│ │ │ -
346 _preconditioner->template apply<forward>(v,d);
│ │ │ -
347 _communication.copyOwnerToAll(v,v);
│ │ │ -
348 }
│ │ │ -
│ │ │ -
349
│ │ │ -
│ │ │ -
355 virtual void post (X& x)
│ │ │ -
356 {
│ │ │ -
357 _preconditioner->post(x);
│ │ │ -
358 }
│ │ │ -
│ │ │ -
359
│ │ │ -
│ │ │ - │ │ │ -
362 {
│ │ │ - │ │ │ -
364 }
│ │ │ -
│ │ │ -
365
│ │ │ -
366 private:
│ │ │ -
368 std::shared_ptr<P> _preconditioner;
│ │ │ -
369
│ │ │ -
371 const communication_type& _communication;
│ │ │ -
372 };
│ │ │ -
│ │ │ -
373
│ │ │ -
376} // end namespace
│ │ │ -
377
│ │ │ -
378#endif
│ │ │ - │ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
Define base class for scalar product and norm.
│ │ │ -
Define general preconditioner interface.
│ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ -
The incomplete LU factorization kernels.
│ │ │ -
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ -
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition gsetc.hh:646
│ │ │ -
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition gsetc.hh:634
│ │ │ +
│ │ │ +
332 inline bool EdgeProperties::influences() const
│ │ │ +
333 {
│ │ │ +
334 // Test the INFLUENCE bit
│ │ │ +
335 return flags_.test(INFLUENCE);
│ │ │ +
336 }
│ │ │ +
│ │ │ +
337
│ │ │ +
│ │ │ + │ │ │ +
339 {
│ │ │ +
340 // Set the first bit.
│ │ │ +
341 //flags_ |= (1<<DEPEND);
│ │ │ +
342 flags_.set(DEPEND);
│ │ │ +
343 }
│ │ │ +
│ │ │ +
344
│ │ │ +
│ │ │ + │ │ │ +
346 {
│ │ │ +
347 // reset the first bit.
│ │ │ +
348 //flags_ &= ~(1<<DEPEND);
│ │ │ +
349 flags_.reset(DEPEND);
│ │ │ +
350 }
│ │ │ +
│ │ │ +
351
│ │ │ +
│ │ │ +
352 inline bool EdgeProperties::depends() const
│ │ │ +
353 {
│ │ │ +
354 // Return the first bit.
│ │ │ +
355 return flags_.test(DEPEND);
│ │ │ +
356 }
│ │ │ +
│ │ │ +
357
│ │ │ +
│ │ │ + │ │ │ +
359 {
│ │ │ +
360 // reset the second bit.
│ │ │ +
361 flags_ &= ~(1<<INFLUENCE);
│ │ │ +
362 }
│ │ │ +
│ │ │ +
363
│ │ │ +
│ │ │ +
364 inline bool EdgeProperties::isOneWay() const
│ │ │ +
365 {
│ │ │ +
366 // Test whether only the first bit is set
│ │ │ +
367 //return isStrong() && !isTwoWay();
│ │ │ +
368 return ((flags_) & std::bitset<SIZE>((1<<INFLUENCE)|(1<<DEPEND)))==(1<<DEPEND);
│ │ │ +
369 }
│ │ │ +
│ │ │ +
370
│ │ │ +
│ │ │ +
371 inline bool EdgeProperties::isTwoWay() const
│ │ │ +
372 {
│ │ │ +
373 // Test whether the first and second bit is set
│ │ │ +
374 return ((flags_) & std::bitset<SIZE>((1<<INFLUENCE)|(1<<DEPEND)))==((1<<INFLUENCE)|(1<<DEPEND));
│ │ │ +
375 }
│ │ │ +
│ │ │ +
376
│ │ │ +
│ │ │ +
377 inline bool EdgeProperties::isStrong() const
│ │ │ +
378 {
│ │ │ +
379 // Test whether the first or second bit is set
│ │ │ +
380 return ((flags_) & std::bitset<SIZE>((1<<INFLUENCE)|(1<<DEPEND))).to_ulong();
│ │ │ +
381 }
│ │ │ +
│ │ │ +
382
│ │ │ +
383
│ │ │ +
│ │ │ +
384 inline std::ostream& operator<<(std::ostream& os, const VertexProperties& props)
│ │ │ +
385 {
│ │ │ +
386 return os << props.flags_;
│ │ │ +
387 }
│ │ │ +
│ │ │ +
388
│ │ │ +
│ │ │ + │ │ │ +
390 : flags_()
│ │ │ +
391 {}
│ │ │ +
│ │ │ +
392
│ │ │ +
393
│ │ │ +
394 inline std::bitset<VertexProperties::SIZE>::reference
│ │ │ +
│ │ │ + │ │ │ +
396 {
│ │ │ +
397 return flags_[v];
│ │ │ +
398 }
│ │ │ +
│ │ │ +
399
│ │ │ +
│ │ │ +
400 inline bool VertexProperties::operator[](std::size_t v) const
│ │ │ +
401 {
│ │ │ +
402 return flags_[v];
│ │ │ +
403 }
│ │ │ +
│ │ │ +
404
│ │ │ +
│ │ │ + │ │ │ +
406 {
│ │ │ +
407 flags_.set(ISOLATED);
│ │ │ +
408 }
│ │ │ +
│ │ │ +
409
│ │ │ +
│ │ │ +
410 inline bool VertexProperties::isolated() const
│ │ │ +
411 {
│ │ │ +
412 return flags_.test(ISOLATED);
│ │ │ +
413 }
│ │ │ +
│ │ │ +
414
│ │ │ +
│ │ │ + │ │ │ +
416 {
│ │ │ +
417 flags_.reset(ISOLATED);
│ │ │ +
418 }
│ │ │ +
│ │ │ +
419
│ │ │ +
│ │ │ + │ │ │ +
421 {
│ │ │ +
422 flags_.set(VISITED);
│ │ │ +
423 }
│ │ │ +
│ │ │ +
424
│ │ │ +
│ │ │ +
425 inline bool VertexProperties::visited() const
│ │ │ +
426 {
│ │ │ +
427 return flags_.test(VISITED);
│ │ │ +
428 }
│ │ │ +
│ │ │ +
429
│ │ │ +
│ │ │ + │ │ │ +
431 {
│ │ │ +
432 flags_.reset(VISITED);
│ │ │ +
433 }
│ │ │ +
│ │ │ +
434
│ │ │ +
│ │ │ + │ │ │ +
436 {
│ │ │ +
437 flags_.set(FRONT);
│ │ │ +
438 }
│ │ │ +
│ │ │ +
439
│ │ │ +
│ │ │ +
440 inline bool VertexProperties::front() const
│ │ │ +
441 {
│ │ │ +
442 return flags_.test(FRONT);
│ │ │ +
443 }
│ │ │ +
│ │ │ +
444
│ │ │ +
│ │ │ + │ │ │ +
446 {
│ │ │ +
447 flags_.reset(FRONT);
│ │ │ +
448 }
│ │ │ +
│ │ │ +
449
│ │ │ +
│ │ │ + │ │ │ +
451 {
│ │ │ +
452 flags_.set(BORDER);
│ │ │ +
453 }
│ │ │ +
│ │ │ +
454
│ │ │ +
│ │ │ + │ │ │ +
456 {
│ │ │ +
457 return flags_.test(BORDER);
│ │ │ +
458 }
│ │ │ +
│ │ │ +
459
│ │ │ +
│ │ │ + │ │ │ +
461 {
│ │ │ +
462 flags_.reset(BORDER);
│ │ │ +
463 }
│ │ │ +
│ │ │ +
464
│ │ │ +
│ │ │ + │ │ │ +
466 {
│ │ │ +
467 flags_.reset();
│ │ │ +
468 }
│ │ │ +
│ │ │ +
469
│ │ │ +
471 }
│ │ │ +
472}
│ │ │ +
473#endif
│ │ │ +
Provides classes for handling internal properties in a graph.
│ │ │ +
Provides classes for building the matrix graph.
│ │ │ +
bool depends() const
Checks whether the vertex the edge points to depends on the vertex the edge starts.
Definition dependency.hh:352
│ │ │ +
void resetFront()
Resets the front node flag.
Definition dependency.hh:445
│ │ │ +
std::bitset< VertexProperties::SIZE > BitSet
The type of the bitset.
Definition dependency.hh:238
│ │ │ +
bool isolated() const
Checks whether the node is isolated.
Definition dependency.hh:410
│ │ │ +
bool ValueType
The value type.
Definition dependency.hh:248
│ │ │ +
friend std::ostream & operator<<(std::ostream &os, const VertexProperties &props)
Definition dependency.hh:384
│ │ │ +
BitSet::reference Reference
The reference type.
Definition dependency.hh:243
│ │ │ +
bool isTwoWay() const
Checks whether the edge is two way. I.e. both the influence flag and the depends flag are that.
Definition dependency.hh:371
│ │ │ +
void setInfluences()
Marks the edge as one of which the start vertex by the end vertex.
Definition dependency.hh:325
│ │ │ +
VertexProperties()
Constructor.
Definition dependency.hh:389
│ │ │ +
void setDepends()
Marks the edge as one of which the end point depends on the starting point.
Definition dependency.hh:338
│ │ │ +
PropertyGraphVertexPropertyMap()
Default constructor.
Definition dependency.hh:266
│ │ │ +
PropertyGraphVertexPropertyMap(G &g)
Constructor.
Definition dependency.hh:259
│ │ │ +
G::VertexDescriptor Vertex
The vertex descriptor.
Definition dependency.hh:253
│ │ │ +
void resetExcludedBorder()
Marks the vertex as included in the aggregation.
Definition dependency.hh:460
│ │ │ +
void setFront()
Marks the node as belonging to the current clusters front.
Definition dependency.hh:435
│ │ │ +
void reset()
Reset all flags.
Definition dependency.hh:465
│ │ │ +
void setVisited()
Mark the node as already visited.
Definition dependency.hh:420
│ │ │ +
EdgeProperties()
Constructor.
Definition dependency.hh:305
│ │ │ +
void resetInfluences()
Resets the influence flag.
Definition dependency.hh:358
│ │ │ +
G Graph
The type of the graph with internal properties.
Definition dependency.hh:233
│ │ │ +
std::bitset< SIZE >::reference operator[](std::size_t v)
Access the bits directly.
Definition dependency.hh:395
│ │ │ +
void printFlags() const
Prints the attributes of the edge for debugging.
│ │ │ +
friend std::ostream & operator<<(std::ostream &os, const EdgeProperties &props)
Definition dependency.hh:300
│ │ │ +
Amg::PropertyGraphVertexPropertyMap< Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM >, Amg::VertexProperties::VISITED > Type
Definition dependency.hh:288
│ │ │ +
bool influences() const
Checks whether the start vertex is influenced by the end vertex.
Definition dependency.hh:332
│ │ │ +
void setIsolated()
Marks that node as being isolated.
Definition dependency.hh:405
│ │ │ +
bool excludedBorder() const
Tests whether the vertex is excluded from the aggregation.
Definition dependency.hh:455
│ │ │ +
void resetVisited()
Resets the visited flag.
Definition dependency.hh:430
│ │ │ +
bool visited() const
Checks whether the node is marked as visited.
Definition dependency.hh:425
│ │ │ +
Reference operator[](const Vertex &vertex) const
Get the properties associated to a vertex.
Definition dependency.hh:275
│ │ │ +
void reset()
Reset all flags.
Definition dependency.hh:320
│ │ │ +
void resetDepends()
Resets the depends flag.
Definition dependency.hh:345
│ │ │ +
ReadWritePropertyMapTag Category
Definition dependency.hh:223
│ │ │ +
void resetIsolated()
Resets the isolated flag.
Definition dependency.hh:415
│ │ │ +
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:113
│ │ │ +
bool isStrong() const
Checks whether the edge is strong. I.e. the influence or depends flag is set.
Definition dependency.hh:377
│ │ │ +
bool front() const
Checks whether the node is marked as a front node.
Definition dependency.hh:440
│ │ │ +
std::bitset< SIZE >::reference operator[](std::size_t v)
Access the bits directly.
Definition dependency.hh:310
│ │ │ +
void setExcludedBorder()
Marks the vertex as excluded from the aggregation.
Definition dependency.hh:450
│ │ │ +
bool isOneWay() const
Checks whether the edge is one way. I.e. either the influence or the depends flag but is set.
Definition dependency.hh:364
│ │ │ +
@ index
the index to access in the bitset.
Definition dependency.hh:227
│ │ │ +
@ VISITED
Definition dependency.hh:129
│ │ │ +
@ ISOLATED
Definition dependency.hh:129
│ │ │ +
@ SIZE
Definition dependency.hh:129
│ │ │ +
@ BORDER
Definition dependency.hh:129
│ │ │ +
@ FRONT
Definition dependency.hh:129
│ │ │ +
@ DEPEND
Definition dependency.hh:43
│ │ │ +
@ SIZE
Definition dependency.hh:43
│ │ │ +
@ INFLUENCE
Definition dependency.hh:43
│ │ │
Definition allocator.hh:11
│ │ │ -
A linear operator exporting itself in matrix form.
Definition operators.hh:111
│ │ │ -
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ -
const communication_type & getCommunication() const
Get the object responsible for communication.
Definition schwarz.hh:146
│ │ │ -
virtual const matrix_type & getmat() const
get the sequential assembled linear operator.
Definition schwarz.hh:133
│ │ │ -
virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const
apply operator to x, scale and add:
Definition schwarz.hh:125
│ │ │ -
virtual void apply(const X &x, Y &y) const
apply operator to x:
Definition schwarz.hh:116
│ │ │ -
C communication_type
The type of the communication object.
Definition schwarz.hh:98
│ │ │ -
X domain_type
The type of the domain.
Definition schwarz.hh:86
│ │ │ -
M matrix_type
The type of the matrix we operate on.
Definition schwarz.hh:81
│ │ │ -
Y range_type
The type of the range.
Definition schwarz.hh:91
│ │ │ -
X::field_type field_type
The field type of the range.
Definition schwarz.hh:93
│ │ │ -
OverlappingSchwarzOperator(const matrix_type &A, const communication_type &com)
constructor: just store a reference to a matrix.
Definition schwarz.hh:107
│ │ │ -
OverlappingSchwarzOperator(const std::shared_ptr< matrix_type > A, const communication_type &com)
Definition schwarz.hh:111
│ │ │ -
virtual SolverCategory::Category category() const
Category of the linear operator (see SolverCategory::Category)
Definition schwarz.hh:139
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
A parallel SSOR preconditioner.
Definition schwarz.hh:175
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition schwarz.hh:184
│ │ │ -
C communication_type
The type of the communication object.
Definition schwarz.hh:186
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition schwarz.hh:233
│ │ │ -
ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c)
Constructor.
Definition schwarz.hh:197
│ │ │ -
virtual void post(X &x)
Clean up.
Definition schwarz.hh:230
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:180
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:182
│ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition schwarz.hh:178
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition schwarz.hh:216
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition schwarz.hh:206
│ │ │ -
Block parallel preconditioner.
Definition schwarz.hh:278
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition schwarz.hh:326
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:285
│ │ │ -
BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c)
Constructor.
Definition schwarz.hh:317
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition schwarz.hh:337
│ │ │ -
BlockPreconditioner(P &p, const communication_type &c)
Constructor.
Definition schwarz.hh:306
│ │ │ -
void apply(X &v, const Y &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition schwarz.hh:344
│ │ │ -
C communication_type
The type of the communication object..
Definition schwarz.hh:297
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition schwarz.hh:292
│ │ │ -
virtual void post(X &x)
Clean up.
Definition schwarz.hh:355
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:290
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition schwarz.hh:361
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ +
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ +
Definition dependency.hh:220
│ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,391 +1,575 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -schwarz.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +dependency.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SCHWARZ_HH │ │ │ │ -6#define DUNE_ISTL_SCHWARZ_HH │ │ │ │ +5#ifndef DUNE_AMG_DEPENDENCY_HH │ │ │ │ +6#define DUNE_AMG_DEPENDENCY_HH │ │ │ │ 7 │ │ │ │ -8#include // for input/output to shell │ │ │ │ -9#include // for input/output to files │ │ │ │ -10#include // STL vector class │ │ │ │ -11#include │ │ │ │ -12 │ │ │ │ -13#include // Yes, we do some math here │ │ │ │ -14 │ │ │ │ -15#include │ │ │ │ +8 │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11 │ │ │ │ +12#include "_g_r_a_p_h_._h_h" │ │ │ │ +13#include "_p_r_o_p_e_r_t_i_e_s_._h_h" │ │ │ │ +14#include │ │ │ │ +15 │ │ │ │ 16 │ │ │ │ -17#include "_i_o_._h_h" │ │ │ │ -18#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -19#include "_v_b_v_e_c_t_o_r_._h_h" │ │ │ │ -20#include "_b_c_r_s_m_a_t_r_i_x_._h_h" │ │ │ │ -21#include "_i_o_._h_h" │ │ │ │ -22#include "_g_s_e_t_c_._h_h" │ │ │ │ -23#include "_i_l_u_._h_h" │ │ │ │ -24#include "_o_p_e_r_a_t_o_r_s_._h_h" │ │ │ │ -25#include "_s_o_l_v_e_r_s_._h_h" │ │ │ │ -26#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h" │ │ │ │ -27#include "_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h" │ │ │ │ -28#include "_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h" │ │ │ │ -29 │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ -31 │ │ │ │ -73 template │ │ │ │ -_7_4 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r : public _A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ -75 { │ │ │ │ -76 public: │ │ │ │ -_8_1 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_8_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_9_1 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_9_3 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_9_8 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ -99 │ │ │ │ -_1_0_7 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r (const _m_a_t_r_i_x___t_y_p_e& A, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& │ │ │ │ -com) │ │ │ │ -108 : _A_(stackobject_to_shared_ptr(A)), communication(com) │ │ │ │ -109 {} │ │ │ │ -110 │ │ │ │ -_1_1_1 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r (const std::shared_ptr A, const │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& com) │ │ │ │ -112 : _A_(A), communication(com) │ │ │ │ -113 {} │ │ │ │ +17namespace _D_u_n_e │ │ │ │ +18{ │ │ │ │ +19 namespace Amg │ │ │ │ +20 { │ │ │ │ +_3_8 class _E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +39 { │ │ │ │ +40 friend std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& │ │ │ │ +props); │ │ │ │ +41 public: │ │ │ │ +_4_3 enum {_I_N_F_L_U_E_N_C_E, _D_E_P_E_N_D, _S_I_Z_E}; │ │ │ │ +44 │ │ │ │ +45 private: │ │ │ │ +46 │ │ │ │ +47 std::bitset flags_; │ │ │ │ +48 public: │ │ │ │ +50 _E_d_g_e_P_r_o_p_e_r_t_i_e_s(); │ │ │ │ +51 │ │ │ │ +53 std::bitset::reference _o_p_e_r_a_t_o_r_[_](std::size_t v); │ │ │ │ +54 │ │ │ │ +56 bool _o_p_e_r_a_t_o_r_[_](std::size_t v) const; │ │ │ │ +57 │ │ │ │ +63 bool _d_e_p_e_n_d_s() const; │ │ │ │ +64 │ │ │ │ +69 void _s_e_t_D_e_p_e_n_d_s(); │ │ │ │ +70 │ │ │ │ +74 void _r_e_s_e_t_D_e_p_e_n_d_s(); │ │ │ │ +75 │ │ │ │ +80 bool _i_n_f_l_u_e_n_c_e_s() const; │ │ │ │ +81 │ │ │ │ +85 void _s_e_t_I_n_f_l_u_e_n_c_e_s(); │ │ │ │ +86 │ │ │ │ +90 void _r_e_s_e_t_I_n_f_l_u_e_n_c_e_s(); │ │ │ │ +91 │ │ │ │ +96 bool _i_s_O_n_e_W_a_y() const; │ │ │ │ +97 │ │ │ │ +102 bool _i_s_T_w_o_W_a_y() const; │ │ │ │ +103 │ │ │ │ +108 bool _i_s_S_t_r_o_n_g() const; │ │ │ │ +109 │ │ │ │ +113 void _r_e_s_e_t(); │ │ │ │ 114 │ │ │ │ -_1_1_6 virtual void _a_p_p_l_y (const X& x, Y& y) const │ │ │ │ -117 { │ │ │ │ -118 y = 0; │ │ │ │ -119 _A_->umv(x,y); // result is consistent on interior+border │ │ │ │ -120 communication.project(y); // we want this here to avoid it before the │ │ │ │ -preconditioner │ │ │ │ -121 // since there d is const! │ │ │ │ -122 } │ │ │ │ -123 │ │ │ │ -_1_2_5 virtual void _a_p_p_l_y_s_c_a_l_e_a_d_d (_f_i_e_l_d___t_y_p_e alpha, const X& x, Y& y) const │ │ │ │ -126 { │ │ │ │ -127 _A_->usmv(alpha,x,y); // result is consistent on interior+border │ │ │ │ -128 communication.project(y); // we want this here to avoid it before the │ │ │ │ -preconditioner │ │ │ │ -129 // since there d is const! │ │ │ │ -130 } │ │ │ │ +_1_1_8 void _p_r_i_n_t_F_l_a_g_s() const; │ │ │ │ +119 }; │ │ │ │ +120 │ │ │ │ +_1_2_6 class _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s { │ │ │ │ +127 friend std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& │ │ │ │ +props); │ │ │ │ +128 public: │ │ │ │ +_1_2_9 enum { _I_S_O_L_A_T_E_D, _V_I_S_I_T_E_D, _F_R_O_N_T, _B_O_R_D_E_R, _S_I_Z_E }; │ │ │ │ +130 private: │ │ │ │ 131 │ │ │ │ -_1_3_3 virtual const _m_a_t_r_i_x___t_y_p_e& _g_e_t_m_a_t () const │ │ │ │ -134 { │ │ │ │ -135 return *_A_; │ │ │ │ -136 } │ │ │ │ -137 │ │ │ │ -_1_3_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -140 { │ │ │ │ -141 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ -142 } │ │ │ │ -143 │ │ │ │ +133 std::bitset flags_; │ │ │ │ +134 │ │ │ │ +135 public: │ │ │ │ +137 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s(); │ │ │ │ +138 │ │ │ │ +140 std::bitset::reference _o_p_e_r_a_t_o_r_[_](std::size_t v); │ │ │ │ +141 │ │ │ │ +143 bool _o_p_e_r_a_t_o_r_[_](std::size_t v) const; │ │ │ │ 144 │ │ │ │ -_1_4_6 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& _g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n() const │ │ │ │ -147 { │ │ │ │ -148 return communication; │ │ │ │ -149 } │ │ │ │ -150 private: │ │ │ │ -151 const std::shared_ptr_A_; │ │ │ │ -152 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& communication; │ │ │ │ -153 }; │ │ │ │ -154 │ │ │ │ -174 template │ │ │ │ -_1_7_5 class _P_a_r_S_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -176 public: │ │ │ │ -_1_7_8 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_1_8_0 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_1_8_2 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_1_8_4 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_1_8_6 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ +151 void _s_e_t_I_s_o_l_a_t_e_d(); │ │ │ │ +152 │ │ │ │ +156 bool _i_s_o_l_a_t_e_d() const; │ │ │ │ +157 │ │ │ │ +161 void _r_e_s_e_t_I_s_o_l_a_t_e_d(); │ │ │ │ +162 │ │ │ │ +166 void _s_e_t_V_i_s_i_t_e_d(); │ │ │ │ +167 │ │ │ │ +171 bool _v_i_s_i_t_e_d() const; │ │ │ │ +172 │ │ │ │ +176 void _r_e_s_e_t_V_i_s_i_t_e_d(); │ │ │ │ +177 │ │ │ │ +181 void _s_e_t_F_r_o_n_t(); │ │ │ │ +182 │ │ │ │ +186 bool _f_r_o_n_t() const; │ │ │ │ 187 │ │ │ │ -_1_9_7 _P_a_r_S_S_O_R (const _m_a_t_r_i_x___t_y_p_e& A, int n, _f_i_e_l_d___t_y_p_e w, const │ │ │ │ -_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ -198 : _A_(A), _n(n), _w(w), communication(c) │ │ │ │ -199 { } │ │ │ │ -200 │ │ │ │ -_2_0_6 virtual void _p_r_e (X& x, [[maybe_unused]] Y& b) │ │ │ │ -207 { │ │ │ │ -208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ -209 } │ │ │ │ -210 │ │ │ │ -_2_1_6 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -217 { │ │ │ │ -218 for (int i=0; i<_n; i++) { │ │ │ │ -219 _b_s_o_r_f(_A_,v,d,_w); │ │ │ │ -220 _b_s_o_r_b(_A_,v,d,_w); │ │ │ │ -221 } │ │ │ │ -222 communication.copyOwnerToAll(v,v); │ │ │ │ -223 } │ │ │ │ +191 void _r_e_s_e_t_F_r_o_n_t(); │ │ │ │ +192 │ │ │ │ +196 void _s_e_t_E_x_c_l_u_d_e_d_B_o_r_d_e_r(); │ │ │ │ +197 │ │ │ │ +202 bool _e_x_c_l_u_d_e_d_B_o_r_d_e_r() const; │ │ │ │ +203 │ │ │ │ +207 void _r_e_s_e_t_E_x_c_l_u_d_e_d_B_o_r_d_e_r(); │ │ │ │ +208 │ │ │ │ +212 void _r_e_s_e_t(); │ │ │ │ +213 │ │ │ │ +214 }; │ │ │ │ +215 │ │ │ │ +216 template │ │ │ │ +_2_1_7 class _P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +218 : public RAPropertyMapHelper:: │ │ │ │ +reference, │ │ │ │ +219 PropertyGraphVertexPropertyMap > │ │ │ │ +220 { │ │ │ │ +221 public: │ │ │ │ +222 │ │ │ │ +_2_2_3 typedef ReadWritePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ 224 │ │ │ │ -_2_3_0 virtual void _p_o_s_t ([[maybe_unused]] X& x) {} │ │ │ │ -231 │ │ │ │ -_2_3_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -234 { │ │ │ │ -235 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ -236 } │ │ │ │ -237 │ │ │ │ -238 private: │ │ │ │ -240 const _m_a_t_r_i_x___t_y_p_e& _A_; │ │ │ │ -242 int _n; │ │ │ │ -244 _f_i_e_l_d___t_y_p_e _w; │ │ │ │ -_2_4_6 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& communication; │ │ │ │ -247 }; │ │ │ │ -248 │ │ │ │ -249 namespace Amg │ │ │ │ -250 { │ │ │ │ -251 template struct ConstructionTraits; │ │ │ │ -252 } │ │ │ │ -253 │ │ │ │ -277 template > │ │ │ │ -_2_7_8 class _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -279 friend struct Amg::ConstructionTraits<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r >; │ │ │ │ -280 public: │ │ │ │ -_2_8_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_2_9_0 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_2_9_2 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_2_9_7 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ -298 │ │ │ │ -_3_0_6 _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r (P& p, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& c) │ │ │ │ -307 : _preconditioner(stackobject_to_shared_ptr(p)), _communication(c) │ │ │ │ -308 { } │ │ │ │ -309 │ │ │ │ -_3_1_7 _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r (const std::shared_ptr

& p, const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& │ │ │ │ -c) │ │ │ │ -318 : _preconditioner(p), _communication(c) │ │ │ │ -319 { } │ │ │ │ -320 │ │ │ │ -_3_2_6 virtual void _p_r_e (X& x, Y& b) │ │ │ │ -327 { │ │ │ │ -328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ -329 _preconditioner->pre(x,b); │ │ │ │ +225 enum { │ │ │ │ +227 _i_n_d_e_x = i │ │ │ │ +_2_2_8 }; │ │ │ │ +229 │ │ │ │ +_2_3_3 typedef G _G_r_a_p_h; │ │ │ │ +234 │ │ │ │ +_2_3_8 typedef std::bitset _B_i_t_S_e_t; │ │ │ │ +239 │ │ │ │ +_2_4_3 typedef typename BitSet::reference _R_e_f_e_r_e_n_c_e; │ │ │ │ +244 │ │ │ │ +_2_4_8 typedef bool _V_a_l_u_e_T_y_p_e; │ │ │ │ +249 │ │ │ │ +_2_5_3 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +254 │ │ │ │ +_2_5_9 _P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p(G& g) │ │ │ │ +260 : graph_(&g) │ │ │ │ +261 {} │ │ │ │ +262 │ │ │ │ +_2_6_6 _P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ +267 : graph_(0) │ │ │ │ +268 {} │ │ │ │ +269 │ │ │ │ +270 │ │ │ │ +_2_7_5 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x& vertex) const │ │ │ │ +276 { │ │ │ │ +277 return graph_->getVertexProperties(vertex)[_i_n_d_e_x]; │ │ │ │ +278 } │ │ │ │ +279 private: │ │ │ │ +280 _G_r_a_p_h* graph_; │ │ │ │ +281 }; │ │ │ │ +282 │ │ │ │ +283 } // end namespace Amg │ │ │ │ +284 │ │ │ │ +285 template │ │ │ │ +_2_8_6 struct PropertyMapTypeSelector > │ │ │ │ +287 { │ │ │ │ +_2_8_8 typedef _A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_: │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>, Amg::VertexProperties::VISITED> _T_y_p_e; │ │ │ │ +289 }; │ │ │ │ +290 │ │ │ │ +291 template │ │ │ │ +292 typename PropertyMapTypeSelector >::Type │ │ │ │ +_2_9_3 _g_e_t([[maybe_unused]] const _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g& tag, _A_m_g_:_: │ │ │ │ +_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>& graph) │ │ │ │ +294 { │ │ │ │ +295 return _A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_G_,_A_m_g_:_: │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_E_P_,_V_M_,_E_M_>, _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_I_S_I_T_E_D>(graph); │ │ │ │ +296 } │ │ │ │ +297 │ │ │ │ +298 namespace Amg │ │ │ │ +299 { │ │ │ │ +_3_0_0 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& │ │ │ │ +props) │ │ │ │ +301 { │ │ │ │ +302 return os << props.flags_; │ │ │ │ +303 } │ │ │ │ +304 │ │ │ │ +_3_0_5 inline _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s() │ │ │ │ +306 : flags_() │ │ │ │ +307 {} │ │ │ │ +308 │ │ │ │ +309 inline std::bitset::reference │ │ │ │ +_3_1_0 _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t v) │ │ │ │ +311 { │ │ │ │ +312 return flags_[v]; │ │ │ │ +313 } │ │ │ │ +314 │ │ │ │ +_3_1_5 inline bool _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t i) const │ │ │ │ +316 { │ │ │ │ +317 return flags_[i]; │ │ │ │ +318 } │ │ │ │ +319 │ │ │ │ +_3_2_0 inline void _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t() │ │ │ │ +321 { │ │ │ │ +322 flags_.reset(); │ │ │ │ +323 } │ │ │ │ +324 │ │ │ │ +_3_2_5 inline void _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_I_n_f_l_u_e_n_c_e_s() │ │ │ │ +326 { │ │ │ │ +327 // Set the INFLUENCE bit │ │ │ │ +328 //flags_ |= (1<apply(v,d); │ │ │ │ -340 _communication.copyOwnerToAll(v,v); │ │ │ │ -341 } │ │ │ │ -342 │ │ │ │ -343 template │ │ │ │ -_3_4_4 void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -345 { │ │ │ │ -346 _preconditioner->template apply(v,d); │ │ │ │ -347 _communication.copyOwnerToAll(v,v); │ │ │ │ -348 } │ │ │ │ -349 │ │ │ │ -_3_5_5 virtual void _p_o_s_t (X& x) │ │ │ │ -356 { │ │ │ │ -357 _preconditioner->post(x); │ │ │ │ -358 } │ │ │ │ -359 │ │ │ │ -_3_6_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -362 { │ │ │ │ -363 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g; │ │ │ │ -364 } │ │ │ │ -365 │ │ │ │ -366 private: │ │ │ │ -368 std::shared_ptr

_preconditioner; │ │ │ │ -369 │ │ │ │ -371 const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& _communication; │ │ │ │ -372 }; │ │ │ │ -373 │ │ │ │ -376} // end namespace │ │ │ │ -377 │ │ │ │ -378#endif │ │ │ │ -_v_b_v_e_c_t_o_r_._h_h │ │ │ │ -??? │ │ │ │ -_s_o_l_v_e_r_s_._h_h │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ -_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ -Define general preconditioner interface. │ │ │ │ -_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ -Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ -_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ -implementation wraps a matrix. │ │ │ │ -_i_o_._h_h │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ -_i_l_u_._h_h │ │ │ │ -The incomplete LU factorization kernels. │ │ │ │ -_g_s_e_t_c_._h_h │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ -generic way. │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ -_D_u_n_e_:_:_b_s_o_r_b │ │ │ │ -void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ -SSOR step. │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:646 │ │ │ │ -_D_u_n_e_:_:_b_s_o_r_f │ │ │ │ -void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ -SOR step. │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:634 │ │ │ │ -_D_u_n_e │ │ │ │ -DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ -A linear operator exporting itself in matrix form. │ │ │ │ -DDeeffiinniittiioonn operators.hh:111 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ -An overlapping Schwarz operator. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:75 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_g_e_t_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ -const communication_type & getCommunication() const │ │ │ │ -Get the object responsible for communication. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:146 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_g_e_t_m_a_t │ │ │ │ -virtual const matrix_type & getmat() const │ │ │ │ -get the sequential assembled linear operator. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:133 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ -virtual void applyscaleadd(field_type alpha, const X &x, Y &y) const │ │ │ │ -apply operator to x, scale and add: │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:125 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(const X &x, Y &y) const │ │ │ │ -apply operator to x: │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:116 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ -C communication_type │ │ │ │ -The type of the communication object. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:98 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The type of the domain. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:86 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -The type of the matrix we operate on. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:81 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The type of the range. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:91 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the range. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:93 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ -OverlappingSchwarzOperator(const matrix_type &A, const communication_type &com) │ │ │ │ -constructor: just store a reference to a matrix. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:107 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r │ │ │ │ -OverlappingSchwarzOperator(const std::shared_ptr< matrix_type > A, const │ │ │ │ -communication_type &com) │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:111 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the linear operator (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:139 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R │ │ │ │ -A parallel SSOR preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:175 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:184 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ -C communication_type │ │ │ │ -The type of the communication object. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:186 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:233 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_P_a_r_S_S_O_R │ │ │ │ -ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c) │ │ │ │ +_3_3_2 inline bool _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_n_f_l_u_e_n_c_e_s() const │ │ │ │ +333 { │ │ │ │ +334 // Test the INFLUENCE bit │ │ │ │ +335 return flags_.test(_I_N_F_L_U_E_N_C_E); │ │ │ │ +336 } │ │ │ │ +337 │ │ │ │ +_3_3_8 inline void _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_D_e_p_e_n_d_s() │ │ │ │ +339 { │ │ │ │ +340 // Set the first bit. │ │ │ │ +341 //flags_ |= (1<((1<<_I_N_F_L_U_E_N_C_E)|(1<<_D_E_P_E_N_D)))== │ │ │ │ +(1<<_D_E_P_E_N_D); │ │ │ │ +369 } │ │ │ │ +370 │ │ │ │ +_3_7_1 inline bool _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_T_w_o_W_a_y() const │ │ │ │ +372 { │ │ │ │ +373 // Test whether the first and second bit is set │ │ │ │ +374 return ((flags_) & std::bitset((1<<_I_N_F_L_U_E_N_C_E)|(1<<_D_E_P_E_N_D)))==( │ │ │ │ +(1<<_I_N_F_L_U_E_N_C_E)|(1<<_D_E_P_E_N_D)); │ │ │ │ +375 } │ │ │ │ +376 │ │ │ │ +_3_7_7 inline bool _E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_S_t_r_o_n_g() const │ │ │ │ +378 { │ │ │ │ +379 // Test whether the first or second bit is set │ │ │ │ +380 return ((flags_) & std::bitset((1<<_I_N_F_L_U_E_N_C_E)|(1<<_D_E_P_E_N_D))).to_ulong │ │ │ │ +(); │ │ │ │ +381 } │ │ │ │ +382 │ │ │ │ +383 │ │ │ │ +_3_8_4 inline std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& │ │ │ │ +props) │ │ │ │ +385 { │ │ │ │ +386 return os << props.flags_; │ │ │ │ +387 } │ │ │ │ +388 │ │ │ │ +_3_8_9 inline _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s() │ │ │ │ +390 : flags_() │ │ │ │ +391 {} │ │ │ │ +392 │ │ │ │ +393 │ │ │ │ +394 inline std::bitset::reference │ │ │ │ +_3_9_5 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t v) │ │ │ │ +396 { │ │ │ │ +397 return flags_[v]; │ │ │ │ +398 } │ │ │ │ +399 │ │ │ │ +_4_0_0 inline bool _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_](std::size_t v) const │ │ │ │ +401 { │ │ │ │ +402 return flags_[v]; │ │ │ │ +403 } │ │ │ │ +404 │ │ │ │ +_4_0_5 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_I_s_o_l_a_t_e_d() │ │ │ │ +406 { │ │ │ │ +407 flags_.set(_I_S_O_L_A_T_E_D); │ │ │ │ +408 } │ │ │ │ +409 │ │ │ │ +_4_1_0 inline bool _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_i_s_o_l_a_t_e_d() const │ │ │ │ +411 { │ │ │ │ +412 return flags_.test(_I_S_O_L_A_T_E_D); │ │ │ │ +413 } │ │ │ │ +414 │ │ │ │ +_4_1_5 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_I_s_o_l_a_t_e_d() │ │ │ │ +416 { │ │ │ │ +417 flags_.reset(_I_S_O_L_A_T_E_D); │ │ │ │ +418 } │ │ │ │ +419 │ │ │ │ +_4_2_0 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_V_i_s_i_t_e_d() │ │ │ │ +421 { │ │ │ │ +422 flags_.set(_V_I_S_I_T_E_D); │ │ │ │ +423 } │ │ │ │ +424 │ │ │ │ +_4_2_5 inline bool _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_v_i_s_i_t_e_d() const │ │ │ │ +426 { │ │ │ │ +427 return flags_.test(_V_I_S_I_T_E_D); │ │ │ │ +428 } │ │ │ │ +429 │ │ │ │ +_4_3_0 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_V_i_s_i_t_e_d() │ │ │ │ +431 { │ │ │ │ +432 flags_.reset(_V_I_S_I_T_E_D); │ │ │ │ +433 } │ │ │ │ +434 │ │ │ │ +_4_3_5 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_F_r_o_n_t() │ │ │ │ +436 { │ │ │ │ +437 flags_.set(_F_R_O_N_T); │ │ │ │ +438 } │ │ │ │ +439 │ │ │ │ +_4_4_0 inline bool _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_f_r_o_n_t() const │ │ │ │ +441 { │ │ │ │ +442 return flags_.test(_F_R_O_N_T); │ │ │ │ +443 } │ │ │ │ +444 │ │ │ │ +_4_4_5 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_F_r_o_n_t() │ │ │ │ +446 { │ │ │ │ +447 flags_.reset(_F_R_O_N_T); │ │ │ │ +448 } │ │ │ │ +449 │ │ │ │ +_4_5_0 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_E_x_c_l_u_d_e_d_B_o_r_d_e_r() │ │ │ │ +451 { │ │ │ │ +452 flags_.set(_B_O_R_D_E_R); │ │ │ │ +453 } │ │ │ │ +454 │ │ │ │ +_4_5_5 inline bool _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_e_x_c_l_u_d_e_d_B_o_r_d_e_r() const │ │ │ │ +456 { │ │ │ │ +457 return flags_.test(_B_O_R_D_E_R); │ │ │ │ +458 } │ │ │ │ +459 │ │ │ │ +_4_6_0 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_E_x_c_l_u_d_e_d_B_o_r_d_e_r() │ │ │ │ +461 { │ │ │ │ +462 flags_.reset(_B_O_R_D_E_R); │ │ │ │ +463 } │ │ │ │ +464 │ │ │ │ +_4_6_5 inline void _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t() │ │ │ │ +466 { │ │ │ │ +467 flags_.reset(); │ │ │ │ +468 } │ │ │ │ +469 │ │ │ │ +471 } │ │ │ │ +472} │ │ │ │ +473#endif │ │ │ │ +_p_r_o_p_e_r_t_i_e_s_._h_h │ │ │ │ +Provides classes for handling internal properties in a graph. │ │ │ │ +_g_r_a_p_h_._h_h │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_d_e_p_e_n_d_s │ │ │ │ +bool depends() const │ │ │ │ +Checks whether the vertex the edge points to depends on the vertex the edge │ │ │ │ +starts. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:352 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_F_r_o_n_t │ │ │ │ +void resetFront() │ │ │ │ +Resets the front node flag. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:445 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_B_i_t_S_e_t │ │ │ │ +std::bitset< VertexProperties::SIZE > BitSet │ │ │ │ +The type of the bitset. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:238 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_i_s_o_l_a_t_e_d │ │ │ │ +bool isolated() const │ │ │ │ +Checks whether the node is isolated. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:410 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_V_a_l_u_e_T_y_p_e │ │ │ │ +bool ValueType │ │ │ │ +The value type. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:248 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ +friend std::ostream & operator<<(std::ostream &os, const VertexProperties │ │ │ │ +&props) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:384 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ +BitSet::reference Reference │ │ │ │ +The reference type. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:243 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_T_w_o_W_a_y │ │ │ │ +bool isTwoWay() const │ │ │ │ +Checks whether the edge is two way. I.e. both the influence flag and the │ │ │ │ +depends flag are that. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:371 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_I_n_f_l_u_e_n_c_e_s │ │ │ │ +void setInfluences() │ │ │ │ +Marks the edge as one of which the start vertex by the end vertex. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:325 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +VertexProperties() │ │ │ │ Constructor. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:197 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:230 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:180 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:182 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:178 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:216 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:206 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Block parallel preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:278 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:326 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:285 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:389 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_D_e_p_e_n_d_s │ │ │ │ +void setDepends() │ │ │ │ +Marks the edge as one of which the end point depends on the starting point. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:338 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +PropertyGraphVertexPropertyMap() │ │ │ │ +Default constructor. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:266 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +PropertyGraphVertexPropertyMap(G &g) │ │ │ │ Constructor. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:317 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:337 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -BlockPreconditioner(P &p, const communication_type &c) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:259 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_V_e_r_t_e_x │ │ │ │ +G::VertexDescriptor Vertex │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:253 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_E_x_c_l_u_d_e_d_B_o_r_d_e_r │ │ │ │ +void resetExcludedBorder() │ │ │ │ +Marks the vertex as included in the aggregation. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:460 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_F_r_o_n_t │ │ │ │ +void setFront() │ │ │ │ +Marks the node as belonging to the current clusters front. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:435 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t │ │ │ │ +void reset() │ │ │ │ +Reset all flags. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:465 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_V_i_s_i_t_e_d │ │ │ │ +void setVisited() │ │ │ │ +Mark the node as already visited. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:420 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +EdgeProperties() │ │ │ │ Constructor. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:306 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:344 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ -C communication_type │ │ │ │ -The type of the communication object.. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:297 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:292 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:355 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:290 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:361 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ -@ overlapping │ │ │ │ -Category for overlapping solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:29 │ │ │ │ +DDeeffiinniittiioonn dependency.hh:305 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_I_n_f_l_u_e_n_c_e_s │ │ │ │ +void resetInfluences() │ │ │ │ +Resets the influence flag. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:358 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_G_r_a_p_h │ │ │ │ +G Graph │ │ │ │ +The type of the graph with internal properties. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:233 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +std::bitset< SIZE >::reference operator[](std::size_t v) │ │ │ │ +Access the bits directly. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:395 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_p_r_i_n_t_F_l_a_g_s │ │ │ │ +void printFlags() const │ │ │ │ +Prints the attributes of the edge for debugging. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ +friend std::ostream & operator<<(std::ostream &os, const EdgeProperties &props) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:300 │ │ │ │ +_D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_y_p_e_S_e_l_e_c_t_o_r_<_ _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g_,_ _A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_, │ │ │ │ +_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_P_,_ _V_M_,_ _E_M_ _>_ _>_:_:_T_y_p_e │ │ │ │ +Amg::PropertyGraphVertexPropertyMap< Amg::PropertiesGraph< G, Amg:: │ │ │ │ +VertexProperties, EP, VM, EM >, Amg::VertexProperties::VISITED > Type │ │ │ │ +DDeeffiinniittiioonn dependency.hh:288 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_n_f_l_u_e_n_c_e_s │ │ │ │ +bool influences() const │ │ │ │ +Checks whether the start vertex is influenced by the end vertex. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:332 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_I_s_o_l_a_t_e_d │ │ │ │ +void setIsolated() │ │ │ │ +Marks that node as being isolated. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:405 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_e_x_c_l_u_d_e_d_B_o_r_d_e_r │ │ │ │ +bool excludedBorder() const │ │ │ │ +Tests whether the vertex is excluded from the aggregation. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:455 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_V_i_s_i_t_e_d │ │ │ │ +void resetVisited() │ │ │ │ +Resets the visited flag. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:430 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_v_i_s_i_t_e_d │ │ │ │ +bool visited() const │ │ │ │ +Checks whether the node is marked as visited. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:425 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +Reference operator[](const Vertex &vertex) const │ │ │ │ +Get the properties associated to a vertex. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:275 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t │ │ │ │ +void reset() │ │ │ │ +Reset all flags. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:320 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_D_e_p_e_n_d_s │ │ │ │ +void resetDepends() │ │ │ │ +Resets the depends flag. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:345 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ +ReadWritePropertyMapTag Category │ │ │ │ +DDeeffiinniittiioonn dependency.hh:223 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_r_e_s_e_t_I_s_o_l_a_t_e_d │ │ │ │ +void resetIsolated() │ │ │ │ +Resets the isolated flag. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:415 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ +std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > │ │ │ │ +&criterion) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:113 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_S_t_r_o_n_g │ │ │ │ +bool isStrong() const │ │ │ │ +Checks whether the edge is strong. I.e. the influence or depends flag is set. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:377 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_f_r_o_n_t │ │ │ │ +bool front() const │ │ │ │ +Checks whether the node is marked as a front node. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:440 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +std::bitset< SIZE >::reference operator[](std::size_t v) │ │ │ │ +Access the bits directly. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:310 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_s_e_t_E_x_c_l_u_d_e_d_B_o_r_d_e_r │ │ │ │ +void setExcludedBorder() │ │ │ │ +Marks the vertex as excluded from the aggregation. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:450 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_i_s_O_n_e_W_a_y │ │ │ │ +bool isOneWay() const │ │ │ │ +Checks whether the edge is one way. I.e. either the influence or the depends │ │ │ │ +flag but is set. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:364 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_:_:_i_n_d_e_x │ │ │ │ +@ index │ │ │ │ +the index to access in the bitset. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:227 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_V_I_S_I_T_E_D │ │ │ │ +@ VISITED │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_I_S_O_L_A_T_E_D │ │ │ │ +@ ISOLATED │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_S_I_Z_E │ │ │ │ +@ SIZE │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_B_O_R_D_E_R │ │ │ │ +@ BORDER │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_:_:_F_R_O_N_T │ │ │ │ +@ FRONT │ │ │ │ +DDeeffiinniittiioonn dependency.hh:129 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_D_E_P_E_N_D │ │ │ │ +@ DEPEND │ │ │ │ +DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_S_I_Z_E │ │ │ │ +@ SIZE │ │ │ │ +DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s_:_:_I_N_F_L_U_E_N_C_E │ │ │ │ +@ INFLUENCE │ │ │ │ +DDeeffiinniittiioonn dependency.hh:43 │ │ │ │ +_D_u_n_e │ │ │ │ +DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +Class representing the properties of an edge in the matrix graph. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +Class representing a node in the matrix graph. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ +DDeeffiinniittiioonn dependency.hh:220 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ +Tag idnetifying the visited property of a vertex. │ │ │ │ +DDeeffiinniittiioonn properties.hh:29 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scaledidmatrix.hh File Reference │ │ │ +dune-istl: hierarchy.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,55 +65,56 @@ │ │ │

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
scaledidmatrix.hh File Reference
│ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

This file implements a quadratic matrix of fixed size which is a multiple of the identity. │ │ │ +

Provides a classes representing the hierarchies in AMG. │ │ │ More...

│ │ │ -
#include <cmath>
│ │ │ -#include <cstddef>
│ │ │ -#include <complex>
│ │ │ -#include <iostream>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include <dune/common/fmatrix.hh>
│ │ │ -#include <dune/common/diagonalmatrix.hh>
│ │ │ -#include <dune/common/ftraits.hh>
│ │ │ +
#include <list>
│ │ │ +#include <memory>
│ │ │ +#include <limits>
│ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ +#include <dune/common/timer.hh>
│ │ │ +#include <dune/common/bigunsignedint.hh>
│ │ │ +#include <dune/istl/paamg/construction.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::ScaledIdentityMatrix< K, n >
 A multiple of the identity matrix of static size. More...
class  Dune::Amg::Hierarchy< T, A >
 A hierarchy of containers (e.g. matrices or vectors) More...
 
struct  Dune::DenseMatrixAssigner< DenseMatrix, ScaledIdentityMatrix< field, N > >
 
struct  Dune::FieldTraits< ScaledIdentityMatrix< K, n > >
class  Dune::Amg::Hierarchy< T, A >::LevelIterator< C, T1 >
 Iterator over the levels in the hierarchy. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ + │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │

Detailed Description

│ │ │ -

This file implements a quadratic matrix of fixed size which is a multiple of the identity.

│ │ │ +

Provides a classes representing the hierarchies in AMG.

│ │ │ +
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,36 +1,38 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ + * _p_a_a_m_g │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -scaledidmatrix.hh File Reference │ │ │ │ -This file implements a quadratic matrix of fixed size which is a multiple of │ │ │ │ -the identity. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ +hierarchy.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Provides a classes representing the hierarchies in AMG. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ - class   _D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _> │ │ │ │ -  A multiple of the identity matrix of static size. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _T_,_ _A_ _> │ │ │ │ +  A hierarchy of containers (e.g. matrices or vectors) _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r_<_ _D_e_n_s_e_M_a_t_r_i_x_,_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _f_i_e_l_d_,_ _N │ │ │ │ - _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _> │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _T_,_ _A_ _>_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_<_ _C_,_ _T_1_ _> │ │ │ │ +  Iterator over the levels in the hierarchy. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -This file implements a quadratic matrix of fixed size which is a multiple of │ │ │ │ -the identity. │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scaledidmatrix.hh Source File │ │ │ +dune-istl: hierarchy.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,626 +70,423 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
scaledidmatrix.hh
│ │ │ +
hierarchy.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SCALEDIDMATRIX_HH
│ │ │ -
6#define DUNE_ISTL_SCALEDIDMATRIX_HH
│ │ │ +
5#ifndef DUNE_AMGHIERARCHY_HH
│ │ │ +
6#define DUNE_AMGHIERARCHY_HH
│ │ │
7
│ │ │ -
14#include <cmath>
│ │ │ -
15#include <cstddef>
│ │ │ -
16#include <complex>
│ │ │ -
17#include <iostream>
│ │ │ -
18#include <dune/common/exceptions.hh>
│ │ │ -
19#include <dune/common/fmatrix.hh>
│ │ │ -
20#include <dune/common/diagonalmatrix.hh>
│ │ │ -
21#include <dune/common/ftraits.hh>
│ │ │ -
22
│ │ │ -
23namespace Dune {
│ │ │ -
24
│ │ │ -
28 template<class K, int n>
│ │ │ -
│ │ │ - │ │ │ -
30 {
│ │ │ -
31 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix<K,n> > WrapperType;
│ │ │ -
32
│ │ │ -
33 public:
│ │ │ -
34 //===== type definitions and constants
│ │ │ -
35
│ │ │ -
37 typedef K field_type;
│ │ │ -
38
│ │ │ -
40 typedef K block_type;
│ │ │ -
41
│ │ │ -
43 typedef std::size_t size_type;
│ │ │ -
44
│ │ │ -
46 typedef DiagonalRowVector<K,n> row_type;
│ │ │ - │ │ │ -
48 typedef DiagonalRowVectorConst<K,n> const_row_type;
│ │ │ - │ │ │ -
50
│ │ │ -
52 enum {
│ │ │ -
54 rows = n,
│ │ │ -
56 cols = n
│ │ │ -
57 };
│ │ │ +
8#include <list>
│ │ │ +
9#include <memory>
│ │ │ +
10#include <limits>
│ │ │ +
11#include <dune/common/stdstreams.hh>
│ │ │ +
12#include <dune/common/timer.hh>
│ │ │ +
13#include <dune/common/bigunsignedint.hh>
│ │ │ + │ │ │ +
15
│ │ │ +
16namespace Dune
│ │ │ +
17{
│ │ │ +
18 namespace Amg
│ │ │ +
19 {
│ │ │ +
38 template<typename T, typename A=std::allocator<T> >
│ │ │ +
│ │ │ + │ │ │ +
40 {
│ │ │ +
41 public:
│ │ │ +
45 typedef T MemberType;
│ │ │ +
46
│ │ │ +
47 template<typename T1, typename T2>
│ │ │ +
48 class LevelIterator;
│ │ │ +
49
│ │ │ +
50 private:
│ │ │ +
54 struct Element
│ │ │ +
55 {
│ │ │ +
56 friend class LevelIterator<Hierarchy<T,A>, T>;
│ │ │ +
57 friend class LevelIterator<const Hierarchy<T,A>, const T>;
│ │ │
58
│ │ │ -
59 //===== constructors
│ │ │ - │ │ │ -
63
│ │ │ -
│ │ │ - │ │ │ -
67 : p_(k)
│ │ │ -
68 {}
│ │ │ -
│ │ │ -
69
│ │ │ -
70 //===== assignment from scalar
│ │ │ -
│ │ │ - │ │ │ -
72 {
│ │ │ -
73 p_ = k;
│ │ │ -
74 return *this;
│ │ │ -
75 }
│ │ │ -
│ │ │ -
76
│ │ │ -
77 // check if matrix is identical to other matrix (not only identical values)
│ │ │ -
│ │ │ -
78 bool identical(const ScaledIdentityMatrix<K,n>& other) const
│ │ │ -
79 {
│ │ │ -
80 return (this==&other);
│ │ │ -
81 }
│ │ │ -
│ │ │ -
82
│ │ │ -
83 //===== iterator interface to rows of the matrix
│ │ │ -
85 typedef ContainerWrapperIterator<const WrapperType, reference, reference> Iterator;
│ │ │ - │ │ │ - │ │ │ -
91 typedef typename row_type::Iterator ColIterator;
│ │ │ -
92
│ │ │ -
│ │ │ - │ │ │ -
95 {
│ │ │ -
96 return Iterator(WrapperType(this),0);
│ │ │ -
97 }
│ │ │ -
│ │ │ -
98
│ │ │ -
│ │ │ - │ │ │ -
101 {
│ │ │ -
102 return Iterator(WrapperType(this),n);
│ │ │ -
103 }
│ │ │ -
│ │ │ +
60 std::weak_ptr<Element> coarser_;
│ │ │ +
61
│ │ │ +
63 std::shared_ptr<Element> finer_;
│ │ │ +
64
│ │ │ +
66 std::shared_ptr<MemberType> element_;
│ │ │ +
67
│ │ │ +
69 std::shared_ptr<MemberType> redistributed_;
│ │ │ +
70 };
│ │ │ +
71 public:
│ │ │ +
72
│ │ │ +
76 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<Element>;
│ │ │ +
77
│ │ │ + │ │ │ +
79
│ │ │ +
│ │ │ +
84 Hierarchy(const std::shared_ptr<MemberType> & first);
│ │ │ +
85
│ │ │ +
│ │ │ +
89 Hierarchy() : levels_(0)
│ │ │ +
90 {}
│ │ │ +
│ │ │ +
91
│ │ │ +
│ │ │ +
95 Hierarchy(const Hierarchy& other);
│ │ │ +
96
│ │ │ +
│ │ │ + │ │ │ +
102
│ │ │ +
│ │ │ + │ │ │
104
│ │ │ -
│ │ │ - │ │ │ -
108 {
│ │ │ -
109 return Iterator(WrapperType(this),n-1);
│ │ │ -
110 }
│ │ │ -
│ │ │ -
111
│ │ │ -
│ │ │ - │ │ │ -
115 {
│ │ │ -
116 return Iterator(WrapperType(this),-1);
│ │ │ -
117 }
│ │ │ -
│ │ │ -
118
│ │ │ -
119
│ │ │ -
121 typedef ContainerWrapperIterator<const WrapperType, const_reference, const_reference> ConstIterator;
│ │ │ - │ │ │ - │ │ │ -
127 typedef typename const_row_type::ConstIterator ConstColIterator;
│ │ │ -
128
│ │ │ -
│ │ │ - │ │ │ -
131 {
│ │ │ -
132 return ConstIterator(WrapperType(this),0);
│ │ │ -
133 }
│ │ │ +
│ │ │ +
109 void addFiner(Arguments& args);
│ │ │ +
110
│ │ │ +
117 template<class C, class T1>
│ │ │ +
│ │ │ + │ │ │ +
119 : public BidirectionalIteratorFacade<LevelIterator<C,T1>,T1,T1&>
│ │ │ +
120 {
│ │ │ +
121 friend class LevelIterator<typename std::remove_const<C>::type,
│ │ │ +
122 typename std::remove_const<T1>::type >;
│ │ │ +
123 friend class LevelIterator<const typename std::remove_const<C>::type,
│ │ │ +
124 const typename std::remove_const<T1>::type >;
│ │ │ +
125
│ │ │ +
126 public:
│ │ │ +
│ │ │ + │ │ │ +
129 {}
│ │ │ +
│ │ │ +
130
│ │ │ +
│ │ │ +
131 LevelIterator(std::shared_ptr<Element> element)
│ │ │ +
132 : element_(element)
│ │ │ +
133 {}
│ │ │
│ │ │
134
│ │ │
│ │ │ - │ │ │ -
137 {
│ │ │ -
138 return ConstIterator(WrapperType(this),n);
│ │ │ -
139 }
│ │ │ +
136 LevelIterator(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ +
137 typename std::remove_const<T1>::type>& other)
│ │ │ +
138 : element_(other.element_)
│ │ │ +
139 {}
│ │ │
│ │ │
140
│ │ │ -
│ │ │ - │ │ │ -
144 {
│ │ │ -
145 return ConstIterator(WrapperType(this),n-1);
│ │ │ -
146 }
│ │ │ +
│ │ │ +
142 LevelIterator(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ +
143 const typename std::remove_const<T1>::type>& other)
│ │ │ +
144 : element_(other.element_)
│ │ │ +
145 {}
│ │ │
│ │ │ -
147
│ │ │ +
146
│ │ │
│ │ │ - │ │ │ -
151 {
│ │ │ -
152 return ConstIterator(WrapperType(this),-1);
│ │ │ -
153 }
│ │ │ -
│ │ │ -
154
│ │ │ -
155 //===== vector space arithmetic
│ │ │ -
156
│ │ │ -
│ │ │ - │ │ │ -
159 {
│ │ │ -
160 p_ += y.p_;
│ │ │ -
161 return *this;
│ │ │ -
162 }
│ │ │ -
│ │ │ -
163
│ │ │ -
│ │ │ - │ │ │ -
166 {
│ │ │ -
167 p_ -= y.p_;
│ │ │ -
168 return *this;
│ │ │ -
169 }
│ │ │ +
150 bool equals(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ +
151 typename std::remove_const<T1>::type>& other) const
│ │ │ +
152 {
│ │ │ +
153 return element_ == other.element_;
│ │ │ +
154 }
│ │ │ +
│ │ │ +
155
│ │ │ +
│ │ │ +
159 bool equals(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ +
160 const typename std::remove_const<T1>::type>& other) const
│ │ │ +
161 {
│ │ │ +
162 return element_ == other.element_;
│ │ │ +
163 }
│ │ │ +
│ │ │ +
164
│ │ │ +
│ │ │ +
166 T1& dereference() const
│ │ │ +
167 {
│ │ │ +
168 return *(element_->element_);
│ │ │ +
169 }
│ │ │
│ │ │
170
│ │ │
│ │ │ - │ │ │ -
173 {
│ │ │ -
174 p_ += k;
│ │ │ -
175 return *this;
│ │ │ -
176 }
│ │ │ -
│ │ │ -
177
│ │ │ -
│ │ │ - │ │ │ -
180 {
│ │ │ -
181 p_ -= k;
│ │ │ -
182 return *this;
│ │ │ -
183 }
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
186 {
│ │ │ -
187 p_ *= k;
│ │ │ -
188 return *this;
│ │ │ -
189 }
│ │ │ -
│ │ │ -
190
│ │ │ -
│ │ │ - │ │ │ -
193 {
│ │ │ -
194 p_ /= k;
│ │ │ -
195 return *this;
│ │ │ -
196 }
│ │ │ -
│ │ │ -
197
│ │ │ -
198 //===== binary operators
│ │ │ -
199
│ │ │ -
201 template <class Scalar,
│ │ │ -
202 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ -
│ │ │ -
203 friend auto operator* ( const ScaledIdentityMatrix& matrix, Scalar scalar)
│ │ │ -
204 {
│ │ │ - │ │ │ -
206 }
│ │ │ -
│ │ │ -
207
│ │ │ -
209 template <class Scalar,
│ │ │ -
210 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ -
│ │ │ -
211 friend auto operator* (Scalar scalar, const ScaledIdentityMatrix& matrix)
│ │ │ -
212 {
│ │ │ - │ │ │ -
214 }
│ │ │ + │ │ │ +
173 {
│ │ │ +
174 element_ = element_->coarser_.lock();
│ │ │ +
175 }
│ │ │ +
│ │ │ +
176
│ │ │ +
│ │ │ + │ │ │ +
179 {
│ │ │ +
180 element_ = element_->finer_;
│ │ │ +
181 }
│ │ │ +
│ │ │ +
182
│ │ │ +
│ │ │ +
187 bool isRedistributed() const
│ │ │ +
188 {
│ │ │ +
189 return (bool)element_->redistributed_;
│ │ │ +
190 }
│ │ │ +
│ │ │ +
191
│ │ │ +
│ │ │ + │ │ │ +
197 {
│ │ │ +
198 assert(element_->redistributed_);
│ │ │ +
199 return *element_->redistributed_;
│ │ │ +
200 }
│ │ │ +
│ │ │ +
│ │ │ +
201 void addRedistributed(std::shared_ptr<T1> t)
│ │ │ +
202 {
│ │ │ +
203 element_->redistributed_ = t;
│ │ │ +
204 }
│ │ │ +
│ │ │ +
205
│ │ │ +
│ │ │ + │ │ │ +
207 {
│ │ │ +
208 element_->redistributed_ = nullptr;
│ │ │ +
209 }
│ │ │ +
│ │ │ +
210
│ │ │ +
211 private:
│ │ │ +
212 std::shared_ptr<Element> element_;
│ │ │ +
213 };
│ │ │
│ │ │ -
215
│ │ │ -
216 //===== comparison ops
│ │ │ +
214
│ │ │ + │ │ │
217
│ │ │ -
│ │ │ -
219 bool operator==(const ScaledIdentityMatrix& other) const
│ │ │ -
220 {
│ │ │ -
221 return p_==other.scalar();
│ │ │ -
222 }
│ │ │ -
│ │ │ -
223
│ │ │ + │ │ │ +
220
│ │ │
│ │ │ -
225 bool operator!=(const ScaledIdentityMatrix& other) const
│ │ │ -
226 {
│ │ │ -
227 return p_!=other.scalar();
│ │ │ -
228 }
│ │ │ -
│ │ │ -
229
│ │ │ -
230 //===== linear maps
│ │ │ -
231
│ │ │ -
233 template<class X, class Y>
│ │ │ -
│ │ │ -
234 void mv (const X& x, Y& y) const
│ │ │ -
235 {
│ │ │ -
236#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
237 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
238 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
239#endif
│ │ │ -
240 for (size_type i=0; i<n; ++i)
│ │ │ -
241 y[i] = p_ * x[i];
│ │ │ -
242 }
│ │ │ -
│ │ │ -
243
│ │ │ -
245 template<class X, class Y>
│ │ │ -
│ │ │ -
246 void mtv (const X& x, Y& y) const
│ │ │ -
247 {
│ │ │ -
248 mv(x, y);
│ │ │ -
249 }
│ │ │ -
│ │ │ -
250
│ │ │ -
252 template<class X, class Y>
│ │ │ -
│ │ │ -
253 void umv (const X& x, Y& y) const
│ │ │ -
254 {
│ │ │ -
255#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
256 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
257 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
258#endif
│ │ │ -
259 for (size_type i=0; i<n; ++i)
│ │ │ -
260 y[i] += p_ * x[i];
│ │ │ -
261 }
│ │ │ -
│ │ │ -
262
│ │ │ -
264 template<class X, class Y>
│ │ │ -
│ │ │ -
265 void umtv (const X& x, Y& y) const
│ │ │ -
266 {
│ │ │ -
267#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
268 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
269 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
270#endif
│ │ │ -
271 for (size_type i=0; i<n; ++i)
│ │ │ -
272 y[i] += p_ * x[i];
│ │ │ -
273 }
│ │ │ -
│ │ │ -
274
│ │ │ -
276 template<class X, class Y>
│ │ │ -
│ │ │ -
277 void umhv (const X& x, Y& y) const
│ │ │ -
278 {
│ │ │ -
279#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
280 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
281 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
282#endif
│ │ │ -
283 for (size_type i=0; i<n; i++)
│ │ │ -
284 y[i] += conjugateComplex(p_)*x[i];
│ │ │ -
285 }
│ │ │ -
│ │ │ -
286
│ │ │ -
288 template<class X, class Y>
│ │ │ -
│ │ │ -
289 void mmv (const X& x, Y& y) const
│ │ │ -
290 {
│ │ │ -
291#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
292 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
293 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
294#endif
│ │ │ -
295 for (size_type i=0; i<n; ++i)
│ │ │ -
296 y[i] -= p_ * x[i];
│ │ │ -
297 }
│ │ │ -
│ │ │ -
298
│ │ │ -
300 template<class X, class Y>
│ │ │ -
│ │ │ -
301 void mmtv (const X& x, Y& y) const
│ │ │ -
302 {
│ │ │ -
303#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
304 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
305 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
306#endif
│ │ │ -
307 for (size_type i=0; i<n; ++i)
│ │ │ -
308 y[i] -= p_ * x[i];
│ │ │ -
309 }
│ │ │ -
│ │ │ -
310
│ │ │ -
312 template<class X, class Y>
│ │ │ -
│ │ │ -
313 void mmhv (const X& x, Y& y) const
│ │ │ -
314 {
│ │ │ -
315#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
316 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
317 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
318#endif
│ │ │ -
319 for (size_type i=0; i<n; i++)
│ │ │ -
320 y[i] -= conjugateComplex(p_)*x[i];
│ │ │ -
321 }
│ │ │ -
│ │ │ -
322
│ │ │ -
324 template<class X, class Y>
│ │ │ -
│ │ │ -
325 void usmv (const K& alpha, const X& x, Y& y) const
│ │ │ -
326 {
│ │ │ -
327#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
328 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
329 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
330#endif
│ │ │ -
331 for (size_type i=0; i<n; i++)
│ │ │ -
332 y[i] += alpha * p_ * x[i];
│ │ │ -
333 }
│ │ │ -
│ │ │ -
334
│ │ │ -
336 template<class X, class Y>
│ │ │ -
│ │ │ -
337 void usmtv (const K& alpha, const X& x, Y& y) const
│ │ │ -
338 {
│ │ │ -
339#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
340 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
341 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
342#endif
│ │ │ -
343 for (size_type i=0; i<n; i++)
│ │ │ -
344 y[i] += alpha * p_ * x[i];
│ │ │ -
345 }
│ │ │ -
│ │ │ -
346
│ │ │ -
348 template<class X, class Y>
│ │ │ -
│ │ │ -
349 void usmhv (const K& alpha, const X& x, Y& y) const
│ │ │ -
350 {
│ │ │ -
351#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
352 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
353 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
354#endif
│ │ │ -
355 for (size_type i=0; i<n; i++)
│ │ │ -
356 y[i] += alpha * conjugateComplex(p_) * x[i];
│ │ │ -
357 }
│ │ │ -
│ │ │ -
358
│ │ │ -
359 //===== norms
│ │ │ -
360
│ │ │ -
│ │ │ -
362 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ -
363 {
│ │ │ -
364 return fvmeta::sqrt(n*p_*p_);
│ │ │ -
365 }
│ │ │ -
│ │ │ -
366
│ │ │ -
│ │ │ -
368 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ -
369 {
│ │ │ -
370 return n*p_*p_;
│ │ │ -
371 }
│ │ │ -
│ │ │ -
372
│ │ │ -
│ │ │ -
374 typename FieldTraits<field_type>::real_type infinity_norm () const
│ │ │ -
375 {
│ │ │ -
376 return std::abs(p_);
│ │ │ -
377 }
│ │ │ -
│ │ │ -
378
│ │ │ -
│ │ │ -
380 typename FieldTraits<field_type>::real_type infinity_norm_real () const
│ │ │ -
381 {
│ │ │ -
382 return fvmeta::absreal(p_);
│ │ │ -
383 }
│ │ │ -
│ │ │ -
384
│ │ │ -
385 //===== solve
│ │ │ -
386
│ │ │ -
389 template<class V>
│ │ │ -
│ │ │ -
390 void solve (V& x, const V& b) const
│ │ │ -
391 {
│ │ │ -
392 for (int i=0; i<n; i++)
│ │ │ -
393 x[i] = b[i]/p_;
│ │ │ -
394 }
│ │ │ -
│ │ │ -
395
│ │ │ -
│ │ │ -
398 void invert()
│ │ │ -
399 {
│ │ │ -
400 p_ = 1/p_;
│ │ │ -
401 }
│ │ │ + │ │ │ +
226
│ │ │ +
│ │ │ + │ │ │ +
232
│ │ │ +
233
│ │ │ +
│ │ │ + │ │ │ +
239
│ │ │ +
│ │ │ + │ │ │ +
245
│ │ │ +
│ │ │ +
250 std::size_t levels() const;
│ │ │ +
251
│ │ │ +
252 private:
│ │ │ +
258 std::shared_ptr<MemberType> originalFinest_;
│ │ │ +
260 std::shared_ptr<Element> finest_;
│ │ │ +
262 std::shared_ptr<Element> coarsest_;
│ │ │ +
264 Allocator allocator_;
│ │ │ +
266 int levels_;
│ │ │ +
267 };
│ │ │ +
268
│ │ │ +
269 template<class T, class A>
│ │ │ +
│ │ │ +
270 Hierarchy<T,A>::Hierarchy(const std::shared_ptr<MemberType> & first)
│ │ │ +
271 : originalFinest_(first)
│ │ │ +
272 {
│ │ │ +
273 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
274 finest_->element_ = originalFinest_;
│ │ │ +
275 coarsest_ = finest_;
│ │ │ +
276 levels_ = 1;
│ │ │ +
277 }
│ │ │ +
│ │ │ +
278
│ │ │ +
280 //TODO: do we actually want to support this? This might be very expensive?!
│ │ │ +
281 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
283 : allocator_(other.allocator_),
│ │ │ +
284 levels_(other.levels_)
│ │ │ +
285 {
│ │ │ +
286 if(!other.finest_)
│ │ │ +
287 {
│ │ │ +
288 finest_=coarsest_=nullptr;
│ │ │ +
289 return;
│ │ │ +
290 }
│ │ │ +
291 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
292 std::shared_ptr<Element> finer_;
│ │ │ +
293 std::shared_ptr<Element> current_ = finest_;
│ │ │ +
294 std::weak_ptr<Element> otherWeak_ = other.finest_;
│ │ │ +
295
│ │ │ +
296 while(! otherWeak_.expired())
│ │ │ +
297 {
│ │ │ +
298 // create shared_ptr from weak_ptr, we just checked that this is safe
│ │ │ +
299 std::shared_ptr<Element> otherCurrent_ = std::shared_ptr<Element>(otherWeak_);
│ │ │ +
300 // clone current level
│ │ │ +
301 //TODO: should we use the allocator?
│ │ │ +
302 current_->element_ =
│ │ │ +
303 std::make_shared<MemberType>(*(otherCurrent_->element_));
│ │ │ +
304 current_->finer_=finer_;
│ │ │ +
305 if(otherCurrent_->redistributed_)
│ │ │ +
306 current_->redistributed_ =
│ │ │ +
307 std::make_shared<MemberType>(*(otherCurrent_->redistributed_));
│ │ │ +
308 finer_=current_;
│ │ │ +
309 if(not otherCurrent_->coarser_.expired())
│ │ │ +
310 {
│ │ │ +
311 auto c = std::allocate_shared<Element>(allocator_);
│ │ │ +
312 current_->coarser_ = c;
│ │ │ +
313 current_ = c;
│ │ │ +
314 }
│ │ │ +
315 // go to coarser level
│ │ │ +
316 otherWeak_ = otherCurrent_->coarser_;
│ │ │ +
317 }
│ │ │ +
318 coarsest_=current_;
│ │ │ +
319 }
│ │ │ +
│ │ │ +
320
│ │ │ +
321 template<class T, class A>
│ │ │ +
│ │ │ +
322 std::size_t Hierarchy<T,A>::levels() const
│ │ │ +
323 {
│ │ │ +
324 return levels_;
│ │ │ +
325 }
│ │ │ +
│ │ │ +
│ │ │ +
326
│ │ │ +
327 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
329 {
│ │ │ +
330 coarsest_->redistributed_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
331 }
│ │ │ +
│ │ │ +
332
│ │ │ +
333 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
335 {
│ │ │ +
336 if(!coarsest_) {
│ │ │ +
337 // we have no levels at all...
│ │ │ +
338 assert(!finest_);
│ │ │ +
339 // allocate into the shared_ptr
│ │ │ +
340 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
341 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
342 coarsest_->element_ = originalFinest_;
│ │ │ +
343 finest_ = coarsest_;
│ │ │ +
344 }else{
│ │ │ +
345 auto old_coarsest = coarsest_;
│ │ │ +
346 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
347 coarsest_->finer_ = old_coarsest;
│ │ │ +
348 coarsest_->element_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
349 old_coarsest->coarser_ = coarsest_;
│ │ │ +
350 }
│ │ │ +
351 ++levels_;
│ │ │ +
352 }
│ │ │ +
│ │ │ +
353
│ │ │ +
354
│ │ │ +
355 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
357 {
│ │ │ +
358 //TODO: wouldn't it be better to do this in the constructor?'
│ │ │ +
359 if(!finest_) {
│ │ │ +
360 // we have no levels at all...
│ │ │ +
361 assert(!coarsest_);
│ │ │ +
362 // allocate into the shared_ptr
│ │ │ +
363 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
364 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
365 finest_->element = originalFinest_;
│ │ │ +
366 coarsest_ = finest_;
│ │ │ +
367 }else{
│ │ │ +
368 finest_->finer_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
369 finest_->finer_->coarser_ = finest_;
│ │ │ +
370 finest_ = finest_->finer_;
│ │ │ +
371 finest_->element = ConstructionTraits<T>::construct(args);
│ │ │ +
372 }
│ │ │ +
373 ++levels_;
│ │ │ +
374 }
│ │ │ +
│ │ │ +
375
│ │ │ +
376 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
378 {
│ │ │ +
379 return Iterator(finest_);
│ │ │ +
380 }
│ │ │ +
│ │ │ +
381
│ │ │ +
382 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
384 {
│ │ │ +
385 return Iterator(coarsest_);
│ │ │ +
386 }
│ │ │ +
│ │ │ +
387
│ │ │ +
388 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
390 {
│ │ │ +
391 return ConstIterator(finest_);
│ │ │ +
392 }
│ │ │ +
│ │ │ +
393
│ │ │ +
394 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
396 {
│ │ │ +
397 return ConstIterator(coarsest_);
│ │ │ +
398 }
│ │ │ +
│ │ │
│ │ │ +
400 } // namespace Amg
│ │ │ +
401} // namespace Dune
│ │ │
402
│ │ │ -
│ │ │ -
404 K determinant () const {
│ │ │ -
405 return std::pow(p_,n);
│ │ │ -
406 }
│ │ │ -
│ │ │ -
407
│ │ │ -
408 //===== sizes
│ │ │ -
409
│ │ │ -
│ │ │ -
411 size_type N () const
│ │ │ -
412 {
│ │ │ -
413 return n;
│ │ │ -
414 }
│ │ │ -
│ │ │ -
415
│ │ │ -
│ │ │ -
417 size_type M () const
│ │ │ -
418 {
│ │ │ -
419 return n;
│ │ │ -
420 }
│ │ │ -
│ │ │ -
421
│ │ │ -
422 //===== query
│ │ │ -
423
│ │ │ -
│ │ │ -
425 bool exists (size_type i, size_type j) const
│ │ │ -
426 {
│ │ │ -
427#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
428 if (i<0 || i>=n) DUNE_THROW(FMatrixError,"row index out of range");
│ │ │ -
429 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range");
│ │ │ -
430#endif
│ │ │ -
431 return i==j;
│ │ │ -
432 }
│ │ │ -
│ │ │ -
433
│ │ │ -
434 //===== conversion operator
│ │ │ -
435
│ │ │ -
│ │ │ -
437 friend std::ostream& operator<< (std::ostream& s, const ScaledIdentityMatrix<K,n>& a)
│ │ │ -
438 {
│ │ │ -
439 for (size_type i=0; i<n; i++) {
│ │ │ -
440 for (size_type j=0; j<n; j++)
│ │ │ -
441 s << ((i==j) ? a.p_ : 0) << " ";
│ │ │ -
442 s << std::endl;
│ │ │ -
443 }
│ │ │ -
444 return s;
│ │ │ -
445 }
│ │ │ -
│ │ │ -
446
│ │ │ -
│ │ │ - │ │ │ -
449 {
│ │ │ -
450 return reference(const_cast<K*>(&p_), i);
│ │ │ -
451 }
│ │ │ -
│ │ │ -
452
│ │ │ -
│ │ │ - │ │ │ -
455 {
│ │ │ -
456 return const_reference(const_cast<K*>(&p_), i);
│ │ │ -
457 }
│ │ │ -
│ │ │ -
458
│ │ │ -
│ │ │ -
460 const K& diagonal(size_type /*i*/) const
│ │ │ -
461 {
│ │ │ -
462 return p_;
│ │ │ -
463 }
│ │ │ -
│ │ │ -
464
│ │ │ -
│ │ │ - │ │ │ -
467 {
│ │ │ -
468 return p_;
│ │ │ -
469 }
│ │ │ -
│ │ │ -
470
│ │ │ -
│ │ │ -
473 const K& scalar() const
│ │ │ -
474 {
│ │ │ -
475 return p_;
│ │ │ -
476 }
│ │ │ -
│ │ │ -
477
│ │ │ -
│ │ │ - │ │ │ -
481 {
│ │ │ -
482 return p_;
│ │ │ -
483 }
│ │ │ -
│ │ │ -
484
│ │ │ -
485 private:
│ │ │ -
486 // the data, very simply a single number
│ │ │ -
487 K p_;
│ │ │ -
488
│ │ │ -
489 };
│ │ │ -
│ │ │ -
490
│ │ │ -
491 template <class DenseMatrix, class field, int N>
│ │ │ -
│ │ │ -
492 struct DenseMatrixAssigner<DenseMatrix, ScaledIdentityMatrix<field, N>> {
│ │ │ -
│ │ │ -
493 static void apply(DenseMatrix& denseMatrix,
│ │ │ - │ │ │ -
495 assert(denseMatrix.M() == N);
│ │ │ -
496 assert(denseMatrix.N() == N);
│ │ │ -
497 denseMatrix = field(0);
│ │ │ -
498 for (int i = 0; i < N; ++i)
│ │ │ -
499 denseMatrix[i][i] = rhs.scalar();
│ │ │ -
500 }
│ │ │ -
│ │ │ -
501 };
│ │ │ -
│ │ │ -
502
│ │ │ -
503 template<class K, int n>
│ │ │ -
│ │ │ -
504 struct FieldTraits< ScaledIdentityMatrix<K, n> >
│ │ │ -
505 {
│ │ │ - │ │ │ -
507 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ -
508 };
│ │ │ -
│ │ │ -
509
│ │ │ -
510} // end namespace
│ │ │ -
511
│ │ │ -
512#endif
│ │ │ +
403#endif
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
│ │ │ +
Helper classes for the construction of classes without empty constructor.
│ │ │ +
Hierarchy(const Hierarchy &other)
Copy constructor (deep copy!).
Definition hierarchy.hh:282
│ │ │ +
void addRedistributedOnCoarsest(Arguments &args)
Definition hierarchy.hh:328
│ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ +
ConstIterator coarsest() const
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:395
│ │ │ +
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ +
void addFiner(Arguments &args)
Add an element on a finer level.
Definition hierarchy.hh:356
│ │ │ +
Hierarchy(const std::shared_ptr< MemberType > &first)
Construct a new hierarchy.
Definition hierarchy.hh:270
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
Iterator coarsest()
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:383
│ │ │ +
ConstIterator finest() const
Get an iterator positioned at the finest level.
Definition hierarchy.hh:389
│ │ │ +
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
A multiple of the identity matrix of static size.
Definition scaledidmatrix.hh:30
│ │ │ -
void usmhv(const K &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition scaledidmatrix.hh:349
│ │ │ -
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition scaledidmatrix.hh:301
│ │ │ -
ScaledIdentityMatrix & operator-=(const ScaledIdentityMatrix &y)
vector space subtraction
Definition scaledidmatrix.hh:165
│ │ │ -
const_row_type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:127
│ │ │ -
ConstIterator end() const
end iterator
Definition scaledidmatrix.hh:136
│ │ │ -
Iterator beforeBegin()
Definition scaledidmatrix.hh:114
│ │ │ -
bool operator!=(const ScaledIdentityMatrix &other) const
incomparison operator
Definition scaledidmatrix.hh:225
│ │ │ -
void mmv(const X &x, Y &y) const
y -= A x
Definition scaledidmatrix.hh:289
│ │ │ -
std::size_t size_type
The type used for the index access and size operations.
Definition scaledidmatrix.hh:43
│ │ │ -
void usmv(const K &alpha, const X &x, Y &y) const
y += alpha A x
Definition scaledidmatrix.hh:325
│ │ │ -
row_type::Iterator ColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:91
│ │ │ -
const_row_type const_reference
Definition scaledidmatrix.hh:49
│ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition scaledidmatrix.hh:234
│ │ │ -
void umtv(const X &x, Y &y) const
y += A^T x
Definition scaledidmatrix.hh:265
│ │ │ -
void umhv(const X &x, Y &y) const
y += A^H x
Definition scaledidmatrix.hh:277
│ │ │ -
DiagonalRowVector< K, n > row_type
Each row is implemented by a field vector.
Definition scaledidmatrix.hh:46
│ │ │ -
ContainerWrapperIterator< const WrapperType, reference, reference > Iterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:85
│ │ │ -
Iterator beforeEnd()
Definition scaledidmatrix.hh:107
│ │ │ -
K determinant() const
calculates the determinant of this matrix
Definition scaledidmatrix.hh:404
│ │ │ -
K field_type
export the type representing the field
Definition scaledidmatrix.hh:37
│ │ │ -
void usmtv(const K &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition scaledidmatrix.hh:337
│ │ │ -
Iterator end()
end iterator
Definition scaledidmatrix.hh:100
│ │ │ -
Iterator iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:87
│ │ │ -
const K & scalar() const
Get const reference to the scalar diagonal value.
Definition scaledidmatrix.hh:473
│ │ │ -
void umv(const X &x, Y &y) const
y += A x
Definition scaledidmatrix.hh:253
│ │ │ -
const K & diagonal(size_type) const
Get const reference to diagonal entry.
Definition scaledidmatrix.hh:460
│ │ │ -
@ rows
The number of rows.
Definition scaledidmatrix.hh:54
│ │ │ -
@ cols
The number of columns.
Definition scaledidmatrix.hh:56
│ │ │ -
ScaledIdentityMatrix & operator=(const K &k)
Definition scaledidmatrix.hh:71
│ │ │ -
ContainerWrapperIterator< const WrapperType, const_reference, const_reference > ConstIterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:121
│ │ │ -
K & diagonal(size_type)
Get reference to diagonal entry.
Definition scaledidmatrix.hh:466
│ │ │ -
void solve(V &x, const V &b) const
Solve system A x = b.
Definition scaledidmatrix.hh:390
│ │ │ -
bool exists(size_type i, size_type j) const
return true when (i,j) is in pattern
Definition scaledidmatrix.hh:425
│ │ │ -
Iterator RowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:89
│ │ │ -
ConstIterator const_iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:123
│ │ │ -
ScaledIdentityMatrix()
Default constructor.
Definition scaledidmatrix.hh:62
│ │ │ -
bool operator==(const ScaledIdentityMatrix &other) const
comparison operator
Definition scaledidmatrix.hh:219
│ │ │ -
ConstIterator beforeBegin() const
Definition scaledidmatrix.hh:150
│ │ │ -
ScaledIdentityMatrix & operator/=(const K &k)
vector space division by scalar
Definition scaledidmatrix.hh:192
│ │ │ -
friend std::ostream & operator<<(std::ostream &s, const ScaledIdentityMatrix< K, n > &a)
Sends the matrix to an output stream.
Definition scaledidmatrix.hh:437
│ │ │ -
FieldTraits< field_type >::real_type frobenius_norm2() const
square of frobenius norm, need for block recursion
Definition scaledidmatrix.hh:368
│ │ │ -
FieldTraits< field_type >::real_type frobenius_norm() const
frobenius norm: sqrt(sum over squared values of entries)
Definition scaledidmatrix.hh:362
│ │ │ -
FieldTraits< field_type >::real_type infinity_norm() const
infinity norm (row sum norm, how to generalize for blocks?)
Definition scaledidmatrix.hh:374
│ │ │ -
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:125
│ │ │ -
ConstIterator beforeEnd() const
Definition scaledidmatrix.hh:143
│ │ │ -
size_type M() const
number of blocks in column direction
Definition scaledidmatrix.hh:417
│ │ │ -
const_reference operator[](size_type i) const
Return const_reference object as row replacement.
Definition scaledidmatrix.hh:454
│ │ │ -
ScaledIdentityMatrix(const K &k)
Constructor initializing the whole matrix with a scalar.
Definition scaledidmatrix.hh:66
│ │ │ -
friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar)
vector space multiplication with scalar
Definition scaledidmatrix.hh:203
│ │ │ -
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition scaledidmatrix.hh:380
│ │ │ -
ScaledIdentityMatrix & operator*=(const K &k)
vector space multiplication with scalar
Definition scaledidmatrix.hh:185
│ │ │ -
bool identical(const ScaledIdentityMatrix< K, n > &other) const
Definition scaledidmatrix.hh:78
│ │ │ -
void invert()
Compute inverse.
Definition scaledidmatrix.hh:398
│ │ │ -
Iterator begin()
begin iterator
Definition scaledidmatrix.hh:94
│ │ │ -
K & scalar()
Get reference to the scalar diagonal value.
Definition scaledidmatrix.hh:480
│ │ │ -
row_type reference
Definition scaledidmatrix.hh:47
│ │ │ -
K block_type
export the type representing the components
Definition scaledidmatrix.hh:40
│ │ │ -
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition scaledidmatrix.hh:313
│ │ │ -
ScaledIdentityMatrix & operator+=(const ScaledIdentityMatrix &y)
vector space addition
Definition scaledidmatrix.hh:158
│ │ │ -
DiagonalRowVectorConst< K, n > const_row_type
Definition scaledidmatrix.hh:48
│ │ │ -
void mtv(const X &x, Y &y) const
y = A^T x
Definition scaledidmatrix.hh:246
│ │ │ -
reference operator[](size_type i)
Return reference object as row replacement.
Definition scaledidmatrix.hh:448
│ │ │ -
ConstIterator begin() const
begin iterator
Definition scaledidmatrix.hh:130
│ │ │ -
size_type N() const
number of blocks in row direction
Definition scaledidmatrix.hh:411
│ │ │ -
static void apply(DenseMatrix &denseMatrix, ScaledIdentityMatrix< field, N > const &rhs)
Definition scaledidmatrix.hh:493
│ │ │ -
typename ScaledIdentityMatrix< K, n >::field_type field_type
Definition scaledidmatrix.hh:506
│ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition scaledidmatrix.hh:507
│ │ │ +
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ +
T MemberType
The type of the container we store.
Definition hierarchy.hh:45
│ │ │ +
LevelIterator< Hierarchy< T, A >, T > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ +
LevelIterator< const Hierarchy< T, A >, const T > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ +
ConstructionTraits< T >::Arguments Arguments
Definition hierarchy.hh:78
│ │ │ +
Hierarchy()
Construct an empty hierarchy.
Definition hierarchy.hh:89
│ │ │ +
typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator
The allocator to use for the list elements.
Definition hierarchy.hh:76
│ │ │ +
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ +
LevelIterator(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:136
│ │ │ +
void addRedistributed(std::shared_ptr< T1 > t)
Definition hierarchy.hh:201
│ │ │ +
T1 & dereference() const
Dereference the iterator.
Definition hierarchy.hh:166
│ │ │ +
bool equals(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:150
│ │ │ +
bool isRedistributed() const
Check whether there was a redistribution at the current level.
Definition hierarchy.hh:187
│ │ │ +
bool equals(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:159
│ │ │ +
void increment()
Move to the next coarser level.
Definition hierarchy.hh:172
│ │ │ +
LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:142
│ │ │ +
void deleteRedistributed()
Definition hierarchy.hh:206
│ │ │ +
void decrement()
Move to the next fine level.
Definition hierarchy.hh:178
│ │ │ +
LevelIterator(std::shared_ptr< Element > element)
Definition hierarchy.hh:131
│ │ │ +
T1 & getRedistributed() const
Get the redistributed container.
Definition hierarchy.hh:196
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,711 +1,442 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -scaledidmatrix.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +hierarchy.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SCALEDIDMATRIX_HH │ │ │ │ -6#define DUNE_ISTL_SCALEDIDMATRIX_HH │ │ │ │ +5#ifndef DUNE_AMGHIERARCHY_HH │ │ │ │ +6#define DUNE_AMGHIERARCHY_HH │ │ │ │ 7 │ │ │ │ -14#include │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17#include │ │ │ │ -18#include │ │ │ │ -19#include │ │ │ │ -20#include │ │ │ │ -21#include │ │ │ │ -22 │ │ │ │ -23namespace _D_u_n_e { │ │ │ │ -24 │ │ │ │ -28 template │ │ │ │ -_2_9 class _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ -30 { │ │ │ │ -31 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix > WrapperType; │ │ │ │ -32 │ │ │ │ -33 public: │ │ │ │ -34 //===== type definitions and constants │ │ │ │ -35 │ │ │ │ -_3_7 typedef K _f_i_e_l_d___t_y_p_e; │ │ │ │ -38 │ │ │ │ -_4_0 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ -41 │ │ │ │ -_4_3 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ -44 │ │ │ │ -_4_6 typedef DiagonalRowVector _r_o_w___t_y_p_e; │ │ │ │ -_4_7 typedef _r_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ -_4_8 typedef DiagonalRowVectorConst _c_o_n_s_t___r_o_w___t_y_p_e; │ │ │ │ -_4_9 typedef _c_o_n_s_t___r_o_w___t_y_p_e _c_o_n_s_t___r_e_f_e_r_e_n_c_e; │ │ │ │ -50 │ │ │ │ -52 enum { │ │ │ │ -_5_4 _r_o_w_s = n, │ │ │ │ -56 _c_o_l_s = n │ │ │ │ -_5_7 }; │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ +15 │ │ │ │ +16namespace _D_u_n_e │ │ │ │ +17{ │ │ │ │ +18 namespace Amg │ │ │ │ +19 { │ │ │ │ +38 template > │ │ │ │ +_3_9 class _H_i_e_r_a_r_c_h_y │ │ │ │ +40 { │ │ │ │ +41 public: │ │ │ │ +_4_5 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ +46 │ │ │ │ +47 template │ │ │ │ +48 class _L_e_v_e_l_I_t_e_r_a_t_o_r; │ │ │ │ +49 │ │ │ │ +50 private: │ │ │ │ +54 struct Element │ │ │ │ +55 { │ │ │ │ +56 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r<_H_i_e_r_a_r_c_h_y, T>; │ │ │ │ +57 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r, const T>; │ │ │ │ 58 │ │ │ │ -59 //===== constructors │ │ │ │ -_6_2 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x () {} │ │ │ │ -63 │ │ │ │ -_6_6 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x (const K& k) │ │ │ │ -67 : p_(k) │ │ │ │ -68 {} │ │ │ │ -69 │ │ │ │ -70 //===== assignment from scalar │ │ │ │ -_7_1 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_=_ (const K& k) │ │ │ │ -72 { │ │ │ │ -73 p_ = k; │ │ │ │ -74 return *this; │ │ │ │ -75 } │ │ │ │ -76 │ │ │ │ -77 // check if matrix is identical to other matrix (not only identical values) │ │ │ │ -_7_8 bool _i_d_e_n_t_i_c_a_l(const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_K_,_n_>& other) const │ │ │ │ -79 { │ │ │ │ -80 return (this==&other); │ │ │ │ -81 } │ │ │ │ -82 │ │ │ │ -83 //===== iterator interface to rows of the matrix │ │ │ │ -_8_5 typedef ContainerWrapperIterator │ │ │ │ -_I_t_e_r_a_t_o_r; │ │ │ │ -_8_7 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ -_8_9 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ -_9_1 typedef typename row_type::Iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ -92 │ │ │ │ -_9_4 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ -95 { │ │ │ │ -96 return _I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ -97 } │ │ │ │ -98 │ │ │ │ -_1_0_0 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ -101 { │ │ │ │ -102 return _I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ -103 } │ │ │ │ +60 std::weak_ptr coarser_; │ │ │ │ +61 │ │ │ │ +63 std::shared_ptr finer_; │ │ │ │ +64 │ │ │ │ +66 std::shared_ptr element_; │ │ │ │ +67 │ │ │ │ +_6_9 std::shared_ptr redistributed_; │ │ │ │ +70 }; │ │ │ │ +71 public: │ │ │ │ +72 │ │ │ │ +_7_6 using _A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ +rebind_alloc; │ │ │ │ +77 │ │ │ │ +_7_8 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _A_r_g_u_m_e_n_t_s; │ │ │ │ +79 │ │ │ │ +_8_4 _H_i_e_r_a_r_c_h_y(const std::shared_ptr & first); │ │ │ │ +85 │ │ │ │ +_8_9 _H_i_e_r_a_r_c_h_y() : levels_(0) │ │ │ │ +90 {} │ │ │ │ +91 │ │ │ │ +_9_5 _H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other); │ │ │ │ +96 │ │ │ │ +_1_0_1 void _a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ +102 │ │ │ │ +_1_0_3 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ 104 │ │ │ │ -_1_0_7 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ -108 { │ │ │ │ -109 return _I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ -110 } │ │ │ │ -111 │ │ │ │ -_1_1_4 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ -115 { │ │ │ │ -116 return _I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ -117 } │ │ │ │ -118 │ │ │ │ -119 │ │ │ │ -_1_2_1 typedef ContainerWrapperIterator _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ -_1_2_3 typedef _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ -_1_2_5 typedef _C_o_n_s_t_I_t_e_r_a_t_o_r _C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ -_1_2_7 typedef typename const_row_type::ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ -128 │ │ │ │ -_1_3_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ -131 { │ │ │ │ -132 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ -133 } │ │ │ │ +_1_0_9 void _a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ +110 │ │ │ │ +117 template │ │ │ │ +_1_1_8 class _L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +119 : public BidirectionalIteratorFacade,T1,T1&> │ │ │ │ +120 { │ │ │ │ +121 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +122 typename std::remove_const::type >; │ │ │ │ +123 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +124 const typename std::remove_const::type >; │ │ │ │ +125 │ │ │ │ +126 public: │ │ │ │ +_1_2_8 _L_e_v_e_l_I_t_e_r_a_t_o_r() │ │ │ │ +129 {} │ │ │ │ +130 │ │ │ │ +_1_3_1 _L_e_v_e_l_I_t_e_r_a_t_o_r(std::shared_ptr element) │ │ │ │ +132 : element_(element) │ │ │ │ +133 {} │ │ │ │ 134 │ │ │ │ -_1_3_6 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ -137 { │ │ │ │ -138 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ -139 } │ │ │ │ +_1_3_6 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +137 typename std::remove_const::type>& other) │ │ │ │ +138 : element_(other.element_) │ │ │ │ +139 {} │ │ │ │ 140 │ │ │ │ -_1_4_3 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ -144 { │ │ │ │ -145 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ -146 } │ │ │ │ -147 │ │ │ │ -_1_5_0 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () const │ │ │ │ -151 { │ │ │ │ -152 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ -153 } │ │ │ │ -154 │ │ │ │ -155 //===== vector space arithmetic │ │ │ │ -156 │ │ │ │ -_1_5_8 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& y) │ │ │ │ -159 { │ │ │ │ -160 p_ += y.p_; │ │ │ │ -161 return *this; │ │ │ │ -162 } │ │ │ │ -163 │ │ │ │ -_1_6_5 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& y) │ │ │ │ -166 { │ │ │ │ -167 p_ -= y.p_; │ │ │ │ -168 return *this; │ │ │ │ +_1_4_2 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r:: │ │ │ │ +type, │ │ │ │ +143 const typename std::remove_const::type>& other) │ │ │ │ +144 : element_(other.element_) │ │ │ │ +145 {} │ │ │ │ +146 │ │ │ │ +_1_5_0 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +151 typename std::remove_const::type>& other) const │ │ │ │ +152 { │ │ │ │ +153 return element_ == other.element_; │ │ │ │ +154 } │ │ │ │ +155 │ │ │ │ +_1_5_9 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +160 const typename std::remove_const::type>& other) const │ │ │ │ +161 { │ │ │ │ +162 return element_ == other.element_; │ │ │ │ +163 } │ │ │ │ +164 │ │ │ │ +_1_6_6 T1& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ +167 { │ │ │ │ +168 return *(element_->element_); │ │ │ │ 169 } │ │ │ │ 170 │ │ │ │ -_1_7_2 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_+_=_ (const K& k) │ │ │ │ +_1_7_2 void _i_n_c_r_e_m_e_n_t() │ │ │ │ 173 { │ │ │ │ -174 p_ += k; │ │ │ │ -175 return *this; │ │ │ │ -176 } │ │ │ │ -177 │ │ │ │ -_1_7_9 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_-_=_ (const K& k) │ │ │ │ -180 { │ │ │ │ -181 p_ -= k; │ │ │ │ -182 return *this; │ │ │ │ -183 } │ │ │ │ -_1_8_5 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_*_=_ (const K& k) │ │ │ │ -186 { │ │ │ │ -187 p_ *= k; │ │ │ │ -188 return *this; │ │ │ │ -189 } │ │ │ │ -190 │ │ │ │ -_1_9_2 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& _o_p_e_r_a_t_o_r_/_=_ (const K& k) │ │ │ │ -193 { │ │ │ │ -194 p_ /= k; │ │ │ │ -195 return *this; │ │ │ │ -196 } │ │ │ │ -197 │ │ │ │ -198 //===== binary operators │ │ │ │ -199 │ │ │ │ -201 template ::value, int> = 0> │ │ │ │ -_2_0_3 friend auto _o_p_e_r_a_t_o_r_*_ ( const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& matrix, Scalar _s_c_a_l_a_r) │ │ │ │ -204 { │ │ │ │ -205 return _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_K_,_S_c_a_l_a_r_>_:_: │ │ │ │ -_P_r_o_m_o_t_e_d_T_y_p_e, n>{matrix._s_c_a_l_a_r()*_s_c_a_l_a_r}; │ │ │ │ -206 } │ │ │ │ -207 │ │ │ │ -209 template ::value, int> = 0> │ │ │ │ -_2_1_1 friend auto _o_p_e_r_a_t_o_r_*_ (Scalar _s_c_a_l_a_r, const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& matrix) │ │ │ │ -212 { │ │ │ │ -213 return _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _P_r_o_m_o_t_i_o_n_T_r_a_i_t_s_<_S_c_a_l_a_r_,_K_>_:_: │ │ │ │ -_P_r_o_m_o_t_e_d_T_y_p_e, n>{_s_c_a_l_a_r*matrix._s_c_a_l_a_r()}; │ │ │ │ -214 } │ │ │ │ -215 │ │ │ │ -216 //===== comparison ops │ │ │ │ +174 element_ = element_->coarser_.lock(); │ │ │ │ +175 } │ │ │ │ +176 │ │ │ │ +_1_7_8 void _d_e_c_r_e_m_e_n_t() │ │ │ │ +179 { │ │ │ │ +180 element_ = element_->finer_; │ │ │ │ +181 } │ │ │ │ +182 │ │ │ │ +_1_8_7 bool _i_s_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ +188 { │ │ │ │ +189 return (bool)element_->redistributed_; │ │ │ │ +190 } │ │ │ │ +191 │ │ │ │ +_1_9_6 T1& _g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ +197 { │ │ │ │ +198 assert(element_->redistributed_); │ │ │ │ +199 return *element_->redistributed_; │ │ │ │ +200 } │ │ │ │ +_2_0_1 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d(std::shared_ptr t) │ │ │ │ +202 { │ │ │ │ +203 element_->redistributed_ = t; │ │ │ │ +204 } │ │ │ │ +205 │ │ │ │ +_2_0_6 void _d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d() │ │ │ │ +207 { │ │ │ │ +208 element_->redistributed_ = nullptr; │ │ │ │ +209 } │ │ │ │ +210 │ │ │ │ +211 private: │ │ │ │ +212 std::shared_ptr element_; │ │ │ │ +213 }; │ │ │ │ +214 │ │ │ │ +_2_1_6 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_H_i_e_r_a_r_c_h_y_<_T_,_A_>,T> _I_t_e_r_a_t_o_r; │ │ │ │ 217 │ │ │ │ -_2_1_9 bool _o_p_e_r_a_t_o_r_=_=(const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& other) const │ │ │ │ -220 { │ │ │ │ -221 return p_==other._s_c_a_l_a_r(); │ │ │ │ -222 } │ │ │ │ -223 │ │ │ │ -_2_2_5 bool _o_p_e_r_a_t_o_r_!_=(const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& other) const │ │ │ │ -226 { │ │ │ │ -227 return p_!=other._s_c_a_l_a_r(); │ │ │ │ -228 } │ │ │ │ -229 │ │ │ │ -230 //===== linear maps │ │ │ │ -231 │ │ │ │ -233 template │ │ │ │ -_2_3_4 void _m_v (const X& x, Y& y) const │ │ │ │ -235 { │ │ │ │ -236#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -237 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -238 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -239#endif │ │ │ │ -240 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_2_4_6 void _m_t_v (const X& x, Y& y) const │ │ │ │ -247 { │ │ │ │ -248 _m_v(x, y); │ │ │ │ -249 } │ │ │ │ -250 │ │ │ │ -252 template │ │ │ │ -_2_5_3 void _u_m_v (const X& x, Y& y) const │ │ │ │ -254 { │ │ │ │ -255#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -256 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -257 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -258#endif │ │ │ │ -259 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_2_6_5 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ -266 { │ │ │ │ -267#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -268 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -269 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -270#endif │ │ │ │ -271 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_2_7_7 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ -278 { │ │ │ │ -279#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -280 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -281 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -282#endif │ │ │ │ -283 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_2_8_9 void _m_m_v (const X& x, Y& y) const │ │ │ │ -290 { │ │ │ │ -291#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -292 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -293 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -294#endif │ │ │ │ -295 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_0_1 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ -302 { │ │ │ │ -303#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -304 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -305 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -306#endif │ │ │ │ -307 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_1_3 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ -314 { │ │ │ │ -315#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -316 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -317 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -318#endif │ │ │ │ -319 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_2_5 void _u_s_m_v (const K& alpha, const X& x, Y& y) const │ │ │ │ -326 { │ │ │ │ -327#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -328 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -329 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -330#endif │ │ │ │ -331 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_3_7 void _u_s_m_t_v (const K& alpha, const X& x, Y& y) const │ │ │ │ -338 { │ │ │ │ -339#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -340 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -341 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -342#endif │ │ │ │ -343 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_4_9 void _u_s_m_h_v (const K& alpha, const X& x, Y& y) const │ │ │ │ -350 { │ │ │ │ -351#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -352 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -353 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -354#endif │ │ │ │ -355 for (_s_i_z_e___t_y_p_e i=0; i::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m () const │ │ │ │ -363 { │ │ │ │ -364 return fvmeta::sqrt(n*p_*p_); │ │ │ │ -365 } │ │ │ │ -366 │ │ │ │ -_3_6_8 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ -369 { │ │ │ │ -370 return n*p_*p_; │ │ │ │ -371 } │ │ │ │ -372 │ │ │ │ -_3_7_4 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m () const │ │ │ │ -375 { │ │ │ │ -376 return std::abs(p_); │ │ │ │ -377 } │ │ │ │ -378 │ │ │ │ -_3_8_0 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l () const │ │ │ │ -381 { │ │ │ │ -382 return fvmeta::absreal(p_); │ │ │ │ -383 } │ │ │ │ -384 │ │ │ │ -385 //===== solve │ │ │ │ -386 │ │ │ │ -389 template │ │ │ │ -_3_9_0 void _s_o_l_v_e (V& x, const V& b) const │ │ │ │ -391 { │ │ │ │ -392 for (int i=0; i, const T> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ +220 │ │ │ │ +_2_2_5 _I_t_e_r_a_t_o_r _f_i_n_e_s_t(); │ │ │ │ +226 │ │ │ │ +_2_3_1 _I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t(); │ │ │ │ +232 │ │ │ │ +233 │ │ │ │ +_2_3_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_e_s_t() const; │ │ │ │ +239 │ │ │ │ +_2_4_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t() const; │ │ │ │ +245 │ │ │ │ +_2_5_0 std::size_t _l_e_v_e_l_s() const; │ │ │ │ +251 │ │ │ │ +252 private: │ │ │ │ +258 std::shared_ptr originalFinest_; │ │ │ │ +260 std::shared_ptr finest_; │ │ │ │ +262 std::shared_ptr coarsest_; │ │ │ │ +264 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ +266 int levels_; │ │ │ │ +267 }; │ │ │ │ +268 │ │ │ │ +269 template │ │ │ │ +_2_7_0 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const std::shared_ptr & first) │ │ │ │ +271 : originalFinest_(first) │ │ │ │ +272 { │ │ │ │ +273 finest_ = std::allocate_shared(allocator_); │ │ │ │ +274 finest_->element_ = originalFinest_; │ │ │ │ +275 coarsest_ = finest_; │ │ │ │ +276 levels_ = 1; │ │ │ │ +277 } │ │ │ │ +278 │ │ │ │ +280 //TODO: do we actually want to support this? This might be very expensive?! │ │ │ │ +281 template │ │ │ │ +_2_8_2 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other) │ │ │ │ +283 : allocator_(other.allocator_), │ │ │ │ +284 levels_(other.levels_) │ │ │ │ +285 { │ │ │ │ +286 if(!other.finest_) │ │ │ │ +287 { │ │ │ │ +288 finest_=coarsest_=nullptr; │ │ │ │ +289 return; │ │ │ │ +290 } │ │ │ │ +291 finest_ = std::allocate_shared(allocator_); │ │ │ │ +292 std::shared_ptr finer_; │ │ │ │ +293 std::shared_ptr current_ = finest_; │ │ │ │ +294 std::weak_ptr otherWeak_ = other.finest_; │ │ │ │ +295 │ │ │ │ +296 while(! otherWeak_.expired()) │ │ │ │ +297 { │ │ │ │ +298 // create shared_ptr from weak_ptr, we just checked that this is safe │ │ │ │ +299 std::shared_ptr otherCurrent_ = std::shared_ptr │ │ │ │ +(otherWeak_); │ │ │ │ +300 // clone current level │ │ │ │ +301 //TODO: should we use the allocator? │ │ │ │ +302 current_->element_ = │ │ │ │ +303 std::make_shared(*(otherCurrent_->element_)); │ │ │ │ +304 current_->finer_=finer_; │ │ │ │ +305 if(otherCurrent_->redistributed_) │ │ │ │ +306 current_->redistributed_ = │ │ │ │ +307 std::make_shared(*(otherCurrent_->redistributed_)); │ │ │ │ +308 finer_=current_; │ │ │ │ +309 if(not otherCurrent_->coarser_.expired()) │ │ │ │ +310 { │ │ │ │ +311 auto c = std::allocate_shared(allocator_); │ │ │ │ +312 current_->coarser_ = c; │ │ │ │ +313 current_ = c; │ │ │ │ +314 } │ │ │ │ +315 // go to coarser level │ │ │ │ +316 otherWeak_ = otherCurrent_->coarser_; │ │ │ │ +317 } │ │ │ │ +318 coarsest_=current_; │ │ │ │ +319 } │ │ │ │ +320 │ │ │ │ +321 template │ │ │ │ +_3_2_2 std::size_t _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ +323 { │ │ │ │ +324 return levels_; │ │ │ │ +325 } │ │ │ │ +326 │ │ │ │ +327 template │ │ │ │ +_3_2_8 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +329 { │ │ │ │ +330 coarsest_->redistributed_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +(args); │ │ │ │ +331 } │ │ │ │ +332 │ │ │ │ +333 template │ │ │ │ +_3_3_4 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +335 { │ │ │ │ +336 if(!coarsest_) { │ │ │ │ +337 // we have no levels at all... │ │ │ │ +338 assert(!finest_); │ │ │ │ +339 // allocate into the shared_ptr │ │ │ │ +340 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ +341 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ +342 coarsest_->element_ = originalFinest_; │ │ │ │ +343 finest_ = coarsest_; │ │ │ │ +344 }else{ │ │ │ │ +345 auto old_coarsest = coarsest_; │ │ │ │ +346 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ +347 coarsest_->finer_ = old_coarsest; │ │ │ │ +348 coarsest_->element_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ +349 old_coarsest->coarser_ = coarsest_; │ │ │ │ +350 } │ │ │ │ +351 ++levels_; │ │ │ │ +352 } │ │ │ │ +353 │ │ │ │ +354 │ │ │ │ +355 template │ │ │ │ +_3_5_6 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +357 { │ │ │ │ +358 //TODO: wouldn't it be better to do this in the constructor?' │ │ │ │ +359 if(!finest_) { │ │ │ │ +360 // we have no levels at all... │ │ │ │ +361 assert(!coarsest_); │ │ │ │ +362 // allocate into the shared_ptr │ │ │ │ +363 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ +364 finest_ = std::allocate_shared(allocator_); │ │ │ │ +365 finest_->element = originalFinest_; │ │ │ │ +366 coarsest_ = finest_; │ │ │ │ +367 }else{ │ │ │ │ +368 finest_->finer_ = std::allocate_shared(allocator_); │ │ │ │ +369 finest_->finer_->coarser_ = finest_; │ │ │ │ +370 finest_ = finest_->finer_; │ │ │ │ +371 finest_->element = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ +372 } │ │ │ │ +373 ++levels_; │ │ │ │ +374 } │ │ │ │ +375 │ │ │ │ +376 template │ │ │ │ +_3_7_7 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() │ │ │ │ +378 { │ │ │ │ +379 return _I_t_e_r_a_t_o_r(finest_); │ │ │ │ +380 } │ │ │ │ +381 │ │ │ │ +382 template │ │ │ │ +_3_8_3 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() │ │ │ │ +384 { │ │ │ │ +385 return _I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ +386 } │ │ │ │ +387 │ │ │ │ +388 template │ │ │ │ +_3_8_9 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() const │ │ │ │ +390 { │ │ │ │ +391 return _C_o_n_s_t_I_t_e_r_a_t_o_r(finest_); │ │ │ │ +392 } │ │ │ │ +393 │ │ │ │ +394 template │ │ │ │ +_3_9_5 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() const │ │ │ │ +396 { │ │ │ │ +397 return _C_o_n_s_t_I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ +398 } │ │ │ │ +400 } // namespace Amg │ │ │ │ +401} // namespace Dune │ │ │ │ 402 │ │ │ │ -_4_0_4 K _d_e_t_e_r_m_i_n_a_n_t () const { │ │ │ │ -405 return std::pow(p_,n); │ │ │ │ -406 } │ │ │ │ -407 │ │ │ │ -408 //===== sizes │ │ │ │ -409 │ │ │ │ -_4_1_1 _s_i_z_e___t_y_p_e _N () const │ │ │ │ -412 { │ │ │ │ -413 return n; │ │ │ │ -414 } │ │ │ │ -415 │ │ │ │ -_4_1_7 _s_i_z_e___t_y_p_e _M () const │ │ │ │ -418 { │ │ │ │ -419 return n; │ │ │ │ -420 } │ │ │ │ -421 │ │ │ │ -422 //===== query │ │ │ │ -423 │ │ │ │ -_4_2_5 bool _e_x_i_s_t_s (_s_i_z_e___t_y_p_e i, _s_i_z_e___t_y_p_e j) const │ │ │ │ -426 { │ │ │ │ -427#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -428 if (i<0 || i>=n) DUNE_THROW(FMatrixError,"row index out of range"); │ │ │ │ -429 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range"); │ │ │ │ -430#endif │ │ │ │ -431 return i==j; │ │ │ │ -432 } │ │ │ │ -433 │ │ │ │ -434 //===== conversion operator │ │ │ │ -435 │ │ │ │ -_4_3_7 friend std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const │ │ │ │ -_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_K_,_n_>& a) │ │ │ │ -438 { │ │ │ │ -439 for (_s_i_z_e___t_y_p_e i=0; i(&p_), i); │ │ │ │ -451 } │ │ │ │ -452 │ │ │ │ -_4_5_4 _c_o_n_s_t___r_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](_s_i_z_e___t_y_p_e i) const │ │ │ │ -455 { │ │ │ │ -456 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(const_cast(&p_), i); │ │ │ │ -457 } │ │ │ │ -458 │ │ │ │ -_4_6_0 const K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) const │ │ │ │ -461 { │ │ │ │ -462 return p_; │ │ │ │ -463 } │ │ │ │ -464 │ │ │ │ -_4_6_6 K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) │ │ │ │ -467 { │ │ │ │ -468 return p_; │ │ │ │ -469 } │ │ │ │ -470 │ │ │ │ -_4_7_3 const K& _s_c_a_l_a_r() const │ │ │ │ -474 { │ │ │ │ -475 return p_; │ │ │ │ -476 } │ │ │ │ -477 │ │ │ │ -_4_8_0 K& _s_c_a_l_a_r() │ │ │ │ -481 { │ │ │ │ -482 return p_; │ │ │ │ -483 } │ │ │ │ -484 │ │ │ │ -485 private: │ │ │ │ -486 // the data, very simply a single number │ │ │ │ -487 K p_; │ │ │ │ -488 │ │ │ │ -489 }; │ │ │ │ -490 │ │ │ │ -491 template │ │ │ │ -_4_9_2 struct DenseMatrixAssigner> { │ │ │ │ -_4_9_3 static void _a_p_p_l_y(DenseMatrix& denseMatrix, │ │ │ │ -494 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_f_i_e_l_d_,_ _N_> const& rhs) { │ │ │ │ -495 assert(denseMatrix.M() == N); │ │ │ │ -496 assert(denseMatrix.N() == N); │ │ │ │ -497 denseMatrix = field(0); │ │ │ │ -498 for (int i = 0; i < N; ++i) │ │ │ │ -499 denseMatrix[i][i] = rhs._s_c_a_l_a_r(); │ │ │ │ -500 } │ │ │ │ -501 }; │ │ │ │ -502 │ │ │ │ -503 template │ │ │ │ -_5_0_4 struct FieldTraits< _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x > │ │ │ │ -505 { │ │ │ │ -_5_0_6 using _f_i_e_l_d___t_y_p_e = typename _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_K_,_ _n_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -_5_0_7 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ -508 }; │ │ │ │ -509 │ │ │ │ -510} // end namespace │ │ │ │ -511 │ │ │ │ -512#endif │ │ │ │ +403#endif │ │ │ │ +_c_o_n_s_t_r_u_c_t_i_o_n_._h_h │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ +Hierarchy(const Hierarchy &other) │ │ │ │ +Copy constructor (deep copy!). │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:282 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t │ │ │ │ +void addRedistributedOnCoarsest(Arguments &args) │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:328 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() const │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ +ConstIterator coarsest() const │ │ │ │ +Get an iterator positioned at the coarsest level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:395 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ +void addCoarser(Arguments &args) │ │ │ │ +Add an element on a coarser level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_F_i_n_e_r │ │ │ │ +void addFiner(Arguments &args) │ │ │ │ +Add an element on a finer level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:356 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ +Hierarchy(const std::shared_ptr< MemberType > &first) │ │ │ │ +Construct a new hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:270 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const void * Arguments │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ +Iterator coarsest() │ │ │ │ +Get an iterator positioned at the coarsest level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:383 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ +ConstIterator finest() const │ │ │ │ +Get an iterator positioned at the finest level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:389 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ +Iterator finest() │ │ │ │ +Get an iterator positioned at the finest level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ -A multiple of the identity matrix of static size. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:30 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_h_v │ │ │ │ -void usmhv(const K &alpha, const X &x, Y &y) const │ │ │ │ -y += alpha A^H x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:349 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_m_t_v │ │ │ │ -void mmtv(const X &x, Y &y) const │ │ │ │ -y -= A^T x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:301 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ -ScaledIdentityMatrix & operator-=(const ScaledIdentityMatrix &y) │ │ │ │ -vector space subtraction │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:165 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ -const_row_type::ConstIterator ConstColIterator │ │ │ │ -rename the iterators for easier access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:127 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ -ConstIterator end() const │ │ │ │ -end iterator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:136 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ -Iterator beforeBegin() │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:114 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ -bool operator!=(const ScaledIdentityMatrix &other) const │ │ │ │ -incomparison operator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:225 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_m_v │ │ │ │ -void mmv(const X &x, Y &y) const │ │ │ │ -y -= A x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:289 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ -std::size_t size_type │ │ │ │ -The type used for the index access and size operations. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:43 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_v │ │ │ │ -void usmv(const K &alpha, const X &x, Y &y) const │ │ │ │ -y += alpha A x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:325 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ -row_type::Iterator ColIterator │ │ │ │ -rename the iterators for easier access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:91 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ -const_row_type const_reference │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:49 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_v │ │ │ │ -void mv(const X &x, Y &y) const │ │ │ │ -y = A x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:234 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_m_t_v │ │ │ │ -void umtv(const X &x, Y &y) const │ │ │ │ -y += A^T x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:265 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_m_h_v │ │ │ │ -void umhv(const X &x, Y &y) const │ │ │ │ -y += A^H x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:277 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ -DiagonalRowVector< K, n > row_type │ │ │ │ -Each row is implemented by a field vector. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:46 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_I_t_e_r_a_t_o_r │ │ │ │ -ContainerWrapperIterator< const WrapperType, reference, reference > Iterator │ │ │ │ -Iterator class for sequential access. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:85 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ -Iterator beforeEnd() │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:107 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_e_t_e_r_m_i_n_a_n_t │ │ │ │ -K determinant() const │ │ │ │ -calculates the determinant of this matrix │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:404 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -K field_type │ │ │ │ -export the type representing the field │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:37 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_s_m_t_v │ │ │ │ -void usmtv(const K &alpha, const X &x, Y &y) const │ │ │ │ -y += alpha A^T x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:337 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ -Iterator end() │ │ │ │ -end iterator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:100 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_t_e_r_a_t_o_r │ │ │ │ -Iterator iterator │ │ │ │ -typedef for stl compliant access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:87 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_c_a_l_a_r │ │ │ │ -const K & scalar() const │ │ │ │ -Get const reference to the scalar diagonal value. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:473 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_u_m_v │ │ │ │ -void umv(const X &x, Y &y) const │ │ │ │ -y += A x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:253 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ -const K & diagonal(size_type) const │ │ │ │ -Get const reference to diagonal entry. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:460 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_o_w_s │ │ │ │ -@ rows │ │ │ │ -The number of rows. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:54 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_l_s │ │ │ │ -@ cols │ │ │ │ -The number of columns. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:56 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ -ScaledIdentityMatrix & operator=(const K &k) │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:71 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ -ContainerWrapperIterator< const WrapperType, const_reference, const_reference > │ │ │ │ -ConstIterator │ │ │ │ -Iterator class for sequential access. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:121 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_d_i_a_g_o_n_a_l │ │ │ │ -K & diagonal(size_type) │ │ │ │ -Get reference to diagonal entry. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:466 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_o_l_v_e │ │ │ │ -void solve(V &x, const V &b) const │ │ │ │ -Solve system A x = b. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:390 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_e_x_i_s_t_s │ │ │ │ -bool exists(size_type i, size_type j) const │ │ │ │ -return true when (i,j) is in pattern │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:425 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ -Iterator RowIterator │ │ │ │ -rename the iterators for easier access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:89 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ -ConstIterator const_iterator │ │ │ │ -typedef for stl compliant access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:123 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ -ScaledIdentityMatrix() │ │ │ │ -Default constructor. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:62 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ -bool operator==(const ScaledIdentityMatrix &other) const │ │ │ │ -comparison operator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:219 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ -ConstIterator beforeBegin() const │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:150 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ -ScaledIdentityMatrix & operator/=(const K &k) │ │ │ │ -vector space division by scalar │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:192 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ -friend std::ostream & operator<<(std::ostream &s, const ScaledIdentityMatrix< │ │ │ │ -K, n > &a) │ │ │ │ -Sends the matrix to an output stream. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:437 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m_2 │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm2() const │ │ │ │ -square of frobenius norm, need for block recursion │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:368 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_f_r_o_b_e_n_i_u_s___n_o_r_m │ │ │ │ -FieldTraits< field_type >::real_type frobenius_norm() const │ │ │ │ -frobenius norm: sqrt(sum over squared values of entries) │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:362 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ -FieldTraits< field_type >::real_type infinity_norm() const │ │ │ │ -infinity norm (row sum norm, how to generalize for blocks?) │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:374 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ -ConstIterator ConstRowIterator │ │ │ │ -rename the iterators for easier access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:125 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ -ConstIterator beforeEnd() const │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:143 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_M │ │ │ │ -size_type M() const │ │ │ │ -number of blocks in column direction │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:417 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -const_reference operator[](size_type i) const │ │ │ │ -Return const_reference object as row replacement. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:454 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ -ScaledIdentityMatrix(const K &k) │ │ │ │ -Constructor initializing the whole matrix with a scalar. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:66 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ -friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar) │ │ │ │ -vector space multiplication with scalar │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:203 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ -FieldTraits< field_type >::real_type infinity_norm_real() const │ │ │ │ -simplified infinity norm (uses Manhattan norm for complex values) │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:380 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ -ScaledIdentityMatrix & operator*=(const K &k) │ │ │ │ -vector space multiplication with scalar │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:185 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_d_e_n_t_i_c_a_l │ │ │ │ -bool identical(const ScaledIdentityMatrix< K, n > &other) const │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:78 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_i_n_v_e_r_t │ │ │ │ -void invert() │ │ │ │ -Compute inverse. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:398 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ -Iterator begin() │ │ │ │ -begin iterator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:94 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_s_c_a_l_a_r │ │ │ │ -K & scalar() │ │ │ │ -Get reference to the scalar diagonal value. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:480 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_r_e_f_e_r_e_n_c_e │ │ │ │ -row_type reference │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:47 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ -K block_type │ │ │ │ -export the type representing the components │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:40 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_m_h_v │ │ │ │ -void mmhv(const X &x, Y &y) const │ │ │ │ -y -= A^H x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:313 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ -ScaledIdentityMatrix & operator+=(const ScaledIdentityMatrix &y) │ │ │ │ -vector space addition │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:158 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_c_o_n_s_t___r_o_w___t_y_p_e │ │ │ │ -DiagonalRowVectorConst< K, n > const_row_type │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:48 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_m_t_v │ │ │ │ -void mtv(const X &x, Y &y) const │ │ │ │ -y = A^T x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:246 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -reference operator[](size_type i) │ │ │ │ -Return reference object as row replacement. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:448 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ -ConstIterator begin() const │ │ │ │ -begin iterator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:130 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_:_:_N │ │ │ │ -size_type N() const │ │ │ │ -number of blocks in row direction │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:411 │ │ │ │ -_D_u_n_e_:_:_D_e_n_s_e_M_a_t_r_i_x_A_s_s_i_g_n_e_r_<_ _D_e_n_s_e_M_a_t_r_i_x_,_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _f_i_e_l_d_,_ _N_ _>_ _>_:_: │ │ │ │ -_a_p_p_l_y │ │ │ │ -static void apply(DenseMatrix &denseMatrix, ScaledIdentityMatrix< field, N > │ │ │ │ -const &rhs) │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:493 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -typename ScaledIdentityMatrix< K, n >::field_type field_type │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:506 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x_<_ _K_,_ _n_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ -typename FieldTraits< field_type >::real_type real_type │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:507 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ +A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ +T MemberType │ │ │ │ +The type of the container we store. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:45 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator< Hierarchy< T, A >, T > Iterator │ │ │ │ +Type of the mutable iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator< const Hierarchy< T, A >, const T > ConstIterator │ │ │ │ +Type of the const iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +ConstructionTraits< T >::Arguments Arguments │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:78 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ +Hierarchy() │ │ │ │ +Construct an empty hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:89 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ +typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator │ │ │ │ +The allocator to use for the list elements. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:76 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +Iterator over the levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ +typename std::remove_const< T1 >::type > &other) │ │ │ │ +Copy constructor. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:136 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ +void addRedistributed(std::shared_ptr< T1 > t) │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:201 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ +T1 & dereference() const │ │ │ │ +Dereference the iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:166 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ +bool equals(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ +typename std::remove_const< T1 >::type > &other) const │ │ │ │ +Equality check. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:150 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_s_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ +bool isRedistributed() const │ │ │ │ +Check whether there was a redistribution at the current level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:187 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ +bool equals(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ +const typename std::remove_const< T1 >::type > &other) const │ │ │ │ +Equality check. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:159 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ +void increment() │ │ │ │ +Move to the next coarser level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:172 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ +const typename std::remove_const< T1 >::type > &other) │ │ │ │ +Copy constructor. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:142 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ +void deleteRedistributed() │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:206 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ +void decrement() │ │ │ │ +Move to the next fine level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:178 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator(std::shared_ptr< Element > element) │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:131 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ +T1 & getRedistributed() const │ │ │ │ +Get the redistributed container. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:196 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scalarproducts.hh File Reference │ │ │ +dune-istl: pinfo.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,77 +65,47 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Namespaces
│ │ │ +
pinfo.hh File Reference
│ │ │ │ │ │
│ │ │ - │ │ │ -

Define base class for scalar product and norm. │ │ │ -More...

│ │ │ -
#include <cmath>
│ │ │ -#include <complex>
│ │ │ -#include <iostream>
│ │ │ -#include <iomanip>
│ │ │ -#include <string>
│ │ │ -#include <memory>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include <dune/common/shared_ptr.hh>
│ │ │ -#include "bvector.hh"
│ │ │ -#include "solvercategory.hh"
│ │ │ +
#include <dune/common/parallel/communication.hh>
│ │ │ +#include <dune/common/enumset.hh>
│ │ │ +#include <dune/common/parallel/mpicommunication.hh>
│ │ │ +#include <dune/common/parallel/mpitraits.hh>
│ │ │ +#include <dune/common/parallel/remoteindices.hh>
│ │ │ +#include <dune/common/parallel/interface.hh>
│ │ │ +#include <dune/common/parallel/communicator.hh>
│ │ │ +#include <dune/istl/solvercategory.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::ScalarProduct< X >
 Base class for scalar product and norm computation. More...
 
class  Dune::ParallelScalarProduct< X, C >
 Scalar product for overlapping Schwarz methods. More...
 
class  Dune::SeqScalarProduct< X >
 Default implementation for the scalar case. More...
 
class  Dune::NonoverlappingSchwarzScalarProduct< X, C >
 Nonoverlapping Scalar Product with communication object. More...
 
class  Dune::OverlappingSchwarzScalarProduct< X, C >
 Scalar product for overlapping Schwarz methods. More...
class  Dune::Amg::SequentialInformation
 
│ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ -Functions

template<class X , class Comm >
std::shared_ptr< ScalarProduct< X > > Dune::makeScalarProduct (std::shared_ptr< const Comm > comm, SolverCategory::Category category)
 Choose the appropriate scalar product for a solver category.
 
template<class X , class Comm >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const Comm &comm, SolverCategory::Category category)
 
namespace  Dune::Amg
 
│ │ │ -

Detailed Description

│ │ │ -

Define base class for scalar product and norm.

│ │ │ -

These classes have to be implemented differently for different data partitioning strategies. Default implementations for the sequential case are provided.

│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,60 +1,28 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -scalarproducts.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _S_c_a_l_a_r_ _p_r_o_d_u_c_t_s │ │ │ │ -Define base class for scalar product and norm. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +pinfo.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_ _X_ _> │ │ │ │ -  Base class for scalar product and norm computation. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_<_ _X_,_ _C_ _> │ │ │ │ -  Scalar product for overlapping Schwarz methods. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t_<_ _X_ _> │ │ │ │ -  Default implementation for the scalar case. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_<_ _X_,_ _C_ _> │ │ │ │ -  Nonoverlapping Scalar Product with communication object. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_<_ _X_,_ _C_ _> │ │ │ │ -  Scalar product for overlapping Schwarz methods. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_m_a_k_e_S_c_a_l_a_r_P_r_o_d_u_c_t (std:: │ │ │ │ - shared_ptr< const Comm > comm, │ │ │ │ - _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category) │ │ │ │ -  Choose the appropriate scalar product │ │ │ │ - for a solver category. │ │ │ │ -  │ │ │ │ -template │ │ │ │ -std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const Comm │ │ │ │ - &comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ - category) │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ -These classes have to be implemented differently for different data │ │ │ │ -partitioning strategies. Default implementations for the sequential case are │ │ │ │ -provided. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: scalarproducts.hh Source File │ │ │ +dune-istl: pinfo.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,226 +70,170 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
scalarproducts.hh
│ │ │ +
pinfo.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_SCALARPRODUCTS_HH
│ │ │ -
6#define DUNE_ISTL_SCALARPRODUCTS_HH
│ │ │ +
5#ifndef DUNE_AMG_PINFO_HH
│ │ │ +
6#define DUNE_AMG_PINFO_HH
│ │ │
7
│ │ │ -
8#include <cmath>
│ │ │ -
9#include <complex>
│ │ │ -
10#include <iostream>
│ │ │ -
11#include <iomanip>
│ │ │ -
12#include <string>
│ │ │ -
13#include <memory>
│ │ │ -
14
│ │ │ -
15#include <dune/common/exceptions.hh>
│ │ │ -
16#include <dune/common/shared_ptr.hh>
│ │ │ -
17
│ │ │ -
18#include "bvector.hh"
│ │ │ -
19#include "solvercategory.hh"
│ │ │ +
8#include <dune/common/parallel/communication.hh>
│ │ │ +
9#include <dune/common/enumset.hh>
│ │ │ +
10
│ │ │ +
11#if HAVE_MPI
│ │ │ +
12
│ │ │ +
13#include <dune/common/parallel/mpicommunication.hh>
│ │ │ +
14#include <dune/common/parallel/mpitraits.hh>
│ │ │ +
15#include <dune/common/parallel/remoteindices.hh>
│ │ │ +
16#include <dune/common/parallel/interface.hh>
│ │ │ +
17#include <dune/common/parallel/communicator.hh>
│ │ │ +
18
│ │ │ +
19#endif
│ │ │
20
│ │ │ -
21
│ │ │ -
22namespace Dune {
│ │ │ -
51 template<class X>
│ │ │ -
│ │ │ - │ │ │ -
53 public:
│ │ │ -
55 typedef X domain_type;
│ │ │ -
56 typedef typename X::field_type field_type;
│ │ │ -
57 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ -
58
│ │ │ -
│ │ │ -
63 virtual field_type dot (const X& x, const X& y) const
│ │ │ -
64 {
│ │ │ -
65 return x.dot(y);
│ │ │ -
66 }
│ │ │ -
│ │ │ -
67
│ │ │ -
│ │ │ -
71 virtual real_type norm (const X& x) const
│ │ │ -
72 {
│ │ │ -
73 return x.two_norm();
│ │ │ -
74 }
│ │ │ -
│ │ │ -
75
│ │ │ -
│ │ │ - │ │ │ -
78 {
│ │ │ - │ │ │ -
80 }
│ │ │ -
│ │ │ -
81
│ │ │ -
83 virtual ~ScalarProduct () {}
│ │ │ -
84 };
│ │ │ -
│ │ │ -
85
│ │ │ -
97 template<class X, class C>
│ │ │ -
│ │ │ - │ │ │ -
99 {
│ │ │ -
100 public:
│ │ │ -
105 typedef X domain_type;
│ │ │ -
107 typedef typename X::field_type field_type;
│ │ │ -
108 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ - │ │ │ -
114
│ │ │ -
│ │ │ -
120 ParallelScalarProduct (std::shared_ptr<const communication_type> com, SolverCategory::Category cat)
│ │ │ -
121 : _communication(com), _category(cat)
│ │ │ -
122 {}
│ │ │ -
│ │ │ -
123
│ │ │ -
│ │ │ - │ │ │ -
131 : ParallelScalarProduct(stackobject_to_shared_ptr(com), cat)
│ │ │ -
132 {}
│ │ │ -
│ │ │ -
133
│ │ │ -
134
│ │ │ -
│ │ │ -
139 virtual field_type dot (const X& x, const X& y) const override
│ │ │ -
140 {
│ │ │ -
141 field_type result(0);
│ │ │ -
142 _communication->dot(x,y,result); // explicitly loop and apply masking
│ │ │ -
143 return result;
│ │ │ -
144 }
│ │ │ -
│ │ │ -
145
│ │ │ -
│ │ │ -
149 virtual real_type norm (const X& x) const override
│ │ │ -
150 {
│ │ │ -
151 return _communication->norm(x);
│ │ │ -
152 }
│ │ │ -
│ │ │ -
153
│ │ │ -
│ │ │ -
155 virtual SolverCategory::Category category() const override
│ │ │ -
156 {
│ │ │ -
157 return _category;
│ │ │ -
158 }
│ │ │ -
│ │ │ -
159
│ │ │ -
160 private:
│ │ │ -
161 std::shared_ptr<const communication_type> _communication;
│ │ │ -
162 SolverCategory::Category _category;
│ │ │ -
163 };
│ │ │ -
│ │ │ -
164
│ │ │ -
166 template<class X>
│ │ │ -
│ │ │ - │ │ │ -
168 {
│ │ │ -
169 using ScalarProduct<X>::ScalarProduct;
│ │ │ -
170 };
│ │ │ -
│ │ │ -
171
│ │ │ -
177 template<class X, class C>
│ │ │ -
│ │ │ - │ │ │ -
179 {
│ │ │ -
180 public:
│ │ │ -
│ │ │ -
181 NonoverlappingSchwarzScalarProduct (std::shared_ptr<const C> comm) :
│ │ │ -
182 ParallelScalarProduct<X,C>(comm,SolverCategory::nonoverlapping) {}
│ │ │ -
│ │ │ -
183
│ │ │ -
│ │ │ - │ │ │ -
185 ParallelScalarProduct<X,C>(comm,SolverCategory::nonoverlapping) {}
│ │ │ -
│ │ │ -
186 };
│ │ │ -
│ │ │ -
187
│ │ │ -
199 template<class X, class C>
│ │ │ -
│ │ │ - │ │ │ -
201 {
│ │ │ -
202 public:
│ │ │ -
│ │ │ -
203 OverlappingSchwarzScalarProduct (std::shared_ptr<const C> comm) :
│ │ │ -
204 ParallelScalarProduct<X,C>(comm, SolverCategory::overlapping) {}
│ │ │ -
│ │ │ -
205
│ │ │ -
│ │ │ - │ │ │ -
207 ParallelScalarProduct<X,C>(comm,SolverCategory::overlapping) {}
│ │ │ -
│ │ │ -
208 };
│ │ │ -
│ │ │ -
209
│ │ │ -
223 template<class X, class Comm>
│ │ │ -
│ │ │ -
224 std::shared_ptr<ScalarProduct<X>> makeScalarProduct(std::shared_ptr<const Comm> comm, SolverCategory::Category category)
│ │ │ -
225 {
│ │ │ -
226 switch(category)
│ │ │ -
227 {
│ │ │ - │ │ │ -
229 return
│ │ │ -
230 std::make_shared<ScalarProduct<X>>();
│ │ │ -
231 default:
│ │ │ -
232 return
│ │ │ -
233 std::make_shared<ParallelScalarProduct<X,Comm>>(comm,category);
│ │ │ -
234 }
│ │ │ -
235 }
│ │ │ -
│ │ │ -
236
│ │ │ -
241 template<class X, class Comm>
│ │ │ -
│ │ │ -
242 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const Comm& comm, SolverCategory::Category category)
│ │ │ -
243 { return makeScalarProduct<X>(stackobject_to_shared_ptr(comm), category); }
│ │ │ -
│ │ │ -
244
│ │ │ -
245} // end namespace Dune
│ │ │ -
246
│ │ │ -
247#endif
│ │ │ - │ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ + │ │ │ +
22namespace Dune
│ │ │ +
23{
│ │ │ +
24 namespace Amg
│ │ │ +
25 {
│ │ │ +
26
│ │ │ +
│ │ │ + │ │ │ +
28 {
│ │ │ +
29 public:
│ │ │ +
30 typedef Communication<void*> MPICommunicator;
│ │ │ +
31 typedef EmptySet<int> CopyFlags;
│ │ │ +
32 typedef AllSet<int> OwnerSet;
│ │ │ +
33
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
36 }
│ │ │ +
│ │ │ +
37
│ │ │ +
│ │ │ + │ │ │ +
39 {
│ │ │ +
40 return comm_;
│ │ │ +
41 }
│ │ │ +
│ │ │ +
42
│ │ │ +
│ │ │ +
43 int procs() const
│ │ │ +
44 {
│ │ │ +
45 return 1;
│ │ │ +
46 }
│ │ │ +
│ │ │ +
47
│ │ │ +
48 template<typename T>
│ │ │ +
│ │ │ +
49 T globalSum(const T& t) const
│ │ │ +
50 {
│ │ │ +
51 return t;
│ │ │ +
52 }
│ │ │ +
│ │ │ +
53
│ │ │ + │ │ │ +
55
│ │ │ +
56 void buildGlobalLookup(std::size_t){}
│ │ │ +
57
│ │ │ + │ │ │ +
59
│ │ │ +
│ │ │ + │ │ │ +
61 {
│ │ │ +
62 return gli;
│ │ │ +
63 }
│ │ │ +
│ │ │ +
64
│ │ │ +
65 template<class V>
│ │ │ +
│ │ │ +
66 void copyOwnerToAll([[maybe_unused]] V& v, [[maybe_unused]] V& v1) const
│ │ │ +
67 {}
│ │ │ +
│ │ │ +
68
│ │ │ +
69 template<class V>
│ │ │ +
│ │ │ +
70 void project([[maybe_unused]] V& v) const
│ │ │ +
71 {}
│ │ │ +
│ │ │ +
72
│ │ │ +
73 template<class T1, class T2>
│ │ │ +
│ │ │ +
74 void dot (const T1& x, const T1& y, T2& result) const
│ │ │ +
75 {
│ │ │ +
76 result = x.dot(y);
│ │ │ +
77 }
│ │ │ +
│ │ │ +
78
│ │ │ +
79 template<class T1>
│ │ │ +
│ │ │ +
80 typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
│ │ │ +
81 {
│ │ │ +
82 return x.two_norm();
│ │ │ +
83 }
│ │ │ +
│ │ │ +
84
│ │ │ +
85 template<class T>
│ │ │ +
│ │ │ +
86 SequentialInformation(const Communication<T>&)
│ │ │ +
87 {}
│ │ │ +
│ │ │ +
88
│ │ │ +
│ │ │ + │ │ │ +
90 {}
│ │ │ +
│ │ │ +
91
│ │ │ +
│ │ │ + │ │ │ +
93 {}
│ │ │ +
│ │ │ +
94 private:
│ │ │ +
95 MPICommunicator comm_{};
│ │ │ + │ │ │ +
97 };
│ │ │ +
│ │ │ +
98
│ │ │ +
99
│ │ │ +
100 } // namespace Amg
│ │ │ +
101} //namespace Dune
│ │ │ +
102#endif
│ │ │ + │ │ │
Definition allocator.hh:11
│ │ │ -
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │ -
std::shared_ptr< ScalarProduct< X > > makeScalarProduct(std::shared_ptr< const Comm > comm, SolverCategory::Category category)
Choose the appropriate scalar product for a solver category.
Definition scalarproducts.hh:224
│ │ │ -
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ -
virtual field_type dot(const X &x, const X &y) const
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition scalarproducts.hh:63
│ │ │ -
virtual SolverCategory::Category category() const
Category of the scalar product (see SolverCategory::Category)
Definition scalarproducts.hh:77
│ │ │ -
X::field_type field_type
Definition scalarproducts.hh:56
│ │ │ -
X domain_type
export types, they come from the derived class
Definition scalarproducts.hh:55
│ │ │ -
virtual ~ScalarProduct()
every abstract base class has a virtual destructor
Definition scalarproducts.hh:83
│ │ │ -
FieldTraits< field_type >::real_type real_type
Definition scalarproducts.hh:57
│ │ │ -
virtual real_type norm(const X &x) const
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.
Definition scalarproducts.hh:71
│ │ │ -
Scalar product for overlapping Schwarz methods.
Definition scalarproducts.hh:99
│ │ │ -
virtual field_type dot(const X &x, const X &y) const override
Dot product of two vectors. It is assumed that the vectors are consistent on the interior+border part...
Definition scalarproducts.hh:139
│ │ │ -
virtual SolverCategory::Category category() const override
Category of the scalar product (see SolverCategory::Category)
Definition scalarproducts.hh:155
│ │ │ -
FieldTraits< field_type >::real_type real_type
Definition scalarproducts.hh:108
│ │ │ -
C communication_type
The type of the communication object.
Definition scalarproducts.hh:113
│ │ │ -
ParallelScalarProduct(const communication_type &com, SolverCategory::Category cat)
Definition scalarproducts.hh:130
│ │ │ -
X domain_type
The type of the vector to compute the scalar product on.
Definition scalarproducts.hh:105
│ │ │ -
ParallelScalarProduct(std::shared_ptr< const communication_type > com, SolverCategory::Category cat)
Definition scalarproducts.hh:120
│ │ │ -
X::field_type field_type
The field type used by the vector type domain_type.
Definition scalarproducts.hh:107
│ │ │ -
virtual real_type norm(const X &x) const override
Norm of a right-hand side vector. The vector must be consistent on the interior+border partition.
Definition scalarproducts.hh:149
│ │ │ -
Default implementation for the scalar case.
Definition scalarproducts.hh:168
│ │ │ -
Nonoverlapping Scalar Product with communication object.
Definition scalarproducts.hh:179
│ │ │ -
NonoverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm)
Definition scalarproducts.hh:181
│ │ │ -
NonoverlappingSchwarzScalarProduct(const C &comm)
Definition scalarproducts.hh:184
│ │ │ -
Scalar product for overlapping Schwarz methods.
Definition scalarproducts.hh:201
│ │ │ -
OverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm)
Definition scalarproducts.hh:203
│ │ │ -
OverlappingSchwarzScalarProduct(const C &comm)
Definition scalarproducts.hh:206
│ │ │ -
Categories for the solvers.
Definition solvercategory.hh:22
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
SequentialInformation()
Definition pinfo.hh:89
│ │ │ +
T globalSum(const T &t) const
Definition pinfo.hh:49
│ │ │ +
EmptySet< int > CopyFlags
Definition pinfo.hh:31
│ │ │ +
void dot(const T1 &x, const T1 &y, T2 &result) const
Definition pinfo.hh:74
│ │ │ +
AllSet< int > OwnerSet
Definition pinfo.hh:32
│ │ │ +
void copyOwnerToAll(V &v, V &v1) const
Definition pinfo.hh:66
│ │ │ +
MPICommunicator communicator() const
Definition pinfo.hh:38
│ │ │ +
void buildGlobalLookup(std::size_t)
Definition pinfo.hh:56
│ │ │ +
void project(V &v) const
Definition pinfo.hh:70
│ │ │ +
Communication< void * > MPICommunicator
Definition pinfo.hh:30
│ │ │ +
SequentialInformation(const Communication< T > &)
Definition pinfo.hh:86
│ │ │ +
const GlobalLookupIndexSet & globalLookup() const
Definition pinfo.hh:60
│ │ │ +
SequentialInformation(const SequentialInformation &)
Definition pinfo.hh:92
│ │ │ +
FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const
Definition pinfo.hh:80
│ │ │ +
void freeGlobalLookup()
Definition pinfo.hh:58
│ │ │ +
int GlobalLookupIndexSet
Definition pinfo.hh:54
│ │ │ +
SolverCategory::Category category() const
Definition pinfo.hh:34
│ │ │ +
int procs() const
Definition pinfo.hh:43
│ │ │
Category
Definition solvercategory.hh:23
│ │ │
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │
│ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,267 +1,179 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -scalarproducts.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +pinfo.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_SCALARPRODUCTS_HH │ │ │ │ -6#define DUNE_ISTL_SCALARPRODUCTS_HH │ │ │ │ +5#ifndef DUNE_AMG_PINFO_HH │ │ │ │ +6#define DUNE_AMG_PINFO_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14 │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17 │ │ │ │ -18#include "_b_v_e_c_t_o_r_._h_h" │ │ │ │ -19#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10 │ │ │ │ +11#if HAVE_MPI │ │ │ │ +12 │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ +17#include │ │ │ │ +18 │ │ │ │ +19#endif │ │ │ │ 20 │ │ │ │ -21 │ │ │ │ -22namespace _D_u_n_e { │ │ │ │ -51 template │ │ │ │ -_5_2 class _S_c_a_l_a_r_P_r_o_d_u_c_t { │ │ │ │ -53 public: │ │ │ │ -_5_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_5_6 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_5_7 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ -58 │ │ │ │ -_6_3 virtual _f_i_e_l_d___t_y_p_e _d_o_t (const X& x, const X& y) const │ │ │ │ -64 { │ │ │ │ -65 return x.dot(y); │ │ │ │ -66 } │ │ │ │ -67 │ │ │ │ -_7_1 virtual _r_e_a_l___t_y_p_e _n_o_r_m (const X& x) const │ │ │ │ -72 { │ │ │ │ -73 return x.two_norm(); │ │ │ │ -74 } │ │ │ │ -75 │ │ │ │ -_7_7 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -78 { │ │ │ │ -79 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -80 } │ │ │ │ -81 │ │ │ │ -_8_3 virtual _~_S_c_a_l_a_r_P_r_o_d_u_c_t () {} │ │ │ │ -84 }; │ │ │ │ -85 │ │ │ │ -97 template │ │ │ │ -_9_8 class _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t : public _S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -99 { │ │ │ │ -100 public: │ │ │ │ -_1_0_5 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_1_0_7 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_1_0_8 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ -_1_1_3 typedef C _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e; │ │ │ │ -114 │ │ │ │ -_1_2_0 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t (std::shared_ptr com, │ │ │ │ -_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y cat) │ │ │ │ -121 : _communication(com), _category(cat) │ │ │ │ -122 {} │ │ │ │ -123 │ │ │ │ -_1_3_0 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t (const _c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e& com, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ -_C_a_t_e_g_o_r_y cat) │ │ │ │ -131 : _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(stackobject_to_shared_ptr(com), cat) │ │ │ │ -132 {} │ │ │ │ -133 │ │ │ │ -134 │ │ │ │ -_1_3_9 virtual _f_i_e_l_d___t_y_p_e _d_o_t (const X& x, const X& y) const override │ │ │ │ -140 { │ │ │ │ -141 _f_i_e_l_d___t_y_p_e result(0); │ │ │ │ -142 _communication->dot(x,y,result); // explicitly loop and apply masking │ │ │ │ -143 return result; │ │ │ │ -144 } │ │ │ │ -145 │ │ │ │ -_1_4_9 virtual _r_e_a_l___t_y_p_e _n_o_r_m (const X& x) const override │ │ │ │ -150 { │ │ │ │ -151 return _communication->norm(x); │ │ │ │ -152 } │ │ │ │ -153 │ │ │ │ -_1_5_5 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const override │ │ │ │ -156 { │ │ │ │ -157 return _category; │ │ │ │ -158 } │ │ │ │ -159 │ │ │ │ -160 private: │ │ │ │ -161 std::shared_ptr _communication; │ │ │ │ -162 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _category; │ │ │ │ -163 }; │ │ │ │ -164 │ │ │ │ -166 template │ │ │ │ -_1_6_7 class _S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t : public _S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -168 { │ │ │ │ -169 using _S_c_a_l_a_r_P_r_o_d_u_c_t::ScalarProduct; │ │ │ │ -170 }; │ │ │ │ -171 │ │ │ │ -177 template │ │ │ │ -_1_7_8 class _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t : public │ │ │ │ -_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -179 { │ │ │ │ -180 public: │ │ │ │ -_1_8_1 _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (std::shared_ptr comm) : │ │ │ │ -182 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm,_S_o_l_v_e_r_C_a_t_e_g_o_r_y::nonoverlapping) {} │ │ │ │ -183 │ │ │ │ -_1_8_4 _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (const C& comm) : │ │ │ │ -185 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm,_S_o_l_v_e_r_C_a_t_e_g_o_r_y::nonoverlapping) {} │ │ │ │ -186 }; │ │ │ │ -187 │ │ │ │ -199 template │ │ │ │ -_2_0_0 class _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t : public _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -201 { │ │ │ │ -202 public: │ │ │ │ -_2_0_3 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (std::shared_ptr comm) : │ │ │ │ -204 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y::overlapping) {} │ │ │ │ -205 │ │ │ │ -_2_0_6 _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t (const C& comm) : │ │ │ │ -207 _P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t(comm,_S_o_l_v_e_r_C_a_t_e_g_o_r_y::overlapping) {} │ │ │ │ -208 }; │ │ │ │ -209 │ │ │ │ -223 template │ │ │ │ -_2_2_4 std::shared_ptr> _m_a_k_e_S_c_a_l_a_r_P_r_o_d_u_c_t(std::shared_ptr comm, _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category) │ │ │ │ -225 { │ │ │ │ -226 switch(category) │ │ │ │ -227 { │ │ │ │ -228 case _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l: │ │ │ │ -229 return │ │ │ │ -230 std::make_shared>(); │ │ │ │ -231 default: │ │ │ │ -232 return │ │ │ │ -233 std::make_shared>(comm,category); │ │ │ │ -234 } │ │ │ │ -235 } │ │ │ │ -236 │ │ │ │ -241 template │ │ │ │ -_2_4_2 std::shared_ptr> _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t(const Comm& comm, │ │ │ │ -_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category) │ │ │ │ -243 { return makeScalarProduct(stackobject_to_shared_ptr(comm), category); } │ │ │ │ -244 │ │ │ │ -245} // end namespace Dune │ │ │ │ -246 │ │ │ │ -247#endif │ │ │ │ +21#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ +22namespace _D_u_n_e │ │ │ │ +23{ │ │ │ │ +24 namespace Amg │ │ │ │ +25 { │ │ │ │ +26 │ │ │ │ +_2_7 class _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +28 { │ │ │ │ +29 public: │ │ │ │ +_3_0 typedef Communication _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ +_3_1 typedef EmptySet _C_o_p_y_F_l_a_g_s; │ │ │ │ +_3_2 typedef AllSet _O_w_n_e_r_S_e_t; │ │ │ │ +33 │ │ │ │ +_3_4 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y () const { │ │ │ │ +35 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ +36 } │ │ │ │ +37 │ │ │ │ +_3_8 _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _c_o_m_m_u_n_i_c_a_t_o_r() const │ │ │ │ +39 { │ │ │ │ +40 return comm_; │ │ │ │ +41 } │ │ │ │ +42 │ │ │ │ +_4_3 int _p_r_o_c_s() const │ │ │ │ +44 { │ │ │ │ +45 return 1; │ │ │ │ +46 } │ │ │ │ +47 │ │ │ │ +48 template │ │ │ │ +_4_9 T _g_l_o_b_a_l_S_u_m(const T& t) const │ │ │ │ +50 { │ │ │ │ +51 return t; │ │ │ │ +52 } │ │ │ │ +53 │ │ │ │ +_5_4 typedef int _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ +55 │ │ │ │ +_5_6 void _b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(std::size_t){} │ │ │ │ +57 │ │ │ │ +_5_8 void _f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p(){} │ │ │ │ +59 │ │ │ │ +_6_0 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& _g_l_o_b_a_l_L_o_o_k_u_p() const │ │ │ │ +61 { │ │ │ │ +62 return gli; │ │ │ │ +63 } │ │ │ │ +64 │ │ │ │ +65 template │ │ │ │ +_6_6 void _c_o_p_y_O_w_n_e_r_T_o_A_l_l([[maybe_unused]] V& v, [[maybe_unused]] V& v1) const │ │ │ │ +67 {} │ │ │ │ +68 │ │ │ │ +69 template │ │ │ │ +_7_0 void _p_r_o_j_e_c_t([[maybe_unused]] V& v) const │ │ │ │ +71 {} │ │ │ │ +72 │ │ │ │ +73 template │ │ │ │ +_7_4 void _d_o_t (const T1& x, const T1& y, T2& result) const │ │ │ │ +75 { │ │ │ │ +76 result = x.dot(y); │ │ │ │ +77 } │ │ │ │ +78 │ │ │ │ +79 template │ │ │ │ +_8_0 typename FieldTraits::real_type _n_o_r_m (const T1& x) │ │ │ │ +const │ │ │ │ +81 { │ │ │ │ +82 return x.two_norm(); │ │ │ │ +83 } │ │ │ │ +84 │ │ │ │ +85 template │ │ │ │ +_8_6 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(const Communication&) │ │ │ │ +87 {} │ │ │ │ +88 │ │ │ │ +_8_9 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n() │ │ │ │ +90 {} │ │ │ │ +91 │ │ │ │ +_9_2 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n&) │ │ │ │ +93 {} │ │ │ │ +94 private: │ │ │ │ +95 _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r comm_{}; │ │ │ │ +96 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t gli{}; │ │ │ │ +97 }; │ │ │ │ +98 │ │ │ │ +99 │ │ │ │ +100 } // namespace Amg │ │ │ │ +101} //namespace Dune │ │ │ │ +102#endif │ │ │ │ _s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, │ │ │ │ -SolverCategory::Category category) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:242 │ │ │ │ -_D_u_n_e_:_:_m_a_k_e_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -std::shared_ptr< ScalarProduct< X > > makeScalarProduct(std::shared_ptr< const │ │ │ │ -Comm > comm, SolverCategory::Category category) │ │ │ │ -Choose the appropriate scalar product for a solver category. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:224 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Base class for scalar product and norm computation. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:52 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_t │ │ │ │ -virtual field_type dot(const X &x, const X &y) const │ │ │ │ -Dot product of two vectors. It is assumed that the vectors are consistent on │ │ │ │ -the interior+border part... │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:63 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the scalar product (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:77 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:56 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -export types, they come from the derived class │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:55 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_~_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -virtual ~ScalarProduct() │ │ │ │ -every abstract base class has a virtual destructor │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:83 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_r_e_a_l___t_y_p_e │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:57 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_n_o_r_m │ │ │ │ -virtual real_type norm(const X &x) const │ │ │ │ -Norm of a right-hand side vector. The vector must be consistent on the │ │ │ │ -interior+border partition. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:71 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Scalar product for overlapping Schwarz methods. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:99 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_t │ │ │ │ -virtual field_type dot(const X &x, const X &y) const override │ │ │ │ -Dot product of two vectors. It is assumed that the vectors are consistent on │ │ │ │ -the interior+border part... │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:139 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const override │ │ │ │ -Category of the scalar product (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:155 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_r_e_a_l___t_y_p_e │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:108 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ -C communication_type │ │ │ │ -The type of the communication object. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:113 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -ParallelScalarProduct(const communication_type &com, SolverCategory::Category │ │ │ │ -cat) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:130 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The type of the vector to compute the scalar product on. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:105 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -ParallelScalarProduct(std::shared_ptr< const communication_type > com, │ │ │ │ -SolverCategory::Category cat) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:120 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type used by the vector type domain_type. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:107 │ │ │ │ -_D_u_n_e_:_:_P_a_r_a_l_l_e_l_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_n_o_r_m │ │ │ │ -virtual real_type norm(const X &x) const override │ │ │ │ -Norm of a right-hand side vector. The vector must be consistent on the │ │ │ │ -interior+border partition. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:149 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Default implementation for the scalar case. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:168 │ │ │ │ -_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Nonoverlapping Scalar Product with communication object. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:179 │ │ │ │ -_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -NonoverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:181 │ │ │ │ -_D_u_n_e_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -NonoverlappingSchwarzScalarProduct(const C &comm) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:184 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Scalar product for overlapping Schwarz methods. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:201 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -OverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:203 │ │ │ │ -_D_u_n_e_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t_:_:_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -OverlappingSchwarzScalarProduct(const C &comm) │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:206 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ -Categories for the solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:22 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +SequentialInformation() │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:89 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_g_l_o_b_a_l_S_u_m │ │ │ │ +T globalSum(const T &t) const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:49 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_C_o_p_y_F_l_a_g_s │ │ │ │ +EmptySet< int > CopyFlags │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:31 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_d_o_t │ │ │ │ +void dot(const T1 &x, const T1 &y, T2 &result) const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:74 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_O_w_n_e_r_S_e_t │ │ │ │ +AllSet< int > OwnerSet │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:32 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ +void copyOwnerToAll(V &v, V &v1) const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:66 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ +MPICommunicator communicator() const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:38 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +void buildGlobalLookup(std::size_t) │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:56 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ +void project(V &v) const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ +Communication< void * > MPICommunicator │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:30 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +SequentialInformation(const Communication< T > &) │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:86 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +const GlobalLookupIndexSet & globalLookup() const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:60 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +SequentialInformation(const SequentialInformation &) │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:92 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_n_o_r_m │ │ │ │ +FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:80 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ +void freeGlobalLookup() │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:58 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +int GlobalLookupIndexSet │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:54 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ +SolverCategory::Category category() const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:34 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_p_r_o_c_s │ │ │ │ +int procs() const │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:43 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ Category │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ @ sequential │ │ │ │ Category for sequential solvers. │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:25 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: repartition.hh File Reference │ │ │ +dune-istl: aggregates.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,107 +65,117 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ -Typedefs | │ │ │ Functions
│ │ │ -
repartition.hh File Reference
│ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

Functionality for redistributing a parallel index set using graph partitioning. │ │ │ +

Provides classes for the Coloring process of AMG. │ │ │ More...

│ │ │ -
#include <cassert>
│ │ │ -#include <map>
│ │ │ -#include <utility>
│ │ │ -#include <cmath>
│ │ │ +
#include "parameters.hh"
│ │ │ +#include "graph.hh"
│ │ │ +#include "properties.hh"
│ │ │ +#include "combinedfunctor.hh"
│ │ │ #include <dune/common/timer.hh>
│ │ │ -#include <dune/common/enumset.hh>
│ │ │ #include <dune/common/stdstreams.hh>
│ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ -#include <dune/common/parallel/communicator.hh>
│ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ -#include <dune/common/parallel/indicessyncer.hh>
│ │ │ -#include <dune/common/parallel/remoteindices.hh>
│ │ │ -#include <dune/common/rangeutilities.hh>
│ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ -#include <dune/istl/paamg/graph.hh>
│ │ │ +#include <dune/common/poolallocator.hh>
│ │ │ +#include <dune/common/sllist.hh>
│ │ │ +#include <dune/common/ftraits.hh>
│ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ +#include <utility>
│ │ │ +#include <set>
│ │ │ +#include <algorithm>
│ │ │ +#include <complex>
│ │ │ +#include <limits>
│ │ │ +#include <ostream>
│ │ │ +#include <tuple>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::RedistributeInterface
class  Dune::Amg::AggregationCriterion< T >
 Base class of all aggregation criterions. More...
 
class  Dune::Amg::SymmetricMatrixDependency< M, N >
 Dependency policy for symmetric matrices. More...
 
class  Dune::Amg::Dependency< M, N >
 Dependency policy for symmetric matrices. More...
 
class  Dune::Amg::SymmetricDependency< M, N >
 Dependency policy for symmetric matrices. More...
 
class  Dune::Amg::Diagonal< N >
 Norm that uses only the [N][N] entry of the block to determine couplings. More...
 
class  Dune::Amg::FirstDiagonal
 Norm that uses only the [0][0] entry of the block to determine couplings. More...
 
struct  Dune::Amg::RowSum
 Functor using the row sum (infinity) norm to determine strong couplings. More...
 
struct  Dune::Amg::FrobeniusNorm
 
struct  Dune::Amg::AlwaysOneNorm
 
class  Dune::Amg::SymmetricCriterion< M, Norm >
 Criterion taking advantage of symmetric matrices. More...
 
class  Dune::Amg::UnSymmetricCriterion< M, Norm >
 Criterion suitable for unsymmetric matrices. More...
 
class  Dune::Amg::AggregatesMap< V >
 Class providing information about the mapping of the vertices onto aggregates. More...
 
class  Dune::Amg::AggregatesMap< V >::DummyEdgeVisitor
 A Dummy visitor that does nothing for each visited edge. More...
 
class  Dune::Amg::Aggregate< G, S >
 A class for temporarily storing the vertices of an aggregate in. More...
 
class  Dune::Amg::Aggregator< G >
 Class for building the aggregates. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Metis
namespace  Dune::Amg
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Typedefs

using Dune::Metis::real_t = float
 
using Dune::Metis::idx_t = std::size_t
 
│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ Functions

template<class G , class T1 , class T2 >
void Dune::fillIndexSetHoles (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
 Fills the holes in an index set.
 
template<class G , class T1 , class T2 >
bool Dune::buildCommunication (const G &graph, std::vector< int > &realparts, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 
template<class S , class T >
void Dune::print_carray (S &os, T *array, std::size_t l)
 
template<class S , class T >
bool Dune::isValidGraph (std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T *adjncy, bool checkSymmetry)
 
template<class M , class T1 , class T2 >
bool Dune::commGraphRepartition (const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 
template<class G , class T1 , class T2 >
bool Dune::graphRepartition (const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
 execute a graph repartition for a giving graph and indexset.
 
template<class T >
std::ostream & Dune::Amg::operator<< (std::ostream &os, const AggregationCriterion< T > &criterion)
 
template<class G , class C >
void Dune::Amg::buildDependency (G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
 Build the dependency of the matrix graph.
 
template<class V >
void Dune::Amg::printAggregates2d (const AggregatesMap< V > &aggregates, int n, int m, std::ostream &os)
 
│ │ │

Detailed Description

│ │ │ -

Functionality for redistributing a parallel index set using graph partitioning.

│ │ │ -

Refactored version of an intern.

Author
Markus Blatt
│ │ │ -

Variable Documentation

│ │ │ - │ │ │ -

◆ globalOwnerVertices

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
int globalOwnerVertices
│ │ │ -
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +

Provides classes for the Coloring process of AMG.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,81 +1,104 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -repartition.hh File Reference │ │ │ │ -Functionality for redistributing a parallel index set using graph partitioning. │ │ │ │ -_M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +aggregates.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Provides classes for the Coloring process of AMG. _M_o_r_e_._._. │ │ │ │ +#include "_p_a_r_a_m_e_t_e_r_s_._h_h" │ │ │ │ +#include "_g_r_a_p_h_._h_h" │ │ │ │ +#include "_p_r_o_p_e_r_t_i_e_s_._h_h" │ │ │ │ +#include "_c_o_m_b_i_n_e_d_f_u_n_c_t_o_r_._h_h" │ │ │ │ #include │ │ │ │ -#include │ │ │ │ #include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_<_ _T_ _> │ │ │ │ +  Base class of all aggregation criterions. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -NNaammeessppaacceess │ │ │ │ -namespace   _D_u_n_e │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_ _M_,_ _N_ _> │ │ │ │ +  _D_e_p_e_n_d_e_n_c_y policy for symmetric matrices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_<_ _M_,_ _N_ _> │ │ │ │ +  _D_e_p_e_n_d_e_n_c_y policy for symmetric matrices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_ _M_,_ _N_ _> │ │ │ │ +  _D_e_p_e_n_d_e_n_c_y policy for symmetric matrices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_<_ _N_ _> │ │ │ │ +  Norm that uses only the [N][N] entry of the block to determine │ │ │ │ + couplings. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_F_i_r_s_t_D_i_a_g_o_n_a_l │ │ │ │ +  Norm that uses only the [0][0] entry of the block to determine │ │ │ │ + couplings. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ +  Functor using the row sum (infinity) norm to determine strong │ │ │ │ + couplings. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_M_e_t_i_s │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │   │ │ │ │ -TTyyppeeddeeffss │ │ │ │ -using  _D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t = float │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_ _M_,_ _N_o_r_m_ _> │ │ │ │ +  Criterion taking advantage of symmetric matrices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_<_ _M_,_ _N_o_r_m_ _> │ │ │ │ +  Criterion suitable for unsymmetric matrices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _V_ _> │ │ │ │ +  Class providing information about the mapping of the vertices onto │ │ │ │ + aggregates. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _V_ _>_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ +  A Dummy visitor that does nothing for each visited edge. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_<_ _G_,_ _S_ _> │ │ │ │ +  A class for temporarily storing the vertices of an aggregate in. │ │ │ │ + _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_<_ _G_ _> │ │ │ │ +  Class for building the aggregates. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +NNaammeessppaacceess │ │ │ │ +namespace   _D_u_n_e │ │ │ │   │ │ │ │ -using  _D_u_n_e_:_:_M_e_t_i_s_:_:_i_d_x___t = std::size_t │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s (const G &graph, _D_u_n_e_:_: │ │ │ │ - _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm) │ │ │ │ -  Fills the holes in an index set. │ │ │ │ -  │ │ │ │ -template │ │ │ │ -bool  _D_u_n_e_:_:_b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n (const G &graph, std::vector< int > &realparts, │ │ │ │ - _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, std::shared_ptr< │ │ │ │ - _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > &outcomm, │ │ │ │ - _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_p_r_i_n_t___c_a_r_r_a_y (S &os, T *array, std::size_t l) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -bool  _D_u_n_e_:_:_i_s_V_a_l_i_d_G_r_a_p_h (std::size_t noVtx, std::size_t gnoVtx, S noEdges, T │ │ │ │ - *xadj, T *adjncy, bool checkSymmetry) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -bool  _D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n (const M &_m_a_t, _D_u_n_e_:_: │ │ │ │ - _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ - std::shared_ptr< _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > │ │ │ │ - &outcomm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -bool  _D_u_n_e_:_:_g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n (const G &graph, _D_u_n_e_:_: │ │ │ │ - _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > &oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ - std::shared_ptr< _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< T1, T2 > > │ │ │ │ - &outcomm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e &redistInf, bool verbose=false) │ │ │ │ -  execute a graph repartition for a giving graph and indexset. │ │ │ │ +template │ │ │ │ +std::ostream &  _D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &os, const │ │ │ │ + _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n< T > &criterion) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y (G &graph, const typename C::Matrix │ │ │ │ + &matrix, C criterion, bool finestLevel) │ │ │ │ +  Build the dependency of the matrix graph. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_A_m_g_:_:_p_r_i_n_t_A_g_g_r_e_g_a_t_e_s_2_d (const _A_g_g_r_e_g_a_t_e_s_M_a_p< V > │ │ │ │ + &aggregates, int n, int m, std::ostream &os) │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Functionality for redistributing a parallel index set using graph partitioning. │ │ │ │ -Refactored version of an intern. │ │ │ │ +Provides classes for the Coloring process of AMG. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ -********** VVaarriiaabbllee DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? gglloobbaallOOwwnneerrVVeerrttiicceess ********** │ │ │ │ -int globalOwnerVertices │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: repartition.hh Source File │ │ │ +dune-istl: aggregates.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1845 +70,2259 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
repartition.hh
│ │ │ +
aggregates.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_REPARTITION_HH
│ │ │ -
6#define DUNE_ISTL_REPARTITION_HH
│ │ │ +
5#ifndef DUNE_AMG_AGGREGATES_HH
│ │ │ +
6#define DUNE_AMG_AGGREGATES_HH
│ │ │
7
│ │ │ -
8#include <cassert>
│ │ │ -
9#include <map>
│ │ │ -
10#include <utility>
│ │ │ -
11#include <cmath>
│ │ │ -
12
│ │ │ -
13#if HAVE_PARMETIS
│ │ │ -
14// Explicitly use C linkage as scotch does not extern "C" in its headers.
│ │ │ -
15// Works because ParMETIS/METIS checks whether compiler is C++ and otherwise
│ │ │ -
16// does not use extern "C". Therefore no nested extern "C" will be created.
│ │ │ -
17extern "C"
│ │ │ -
18{
│ │ │ -
19#include <parmetis.h>
│ │ │ -
20}
│ │ │ -
21#endif
│ │ │ -
22
│ │ │ -
23#include <dune/common/timer.hh>
│ │ │ -
24#include <dune/common/enumset.hh>
│ │ │ -
25#include <dune/common/stdstreams.hh>
│ │ │ -
26#include <dune/common/parallel/mpitraits.hh>
│ │ │ -
27#include <dune/common/parallel/communicator.hh>
│ │ │ -
28#include <dune/common/parallel/indexset.hh>
│ │ │ -
29#include <dune/common/parallel/indicessyncer.hh>
│ │ │ -
30#include <dune/common/parallel/remoteindices.hh>
│ │ │ -
31#include <dune/common/rangeutilities.hh>
│ │ │ -
32
│ │ │ - │ │ │ - │ │ │ -
35
│ │ │ -
44namespace Dune
│ │ │ -
45{
│ │ │ -
│ │ │ -
46 namespace Metis
│ │ │ -
47 {
│ │ │ -
48 // Explicitly specify a real_t and idx_t for older (Par)METIS versions that do not
│ │ │ -
49 // provide these typedefs
│ │ │ -
50#if HAVE_PARMETIS && defined(REALTYPEWIDTH)
│ │ │ -
51 using real_t = ::real_t;
│ │ │ -
52#else
│ │ │ -
53 using real_t = float;
│ │ │ -
54#endif
│ │ │ -
55
│ │ │ -
56#if HAVE_PARMETIS && defined(IDXTYPEWIDTH)
│ │ │ -
57 using idx_t = ::idx_t;
│ │ │ -
58#elif HAVE_PARMETIS && defined(HAVE_SCOTCH_NUM_TYPE)
│ │ │ -
59 using idx_t = SCOTCH_Num;
│ │ │ -
60#elif HAVE_PARMETIS
│ │ │ -
61 using idx_t = int;
│ │ │ -
62#else
│ │ │ -
63 using idx_t = std::size_t;
│ │ │ -
64#endif
│ │ │ -
65 }
│ │ │ -
│ │ │ -
66
│ │ │ -
67
│ │ │ -
68#if HAVE_MPI
│ │ │ -
82 template<class G, class T1, class T2>
│ │ │ -
│ │ │ - │ │ │ -
84 {
│ │ │ - │ │ │ -
86 typedef typename IndexSet::LocalIndex::Attribute Attribute;
│ │ │ -
87
│ │ │ -
88 IndexSet& indexSet = oocomm.indexSet();
│ │ │ - │ │ │ -
90
│ │ │ -
91 std::size_t sum=0, needed = graph.noVertices()-indexSet.size();
│ │ │ -
92 std::vector<std::size_t> neededall(oocomm.communicator().size(), 0);
│ │ │ -
93
│ │ │ -
94 MPI_Allgather(&needed, 1, MPITraits<std::size_t>::getType() , &(neededall[0]), 1, MPITraits<std::size_t>::getType(), oocomm.communicator());
│ │ │ -
95 for(int i=0; i<oocomm.communicator().size(); ++i)
│ │ │ -
96 sum=sum+neededall[i]; // MAke this for generic
│ │ │ -
97
│ │ │ -
98 if(sum==0)
│ │ │ -
99 // Nothing to do
│ │ │ -
100 return;
│ │ │ -
101
│ │ │ -
102 //Compute Maximum Global Index
│ │ │ -
103 T1 maxgi=0;
│ │ │ -
104 auto end = indexSet.end();
│ │ │ -
105 for(auto it = indexSet.begin(); it != end; ++it)
│ │ │ -
106 maxgi=std::max(maxgi,it->global());
│ │ │ -
107
│ │ │ -
108 //Process p creates global indices consecutively
│ │ │ -
109 //starting atmaxgi+\sum_{i=1}^p neededall[i]
│ │ │ -
110 // All created indices are owned by the process
│ │ │ -
111 maxgi=oocomm.communicator().max(maxgi);
│ │ │ -
112 ++maxgi; // Start with the next free index.
│ │ │ -
113
│ │ │ -
114 for(int i=0; i<oocomm.communicator().rank(); ++i)
│ │ │ -
115 maxgi=maxgi+neededall[i]; // TODO: make this more generic
│ │ │ -
116
│ │ │ -
117 // Store the global index information for repairing the remote index information
│ │ │ -
118 std::map<int,SLList<std::pair<T1,Attribute> > > globalIndices;
│ │ │ -
119 storeGlobalIndicesOfRemoteIndices(globalIndices, oocomm.remoteIndices());
│ │ │ -
120 indexSet.beginResize();
│ │ │ -
121
│ │ │ -
122 for(auto vertex = graph.begin(), vend=graph.end(); vertex != vend; ++vertex) {
│ │ │ -
123 const typename IndexSet::IndexPair* pair=lookup.pair(*vertex);
│ │ │ -
124 if(pair==0) {
│ │ │ -
125 // No index yet, add new one
│ │ │ -
126 indexSet.add(maxgi, typename IndexSet::LocalIndex(*vertex, OwnerOverlapCopyAttributeSet::owner, false));
│ │ │ -
127 ++maxgi;
│ │ │ -
128 }
│ │ │ -
129 }
│ │ │ -
130
│ │ │ -
131 indexSet.endResize();
│ │ │ -
132
│ │ │ -
133 repairLocalIndexPointers(globalIndices, oocomm.remoteIndices(), indexSet);
│ │ │ -
134
│ │ │ -
135 oocomm.freeGlobalLookup();
│ │ │ -
136 oocomm.buildGlobalLookup();
│ │ │ -
137#ifdef DEBUG_REPART
│ │ │ -
138 std::cout<<"Holes are filled!"<<std::endl;
│ │ │ -
139 std::cout<<oocomm.communicator().rank()<<": "<<oocomm.indexSet()<<std::endl;
│ │ │ -
140#endif
│ │ │ -
141 }
│ │ │ -
│ │ │ -
142
│ │ │ -
143 namespace
│ │ │ -
144 {
│ │ │ +
8
│ │ │ +
9#include "parameters.hh"
│ │ │ +
10#include "graph.hh"
│ │ │ +
11#include "properties.hh"
│ │ │ +
12#include "combinedfunctor.hh"
│ │ │ +
13
│ │ │ +
14#include <dune/common/timer.hh>
│ │ │ +
15#include <dune/common/stdstreams.hh>
│ │ │ +
16#include <dune/common/poolallocator.hh>
│ │ │ +
17#include <dune/common/sllist.hh>
│ │ │ +
18#include <dune/common/ftraits.hh>
│ │ │ +
19#include <dune/common/scalarmatrixview.hh>
│ │ │ +
20
│ │ │ +
21#include <utility>
│ │ │ +
22#include <set>
│ │ │ +
23#include <algorithm>
│ │ │ +
24#include <complex>
│ │ │ +
25#include <limits>
│ │ │ +
26#include <ostream>
│ │ │ +
27#include <tuple>
│ │ │ +
28
│ │ │ +
29namespace Dune
│ │ │ +
30{
│ │ │ +
31 namespace Amg
│ │ │ +
32 {
│ │ │ +
33
│ │ │ +
47 template<class T>
│ │ │ +
│ │ │ +
48 class AggregationCriterion : public T
│ │ │ +
49 {
│ │ │ +
50
│ │ │ +
51 public:
│ │ │ + │ │ │ +
56
│ │ │ +
│ │ │ + │ │ │ +
67 : T()
│ │ │ +
68 {}
│ │ │ +
│ │ │ +
69
│ │ │ +
│ │ │ + │ │ │ +
71 : T(parms)
│ │ │ +
72 {}
│ │ │ +
│ │ │ +
│ │ │ +
82 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
│ │ │ +
83 {
│ │ │ +
84 this->setMaxDistance(diameter-1);
│ │ │ +
85 std::size_t csize=1;
│ │ │ +
86
│ │ │ +
87 for(; dim>0; dim--) {
│ │ │ +
88 csize*=diameter;
│ │ │ +
89 this->setMaxDistance(this->maxDistance()+diameter-1);
│ │ │ +
90 }
│ │ │ +
91 this->setMinAggregateSize(csize);
│ │ │ +
92 this->setMaxAggregateSize(static_cast<std::size_t>(csize*1.5));
│ │ │ +
93 }
│ │ │ +
│ │ │ +
94
│ │ │ +
│ │ │ +
105 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ +
106 {
│ │ │ +
107 setDefaultValuesIsotropic(dim, diameter);
│ │ │ +
108 this->setMaxDistance(this->maxDistance()+dim-1);
│ │ │ +
109 }
│ │ │ +
│ │ │ +
110 };
│ │ │ +
│ │ │ +
111
│ │ │ +
112 template<class T>
│ │ │ +
│ │ │ +
113 std::ostream& operator<<(std::ostream& os, const AggregationCriterion<T>& criterion)
│ │ │ +
114 {
│ │ │ +
115 os<<"{ maxdistance="<<criterion.maxDistance()<<" minAggregateSize="
│ │ │ +
116 <<criterion.minAggregateSize()<< " maxAggregateSize="<<criterion.maxAggregateSize()
│ │ │ +
117 <<" connectivity="<<criterion.maxConnectivity()<<" debugLevel="<<criterion.debugLevel()<<"}";
│ │ │ +
118 return os;
│ │ │ +
119 }
│ │ │ +
│ │ │ +
120
│ │ │ +
132 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
134 {
│ │ │ +
135 public:
│ │ │ +
139 typedef M Matrix;
│ │ │ +
140
│ │ │ +
144 typedef N Norm;
│ │ │
145
│ │ │ -
146 class ParmetisDuneIndexMap
│ │ │ -
147 {
│ │ │ -
148 public:
│ │ │ -
149 template<class Graph, class OOComm>
│ │ │ -
150 ParmetisDuneIndexMap(const Graph& graph, const OOComm& com);
│ │ │ -
151 int toParmetis(int i) const
│ │ │ -
152 {
│ │ │ -
153 return duneToParmetis[i];
│ │ │ -
154 }
│ │ │ -
155 int toLocalParmetis(int i) const
│ │ │ -
156 {
│ │ │ -
157 return duneToParmetis[i]-base_;
│ │ │ -
158 }
│ │ │ -
159 int operator[](int i) const
│ │ │ -
160 {
│ │ │ -
161 return duneToParmetis[i];
│ │ │ -
162 }
│ │ │ -
163 int toDune(int i) const
│ │ │ -
164 {
│ │ │ -
165 return parmetisToDune[i];
│ │ │ -
166 }
│ │ │ -
167 std::vector<int>::size_type numOfOwnVtx() const
│ │ │ -
168 {
│ │ │ -
169 return parmetisToDune.size();
│ │ │ -
170 }
│ │ │ -
171 Metis::idx_t* vtxDist()
│ │ │ -
172 {
│ │ │ -
173 return &vtxDist_[0];
│ │ │ -
174 }
│ │ │ - │ │ │ -
176 private:
│ │ │ -
177 int base_;
│ │ │ -
178 std::vector<int> duneToParmetis;
│ │ │ -
179 std::vector<int> parmetisToDune;
│ │ │ -
180 // range of vertices for processor i: vtxdist[i] to vtxdist[i+1] (parmetis global)
│ │ │ -
181 std::vector<Metis::idx_t> vtxDist_;
│ │ │ -
182 };
│ │ │ -
183
│ │ │ -
184 template<class G, class OOComm>
│ │ │ -
185 ParmetisDuneIndexMap::ParmetisDuneIndexMap(const G& graph, const OOComm& oocomm)
│ │ │ -
186 : duneToParmetis(graph.noVertices(), -1), vtxDist_(oocomm.communicator().size()+1)
│ │ │ -
187 {
│ │ │ -
188 int npes=oocomm.communicator().size(), mype=oocomm.communicator().rank();
│ │ │ -
189
│ │ │ -
190 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ -
191
│ │ │ -
192 int numOfOwnVtx=0;
│ │ │ -
193 auto end = oocomm.indexSet().end();
│ │ │ -
194 for(auto index = oocomm.indexSet().begin(); index != end; ++index) {
│ │ │ -
195 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ -
196 numOfOwnVtx++;
│ │ │ -
197 }
│ │ │ -
198 }
│ │ │ -
199 parmetisToDune.resize(numOfOwnVtx);
│ │ │ -
200 std::vector<int> globalNumOfVtx(npes);
│ │ │ -
201 // make this number available to all processes
│ │ │ -
202 MPI_Allgather(&numOfOwnVtx, 1, MPI_INT, &(globalNumOfVtx[0]), 1, MPI_INT, oocomm.communicator());
│ │ │ -
203
│ │ │ -
204 int base=0;
│ │ │ -
205 vtxDist_[0] = 0;
│ │ │ -
206 for(int i=0; i<npes; i++) {
│ │ │ -
207 if (i<mype) {
│ │ │ -
208 base += globalNumOfVtx[i];
│ │ │ -
209 }
│ │ │ -
210 vtxDist_[i+1] = vtxDist_[i] + globalNumOfVtx[i];
│ │ │ -
211 }
│ │ │ -
212 globalOwnerVertices=vtxDist_[npes];
│ │ │ -
213 base_=base;
│ │ │ -
214
│ │ │ -
215#ifdef DEBUG_REPART
│ │ │ -
216 std::cout << oocomm.communicator().rank()<<" vtxDist: ";
│ │ │ -
217 for(int i=0; i<= npes; ++i)
│ │ │ -
218 std::cout << vtxDist_[i]<<" ";
│ │ │ -
219 std::cout<<std::endl;
│ │ │ -
220#endif
│ │ │ -
221
│ │ │ -
222 // Traverse the graph and assign a new consecutive number/index
│ │ │ -
223 // starting by "base" to all owner vertices.
│ │ │ -
224 // The new index is used as the ParMETIS global index and is
│ │ │ -
225 // stored in the vector "duneToParmetis"
│ │ │ -
226 auto vend = graph.end();
│ │ │ -
227 for(auto vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ -
228 const typename OOComm::ParallelIndexSet::IndexPair* index=oocomm.globalLookup().pair(*vertex);
│ │ │ -
229 assert(index);
│ │ │ -
230 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ -
231 // assign and count the index
│ │ │ -
232 parmetisToDune[base-base_]=index->local();
│ │ │ -
233 duneToParmetis[index->local()] = base++;
│ │ │ -
234 }
│ │ │ +
149 typedef typename Matrix::row_type Row;
│ │ │ +
150
│ │ │ + │ │ │ +
155
│ │ │ +
156 void init(const Matrix* matrix);
│ │ │ +
157
│ │ │ +
158 void initRow(const Row& row, int index);
│ │ │ +
159
│ │ │ +
160 void examine(const ColIter& col);
│ │ │ +
161
│ │ │ +
162 template<class G>
│ │ │ +
163 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ +
164
│ │ │ +
165 bool isIsolated();
│ │ │ +
166
│ │ │ +
167
│ │ │ +
│ │ │ + │ │ │ +
169 : Parameters(parms)
│ │ │ +
170 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
172 : Parameters()
│ │ │ +
173 {}
│ │ │ +
│ │ │ +
174
│ │ │ +
175 protected:
│ │ │ + │ │ │ + │ │ │ +
180 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ + │ │ │ + │ │ │ +
185 int row_;
│ │ │ + │ │ │ +
188 std::vector<real_type> vals_;
│ │ │ +
189 typename std::vector<real_type>::iterator valIter_;
│ │ │ +
190
│ │ │ +
191 };
│ │ │ +
│ │ │ +
192
│ │ │ +
193
│ │ │ +
194 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
196 {
│ │ │ +
197 matrix_ = matrix;
│ │ │ +
198 }
│ │ │ +
│ │ │ +
199
│ │ │ +
200 template<class M, class N>
│ │ │ +
│ │ │ +
201 inline void SymmetricMatrixDependency<M,N>::initRow(const Row& row, int index)
│ │ │ +
202 {
│ │ │ +
203 using std::min;
│ │ │ +
204 vals_.assign(row.size(), 0.0);
│ │ │ +
205 assert(vals_.size()==row.size());
│ │ │ +
206 valIter_=vals_.begin();
│ │ │ +
207
│ │ │ +
208 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ +
209 diagonal_=norm_(row[index]);
│ │ │ +
210 row_ = index;
│ │ │ +
211 }
│ │ │ +
│ │ │ +
212
│ │ │ +
213 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
215 {
│ │ │ +
216 using std::max;
│ │ │ +
217 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ +
218 real_type eij = norm_(*col);
│ │ │ +
219 if(!N::is_sign_preserving || eij<0) // || eji<0)
│ │ │ +
220 {
│ │ │ +
221 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](col.index())[col.index()]);
│ │ │ +
222 maxValue_ = max(maxValue_, *valIter_);
│ │ │ +
223 }else
│ │ │ +
224 *valIter_ =0;
│ │ │ +
225 ++valIter_;
│ │ │ +
226 }
│ │ │ +
│ │ │ +
227
│ │ │ +
228 template<class M, class N>
│ │ │ +
229 template<class G>
│ │ │ +
│ │ │ +
230 inline void SymmetricMatrixDependency<M,N>::examine(G&, const typename G::EdgeIterator& edge, const ColIter&)
│ │ │ +
231 {
│ │ │ +
232 if(*valIter_ > alpha() * maxValue_) {
│ │ │ +
233 edge.properties().setDepends();
│ │ │ +
234 edge.properties().setInfluences();
│ │ │
235 }
│ │ │ -
236
│ │ │ -
237 // At this point, every process knows the ParMETIS global index
│ │ │ -
238 // of it's owner vertices. The next step is to get the
│ │ │ -
239 // ParMETIS global index of the overlap vertices from the
│ │ │ -
240 // associated processes. To do this, the Dune::Interface class
│ │ │ -
241 // is used.
│ │ │ -
242#ifdef DEBUG_REPART
│ │ │ -
243 std::cout <<oocomm.communicator().rank()<<": before ";
│ │ │ -
244 for(std::size_t i=0; i<duneToParmetis.size(); ++i)
│ │ │ -
245 std::cout<<duneToParmetis[i]<<" ";
│ │ │ -
246 std::cout<<std::endl;
│ │ │ -
247#endif
│ │ │ -
248 oocomm.copyOwnerToAll(duneToParmetis,duneToParmetis);
│ │ │ -
249#ifdef DEBUG_REPART
│ │ │ -
250 std::cout <<oocomm.communicator().rank()<<": after ";
│ │ │ -
251 for(std::size_t i=0; i<duneToParmetis.size(); ++i)
│ │ │ -
252 std::cout<<duneToParmetis[i]<<" ";
│ │ │ -
253 std::cout<<std::endl;
│ │ │ -
254#endif
│ │ │ -
255 }
│ │ │ -
256 }
│ │ │ -
257
│ │ │ -
│ │ │ - │ │ │ -
259 : public Interface
│ │ │ -
260 {
│ │ │ -
│ │ │ -
261 void setCommunicator(MPI_Comm comm)
│ │ │ -
262 {
│ │ │ -
263 communicator_=comm;
│ │ │ -
264 }
│ │ │ -
│ │ │ -
265 template<class Flags,class IS>
│ │ │ -
│ │ │ -
266 void buildSendInterface(const std::vector<int>& toPart, const IS& idxset)
│ │ │ -
267 {
│ │ │ -
268 std::map<int,int> sizes;
│ │ │ -
269
│ │ │ -
270 for(auto i=idxset.begin(), end=idxset.end(); i!=end; ++i)
│ │ │ -
271 if(Flags::contains(i->local().attribute()))
│ │ │ -
272 ++sizes[toPart[i->local()]];
│ │ │ -
273
│ │ │ -
274 // Allocate the necessary space
│ │ │ -
275 for(auto i=sizes.begin(), end=sizes.end(); i!=end; ++i)
│ │ │ -
276 interfaces()[i->first].first.reserve(i->second);
│ │ │ -
277
│ │ │ -
278 //Insert the interface information
│ │ │ -
279 for(auto i=idxset.begin(), end=idxset.end(); i!=end; ++i)
│ │ │ -
280 if(Flags::contains(i->local().attribute()))
│ │ │ -
281 interfaces()[toPart[i->local()]].first.add(i->local());
│ │ │ -
282 }
│ │ │ +
236 ++valIter_;
│ │ │ +
237 }
│ │ │
│ │ │ +
238
│ │ │ +
239 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
241 {
│ │ │ +
242 if(diagonal_==0)
│ │ │ +
243 DUNE_THROW(Dune::ISTLError, "No diagonal entry for row "<<row_<<".");
│ │ │ +
244 valIter_=vals_.begin();
│ │ │ +
245 return maxValue_ < beta();
│ │ │ +
246 }
│ │ │ +
│ │ │ +
247
│ │ │ +
251 template<class M, class N>
│ │ │ +
│ │ │ +
252 class Dependency : public Parameters
│ │ │ +
253 {
│ │ │ +
254 public:
│ │ │ +
258 typedef M Matrix;
│ │ │ +
259
│ │ │ +
263 typedef N Norm;
│ │ │ +
264
│ │ │ +
268 typedef typename Matrix::row_type Row;
│ │ │ +
269
│ │ │ + │ │ │ +
274
│ │ │ +
275 void init(const Matrix* matrix);
│ │ │ +
276
│ │ │ +
277 void initRow(const Row& row, int index);
│ │ │ +
278
│ │ │ +
279 void examine(const ColIter& col);
│ │ │ +
280
│ │ │ +
281 template<class G>
│ │ │ +
282 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │
283
│ │ │ -
│ │ │ -
284 void reserveSpaceForReceiveInterface(int proc, int size)
│ │ │ -
285 {
│ │ │ -
286 interfaces()[proc].second.reserve(size);
│ │ │ -
287 }
│ │ │ -
│ │ │ -
│ │ │ -
288 void addReceiveIndex(int proc, std::size_t idx)
│ │ │ -
289 {
│ │ │ -
290 interfaces()[proc].second.add(idx);
│ │ │ -
291 }
│ │ │ -
│ │ │ -
292 template<typename TG>
│ │ │ -
│ │ │ -
293 void buildReceiveInterface(std::vector<std::pair<TG,int> >& indices)
│ │ │ -
294 {
│ │ │ -
295 std::size_t i=0;
│ │ │ -
296 for(auto idx=indices.begin(); idx!= indices.end(); ++idx) {
│ │ │ -
297 interfaces()[idx->second].second.add(i++);
│ │ │ -
298 }
│ │ │ -
299 }
│ │ │ -
│ │ │ -
300
│ │ │ -
301 };
│ │ │ -
│ │ │ -
302
│ │ │ -
303 namespace
│ │ │ -
304 {
│ │ │ -
314 template<class GI>
│ │ │ -
315 void createSendBuf(std::vector<GI>& ownerVec, std::set<GI>& overlapVec, std::set<int>& neighbors, char *sendBuf, int buffersize, MPI_Comm comm) {
│ │ │ -
316 // Pack owner vertices
│ │ │ -
317 std::size_t s=ownerVec.size();
│ │ │ -
318 int pos=0;
│ │ │ -
319 if(s==0)
│ │ │ -
320 ownerVec.resize(1); // otherwise would read beyond the memory bound
│ │ │ -
321 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ -
322 MPI_Pack(&(ownerVec[0]), s, MPITraits<GI>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ -
323 s = overlapVec.size();
│ │ │ -
324 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ -
325 for(auto i=overlapVec.begin(), end= overlapVec.end(); i != end; ++i)
│ │ │ -
326 MPI_Pack(const_cast<GI*>(&(*i)), 1, MPITraits<GI>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ -
327
│ │ │ -
328 s=neighbors.size();
│ │ │ -
329 MPI_Pack(&s, 1, MPITraits<std::size_t>::getType(), sendBuf, buffersize, &pos, comm);
│ │ │ + │ │ │ +
285
│ │ │ +
│ │ │ +
286 Dependency(const Parameters& parms)
│ │ │ +
287 : Parameters(parms)
│ │ │ +
288 {}
│ │ │ +
│ │ │ +
289
│ │ │ +
│ │ │ + │ │ │ +
291 : Parameters()
│ │ │ +
292 {}
│ │ │ +
│ │ │ +
293
│ │ │ +
294 protected:
│ │ │ + │ │ │ + │ │ │ +
299 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ + │ │ │ + │ │ │ +
304 int row_;
│ │ │ + │ │ │ +
307 };
│ │ │ +
│ │ │ +
308
│ │ │ +
312 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
314 {
│ │ │ +
315 public:
│ │ │ +
319 typedef M Matrix;
│ │ │ +
320
│ │ │ +
324 typedef N Norm;
│ │ │ +
325
│ │ │ +
329 typedef typename Matrix::row_type Row;
│ │ │
330
│ │ │ -
331 for(auto i=neighbors.begin(), end= neighbors.end(); i != end; ++i)
│ │ │ -
332 MPI_Pack(const_cast<int*>(&(*i)), 1, MPI_INT, sendBuf, buffersize, &pos, comm);
│ │ │ -
333 }
│ │ │ -
342 template<class GI>
│ │ │ -
343 void saveRecvBuf(char *recvBuf, int bufferSize, std::vector<std::pair<GI,int> >& ownerVec,
│ │ │ -
344 std::set<GI>& overlapVec, std::set<int>& neighbors, RedistributeInterface& inf, int from, MPI_Comm comm) {
│ │ │ -
345 std::size_t size;
│ │ │ -
346 int pos=0;
│ │ │ -
347 // unpack owner vertices
│ │ │ -
348 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ -
349 inf.reserveSpaceForReceiveInterface(from, size);
│ │ │ -
350 ownerVec.reserve(ownerVec.size()+size);
│ │ │ -
351 for(; size!=0; --size) {
│ │ │ -
352 GI gi;
│ │ │ -
353 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits<GI>::getType(), comm);
│ │ │ -
354 ownerVec.push_back(std::make_pair(gi,from));
│ │ │ -
355 }
│ │ │ -
356 // unpack overlap vertices
│ │ │ -
357 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ -
358 typename std::set<GI>::iterator ipos = overlapVec.begin();
│ │ │ -
359 Dune::dverb << "unpacking "<<size<<" overlap"<<std::endl;
│ │ │ -
360 for(; size!=0; --size) {
│ │ │ -
361 GI gi;
│ │ │ -
362 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits<GI>::getType(), comm);
│ │ │ -
363 ipos=overlapVec.insert(ipos, gi);
│ │ │ -
364 }
│ │ │ -
365 //unpack neighbors
│ │ │ -
366 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits<std::size_t>::getType(), comm);
│ │ │ -
367 Dune::dverb << "unpacking "<<size<<" neighbors"<<std::endl;
│ │ │ -
368 typename std::set<int>::iterator npos = neighbors.begin();
│ │ │ -
369 for(; size!=0; --size) {
│ │ │ -
370 int n;
│ │ │ -
371 MPI_Unpack(recvBuf, bufferSize, &pos, &n, 1, MPI_INT, comm);
│ │ │ -
372 npos=neighbors.insert(npos, n);
│ │ │ -
373 }
│ │ │ -
374 }
│ │ │ -
375
│ │ │ -
389 template<typename T>
│ │ │ -
390 void getDomain(const MPI_Comm& comm, T *part, int numOfOwnVtx, int nparts, int *myDomain, std::vector<int> &domainMapping) {
│ │ │ -
391 int npes, mype;
│ │ │ -
392 MPI_Comm_size(comm, &npes);
│ │ │ -
393 MPI_Comm_rank(comm, &mype);
│ │ │ -
394 MPI_Status status;
│ │ │ -
395
│ │ │ -
396 *myDomain = -1;
│ │ │ -
397
│ │ │ -
398 std::vector<int> domain(nparts, 0);
│ │ │ -
399 std::vector<int> assigned(npes, 0);
│ │ │ -
400 // init domain Mapping
│ │ │ -
401 domainMapping.assign(domainMapping.size(), -1);
│ │ │ -
402
│ │ │ -
403 // count the occurrence of domains
│ │ │ -
404 for (int i = 0; i < numOfOwnVtx; i++) {
│ │ │ -
405 domain[part[i]]++;
│ │ │ -
406 }
│ │ │ -
407
│ │ │ -
408 std::vector<int> domainMatrix(npes * nparts, -1);
│ │ │ -
409
│ │ │ -
410 // init buffer with the own domain
│ │ │ -
411 int *buf = new int[nparts];
│ │ │ -
412 for (int i = 0; i < nparts; i++) {
│ │ │ -
413 buf[i] = domain[i];
│ │ │ -
414 domainMatrix[mype*nparts+i] = domain[i];
│ │ │ -
415 }
│ │ │ -
416 int pe=0;
│ │ │ -
417 int src = (mype-1+npes)%npes;
│ │ │ -
418 int dest = (mype+1)%npes;
│ │ │ -
419 // ring communication, we need n-1 communications for n processors
│ │ │ -
420 for (int i = 0; i < npes-1; i++) {
│ │ │ -
421 MPI_Sendrecv_replace(buf, nparts, MPI_INT, dest, 0, src, 0, comm, &status);
│ │ │ -
422 // pe is the process of the actual received buffer
│ │ │ -
423 pe = ((mype-1-i)+npes)%npes;
│ │ │ -
424 for(int j = 0; j < nparts; j++) {
│ │ │ -
425 // save the values to the domain matrix
│ │ │ -
426 domainMatrix[pe*nparts+j] = buf[j];
│ │ │ -
427 }
│ │ │ -
428 }
│ │ │ -
429 delete[] buf;
│ │ │ -
430
│ │ │ -
431 // Start the domain calculation.
│ │ │ -
432 // The process which contains the maximum number of vertices of a
│ │ │ -
433 // particular domain is selected to choose it's favorate domain
│ │ │ -
434 int maxOccurance = 0;
│ │ │ -
435 pe = -1;
│ │ │ -
436 std::set<std::size_t> unassigned;
│ │ │ -
437
│ │ │ -
438 for (int i = 0; i < nparts; i++) {
│ │ │ -
439 for (int j = 0; j < npes; j++) {
│ │ │ -
440 // process has no domain assigned
│ │ │ -
441 if (assigned[j]==0) {
│ │ │ -
442 if (maxOccurance < domainMatrix[j*nparts+i]) {
│ │ │ -
443 maxOccurance = domainMatrix[j*nparts+i];
│ │ │ -
444 pe = j;
│ │ │ -
445 }
│ │ │ -
446 }
│ │ │ + │ │ │ +
335
│ │ │ +
336 void init(const Matrix* matrix);
│ │ │ +
337
│ │ │ +
338 void initRow(const Row& row, int index);
│ │ │ +
339
│ │ │ +
340 void examine(const ColIter& col);
│ │ │ +
341
│ │ │ +
342 template<class G>
│ │ │ +
343 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ +
344
│ │ │ + │ │ │ +
346
│ │ │ +
347
│ │ │ +
│ │ │ + │ │ │ +
349 : Parameters(parms)
│ │ │ +
350 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
352 : Parameters()
│ │ │ +
353 {}
│ │ │ +
│ │ │ +
354
│ │ │ +
355 protected:
│ │ │ + │ │ │ + │ │ │ +
360 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ + │ │ │ + │ │ │ +
365 int row_;
│ │ │ + │ │ │ +
368 private:
│ │ │ +
369 void initRow(const Row& row, int index, const std::true_type&);
│ │ │ +
370 void initRow(const Row& row, int index, const std::false_type&);
│ │ │ +
371 };
│ │ │ +
│ │ │ +
372
│ │ │ +
377 template<int N>
│ │ │ +
│ │ │ + │ │ │ +
379 {
│ │ │ +
380 public:
│ │ │ +
381 enum { /* @brief We preserve the sign.*/
│ │ │ +
382 is_sign_preserving = true
│ │ │ +
383 };
│ │ │ +
384
│ │ │ +
389 template<class M>
│ │ │ +
│ │ │ +
390 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m,
│ │ │ +
391 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ +
392 {
│ │ │ +
393 typedef typename M::field_type field_type;
│ │ │ +
394 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ +
395 static_assert( std::is_convertible<field_type, real_type >::value,
│ │ │ +
396 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ +
397 return m[N][N];
│ │ │ +
398 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ +
399 }
│ │ │ +
│ │ │ +
400
│ │ │ +
405 template<class M>
│ │ │ +
│ │ │ +
406 auto operator()(const M& m,
│ │ │ +
407 typename std::enable_if_t<Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ +
408 {
│ │ │ +
409 typedef typename FieldTraits<M>::real_type real_type;
│ │ │ +
410 static_assert( std::is_convertible<M, real_type >::value,
│ │ │ +
411 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ +
412 return m;
│ │ │ +
413 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ +
414 }
│ │ │ +
│ │ │ +
415
│ │ │ +
416 private:
│ │ │ +
417
│ │ │ +
419 template<typename T>
│ │ │ +
420 static T signed_abs(const T & v)
│ │ │ +
421 {
│ │ │ +
422 return v;
│ │ │ +
423 }
│ │ │ +
424
│ │ │ +
426 template<typename T>
│ │ │ +
427 static T signed_abs(const std::complex<T> & v)
│ │ │ +
428 {
│ │ │ +
429 // return sign * abs_value
│ │ │ +
430 // in case of complex numbers this extends to using the csgn function to determine the sign
│ │ │ +
431 return csgn(v) * std::abs(v);
│ │ │ +
432 }
│ │ │ +
433
│ │ │ +
435 template<typename T>
│ │ │ +
436 static T csgn(const T & v)
│ │ │ +
437 {
│ │ │ +
438 return (T(0) < v) - (v < T(0));
│ │ │ +
439 }
│ │ │ +
440
│ │ │ +
442 template<typename T>
│ │ │ +
443 static T csgn(std::complex<T> a)
│ │ │ +
444 {
│ │ │ +
445 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag());
│ │ │ +
446 }
│ │ │
447
│ │ │ -
448 }
│ │ │ -
449 if (pe!=-1) {
│ │ │ -
450 // process got a domain, ...
│ │ │ -
451 domainMapping[i] = pe;
│ │ │ -
452 // ...mark as assigned
│ │ │ -
453 assigned[pe] = 1;
│ │ │ -
454 if (pe==mype) {
│ │ │ -
455 *myDomain = i;
│ │ │ -
456 }
│ │ │ -
457 pe = -1;
│ │ │ -
458 }
│ │ │ -
459 else
│ │ │ -
460 {
│ │ │ -
461 unassigned.insert(i);
│ │ │ -
462 }
│ │ │ -
463 maxOccurance = 0;
│ │ │ -
464 }
│ │ │ -
465
│ │ │ -
466 typename std::vector<int>::iterator next_free = assigned.begin();
│ │ │ -
467
│ │ │ -
468 for(auto udomain = unassigned.begin(),
│ │ │ -
469 end = unassigned.end(); udomain != end; ++udomain)
│ │ │ -
470 {
│ │ │ -
471 next_free = std::find_if(next_free, assigned.end(), std::bind(std::less<int>(), std::placeholders::_1, 1));
│ │ │ -
472 assert(next_free != assigned.end());
│ │ │ -
473 domainMapping[*udomain] = next_free-assigned.begin();
│ │ │ -
474 *next_free = 1;
│ │ │ -
475 }
│ │ │ -
476 }
│ │ │ -
477
│ │ │ -
478 struct SortFirst
│ │ │ -
479 {
│ │ │ -
480 template<class T>
│ │ │ -
481 bool operator()(const T& t1, const T& t2) const
│ │ │ -
482 {
│ │ │ -
483 return t1<t2;
│ │ │ -
484 }
│ │ │ -
485 };
│ │ │ -
486
│ │ │ -
487
│ │ │ -
498 template<class GI>
│ │ │ -
499 void mergeVec(std::vector<std::pair<GI, int> >& ownerVec, std::set<GI>& overlapSet) {
│ │ │ -
500
│ │ │ -
501#ifdef DEBUG_REPART
│ │ │ -
502 // Safety check for duplicates.
│ │ │ -
503 if(ownerVec.size()>0)
│ │ │ -
504 {
│ │ │ -
505 auto old=ownerVec.begin();
│ │ │ -
506 for(auto i=old+1, end=ownerVec.end(); i != end; old=i++)
│ │ │ -
507 {
│ │ │ -
508 if(i->first==old->first)
│ │ │ -
509 {
│ │ │ -
510 std::cerr<<"Value at index "<<old-ownerVec.begin()<<" is the same as at index "
│ │ │ -
511 <<i-ownerVec.begin()<<" ["<<old->first<<","<<old->second<<"]==["
│ │ │ -
512 <<i->first<<","<<i->second<<"]"<<std::endl;
│ │ │ -
513 throw "Huch!";
│ │ │ -
514 }
│ │ │ -
515 }
│ │ │ -
516 }
│ │ │ -
517
│ │ │ -
518#endif
│ │ │ -
519
│ │ │ -
520 auto v=ownerVec.begin(), vend=ownerVec.end();
│ │ │ -
521 for(auto s=overlapSet.begin(), send=overlapSet.end(); s!=send;)
│ │ │ -
522 {
│ │ │ -
523 while(v!=vend && v->first<*s) ++v;
│ │ │ -
524 if(v!=vend && v->first==*s) {
│ │ │ -
525 // Move to the next element before erasing
│ │ │ -
526 // thus s stays valid!
│ │ │ -
527 auto tmp=s;
│ │ │ -
528 ++s;
│ │ │ -
529 overlapSet.erase(tmp);
│ │ │ -
530 }else
│ │ │ -
531 ++s;
│ │ │ -
532 }
│ │ │ -
533 }
│ │ │ -
534
│ │ │ -
535
│ │ │ -
549 template<class OwnerSet, class Graph, class IS, class GI>
│ │ │ -
550 void getNeighbor(const Graph& g, std::vector<int>& part,
│ │ │ -
551 typename Graph::VertexDescriptor vtx, const IS& indexSet,
│ │ │ -
552 int toPe, std::set<GI>& neighbor, std::set<int>& neighborProcs) {
│ │ │ -
553 for(auto edge=g.beginEdges(vtx), end=g.endEdges(vtx); edge!=end; ++edge)
│ │ │ -
554 {
│ │ │ -
555 const typename IS::IndexPair* pindex = indexSet.pair(edge.target());
│ │ │ -
556 assert(pindex);
│ │ │ -
557 if(part[pindex->local()]!=toPe || !OwnerSet::contains(pindex->local().attribute()))
│ │ │ -
558 {
│ │ │ -
559 // is sent to another process and therefore becomes overlap
│ │ │ -
560 neighbor.insert(pindex->global());
│ │ │ -
561 neighborProcs.insert(part[pindex->local()]);
│ │ │ -
562 }
│ │ │ -
563 }
│ │ │ -
564 }
│ │ │ -
565
│ │ │ -
566 template<class T, class I>
│ │ │ -
567 void my_push_back(std::vector<T>& ownerVec, const I& index, [[maybe_unused]] int proc)
│ │ │ -
568 {
│ │ │ -
569 ownerVec.push_back(index);
│ │ │ -
570 }
│ │ │ -
571
│ │ │ -
572 template<class T, class I>
│ │ │ -
573 void my_push_back(std::vector<std::pair<T,int> >& ownerVec, const I& index, int proc)
│ │ │ -
574 {
│ │ │ -
575 ownerVec.push_back(std::make_pair(index,proc));
│ │ │ -
576 }
│ │ │ -
577 template<class T>
│ │ │ -
578 void reserve(std::vector<T>&, RedistributeInterface&, int)
│ │ │ -
579 {}
│ │ │ -
580 template<class T>
│ │ │ -
581 void reserve(std::vector<std::pair<T,int> >& ownerVec, RedistributeInterface& redist, int proc)
│ │ │ -
582 {
│ │ │ -
583 redist.reserveSpaceForReceiveInterface(proc, ownerVec.size());
│ │ │ -
584 }
│ │ │ -
585
│ │ │ -
586
│ │ │ -
604 template<class OwnerSet, class G, class IS, class T, class GI>
│ │ │ -
605 void getOwnerOverlapVec(const G& graph, std::vector<int>& part, IS& indexSet,
│ │ │ -
606 [[maybe_unused]] int myPe, int toPe, std::vector<T>& ownerVec, std::set<GI>& overlapSet,
│ │ │ -
607 RedistributeInterface& redist, std::set<int>& neighborProcs) {
│ │ │ -
608 for(auto index = indexSet.begin(); index != indexSet.end(); ++index) {
│ │ │ -
609 // Only Process owner vertices, the others are not in the parmetis graph.
│ │ │ -
610 if(OwnerSet::contains(index->local().attribute()))
│ │ │ -
611 {
│ │ │ -
612 if(part[index->local()]==toPe)
│ │ │ -
613 {
│ │ │ -
614 getNeighbor<OwnerSet>(graph, part, index->local(), indexSet,
│ │ │ -
615 toPe, overlapSet, neighborProcs);
│ │ │ -
616 my_push_back(ownerVec, index->global(), toPe);
│ │ │ -
617 }
│ │ │ -
618 }
│ │ │ -
619 }
│ │ │ -
620 reserve(ownerVec, redist, toPe);
│ │ │ -
621
│ │ │ -
622 }
│ │ │ -
623
│ │ │ -
624
│ │ │ -
631 template<class F, class IS>
│ │ │ -
632 inline bool isOwner(IS& indexSet, int index) {
│ │ │ -
633
│ │ │ -
634 const typename IS::IndexPair* pindex=indexSet.pair(index);
│ │ │ -
635
│ │ │ -
636 assert(pindex);
│ │ │ -
637 return F::contains(pindex->local().attribute());
│ │ │ -
638 }
│ │ │ -
639
│ │ │ -
640
│ │ │ -
641 class BaseEdgeFunctor
│ │ │ -
642 {
│ │ │ -
643 public:
│ │ │ -
644 BaseEdgeFunctor(Metis::idx_t* adj,const ParmetisDuneIndexMap& data)
│ │ │ -
645 : i_(), adj_(adj), data_(data)
│ │ │ -
646 {}
│ │ │ -
647
│ │ │ -
648 template<class T>
│ │ │ -
649 void operator()(const T& edge)
│ │ │ -
650 {
│ │ │ -
651 // Get the edge weight
│ │ │ -
652 // const Weight& weight=edge.weight();
│ │ │ -
653 adj_[i_] = data_.toParmetis(edge.target());
│ │ │ -
654 i_++;
│ │ │ -
655 }
│ │ │ -
656 std::size_t index()
│ │ │ -
657 {
│ │ │ -
658 return i_;
│ │ │ -
659 }
│ │ │ -
660
│ │ │ -
661 private:
│ │ │ -
662 std::size_t i_;
│ │ │ -
663 Metis::idx_t* adj_;
│ │ │ -
664 const ParmetisDuneIndexMap& data_;
│ │ │ -
665 };
│ │ │ -
666
│ │ │ -
667 template<typename G>
│ │ │ -
668 struct EdgeFunctor
│ │ │ -
669 : public BaseEdgeFunctor
│ │ │ -
670 {
│ │ │ -
671 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std::size_t)
│ │ │ -
672 : BaseEdgeFunctor(adj, data)
│ │ │ -
673 {}
│ │ │ -
674
│ │ │ -
675 Metis::idx_t* getWeights()
│ │ │ -
676 {
│ │ │ -
677 return NULL;
│ │ │ -
678 }
│ │ │ -
679 void free(){}
│ │ │ -
680 };
│ │ │ -
681
│ │ │ -
682 template<class G, class V, class E, class VM, class EM>
│ │ │ -
683 class EdgeFunctor<Dune::Amg::PropertiesGraph<G,V,E,VM,EM> >
│ │ │ -
684 : public BaseEdgeFunctor
│ │ │ -
685 {
│ │ │ -
686 public:
│ │ │ -
687 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std::size_t s)
│ │ │ -
688 : BaseEdgeFunctor(adj, data)
│ │ │ -
689 {
│ │ │ -
690 weight_=new Metis::idx_t[s];
│ │ │ -
691 }
│ │ │ -
692
│ │ │ -
693 template<class T>
│ │ │ -
694 void operator()(const T& edge)
│ │ │ -
695 {
│ │ │ -
696 weight_[index()]=edge.properties().depends() ? 3 : 1;
│ │ │ -
697 BaseEdgeFunctor::operator()(edge);
│ │ │ -
698 }
│ │ │ -
699 Metis::idx_t* getWeights()
│ │ │ -
700 {
│ │ │ -
701 return weight_;
│ │ │ -
702 }
│ │ │ -
703 void free(){
│ │ │ -
704 delete[] weight_;
│ │ │ -
705 weight_ = nullptr;
│ │ │ -
706 }
│ │ │ -
707 private:
│ │ │ -
708 Metis::idx_t* weight_;
│ │ │ -
709 };
│ │ │ -
710
│ │ │ -
711
│ │ │ -
712
│ │ │ -
726 template<class F, class G, class IS, class EW>
│ │ │ -
727 void getAdjArrays(G& graph, IS& indexSet, Metis::idx_t *xadj,
│ │ │ -
728 EW& ew)
│ │ │ -
729 {
│ │ │ -
730 int j=0;
│ │ │ -
731 auto vend = graph.end();
│ │ │ -
732
│ │ │ -
733 for(auto vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ -
734 if (isOwner<F>(indexSet,*vertex)) {
│ │ │ -
735 // The type of const edge iterator.
│ │ │ -
736 auto eend = vertex.end();
│ │ │ -
737 xadj[j] = ew.index();
│ │ │ -
738 j++;
│ │ │ -
739 for(auto edge = vertex.begin(); edge != eend; ++edge) {
│ │ │ -
740 ew(edge);
│ │ │ -
741 }
│ │ │ -
742 }
│ │ │ -
743 }
│ │ │ -
744 xadj[j] = ew.index();
│ │ │ -
745 }
│ │ │ -
746 } // end anonymous namespace
│ │ │ -
747
│ │ │ -
748 template<class G, class T1, class T2>
│ │ │ -
749 bool buildCommunication(const G& graph, std::vector<int>& realparts,
│ │ │ - │ │ │ -
751 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ -
752 RedistributeInterface& redistInf,
│ │ │ -
753 bool verbose=false);
│ │ │ -
754#if HAVE_PARMETIS
│ │ │ -
755#ifndef METIS_VER_MAJOR
│ │ │ -
756 extern "C"
│ │ │ -
757 {
│ │ │ -
758 // backwards compatibility to parmetis < 4.0.0
│ │ │ -
759 void METIS_PartGraphKway(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t *adjncy, Metis::idx_t *vwgt,
│ │ │ -
760 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts,
│ │ │ -
761 int *options, int *edgecut, Metis::idx_t *part);
│ │ │ -
762
│ │ │ -
763 void METIS_PartGraphRecursive(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t *adjncy, Metis::idx_t *vwgt,
│ │ │ -
764 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts,
│ │ │ -
765 int *options, int *edgecut, Metis::idx_t *part);
│ │ │ -
766 }
│ │ │ -
767#endif
│ │ │ -
768#endif // HAVE_PARMETIS
│ │ │ -
769
│ │ │ -
770 template<class S, class T>
│ │ │ -
│ │ │ -
771 inline void print_carray(S& os, T* array, std::size_t l)
│ │ │ -
772 {
│ │ │ -
773 for(T *cur=array, *end=array+l; cur!=end; ++cur)
│ │ │ -
774 os<<*cur<<" ";
│ │ │ -
775 }
│ │ │ -
│ │ │ -
776
│ │ │ -
777 template<class S, class T>
│ │ │ -
│ │ │ -
778 inline bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T* xadj,
│ │ │ -
779 T* adjncy, bool checkSymmetry)
│ │ │ -
780 {
│ │ │ -
781 bool correct=true;
│ │ │ -
782
│ │ │ -
783 using std::signbit;
│ │ │ -
784 for(Metis::idx_t vtx=0; vtx<(Metis::idx_t)noVtx; ++vtx) {
│ │ │ -
785 if(static_cast<S>(xadj[vtx])>noEdges || signbit(xadj[vtx])) {
│ │ │ -
786 std::cerr <<"Check graph: xadj["<<vtx<<"]="<<xadj[vtx]<<" (>"
│ │ │ -
787 <<noEdges<<") out of range!"<<std::endl;
│ │ │ -
788 correct=false;
│ │ │ -
789 }
│ │ │ -
790 if(static_cast<S>(xadj[vtx+1])>noEdges || signbit(xadj[vtx+1])) {
│ │ │ -
791 std::cerr <<"Check graph: xadj["<<vtx+1<<"]="<<xadj[vtx+1]<<" (>"
│ │ │ -
792 <<noEdges<<") out of range!"<<std::endl;
│ │ │ -
793 correct=false;
│ │ │ -
794 }
│ │ │ -
795 // Check numbers in adjncy
│ │ │ -
796 for(Metis::idx_t i=xadj[vtx]; i< xadj[vtx+1]; ++i) {
│ │ │ -
797 if(signbit(adjncy[i]) || ((std::size_t)adjncy[i])>gnoVtx) {
│ │ │ -
798 std::cerr<<" Edge "<<adjncy[i]<<" out of range ["<<0<<","<<noVtx<<")"
│ │ │ -
799 <<std::endl;
│ │ │ -
800 correct=false;
│ │ │ -
801 }
│ │ │ -
802 }
│ │ │ -
803 if(checkSymmetry) {
│ │ │ -
804 for(Metis::idx_t i=xadj[vtx]; i< xadj[vtx+1]; ++i) {
│ │ │ -
805 Metis::idx_t target=adjncy[i];
│ │ │ -
806 // search for symmetric edge
│ │ │ -
807 int found=0;
│ │ │ -
808 for(Metis::idx_t j=xadj[target]; j< xadj[target+1]; ++j)
│ │ │ -
809 if(adjncy[j]==vtx)
│ │ │ -
810 found++;
│ │ │ -
811 if(found!=1) {
│ │ │ -
812 std::cerr<<"Edge ("<<target<<","<<vtx<<") "<<i<<" time"<<std::endl;
│ │ │ -
813 correct=false;
│ │ │ -
814 }
│ │ │ -
815 }
│ │ │ -
816 }
│ │ │ -
817 }
│ │ │ -
818 return correct;
│ │ │ -
819 }
│ │ │ +
448 };
│ │ │ +
│ │ │ +
449
│ │ │ +
│ │ │ +
454 class FirstDiagonal : public Diagonal<0>
│ │ │ +
455 {};
│ │ │
│ │ │ -
820
│ │ │ -
821 template<class M, class T1, class T2>
│ │ │ +
456
│ │ │ +
│ │ │ +
462 struct RowSum
│ │ │ +
463 {
│ │ │ +
464
│ │ │ +
465 enum { /* @brief We preserve the sign.*/
│ │ │ +
466 is_sign_preserving = false
│ │ │ +
467 };
│ │ │ +
472 template<class M>
│ │ │ +
│ │ │ +
473 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ +
474 {
│ │ │ +
475 return m.infinity_norm();
│ │ │ +
476 }
│ │ │ +
│ │ │ +
477 };
│ │ │ +
│ │ │ +
478
│ │ │ +
│ │ │ + │ │ │ +
480 {
│ │ │ +
481
│ │ │ +
482 enum { /* @brief We preserve the sign.*/
│ │ │ +
483 is_sign_preserving = false
│ │ │ +
484 };
│ │ │ +
489 template<class M>
│ │ │ +
│ │ │ +
490 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ +
491 {
│ │ │ +
492 return m.frobenius_norm();
│ │ │ +
493 }
│ │ │ +
│ │ │ +
494 };
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
496 {
│ │ │ +
497
│ │ │ +
498 enum { /* @brief We preserve the sign.*/
│ │ │ +
499 is_sign_preserving = false
│ │ │ +
500 };
│ │ │ +
505 template<class M>
│ │ │ +
│ │ │ +
506 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ +
507 {
│ │ │ +
508 return 1;
│ │ │ +
509 }
│ │ │ +
│ │ │ +
510 };
│ │ │ +
│ │ │ +
517 template<class M, class Norm>
│ │ │ +
│ │ │ +
518 class SymmetricCriterion : public AggregationCriterion<SymmetricDependency<M,Norm> >
│ │ │ +
519 {
│ │ │ +
520 public:
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
523 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
525 {}
│ │ │ +
│ │ │ +
526 };
│ │ │ +
│ │ │ +
527
│ │ │ +
528
│ │ │ +
537 template<class M, class Norm>
│ │ │ +
│ │ │ +
538 class UnSymmetricCriterion : public AggregationCriterion<Dependency<M,Norm> >
│ │ │ +
539 {
│ │ │ +
540 public:
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
543 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
545 {}
│ │ │ +
│ │ │ +
546 };
│ │ │ +
│ │ │ +
547 // forward declaration
│ │ │ +
548 template<class G> class Aggregator;
│ │ │ +
549
│ │ │ +
550
│ │ │ +
558 template<class V>
│ │ │ +
│ │ │ + │ │ │ +
560 {
│ │ │ +
561 public:
│ │ │ +
562
│ │ │ +
566 static const V UNAGGREGATED;
│ │ │ +
567
│ │ │ +
571 static const V ISOLATED;
│ │ │ + │ │ │ +
576
│ │ │ + │ │ │ +
581
│ │ │ +
586 typedef PoolAllocator<VertexDescriptor,100> Allocator;
│ │ │ +
587
│ │ │ +
592 typedef SLList<VertexDescriptor,Allocator> VertexList;
│ │ │ +
593
│ │ │ +
│ │ │ + │ │ │ +
598 {
│ │ │ +
599 public:
│ │ │ +
600 template<class EdgeIterator>
│ │ │ +
│ │ │ +
601 void operator()([[maybe_unused]] const EdgeIterator& edge) const
│ │ │ +
602 {}
│ │ │ +
│ │ │ +
603 };
│ │ │ +
│ │ │ +
604
│ │ │ +
605
│ │ │ + │ │ │ +
610
│ │ │ + │ │ │ +
617
│ │ │ + │ │ │ +
622
│ │ │ +
634 template<class M, class G, class C>
│ │ │ +
635 std::tuple<int,int,int,int> buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ +
636 bool finestLevel);
│ │ │ +
637
│ │ │ +
655 template<bool reset, class G, class F, class VM>
│ │ │ +
656 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ +
657 const AggregateDescriptor& aggregate,
│ │ │ +
658 const G& graph,
│ │ │ +
659 F& aggregateVisitor,
│ │ │ +
660 VM& visitedMap) const;
│ │ │ +
661
│ │ │ +
685 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ +
686 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ +
687 const AggregateDescriptor& aggregate,
│ │ │ +
688 const G& graph, L& visited, F1& aggregateVisitor,
│ │ │ +
689 F2& nonAggregateVisitor,
│ │ │ +
690 VM& visitedMap) const;
│ │ │ +
691
│ │ │ +
697 void allocate(std::size_t noVertices);
│ │ │ +
698
│ │ │ +
702 std::size_t noVertices() const;
│ │ │ +
703
│ │ │ +
707 void free();
│ │ │ +
708
│ │ │ + │ │ │ +
715
│ │ │ + │ │ │ +
722
│ │ │ + │ │ │ +
724
│ │ │ +
│ │ │ + │ │ │ +
726 {
│ │ │ +
727 return aggregates_;
│ │ │ +
728 }
│ │ │ +
│ │ │ +
729
│ │ │ +
│ │ │ + │ │ │ +
731 {
│ │ │ +
732 return aggregates_+noVertices();
│ │ │ +
733 }
│ │ │ +
│ │ │ +
734
│ │ │ + │ │ │ +
736
│ │ │ +
│ │ │ + │ │ │ +
738 {
│ │ │ +
739 return aggregates_;
│ │ │ +
740 }
│ │ │ +
│ │ │ +
741
│ │ │ +
│ │ │ + │ │ │ +
743 {
│ │ │ +
744 return aggregates_+noVertices();
│ │ │ +
745 }
│ │ │ +
│ │ │ +
746 private:
│ │ │ +
748 AggregatesMap(const AggregatesMap<V>&) = delete;
│ │ │ +
750 AggregatesMap<V>& operator=(const AggregatesMap<V>&) = delete;
│ │ │ +
751
│ │ │ +
755 AggregateDescriptor* aggregates_;
│ │ │ +
756
│ │ │ +
760 std::size_t noVertices_;
│ │ │ +
761 };
│ │ │ +
│ │ │ +
762
│ │ │ +
766 template<class G, class C>
│ │ │ +
767 void buildDependency(G& graph,
│ │ │ +
768 const typename C::Matrix& matrix,
│ │ │ +
769 C criterion,
│ │ │ +
770 bool finestLevel);
│ │ │ +
771
│ │ │ +
776 template<class G, class S>
│ │ │ +
│ │ │ + │ │ │ +
778 {
│ │ │ +
779
│ │ │ +
780 public:
│ │ │ +
781
│ │ │ +
782 /***
│ │ │ +
783 * @brief The type of the matrix graph we work with.
│ │ │ +
784 */
│ │ │ +
785 typedef G MatrixGraph;
│ │ │ + │ │ │ +
790
│ │ │ +
795 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ +
796
│ │ │ +
801 typedef S VertexSet;
│ │ │ +
802
│ │ │ +
804 typedef typename VertexSet::const_iterator const_iterator;
│ │ │ +
805
│ │ │ +
809 typedef std::size_t* SphereMap;
│ │ │ +
810
│ │ │ + │ │ │ +
820 VertexSet& connectivity, std::vector<Vertex>& front_);
│ │ │ +
821
│ │ │
│ │ │ - │ │ │ -
823 Metis::idx_t nparts,
│ │ │ -
824 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ -
825 RedistributeInterface& redistInf,
│ │ │ -
826 bool verbose=false)
│ │ │ -
827 {
│ │ │ -
828 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
829 std::cout<<"Repartitioning from "<<oocomm.communicator().size()
│ │ │ -
830 <<" to "<<nparts<<" parts"<<std::endl;
│ │ │ -
831 Timer time;
│ │ │ -
832 int rank = oocomm.communicator().rank();
│ │ │ -
833#if !HAVE_PARMETIS
│ │ │ -
834 int* part = new int[1];
│ │ │ -
835 part[0]=0;
│ │ │ -
836#else
│ │ │ -
837 Metis::idx_t* part = new Metis::idx_t[1]; // where all our data moves to
│ │ │ -
838
│ │ │ -
839 if(nparts>1) {
│ │ │ -
840
│ │ │ -
841 part[0]=rank;
│ │ │ -
842
│ │ │ -
843 { // sublock for automatic memory deletion
│ │ │ + │ │ │ +
823 {
│ │ │ +
824 --id_;
│ │ │ +
825 }
│ │ │ +
│ │ │ +
826
│ │ │ +
833 void reconstruct(const Vertex& vertex);
│ │ │ +
834
│ │ │ +
838 void seed(const Vertex& vertex);
│ │ │ +
839
│ │ │ +
843 void add(const Vertex& vertex);
│ │ │
844
│ │ │ -
845 // Build the graph of the communication scheme and create an appropriate indexset.
│ │ │ -
846 // calculate the neighbour vertices
│ │ │ -
847 int noNeighbours = oocomm.remoteIndices().neighbours();
│ │ │ -
848
│ │ │ -
849 for(auto n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ -
850 ++n)
│ │ │ -
851 if(n->first==rank) {
│ │ │ -
852 //do not include ourselves.
│ │ │ -
853 --noNeighbours;
│ │ │ -
854 break;
│ │ │ -
855 }
│ │ │ -
856
│ │ │ -
857 // A parmetis graph representing the communication graph.
│ │ │ -
858 // The diagonal entries are the number of nodes on the process.
│ │ │ -
859 // The offdiagonal entries are the number of edges leading to other processes.
│ │ │ -
860
│ │ │ -
861 Metis::idx_t *xadj=new Metis::idx_t[2];
│ │ │ -
862 Metis::idx_t *vtxdist=new Metis::idx_t[oocomm.communicator().size()+1];
│ │ │ -
863 Metis::idx_t *adjncy=new Metis::idx_t[noNeighbours];
│ │ │ -
864#ifdef USE_WEIGHTS
│ │ │ -
865 Metis::idx_t *vwgt = 0;
│ │ │ -
866 Metis::idx_t *adjwgt = 0;
│ │ │ -
867#endif
│ │ │ -
868
│ │ │ -
869 // each process has exactly one vertex!
│ │ │ -
870 for(int i=0; i<oocomm.communicator().size(); ++i)
│ │ │ -
871 vtxdist[i]=i;
│ │ │ -
872 vtxdist[oocomm.communicator().size()]=oocomm.communicator().size();
│ │ │ -
873
│ │ │ -
874 xadj[0]=0;
│ │ │ -
875 xadj[1]=noNeighbours;
│ │ │ +
845 void add(std::vector<Vertex>& vertex);
│ │ │ +
849 void clear();
│ │ │ +
850
│ │ │ +
854 typename VertexSet::size_type size();
│ │ │ +
858 typename VertexSet::size_type connectSize();
│ │ │ +
859
│ │ │ +
863 int id();
│ │ │ +
864
│ │ │ + │ │ │ +
867
│ │ │ + │ │ │ +
870
│ │ │ +
871 private:
│ │ │ +
875 VertexSet vertices_;
│ │ │
876
│ │ │ -
877 // count edges to other processor
│ │ │ -
878 // a vector mapping the index to the owner
│ │ │ -
879 // std::vector<int> owner(mat.N(), oocomm.communicator().rank());
│ │ │ -
880 // for(NeighbourIterator n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ -
881 // ++n)
│ │ │ -
882 // {
│ │ │ -
883 // if(n->first!=oocomm.communicator().rank()){
│ │ │ -
884 // typedef typename RemoteIndices::RemoteIndexList RIList;
│ │ │ -
885 // const RIList& rlist = *(n->second.first);
│ │ │ -
886 // typedef typename RIList::const_iterator LIter;
│ │ │ -
887 // for(LIter entry=rlist.begin(); entry!=rlist.end(); ++entry){
│ │ │ -
888 // if(entry->attribute()==OwnerOverlapCopyAttributeSet::owner)
│ │ │ -
889 // owner[entry->localIndexPair().local()] = n->first;
│ │ │ -
890 // }
│ │ │ -
891 // }
│ │ │ -
892 // }
│ │ │ -
893
│ │ │ -
894 // std::map<int,Metis::idx_t> edgecount; // edges to other processors
│ │ │ -
895 // typedef typename M::ConstRowIterator RIter;
│ │ │ -
896 // typedef typename M::ConstColIterator CIter;
│ │ │ +
881 int id_;
│ │ │ +
882
│ │ │ +
886 MatrixGraph& graph_;
│ │ │ +
887
│ │ │ +
891 AggregatesMap<Vertex>& aggregates_;
│ │ │ +
892
│ │ │ +
896 VertexSet& connected_;
│ │ │
897
│ │ │ -
898 // // calculate edge count
│ │ │ -
899 // for(RIter row=mat.begin(), endr=mat.end(); row != endr; ++row)
│ │ │ -
900 // if(owner[row.index()]==OwnerOverlapCopyAttributeSet::owner)
│ │ │ -
901 // for(CIter entry= row->begin(), end = row->end(); entry != end; ++entry)
│ │ │ -
902 // ++edgecount[owner[entry.index()]];
│ │ │ +
901 std::vector<Vertex>& front_;
│ │ │ +
902 };
│ │ │ +
│ │ │
903
│ │ │ -
904 // setup edge and weight pattern
│ │ │ -
905
│ │ │ -
906 Metis::idx_t* adjp=adjncy;
│ │ │ -
907
│ │ │ -
908#ifdef USE_WEIGHTS
│ │ │ -
909 vwgt = new Metis::idx_t[1];
│ │ │ -
910 vwgt[0]= mat.N(); // weight is number of rows TODO: Should actually be the nonzeros.
│ │ │ +
907 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
909 {
│ │ │ +
910 public:
│ │ │
911
│ │ │ -
912 adjwgt = new Metis::idx_t[noNeighbours];
│ │ │ -
913 Metis::idx_t* adjwp=adjwgt;
│ │ │ -
914#endif
│ │ │ -
915
│ │ │ -
916 for(auto n= oocomm.remoteIndices().begin(); n != oocomm.remoteIndices().end();
│ │ │ -
917 ++n)
│ │ │ -
918 if(n->first != rank) {
│ │ │ -
919 *adjp=n->first;
│ │ │ -
920 ++adjp;
│ │ │ -
921#ifdef USE_WEIGHTS
│ │ │ -
922 *adjwp=1; //edgecount[n->first];
│ │ │ -
923 ++adjwp;
│ │ │ -
924#endif
│ │ │ -
925 }
│ │ │ -
926 assert(isValidGraph(vtxdist[rank+1]-vtxdist[rank],
│ │ │ -
927 vtxdist[oocomm.communicator().size()],
│ │ │ -
928 noNeighbours, xadj, adjncy, false));
│ │ │ +
915 typedef G MatrixGraph;
│ │ │ +
916
│ │ │ + │ │ │ +
921
│ │ │ + │ │ │ +
924
│ │ │ + │ │ │
929
│ │ │ -
930 [[maybe_unused]] Metis::idx_t wgtflag=0;
│ │ │ -
931 Metis::idx_t numflag=0;
│ │ │ -
932 Metis::idx_t edgecut;
│ │ │ -
933#ifdef USE_WEIGHTS
│ │ │ -
934 wgtflag=3;
│ │ │ -
935#endif
│ │ │ -
936 Metis::real_t *tpwgts = new Metis::real_t[nparts];
│ │ │ -
937 for(int i=0; i<nparts; ++i)
│ │ │ -
938 tpwgts[i]=1.0/nparts;
│ │ │ -
939 MPI_Comm comm=oocomm.communicator();
│ │ │ -
940
│ │ │ -
941 Dune::dinfo<<rank<<" vtxdist: ";
│ │ │ -
942 print_carray(Dune::dinfo, vtxdist, oocomm.communicator().size()+1);
│ │ │ -
943 Dune::dinfo<<std::endl<<rank<<" xadj: ";
│ │ │ -
944 print_carray(Dune::dinfo, xadj, 2);
│ │ │ -
945 Dune::dinfo<<std::endl<<rank<<" adjncy: ";
│ │ │ -
946 print_carray(Dune::dinfo, adjncy, noNeighbours);
│ │ │ -
947
│ │ │ -
948#ifdef USE_WEIGHTS
│ │ │ -
949 Dune::dinfo<<std::endl<<rank<<" vwgt: ";
│ │ │ -
950 print_carray(Dune::dinfo, vwgt, 1);
│ │ │ -
951 Dune::dinfo<<std::endl<<rank<<" adwgt: ";
│ │ │ -
952 print_carray(Dune::dinfo, adjwgt, noNeighbours);
│ │ │ -
953#endif
│ │ │ -
954 Dune::dinfo<<std::endl;
│ │ │ -
955 oocomm.communicator().barrier();
│ │ │ -
956 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
957 std::cout<<"Creating comm graph took "<<time.elapsed()<<std::endl;
│ │ │ -
958 time.reset();
│ │ │ -
959
│ │ │ -
960#ifdef PARALLEL_PARTITION
│ │ │ -
961 Metis::real_t ubvec = 1.15;
│ │ │ -
962 int ncon=1;
│ │ │ -
963 int options[5] ={ 0,1,15,0,0};
│ │ │ -
964
│ │ │ -
965 //=======================================================
│ │ │ -
966 // ParMETIS_V3_PartKway
│ │ │ -
967 //=======================================================
│ │ │ -
968 ParMETIS_V3_PartKway(vtxdist, xadj, adjncy,
│ │ │ -
969 vwgt, adjwgt, &wgtflag,
│ │ │ -
970 &numflag, &ncon, &nparts, tpwgts, &ubvec, options, &edgecut, part,
│ │ │ -
971 &comm);
│ │ │ -
972 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
973 std::cout<<"ParMETIS took "<<time.elapsed()<<std::endl;
│ │ │ -
974 time.reset();
│ │ │ -
975#else
│ │ │ -
976 Timer time1;
│ │ │ -
977 std::size_t gnoedges=0;
│ │ │ -
978 int* noedges = 0;
│ │ │ -
979 noedges = new int[oocomm.communicator().size()];
│ │ │ -
980 Dune::dverb<<"noNeighbours: "<<noNeighbours<<std::endl;
│ │ │ -
981 // gather number of edges for each vertex.
│ │ │ -
982 MPI_Allgather(&noNeighbours,1,MPI_INT,noedges,1, MPI_INT,oocomm.communicator());
│ │ │ -
983
│ │ │ -
984 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
985 std::cout<<"Gathering noedges took "<<time1.elapsed()<<std::endl;
│ │ │ -
986 time1.reset();
│ │ │ -
987
│ │ │ -
988 Metis::idx_t noVertices = vtxdist[oocomm.communicator().size()];
│ │ │ -
989 Metis::idx_t *gxadj = 0;
│ │ │ -
990 Metis::idx_t *gvwgt = 0;
│ │ │ -
991 Metis::idx_t *gadjncy = 0;
│ │ │ -
992 Metis::idx_t *gadjwgt = 0;
│ │ │ -
993 Metis::idx_t *gpart = 0;
│ │ │ -
994 int* displ = 0;
│ │ │ -
995 int* noxs = 0;
│ │ │ -
996 int* xdispl = 0; // displacement for xadj
│ │ │ -
997 int* novs = 0;
│ │ │ -
998 int* vdispl=0; // real vertex displacement
│ │ │ -
999#ifdef USE_WEIGHTS
│ │ │ -
1000 std::size_t localNoVtx=vtxdist[rank+1]-vtxdist[rank];
│ │ │ -
1001#endif
│ │ │ -
1002 std::size_t gxadjlen = vtxdist[oocomm.communicator().size()]-vtxdist[0]+oocomm.communicator().size();
│ │ │ -
1003
│ │ │ -
1004 {
│ │ │ -
1005 Dune::dinfo<<"noedges: ";
│ │ │ -
1006 print_carray(Dune::dinfo, noedges, oocomm.communicator().size());
│ │ │ -
1007 Dune::dinfo<<std::endl;
│ │ │ -
1008 displ = new int[oocomm.communicator().size()];
│ │ │ -
1009 xdispl = new int[oocomm.communicator().size()];
│ │ │ -
1010 noxs = new int[oocomm.communicator().size()];
│ │ │ -
1011 vdispl = new int[oocomm.communicator().size()];
│ │ │ -
1012 novs = new int[oocomm.communicator().size()];
│ │ │ -
1013
│ │ │ -
1014 for(int i=0; i < oocomm.communicator().size(); ++i) {
│ │ │ -
1015 noxs[i]=vtxdist[i+1]-vtxdist[i]+1;
│ │ │ -
1016 novs[i]=vtxdist[i+1]-vtxdist[i];
│ │ │ -
1017 }
│ │ │ -
1018
│ │ │ -
1019 Metis::idx_t *so= vtxdist;
│ │ │ -
1020 int offset = 0;
│ │ │ -
1021 for(int *xcurr = xdispl, *vcurr = vdispl, *end=vdispl+oocomm.communicator().size();
│ │ │ -
1022 vcurr!=end; ++vcurr, ++xcurr, ++so, ++offset) {
│ │ │ -
1023 *vcurr = *so;
│ │ │ -
1024 *xcurr = offset + *so;
│ │ │ -
1025 }
│ │ │ -
1026
│ │ │ -
1027 int *pdispl =displ;
│ │ │ -
1028 int cdispl = 0;
│ │ │ -
1029 *pdispl = 0;
│ │ │ -
1030 for(int *curr=noedges, *end=noedges+oocomm.communicator().size()-1;
│ │ │ -
1031 curr!=end; ++curr) {
│ │ │ -
1032 ++pdispl; // next displacement
│ │ │ -
1033 cdispl += *curr; // next value
│ │ │ -
1034 *pdispl = cdispl;
│ │ │ -
1035 }
│ │ │ -
1036 Dune::dinfo<<"displ: ";
│ │ │ -
1037 print_carray(Dune::dinfo, displ, oocomm.communicator().size());
│ │ │ -
1038 Dune::dinfo<<std::endl;
│ │ │ -
1039
│ │ │ -
1040 // calculate global number of edges
│ │ │ -
1041 // It is bigger than the actual one as we habe size-1 additional end entries
│ │ │ -
1042 for(int *curr=noedges, *end=noedges+oocomm.communicator().size();
│ │ │ -
1043 curr!=end; ++curr)
│ │ │ -
1044 gnoedges += *curr;
│ │ │ -
1045
│ │ │ -
1046 // allocate global graph
│ │ │ -
1047 Dune::dinfo<<"gxadjlen: "<<gxadjlen<<" noVertices: "<<noVertices
│ │ │ -
1048 <<" gnoedges: "<<gnoedges<<std::endl;
│ │ │ -
1049 gxadj = new Metis::idx_t[gxadjlen];
│ │ │ -
1050 gpart = new Metis::idx_t[noVertices];
│ │ │ -
1051#ifdef USE_WEIGHTS
│ │ │ -
1052 gvwgt = new Metis::idx_t[noVertices];
│ │ │ -
1053 gadjwgt = new Metis::idx_t[gnoedges];
│ │ │ -
1054#endif
│ │ │ -
1055 gadjncy = new Metis::idx_t[gnoedges];
│ │ │ -
1056 }
│ │ │ -
1057
│ │ │ -
1058 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1059 std::cout<<"Preparing global graph took "<<time1.elapsed()<<std::endl;
│ │ │ -
1060 time1.reset();
│ │ │ -
1061 // Communicate data
│ │ │ -
1062
│ │ │ -
1063 MPI_Allgatherv(xadj,2,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1064 gxadj,noxs,xdispl,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1065 comm);
│ │ │ -
1066 MPI_Allgatherv(adjncy,noNeighbours,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1067 gadjncy,noedges,displ,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1068 comm);
│ │ │ -
1069#ifdef USE_WEIGHTS
│ │ │ -
1070 MPI_Allgatherv(adjwgt,noNeighbours,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1071 gadjwgt,noedges,displ,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1072 comm);
│ │ │ -
1073 MPI_Allgatherv(vwgt,localNoVtx,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1074 gvwgt,novs,vdispl,MPITraits<Metis::idx_t>::getType(),
│ │ │ -
1075 comm);
│ │ │ -
1076#endif
│ │ │ -
1077 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1078 std::cout<<"Gathering global graph data took "<<time1.elapsed()<<std::endl;
│ │ │ -
1079 time1.reset();
│ │ │ -
1080
│ │ │ -
1081 {
│ │ │ -
1082 // create the real gxadj array
│ │ │ -
1083 // i.e. shift entries and add displacements.
│ │ │ -
1084
│ │ │ -
1085 print_carray(Dune::dinfo, gxadj, gxadjlen);
│ │ │ -
1086
│ │ │ -
1087 int offset = 0;
│ │ │ -
1088 Metis::idx_t increment = vtxdist[1];
│ │ │ -
1089 Metis::idx_t *start=gxadj+1;
│ │ │ -
1090 for(int i=1; i<oocomm.communicator().size(); ++i) {
│ │ │ -
1091 offset+=1;
│ │ │ -
1092 int lprev = vtxdist[i]-vtxdist[i-1];
│ │ │ -
1093 int l = vtxdist[i+1]-vtxdist[i];
│ │ │ -
1094 start+=lprev;
│ │ │ -
1095 assert((start+l+offset)-gxadj<=static_cast<Metis::idx_t>(gxadjlen));
│ │ │ -
1096 increment = *(start-1);
│ │ │ -
1097 std::transform(start+offset, start+l+offset, start, std::bind(std::plus<Metis::idx_t>(), std::placeholders::_1, increment));
│ │ │ -
1098 }
│ │ │ -
1099 Dune::dinfo<<std::endl<<"shifted xadj:";
│ │ │ -
1100 print_carray(Dune::dinfo, gxadj, noVertices+1);
│ │ │ -
1101 Dune::dinfo<<std::endl<<" gadjncy: ";
│ │ │ -
1102 print_carray(Dune::dinfo, gadjncy, gnoedges);
│ │ │ -
1103#ifdef USE_WEIGHTS
│ │ │ -
1104 Dune::dinfo<<std::endl<<" gvwgt: ";
│ │ │ -
1105 print_carray(Dune::dinfo, gvwgt, noVertices);
│ │ │ -
1106 Dune::dinfo<<std::endl<<"adjwgt: ";
│ │ │ -
1107 print_carray(Dune::dinfo, gadjwgt, gnoedges);
│ │ │ -
1108 Dune::dinfo<<std::endl;
│ │ │ -
1109#endif
│ │ │ -
1110 // everything should be fine now!!!
│ │ │ -
1111 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1112 std::cout<<"Postprocessing global graph data took "<<time1.elapsed()<<std::endl;
│ │ │ -
1113 time1.reset();
│ │ │ -
1114#ifndef NDEBUG
│ │ │ -
1115 assert(isValidGraph(noVertices, noVertices, gnoedges,
│ │ │ -
1116 gxadj, gadjncy, true));
│ │ │ -
1117#endif
│ │ │ -
1118
│ │ │ -
1119 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1120 std::cout<<"Creating grah one 1 process took "<<time.elapsed()<<std::endl;
│ │ │ -
1121 time.reset();
│ │ │ -
1122#if METIS_VER_MAJOR >= 5
│ │ │ -
1123 Metis::idx_t ncon = 1;
│ │ │ -
1124 Metis::idx_t moptions[METIS_NOPTIONS];
│ │ │ -
1125 METIS_SetDefaultOptions(moptions);
│ │ │ -
1126 moptions[METIS_OPTION_NUMBERING] = numflag;
│ │ │ -
1127 METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, gadjwgt,
│ │ │ -
1128 &nparts, NULL, NULL, moptions, &edgecut, gpart);
│ │ │ -
1129#else
│ │ │ -
1130 int options[5] = {0, 1, 1, 3, 3};
│ │ │ -
1131 // Call metis
│ │ │ -
1132 METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, &wgtflag,
│ │ │ -
1133 &numflag, &nparts, options, &edgecut, gpart);
│ │ │ -
1134#endif
│ │ │ -
1135
│ │ │ -
1136 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1137 std::cout<<"METIS took "<<time.elapsed()<<std::endl;
│ │ │ -
1138 time.reset();
│ │ │ -
1139
│ │ │ -
1140 Dune::dinfo<<std::endl<<"part:";
│ │ │ -
1141 print_carray(Dune::dinfo, gpart, noVertices);
│ │ │ -
1142
│ │ │ -
1143 delete[] gxadj;
│ │ │ -
1144 delete[] gadjncy;
│ │ │ -
1145#ifdef USE_WEIGHTS
│ │ │ -
1146 delete[] gvwgt;
│ │ │ -
1147 delete[] gadjwgt;
│ │ │ -
1148#endif
│ │ │ -
1149 }
│ │ │ -
1150 // Scatter result
│ │ │ -
1151 MPI_Scatter(gpart, 1, MPITraits<Metis::idx_t>::getType(), part, 1,
│ │ │ -
1152 MPITraits<Metis::idx_t>::getType(), 0, comm);
│ │ │ -
1153
│ │ │ -
1154 {
│ │ │ -
1155 // release remaining memory
│ │ │ -
1156 delete[] gpart;
│ │ │ -
1157 delete[] noedges;
│ │ │ -
1158 delete[] displ;
│ │ │ -
1159 }
│ │ │ -
1160
│ │ │ + │ │ │ +
934
│ │ │ +
951 template<class M, class C>
│ │ │ +
952 std::tuple<int,int,int,int> build(const M& m, G& graph,
│ │ │ +
953 AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ +
954 bool finestLevel);
│ │ │ +
955 private:
│ │ │ +
960 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ +
961
│ │ │ +
965 typedef SLList<Vertex,Allocator> VertexList;
│ │ │ +
966
│ │ │ +
970 typedef std::set<Vertex,std::less<Vertex>,Allocator> VertexSet;
│ │ │ +
971
│ │ │ +
975 typedef std::size_t* SphereMap;
│ │ │ +
976
│ │ │ +
980 MatrixGraph* graph_;
│ │ │ +
981
│ │ │ + │ │ │ +
986
│ │ │ +
990 std::vector<Vertex> front_;
│ │ │ +
991
│ │ │ +
995 VertexSet connected_;
│ │ │ +
996
│ │ │ +
1000 int size_;
│ │ │ +
1001
│ │ │ +
1005 class Stack
│ │ │ +
1006 {
│ │ │ +
1007 public:
│ │ │ +
1008 static const Vertex NullEntry;
│ │ │ +
1009
│ │ │ +
1010 Stack(const MatrixGraph& graph,
│ │ │ +
1011 const Aggregator<G>& aggregatesBuilder,
│ │ │ +
1012 const AggregatesMap<Vertex>& aggregates);
│ │ │ + │ │ │ + │ │ │ +
1015 private:
│ │ │ +
1016 enum { N = 1300000 };
│ │ │ +
1017
│ │ │ +
1019 const MatrixGraph& graph_;
│ │ │ +
1021 const Aggregator<G>& aggregatesBuilder_;
│ │ │ +
1023 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
1025 int size_;
│ │ │ +
1026 Vertex maxSize_;
│ │ │ +
1028 typename MatrixGraph::ConstVertexIterator begin_;
│ │ │ + │ │ │ +
1030
│ │ │ +
1032 Vertex* vals_;
│ │ │ +
1033
│ │ │ +
1034 };
│ │ │ +
1035
│ │ │ +
1036 friend class Stack;
│ │ │ +
1037
│ │ │ +
1048 template<class V>
│ │ │ +
1049 void visitAggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1050 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1051 V& visitor) const;
│ │ │ +
1052
│ │ │ +
1057 template<class V>
│ │ │ +
1058 class AggregateVisitor
│ │ │ +
1059 {
│ │ │ +
1060 public:
│ │ │ +
1064 typedef V Visitor;
│ │ │ + │ │ │ +
1073 Visitor& visitor);
│ │ │ +
1074
│ │ │ +
1081 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1082
│ │ │ +
1083 private:
│ │ │ +
1085 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
1087 AggregateDescriptor aggregate_;
│ │ │ +
1089 Visitor* visitor_;
│ │ │ +
1090 };
│ │ │ +
1091
│ │ │ +
1095 class Counter
│ │ │ +
1096 {
│ │ │ +
1097 public:
│ │ │ + │ │ │ +
1101 int value();
│ │ │ +
1102
│ │ │ +
1103 protected:
│ │ │ + │ │ │ + │ │ │ +
1108
│ │ │ +
1109 private:
│ │ │ +
1110 int count_;
│ │ │ +
1111 };
│ │ │ +
1112
│ │ │ +
1113
│ │ │ +
1118 class FrontNeighbourCounter : public Counter
│ │ │ +
1119 {
│ │ │ +
1120 public:
│ │ │ + │ │ │ +
1126
│ │ │ +
1127 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1128
│ │ │ +
1129 private:
│ │ │ +
1130 const MatrixGraph& graph_;
│ │ │ +
1131 };
│ │ │ +
1132
│ │ │ +
1137 int noFrontNeighbours(const Vertex& vertex) const;
│ │ │ +
1138
│ │ │ +
1142 class TwoWayCounter : public Counter
│ │ │ +
1143 {
│ │ │ +
1144 public:
│ │ │ +
1145 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1146 };
│ │ │ +
1147
│ │ │ +
1159 int twoWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ +
1160 const AggregatesMap<Vertex>& aggregates) const;
│ │ │
1161
│ │ │ -
1162#endif
│ │ │ -
1163 delete[] xadj;
│ │ │ -
1164 delete[] vtxdist;
│ │ │ -
1165 delete[] adjncy;
│ │ │ -
1166#ifdef USE_WEIGHTS
│ │ │ -
1167 delete[] vwgt;
│ │ │ -
1168 delete[] adjwgt;
│ │ │ -
1169#endif
│ │ │ -
1170 delete[] tpwgts;
│ │ │ -
1171 }
│ │ │ -
1172 }else{
│ │ │ -
1173 part[0]=0;
│ │ │ -
1174 }
│ │ │ -
1175#endif
│ │ │ -
1176 Dune::dinfo<<" repart "<<rank <<" -> "<< part[0]<<std::endl;
│ │ │ -
1177
│ │ │ -
1178 std::vector<int> realpart(mat.N(), part[0]);
│ │ │ -
1179 delete[] part;
│ │ │ -
1180
│ │ │ -
1181 oocomm.copyOwnerToAll(realpart, realpart);
│ │ │ -
1182
│ │ │ -
1183 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1184 std::cout<<"Scattering repartitioning took "<<time.elapsed()<<std::endl;
│ │ │ -
1185 time.reset();
│ │ │ -
1186
│ │ │ -
1187
│ │ │ -
1188 oocomm.buildGlobalLookup(mat.N());
│ │ │ -
1189 Dune::Amg::MatrixGraph<M> graph(const_cast<M&>(mat));
│ │ │ -
1190 fillIndexSetHoles(graph, oocomm);
│ │ │ -
1191 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1192 std::cout<<"Filling index set took "<<time.elapsed()<<std::endl;
│ │ │ -
1193 time.reset();
│ │ │ -
1194
│ │ │ -
1195 if(verbose) {
│ │ │ -
1196 int noNeighbours=oocomm.remoteIndices().neighbours();
│ │ │ -
1197 noNeighbours = oocomm.communicator().sum(noNeighbours)
│ │ │ -
1198 / oocomm.communicator().size();
│ │ │ -
1199 if(oocomm.communicator().rank()==0)
│ │ │ -
1200 std::cout<<"Average no neighbours was "<<noNeighbours<<std::endl;
│ │ │ -
1201 }
│ │ │ -
1202 bool ret = buildCommunication(graph, realpart, oocomm, outcomm, redistInf,
│ │ │ -
1203 verbose);
│ │ │ -
1204 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1205 std::cout<<"Building index sets took "<<time.elapsed()<<std::endl;
│ │ │ -
1206 time.reset();
│ │ │ -
1207
│ │ │ -
1208
│ │ │ -
1209 return ret;
│ │ │ -
1210
│ │ │ -
1211 }
│ │ │ -
│ │ │ -
1212
│ │ │ -
1227 template<class G, class T1, class T2>
│ │ │ -
│ │ │ - │ │ │ -
1229 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ -
1230 RedistributeInterface& redistInf,
│ │ │ -
1231 bool verbose=false)
│ │ │ -
1232 {
│ │ │ -
1233 Timer time;
│ │ │ -
1234
│ │ │ -
1235 MPI_Comm comm=oocomm.communicator();
│ │ │ -
1236 oocomm.buildGlobalLookup(graph.noVertices());
│ │ │ -
1237 fillIndexSetHoles(graph, oocomm);
│ │ │ -
1238
│ │ │ -
1239 if(verbose && oocomm.communicator().rank()==0)
│ │ │ -
1240 std::cout<<"Filling holes took "<<time.elapsed()<<std::endl;
│ │ │ -
1241 time.reset();
│ │ │ -
1242
│ │ │ -
1243 // simple precondition checks
│ │ │ -
1244
│ │ │ -
1245#ifdef PERF_REPART
│ │ │ -
1246 // Profiling variables
│ │ │ -
1247 double t1=0.0, t2=0.0, t3=0.0, t4=0.0, tSum=0.0;
│ │ │ -
1248#endif
│ │ │ -
1249
│ │ │ -
1250
│ │ │ -
1251 // MPI variables
│ │ │ -
1252 int mype = oocomm.communicator().rank();
│ │ │ -
1253
│ │ │ -
1254 assert(nparts<=static_cast<Metis::idx_t>(oocomm.communicator().size()));
│ │ │ -
1255
│ │ │ -
1256 int myDomain = -1;
│ │ │ -
1257
│ │ │ -
1258 //
│ │ │ -
1259 // 1) Prepare the required parameters for using ParMETIS
│ │ │ -
1260 // Especially the arrays that represent the graph must be
│ │ │ -
1261 // generated by the DUNE Graph and IndexSet input variables.
│ │ │ -
1262 // These are the arrays:
│ │ │ -
1263 // - vtxdist
│ │ │ -
1264 // - xadj
│ │ │ -
1265 // - adjncy
│ │ │ -
1266 //
│ │ │ -
1267 //
│ │ │ -
1268#ifdef PERF_REPART
│ │ │ -
1269 // reset timer for step 1)
│ │ │ -
1270 t1=MPI_Wtime();
│ │ │ -
1271#endif
│ │ │ -
1272
│ │ │ -
1273
│ │ │ -
1274 typedef typename Dune::OwnerOverlapCopyCommunication<T1,T2> OOComm;
│ │ │ -
1275 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ -
1276
│ │ │ -
1277 // Create the vtxdist array and parmetisVtxMapping.
│ │ │ -
1278 // Global communications are necessary
│ │ │ -
1279 // The parmetis global identifiers for the owner vertices.
│ │ │ -
1280 ParmetisDuneIndexMap indexMap(graph,oocomm);
│ │ │ -
1281 Metis::idx_t *part = new Metis::idx_t[indexMap.numOfOwnVtx()];
│ │ │ -
1282 for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i)
│ │ │ -
1283 part[i]=mype;
│ │ │ -
1284
│ │ │ -
1285#if !HAVE_PARMETIS
│ │ │ -
1286 if(oocomm.communicator().rank()==0 && nparts>1)
│ │ │ -
1287 std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead of requested "
│ │ │ -
1288 <<nparts<<" domains."<<std::endl;
│ │ │ -
1289 nparts=1; // No parmetis available, fallback to agglomerating to 1 process
│ │ │ -
1290
│ │ │ -
1291#else
│ │ │ +
1165 class OneWayCounter : public Counter
│ │ │ +
1166 {
│ │ │ +
1167 public:
│ │ │ +
1168 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1169 };
│ │ │ +
1170
│ │ │ +
1182 int oneWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ +
1183 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1184
│ │ │ +
1191 class ConnectivityCounter : public Counter
│ │ │ +
1192 {
│ │ │ +
1193 public:
│ │ │ +
1200 ConnectivityCounter(const VertexSet& connected, const AggregatesMap<Vertex>& aggregates);
│ │ │ +
1201
│ │ │ +
1202 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1203
│ │ │ +
1204 private:
│ │ │ +
1206 const VertexSet& connected_;
│ │ │ +
1208 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
1209
│ │ │ +
1210 };
│ │ │ +
1211
│ │ │ +
1223 double connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1231 bool connected(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1232 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1233
│ │ │ +
1241 bool connected(const Vertex& vertex, const SLList<AggregateDescriptor>& aggregateList,
│ │ │ +
1242 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1243
│ │ │ +
1251 class DependencyCounter : public Counter
│ │ │ +
1252 {
│ │ │ +
1253 public:
│ │ │ + │ │ │ +
1258
│ │ │ +
1259 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1260 };
│ │ │ +
1261
│ │ │ +
1268 class FrontMarker
│ │ │ +
1269 {
│ │ │ +
1270 public:
│ │ │ +
1277 FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph);
│ │ │ +
1278
│ │ │ +
1279 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1280
│ │ │ +
1281 private:
│ │ │ +
1283 std::vector<Vertex>& front_;
│ │ │ +
1285 MatrixGraph& graph_;
│ │ │ +
1286 };
│ │ │ +
1287
│ │ │ +
1291 void unmarkFront();
│ │ │
1292
│ │ │ -
1293 if(nparts>1) {
│ │ │ -
1294 // Create the xadj and adjncy arrays
│ │ │ -
1295 Metis::idx_t *xadj = new Metis::idx_t[indexMap.numOfOwnVtx()+1];
│ │ │ -
1296 Metis::idx_t *adjncy = new Metis::idx_t[graph.noEdges()];
│ │ │ -
1297 EdgeFunctor<G> ef(adjncy, indexMap, graph.noEdges());
│ │ │ -
1298 getAdjArrays<OwnerSet>(graph, oocomm.globalLookup(), xadj, ef);
│ │ │ -
1299
│ │ │ -
1300 //
│ │ │ -
1301 // 2) Call ParMETIS
│ │ │ -
1302 //
│ │ │ -
1303 //
│ │ │ -
1304 Metis::idx_t numflag=0, wgtflag=0, options[3], edgecut=0, ncon=1;
│ │ │ -
1305 //float *tpwgts = NULL;
│ │ │ -
1306 Metis::real_t *tpwgts = new Metis::real_t[nparts];
│ │ │ -
1307 for(int i=0; i<nparts; ++i)
│ │ │ -
1308 tpwgts[i]=1.0/nparts;
│ │ │ -
1309 Metis::real_t ubvec[1];
│ │ │ -
1310 options[0] = 0; // 0=default, 1=options are defined in [1]+[2]
│ │ │ -
1311#ifdef DEBUG_REPART
│ │ │ -
1312 options[1] = 3; // show info: 0=no message
│ │ │ -
1313#else
│ │ │ -
1314 options[1] = 0; // show info: 0=no message
│ │ │ -
1315#endif
│ │ │ -
1316 options[2] = 1; // random number seed, default is 15
│ │ │ -
1317 wgtflag = (ef.getWeights()!=NULL) ? 1 : 0;
│ │ │ -
1318 numflag = 0;
│ │ │ -
1319 edgecut = 0;
│ │ │ -
1320 ncon=1;
│ │ │ -
1321 ubvec[0]=1.05; // recommended by ParMETIS
│ │ │ -
1322
│ │ │ -
1323#ifdef DEBUG_REPART
│ │ │ -
1324 if (mype == 0) {
│ │ │ -
1325 std::cout<<std::endl;
│ │ │ -
1326 std::cout<<"Testing ParMETIS_V3_PartKway with options[1-2] = {"
│ │ │ -
1327 <<options[1]<<" "<<options[2]<<"}, Ncon: "
│ │ │ -
1328 <<ncon<<", Nparts: "<<nparts<<std::endl;
│ │ │ -
1329 }
│ │ │ -
1330#endif
│ │ │ -
1331#ifdef PERF_REPART
│ │ │ -
1332 // stop the time for step 1)
│ │ │ -
1333 t1=MPI_Wtime()-t1;
│ │ │ -
1334 // reset timer for step 2)
│ │ │ -
1335 t2=MPI_Wtime();
│ │ │ -
1336#endif
│ │ │ -
1337
│ │ │ -
1338 if(verbose) {
│ │ │ -
1339 oocomm.communicator().barrier();
│ │ │ -
1340 if(oocomm.communicator().rank()==0)
│ │ │ -
1341 std::cout<<"Preparing for parmetis took "<<time.elapsed()<<std::endl;
│ │ │ -
1342 }
│ │ │ -
1343 time.reset();
│ │ │ -
1344
│ │ │ -
1345 //=======================================================
│ │ │ -
1346 // ParMETIS_V3_PartKway
│ │ │ -
1347 //=======================================================
│ │ │ -
1348 ParMETIS_V3_PartKway(indexMap.vtxDist(), xadj, adjncy,
│ │ │ -
1349 NULL, ef.getWeights(), &wgtflag,
│ │ │ -
1350 &numflag, &ncon, &nparts, tpwgts, ubvec, options, &edgecut, part, &const_cast<MPI_Comm&>(comm));
│ │ │ +
1307 int unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1308
│ │ │ +
1322 std::pair<int,int> neighbours(const Vertex& vertex,
│ │ │ +
1323 const AggregateDescriptor& aggregate,
│ │ │ +
1324 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1341 int aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1342
│ │ │ +
1350 bool admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │
1351
│ │ │ -
1352
│ │ │ -
1353 delete[] xadj;
│ │ │ -
1354 delete[] adjncy;
│ │ │ -
1355 delete[] tpwgts;
│ │ │ -
1356
│ │ │ -
1357 ef.free();
│ │ │ -
1358
│ │ │ -
1359#ifdef DEBUG_REPART
│ │ │ -
1360 if (mype == 0) {
│ │ │ -
1361 std::cout<<std::endl;
│ │ │ -
1362 std::cout<<"ParMETIS_V3_PartKway reported a cut of "<<edgecut<<std::endl;
│ │ │ -
1363 std::cout<<std::endl;
│ │ │ -
1364 }
│ │ │ -
1365 std::cout<<mype<<": PARMETIS-Result: ";
│ │ │ -
1366 for(int i=0; i < indexMap.vtxDist()[mype+1]-indexMap.vtxDist()[mype]; ++i) {
│ │ │ -
1367 std::cout<<part[i]<<" ";
│ │ │ -
1368 }
│ │ │ -
1369 std::cout<<std::endl;
│ │ │ -
1370 std::cout<<"Testing ParMETIS_V3_PartKway with options[1-2] = {"
│ │ │ -
1371 <<options[1]<<" "<<options[2]<<"}, Ncon: "
│ │ │ -
1372 <<ncon<<", Nparts: "<<nparts<<std::endl;
│ │ │ -
1373#endif
│ │ │ -
1374#ifdef PERF_REPART
│ │ │ -
1375 // stop the time for step 2)
│ │ │ -
1376 t2=MPI_Wtime()-t2;
│ │ │ -
1377 // reset timer for step 3)
│ │ │ -
1378 t3=MPI_Wtime();
│ │ │ -
1379#endif
│ │ │ -
1380
│ │ │ -
1381
│ │ │ -
1382 if(verbose) {
│ │ │ -
1383 oocomm.communicator().barrier();
│ │ │ -
1384 if(oocomm.communicator().rank()==0)
│ │ │ -
1385 std::cout<<"Parmetis took "<<time.elapsed()<<std::endl;
│ │ │ -
1386 }
│ │ │ -
1387 time.reset();
│ │ │ -
1388 }else
│ │ │ -
1389#endif
│ │ │ -
1390 {
│ │ │ -
1391 // Everything goes to process 0!
│ │ │ -
1392 for(std::size_t i=0; i<indexMap.numOfOwnVtx(); ++i)
│ │ │ -
1393 part[i]=0;
│ │ │ -
1394 }
│ │ │ -
1395
│ │ │ -
1396
│ │ │ -
1397 //
│ │ │ -
1398 // 3) Find a optimal domain based on the ParMETIS repartitioning
│ │ │ -
1399 // result
│ │ │ -
1400 //
│ │ │ -
1401
│ │ │ -
1402 std::vector<int> domainMapping(nparts);
│ │ │ -
1403 if(nparts>1)
│ │ │ -
1404 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, domainMapping);
│ │ │ -
1405 else
│ │ │ -
1406 domainMapping[0]=0;
│ │ │ -
1407
│ │ │ -
1408#ifdef DEBUG_REPART
│ │ │ -
1409 std::cout<<mype<<": myDomain: "<<myDomain<<std::endl;
│ │ │ -
1410 std::cout<<mype<<": DomainMapping: ";
│ │ │ -
1411 for(auto j : range(nparts)) {
│ │ │ -
1412 std::cout<<" do: "<<j<<" pe: "<<domainMapping[j]<<" ";
│ │ │ -
1413 }
│ │ │ -
1414 std::cout<<std::endl;
│ │ │ -
1415#endif
│ │ │ -
1416
│ │ │ -
1417 // Make a domain mapping for the indexset and translate
│ │ │ -
1418 //domain number to real process number
│ │ │ -
1419 // domainMapping is the one of parmetis, that is without
│ │ │ -
1420 // the overlap/copy vertices
│ │ │ -
1421 std::vector<int> setPartition(oocomm.indexSet().size(), -1);
│ │ │ -
1422
│ │ │ -
1423 std::size_t i=0; // parmetis index
│ │ │ -
1424 for(auto index = oocomm.indexSet().begin(); index != oocomm.indexSet().end(); ++index)
│ │ │ -
1425 if(OwnerSet::contains(index->local().attribute())) {
│ │ │ -
1426 setPartition[index->local()]=domainMapping[part[i++]];
│ │ │ -
1427 }
│ │ │ -
1428
│ │ │ -
1429 delete[] part;
│ │ │ -
1430 oocomm.copyOwnerToAll(setPartition, setPartition);
│ │ │ -
1431 // communication only needed for ALU
│ │ │ -
1432 // (ghosts with same global id as owners on the same process)
│ │ │ -
1433 if (SolverCategory::category(oocomm) ==
│ │ │ -
1434 static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ -
1435 oocomm.copyCopyToAll(setPartition, setPartition);
│ │ │ -
1436 bool ret = buildCommunication(graph, setPartition, oocomm, outcomm, redistInf,
│ │ │ -
1437 verbose);
│ │ │ -
1438 if(verbose) {
│ │ │ -
1439 oocomm.communicator().barrier();
│ │ │ -
1440 if(oocomm.communicator().rank()==0)
│ │ │ -
1441 std::cout<<"Creating indexsets took "<<time.elapsed()<<std::endl;
│ │ │ -
1442 }
│ │ │ -
1443 return ret;
│ │ │ -
1444 }
│ │ │ +
1359 std::size_t distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates);
│ │ │ +
1360
│ │ │ +
1369 Vertex mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1370
│ │ │ +
1379 void nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ +
1380 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1381 SLList<Vertex>& neighbours) const;
│ │ │ +
1382
│ │ │ +
1390 template<class C>
│ │ │ +
1391 void growAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ +
1392 template<class C>
│ │ │ +
1393 void growIsolatedAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ +
1394 };
│ │ │
│ │ │ +
1395
│ │ │ +
1396#ifndef DOXYGEN
│ │ │ +
1397
│ │ │ +
1398 template<class M, class N>
│ │ │ +
1399 inline void SymmetricDependency<M,N>::init(const Matrix* matrix)
│ │ │ +
1400 {
│ │ │ +
1401 matrix_ = matrix;
│ │ │ +
1402 }
│ │ │ +
1403
│ │ │ +
1404 template<class M, class N>
│ │ │ +
1405 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index)
│ │ │ +
1406 {
│ │ │ +
1407 initRow(row, index, std::is_convertible<field_type, real_type>());
│ │ │ +
1408 }
│ │ │ +
1409
│ │ │ +
1410 template<class M, class N>
│ │ │ +
1411 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index, const std::false_type&)
│ │ │ +
1412 {
│ │ │ +
1413 DUNE_THROW(InvalidStateException, "field_type needs to convertible to real_type");
│ │ │ +
1414 }
│ │ │ +
1415
│ │ │ +
1416 template<class M, class N>
│ │ │ +
1417 inline void SymmetricDependency<M,N>::initRow([[maybe_unused]] const Row& row, int index, const std::true_type&)
│ │ │ +
1418 {
│ │ │ +
1419 using std::min;
│ │ │ +
1420 maxValue_ = min(- std::numeric_limits<typename Matrix::field_type>::max(), std::numeric_limits<typename Matrix::field_type>::min());
│ │ │ +
1421 row_ = index;
│ │ │ +
1422 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ +
1423 }
│ │ │ +
1424
│ │ │ +
1425 template<class M, class N>
│ │ │ +
1426 inline void SymmetricDependency<M,N>::examine(const ColIter& col)
│ │ │ +
1427 {
│ │ │ +
1428 using std::max;
│ │ │ +
1429 real_type eij = norm_(*col);
│ │ │ +
1430 typename Matrix::ConstColIterator opposite_entry =
│ │ │ +
1431 matrix_->operator[](col.index()).find(row_);
│ │ │ +
1432 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ +
1433 {
│ │ │ +
1434 // Consider this a weak connection we disregard.
│ │ │ +
1435 return;
│ │ │ +
1436 }
│ │ │ +
1437 real_type eji = norm_(*opposite_entry);
│ │ │ +
1438
│ │ │ +
1439 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ +
1440 if(!N::is_sign_preserving || eij<0 || eji<0)
│ │ │ +
1441 maxValue_ = max(maxValue_,
│ │ │ +
1442 eij /diagonal_ * eji/
│ │ │ +
1443 norm_(matrix_->operator[](col.index())[col.index()]));
│ │ │ +
1444 }
│ │ │
1445
│ │ │ -
1446
│ │ │ -
1447
│ │ │ -
1448 template<class G, class T1, class T2>
│ │ │ -
│ │ │ -
1449 bool buildCommunication(const G& graph,
│ │ │ -
1450 std::vector<int>& setPartition, Dune::OwnerOverlapCopyCommunication<T1,T2>& oocomm,
│ │ │ -
1451 std::shared_ptr<Dune::OwnerOverlapCopyCommunication<T1,T2>>& outcomm,
│ │ │ -
1452 RedistributeInterface& redistInf,
│ │ │ -
1453 bool verbose)
│ │ │ -
1454 {
│ │ │ -
1455 typedef typename Dune::OwnerOverlapCopyCommunication<T1,T2> OOComm;
│ │ │ -
1456 typedef typename OOComm::OwnerSet OwnerSet;
│ │ │ -
1457
│ │ │ -
1458 Timer time;
│ │ │ -
1459
│ │ │ -
1460 // Build the send interface
│ │ │ -
1461 redistInf.buildSendInterface<OwnerSet>(setPartition, oocomm.indexSet());
│ │ │ -
1462
│ │ │ -
1463#ifdef PERF_REPART
│ │ │ -
1464 // stop the time for step 3)
│ │ │ -
1465 t3=MPI_Wtime()-t3;
│ │ │ -
1466 // reset timer for step 4)
│ │ │ -
1467 t4=MPI_Wtime();
│ │ │ -
1468#endif
│ │ │ -
1469
│ │ │ -
1470
│ │ │ -
1471 //
│ │ │ -
1472 // 4) Create the output IndexSet and RemoteIndices
│ │ │ -
1473 // 4.1) Determine the "send to" and "receive from" relation
│ │ │ -
1474 // according to the new partition using a MPI ring
│ │ │ -
1475 // communication.
│ │ │ -
1476 //
│ │ │ -
1477 // 4.2) Depends on the "send to" and "receive from" vector,
│ │ │ -
1478 // the processes will exchange the vertices each other
│ │ │ -
1479 //
│ │ │ -
1480 // 4.3) Create the IndexSet, RemoteIndices and the new MPI
│ │ │ -
1481 // communicator
│ │ │ -
1482 //
│ │ │ -
1483
│ │ │ -
1484 //
│ │ │ -
1485 // 4.1) Let's start...
│ │ │ -
1486 //
│ │ │ -
1487 int npes = oocomm.communicator().size();
│ │ │ -
1488 int *sendTo = 0;
│ │ │ -
1489 int noSendTo = 0;
│ │ │ -
1490 std::set<int> recvFrom;
│ │ │ -
1491
│ │ │ -
1492 // the max number of vertices is stored in the sendTo buffer,
│ │ │ -
1493 // not the number of vertices to send! Because the max number of Vtx
│ │ │ -
1494 // is used as the fixed buffer size by the MPI send/receive calls
│ │ │ -
1495
│ │ │ -
1496 int mype = oocomm.communicator().rank();
│ │ │ -
1497
│ │ │ -
1498 {
│ │ │ -
1499 std::set<int> tsendTo;
│ │ │ -
1500 for(auto i=setPartition.begin(), iend = setPartition.end(); i!=iend; ++i)
│ │ │ -
1501 tsendTo.insert(*i);
│ │ │ -
1502
│ │ │ -
1503 noSendTo = tsendTo.size();
│ │ │ -
1504 sendTo = new int[noSendTo];
│ │ │ -
1505 int idx=0;
│ │ │ -
1506 for(auto i=tsendTo.begin(); i != tsendTo.end(); ++i, ++idx)
│ │ │ -
1507 sendTo[idx]=*i;
│ │ │ -
1508 }
│ │ │ -
1509
│ │ │ -
1510 //
│ │ │ -
1511 int* gnoSend= new int[oocomm.communicator().size()];
│ │ │ -
1512 int* gsendToDispl = new int[oocomm.communicator().size()+1];
│ │ │ -
1513
│ │ │ -
1514 MPI_Allgather(&noSendTo, 1, MPI_INT, gnoSend, 1,
│ │ │ -
1515 MPI_INT, oocomm.communicator());
│ │ │ +
1446 template<class M, class N>
│ │ │ +
1447 template<class G>
│ │ │ +
1448 inline void SymmetricDependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ +
1449 {
│ │ │ +
1450 real_type eij = norm_(*col);
│ │ │ +
1451 typename Matrix::ConstColIterator opposite_entry =
│ │ │ +
1452 matrix_->operator[](col.index()).find(row_);
│ │ │ +
1453
│ │ │ +
1454 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ +
1455 {
│ │ │ +
1456 // Consider this as a weak connection we disregard.
│ │ │ +
1457 return;
│ │ │ +
1458 }
│ │ │ +
1459 real_type eji = norm_(*opposite_entry);
│ │ │ +
1460 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ +
1461 if(!N::is_sign_preserving || (eij<0 || eji<0))
│ │ │ +
1462 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) *
│ │ │ +
1463 eij/ diagonal_ > alpha() * maxValue_) {
│ │ │ +
1464 edge.properties().setDepends();
│ │ │ +
1465 edge.properties().setInfluences();
│ │ │ +
1466 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), edge.source());
│ │ │ +
1467 other.setInfluences();
│ │ │ +
1468 other.setDepends();
│ │ │ +
1469 }
│ │ │ +
1470 }
│ │ │ +
1471
│ │ │ +
1472 template<class M, class N>
│ │ │ + │ │ │ +
1474 {
│ │ │ +
1475 return maxValue_ < beta();
│ │ │ +
1476 }
│ │ │ +
1477
│ │ │ +
1478
│ │ │ +
1479 template<class M, class N>
│ │ │ +
1480 inline void Dependency<M,N>::init(const Matrix* matrix)
│ │ │ +
1481 {
│ │ │ +
1482 matrix_ = matrix;
│ │ │ +
1483 }
│ │ │ +
1484
│ │ │ +
1485 template<class M, class N>
│ │ │ +
1486 inline void Dependency<M,N>::initRow([[maybe_unused]] const Row& row, int index)
│ │ │ +
1487 {
│ │ │ +
1488 using std::min;
│ │ │ +
1489 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ +
1490 row_ = index;
│ │ │ +
1491 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ +
1492 }
│ │ │ +
1493
│ │ │ +
1494 template<class M, class N>
│ │ │ +
1495 inline void Dependency<M,N>::examine(const ColIter& col)
│ │ │ +
1496 {
│ │ │ +
1497 using std::max;
│ │ │ +
1498 maxValue_ = max(maxValue_, -norm_(*col));
│ │ │ +
1499 }
│ │ │ +
1500
│ │ │ +
1501 template<class M, class N>
│ │ │ +
1502 template<class G>
│ │ │ +
1503 inline void Dependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ +
1504 {
│ │ │ +
1505 if(-norm_(*col) >= maxValue_ * alpha()) {
│ │ │ +
1506 edge.properties().setDepends();
│ │ │ +
1507 typedef typename G::EdgeDescriptor ED;
│ │ │ +
1508 ED e= graph.findEdge(edge.target(), edge.source());
│ │ │ +
1509 if(e!=std::numeric_limits<ED>::max())
│ │ │ +
1510 {
│ │ │ +
1511 typename G::EdgeProperties& other = graph.getEdgeProperties(e);
│ │ │ +
1512 other.setInfluences();
│ │ │ +
1513 }
│ │ │ +
1514 }
│ │ │ +
1515 }
│ │ │
1516
│ │ │ -
1517 // calculate total receive message size
│ │ │ -
1518 int totalNoRecv = 0;
│ │ │ -
1519 for(int i=0; i<npes; ++i)
│ │ │ -
1520 totalNoRecv += gnoSend[i];
│ │ │ -
1521
│ │ │ -
1522 int *gsendTo = new int[totalNoRecv];
│ │ │ -
1523
│ │ │ -
1524 // calculate displacement for allgatherv
│ │ │ -
1525 gsendToDispl[0]=0;
│ │ │ -
1526 for(int i=0; i<npes; ++i)
│ │ │ -
1527 gsendToDispl[i+1]=gsendToDispl[i]+gnoSend[i];
│ │ │ -
1528
│ │ │ -
1529 // gather the data
│ │ │ -
1530 MPI_Allgatherv(sendTo, noSendTo, MPI_INT, gsendTo, gnoSend, gsendToDispl,
│ │ │ -
1531 MPI_INT, oocomm.communicator());
│ │ │ -
1532
│ │ │ -
1533 // Extract from which processes we will receive data
│ │ │ -
1534 for(int proc=0; proc < npes; ++proc)
│ │ │ -
1535 for(int i=gsendToDispl[proc]; i < gsendToDispl[proc+1]; ++i)
│ │ │ -
1536 if(gsendTo[i]==mype)
│ │ │ -
1537 recvFrom.insert(proc);
│ │ │ -
1538
│ │ │ -
1539 bool existentOnNextLevel = recvFrom.size()>0;
│ │ │ -
1540
│ │ │ -
1541 // Delete memory
│ │ │ -
1542 delete[] gnoSend;
│ │ │ -
1543 delete[] gsendToDispl;
│ │ │ -
1544 delete[] gsendTo;
│ │ │ +
1517 template<class M, class N>
│ │ │ +
1518 inline bool Dependency<M,N>::isIsolated()
│ │ │ +
1519 {
│ │ │ +
1520 return maxValue_ < beta() * diagonal_;
│ │ │ +
1521 }
│ │ │ +
1522
│ │ │ +
1523 template<class G,class S>
│ │ │ +
1524 Aggregate<G,S>::Aggregate(MatrixGraph& graph, AggregatesMap<Vertex>& aggregates,
│ │ │ +
1525 VertexSet& connected, std::vector<Vertex>& front)
│ │ │ +
1526 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates),
│ │ │ +
1527 connected_(connected), front_(front)
│ │ │ +
1528 {}
│ │ │ +
1529
│ │ │ +
1530 template<class G,class S>
│ │ │ +
1531 void Aggregate<G,S>::reconstruct(const Vertex& vertex)
│ │ │ +
1532 {
│ │ │ +
1533 /*
│ │ │ +
1534 vertices_.push_back(vertex);
│ │ │ +
1535 typedef typename VertexList::const_iterator iterator;
│ │ │ +
1536 iterator begin = vertices_.begin();
│ │ │ +
1537 iterator end = vertices_.end();*/
│ │ │ +
1538 throw "Not yet implemented";
│ │ │ +
1539
│ │ │ +
1540 // while(begin!=end){
│ │ │ +
1541 //for();
│ │ │ +
1542 // }
│ │ │ +
1543
│ │ │ +
1544 }
│ │ │
1545
│ │ │ -
1546
│ │ │ -
1547#ifdef DEBUG_REPART
│ │ │ -
1548 if(recvFrom.size()) {
│ │ │ -
1549 std::cout<<mype<<": recvFrom: ";
│ │ │ -
1550 for(auto i=recvFrom.begin(); i!= recvFrom.end(); ++i) {
│ │ │ -
1551 std::cout<<*i<<" ";
│ │ │ -
1552 }
│ │ │ -
1553 }
│ │ │ -
1554
│ │ │ -
1555 std::cout<<std::endl<<std::endl;
│ │ │ -
1556 std::cout<<mype<<": sendTo: ";
│ │ │ -
1557 for(int i=0; i<noSendTo; i++) {
│ │ │ -
1558 std::cout<<sendTo[i]<<" ";
│ │ │ -
1559 }
│ │ │ -
1560 std::cout<<std::endl<<std::endl;
│ │ │ -
1561#endif
│ │ │ -
1562
│ │ │ -
1563 if(verbose)
│ │ │ -
1564 if(oocomm.communicator().rank()==0)
│ │ │ -
1565 std::cout<<" Communicating the receive information took "<<
│ │ │ -
1566 time.elapsed()<<std::endl;
│ │ │ -
1567 time.reset();
│ │ │ -
1568
│ │ │ -
1569 //
│ │ │ -
1570 // 4.2) Start the communication
│ │ │ -
1571 //
│ │ │ -
1572
│ │ │ -
1573 // Get all the owner and overlap vertices for myself and save
│ │ │ -
1574 // it in the vectors myOwnerVec and myOverlapVec.
│ │ │ -
1575 // The received vertices from the other processes are simple
│ │ │ -
1576 // added to these vector.
│ │ │ -
1577 //
│ │ │ -
1578
│ │ │ -
1579
│ │ │ -
1580 typedef typename OOComm::ParallelIndexSet::GlobalIndex GI;
│ │ │ -
1581 typedef std::vector<GI> GlobalVector;
│ │ │ -
1582 std::vector<std::pair<GI,int> > myOwnerVec;
│ │ │ -
1583 std::set<GI> myOverlapSet;
│ │ │ -
1584 GlobalVector sendOwnerVec;
│ │ │ -
1585 std::set<GI> sendOverlapSet;
│ │ │ -
1586 std::set<int> myNeighbors;
│ │ │ -
1587
│ │ │ -
1588 // getOwnerOverlapVec<OwnerSet>(graph, setPartition, oocomm.globalLookup(),
│ │ │ -
1589 // mype, mype, myOwnerVec, myOverlapSet, redistInf, myNeighbors);
│ │ │ -
1590
│ │ │ -
1591 char **sendBuffers=new char*[noSendTo];
│ │ │ -
1592 MPI_Request *requests = new MPI_Request[noSendTo];
│ │ │ -
1593
│ │ │ -
1594 // Create all messages to be sent
│ │ │ -
1595 for(int i=0; i < noSendTo; ++i) {
│ │ │ -
1596 // clear the vector for sending
│ │ │ -
1597 sendOwnerVec.clear();
│ │ │ -
1598 sendOverlapSet.clear();
│ │ │ -
1599 // get all owner and overlap vertices for process j and save these
│ │ │ -
1600 // in the vectors sendOwnerVec and sendOverlapSet
│ │ │ -
1601 std::set<int> neighbors;
│ │ │ -
1602 getOwnerOverlapVec<OwnerSet>(graph, setPartition, oocomm.globalLookup(),
│ │ │ -
1603 mype, sendTo[i], sendOwnerVec, sendOverlapSet, redistInf,
│ │ │ -
1604 neighbors);
│ │ │ -
1605 // +2, we need 2 integer more for the length of each part
│ │ │ -
1606 // (owner/overlap) of the array
│ │ │ -
1607 int buffersize=0;
│ │ │ -
1608 int tsize;
│ │ │ -
1609 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &buffersize);
│ │ │ -
1610 MPI_Pack_size(sendOwnerVec.size(), MPITraits<GI>::getType(), oocomm.communicator(), &tsize);
│ │ │ -
1611 buffersize +=tsize;
│ │ │ -
1612 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &tsize);
│ │ │ -
1613 buffersize +=tsize;
│ │ │ -
1614 MPI_Pack_size(sendOverlapSet.size(), MPITraits<GI>::getType(), oocomm.communicator(), &tsize);
│ │ │ -
1615 buffersize += tsize;
│ │ │ -
1616 MPI_Pack_size(1, MPITraits<std::size_t>::getType(), oocomm.communicator(), &tsize);
│ │ │ -
1617 buffersize += tsize;
│ │ │ -
1618 MPI_Pack_size(neighbors.size(), MPI_INT, oocomm.communicator(), &tsize);
│ │ │ -
1619 buffersize += tsize;
│ │ │ -
1620
│ │ │ -
1621 sendBuffers[i] = new char[buffersize];
│ │ │ -
1622
│ │ │ -
1623#ifdef DEBUG_REPART
│ │ │ -
1624 std::cout<<mype<<" sending "<<sendOwnerVec.size()<<" owner and "<<
│ │ │ -
1625 sendOverlapSet.size()<<" overlap to "<<sendTo[i]<<" buffersize="<<buffersize<<std::endl;
│ │ │ -
1626#endif
│ │ │ -
1627 createSendBuf(sendOwnerVec, sendOverlapSet, neighbors, sendBuffers[i], buffersize, oocomm.communicator());
│ │ │ -
1628 MPI_Issend(sendBuffers[i], buffersize, MPI_PACKED, sendTo[i], 99, oocomm.communicator(), requests+i);
│ │ │ -
1629 }
│ │ │ -
1630
│ │ │ -
1631 if(verbose) {
│ │ │ -
1632 oocomm.communicator().barrier();
│ │ │ -
1633 if(oocomm.communicator().rank()==0)
│ │ │ -
1634 std::cout<<" Creating sends took "<<
│ │ │ -
1635 time.elapsed()<<std::endl;
│ │ │ -
1636 }
│ │ │ -
1637 time.reset();
│ │ │ -
1638
│ │ │ -
1639 // Receive Messages
│ │ │ -
1640 int noRecv = recvFrom.size();
│ │ │ -
1641 int oldbuffersize=0;
│ │ │ -
1642 char* recvBuf = 0;
│ │ │ -
1643 while(noRecv>0) {
│ │ │ -
1644 // probe for an incoming message
│ │ │ -
1645 MPI_Status stat;
│ │ │ -
1646 MPI_Probe(MPI_ANY_SOURCE, 99, oocomm.communicator(), &stat);
│ │ │ -
1647 int buffersize;
│ │ │ -
1648 MPI_Get_count(&stat, MPI_PACKED, &buffersize);
│ │ │ +
1546 template<class G,class S>
│ │ │ +
1547 inline void Aggregate<G,S>::seed(const Vertex& vertex)
│ │ │ +
1548 {
│ │ │ +
1549 dvverb<<"Connected cleared"<<std::endl;
│ │ │ +
1550 connected_.clear();
│ │ │ +
1551 vertices_.clear();
│ │ │ +
1552 connected_.insert(vertex);
│ │ │ +
1553 dvverb << " Inserting "<<vertex<<" size="<<connected_.size();
│ │ │ +
1554 ++id_ ;
│ │ │ +
1555 add(vertex);
│ │ │ +
1556 }
│ │ │ +
1557
│ │ │ +
1558
│ │ │ +
1559 template<class G,class S>
│ │ │ +
1560 inline void Aggregate<G,S>::add(const Vertex& vertex)
│ │ │ +
1561 {
│ │ │ +
1562 vertices_.insert(vertex);
│ │ │ +
1563 aggregates_[vertex]=id_;
│ │ │ +
1564 if(front_.size())
│ │ │ +
1565 front_.erase(std::lower_bound(front_.begin(), front_.end(), vertex));
│ │ │ +
1566
│ │ │ +
1567
│ │ │ +
1568 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ +
1569 const iterator end = graph_.endEdges(vertex);
│ │ │ +
1570 for(iterator edge = graph_.beginEdges(vertex); edge != end; ++edge) {
│ │ │ +
1571 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ +
1572 connected_.insert(aggregates_[edge.target()]);
│ │ │ +
1573 dvverb <<" size="<<connected_.size();
│ │ │ +
1574 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ +
1575 !graph_.getVertexProperties(edge.target()).front())
│ │ │ +
1576 {
│ │ │ +
1577 front_.push_back(edge.target());
│ │ │ +
1578 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ +
1579 }
│ │ │ +
1580 }
│ │ │ +
1581 dvverb <<std::endl;
│ │ │ +
1582 std::sort(front_.begin(), front_.end());
│ │ │ +
1583 }
│ │ │ +
1584
│ │ │ +
1585 template<class G,class S>
│ │ │ +
1586 inline void Aggregate<G,S>::add(std::vector<Vertex>& vertices)
│ │ │ +
1587 {
│ │ │ +
1588#ifndef NDEBUG
│ │ │ +
1589 std::size_t oldsize = vertices_.size();
│ │ │ +
1590#endif
│ │ │ +
1591 typedef typename std::vector<Vertex>::iterator Iterator;
│ │ │ +
1592
│ │ │ +
1593 typedef typename VertexSet::iterator SIterator;
│ │ │ +
1594
│ │ │ +
1595 SIterator pos=vertices_.begin();
│ │ │ +
1596 std::vector<Vertex> newFront;
│ │ │ +
1597 newFront.reserve(front_.capacity());
│ │ │ +
1598
│ │ │ +
1599 std::set_difference(front_.begin(), front_.end(), vertices.begin(), vertices.end(),
│ │ │ +
1600 std::back_inserter(newFront));
│ │ │ +
1601 front_=newFront;
│ │ │ +
1602
│ │ │ +
1603 for(Iterator vertex=vertices.begin(); vertex != vertices.end(); ++vertex)
│ │ │ +
1604 {
│ │ │ +
1605 pos=vertices_.insert(pos,*vertex);
│ │ │ +
1606 vertices_.insert(*vertex);
│ │ │ +
1607 graph_.getVertexProperties(*vertex).resetFront(); // Not a front node any more.
│ │ │ +
1608 aggregates_[*vertex]=id_;
│ │ │ +
1609
│ │ │ +
1610 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ +
1611 const iterator end = graph_.endEdges(*vertex);
│ │ │ +
1612 for(iterator edge = graph_.beginEdges(*vertex); edge != end; ++edge) {
│ │ │ +
1613 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ +
1614 connected_.insert(aggregates_[edge.target()]);
│ │ │ +
1615 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ +
1616 !graph_.getVertexProperties(edge.target()).front())
│ │ │ +
1617 {
│ │ │ +
1618 front_.push_back(edge.target());
│ │ │ +
1619 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ +
1620 }
│ │ │ +
1621 dvverb <<" size="<<connected_.size();
│ │ │ +
1622 }
│ │ │ +
1623 dvverb <<std::endl;
│ │ │ +
1624 }
│ │ │ +
1625 std::sort(front_.begin(), front_.end());
│ │ │ +
1626 assert(oldsize+vertices.size()==vertices_.size());
│ │ │ +
1627 }
│ │ │ +
1628 template<class G,class S>
│ │ │ +
1629 inline void Aggregate<G,S>::clear()
│ │ │ +
1630 {
│ │ │ +
1631 vertices_.clear();
│ │ │ +
1632 connected_.clear();
│ │ │ +
1633 id_=-1;
│ │ │ +
1634 }
│ │ │ +
1635
│ │ │ +
1636 template<class G,class S>
│ │ │ +
1637 inline typename Aggregate<G,S>::VertexSet::size_type
│ │ │ + │ │ │ +
1639 {
│ │ │ +
1640 return vertices_.size();
│ │ │ +
1641 }
│ │ │ +
1642
│ │ │ +
1643 template<class G,class S>
│ │ │ +
1644 inline typename Aggregate<G,S>::VertexSet::size_type
│ │ │ + │ │ │ +
1646 {
│ │ │ +
1647 return connected_.size();
│ │ │ +
1648 }
│ │ │
1649
│ │ │ -
1650 if(oldbuffersize<buffersize) {
│ │ │ -
1651 // buffer too small, reallocate
│ │ │ -
1652 delete[] recvBuf;
│ │ │ -
1653 recvBuf = new char[buffersize];
│ │ │ -
1654 oldbuffersize = buffersize;
│ │ │ -
1655 }
│ │ │ -
1656 MPI_Recv(recvBuf, buffersize, MPI_PACKED, stat.MPI_SOURCE, 99, oocomm.communicator(), &stat);
│ │ │ -
1657 saveRecvBuf(recvBuf, buffersize, myOwnerVec, myOverlapSet, myNeighbors, redistInf,
│ │ │ -
1658 stat.MPI_SOURCE, oocomm.communicator());
│ │ │ -
1659 --noRecv;
│ │ │ +
1650 template<class G,class S>
│ │ │ +
1651 inline int Aggregate<G,S>::id()
│ │ │ +
1652 {
│ │ │ +
1653 return id_;
│ │ │ +
1654 }
│ │ │ +
1655
│ │ │ +
1656 template<class G,class S>
│ │ │ + │ │ │ +
1658 {
│ │ │ +
1659 return vertices_.begin();
│ │ │
1660 }
│ │ │
1661
│ │ │ -
1662 if(recvBuf)
│ │ │ -
1663 delete[] recvBuf;
│ │ │ -
1664
│ │ │ -
1665 time.reset();
│ │ │ -
1666 // Wait for sending messages to complete
│ │ │ -
1667 MPI_Status *statuses = new MPI_Status[noSendTo];
│ │ │ -
1668 int send = MPI_Waitall(noSendTo, requests, statuses);
│ │ │ -
1669
│ │ │ -
1670 // check for errors
│ │ │ -
1671 if(send==MPI_ERR_IN_STATUS) {
│ │ │ -
1672 std::cerr<<mype<<": Error in sending :"<<std::endl;
│ │ │ -
1673 // Search for the error
│ │ │ -
1674 for(int i=0; i< noSendTo; i++)
│ │ │ -
1675 if(statuses[i].MPI_ERROR!=MPI_SUCCESS) {
│ │ │ -
1676 char message[300];
│ │ │ -
1677 int messageLength;
│ │ │ -
1678 MPI_Error_string(statuses[i].MPI_ERROR, message, &messageLength);
│ │ │ -
1679 std::cerr<<" source="<<statuses[i].MPI_SOURCE<<" message: ";
│ │ │ -
1680 for(int j = 0; j < messageLength; j++)
│ │ │ -
1681 std::cout<<message[j];
│ │ │ -
1682 }
│ │ │ -
1683 std::cerr<<std::endl;
│ │ │ +
1662 template<class G,class S>
│ │ │ + │ │ │ +
1664 {
│ │ │ +
1665 return vertices_.end();
│ │ │ +
1666 }
│ │ │ +
1667
│ │ │ +
1668 template<class V>
│ │ │ +
1669 const V AggregatesMap<V>::UNAGGREGATED = std::numeric_limits<V>::max();
│ │ │ +
1670
│ │ │ +
1671 template<class V>
│ │ │ +
1672 const V AggregatesMap<V>::ISOLATED = std::numeric_limits<V>::max()-1;
│ │ │ +
1673
│ │ │ +
1674 template<class V>
│ │ │ + │ │ │ +
1676 : aggregates_(0)
│ │ │ +
1677 {}
│ │ │ +
1678
│ │ │ +
1679 template<class V>
│ │ │ + │ │ │ +
1681 {
│ │ │ +
1682 if(aggregates_!=0)
│ │ │ +
1683 delete[] aggregates_;
│ │ │
1684 }
│ │ │
1685
│ │ │ -
1686 if(verbose) {
│ │ │ -
1687 oocomm.communicator().barrier();
│ │ │ -
1688 if(oocomm.communicator().rank()==0)
│ │ │ -
1689 std::cout<<" Receiving and saving took "<<
│ │ │ -
1690 time.elapsed()<<std::endl;
│ │ │ +
1686
│ │ │ +
1687 template<class V>
│ │ │ +
1688 inline AggregatesMap<V>::AggregatesMap(std::size_t noVertices)
│ │ │ +
1689 {
│ │ │ +
1690 allocate(noVertices);
│ │ │
1691 }
│ │ │ -
1692 time.reset();
│ │ │ -
1693
│ │ │ -
1694 for(int i=0; i < noSendTo; ++i)
│ │ │ -
1695 delete[] sendBuffers[i];
│ │ │ -
1696
│ │ │ -
1697 delete[] sendBuffers;
│ │ │ -
1698 delete[] statuses;
│ │ │ -
1699 delete[] requests;
│ │ │ -
1700
│ │ │ -
1701 redistInf.setCommunicator(oocomm.communicator());
│ │ │ -
1702
│ │ │ -
1703 //
│ │ │ -
1704 // 4.2) Create the IndexSet etc.
│ │ │ -
1705 //
│ │ │ -
1706
│ │ │ -
1707 // build the new outputIndexSet
│ │ │ +
1692
│ │ │ +
1693 template<class V>
│ │ │ +
1694 inline std::size_t AggregatesMap<V>::noVertices() const
│ │ │ +
1695 {
│ │ │ +
1696 return noVertices_;
│ │ │ +
1697 }
│ │ │ +
1698
│ │ │ +
1699 template<class V>
│ │ │ +
1700 inline void AggregatesMap<V>::allocate(std::size_t noVertices)
│ │ │ +
1701 {
│ │ │ +
1702 aggregates_ = new AggregateDescriptor[noVertices];
│ │ │ +
1703 noVertices_ = noVertices;
│ │ │ +
1704
│ │ │ +
1705 for(std::size_t i=0; i < noVertices; i++)
│ │ │ +
1706 aggregates_[i]=UNAGGREGATED;
│ │ │ +
1707 }
│ │ │
1708
│ │ │ -
1709
│ │ │ -
1710 int color=0;
│ │ │ -
1711
│ │ │ -
1712 if (!existentOnNextLevel) {
│ │ │ -
1713 // this process is not used anymore
│ │ │ -
1714 color= MPI_UNDEFINED;
│ │ │ +
1709 template<class V>
│ │ │ +
1710 inline void AggregatesMap<V>::free()
│ │ │ +
1711 {
│ │ │ +
1712 assert(aggregates_ != 0);
│ │ │ +
1713 delete[] aggregates_;
│ │ │ +
1714 aggregates_=0;
│ │ │
1715 }
│ │ │ -
1716 MPI_Comm outputComm;
│ │ │ -
1717
│ │ │ -
1718 MPI_Comm_split(oocomm.communicator(), color, oocomm.communicator().rank(), &outputComm);
│ │ │ -
1719 outcomm = std::make_shared<OOComm>(outputComm,SolverCategory::category(oocomm),true);
│ │ │ -
1720
│ │ │ -
1721 // translate neighbor ranks.
│ │ │ -
1722 int newrank=outcomm->communicator().rank();
│ │ │ -
1723 int *newranks=new int[oocomm.communicator().size()];
│ │ │ -
1724 std::vector<int> tneighbors;
│ │ │ -
1725 tneighbors.reserve(myNeighbors.size());
│ │ │ -
1726
│ │ │ -
1727 typename OOComm::ParallelIndexSet& outputIndexSet = outcomm->indexSet();
│ │ │ -
1728
│ │ │ -
1729 MPI_Allgather(&newrank, 1, MPI_INT, newranks, 1,
│ │ │ -
1730 MPI_INT, oocomm.communicator());
│ │ │ -
1731
│ │ │ -
1732#ifdef DEBUG_REPART
│ │ │ -
1733 std::cout<<oocomm.communicator().rank()<<" ";
│ │ │ -
1734 for(auto i=myNeighbors.begin(), end=myNeighbors.end();
│ │ │ -
1735 i!=end; ++i) {
│ │ │ -
1736 assert(newranks[*i]>=0);
│ │ │ -
1737 std::cout<<*i<<"->"<<newranks[*i]<<" ";
│ │ │ -
1738 tneighbors.push_back(newranks[*i]);
│ │ │ -
1739 }
│ │ │ -
1740 std::cout<<std::endl;
│ │ │ -
1741#else
│ │ │ -
1742 for(auto i=myNeighbors.begin(), end=myNeighbors.end();
│ │ │ -
1743 i!=end; ++i) {
│ │ │ -
1744 tneighbors.push_back(newranks[*i]);
│ │ │ -
1745 }
│ │ │ -
1746#endif
│ │ │ -
1747 delete[] newranks;
│ │ │ -
1748 myNeighbors.clear();
│ │ │ -
1749
│ │ │ -
1750 if(verbose) {
│ │ │ -
1751 oocomm.communicator().barrier();
│ │ │ -
1752 if(oocomm.communicator().rank()==0)
│ │ │ -
1753 std::cout<<" Calculating new neighbours ("<<tneighbors.size()<<") took "<<
│ │ │ -
1754 time.elapsed()<<std::endl;
│ │ │ -
1755 }
│ │ │ -
1756 time.reset();
│ │ │ -
1757
│ │ │ -
1758
│ │ │ -
1759 outputIndexSet.beginResize();
│ │ │ -
1760 // 1) add the owner vertices
│ │ │ -
1761 // Sort the owners
│ │ │ -
1762 std::sort(myOwnerVec.begin(), myOwnerVec.end(), SortFirst());
│ │ │ -
1763 // The owners are sorted according to there global index
│ │ │ -
1764 // Therefore the entries of ownerVec are the same as the
│ │ │ -
1765 // ones in the resulting index set.
│ │ │ -
1766 int i=0;
│ │ │ -
1767 using LocalIndexT = typename OOComm::ParallelIndexSet::LocalIndex;
│ │ │ -
1768 for(auto g=myOwnerVec.begin(), end =myOwnerVec.end(); g!=end; ++g, ++i ) {
│ │ │ -
1769 outputIndexSet.add(g->first,LocalIndexT(i, OwnerOverlapCopyAttributeSet::owner, true));
│ │ │ -
1770 redistInf.addReceiveIndex(g->second, i);
│ │ │ -
1771 }
│ │ │ -
1772
│ │ │ -
1773 if(verbose) {
│ │ │ -
1774 oocomm.communicator().barrier();
│ │ │ -
1775 if(oocomm.communicator().rank()==0)
│ │ │ -
1776 std::cout<<" Adding owner indices took "<<
│ │ │ -
1777 time.elapsed()<<std::endl;
│ │ │ -
1778 }
│ │ │ -
1779 time.reset();
│ │ │ -
1780
│ │ │ -
1781
│ │ │ -
1782 // After all the vertices are received, the vectors must
│ │ │ -
1783 // be "merged" together to create the final vectors.
│ │ │ -
1784 // Because some vertices that are sent as overlap could now
│ │ │ -
1785 // already included as owner vertiecs in the new partition
│ │ │ -
1786 mergeVec(myOwnerVec, myOverlapSet);
│ │ │ -
1787
│ │ │ -
1788 // Trick to free memory
│ │ │ -
1789 myOwnerVec.clear();
│ │ │ -
1790 myOwnerVec.swap(myOwnerVec);
│ │ │ -
1791
│ │ │ -
1792 if(verbose) {
│ │ │ -
1793 oocomm.communicator().barrier();
│ │ │ -
1794 if(oocomm.communicator().rank()==0)
│ │ │ -
1795 std::cout<<" Merging indices took "<<
│ │ │ -
1796 time.elapsed()<<std::endl;
│ │ │ -
1797 }
│ │ │ -
1798 time.reset();
│ │ │ -
1799
│ │ │ -
1800
│ │ │ -
1801 // 2) add the overlap vertices
│ │ │ -
1802 for(auto g=myOverlapSet.begin(), end=myOverlapSet.end(); g!=end; ++g, i++) {
│ │ │ -
1803 outputIndexSet.add(*g,LocalIndexT(i, OwnerOverlapCopyAttributeSet::copy, true));
│ │ │ -
1804 }
│ │ │ -
1805 myOverlapSet.clear();
│ │ │ -
1806 outputIndexSet.endResize();
│ │ │ -
1807
│ │ │ -
1808#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
1809 int numOfOwnVtx =0;
│ │ │ -
1810 auto end = outputIndexSet.end();
│ │ │ -
1811 for(auto index = outputIndexSet.begin(); index != end; ++index) {
│ │ │ -
1812 if (OwnerSet::contains(index->local().attribute())) {
│ │ │ -
1813 numOfOwnVtx++;
│ │ │ -
1814 }
│ │ │ -
1815 }
│ │ │ -
1816 numOfOwnVtx = oocomm.communicator().sum(numOfOwnVtx);
│ │ │ -
1817 // if(numOfOwnVtx!=indexMap.globalOwnerVertices)
│ │ │ -
1818 // {
│ │ │ -
1819 // std::cerr<<numOfOwnVtx<<"!="<<indexMap.globalOwnerVertices<<" owners missing or additional ones!"<<std::endl;
│ │ │ -
1820 // DUNE_THROW(ISTLError, numOfOwnVtx<<"!="<<indexMap.globalOwnerVertices<<" owners missing or additional ones"
│ │ │ -
1821 // <<" during repartitioning.");
│ │ │ -
1822 // }
│ │ │ -
1823 std::is_sorted(outputIndexSet.begin(), outputIndexSet.end(),
│ │ │ -
1824 [](const auto& v1, const auto& v2){ return v1.global() < v2.global();});
│ │ │ -
1825#endif
│ │ │ -
1826 if(verbose) {
│ │ │ -
1827 oocomm.communicator().barrier();
│ │ │ -
1828 if(oocomm.communicator().rank()==0)
│ │ │ -
1829 std::cout<<" Adding overlap indices took "<<
│ │ │ -
1830 time.elapsed()<<std::endl;
│ │ │ -
1831 }
│ │ │ -
1832 time.reset();
│ │ │ +
1716
│ │ │ +
1717 template<class V>
│ │ │ + │ │ │ +
1719 AggregatesMap<V>::operator[](const VertexDescriptor& v)
│ │ │ +
1720 {
│ │ │ +
1721 return aggregates_[v];
│ │ │ +
1722 }
│ │ │ +
1723
│ │ │ +
1724 template<class V>
│ │ │ +
1725 inline const typename AggregatesMap<V>::AggregateDescriptor&
│ │ │ +
1726 AggregatesMap<V>::operator[](const VertexDescriptor& v) const
│ │ │ +
1727 {
│ │ │ +
1728 return aggregates_[v];
│ │ │ +
1729 }
│ │ │ +
1730
│ │ │ +
1731 template<class V>
│ │ │ +
1732 template<bool reset, class G, class F,class VM>
│ │ │ +
1733 inline std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ +
1734 const AggregateDescriptor& aggregate,
│ │ │ +
1735 const G& graph, F& aggregateVisitor,
│ │ │ +
1736 VM& visitedMap) const
│ │ │ +
1737 {
│ │ │ +
1738 VertexList vlist;
│ │ │ +
1739
│ │ │ +
1740 DummyEdgeVisitor dummy;
│ │ │ +
1741 return breadthFirstSearch<true,reset>(start, aggregate, graph, vlist, aggregateVisitor, dummy, visitedMap);
│ │ │ +
1742 }
│ │ │ +
1743
│ │ │ +
1744 template<class V>
│ │ │ +
1745 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ +
1746 std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ +
1747 const AggregateDescriptor& aggregate,
│ │ │ +
1748 const G& graph,
│ │ │ +
1749 L& visited,
│ │ │ +
1750 F1& aggregateVisitor,
│ │ │ +
1751 F2& nonAggregateVisitor,
│ │ │ +
1752 VM& visitedMap) const
│ │ │ +
1753 {
│ │ │ +
1754 typedef typename L::const_iterator ListIterator;
│ │ │ +
1755 int visitedSpheres = 0;
│ │ │ +
1756
│ │ │ +
1757 visited.push_back(start);
│ │ │ +
1758 put(visitedMap, start, true);
│ │ │ +
1759
│ │ │ +
1760 ListIterator current = visited.begin();
│ │ │ +
1761 ListIterator end = visited.end();
│ │ │ +
1762 std::size_t i=0, size=visited.size();
│ │ │ +
1763
│ │ │ +
1764 // visit the neighbours of all vertices of the
│ │ │ +
1765 // current sphere.
│ │ │ +
1766 while(current != end) {
│ │ │ +
1767
│ │ │ +
1768 for(; i<size; ++current, ++i) {
│ │ │ +
1769 typedef typename G::ConstEdgeIterator EdgeIterator;
│ │ │ +
1770 const EdgeIterator endEdge = graph.endEdges(*current);
│ │ │ +
1771
│ │ │ +
1772 for(EdgeIterator edge = graph.beginEdges(*current);
│ │ │ +
1773 edge != endEdge; ++edge) {
│ │ │ +
1774
│ │ │ +
1775 if(aggregates_[edge.target()]==aggregate) {
│ │ │ +
1776 if(!get(visitedMap, edge.target())) {
│ │ │ +
1777 put(visitedMap, edge.target(), true);
│ │ │ +
1778 visited.push_back(edge.target());
│ │ │ +
1779 aggregateVisitor(edge);
│ │ │ +
1780 }
│ │ │ +
1781 }else
│ │ │ +
1782 nonAggregateVisitor(edge);
│ │ │ +
1783 }
│ │ │ +
1784 }
│ │ │ +
1785 end = visited.end();
│ │ │ +
1786 size = visited.size();
│ │ │ +
1787 if(current != end)
│ │ │ +
1788 visitedSpheres++;
│ │ │ +
1789 }
│ │ │ +
1790
│ │ │ +
1791 if(reset)
│ │ │ +
1792 for(current = visited.begin(); current != end; ++current)
│ │ │ +
1793 put(visitedMap, *current, false);
│ │ │ +
1794
│ │ │ +
1795
│ │ │ +
1796 if(remove)
│ │ │ +
1797 visited.clear();
│ │ │ +
1798
│ │ │ +
1799 return visitedSpheres;
│ │ │ +
1800 }
│ │ │ +
1801
│ │ │ +
1802 template<class G>
│ │ │ + │ │ │ +
1804 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1)
│ │ │ +
1805 {}
│ │ │ +
1806
│ │ │ +
1807 template<class G>
│ │ │ + │ │ │ +
1809 {
│ │ │ +
1810 size_=-1;
│ │ │ +
1811 }
│ │ │ +
1812
│ │ │ +
1813 template<class G, class C>
│ │ │ +
1814 void buildDependency(G& graph,
│ │ │ +
1815 const typename C::Matrix& matrix,
│ │ │ +
1816 C criterion, bool firstlevel)
│ │ │ +
1817 {
│ │ │ +
1818 // assert(graph.isBuilt());
│ │ │ +
1819 typedef typename C::Matrix Matrix;
│ │ │ +
1820 typedef typename G::VertexIterator VertexIterator;
│ │ │ +
1821
│ │ │ +
1822 criterion.init(&matrix);
│ │ │ +
1823
│ │ │ +
1824 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); ++vertex) {
│ │ │ +
1825 typedef typename Matrix::row_type Row;
│ │ │ +
1826
│ │ │ +
1827 const Row& row = matrix[*vertex];
│ │ │ +
1828
│ │ │ +
1829 // Tell the criterion what row we will examine now
│ │ │ +
1830 // This might for example be used for calculating the
│ │ │ +
1831 // maximum offdiagonal value
│ │ │ +
1832 criterion.initRow(row, *vertex);
│ │ │
1833
│ │ │ -
1834
│ │ │ -
1835 if(color != MPI_UNDEFINED) {
│ │ │ -
1836 outcomm->remoteIndices().setNeighbours(tneighbors);
│ │ │ -
1837 outcomm->remoteIndices().template rebuild<true>();
│ │ │ -
1838
│ │ │ -
1839 }
│ │ │ -
1840
│ │ │ -
1841 // release the memory
│ │ │ -
1842 delete[] sendTo;
│ │ │ -
1843
│ │ │ -
1844 if(verbose) {
│ │ │ -
1845 oocomm.communicator().barrier();
│ │ │ -
1846 if(oocomm.communicator().rank()==0)
│ │ │ -
1847 std::cout<<" Storing indexsets took "<<
│ │ │ -
1848 time.elapsed()<<std::endl;
│ │ │ -
1849 }
│ │ │ -
1850
│ │ │ -
1851#ifdef PERF_REPART
│ │ │ -
1852 // stop the time for step 4) and print the results
│ │ │ -
1853 t4=MPI_Wtime()-t4;
│ │ │ -
1854 tSum = t1 + t2 + t3 + t4;
│ │ │ -
1855 std::cout<<std::endl
│ │ │ -
1856 <<mype<<": WTime for step 1): "<<t1
│ │ │ -
1857 <<" 2): "<<t2
│ │ │ -
1858 <<" 3): "<<t3
│ │ │ -
1859 <<" 4): "<<t4
│ │ │ -
1860 <<" total: "<<tSum
│ │ │ -
1861 <<std::endl;
│ │ │ -
1862#endif
│ │ │ -
1863
│ │ │ -
1864 return color!=MPI_UNDEFINED;
│ │ │ -
1865
│ │ │ -
1866 }
│ │ │ -
│ │ │ -
1867#else
│ │ │ -
1868 template<class G, class P,class T1, class T2, class R>
│ │ │ -
1869 bool graphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ -
1870 std::shared_ptr<P>& outcomm,
│ │ │ -
1871 R& redistInf,
│ │ │ -
1872 bool v=false)
│ │ │ -
1873 {
│ │ │ -
1874 if(nparts!=oocomm.size())
│ │ │ -
1875 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ -
1876 }
│ │ │ -
1877
│ │ │ +
1834 // On a first path all columns are examined. After this
│ │ │ +
1835 // the calculator should know whether the vertex is isolated.
│ │ │ +
1836 typedef typename Matrix::ConstColIterator ColIterator;
│ │ │ +
1837 ColIterator end = row.end();
│ │ │ +
1838 typename FieldTraits<typename Matrix::field_type>::real_type absoffdiag=0.;
│ │ │ +
1839
│ │ │ +
1840 using std::max;
│ │ │ +
1841 if(firstlevel) {
│ │ │ +
1842 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ +
1843 if(col.index()!=*vertex) {
│ │ │ +
1844 criterion.examine(col);
│ │ │ +
1845 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm());
│ │ │ +
1846 }
│ │ │ +
1847
│ │ │ +
1848 if(absoffdiag==0)
│ │ │ +
1849 vertex.properties().setExcludedBorder();
│ │ │ +
1850 }
│ │ │ +
1851 else
│ │ │ +
1852 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ +
1853 if(col.index()!=*vertex)
│ │ │ +
1854 criterion.examine(col);
│ │ │ +
1855
│ │ │ +
1856 // reset the vertex properties
│ │ │ +
1857 //vertex.properties().reset();
│ │ │ +
1858
│ │ │ +
1859 // Check whether the vertex is isolated.
│ │ │ +
1860 if(criterion.isIsolated()) {
│ │ │ +
1861 //std::cout<<"ISOLATED: "<<*vertex<<std::endl;
│ │ │ +
1862 vertex.properties().setIsolated();
│ │ │ +
1863 }else{
│ │ │ +
1864 // Examine all the edges beginning at this vertex.
│ │ │ +
1865 auto eEnd = vertex.end();
│ │ │ +
1866 auto col = matrix[*vertex].begin();
│ │ │ +
1867
│ │ │ +
1868 for(auto edge = vertex.begin(); edge!= eEnd; ++edge, ++col) {
│ │ │ +
1869 // Move to the right column.
│ │ │ +
1870 while(col.index()!=edge.target())
│ │ │ +
1871 ++col;
│ │ │ +
1872 criterion.examine(graph, edge, col);
│ │ │ +
1873 }
│ │ │ +
1874 }
│ │ │ +
1875
│ │ │ +
1876 }
│ │ │ +
1877 }
│ │ │
1878
│ │ │ -
1879 template<class G, class P,class T1, class T2, class R>
│ │ │ -
1880 bool commGraphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ -
1881 std::shared_ptr<P>& outcomm,
│ │ │ -
1882 R& redistInf,
│ │ │ -
1883 bool v=false)
│ │ │ -
1884 {
│ │ │ -
1885 if(nparts!=oocomm.size())
│ │ │ -
1886 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ -
1887 }
│ │ │ -
1888#endif // HAVE_MPI
│ │ │ -
1889} // end of namespace Dune
│ │ │ -
1890#endif
│ │ │ -
int globalOwnerVertices
Definition repartition.hh:175
│ │ │ -
Provides classes for building the matrix graph.
│ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ +
1879
│ │ │ +
1880 template<class G>
│ │ │ +
1881 template<class V>
│ │ │ +
1882 inline Aggregator<G>::AggregateVisitor<V>::AggregateVisitor(const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1883 const AggregateDescriptor& aggregate, V& visitor)
│ │ │ +
1884 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor)
│ │ │ +
1885 {}
│ │ │ +
1886
│ │ │ +
1887 template<class G>
│ │ │ +
1888 template<class V>
│ │ │ + │ │ │ +
1890 {
│ │ │ +
1891 if(aggregates_[edge.target()]==aggregate_)
│ │ │ +
1892 visitor_->operator()(edge);
│ │ │ +
1893 }
│ │ │ +
1894
│ │ │ +
1895 template<class G>
│ │ │ +
1896 template<class V>
│ │ │ +
1897 inline void Aggregator<G>::visitAggregateNeighbours(const Vertex& vertex,
│ │ │ +
1898 const AggregateDescriptor& aggregate,
│ │ │ +
1899 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1900 V& visitor) const
│ │ │ +
1901 {
│ │ │ +
1902 // Only evaluates for edge pointing to the aggregate
│ │ │ +
1903 AggregateVisitor<V> v(aggregates, aggregate, visitor);
│ │ │ +
1904 visitNeighbours(*graph_, vertex, v);
│ │ │ +
1905 }
│ │ │ +
1906
│ │ │ +
1907
│ │ │ +
1908 template<class G>
│ │ │ + │ │ │ +
1910 : count_(0)
│ │ │ +
1911 {}
│ │ │ +
1912
│ │ │ +
1913 template<class G>
│ │ │ + │ │ │ +
1915 {
│ │ │ +
1916 ++count_;
│ │ │ +
1917 }
│ │ │ +
1918
│ │ │ +
1919 template<class G>
│ │ │ + │ │ │ +
1921 {
│ │ │ +
1922 --count_;
│ │ │ +
1923 }
│ │ │ +
1924 template<class G>
│ │ │ + │ │ │ +
1926 {
│ │ │ +
1927 return count_;
│ │ │ +
1928 }
│ │ │ +
1929
│ │ │ +
1930 template<class G>
│ │ │ + │ │ │ +
1932 {
│ │ │ +
1933 if(edge.properties().isTwoWay())
│ │ │ + │ │ │ +
1935 }
│ │ │ +
1936
│ │ │ +
1937 template<class G>
│ │ │ +
1938 int Aggregator<G>::twoWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1939 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
1940 {
│ │ │ +
1941 TwoWayCounter counter;
│ │ │ +
1942 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ +
1943 return counter.value();
│ │ │ +
1944 }
│ │ │ +
1945
│ │ │ +
1946 template<class G>
│ │ │ +
1947 int Aggregator<G>::oneWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1948 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
1949 {
│ │ │ +
1950 OneWayCounter counter;
│ │ │ +
1951 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ +
1952 return counter.value();
│ │ │ +
1953 }
│ │ │ +
1954
│ │ │ +
1955 template<class G>
│ │ │ + │ │ │ +
1957 {
│ │ │ +
1958 if(edge.properties().isOneWay())
│ │ │ + │ │ │ +
1960 }
│ │ │ +
1961
│ │ │ +
1962 template<class G>
│ │ │ +
1963 inline Aggregator<G>::ConnectivityCounter::ConnectivityCounter(const VertexSet& connected,
│ │ │ +
1964 const AggregatesMap<Vertex>& aggregates)
│ │ │ +
1965 : Counter(), connected_(connected), aggregates_(aggregates)
│ │ │ +
1966 {}
│ │ │ +
1967
│ │ │ +
1968
│ │ │ +
1969 template<class G>
│ │ │ + │ │ │ +
1971 {
│ │ │ +
1972 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ +
1973 // Would be a new connection
│ │ │ + │ │ │ +
1975 else{
│ │ │ + │ │ │ + │ │ │ +
1978 }
│ │ │ +
1979 }
│ │ │ +
1980
│ │ │ +
1981 template<class G>
│ │ │ +
1982 inline double Aggregator<G>::connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
1983 {
│ │ │ +
1984 ConnectivityCounter counter(connected_, aggregates);
│ │ │ +
1985 double noNeighbours=visitNeighbours(*graph_, vertex, counter);
│ │ │ +
1986 return (double)counter.value()/noNeighbours;
│ │ │ +
1987 }
│ │ │ +
1988
│ │ │ +
1989 template<class G>
│ │ │ + │ │ │ +
1991 : Counter()
│ │ │ +
1992 {}
│ │ │ +
1993
│ │ │ +
1994 template<class G>
│ │ │ + │ │ │ +
1996 {
│ │ │ +
1997 if(edge.properties().depends())
│ │ │ + │ │ │ +
1999 if(edge.properties().influences())
│ │ │ + │ │ │ +
2001 }
│ │ │ +
2002
│ │ │ +
2003 template<class G>
│ │ │ +
2004 int Aggregator<G>::unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2005 {
│ │ │ +
2006 return aggregateNeighbours(vertex, AggregatesMap<Vertex>::UNAGGREGATED, aggregates);
│ │ │ +
2007 }
│ │ │ +
2008
│ │ │ +
2009 template<class G>
│ │ │ +
2010 std::pair<int,int> Aggregator<G>::neighbours(const Vertex& vertex,
│ │ │ +
2011 const AggregateDescriptor& aggregate,
│ │ │ +
2012 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2013 {
│ │ │ +
2014 DependencyCounter unused, aggregated;
│ │ │ +
2015 typedef AggregateVisitor<DependencyCounter> CounterT;
│ │ │ +
2016 typedef std::tuple<CounterT,CounterT> CounterTuple;
│ │ │ +
2017 CombinedFunctor<CounterTuple> visitors(CounterTuple(CounterT(aggregates, AggregatesMap<Vertex>::UNAGGREGATED, unused), CounterT(aggregates, aggregate, aggregated)));
│ │ │ +
2018 visitNeighbours(*graph_, vertex, visitors);
│ │ │ +
2019 return std::make_pair(unused.value(), aggregated.value());
│ │ │ +
2020 }
│ │ │ +
2021
│ │ │ +
2022
│ │ │ +
2023 template<class G>
│ │ │ +
2024 int Aggregator<G>::aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2025 {
│ │ │ +
2026 DependencyCounter counter;
│ │ │ +
2027 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ +
2028 return counter.value();
│ │ │ +
2029 }
│ │ │ +
2030
│ │ │ +
2031 template<class G>
│ │ │ +
2032 std::size_t Aggregator<G>::distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates)
│ │ │ +
2033 {
│ │ │ +
2034 return 0;
│ │ │ +
2035 typename PropertyMapTypeSelector<VertexVisitedTag,G>::Type visitedMap = get(VertexVisitedTag(), *graph_);
│ │ │ +
2036 VertexList vlist;
│ │ │ +
2037 typename AggregatesMap<Vertex>::DummyEdgeVisitor dummy;
│ │ │ +
2038 return aggregates.template breadthFirstSearch<true,true>(vertex,
│ │ │ +
2039 aggregate_->id(), *graph_,
│ │ │ +
2040 vlist, dummy, dummy, visitedMap);
│ │ │ +
2041 }
│ │ │ +
2042
│ │ │ +
2043 template<class G>
│ │ │ +
2044 inline Aggregator<G>::FrontMarker::FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph)
│ │ │ +
2045 : front_(front), graph_(graph)
│ │ │ +
2046 {}
│ │ │ +
2047
│ │ │ +
2048 template<class G>
│ │ │ + │ │ │ +
2050 {
│ │ │ +
2051 Vertex target = edge.target();
│ │ │ +
2052
│ │ │ +
2053 if(!graph_.getVertexProperties(target).front()) {
│ │ │ +
2054 front_.push_back(target);
│ │ │ +
2055 graph_.getVertexProperties(target).setFront();
│ │ │ +
2056 }
│ │ │ +
2057 }
│ │ │ +
2058
│ │ │ +
2059 template<class G>
│ │ │ +
2060 inline bool Aggregator<G>::admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2061 {
│ │ │ +
2062 // Todo
│ │ │ +
2063 Dune::dvverb<<" Admissible not yet implemented!"<<std::endl;
│ │ │ +
2064 return true;
│ │ │ +
2065 //Situation 1: front node depends on two nodes. Then these
│ │ │ +
2066 // have to be strongly connected to each other
│ │ │ +
2067
│ │ │ +
2068 // Iterate over all all neighbours of front node
│ │ │ +
2069 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ +
2070 Iterator vend = graph_->endEdges(vertex);
│ │ │ +
2071 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ +
2072 // if(edge.properties().depends() && !edge.properties().influences()
│ │ │ +
2073 if(edge.properties().isStrong()
│ │ │ +
2074 && aggregates[edge.target()]==aggregate)
│ │ │ +
2075 {
│ │ │ +
2076 // Search for another link to the aggregate
│ │ │ +
2077 Iterator edge1 = edge;
│ │ │ +
2078 for(++edge1; edge1 != vend; ++edge1) {
│ │ │ +
2079 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ +
2080 if(edge1.properties().isStrong()
│ │ │ +
2081 && aggregates[edge.target()]==aggregate)
│ │ │ +
2082 {
│ │ │ +
2083 //Search for an edge connecting the two vertices that is
│ │ │ +
2084 //strong
│ │ │ +
2085 bool found=false;
│ │ │ +
2086 Iterator v2end = graph_->endEdges(edge.target());
│ │ │ +
2087 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; ++edge2) {
│ │ │ +
2088 if(edge2.target()==edge1.target() &&
│ │ │ +
2089 edge2.properties().isStrong()) {
│ │ │ +
2090 found =true;
│ │ │ +
2091 break;
│ │ │ +
2092 }
│ │ │ +
2093 }
│ │ │ +
2094 if(found)
│ │ │ +
2095 {
│ │ │ +
2096 return true;
│ │ │ +
2097 }
│ │ │ +
2098 }
│ │ │ +
2099 }
│ │ │ +
2100 }
│ │ │ +
2101 }
│ │ │ +
2102
│ │ │ +
2103 // Situation 2: cluster node depends on front node and other cluster node
│ │ │ +
2105 vend = graph_->endEdges(vertex);
│ │ │ +
2106 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ +
2107 //if(!edge.properties().depends() && edge.properties().influences()
│ │ │ +
2108 if(edge.properties().isStrong()
│ │ │ +
2109 && aggregates[edge.target()]==aggregate)
│ │ │ +
2110 {
│ │ │ +
2111 // Search for a link from target that stays within the aggregate
│ │ │ +
2112 Iterator v1end = graph_->endEdges(edge.target());
│ │ │ +
2113
│ │ │ +
2114 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; ++edge1) {
│ │ │ +
2115 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ +
2116 if(edge1.properties().isStrong()
│ │ │ +
2117 && aggregates[edge1.target()]==aggregate)
│ │ │ +
2118 {
│ │ │ +
2119 bool found=false;
│ │ │ +
2120 // Check if front node is also connected to this one
│ │ │ +
2121 Iterator v2end = graph_->endEdges(vertex);
│ │ │ +
2122 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) {
│ │ │ +
2123 if(edge2.target()==edge1.target()) {
│ │ │ +
2124 if(edge2.properties().isStrong())
│ │ │ +
2125 found=true;
│ │ │ +
2126 break;
│ │ │ +
2127 }
│ │ │ +
2128 }
│ │ │ +
2129 if(found)
│ │ │ +
2130 {
│ │ │ +
2131 return true;
│ │ │ +
2132 }
│ │ │ +
2133 }
│ │ │ +
2134 }
│ │ │ +
2135 }
│ │ │ +
2136 }
│ │ │ +
2137 return false;
│ │ │ +
2138 }
│ │ │ +
2139
│ │ │ +
2140 template<class G>
│ │ │ +
2141 void Aggregator<G>::unmarkFront()
│ │ │ +
2142 {
│ │ │ +
2143 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2144
│ │ │ +
2145 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex)
│ │ │ +
2146 graph_->getVertexProperties(*vertex).resetFront();
│ │ │ +
2147
│ │ │ +
2148 front_.clear();
│ │ │ +
2149 }
│ │ │ +
2150
│ │ │ +
2151 template<class G>
│ │ │ +
2152 inline void
│ │ │ +
2153 Aggregator<G>::nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ +
2154 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
2155 SLList<Vertex>& neighbours) const
│ │ │ +
2156 {
│ │ │ +
2157 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ +
2158 Iterator end=graph_->beginEdges(vertex);
│ │ │ +
2159 neighbours.clear();
│ │ │ +
2160
│ │ │ +
2161 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge)
│ │ │ +
2162 {
│ │ │ +
2163 if(aggregates[edge.target()]!=AggregatesMap<Vertex>::UNAGGREGATED && graph_->getVertexProperties(edge.target()).isolated())
│ │ │ +
2164 neighbours.push_back(aggregates[edge.target()]);
│ │ │ +
2165 }
│ │ │ +
2166 }
│ │ │ +
2167
│ │ │ +
2168 template<class G>
│ │ │ +
2169 inline typename G::VertexDescriptor Aggregator<G>::mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2170 {
│ │ │ +
2171 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ +
2172
│ │ │ +
2173 Iterator end = graph_->endEdges(vertex);
│ │ │ +
2174 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) {
│ │ │ +
2175 if(aggregates[edge.target()] != AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ +
2176 graph_->getVertexProperties(edge.target()).isolated() == graph_->getVertexProperties(edge.source()).isolated()) {
│ │ │ +
2177 if( graph_->getVertexProperties(vertex).isolated() ||
│ │ │ +
2178 ((edge.properties().depends() || edge.properties().influences())
│ │ │ +
2179 && admissible(vertex, aggregates[edge.target()], aggregates)))
│ │ │ +
2180 return edge.target();
│ │ │ +
2181 }
│ │ │ +
2182 }
│ │ │ +
2183 return AggregatesMap<Vertex>::UNAGGREGATED;
│ │ │ +
2184 }
│ │ │ +
2185
│ │ │ +
2186 template<class G>
│ │ │ + │ │ │ +
2188 : Counter(), graph_(graph)
│ │ │ +
2189 {}
│ │ │ +
2190
│ │ │ +
2191 template<class G>
│ │ │ + │ │ │ +
2193 {
│ │ │ +
2194 if(graph_.getVertexProperties(edge.target()).front())
│ │ │ + │ │ │ +
2196 }
│ │ │ +
2197
│ │ │ +
2198 template<class G>
│ │ │ +
2199 int Aggregator<G>::noFrontNeighbours(const Vertex& vertex) const
│ │ │ +
2200 {
│ │ │ +
2201 FrontNeighbourCounter counter(*graph_);
│ │ │ +
2202 visitNeighbours(*graph_, vertex, counter);
│ │ │ +
2203 return counter.value();
│ │ │ +
2204 }
│ │ │ +
2205 template<class G>
│ │ │ +
2206 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ +
2207 const AggregateDescriptor& aggregate,
│ │ │ +
2208 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2209 {
│ │ │ +
2210 typedef typename G::ConstEdgeIterator iterator;
│ │ │ +
2211 const iterator end = graph_->endEdges(vertex);
│ │ │ +
2212 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge)
│ │ │ +
2213 if(aggregates[edge.target()]==aggregate)
│ │ │ +
2214 return true;
│ │ │ +
2215 return false;
│ │ │ +
2216 }
│ │ │ +
2217 template<class G>
│ │ │ +
2218 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ +
2219 const SLList<AggregateDescriptor>& aggregateList,
│ │ │ +
2220 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2221 {
│ │ │ +
2222 typedef typename SLList<AggregateDescriptor>::const_iterator Iter;
│ │ │ +
2223 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i)
│ │ │ +
2224 if(connected(vertex, *i, aggregates))
│ │ │ +
2225 return true;
│ │ │ +
2226 return false;
│ │ │ +
2227 }
│ │ │ +
2228
│ │ │ +
2229 template<class G>
│ │ │ +
2230 template<class C>
│ │ │ +
2231 void Aggregator<G>::growIsolatedAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ +
2232 {
│ │ │ +
2233 SLList<Vertex> connectedAggregates;
│ │ │ +
2234 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates);
│ │ │ +
2235
│ │ │ +
2236 while(aggregate_->size()< c.minAggregateSize() && aggregate_->connectSize() < c.maxConnectivity()) {
│ │ │ +
2237 double maxCon=-1;
│ │ │ +
2238 std::size_t maxFrontNeighbours=0;
│ │ │ +
2239
│ │ │ +
2240 Vertex candidate=AggregatesMap<Vertex>::UNAGGREGATED;
│ │ │ +
2241
│ │ │ +
2242 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2243
│ │ │ +
2244 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ +
2245 if(distance(*vertex, aggregates)>c.maxDistance())
│ │ │ +
2246 continue; // distance of proposes aggregate too big
│ │ │ +
2247
│ │ │ +
2248 if(connectedAggregates.size()>0) {
│ │ │ +
2249 // there is already a neighbour cluster
│ │ │ +
2250 // front node must be connected to same neighbour cluster
│ │ │ +
2251
│ │ │ +
2252 if(!connected(*vertex, connectedAggregates, aggregates))
│ │ │ +
2253 continue;
│ │ │ +
2254 }
│ │ │ +
2255
│ │ │ +
2256 double con = connectivity(*vertex, aggregates);
│ │ │ +
2257
│ │ │ +
2258 if(con == maxCon) {
│ │ │ +
2259 std::size_t frontNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2260
│ │ │ +
2261 if(frontNeighbours >= maxFrontNeighbours) {
│ │ │ +
2262 maxFrontNeighbours = frontNeighbours;
│ │ │ +
2263 candidate = *vertex;
│ │ │ +
2264 }
│ │ │ +
2265 }else if(con > maxCon) {
│ │ │ +
2266 maxCon = con;
│ │ │ +
2267 maxFrontNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2268 candidate = *vertex;
│ │ │ +
2269 }
│ │ │ +
2270 }
│ │ │ +
2271
│ │ │ +
2272 if(candidate==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ +
2273 break;
│ │ │ +
2274
│ │ │ +
2275 aggregate_->add(candidate);
│ │ │ +
2276 }
│ │ │ +
2277 }
│ │ │ +
2278
│ │ │ +
2279 template<class G>
│ │ │ +
2280 template<class C>
│ │ │ +
2281 void Aggregator<G>::growAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ +
2282 {
│ │ │ +
2283 using std::min;
│ │ │ +
2284
│ │ │ +
2285 std::size_t distance_ =0;
│ │ │ +
2286 while(aggregate_->size() < c.minAggregateSize()&& distance_<c.maxDistance()) {
│ │ │ +
2287 int maxTwoCons=0, maxOneCons=0, maxNeighbours=-1;
│ │ │ +
2288 double maxCon=-1;
│ │ │ +
2289
│ │ │ +
2290 std::vector<Vertex> candidates;
│ │ │ +
2291 candidates.reserve(30);
│ │ │ +
2292
│ │ │ +
2293 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2294
│ │ │ +
2295 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ +
2296 // Only nonisolated nodes are considered
│ │ │ +
2297 if(graph_->getVertexProperties(*vertex).isolated())
│ │ │ +
2298 continue;
│ │ │ +
2299
│ │ │ +
2300 int twoWayCons = twoWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ +
2301
│ │ │ +
2302 /* The case of two way connections. */
│ │ │ +
2303 if( maxTwoCons == twoWayCons && twoWayCons > 0) {
│ │ │ +
2304 double con = connectivity(*vertex, aggregates);
│ │ │ +
2305
│ │ │ +
2306 if(con == maxCon) {
│ │ │ +
2307 int neighbours = noFrontNeighbours(*vertex);
│ │ │ +
2308
│ │ │ +
2309 if(neighbours > maxNeighbours) {
│ │ │ +
2310 maxNeighbours = neighbours;
│ │ │ +
2311 candidates.clear();
│ │ │ +
2312 candidates.push_back(*vertex);
│ │ │ +
2313 }else{
│ │ │ +
2314 candidates.push_back(*vertex);
│ │ │ +
2315 }
│ │ │ +
2316 }else if( con > maxCon) {
│ │ │ +
2317 maxCon = con;
│ │ │ +
2318 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2319 candidates.clear();
│ │ │ +
2320 candidates.push_back(*vertex);
│ │ │ +
2321 }
│ │ │ +
2322 }else if(twoWayCons > maxTwoCons) {
│ │ │ +
2323 maxTwoCons = twoWayCons;
│ │ │ +
2324 maxCon = connectivity(*vertex, aggregates);
│ │ │ +
2325 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2326 candidates.clear();
│ │ │ +
2327 candidates.push_back(*vertex);
│ │ │ +
2328
│ │ │ +
2329 // two way connections precede
│ │ │ +
2330 maxOneCons = std::numeric_limits<int>::max();
│ │ │ +
2331 }
│ │ │ +
2332
│ │ │ +
2333 if(twoWayCons > 0)
│ │ │ +
2334 {
│ │ │ +
2335 continue; // THis is a two-way node, skip tests for one way nodes
│ │ │ +
2336 }
│ │ │ +
2337
│ │ │ +
2338 /* The one way case */
│ │ │ +
2339 int oneWayCons = oneWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ +
2340
│ │ │ +
2341 if(oneWayCons==0)
│ │ │ +
2342 continue; // No strong connections, skip the tests.
│ │ │ +
2343
│ │ │ +
2344 if(!admissible(*vertex, aggregate_->id(), aggregates))
│ │ │ +
2345 continue;
│ │ │ +
2346
│ │ │ +
2347 if( maxOneCons == oneWayCons && oneWayCons > 0) {
│ │ │ +
2348 double con = connectivity(*vertex, aggregates);
│ │ │ +
2349
│ │ │ +
2350 if(con == maxCon) {
│ │ │ +
2351 int neighbours = noFrontNeighbours(*vertex);
│ │ │ +
2352
│ │ │ +
2353 if(neighbours > maxNeighbours) {
│ │ │ +
2354 maxNeighbours = neighbours;
│ │ │ +
2355 candidates.clear();
│ │ │ +
2356 candidates.push_back(*vertex);
│ │ │ +
2357 }else{
│ │ │ +
2358 if(neighbours==maxNeighbours)
│ │ │ +
2359 {
│ │ │ +
2360 candidates.push_back(*vertex);
│ │ │ +
2361 }
│ │ │ +
2362 }
│ │ │ +
2363 }else if( con > maxCon) {
│ │ │ +
2364 maxCon = con;
│ │ │ +
2365 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2366 candidates.clear();
│ │ │ +
2367 candidates.push_back(*vertex);
│ │ │ +
2368 }
│ │ │ +
2369 }else if(oneWayCons > maxOneCons) {
│ │ │ +
2370 maxOneCons = oneWayCons;
│ │ │ +
2371 maxCon = connectivity(*vertex, aggregates);
│ │ │ +
2372 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2373 candidates.clear();
│ │ │ +
2374 candidates.push_back(*vertex);
│ │ │ +
2375 }
│ │ │ +
2376 }
│ │ │ +
2377
│ │ │ +
2378
│ │ │ +
2379 if(!candidates.size())
│ │ │ +
2380 break; // No more candidates found
│ │ │ +
2381 distance_=distance(seed, aggregates);
│ │ │ +
2382 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ +
2383 aggregate_->size()));
│ │ │ +
2384 aggregate_->add(candidates);
│ │ │ +
2385 }
│ │ │ +
2386 }
│ │ │ +
2387
│ │ │ +
2388 template<typename V>
│ │ │ +
2389 template<typename M, typename G, typename C>
│ │ │ +
2390 std::tuple<int,int,int,int> AggregatesMap<V>::buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ +
2391 bool finestLevel)
│ │ │ +
2392 {
│ │ │ +
2393 Aggregator<G> aggregator;
│ │ │ +
2394 return aggregator.build(matrix, graph, *this, criterion, finestLevel);
│ │ │ +
2395 }
│ │ │ +
2396
│ │ │ +
2397 template<class G>
│ │ │ +
2398 template<class M, class C>
│ │ │ +
2399 std::tuple<int,int,int,int> Aggregator<G>::build(const M& m, G& graph, AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ +
2400 bool finestLevel)
│ │ │ +
2401 {
│ │ │ +
2402 using std::max;
│ │ │ +
2403 using std::min;
│ │ │ +
2404 // Stack for fast vertex access
│ │ │ +
2405 Stack stack_(graph, *this, aggregates);
│ │ │ +
2406
│ │ │ +
2407 graph_ = &graph;
│ │ │ +
2408
│ │ │ +
2409 aggregate_ = new Aggregate<G,VertexSet>(graph, aggregates, connected_, front_);
│ │ │ +
2410
│ │ │ +
2411 Timer watch;
│ │ │ +
2412 watch.reset();
│ │ │ +
2413
│ │ │ +
2414 buildDependency(graph, m, c, finestLevel);
│ │ │ +
2415
│ │ │ +
2416 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
2417 int noAggregates, conAggregates, isoAggregates, oneAggregates;
│ │ │ +
2418 std::size_t maxA=0, minA=1000000, avg=0;
│ │ │ +
2419 int skippedAggregates;
│ │ │ +
2420 noAggregates = conAggregates = isoAggregates = oneAggregates =
│ │ │ +
2421 skippedAggregates = 0;
│ │ │ +
2422
│ │ │ +
2423 while(true) {
│ │ │ +
2424 Vertex seed = stack_.pop();
│ │ │ +
2425
│ │ │ +
2426 if(seed == Stack::NullEntry)
│ │ │ +
2427 // No more unaggregated vertices. We are finished!
│ │ │ +
2428 break;
│ │ │ +
2429
│ │ │ +
2430 // Debugging output
│ │ │ +
2431 if((noAggregates+1)%10000 == 0)
│ │ │ +
2432 Dune::dverb<<"c";
│ │ │ +
2433 unmarkFront();
│ │ │ +
2434
│ │ │ +
2435 if(graph.getVertexProperties(seed).excludedBorder()) {
│ │ │ +
2436 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ +
2437 ++skippedAggregates;
│ │ │ +
2438 continue;
│ │ │ +
2439 }
│ │ │ +
2440
│ │ │ +
2441 if(graph.getVertexProperties(seed).isolated()) {
│ │ │ +
2442 if(c.skipIsolated()) {
│ │ │ +
2443 // isolated vertices are not aggregated but skipped on the coarser levels.
│ │ │ +
2444 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ +
2445 ++skippedAggregates;
│ │ │ +
2446 // skip rest as no agglomeration is done.
│ │ │ +
2447 continue;
│ │ │ +
2448 }else{
│ │ │ +
2449 aggregate_->seed(seed);
│ │ │ +
2450 growIsolatedAggregate(seed, aggregates, c);
│ │ │ +
2451 }
│ │ │ +
2452 }else{
│ │ │ +
2453 aggregate_->seed(seed);
│ │ │ +
2454 growAggregate(seed, aggregates, c);
│ │ │ +
2455 }
│ │ │ +
2456
│ │ │ +
2457 /* The rounding step. */
│ │ │ +
2458 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->size() < c.maxAggregateSize()) {
│ │ │ +
2459
│ │ │ +
2460 std::vector<Vertex> candidates;
│ │ │ +
2461 candidates.reserve(30);
│ │ │ +
2462
│ │ │ +
2463 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2464
│ │ │ +
2465 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ +
2466
│ │ │ +
2467 if(graph.getVertexProperties(*vertex).isolated())
│ │ │ +
2468 continue; // No isolated nodes here
│ │ │ +
2469
│ │ │ +
2470 if(twoWayConnections( *vertex, aggregate_->id(), aggregates) == 0 &&
│ │ │ +
2471 (oneWayConnections( *vertex, aggregate_->id(), aggregates) == 0 ||
│ │ │ +
2472 !admissible( *vertex, aggregate_->id(), aggregates) ))
│ │ │ +
2473 continue;
│ │ │ +
2474
│ │ │ +
2475 std::pair<int,int> neighbourPair=neighbours(*vertex, aggregate_->id(),
│ │ │ +
2476 aggregates);
│ │ │ +
2477
│ │ │ +
2478 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= unusedNeighbours(*vertex, aggregates))
│ │ │ +
2479 // continue;
│ │ │ +
2480
│ │ │ +
2481 if(neighbourPair.first >= neighbourPair.second)
│ │ │ +
2482 continue;
│ │ │ +
2483
│ │ │ +
2484 if(distance(*vertex, aggregates) > c.maxDistance())
│ │ │ +
2485 continue; // Distance too far
│ │ │ +
2486 candidates.push_back(*vertex);
│ │ │ +
2487 break;
│ │ │ +
2488 }
│ │ │ +
2489
│ │ │ +
2490 if(!candidates.size()) break; // no more candidates found.
│ │ │ +
2491
│ │ │ +
2492 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ +
2493 aggregate_->size()));
│ │ │ +
2494 aggregate_->add(candidates);
│ │ │ +
2495
│ │ │ +
2496 }
│ │ │ +
2497
│ │ │ +
2498 // try to merge aggregates consisting of only one nonisolated vertex with other aggregates
│ │ │ +
2499 if(aggregate_->size()==1 && c.maxAggregateSize()>1) {
│ │ │ +
2500 if(!graph.getVertexProperties(seed).isolated()) {
│ │ │ +
2501 Vertex mergedNeighbour = mergeNeighbour(seed, aggregates);
│ │ │ +
2502
│ │ │ +
2503 if(mergedNeighbour != AggregatesMap<Vertex>::UNAGGREGATED) {
│ │ │ +
2504 // assign vertex to the neighbouring cluster
│ │ │ +
2505 aggregates[seed] = aggregates[mergedNeighbour];
│ │ │ +
2506 aggregate_->invalidate();
│ │ │ +
2507 }else{
│ │ │ +
2508 ++avg;
│ │ │ +
2509 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ +
2510 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ +
2511 ++oneAggregates;
│ │ │ +
2512 ++conAggregates;
│ │ │ +
2513 }
│ │ │ +
2514 }else{
│ │ │ +
2515 ++avg;
│ │ │ +
2516 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ +
2517 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ +
2518 ++oneAggregates;
│ │ │ +
2519 ++isoAggregates;
│ │ │ +
2520 }
│ │ │ +
2521 ++avg;
│ │ │ +
2522 }else{
│ │ │ +
2523 avg+=aggregate_->size();
│ │ │ +
2524 minA=min(minA,aggregate_->size());
│ │ │ +
2525 maxA=max(maxA,aggregate_->size());
│ │ │ +
2526 if(graph.getVertexProperties(seed).isolated())
│ │ │ +
2527 ++isoAggregates;
│ │ │ +
2528 else
│ │ │ +
2529 ++conAggregates;
│ │ │ +
2530 }
│ │ │ +
2531
│ │ │ +
2532 }
│ │ │ +
2533
│ │ │ +
2534 Dune::dinfo<<"connected aggregates: "<<conAggregates;
│ │ │ +
2535 Dune::dinfo<<" isolated aggregates: "<<isoAggregates;
│ │ │ +
2536 if(conAggregates+isoAggregates>0)
│ │ │ +
2537 Dune::dinfo<<" one node aggregates: "<<oneAggregates<<" min size="
│ │ │ +
2538 <<minA<<" max size="<<maxA
│ │ │ +
2539 <<" avg="<<avg/(conAggregates+isoAggregates)<<std::endl;
│ │ │ +
2540
│ │ │ +
2541 delete aggregate_;
│ │ │ +
2542 return std::make_tuple(conAggregates+isoAggregates,isoAggregates,
│ │ │ +
2543 oneAggregates,skippedAggregates);
│ │ │ +
2544 }
│ │ │ +
2545
│ │ │ +
2546
│ │ │ +
2547 template<class G>
│ │ │ +
2548 Aggregator<G>::Stack::Stack(const MatrixGraph& graph, const Aggregator<G>& aggregatesBuilder,
│ │ │ +
2549 const AggregatesMap<Vertex>& aggregates)
│ │ │ +
2550 : graph_(graph), aggregatesBuilder_(aggregatesBuilder), aggregates_(aggregates), begin_(graph.begin()), end_(graph.end())
│ │ │ +
2551 {
│ │ │ +
2552 //vals_ = new Vertex[N];
│ │ │ +
2553 }
│ │ │ +
2554
│ │ │ +
2555 template<class G>
│ │ │ + │ │ │ +
2557 {
│ │ │ +
2558 //Dune::dverb << "Max stack size was "<<maxSize_<<" filled="<<filled_<<std::endl;
│ │ │ +
2559 //delete[] vals_;
│ │ │ +
2560 }
│ │ │ +
2561
│ │ │ +
2562 template<class G>
│ │ │ + │ │ │ +
2564 = std::numeric_limits<typename G::VertexDescriptor>::max();
│ │ │ +
2565
│ │ │ +
2566 template<class G>
│ │ │ +
2567 inline typename G::VertexDescriptor Aggregator<G>::Stack::pop()
│ │ │ +
2568 {
│ │ │ +
2569 for(; begin_!=end_ && aggregates_[*begin_] != AggregatesMap<Vertex>::UNAGGREGATED; ++begin_) ;
│ │ │ +
2570
│ │ │ +
2571 if(begin_!=end_)
│ │ │ +
2572 {
│ │ │ +
2573 typename G::VertexDescriptor current=*begin_;
│ │ │ +
2574 ++begin_;
│ │ │ +
2575 return current;
│ │ │ +
2576 }else
│ │ │ +
2577 return NullEntry;
│ │ │ +
2578 }
│ │ │ +
2579
│ │ │ +
2580#endif // DOXYGEN
│ │ │ +
2581
│ │ │ +
2582 template<class V>
│ │ │ +
│ │ │ +
2583 void printAggregates2d(const AggregatesMap<V>& aggregates, int n, int m, std::ostream& os)
│ │ │ +
2584 {
│ │ │ +
2585 using std::max;
│ │ │ +
2586
│ │ │ +
2587 std::ios_base::fmtflags oldOpts=os.flags();
│ │ │ +
2588
│ │ │ +
2589 os.setf(std::ios_base::right, std::ios_base::adjustfield);
│ │ │ +
2590
│ │ │ +
2591 V maxVal=0;
│ │ │ +
2592 int width=1;
│ │ │ +
2593
│ │ │ +
2594 for(int i=0; i< n*m; i++)
│ │ │ +
2595 maxVal=max(maxVal, aggregates[i]);
│ │ │ +
2596
│ │ │ +
2597 for(int i=10; i < 1000000; i*=10)
│ │ │ +
2598 if(maxVal/i>0)
│ │ │ +
2599 width++;
│ │ │ +
2600 else
│ │ │ +
2601 break;
│ │ │ +
2602
│ │ │ +
2603 for(int j=0, entry=0; j < m; j++) {
│ │ │ +
2604 for(int i=0; i<n; i++, entry++) {
│ │ │ +
2605 os.width(width);
│ │ │ +
2606 os<<aggregates[entry]<<" ";
│ │ │ +
2607 }
│ │ │ +
2608
│ │ │ +
2609 os<<std::endl;
│ │ │ +
2610 }
│ │ │ +
2611 os<<std::endl;
│ │ │ +
2612 os.flags(oldOpts);
│ │ │ +
2613 }
│ │ │ +
│ │ │ +
2614
│ │ │ +
2615
│ │ │ +
2616 } // namespace Amg
│ │ │ +
2617
│ │ │ +
2618} // namespace Dune
│ │ │ +
2619
│ │ │ +
2620
│ │ │ +
2621#endif
│ │ │ +
Provides classes for handling internal properties in a graph.
│ │ │ +
Provides classes for building the matrix graph.
│ │ │ + │ │ │ +
Parameter classes for customizing AMG.
│ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:273
│ │ │ +
std::vector< real_type >::iterator valIter_
Definition aggregates.hh:189
│ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:154
│ │ │ +
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, L &visited, F1 &aggregateVisitor, F2 &nonAggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ +
PoolAllocator< VertexDescriptor, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:586
│ │ │ +
iterator begin()
Definition aggregates.hh:737
│ │ │ +
int id()
Get the id identifying the aggregate.
│ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:302
│ │ │ +
MatrixGraph::VertexDescriptor Vertex
The vertex identifier.
Definition aggregates.hh:920
│ │ │ +
AggregationCriterion()
Constructor.
Definition aggregates.hh:66
│ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:357
│ │ │ +
auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr) const
Compute the norm of a scalar.
Definition aggregates.hh:406
│ │ │ +
void initRow(const Row &row, int index)
│ │ │ +
SymmetricMatrixDependency(const Parameters &parms)
Definition aggregates.hh:168
│ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:258
│ │ │ + │ │ │ +
G MatrixGraph
The matrix graph type used.
Definition aggregates.hh:915
│ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:363
│ │ │ +
void operator()(const EdgeIterator &edge) const
Definition aggregates.hh:601
│ │ │ +
SymmetricCriterion()
Definition aggregates.hh:524
│ │ │ +
Dependency()
Definition aggregates.hh:290
│ │ │ +
void examine(const ColIter &col)
│ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:319
│ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:187
│ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:263
│ │ │ +
iterator end()
Definition aggregates.hh:742
│ │ │ +
UnSymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:541
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
void initRow(const Row &row, int index)
Definition aggregates.hh:201
│ │ │ + │ │ │ +
static const Vertex NullEntry
Definition aggregates.hh:1008
│ │ │ +
void examine(const ColIter &col)
Definition aggregates.hh:214
│ │ │ +
Dependency(const Parameters &parms)
Definition aggregates.hh:286
│ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:185
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
std::tuple< int, int, int, int > build(const M &m, G &graph, AggregatesMap< Vertex > &aggregates, const C &c, bool finestLevel)
Build the aggregates.
│ │ │ +
FrontNeighbourCounter(const MatrixGraph &front)
Constructor.
│ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:329
│ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:296
│ │ │ +
const AggregateDescriptor & operator[](const VertexDescriptor &v) const
Get the aggregate a vertex belongs to.
│ │ │ +
void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter &col)
│ │ │ +
AggregateVisitor(const AggregatesMap< Vertex > &aggregates, const AggregateDescriptor &aggregate, Visitor &visitor)
Constructor.
│ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:334
│ │ │ +
~AggregatesMap()
Destructor.
│ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:179
│ │ │ +
void decrement()
Decrement counter.
│ │ │ +
Aggregate(MatrixGraph &graph, AggregatesMap< Vertex > &aggregates, VertexSet &connectivity, std::vector< Vertex > &front_)
Constructor.
│ │ │ +
V Visitor
The type of the adapted visitor.
Definition aggregates.hh:1064
│ │ │ +
std::size_t * SphereMap
Type of the mapping of aggregate members onto distance spheres.
Definition aggregates.hh:809
│ │ │ +
AggregationCriterion(const Parameters &parms)
Definition aggregates.hh:70
│ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:268
│ │ │ +
VertexSet::size_type connectSize()
Get the number of connections to other aggregates.
│ │ │ +
std::vector< real_type > vals_
Definition aggregates.hh:188
│ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:324
│ │ │ +
void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, std::ostream &os)
Definition aggregates.hh:2583
│ │ │ +
void invalidate()
Definition aggregates.hh:822
│ │ │ +
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ +
real_type maxValue_
Definition aggregates.hh:181
│ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:183
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
VertexSet::const_iterator const_iterator
Const iterator over a vertex list.
Definition aggregates.hh:804
│ │ │ +
SymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:521
│ │ │ +
MatrixGraph::VertexDescriptor AggregateDescriptor
The type of the aggregate descriptor.
Definition aggregates.hh:923
│ │ │ +
real_type maxValue_
Definition aggregates.hh:361
│ │ │ +
void init(const Matrix *matrix)
Definition aggregates.hh:195
│ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:367
│ │ │ +
AggregateDescriptor * iterator
Definition aggregates.hh:735
│ │ │ +
SymmetricDependency(const Parameters &parms)
Definition aggregates.hh:348
│ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:360
│ │ │ +
~Aggregator()
Destructor.
│ │ │ +
void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter &col)
│ │ │ +
void add(const Vertex &vertex)
Add a vertex to the aggregate.
│ │ │ +
T DependencyPolicy
The policy for calculating the dependency graph.
Definition aggregates.hh:55
│ │ │ +
void add(std::vector< Vertex > &vertex)
│ │ │ +
void examine(const ColIter &col)
│ │ │ +
Aggregator()
Constructor.
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
Examine an edge.
│ │ │ +
FrontMarker(std::vector< Vertex > &front, MatrixGraph &graph)
Constructor.
│ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:506
│ │ │ +
void init(const Matrix *matrix)
│ │ │ +
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ +
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition aggregates.hh:82
│ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ +
V AggregateDescriptor
The aggregate descriptor type.
Definition aggregates.hh:580
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:365
│ │ │ +
SymmetricMatrixDependency()
Definition aggregates.hh:171
│ │ │ + │ │ │ + │ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:306
│ │ │ +
std::size_t noVertices() const
Get the number of vertices.
│ │ │ +
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an aisotropic problem.
Definition aggregates.hh:105
│ │ │ +
AggregatesMap(std::size_t noVertices)
Constructs with allocating memory.
│ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:359
│ │ │ +
AggregateDescriptor & operator[](const VertexDescriptor &v)
Get the aggregate a vertex belongs to.
│ │ │ +
AggregatesMap()
Constructs without allocating memory.
│ │ │ +
int value()
Access the current count.
│ │ │ +
SLList< VertexDescriptor, Allocator > VertexList
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:592
│ │ │ + │ │ │ +
ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > &aggregates)
Constructor.
│ │ │ +
VertexSet::size_type size()
Get the size of the aggregate.
│ │ │ +
const_iterator end() const
get an iterator over the vertices of the aggregate.
│ │ │ +
void init(const Matrix *matrix)
│ │ │ +
UnSymmetricCriterion()
Definition aggregates.hh:544
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:304
│ │ │ +
Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const AggregatesMap< Vertex > &aggregates)
│ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:180
│ │ │ +
void initRow(const Row &row, int index)
│ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:139
│ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:299
│ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:177
│ │ │ +
S VertexSet
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:801
│ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:490
│ │ │ +
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:566
│ │ │ +
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:298
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:113
│ │ │ +
bool isIsolated()
Definition aggregates.hh:240
│ │ │ +
void allocate(std::size_t noVertices)
Allocate memory for holding the information.
│ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:144
│ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:473
│ │ │ +
void reconstruct(const Vertex &vertex)
Reconstruct the aggregat from an seed node.
│ │ │ +
const_iterator begin() const
get an iterator over the vertices of the aggregate.
│ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m, typename std::enable_if_t<!Dune::IsNumber< M >::value > *sfinae=nullptr) const
compute the norm of a matrix.
Definition aggregates.hh:390
│ │ │ +
MatrixGraph::VertexDescriptor Vertex
The vertex descriptor type.
Definition aggregates.hh:789
│ │ │ +
void seed(const Vertex &vertex)
Initialize the aggregate with one vertex.
│ │ │ + │ │ │ +
SymmetricDependency()
Definition aggregates.hh:351
│ │ │ +
void clear()
Clear the aggregate.
│ │ │ +
void free()
Free the allocated memory.
│ │ │ +
void increment()
Increment counter.
│ │ │ +
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ +
V VertexDescriptor
The vertex descriptor type.
Definition aggregates.hh:575
│ │ │ +
real_type maxValue_
Definition aggregates.hh:300
│ │ │ +
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:149
│ │ │ +
PoolAllocator< Vertex, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:795
│ │ │ +
G MatrixGraph
Definition aggregates.hh:785
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:483
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:382
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:499
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:466
│ │ │
Definition allocator.hh:11
│ │ │ -
bool buildCommunication(const G &graph, std::vector< int > &realparts, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
Definition repartition.hh:1449
│ │ │ -
void fillIndexSetHoles(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm)
Fills the holes in an index set.
Definition repartition.hh:83
│ │ │ -
bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
Definition repartition.hh:822
│ │ │ -
void print_carray(S &os, T *array, std::size_t l)
Definition repartition.hh:771
│ │ │ -
bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T *adjncy, bool checkSymmetry)
Definition repartition.hh:778
│ │ │ -
bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
execute a graph repartition for a giving graph and indexset.
Definition repartition.hh:1228
│ │ │ -
float real_t
Definition repartition.hh:53
│ │ │ -
std::size_t idx_t
Definition repartition.hh:63
│ │ │ -
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ -
const GlobalLookupIndexSet & globalLookup() const
Definition owneroverlapcopy.hh:526
│ │ │ -
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ -
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ -
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ -
void buildGlobalLookup()
Definition owneroverlapcopy.hh:495
│ │ │ -
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ -
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ -
void freeGlobalLookup()
Definition owneroverlapcopy.hh:520
│ │ │ -
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
Definition repartition.hh:260
│ │ │ -
void reserveSpaceForReceiveInterface(int proc, int size)
Definition repartition.hh:284
│ │ │ -
void buildReceiveInterface(std::vector< std::pair< TG, int > > &indices)
Definition repartition.hh:293
│ │ │ -
void setCommunicator(MPI_Comm comm)
Definition repartition.hh:261
│ │ │ -
void buildSendInterface(const std::vector< int > &toPart, const IS &idxset)
Definition repartition.hh:266
│ │ │ -
void addReceiveIndex(int proc, std::size_t idx)
Definition repartition.hh:288
│ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ +
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ +
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ +
Base class of all aggregation criterions.
Definition aggregates.hh:49
│ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:134
│ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:253
│ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:314
│ │ │ +
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:379
│ │ │ +
Norm that uses only the [0][0] entry of the block to determine couplings.
Definition aggregates.hh:455
│ │ │ +
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:463
│ │ │ +
Definition aggregates.hh:480
│ │ │ +
Definition aggregates.hh:496
│ │ │ +
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:519
│ │ │ +
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:539
│ │ │ +
Class for building the aggregates.
Definition aggregates.hh:909
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:598
│ │ │ +
A class for temporarily storing the vertices of an aggregate in.
Definition aggregates.hh:778
│ │ │ +
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ +
EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:298
│ │ │ +
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ +
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1975 +1,2654 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -repartition.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +aggregates.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_REPARTITION_HH │ │ │ │ -6#define DUNE_ISTL_REPARTITION_HH │ │ │ │ +5#ifndef DUNE_AMG_AGGREGATES_HH │ │ │ │ +6#define DUNE_AMG_AGGREGATES_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12 │ │ │ │ -13#if HAVE_PARMETIS │ │ │ │ -14// Explicitly use C linkage as scotch does not extern "C" in its headers. │ │ │ │ -15// Works because ParMETIS/METIS checks whether compiler is C++ and otherwise │ │ │ │ -16// does not use extern "C". Therefore no nested extern "C" will be created. │ │ │ │ -17extern "C" │ │ │ │ -18{ │ │ │ │ -19#include │ │ │ │ -20} │ │ │ │ -21#endif │ │ │ │ -22 │ │ │ │ -23#include │ │ │ │ -24#include │ │ │ │ -25#include │ │ │ │ -26#include │ │ │ │ -27#include │ │ │ │ -28#include │ │ │ │ -29#include │ │ │ │ -30#include │ │ │ │ -31#include │ │ │ │ -32 │ │ │ │ -33#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ -34#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ -35 │ │ │ │ -44namespace _D_u_n_e │ │ │ │ -45{ │ │ │ │ -_4_6 namespace Metis │ │ │ │ -47 { │ │ │ │ -48 // Explicitly specify a real_t and idx_t for older (Par)METIS versions that │ │ │ │ -do not │ │ │ │ -49 // provide these typedefs │ │ │ │ -50#if HAVE_PARMETIS && defined(REALTYPEWIDTH) │ │ │ │ -51 using _r_e_a_l___t = _:_:_r_e_a_l___t; │ │ │ │ -52#else │ │ │ │ -_5_3 using _r_e_a_l___t = float; │ │ │ │ -54#endif │ │ │ │ -55 │ │ │ │ -56#if HAVE_PARMETIS && defined(IDXTYPEWIDTH) │ │ │ │ -57 using _i_d_x___t = _:_:_i_d_x___t; │ │ │ │ -58#elif HAVE_PARMETIS && defined(HAVE_SCOTCH_NUM_TYPE) │ │ │ │ -59 using _i_d_x___t = SCOTCH_Num; │ │ │ │ -60#elif HAVE_PARMETIS │ │ │ │ -61 using _i_d_x___t = int; │ │ │ │ -62#else │ │ │ │ -_6_3 using _i_d_x___t = std::size_t; │ │ │ │ -64#endif │ │ │ │ -65 } │ │ │ │ -66 │ │ │ │ -67 │ │ │ │ -68#if HAVE_MPI │ │ │ │ -82 template │ │ │ │ -_8_3 void _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(const G& graph, _D_u_n_e_:_: │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm) │ │ │ │ -84 { │ │ │ │ -85 typedef typename _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>_:_: │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t IndexSet; │ │ │ │ -86 typedef typename IndexSet::LocalIndex::Attribute Attribute; │ │ │ │ -87 │ │ │ │ -88 IndexSet& indexSet = oocomm._i_n_d_e_x_S_e_t(); │ │ │ │ -89 const typename _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>_:_: │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& lookup =oocomm._g_l_o_b_a_l_L_o_o_k_u_p(); │ │ │ │ -90 │ │ │ │ -91 std::size_t sum=0, needed = graph.noVertices()-indexSet.size(); │ │ │ │ -92 std::vector neededall(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size(), 0); │ │ │ │ -93 │ │ │ │ -94 MPI_Allgather(&needed, 1, MPITraits::getType() , &(neededall │ │ │ │ -[0]), 1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ -95 for(int i=0; iglobal()); │ │ │ │ -107 │ │ │ │ -108 //Process p creates global indices consecutively │ │ │ │ -109 //starting atmaxgi+\sum_{i=1}^p neededall[i] │ │ │ │ -110 // All created indices are owned by the process │ │ │ │ -111 maxgi=oocomm._c_o_m_m_u_n_i_c_a_t_o_r().max(maxgi); │ │ │ │ -112 ++maxgi; // Start with the next free index. │ │ │ │ -113 │ │ │ │ -114 for(int i=0; i > > globalIndices; │ │ │ │ -119 storeGlobalIndicesOfRemoteIndices(globalIndices, oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s()); │ │ │ │ -120 indexSet.beginResize(); │ │ │ │ -121 │ │ │ │ -122 for(auto vertex = graph.begin(), vend=graph.end(); vertex != vend; │ │ │ │ -++vertex) { │ │ │ │ -123 const typename IndexSet::IndexPair* pair=lookup.pair(*vertex); │ │ │ │ -124 if(pair==0) { │ │ │ │ -125 // No index yet, add new one │ │ │ │ -126 indexSet.add(maxgi, typename IndexSet::LocalIndex(*vertex, │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r, false)); │ │ │ │ -127 ++maxgi; │ │ │ │ -128 } │ │ │ │ -129 } │ │ │ │ -130 │ │ │ │ -131 indexSet.endResize(); │ │ │ │ -132 │ │ │ │ -133 repairLocalIndexPointers(globalIndices, oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s(), indexSet); │ │ │ │ -134 │ │ │ │ -135 oocomm._f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p(); │ │ │ │ -136 oocomm._b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(); │ │ │ │ -137#ifdef DEBUG_REPART │ │ │ │ -138 std::cout<<"Holes are filled!"< │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ +17#include │ │ │ │ +18#include │ │ │ │ +19#include │ │ │ │ +20 │ │ │ │ +21#include │ │ │ │ +22#include │ │ │ │ +23#include │ │ │ │ +24#include │ │ │ │ +25#include │ │ │ │ +26#include │ │ │ │ +27#include │ │ │ │ +28 │ │ │ │ +29namespace _D_u_n_e │ │ │ │ +30{ │ │ │ │ +31 namespace Amg │ │ │ │ +32 { │ │ │ │ +33 │ │ │ │ +47 template │ │ │ │ +_4_8 class _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n : public T │ │ │ │ +49 { │ │ │ │ +50 │ │ │ │ +51 public: │ │ │ │ +_5_5 typedef T _D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y; │ │ │ │ +56 │ │ │ │ +_6_6 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n() │ │ │ │ +67 : T() │ │ │ │ +68 {} │ │ │ │ +69 │ │ │ │ +_7_0 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +71 : T(parms) │ │ │ │ +72 {} │ │ │ │ +_8_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(std::size_t dim, std::size_t diameter=2) │ │ │ │ +83 { │ │ │ │ +84 this->setMaxDistance(diameter-1); │ │ │ │ +85 std::size_t csize=1; │ │ │ │ +86 │ │ │ │ +87 for(; dim>0; dim--) { │ │ │ │ +88 csize*=diameter; │ │ │ │ +89 this->setMaxDistance(this->maxDistance()+diameter-1); │ │ │ │ +90 } │ │ │ │ +91 this->setMinAggregateSize(csize); │ │ │ │ +92 this->setMaxAggregateSize(static_cast(csize*1.5)); │ │ │ │ +93 } │ │ │ │ +94 │ │ │ │ +_1_0_5 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ +106 { │ │ │ │ +107 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ +108 this->setMaxDistance(this->maxDistance()+dim-1); │ │ │ │ +109 } │ │ │ │ +110 }; │ │ │ │ +111 │ │ │ │ +112 template │ │ │ │ +_1_1_3 std::ostream& _o_p_e_r_a_t_o_r_<_<(std::ostream& os, const _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_<_T_>& │ │ │ │ +criterion) │ │ │ │ +114 { │ │ │ │ +115 os<<"{ maxdistance="< │ │ │ │ +_1_3_3 class _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y : public _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +134 { │ │ │ │ +135 public: │ │ │ │ +_1_3_9 typedef M _M_a_t_r_i_x; │ │ │ │ +140 │ │ │ │ +_1_4_4 typedef N _N_o_r_m; │ │ │ │ 145 │ │ │ │ -146 class ParmetisDuneIndexMap │ │ │ │ -147 { │ │ │ │ -148 public: │ │ │ │ -149 template │ │ │ │ -150 ParmetisDuneIndexMap(const Graph& graph, const OOComm& com); │ │ │ │ -151 int toParmetis(int i) const │ │ │ │ -152 { │ │ │ │ -153 return duneToParmetis[i]; │ │ │ │ -154 } │ │ │ │ -155 int toLocalParmetis(int i) const │ │ │ │ -156 { │ │ │ │ -157 return duneToParmetis[i]-base_; │ │ │ │ -158 } │ │ │ │ -159 int operator[](int i) const │ │ │ │ -160 { │ │ │ │ -161 return duneToParmetis[i]; │ │ │ │ -162 } │ │ │ │ -163 int toDune(int i) const │ │ │ │ -164 { │ │ │ │ -165 return parmetisToDune[i]; │ │ │ │ -166 } │ │ │ │ -167 std::vector::size_type numOfOwnVtx() const │ │ │ │ -168 { │ │ │ │ -169 return parmetisToDune.size(); │ │ │ │ -170 } │ │ │ │ -171 _M_e_t_i_s_:_:_i_d_x___t* vtxDist() │ │ │ │ -172 { │ │ │ │ -173 return &vtxDist_[0]; │ │ │ │ -174 } │ │ │ │ -_1_7_5 int _g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s; │ │ │ │ -176 private: │ │ │ │ -177 int base_; │ │ │ │ -178 std::vector duneToParmetis; │ │ │ │ -179 std::vector parmetisToDune; │ │ │ │ -180 // range of vertices for processor i: vtxdist[i] to vtxdist[i+1] (parmetis │ │ │ │ -global) │ │ │ │ -181 std::vector vtxDist_; │ │ │ │ -182 }; │ │ │ │ -183 │ │ │ │ -184 template │ │ │ │ -185 ParmetisDuneIndexMap::ParmetisDuneIndexMap(const G& graph, const OOComm& │ │ │ │ -oocomm) │ │ │ │ -186 : duneToParmetis(graph.noVertices(), -1), vtxDist_(oocomm.communicator │ │ │ │ -().size()+1) │ │ │ │ -187 { │ │ │ │ -188 int npes=oocomm.communicator().size(), mype=oocomm.communicator().rank(); │ │ │ │ -189 │ │ │ │ -190 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ -191 │ │ │ │ -192 int numOfOwnVtx=0; │ │ │ │ -193 auto end = oocomm.indexSet().end(); │ │ │ │ -194 for(auto index = oocomm.indexSet().begin(); index != end; ++index) { │ │ │ │ -195 if (OwnerSet::contains(index->local().attribute())) { │ │ │ │ -196 numOfOwnVtx++; │ │ │ │ -197 } │ │ │ │ +_1_4_9 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ +150 │ │ │ │ +_1_5_4 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ +155 │ │ │ │ +156 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ +157 │ │ │ │ +158 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ +159 │ │ │ │ +160 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ +161 │ │ │ │ +162 template │ │ │ │ +163 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ +_c_o_l); │ │ │ │ +164 │ │ │ │ +165 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ +166 │ │ │ │ +167 │ │ │ │ +_1_6_8 _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +169 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ +170 {} │ │ │ │ +_1_7_1 _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y() │ │ │ │ +172 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ +173 {} │ │ │ │ +174 │ │ │ │ +175 protected: │ │ │ │ +_1_7_7 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ +_1_7_9 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ +_1_8_0 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +_1_8_1 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ +_1_8_3 _N_o_r_m _n_o_r_m__; │ │ │ │ +_1_8_5 int _r_o_w__; │ │ │ │ +_1_8_7 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ +_1_8_8 std::vector _v_a_l_s__; │ │ │ │ +_1_8_9 typename std::vector::iterator _v_a_l_I_t_e_r__; │ │ │ │ +190 │ │ │ │ +191 }; │ │ │ │ +192 │ │ │ │ +193 │ │ │ │ +194 template │ │ │ │ +_1_9_5 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const _M_a_t_r_i_x* matrix) │ │ │ │ +196 { │ │ │ │ +197 matrix_ = matrix; │ │ │ │ 198 } │ │ │ │ -199 parmetisToDune.resize(numOfOwnVtx); │ │ │ │ -200 std::vector globalNumOfVtx(npes); │ │ │ │ -201 // make this number available to all processes │ │ │ │ -202 MPI_Allgather(&numOfOwnVtx, 1, MPI_INT, &(globalNumOfVtx[0]), 1, MPI_INT, │ │ │ │ -oocomm.communicator()); │ │ │ │ -203 │ │ │ │ -204 int base=0; │ │ │ │ -205 vtxDist_[0] = 0; │ │ │ │ -206 for(int i=0; i │ │ │ │ +_2_0_1 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const _R_o_w& row, int │ │ │ │ +index) │ │ │ │ +202 { │ │ │ │ +203 using std::min; │ │ │ │ +204 vals_.assign(row.size(), 0.0); │ │ │ │ +205 assert(vals_.size()==row.size()); │ │ │ │ +206 valIter_=vals_.begin(); │ │ │ │ +207 │ │ │ │ +208 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ +numeric_limits::min()); │ │ │ │ +209 diagonal_=norm_(row[index]); │ │ │ │ +210 row_ = index; │ │ │ │ 211 } │ │ │ │ -212 _g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s=vtxDist_[npes]; │ │ │ │ -213 base_=base; │ │ │ │ -214 │ │ │ │ -215#ifdef DEBUG_REPART │ │ │ │ -216 std::cout << oocomm.communicator().rank()<<" vtxDist: "; │ │ │ │ -217 for(int i=0; i<= npes; ++i) │ │ │ │ -218 std::cout << vtxDist_[i]<<" "; │ │ │ │ -219 std::cout<local().attribute())) { │ │ │ │ -231 // assign and count the index │ │ │ │ -232 parmetisToDune[base-base_]=index->local(); │ │ │ │ -233 duneToParmetis[index->local()] = base++; │ │ │ │ -234 } │ │ │ │ +212 │ │ │ │ +213 template │ │ │ │ +_2_1_4 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l) │ │ │ │ +215 { │ │ │ │ +216 using std::max; │ │ │ │ +217 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ +218 _r_e_a_l___t_y_p_e eij = norm_(*_c_o_l); │ │ │ │ +219 if(!N::is_sign_preserving || eij<0) // || eji<0) │ │ │ │ +220 { │ │ │ │ +221 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](_c_o_l.index()) │ │ │ │ +[_c_o_l.index()]); │ │ │ │ +222 maxValue_ = max(maxValue_, *valIter_); │ │ │ │ +223 }else │ │ │ │ +224 *valIter_ =0; │ │ │ │ +225 ++valIter_; │ │ │ │ +226 } │ │ │ │ +227 │ │ │ │ +228 template │ │ │ │ +229 template │ │ │ │ +_2_3_0 inline void _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G&, const typename G:: │ │ │ │ +EdgeIterator& edge, const _C_o_l_I_t_e_r&) │ │ │ │ +231 { │ │ │ │ +232 if(*valIter_ > alpha() * maxValue_) { │ │ │ │ +233 edge.properties().setDepends(); │ │ │ │ +234 edge.properties().setInfluences(); │ │ │ │ 235 } │ │ │ │ -236 │ │ │ │ -237 // At this point, every process knows the ParMETIS global index │ │ │ │ -238 // of it's owner vertices. The next step is to get the │ │ │ │ -239 // ParMETIS global index of the overlap vertices from the │ │ │ │ -240 // associated processes. To do this, the Dune::Interface class │ │ │ │ -241 // is used. │ │ │ │ -242#ifdef DEBUG_REPART │ │ │ │ -243 std::cout < │ │ │ │ -_2_6_6 void _b_u_i_l_d_S_e_n_d_I_n_t_e_r_f_a_c_e(const std::vector& toPart, const IS& idxset) │ │ │ │ -267 { │ │ │ │ -268 std::map sizes; │ │ │ │ +236 ++valIter_; │ │ │ │ +237 } │ │ │ │ +238 │ │ │ │ +239 template │ │ │ │ +_2_4_0 inline bool _S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ +241 { │ │ │ │ +242 if(diagonal_==0) │ │ │ │ +243 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r, "No diagonal entry for row "< │ │ │ │ +_2_5_2 class _D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ +253 { │ │ │ │ +254 public: │ │ │ │ +_2_5_8 typedef M _M_a_t_r_i_x; │ │ │ │ +259 │ │ │ │ +_2_6_3 typedef N _N_o_r_m; │ │ │ │ +264 │ │ │ │ +_2_6_8 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ 269 │ │ │ │ -270 for(auto i=idxset.begin(), end=idxset.end(); i!=end; ++i) │ │ │ │ -271 if(Flags::contains(i->local().attribute())) │ │ │ │ -272 ++sizes[toPart[i->local()]]; │ │ │ │ -273 │ │ │ │ -274 // Allocate the necessary space │ │ │ │ -275 for(auto i=sizes.begin(), end=sizes.end(); i!=end; ++i) │ │ │ │ -276 interfaces()[i->first].first.reserve(i->second); │ │ │ │ -277 │ │ │ │ -278 //Insert the interface information │ │ │ │ -279 for(auto i=idxset.begin(), end=idxset.end(); i!=end; ++i) │ │ │ │ -280 if(Flags::contains(i->local().attribute())) │ │ │ │ -281 interfaces()[toPart[i->local()]].first.add(i->local()); │ │ │ │ -282 } │ │ │ │ +_2_7_3 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ +274 │ │ │ │ +_2_7_5 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ +276 │ │ │ │ +_2_7_7 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ +278 │ │ │ │ +_2_7_9 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ +280 │ │ │ │ +281 template │ │ │ │ +_2_8_2 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ +_c_o_l); │ │ │ │ 283 │ │ │ │ -_2_8_4 void _r_e_s_e_r_v_e_S_p_a_c_e_F_o_r_R_e_c_e_i_v_e_I_n_t_e_r_f_a_c_e(int proc, int size) │ │ │ │ -285 { │ │ │ │ -286 interfaces()[proc].second.reserve(size); │ │ │ │ -287 } │ │ │ │ -_2_8_8 void _a_d_d_R_e_c_e_i_v_e_I_n_d_e_x(int proc, std::size_t idx) │ │ │ │ -289 { │ │ │ │ -290 interfaces()[proc].second.add(idx); │ │ │ │ -291 } │ │ │ │ -292 template │ │ │ │ -_2_9_3 void _b_u_i_l_d_R_e_c_e_i_v_e_I_n_t_e_r_f_a_c_e(std::vector >& indices) │ │ │ │ -294 { │ │ │ │ -295 std::size_t i=0; │ │ │ │ -296 for(auto idx=indices.begin(); idx!= indices.end(); ++idx) { │ │ │ │ -297 interfaces()[idx->second].second.add(i++); │ │ │ │ -298 } │ │ │ │ -299 } │ │ │ │ -300 │ │ │ │ -301 }; │ │ │ │ -302 │ │ │ │ -303 namespace │ │ │ │ -304 { │ │ │ │ -314 template │ │ │ │ -315 void createSendBuf(std::vector& ownerVec, std::set& overlapVec, │ │ │ │ -std::set& neighbors, char *sendBuf, int buffersize, MPI_Comm comm) { │ │ │ │ -316 // Pack owner vertices │ │ │ │ -317 std::size_t s=ownerVec.size(); │ │ │ │ -318 int pos=0; │ │ │ │ -319 if(s==0) │ │ │ │ -320 ownerVec.resize(1); // otherwise would read beyond the memory bound │ │ │ │ -321 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ -&pos, comm); │ │ │ │ -322 MPI_Pack(&(ownerVec[0]), s, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ -&pos, comm); │ │ │ │ -323 s = overlapVec.size(); │ │ │ │ -324 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ -&pos, comm); │ │ │ │ -325 for(auto i=overlapVec.begin(), end= overlapVec.end(); i != end; ++i) │ │ │ │ -326 MPI_Pack(const_cast(&(*i)), 1, MPITraits::getType(), sendBuf, │ │ │ │ -buffersize, &pos, comm); │ │ │ │ -327 │ │ │ │ -328 s=neighbors.size(); │ │ │ │ -329 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ -&pos, comm); │ │ │ │ +_2_8_4 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ +285 │ │ │ │ +_2_8_6 _D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +287 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ +288 {} │ │ │ │ +289 │ │ │ │ +_2_9_0 _D_e_p_e_n_d_e_n_c_y() │ │ │ │ +291 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ +292 {} │ │ │ │ +293 │ │ │ │ +294 protected: │ │ │ │ +_2_9_6 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ +_2_9_8 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ +_2_9_9 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +_3_0_0 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ +_3_0_2 _N_o_r_m _n_o_r_m__; │ │ │ │ +_3_0_4 int _r_o_w__; │ │ │ │ +_3_0_6 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ +307 }; │ │ │ │ +308 │ │ │ │ +312 template │ │ │ │ +_3_1_3 class _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ +314 { │ │ │ │ +315 public: │ │ │ │ +_3_1_9 typedef M _M_a_t_r_i_x; │ │ │ │ +320 │ │ │ │ +_3_2_4 typedef N _N_o_r_m; │ │ │ │ +325 │ │ │ │ +_3_2_9 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ 330 │ │ │ │ -331 for(auto i=neighbors.begin(), end= neighbors.end(); i != end; ++i) │ │ │ │ -332 MPI_Pack(const_cast(&(*i)), 1, MPI_INT, sendBuf, buffersize, &pos, │ │ │ │ -comm); │ │ │ │ -333 } │ │ │ │ -342 template │ │ │ │ -343 void saveRecvBuf(char *recvBuf, int bufferSize, std::vector >& ownerVec, │ │ │ │ -344 std::set& overlapVec, std::set& neighbors, RedistributeInterface& │ │ │ │ -inf, int from, MPI_Comm comm) { │ │ │ │ -345 std::size_t size; │ │ │ │ -346 int pos=0; │ │ │ │ -347 // unpack owner vertices │ │ │ │ -348 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ -getType(), comm); │ │ │ │ -349 inf.reserveSpaceForReceiveInterface(from, size); │ │ │ │ -350 ownerVec.reserve(ownerVec.size()+size); │ │ │ │ -351 for(; size!=0; --size) { │ │ │ │ -352 GI gi; │ │ │ │ -353 MPI_Unpack(recvBuf, bufferSize, &pos, &gi, 1, MPITraits::getType(), │ │ │ │ -comm); │ │ │ │ -354 ownerVec.push_back(std::make_pair(gi,from)); │ │ │ │ -355 } │ │ │ │ -356 // unpack overlap vertices │ │ │ │ -357 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ -getType(), comm); │ │ │ │ -358 typename std::set::iterator ipos = overlapVec.begin(); │ │ │ │ -359 Dune::dverb << "unpacking "<::getType(), │ │ │ │ -comm); │ │ │ │ -363 ipos=overlapVec.insert(ipos, gi); │ │ │ │ -364 } │ │ │ │ -365 //unpack neighbors │ │ │ │ -366 MPI_Unpack(recvBuf, bufferSize, &pos, &size, 1, MPITraits:: │ │ │ │ -getType(), comm); │ │ │ │ -367 Dune::dverb << "unpacking "<::iterator npos = neighbors.begin(); │ │ │ │ -369 for(; size!=0; --size) { │ │ │ │ -370 int n; │ │ │ │ -371 MPI_Unpack(recvBuf, bufferSize, &pos, &n, 1, MPI_INT, comm); │ │ │ │ -372 npos=neighbors.insert(npos, n); │ │ │ │ -373 } │ │ │ │ -374 } │ │ │ │ -375 │ │ │ │ -389 template │ │ │ │ -390 void getDomain(const MPI_Comm& comm, T *part, int numOfOwnVtx, int nparts, │ │ │ │ -int *myDomain, std::vector &domainMapping) { │ │ │ │ -391 int npes, mype; │ │ │ │ -392 MPI_Comm_size(comm, &npes); │ │ │ │ -393 MPI_Comm_rank(comm, &mype); │ │ │ │ -394 MPI_Status status; │ │ │ │ -395 │ │ │ │ -396 *myDomain = -1; │ │ │ │ -397 │ │ │ │ -398 std::vector domain(nparts, 0); │ │ │ │ -399 std::vector assigned(npes, 0); │ │ │ │ -400 // init domain Mapping │ │ │ │ -401 domainMapping.assign(domainMapping.size(), -1); │ │ │ │ -402 │ │ │ │ -403 // count the occurrence of domains │ │ │ │ -404 for (int i = 0; i < numOfOwnVtx; i++) { │ │ │ │ -405 domain[part[i]]++; │ │ │ │ -406 } │ │ │ │ -407 │ │ │ │ -408 std::vector domainMatrix(npes * nparts, -1); │ │ │ │ -409 │ │ │ │ -410 // init buffer with the own domain │ │ │ │ -411 int *buf = new int[nparts]; │ │ │ │ -412 for (int i = 0; i < nparts; i++) { │ │ │ │ -413 buf[i] = domain[i]; │ │ │ │ -414 domainMatrix[mype*nparts+i] = domain[i]; │ │ │ │ -415 } │ │ │ │ -416 int pe=0; │ │ │ │ -417 int src = (mype-1+npes)%npes; │ │ │ │ -418 int dest = (mype+1)%npes; │ │ │ │ -419 // ring communication, we need n-1 communications for n processors │ │ │ │ -420 for (int i = 0; i < npes-1; i++) { │ │ │ │ -421 MPI_Sendrecv_replace(buf, nparts, MPI_INT, dest, 0, src, 0, comm, &status); │ │ │ │ -422 // pe is the process of the actual received buffer │ │ │ │ -423 pe = ((mype-1-i)+npes)%npes; │ │ │ │ -424 for(int j = 0; j < nparts; j++) { │ │ │ │ -425 // save the values to the domain matrix │ │ │ │ -426 domainMatrix[pe*nparts+j] = buf[j]; │ │ │ │ -427 } │ │ │ │ -428 } │ │ │ │ -429 delete[] buf; │ │ │ │ -430 │ │ │ │ -431 // Start the domain calculation. │ │ │ │ -432 // The process which contains the maximum number of vertices of a │ │ │ │ -433 // particular domain is selected to choose it's favorate domain │ │ │ │ -434 int maxOccurance = 0; │ │ │ │ -435 pe = -1; │ │ │ │ -436 std::set unassigned; │ │ │ │ -437 │ │ │ │ -438 for (int i = 0; i < nparts; i++) { │ │ │ │ -439 for (int j = 0; j < npes; j++) { │ │ │ │ -440 // process has no domain assigned │ │ │ │ -441 if (assigned[j]==0) { │ │ │ │ -442 if (maxOccurance < domainMatrix[j*nparts+i]) { │ │ │ │ -443 maxOccurance = domainMatrix[j*nparts+i]; │ │ │ │ -444 pe = j; │ │ │ │ -445 } │ │ │ │ +_3_3_4 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r _C_o_l_I_t_e_r; │ │ │ │ +335 │ │ │ │ +_3_3_6 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ +337 │ │ │ │ +_3_3_8 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ +339 │ │ │ │ +_3_4_0 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ +341 │ │ │ │ +342 template │ │ │ │ +_3_4_3 void _e_x_a_m_i_n_e(G& graph, const typename G::EdgeIterator& edge, const _C_o_l_I_t_e_r& │ │ │ │ +_c_o_l); │ │ │ │ +344 │ │ │ │ +_3_4_5 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ +346 │ │ │ │ +347 │ │ │ │ +_3_4_8 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +349 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ +350 {} │ │ │ │ +_3_5_1 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y() │ │ │ │ +352 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ +353 {} │ │ │ │ +354 │ │ │ │ +355 protected: │ │ │ │ +_3_5_7 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ +_3_5_9 typedef typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e _f_i_e_l_d___t_y_p_e; │ │ │ │ +_3_6_0 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +_3_6_1 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ +_3_6_3 _N_o_r_m _n_o_r_m__; │ │ │ │ +_3_6_5 int _r_o_w__; │ │ │ │ +_3_6_7 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ +368 private: │ │ │ │ +369 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::true_type&); │ │ │ │ +370 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::false_type&); │ │ │ │ +371 }; │ │ │ │ +372 │ │ │ │ +377 template │ │ │ │ +_3_7_8 class _D_i_a_g_o_n_a_l │ │ │ │ +379 { │ │ │ │ +380 public: │ │ │ │ +381 enum { /* @brief We preserve the sign.*/ │ │ │ │ +382 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = true │ │ │ │ +_3_8_3 }; │ │ │ │ +384 │ │ │ │ +389 template │ │ │ │ +_3_9_0 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +m, │ │ │ │ +391 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ +sfinae = nullptr) const │ │ │ │ +392 { │ │ │ │ +393 typedef typename M::field_type field_type; │ │ │ │ +394 typedef typename FieldTraits::real_type real_type; │ │ │ │ +395 static_assert( std::is_convertible::value, │ │ │ │ +396 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ +397 return m[N][N]; │ │ │ │ +398 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ +399 } │ │ │ │ +400 │ │ │ │ +405 template │ │ │ │ +_4_0_6 auto _o_p_e_r_a_t_o_r_(_)(const M& m, │ │ │ │ +407 typename std::enable_if_t::value>* sfinae = nullptr) │ │ │ │ +const │ │ │ │ +408 { │ │ │ │ +409 typedef typename FieldTraits::real_type real_type; │ │ │ │ +410 static_assert( std::is_convertible::value, │ │ │ │ +411 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ +412 return m; │ │ │ │ +413 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ +414 } │ │ │ │ +415 │ │ │ │ +416 private: │ │ │ │ +417 │ │ │ │ +419 template │ │ │ │ +420 static T signed_abs(const T & v) │ │ │ │ +421 { │ │ │ │ +422 return v; │ │ │ │ +423 } │ │ │ │ +424 │ │ │ │ +426 template │ │ │ │ +427 static T signed_abs(const std::complex & v) │ │ │ │ +428 { │ │ │ │ +429 // return sign * abs_value │ │ │ │ +430 // in case of complex numbers this extends to using the csgn function to │ │ │ │ +determine the sign │ │ │ │ +431 return csgn(v) * std::abs(v); │ │ │ │ +432 } │ │ │ │ +433 │ │ │ │ +435 template │ │ │ │ +436 static T csgn(const T & v) │ │ │ │ +437 { │ │ │ │ +438 return (T(0) < v) - (v < T(0)); │ │ │ │ +439 } │ │ │ │ +440 │ │ │ │ +442 template │ │ │ │ +443 static T csgn(std::complex a) │ │ │ │ +444 { │ │ │ │ +445 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag()); │ │ │ │ 446 } │ │ │ │ 447 │ │ │ │ -448 } │ │ │ │ -449 if (pe!=-1) { │ │ │ │ -450 // process got a domain, ... │ │ │ │ -451 domainMapping[i] = pe; │ │ │ │ -452 // ...mark as assigned │ │ │ │ -453 assigned[pe] = 1; │ │ │ │ -454 if (pe==mype) { │ │ │ │ -455 *myDomain = i; │ │ │ │ -456 } │ │ │ │ -457 pe = -1; │ │ │ │ -458 } │ │ │ │ -459 else │ │ │ │ -460 { │ │ │ │ -461 unassigned.insert(i); │ │ │ │ -462 } │ │ │ │ -463 maxOccurance = 0; │ │ │ │ -464 } │ │ │ │ -465 │ │ │ │ -466 typename std::vector::iterator next_free = assigned.begin(); │ │ │ │ -467 │ │ │ │ -468 for(auto udomain = unassigned.begin(), │ │ │ │ -469 end = unassigned.end(); udomain != end; ++udomain) │ │ │ │ -470 { │ │ │ │ -471 next_free = std::find_if(next_free, assigned.end(), std::bind(std:: │ │ │ │ -less(), std::placeholders::_1, 1)); │ │ │ │ -472 assert(next_free != assigned.end()); │ │ │ │ -473 domainMapping[*udomain] = next_free-assigned.begin(); │ │ │ │ -474 *next_free = 1; │ │ │ │ -475 } │ │ │ │ +448 }; │ │ │ │ +449 │ │ │ │ +_4_5_4 class _F_i_r_s_t_D_i_a_g_o_n_a_l : public _D_i_a_g_o_n_a_l<0> │ │ │ │ +455 {}; │ │ │ │ +456 │ │ │ │ +_4_6_2 struct _R_o_w_S_u_m │ │ │ │ +463 { │ │ │ │ +464 │ │ │ │ +465 enum { /* @brief We preserve the sign.*/ │ │ │ │ +466 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ +_4_6_7 }; │ │ │ │ +472 template │ │ │ │ +_4_7_3 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +m) const │ │ │ │ +474 { │ │ │ │ +475 return m.infinity_norm(); │ │ │ │ 476 } │ │ │ │ -477 │ │ │ │ -478 struct SortFirst │ │ │ │ -479 { │ │ │ │ -480 template │ │ │ │ -481 bool operator()(const T& t1, const T& t2) const │ │ │ │ -482 { │ │ │ │ -483 return t1 │ │ │ │ -499 void mergeVec(std::vector >& ownerVec, std::set& │ │ │ │ -overlapSet) { │ │ │ │ -500 │ │ │ │ -501#ifdef DEBUG_REPART │ │ │ │ -502 // Safety check for duplicates. │ │ │ │ -503 if(ownerVec.size()>0) │ │ │ │ -504 { │ │ │ │ -505 auto old=ownerVec.begin(); │ │ │ │ -506 for(auto i=old+1, end=ownerVec.end(); i != end; old=i++) │ │ │ │ +477 }; │ │ │ │ +478 │ │ │ │ +_4_7_9 struct _F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +480 { │ │ │ │ +481 │ │ │ │ +482 enum { /* @brief We preserve the sign.*/ │ │ │ │ +483 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ +_4_8_4 }; │ │ │ │ +489 template │ │ │ │ +_4_9_0 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +m) const │ │ │ │ +491 { │ │ │ │ +492 return m.frobenius_norm(); │ │ │ │ +493 } │ │ │ │ +494 }; │ │ │ │ +_4_9_5 struct _A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +496 { │ │ │ │ +497 │ │ │ │ +498 enum { /* @brief We preserve the sign.*/ │ │ │ │ +499 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ +_5_0_0 }; │ │ │ │ +505 template │ │ │ │ +_5_0_6 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +m) const │ │ │ │ 507 { │ │ │ │ -508 if(i->first==old->first) │ │ │ │ -509 { │ │ │ │ -510 std::cerr<<"Value at index "<first<<","<second<<"]==[" │ │ │ │ -512 <first<<","<second<<"]"<first<*s) ++v; │ │ │ │ -524 if(v!=vend && v->first==*s) { │ │ │ │ -525 // Move to the next element before erasing │ │ │ │ -526 // thus s stays valid! │ │ │ │ -527 auto tmp=s; │ │ │ │ -528 ++s; │ │ │ │ -529 overlapSet.erase(tmp); │ │ │ │ -530 }else │ │ │ │ -531 ++s; │ │ │ │ -532 } │ │ │ │ -533 } │ │ │ │ -534 │ │ │ │ -535 │ │ │ │ -549 template │ │ │ │ -550 void getNeighbor(const Graph& g, std::vector& part, │ │ │ │ -551 typename Graph::VertexDescriptor vtx, const IS& indexSet, │ │ │ │ -552 int toPe, std::set& neighbor, std::set& neighborProcs) { │ │ │ │ -553 for(auto edge=g.beginEdges(vtx), end=g.endEdges(vtx); edge!=end; ++edge) │ │ │ │ -554 { │ │ │ │ -555 const typename IS::IndexPair* pindex = indexSet.pair(edge.target()); │ │ │ │ -556 assert(pindex); │ │ │ │ -557 if(part[pindex->local()]!=toPe || !OwnerSet::contains(pindex->local │ │ │ │ -().attribute())) │ │ │ │ -558 { │ │ │ │ -559 // is sent to another process and therefore becomes overlap │ │ │ │ -560 neighbor.insert(pindex->global()); │ │ │ │ -561 neighborProcs.insert(part[pindex->local()]); │ │ │ │ -562 } │ │ │ │ -563 } │ │ │ │ -564 } │ │ │ │ -565 │ │ │ │ -566 template │ │ │ │ -567 void my_push_back(std::vector& ownerVec, const I& index, [ │ │ │ │ -[maybe_unused]] int proc) │ │ │ │ -568 { │ │ │ │ -569 ownerVec.push_back(index); │ │ │ │ -570 } │ │ │ │ -571 │ │ │ │ -572 template │ │ │ │ -573 void my_push_back(std::vector >& ownerVec, const I& index, │ │ │ │ -int proc) │ │ │ │ -574 { │ │ │ │ -575 ownerVec.push_back(std::make_pair(index,proc)); │ │ │ │ -576 } │ │ │ │ -577 template │ │ │ │ -578 void reserve(std::vector&, RedistributeInterface&, int) │ │ │ │ -579 {} │ │ │ │ -580 template │ │ │ │ -581 void reserve(std::vector >& ownerVec, │ │ │ │ -RedistributeInterface& redist, int proc) │ │ │ │ -582 { │ │ │ │ -583 redist.reserveSpaceForReceiveInterface(proc, ownerVec.size()); │ │ │ │ -584 } │ │ │ │ -585 │ │ │ │ -586 │ │ │ │ -604 template │ │ │ │ -605 void getOwnerOverlapVec(const G& graph, std::vector& part, IS& │ │ │ │ -indexSet, │ │ │ │ -606 [[maybe_unused]] int myPe, int toPe, std::vector& ownerVec, std:: │ │ │ │ -set& overlapSet, │ │ │ │ -607 RedistributeInterface& redist, std::set& neighborProcs) { │ │ │ │ -608 for(auto index = indexSet.begin(); index != indexSet.end(); ++index) { │ │ │ │ -609 // Only Process owner vertices, the others are not in the parmetis graph. │ │ │ │ -610 if(OwnerSet::contains(index->local().attribute())) │ │ │ │ -611 { │ │ │ │ -612 if(part[index->local()]==toPe) │ │ │ │ -613 { │ │ │ │ -614 getNeighbor(graph, part, index->local(), indexSet, │ │ │ │ -615 toPe, overlapSet, neighborProcs); │ │ │ │ -616 my_push_back(ownerVec, index->global(), toPe); │ │ │ │ -617 } │ │ │ │ -618 } │ │ │ │ -619 } │ │ │ │ -620 reserve(ownerVec, redist, toPe); │ │ │ │ -621 │ │ │ │ -622 } │ │ │ │ -623 │ │ │ │ -624 │ │ │ │ -631 template │ │ │ │ -632 inline bool isOwner(IS& indexSet, int index) { │ │ │ │ -633 │ │ │ │ -634 const typename IS::IndexPair* pindex=indexSet.pair(index); │ │ │ │ -635 │ │ │ │ -636 assert(pindex); │ │ │ │ -637 return F::contains(pindex->local().attribute()); │ │ │ │ -638 } │ │ │ │ -639 │ │ │ │ -640 │ │ │ │ -641 class BaseEdgeFunctor │ │ │ │ -642 { │ │ │ │ -643 public: │ │ │ │ -644 BaseEdgeFunctor(Metis::idx_t* adj,const ParmetisDuneIndexMap& data) │ │ │ │ -645 : i_(), adj_(adj), data_(data) │ │ │ │ -646 {} │ │ │ │ -647 │ │ │ │ -648 template │ │ │ │ -649 void operator()(const T& edge) │ │ │ │ -650 { │ │ │ │ -651 // Get the edge weight │ │ │ │ -652 // const Weight& weight=edge.weight(); │ │ │ │ -653 adj_[i_] = data_.toParmetis(edge.target()); │ │ │ │ -654 i_++; │ │ │ │ -655 } │ │ │ │ -656 std::size_t index() │ │ │ │ -657 { │ │ │ │ -658 return i_; │ │ │ │ -659 } │ │ │ │ -660 │ │ │ │ -661 private: │ │ │ │ -662 std::size_t i_; │ │ │ │ -663 Metis::idx_t* adj_; │ │ │ │ -664 const ParmetisDuneIndexMap& data_; │ │ │ │ -665 }; │ │ │ │ -666 │ │ │ │ -667 template │ │ │ │ -668 struct EdgeFunctor │ │ │ │ -669 : public BaseEdgeFunctor │ │ │ │ -670 { │ │ │ │ -671 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std:: │ │ │ │ -size_t) │ │ │ │ -672 : BaseEdgeFunctor(adj, data) │ │ │ │ -673 {} │ │ │ │ -674 │ │ │ │ -675 Metis::idx_t* getWeights() │ │ │ │ -676 { │ │ │ │ -677 return NULL; │ │ │ │ -678 } │ │ │ │ -679 void free(){} │ │ │ │ -680 }; │ │ │ │ -681 │ │ │ │ -682 template │ │ │ │ -683 class EdgeFunctor<_D_u_n_e::Amg::PropertiesGraph > │ │ │ │ -684 : public BaseEdgeFunctor │ │ │ │ -685 { │ │ │ │ -686 public: │ │ │ │ -687 EdgeFunctor(Metis::idx_t* adj, const ParmetisDuneIndexMap& data, std:: │ │ │ │ -size_t s) │ │ │ │ -688 : BaseEdgeFunctor(adj, data) │ │ │ │ -689 { │ │ │ │ -690 weight_=new Metis::idx_t[s]; │ │ │ │ -691 } │ │ │ │ -692 │ │ │ │ -693 template │ │ │ │ -694 void operator()(const T& edge) │ │ │ │ -695 { │ │ │ │ -696 weight_[index()]=edge.properties().depends() ? 3 : 1; │ │ │ │ -697 BaseEdgeFunctor::operator()(edge); │ │ │ │ -698 } │ │ │ │ -699 Metis::idx_t* getWeights() │ │ │ │ -700 { │ │ │ │ -701 return weight_; │ │ │ │ -702 } │ │ │ │ -703 void free(){ │ │ │ │ -704 delete[] weight_; │ │ │ │ -705 weight_ = nullptr; │ │ │ │ -706 } │ │ │ │ -707 private: │ │ │ │ -708 Metis::idx_t* weight_; │ │ │ │ -709 }; │ │ │ │ -710 │ │ │ │ -711 │ │ │ │ -712 │ │ │ │ -726 template │ │ │ │ -727 void getAdjArrays(G& graph, IS& indexSet, Metis::idx_t *xadj, │ │ │ │ -728 EW& ew) │ │ │ │ -729 { │ │ │ │ -730 int j=0; │ │ │ │ -731 auto vend = graph.end(); │ │ │ │ -732 │ │ │ │ -733 for(auto vertex = graph.begin(); vertex != vend; ++vertex) { │ │ │ │ -734 if (isOwner(indexSet,*vertex)) { │ │ │ │ -735 // The type of const edge iterator. │ │ │ │ -736 auto eend = vertex.end(); │ │ │ │ -737 xadj[j] = ew.index(); │ │ │ │ -738 j++; │ │ │ │ -739 for(auto edge = vertex.begin(); edge != eend; ++edge) { │ │ │ │ -740 ew(edge); │ │ │ │ -741 } │ │ │ │ -742 } │ │ │ │ -743 } │ │ │ │ -744 xadj[j] = ew.index(); │ │ │ │ +508 return 1; │ │ │ │ +509 } │ │ │ │ +510 }; │ │ │ │ +517 template │ │ │ │ +_5_1_8 class _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n : public │ │ │ │ +_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n > │ │ │ │ +519 { │ │ │ │ +520 public: │ │ │ │ +_5_2_1 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +522 : _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n<_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y >(parms) │ │ │ │ +523 {} │ │ │ │ +_5_2_4 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ +525 {} │ │ │ │ +526 }; │ │ │ │ +527 │ │ │ │ +528 │ │ │ │ +537 template │ │ │ │ +_5_3_8 class _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n : public _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ +> │ │ │ │ +539 { │ │ │ │ +540 public: │ │ │ │ +_5_4_1 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +542 : _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n<_D_e_p_e_n_d_e_n_c_y >(parms) │ │ │ │ +543 {} │ │ │ │ +_5_4_4 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ +545 {} │ │ │ │ +546 }; │ │ │ │ +547 // forward declaration │ │ │ │ +548 template class Aggregator; │ │ │ │ +549 │ │ │ │ +550 │ │ │ │ +558 template │ │ │ │ +_5_5_9 class _A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +560 { │ │ │ │ +561 public: │ │ │ │ +562 │ │ │ │ +_5_6_6 static const V _U_N_A_G_G_R_E_G_A_T_E_D; │ │ │ │ +567 │ │ │ │ +_5_7_1 static const V _I_S_O_L_A_T_E_D; │ │ │ │ +_5_7_5 typedef V _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +576 │ │ │ │ +_5_8_0 typedef V _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +581 │ │ │ │ +_5_8_6 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ +587 │ │ │ │ +_5_9_2 typedef SLList _V_e_r_t_e_x_L_i_s_t; │ │ │ │ +593 │ │ │ │ +_5_9_7 class _D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ +598 { │ │ │ │ +599 public: │ │ │ │ +600 template │ │ │ │ +_6_0_1 void _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const EdgeIterator& edge) const │ │ │ │ +602 {} │ │ │ │ +603 }; │ │ │ │ +604 │ │ │ │ +605 │ │ │ │ +_6_0_9 _A_g_g_r_e_g_a_t_e_s_M_a_p(); │ │ │ │ +610 │ │ │ │ +_6_1_6 _A_g_g_r_e_g_a_t_e_s_M_a_p(std::size_t _n_o_V_e_r_t_i_c_e_s); │ │ │ │ +617 │ │ │ │ +_6_2_1 _~_A_g_g_r_e_g_a_t_e_s_M_a_p(); │ │ │ │ +622 │ │ │ │ +634 template │ │ │ │ +_6_3_5 std::tuple _b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(const M& matrix, G& graph, │ │ │ │ +const C& criterion, │ │ │ │ +636 bool finestLevel); │ │ │ │ +637 │ │ │ │ +655 template │ │ │ │ +_6_5_6 std::size_t _b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& start, │ │ │ │ +657 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +658 const G& graph, │ │ │ │ +659 F& aggregateVisitor, │ │ │ │ +660 VM& visitedMap) const; │ │ │ │ +661 │ │ │ │ +685 template │ │ │ │ +_6_8_6 std::size_t _b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& start, │ │ │ │ +687 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +688 const G& graph, L& visited, F1& aggregateVisitor, │ │ │ │ +689 F2& nonAggregateVisitor, │ │ │ │ +690 VM& visitedMap) const; │ │ │ │ +691 │ │ │ │ +_6_9_7 void _a_l_l_o_c_a_t_e(std::size_t _n_o_V_e_r_t_i_c_e_s); │ │ │ │ +698 │ │ │ │ +_7_0_2 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +703 │ │ │ │ +_7_0_7 void _f_r_e_e(); │ │ │ │ +708 │ │ │ │ +_7_1_4 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& v); │ │ │ │ +715 │ │ │ │ +_7_2_1 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& v) const; │ │ │ │ +722 │ │ │ │ +_7_2_3 typedef const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ +724 │ │ │ │ +_7_2_5 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ +726 { │ │ │ │ +727 return aggregates_; │ │ │ │ +728 } │ │ │ │ +729 │ │ │ │ +_7_3_0 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ +731 { │ │ │ │ +732 return aggregates_+_n_o_V_e_r_t_i_c_e_s(); │ │ │ │ +733 } │ │ │ │ +734 │ │ │ │ +_7_3_5 typedef _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* _i_t_e_r_a_t_o_r; │ │ │ │ +736 │ │ │ │ +_7_3_7 _i_t_e_r_a_t_o_r _b_e_g_i_n() │ │ │ │ +738 { │ │ │ │ +739 return aggregates_; │ │ │ │ +740 } │ │ │ │ +741 │ │ │ │ +_7_4_2 _i_t_e_r_a_t_o_r _e_n_d() │ │ │ │ +743 { │ │ │ │ +744 return aggregates_+_n_o_V_e_r_t_i_c_e_s(); │ │ │ │ 745 } │ │ │ │ -746 } // end anonymous namespace │ │ │ │ -747 │ │ │ │ -748 template │ │ │ │ -749 bool _b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n(const G& graph, std::vector& realparts, │ │ │ │ -750 _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm, │ │ │ │ -751 std::shared_ptr<_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>>& outcomm, │ │ │ │ -752 RedistributeInterface& redistInf, │ │ │ │ -753 bool verbose=false); │ │ │ │ -754#if HAVE_PARMETIS │ │ │ │ -755#ifndef METIS_VER_MAJOR │ │ │ │ -756 extern "C" │ │ │ │ -757 { │ │ │ │ -758 // backwards compatibility to parmetis < 4.0.0 │ │ │ │ -759 void METIS_PartGraphKway(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t │ │ │ │ -*adjncy, Metis::idx_t *vwgt, │ │ │ │ -760 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts, │ │ │ │ -761 int *options, int *edgecut, Metis::idx_t *part); │ │ │ │ +746 private: │ │ │ │ +748 _A_g_g_r_e_g_a_t_e_s_M_a_p(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>&) = delete; │ │ │ │ +750 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>& operator=(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>&) = delete; │ │ │ │ +751 │ │ │ │ +755 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* aggregates_; │ │ │ │ +756 │ │ │ │ +760 std::size_t noVertices_; │ │ │ │ +761 }; │ │ │ │ 762 │ │ │ │ -763 void METIS_PartGraphRecursive(int *nvtxs, Metis::idx_t *xadj, Metis::idx_t │ │ │ │ -*adjncy, Metis::idx_t *vwgt, │ │ │ │ -764 Metis::idx_t *adjwgt, int *wgtflag, int *numflag, int *nparts, │ │ │ │ -765 int *options, int *edgecut, Metis::idx_t *part); │ │ │ │ -766 } │ │ │ │ -767#endif │ │ │ │ -768#endif // HAVE_PARMETIS │ │ │ │ -769 │ │ │ │ -770 template │ │ │ │ -_7_7_1 inline void _p_r_i_n_t___c_a_r_r_a_y(S& os, T* array, std::size_t l) │ │ │ │ -772 { │ │ │ │ -773 for(T *cur=array, *end=array+l; cur!=end; ++cur) │ │ │ │ -774 os<<*cur<<" "; │ │ │ │ -775 } │ │ │ │ -776 │ │ │ │ -777 template │ │ │ │ -_7_7_8 inline bool _i_s_V_a_l_i_d_G_r_a_p_h(std::size_t noVtx, std::size_t gnoVtx, S noEdges, │ │ │ │ -T* xadj, │ │ │ │ -779 T* adjncy, bool checkSymmetry) │ │ │ │ -780 { │ │ │ │ -781 bool correct=true; │ │ │ │ -782 │ │ │ │ -783 using std::signbit; │ │ │ │ -784 for(_M_e_t_i_s_:_:_i_d_x___t vtx=0; vtx<(_M_e_t_i_s_:_:_i_d_x___t)noVtx; ++vtx) { │ │ │ │ -785 if(static_cast(xadj[vtx])>noEdges || signbit(xadj[vtx])) { │ │ │ │ -786 std::cerr <<"Check graph: xadj["<" │ │ │ │ -787 <(xadj[vtx+1])>noEdges || signbit(xadj[vtx+1])) { │ │ │ │ -791 std::cerr <<"Check graph: xadj["<" │ │ │ │ -792 <gnoVtx) { │ │ │ │ -798 std::cerr<<" Edge "< │ │ │ │ -_8_2_2 bool _c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(const M& _m_a_t, _D_u_n_e_:_: │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm, │ │ │ │ -823 _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ -824 std::shared_ptr<_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>>& outcomm, │ │ │ │ -825 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ -826 bool verbose=false) │ │ │ │ -827 { │ │ │ │ -828 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -829 std::cout<<"Repartitioning from "<1) { │ │ │ │ -840 │ │ │ │ -841 part[0]=rank; │ │ │ │ -842 │ │ │ │ -843 { // sublock for automatic memory deletion │ │ │ │ +766 template │ │ │ │ +_7_6_7 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ +768 const typename C::Matrix& matrix, │ │ │ │ +769 C criterion, │ │ │ │ +770 bool finestLevel); │ │ │ │ +771 │ │ │ │ +776 template │ │ │ │ +_7_7_7 class _A_g_g_r_e_g_a_t_e │ │ │ │ +778 { │ │ │ │ +779 │ │ │ │ +780 public: │ │ │ │ +781 │ │ │ │ +782 /*** │ │ │ │ +783 * @brief The type of the matrix graph we work with. │ │ │ │ +784 */ │ │ │ │ +_7_8_5 typedef G _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +_7_8_9 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _V_e_r_t_e_x; │ │ │ │ +790 │ │ │ │ +_7_9_5 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ +796 │ │ │ │ +_8_0_1 typedef S _V_e_r_t_e_x_S_e_t; │ │ │ │ +802 │ │ │ │ +_8_0_4 typedef typename VertexSet::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ +805 │ │ │ │ +_8_0_9 typedef std::size_t* _S_p_h_e_r_e_M_a_p; │ │ │ │ +810 │ │ │ │ +_8_1_9 _A_g_g_r_e_g_a_t_e(_M_a_t_r_i_x_G_r_a_p_h& graph, _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +820 _V_e_r_t_e_x_S_e_t& connectivity, std::vector& front_); │ │ │ │ +821 │ │ │ │ +_8_2_2 void _i_n_v_a_l_i_d_a_t_e() │ │ │ │ +823 { │ │ │ │ +824 --id_; │ │ │ │ +825 } │ │ │ │ +826 │ │ │ │ +_8_3_3 void _r_e_c_o_n_s_t_r_u_c_t(const _V_e_r_t_e_x& vertex); │ │ │ │ +834 │ │ │ │ +_8_3_8 void _s_e_e_d(const _V_e_r_t_e_x& vertex); │ │ │ │ +839 │ │ │ │ +_8_4_3 void _a_d_d(const _V_e_r_t_e_x& vertex); │ │ │ │ 844 │ │ │ │ -845 // Build the graph of the communication scheme and create an appropriate │ │ │ │ -indexset. │ │ │ │ -846 // calculate the neighbour vertices │ │ │ │ -847 int noNeighbours = oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().neighbours(); │ │ │ │ -848 │ │ │ │ -849 for(auto n= oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().begin(); n != oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().end │ │ │ │ -(); │ │ │ │ -850 ++n) │ │ │ │ -851 if(n->first==rank) { │ │ │ │ -852 //do not include ourselves. │ │ │ │ -853 --noNeighbours; │ │ │ │ -854 break; │ │ │ │ -855 } │ │ │ │ -856 │ │ │ │ -857 // A parmetis graph representing the communication graph. │ │ │ │ -858 // The diagonal entries are the number of nodes on the process. │ │ │ │ -859 // The offdiagonal entries are the number of edges leading to other │ │ │ │ -processes. │ │ │ │ -860 │ │ │ │ -861 _M_e_t_i_s_:_:_i_d_x___t *xadj=new _M_e_t_i_s_:_:_i_d_x___t[2]; │ │ │ │ -862 _M_e_t_i_s_:_:_i_d_x___t *vtxdist=new _M_e_t_i_s_:_:_i_d_x___t[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()+1]; │ │ │ │ -863 _M_e_t_i_s_:_:_i_d_x___t *adjncy=new _M_e_t_i_s_:_:_i_d_x___t[noNeighbours]; │ │ │ │ -864#ifdef USE_WEIGHTS │ │ │ │ -865 _M_e_t_i_s_:_:_i_d_x___t *vwgt = 0; │ │ │ │ -866 _M_e_t_i_s_:_:_i_d_x___t *adjwgt = 0; │ │ │ │ -867#endif │ │ │ │ -868 │ │ │ │ -869 // each process has exactly one vertex! │ │ │ │ -870 for(int i=0; i& vertex); │ │ │ │ +_8_4_9 void _c_l_e_a_r(); │ │ │ │ +850 │ │ │ │ +_8_5_4 typename VertexSet::size_type _s_i_z_e(); │ │ │ │ +_8_5_8 typename VertexSet::size_type _c_o_n_n_e_c_t_S_i_z_e(); │ │ │ │ +859 │ │ │ │ +_8_6_3 int _i_d(); │ │ │ │ +864 │ │ │ │ +_8_6_6 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +867 │ │ │ │ +_8_6_9 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +870 │ │ │ │ +871 private: │ │ │ │ +875 _V_e_r_t_e_x_S_e_t vertices_; │ │ │ │ 876 │ │ │ │ -877 // count edges to other processor │ │ │ │ -878 // a vector mapping the index to the owner │ │ │ │ -879 // std::vector owner(mat.N(), oocomm.communicator().rank()); │ │ │ │ -880 // for(NeighbourIterator n= oocomm.remoteIndices().begin(); n != │ │ │ │ -oocomm.remoteIndices().end(); │ │ │ │ -881 // ++n) │ │ │ │ -882 // { │ │ │ │ -883 // if(n->first!=oocomm.communicator().rank()){ │ │ │ │ -884 // typedef typename RemoteIndices::RemoteIndexList RIList; │ │ │ │ -885 // const RIList& rlist = *(n->second.first); │ │ │ │ -886 // typedef typename RIList::const_iterator LIter; │ │ │ │ -887 // for(LIter entry=rlist.begin(); entry!=rlist.end(); ++entry){ │ │ │ │ -888 // if(entry->attribute()==OwnerOverlapCopyAttributeSet::owner) │ │ │ │ -889 // owner[entry->localIndexPair().local()] = n->first; │ │ │ │ -890 // } │ │ │ │ -891 // } │ │ │ │ -892 // } │ │ │ │ -893 │ │ │ │ -894 // std::map edgecount; // edges to other processors │ │ │ │ -895 // typedef typename M::ConstRowIterator RIter; │ │ │ │ -896 // typedef typename M::ConstColIterator CIter; │ │ │ │ +881 int id_; │ │ │ │ +882 │ │ │ │ +886 _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +887 │ │ │ │ +891 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +892 │ │ │ │ +896 _V_e_r_t_e_x_S_e_t& connected_; │ │ │ │ 897 │ │ │ │ -898 // // calculate edge count │ │ │ │ -899 // for(RIter row=mat.begin(), endr=mat.end(); row != endr; ++row) │ │ │ │ -900 // if(owner[row.index()]==OwnerOverlapCopyAttributeSet::owner) │ │ │ │ -901 // for(CIter entry= row->begin(), end = row->end(); entry != end; ++entry) │ │ │ │ -902 // ++edgecount[owner[entry.index()]]; │ │ │ │ +901 std::vector& front_; │ │ │ │ +902 }; │ │ │ │ 903 │ │ │ │ -904 // setup edge and weight pattern │ │ │ │ -905 │ │ │ │ -906 _M_e_t_i_s_:_:_i_d_x___t* adjp=adjncy; │ │ │ │ -907 │ │ │ │ -908#ifdef USE_WEIGHTS │ │ │ │ -909 vwgt = new _M_e_t_i_s_:_:_i_d_x___t[1]; │ │ │ │ -910 vwgt[0]= _m_a_t.N(); // weight is number of rows TODO: Should actually be the │ │ │ │ -nonzeros. │ │ │ │ +907 template │ │ │ │ +_9_0_8 class _A_g_g_r_e_g_a_t_o_r │ │ │ │ +909 { │ │ │ │ +910 public: │ │ │ │ 911 │ │ │ │ -912 adjwgt = new _M_e_t_i_s_:_:_i_d_x___t[noNeighbours]; │ │ │ │ -913 _M_e_t_i_s_:_:_i_d_x___t* adjwp=adjwgt; │ │ │ │ -914#endif │ │ │ │ -915 │ │ │ │ -916 for(auto n= oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().begin(); n != oocomm._r_e_m_o_t_e_I_n_d_i_c_e_s().end │ │ │ │ -(); │ │ │ │ -917 ++n) │ │ │ │ -918 if(n->first != rank) { │ │ │ │ -919 *adjp=n->first; │ │ │ │ -920 ++adjp; │ │ │ │ -921#ifdef USE_WEIGHTS │ │ │ │ -922 *adjwp=1; //edgecount[n->first]; │ │ │ │ -923 ++adjwp; │ │ │ │ -924#endif │ │ │ │ -925 } │ │ │ │ -926 assert(_i_s_V_a_l_i_d_G_r_a_p_h(vtxdist[rank+1]-vtxdist[rank], │ │ │ │ -927 vtxdist[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()], │ │ │ │ -928 noNeighbours, xadj, adjncy, false)); │ │ │ │ +_9_1_5 typedef G _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +916 │ │ │ │ +_9_2_0 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _V_e_r_t_e_x; │ │ │ │ +921 │ │ │ │ +_9_2_3 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +924 │ │ │ │ +_9_2_8 _A_g_g_r_e_g_a_t_o_r(); │ │ │ │ 929 │ │ │ │ -930 [[maybe_unused]] _M_e_t_i_s_:_:_i_d_x___t wgtflag=0; │ │ │ │ -931 _M_e_t_i_s_:_:_i_d_x___t numflag=0; │ │ │ │ -932 _M_e_t_i_s_:_:_i_d_x___t edgecut; │ │ │ │ -933#ifdef USE_WEIGHTS │ │ │ │ -934 wgtflag=3; │ │ │ │ -935#endif │ │ │ │ -936 _M_e_t_i_s_:_:_r_e_a_l___t *tpwgts = new _M_e_t_i_s_:_:_r_e_a_l___t[nparts]; │ │ │ │ -937 for(int i=0; i::getType(), │ │ │ │ -1064 gxadj,noxs,xdispl,MPITraits::getType(), │ │ │ │ -1065 comm); │ │ │ │ -1066 MPI_Allgatherv(adjncy,noNeighbours,MPITraits::getType(), │ │ │ │ -1067 gadjncy,noedges,displ,MPITraits::getType(), │ │ │ │ -1068 comm); │ │ │ │ -1069#ifdef USE_WEIGHTS │ │ │ │ -1070 MPI_Allgatherv(adjwgt,noNeighbours,MPITraits::getType(), │ │ │ │ -1071 gadjwgt,noedges,displ,MPITraits::getType(), │ │ │ │ -1072 comm); │ │ │ │ -1073 MPI_Allgatherv(vwgt,localNoVtx,MPITraits::getType(), │ │ │ │ -1074 gvwgt,novs,vdispl,MPITraits::getType(), │ │ │ │ -1075 comm); │ │ │ │ -1076#endif │ │ │ │ -1077 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1078 std::cout<<"Gathering global graph data took "<(gxadjlen)); │ │ │ │ -1096 increment = *(start-1); │ │ │ │ -1097 std::transform(start+offset, start+l+offset, start, std::bind(std:: │ │ │ │ -plus(), std::placeholders::_1, increment)); │ │ │ │ -1098 } │ │ │ │ -1099 Dune::dinfo<= 5 │ │ │ │ -1123 _M_e_t_i_s_:_:_i_d_x___t ncon = 1; │ │ │ │ -1124 _M_e_t_i_s_:_:_i_d_x___t moptions[METIS_NOPTIONS]; │ │ │ │ -1125 METIS_SetDefaultOptions(moptions); │ │ │ │ -1126 moptions[METIS_OPTION_NUMBERING] = numflag; │ │ │ │ -1127 METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, │ │ │ │ -gadjwgt, │ │ │ │ -1128 &nparts, NULL, NULL, moptions, &edgecut, gpart); │ │ │ │ -1129#else │ │ │ │ -1130 int options[5] = {0, 1, 1, 3, 3}; │ │ │ │ -1131 // Call metis │ │ │ │ -1132 METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, │ │ │ │ -&wgtflag, │ │ │ │ -1133 &numflag, &nparts, options, &edgecut, gpart); │ │ │ │ -1134#endif │ │ │ │ -1135 │ │ │ │ -1136 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1137 std::cout<<"METIS took "<::getType(), part, 1, │ │ │ │ -1152 MPITraits::getType(), 0, comm); │ │ │ │ -1153 │ │ │ │ -1154 { │ │ │ │ -1155 // release remaining memory │ │ │ │ -1156 delete[] gpart; │ │ │ │ -1157 delete[] noedges; │ │ │ │ -1158 delete[] displ; │ │ │ │ -1159 } │ │ │ │ -1160 │ │ │ │ +_9_3_3 _~_A_g_g_r_e_g_a_t_o_r(); │ │ │ │ +934 │ │ │ │ +951 template │ │ │ │ +_9_5_2 std::tuple _b_u_i_l_d(const M& m, G& graph, │ │ │ │ +953 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const C& c, │ │ │ │ +954 bool finestLevel); │ │ │ │ +955 private: │ │ │ │ +960 typedef PoolAllocator Allocator; │ │ │ │ +961 │ │ │ │ +965 typedef SLList VertexList; │ │ │ │ +966 │ │ │ │ +970 typedef std::set,Allocator> VertexSet; │ │ │ │ +971 │ │ │ │ +975 typedef std::size_t* SphereMap; │ │ │ │ +976 │ │ │ │ +980 _M_a_t_r_i_x_G_r_a_p_h* graph_; │ │ │ │ +981 │ │ │ │ +985 _A_g_g_r_e_g_a_t_e_<_M_a_t_r_i_x_G_r_a_p_h_,_V_e_r_t_e_x_S_e_t_>* aggregate_; │ │ │ │ +986 │ │ │ │ +990 std::vector front_; │ │ │ │ +991 │ │ │ │ +995 VertexSet connected_; │ │ │ │ +996 │ │ │ │ +1000 int size_; │ │ │ │ +1001 │ │ │ │ +1005 class Stack │ │ │ │ +1006 { │ │ │ │ +1007 public: │ │ │ │ +_1_0_0_8 static const _V_e_r_t_e_x _N_u_l_l_E_n_t_r_y; │ │ │ │ +1009 │ │ │ │ +_1_0_1_0 _S_t_a_c_k(const _M_a_t_r_i_x_G_r_a_p_h& graph, │ │ │ │ +1011 const _A_g_g_r_e_g_a_t_o_r_<_G_>& aggregatesBuilder, │ │ │ │ +1012 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates); │ │ │ │ +_1_0_1_3 _~_S_t_a_c_k(); │ │ │ │ +_1_0_1_4 _V_e_r_t_e_x _p_o_p(); │ │ │ │ +1015 private: │ │ │ │ +1016 enum { N = 1300000 }; │ │ │ │ +1017 │ │ │ │ +1019 const _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +1021 const _A_g_g_r_e_g_a_t_o_r_<_G_>& aggregatesBuilder_; │ │ │ │ +1023 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +1025 int size_; │ │ │ │ +1026 _V_e_r_t_e_x maxSize_; │ │ │ │ +1028 typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r begin_; │ │ │ │ +1029 typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r end_; │ │ │ │ +1030 │ │ │ │ +1032 _V_e_r_t_e_x* vals_; │ │ │ │ +1033 │ │ │ │ +1034 }; │ │ │ │ +1035 │ │ │ │ +_1_0_3_6 friend class Stack; │ │ │ │ +1037 │ │ │ │ +1048 template │ │ │ │ +1049 void visitAggregateNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1050 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +1051 V& visitor) const; │ │ │ │ +1052 │ │ │ │ +1057 template │ │ │ │ +1058 class AggregateVisitor │ │ │ │ +1059 { │ │ │ │ +1060 public: │ │ │ │ +_1_0_6_4 typedef V _V_i_s_i_t_o_r; │ │ │ │ +_1_0_7_2 _A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1073 _V_i_s_i_t_o_r& visitor); │ │ │ │ +1074 │ │ │ │ +_1_0_8_1 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +1082 │ │ │ │ +1083 private: │ │ │ │ +1085 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +1087 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r aggregate_; │ │ │ │ +1089 _V_i_s_i_t_o_r* visitor_; │ │ │ │ +1090 }; │ │ │ │ +1091 │ │ │ │ +1095 class Counter │ │ │ │ +1096 { │ │ │ │ +1097 public: │ │ │ │ +_1_0_9_9 _C_o_u_n_t_e_r(); │ │ │ │ +_1_1_0_1 int _v_a_l_u_e(); │ │ │ │ +1102 │ │ │ │ +1103 protected: │ │ │ │ +_1_1_0_5 void _i_n_c_r_e_m_e_n_t(); │ │ │ │ +_1_1_0_7 void _d_e_c_r_e_m_e_n_t(); │ │ │ │ +1108 │ │ │ │ +1109 private: │ │ │ │ +1110 int count_; │ │ │ │ +1111 }; │ │ │ │ +1112 │ │ │ │ +1113 │ │ │ │ +1118 class FrontNeighbourCounter : public Counter │ │ │ │ +1119 { │ │ │ │ +1120 public: │ │ │ │ +_1_1_2_5 _F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r(const _M_a_t_r_i_x_G_r_a_p_h& front); │ │ │ │ +1126 │ │ │ │ +_1_1_2_7 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +1128 │ │ │ │ +1129 private: │ │ │ │ +1130 const _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +1131 }; │ │ │ │ +1132 │ │ │ │ +1137 int noFrontNeighbours(const _V_e_r_t_e_x& vertex) const; │ │ │ │ +1138 │ │ │ │ +1142 class TwoWayCounter : public Counter │ │ │ │ +1143 { │ │ │ │ +1144 public: │ │ │ │ +_1_1_4_5 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +1146 }; │ │ │ │ +1147 │ │ │ │ +1159 int twoWayConnections(const _V_e_r_t_e_x&, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1160 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ 1161 │ │ │ │ -1162#endif │ │ │ │ -1163 delete[] xadj; │ │ │ │ -1164 delete[] vtxdist; │ │ │ │ -1165 delete[] adjncy; │ │ │ │ -1166#ifdef USE_WEIGHTS │ │ │ │ -1167 delete[] vwgt; │ │ │ │ -1168 delete[] adjwgt; │ │ │ │ -1169#endif │ │ │ │ -1170 delete[] tpwgts; │ │ │ │ -1171 } │ │ │ │ -1172 }else{ │ │ │ │ -1173 part[0]=0; │ │ │ │ -1174 } │ │ │ │ -1175#endif │ │ │ │ -1176 Dune::dinfo<<" repart "< "<< part[0]< realpart(_m_a_t.N(), part[0]); │ │ │ │ -1179 delete[] part; │ │ │ │ -1180 │ │ │ │ -1181 oocomm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(realpart, realpart); │ │ │ │ -1182 │ │ │ │ -1183 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1184 std::cout<<"Scattering repartitioning took "< graph(const_cast(_m_a_t)); │ │ │ │ -1190 _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(graph, oocomm); │ │ │ │ -1191 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1192 std::cout<<"Filling index set took "< │ │ │ │ -_1_2_2_8 bool _g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(const G& graph, _D_u_n_e_:_: │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm, _M_e_t_i_s_:_:_i_d_x___t nparts, │ │ │ │ -1229 std::shared_ptr<_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>>& outcomm, │ │ │ │ -1230 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ -1231 bool verbose=false) │ │ │ │ -1232 { │ │ │ │ -1233 Timer time; │ │ │ │ -1234 │ │ │ │ -1235 MPI_Comm comm=oocomm._c_o_m_m_u_n_i_c_a_t_o_r(); │ │ │ │ -1236 oocomm._b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(graph.noVertices()); │ │ │ │ -1237 _f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s(graph, oocomm); │ │ │ │ -1238 │ │ │ │ -1239 if(verbose && oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1240 std::cout<<"Filling holes took "<(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size())); │ │ │ │ -1255 │ │ │ │ -1256 int myDomain = -1; │ │ │ │ -1257 │ │ │ │ -1258 // │ │ │ │ -1259 // 1) Prepare the required parameters for using ParMETIS │ │ │ │ -1260 // Especially the arrays that represent the graph must be │ │ │ │ -1261 // generated by the DUNE Graph and IndexSet input variables. │ │ │ │ -1262 // These are the arrays: │ │ │ │ -1263 // - vtxdist │ │ │ │ -1264 // - xadj │ │ │ │ -1265 // - adjncy │ │ │ │ -1266 // │ │ │ │ -1267 // │ │ │ │ -1268#ifdef PERF_REPART │ │ │ │ -1269 // reset timer for step 1) │ │ │ │ -1270 t1=MPI_Wtime(); │ │ │ │ -1271#endif │ │ │ │ -1272 │ │ │ │ -1273 │ │ │ │ -1274 typedef typename _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> OOComm; │ │ │ │ -1275 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ -1276 │ │ │ │ -1277 // Create the vtxdist array and parmetisVtxMapping. │ │ │ │ -1278 // Global communications are necessary │ │ │ │ -1279 // The parmetis global identifiers for the owner vertices. │ │ │ │ -1280 ParmetisDuneIndexMap indexMap(graph,oocomm); │ │ │ │ -1281 _M_e_t_i_s_:_:_i_d_x___t *part = new _M_e_t_i_s_:_:_i_d_x___t[indexMap.numOfOwnVtx()]; │ │ │ │ -1282 for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i) │ │ │ │ -1283 part[i]=mype; │ │ │ │ -1284 │ │ │ │ -1285#if !HAVE_PARMETIS │ │ │ │ -1286 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0 && nparts>1) │ │ │ │ -1287 std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead │ │ │ │ -of requested " │ │ │ │ -1288 <& aggregates) const; │ │ │ │ +1184 │ │ │ │ +1191 class ConnectivityCounter : public Counter │ │ │ │ +1192 { │ │ │ │ +1193 public: │ │ │ │ +_1_2_0_0 _C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r(const VertexSet& connected, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates); │ │ │ │ +1201 │ │ │ │ +_1_2_0_2 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +1203 │ │ │ │ +1204 private: │ │ │ │ +1206 const VertexSet& connected_; │ │ │ │ +1208 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +1209 │ │ │ │ +1210 }; │ │ │ │ +1211 │ │ │ │ +1223 double connectivity(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ +aggregates) const; │ │ │ │ +1231 bool connected(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1232 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ +1233 │ │ │ │ +1241 bool connected(const _V_e_r_t_e_x& vertex, const SLList& │ │ │ │ +aggregateList, │ │ │ │ +1242 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ +1243 │ │ │ │ +1251 class DependencyCounter : public Counter │ │ │ │ +1252 { │ │ │ │ +1253 public: │ │ │ │ +_1_2_5_7 _D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r(); │ │ │ │ +1258 │ │ │ │ +_1_2_5_9 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +1260 }; │ │ │ │ +1261 │ │ │ │ +1268 class FrontMarker │ │ │ │ +1269 { │ │ │ │ +1270 public: │ │ │ │ +_1_2_7_7 _F_r_o_n_t_M_a_r_k_e_r(std::vector& front, _M_a_t_r_i_x_G_r_a_p_h& graph); │ │ │ │ +1278 │ │ │ │ +_1_2_7_9 void _o_p_e_r_a_t_o_r_(_)(const typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ +1280 │ │ │ │ +1281 private: │ │ │ │ +1283 std::vector& front_; │ │ │ │ +1285 _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +1286 }; │ │ │ │ +1287 │ │ │ │ +1291 void unmarkFront(); │ │ │ │ 1292 │ │ │ │ -1293 if(nparts>1) { │ │ │ │ -1294 // Create the xadj and adjncy arrays │ │ │ │ -1295 _M_e_t_i_s_:_:_i_d_x___t *xadj = new _M_e_t_i_s_:_:_i_d_x___t[indexMap.numOfOwnVtx()+1]; │ │ │ │ -1296 _M_e_t_i_s_:_:_i_d_x___t *adjncy = new _M_e_t_i_s_:_:_i_d_x___t[graph.noEdges()]; │ │ │ │ -1297 EdgeFunctor ef(adjncy, indexMap, graph.noEdges()); │ │ │ │ -1298 getAdjArrays(graph, oocomm._g_l_o_b_a_l_L_o_o_k_u_p(), xadj, ef); │ │ │ │ -1299 │ │ │ │ -1300 // │ │ │ │ -1301 // 2) Call ParMETIS │ │ │ │ -1302 // │ │ │ │ -1303 // │ │ │ │ -1304 _M_e_t_i_s_:_:_i_d_x___t numflag=0, wgtflag=0, options[3], edgecut=0, ncon=1; │ │ │ │ -1305 //float *tpwgts = NULL; │ │ │ │ -1306 _M_e_t_i_s_:_:_r_e_a_l___t *tpwgts = new _M_e_t_i_s_:_:_r_e_a_l___t[nparts]; │ │ │ │ -1307 for(int i=0; i(comm)); │ │ │ │ +1307 int unusedNeighbours(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ +aggregates) const; │ │ │ │ +1308 │ │ │ │ +1322 std::pair neighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ +1323 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1324 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ +1341 int aggregateNeighbours(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ +aggregate, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ +1342 │ │ │ │ +1350 bool admissible(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ +aggregate, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ 1351 │ │ │ │ -1352 │ │ │ │ -1353 delete[] xadj; │ │ │ │ -1354 delete[] adjncy; │ │ │ │ -1355 delete[] tpwgts; │ │ │ │ -1356 │ │ │ │ -1357 ef.free(); │ │ │ │ -1358 │ │ │ │ -1359#ifdef DEBUG_REPART │ │ │ │ -1360 if (mype == 0) { │ │ │ │ -1361 std::cout<& │ │ │ │ +aggregates); │ │ │ │ +1360 │ │ │ │ +1369 _V_e_r_t_e_x mergeNeighbour(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ +aggregates) const; │ │ │ │ +1370 │ │ │ │ +1379 void nonisoNeighbourAggregate(const _V_e_r_t_e_x& vertex, │ │ │ │ +1380 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +1381 SLList& neighbours) const; │ │ │ │ +1382 │ │ │ │ +1390 template │ │ │ │ +1391 void growAggregate(const _V_e_r_t_e_x& vertex, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ +aggregates, const C& c); │ │ │ │ +1392 template │ │ │ │ +1393 void growIsolatedAggregate(const _V_e_r_t_e_x& vertex, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const C& c); │ │ │ │ +1394 }; │ │ │ │ 1395 │ │ │ │ -1396 │ │ │ │ -1397 // │ │ │ │ -1398 // 3) Find a optimal domain based on the ParMETIS repartitioning │ │ │ │ -1399 // result │ │ │ │ -1400 // │ │ │ │ -1401 │ │ │ │ -1402 std::vector domainMapping(nparts); │ │ │ │ -1403 if(nparts>1) │ │ │ │ -1404 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, │ │ │ │ -domainMapping); │ │ │ │ -1405 else │ │ │ │ -1406 domainMapping[0]=0; │ │ │ │ -1407 │ │ │ │ -1408#ifdef DEBUG_REPART │ │ │ │ -1409 std::cout< setPartition(oocomm._i_n_d_e_x_S_e_t().size(), -1); │ │ │ │ -1422 │ │ │ │ -1423 std::size_t i=0; // parmetis index │ │ │ │ -1424 for(auto index = oocomm._i_n_d_e_x_S_e_t().begin(); index != oocomm._i_n_d_e_x_S_e_t().end │ │ │ │ -(); ++index) │ │ │ │ -1425 if(OwnerSet::contains(index->local().attribute())) { │ │ │ │ -1426 setPartition[index->local()]=domainMapping[part[i++]]; │ │ │ │ -1427 } │ │ │ │ -1428 │ │ │ │ -1429 delete[] part; │ │ │ │ -1430 oocomm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(setPartition, setPartition); │ │ │ │ -1431 // communication only needed for ALU │ │ │ │ -1432 // (ghosts with same global id as owners on the same process) │ │ │ │ -1433 if (SolverCategory::category(oocomm) == │ │ │ │ -1434 static_cast(SolverCategory::nonoverlapping)) │ │ │ │ -1435 oocomm._c_o_p_y_C_o_p_y_T_o_A_l_l(setPartition, setPartition); │ │ │ │ -1436 bool ret = _b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n(graph, setPartition, oocomm, outcomm, │ │ │ │ -redistInf, │ │ │ │ -1437 verbose); │ │ │ │ -1438 if(verbose) { │ │ │ │ -1439 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1440 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1441 std::cout<<"Creating indexsets took "< │ │ │ │ +1399 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const _M_a_t_r_i_x* matrix) │ │ │ │ +1400 { │ │ │ │ +1401 matrix_ = matrix; │ │ │ │ +1402 } │ │ │ │ +1403 │ │ │ │ +1404 template │ │ │ │ +1405 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const Row& row, int index) │ │ │ │ +1406 { │ │ │ │ +1407 initRow(row, index, std::is_convertible()); │ │ │ │ +1408 } │ │ │ │ +1409 │ │ │ │ +1410 template │ │ │ │ +1411 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w(const Row& row, int index, │ │ │ │ +const std::false_type&) │ │ │ │ +1412 { │ │ │ │ +1413 DUNE_THROW(InvalidStateException, "field_type needs to convertible to │ │ │ │ +real_type"); │ │ │ │ +1414 } │ │ │ │ +1415 │ │ │ │ +1416 template │ │ │ │ +1417 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w([[maybe_unused]] const Row& │ │ │ │ +row, int index, const std::true_type&) │ │ │ │ +1418 { │ │ │ │ +1419 using std::min; │ │ │ │ +1420 maxValue_ = min(- std::numeric_limits::max(), │ │ │ │ +std::numeric_limits::min()); │ │ │ │ +1421 row_ = index; │ │ │ │ +1422 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ +1423 } │ │ │ │ +1424 │ │ │ │ +1425 template │ │ │ │ +1426 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const ColIter& _c_o_l) │ │ │ │ +1427 { │ │ │ │ +1428 using std::max; │ │ │ │ +1429 real_type eij = norm_(*_c_o_l); │ │ │ │ +1430 typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r opposite_entry = │ │ │ │ +1431 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ +1432 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ +1433 { │ │ │ │ +1434 // Consider this a weak connection we disregard. │ │ │ │ +1435 return; │ │ │ │ +1436 } │ │ │ │ +1437 real_type eji = norm_(*opposite_entry); │ │ │ │ +1438 │ │ │ │ +1439 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ +1440 if(!N::is_sign_preserving || eij<0 || eji<0) │ │ │ │ +1441 maxValue_ = max(maxValue_, │ │ │ │ +1442 eij /diagonal_ * eji/ │ │ │ │ +1443 norm_(matrix_->operator[](_c_o_l.index())[_c_o_l.index()])); │ │ │ │ 1444 } │ │ │ │ 1445 │ │ │ │ -1446 │ │ │ │ -1447 │ │ │ │ -1448 template │ │ │ │ -_1_4_4_9 bool _b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n(const G& graph, │ │ │ │ -1450 std::vector& setPartition, _D_u_n_e_:_: │ │ │ │ -_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& oocomm, │ │ │ │ -1451 std::shared_ptr<_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>>& outcomm, │ │ │ │ -1452 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e& redistInf, │ │ │ │ -1453 bool verbose) │ │ │ │ -1454 { │ │ │ │ -1455 typedef typename _D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> OOComm; │ │ │ │ -1456 typedef typename OOComm::OwnerSet OwnerSet; │ │ │ │ -1457 │ │ │ │ -1458 Timer time; │ │ │ │ -1459 │ │ │ │ -1460 // Build the send interface │ │ │ │ -1461 redistInf._b_u_i_l_d_S_e_n_d_I_n_t_e_r_f_a_c_e(setPartition, oocomm._i_n_d_e_x_S_e_t()); │ │ │ │ -1462 │ │ │ │ -1463#ifdef PERF_REPART │ │ │ │ -1464 // stop the time for step 3) │ │ │ │ -1465 t3=MPI_Wtime()-t3; │ │ │ │ -1466 // reset timer for step 4) │ │ │ │ -1467 t4=MPI_Wtime(); │ │ │ │ -1468#endif │ │ │ │ -1469 │ │ │ │ -1470 │ │ │ │ -1471 // │ │ │ │ -1472 // 4) Create the output IndexSet and RemoteIndices │ │ │ │ -1473 // 4.1) Determine the "send to" and "receive from" relation │ │ │ │ -1474 // according to the new partition using a MPI ring │ │ │ │ -1475 // communication. │ │ │ │ -1476 // │ │ │ │ -1477 // 4.2) Depends on the "send to" and "receive from" vector, │ │ │ │ -1478 // the processes will exchange the vertices each other │ │ │ │ -1479 // │ │ │ │ -1480 // 4.3) Create the IndexSet, RemoteIndices and the new MPI │ │ │ │ -1481 // communicator │ │ │ │ -1482 // │ │ │ │ -1483 │ │ │ │ -1484 // │ │ │ │ -1485 // 4.1) Let's start... │ │ │ │ -1486 // │ │ │ │ -1487 int npes = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size(); │ │ │ │ -1488 int *sendTo = 0; │ │ │ │ -1489 int noSendTo = 0; │ │ │ │ -1490 std::set recvFrom; │ │ │ │ -1491 │ │ │ │ -1492 // the max number of vertices is stored in the sendTo buffer, │ │ │ │ -1493 // not the number of vertices to send! Because the max number of Vtx │ │ │ │ -1494 // is used as the fixed buffer size by the MPI send/receive calls │ │ │ │ -1495 │ │ │ │ -1496 int mype = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank(); │ │ │ │ -1497 │ │ │ │ -1498 { │ │ │ │ -1499 std::set tsendTo; │ │ │ │ -1500 for(auto i=setPartition.begin(), iend = setPartition.end(); i!=iend; ++i) │ │ │ │ -1501 tsendTo.insert(*i); │ │ │ │ -1502 │ │ │ │ -1503 noSendTo = tsendTo.size(); │ │ │ │ -1504 sendTo = new int[noSendTo]; │ │ │ │ -1505 int idx=0; │ │ │ │ -1506 for(auto i=tsendTo.begin(); i != tsendTo.end(); ++i, ++idx) │ │ │ │ -1507 sendTo[idx]=*i; │ │ │ │ -1508 } │ │ │ │ -1509 │ │ │ │ -1510 // │ │ │ │ -1511 int* gnoSend= new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ -1512 int* gsendToDispl = new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()+1]; │ │ │ │ -1513 │ │ │ │ -1514 MPI_Allgather(&noSendTo, 1, MPI_INT, gnoSend, 1, │ │ │ │ -1515 MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ +1446 template │ │ │ │ +1447 template │ │ │ │ +1448 inline void _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G& graph, const typename G:: │ │ │ │ +EdgeIterator& edge, const ColIter& _c_o_l) │ │ │ │ +1449 { │ │ │ │ +1450 real_type eij = norm_(*_c_o_l); │ │ │ │ +1451 typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r opposite_entry = │ │ │ │ +1452 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ +1453 │ │ │ │ +1454 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ +1455 { │ │ │ │ +1456 // Consider this as a weak connection we disregard. │ │ │ │ +1457 return; │ │ │ │ +1458 } │ │ │ │ +1459 real_type eji = norm_(*opposite_entry); │ │ │ │ +1460 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ +1461 if(!N::is_sign_preserving || (eij<0 || eji<0)) │ │ │ │ +1462 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) * │ │ │ │ +1463 eij/ diagonal_ > alpha() * maxValue_) { │ │ │ │ +1464 edge.properties().setDepends(); │ │ │ │ +1465 edge.properties().setInfluences(); │ │ │ │ +1466 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), │ │ │ │ +edge.source()); │ │ │ │ +1467 other.setInfluences(); │ │ │ │ +1468 other.setDepends(); │ │ │ │ +1469 } │ │ │ │ +1470 } │ │ │ │ +1471 │ │ │ │ +1472 template │ │ │ │ +1473 inline bool _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ +1474 { │ │ │ │ +1475 return maxValue_ < beta(); │ │ │ │ +1476 } │ │ │ │ +1477 │ │ │ │ +1478 │ │ │ │ +1479 template │ │ │ │ +1480 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const Matrix* matrix) │ │ │ │ +1481 { │ │ │ │ +1482 matrix_ = matrix; │ │ │ │ +1483 } │ │ │ │ +1484 │ │ │ │ +1485 template │ │ │ │ +1486 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t_R_o_w([[maybe_unused]] const Row& row, int │ │ │ │ +index) │ │ │ │ +1487 { │ │ │ │ +1488 using std::min; │ │ │ │ +1489 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ +numeric_limits::min()); │ │ │ │ +1490 row_ = index; │ │ │ │ +1491 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ +1492 } │ │ │ │ +1493 │ │ │ │ +1494 template │ │ │ │ +1495 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(const ColIter& _c_o_l) │ │ │ │ +1496 { │ │ │ │ +1497 using std::max; │ │ │ │ +1498 maxValue_ = max(maxValue_, -norm_(*_c_o_l)); │ │ │ │ +1499 } │ │ │ │ +1500 │ │ │ │ +1501 template │ │ │ │ +1502 template │ │ │ │ +1503 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_e_x_a_m_i_n_e(G& graph, const typename G:: │ │ │ │ +EdgeIterator& edge, const ColIter& _c_o_l) │ │ │ │ +1504 { │ │ │ │ +1505 if(-norm_(*_c_o_l) >= maxValue_ * alpha()) { │ │ │ │ +1506 edge.properties().setDepends(); │ │ │ │ +1507 typedef typename G::EdgeDescriptor ED; │ │ │ │ +1508 ED e= graph.findEdge(edge.target(), edge.source()); │ │ │ │ +1509 if(e!=std::numeric_limits::max()) │ │ │ │ +1510 { │ │ │ │ +1511 typename G::EdgeProperties& other = graph.getEdgeProperties(e); │ │ │ │ +1512 other.setInfluences(); │ │ │ │ +1513 } │ │ │ │ +1514 } │ │ │ │ +1515 } │ │ │ │ 1516 │ │ │ │ -1517 // calculate total receive message size │ │ │ │ -1518 int totalNoRecv = 0; │ │ │ │ -1519 for(int i=0; i0; │ │ │ │ -1540 │ │ │ │ -1541 // Delete memory │ │ │ │ -1542 delete[] gnoSend; │ │ │ │ -1543 delete[] gsendToDispl; │ │ │ │ -1544 delete[] gsendTo; │ │ │ │ +1517 template │ │ │ │ +1518 inline bool _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ +1519 { │ │ │ │ +1520 return maxValue_ < beta() * diagonal_; │ │ │ │ +1521 } │ │ │ │ +1522 │ │ │ │ +1523 template │ │ │ │ +1524 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_A_g_g_r_e_g_a_t_e(MatrixGraph& graph, AggregatesMap& │ │ │ │ +aggregates, │ │ │ │ +1525 VertexSet& connected, std::vector& front) │ │ │ │ +1526 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates), │ │ │ │ +1527 connected_(connected), front_(front) │ │ │ │ +1528 {} │ │ │ │ +1529 │ │ │ │ +1530 template │ │ │ │ +1531 void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_r_e_c_o_n_s_t_r_u_c_t(const _V_e_r_t_e_x& vertex) │ │ │ │ +1532 { │ │ │ │ +1533 /* │ │ │ │ +1534 vertices_.push_back(vertex); │ │ │ │ +1535 typedef typename VertexList::const_iterator iterator; │ │ │ │ +1536 iterator begin = vertices_.begin(); │ │ │ │ +1537 iterator end = vertices_.end();*/ │ │ │ │ +1538 throw "Not yet implemented"; │ │ │ │ +1539 │ │ │ │ +1540 // while(begin!=end){ │ │ │ │ +1541 //for(); │ │ │ │ +1542 // } │ │ │ │ +1543 │ │ │ │ +1544 } │ │ │ │ 1545 │ │ │ │ -1546 │ │ │ │ -1547#ifdef DEBUG_REPART │ │ │ │ -1548 if(recvFrom.size()) { │ │ │ │ -1549 std::cout< GlobalVector; │ │ │ │ -1582 std::vector > myOwnerVec; │ │ │ │ -1583 std::set myOverlapSet; │ │ │ │ -1584 GlobalVector sendOwnerVec; │ │ │ │ -1585 std::set sendOverlapSet; │ │ │ │ -1586 std::set myNeighbors; │ │ │ │ -1587 │ │ │ │ -1588 // getOwnerOverlapVec(graph, setPartition, oocomm.globalLookup │ │ │ │ -(), │ │ │ │ -1589 // mype, mype, myOwnerVec, myOverlapSet, redistInf, myNeighbors); │ │ │ │ -1590 │ │ │ │ -1591 char **sendBuffers=new char*[noSendTo]; │ │ │ │ -1592 MPI_Request *requests = new MPI_Request[noSendTo]; │ │ │ │ -1593 │ │ │ │ -1594 // Create all messages to be sent │ │ │ │ -1595 for(int i=0; i < noSendTo; ++i) { │ │ │ │ -1596 // clear the vector for sending │ │ │ │ -1597 sendOwnerVec.clear(); │ │ │ │ -1598 sendOverlapSet.clear(); │ │ │ │ -1599 // get all owner and overlap vertices for process j and save these │ │ │ │ -1600 // in the vectors sendOwnerVec and sendOverlapSet │ │ │ │ -1601 std::set neighbors; │ │ │ │ -1602 getOwnerOverlapVec(graph, setPartition, oocomm._g_l_o_b_a_l_L_o_o_k_u_p(), │ │ │ │ -1603 mype, sendTo[i], sendOwnerVec, sendOverlapSet, redistInf, │ │ │ │ -1604 neighbors); │ │ │ │ -1605 // +2, we need 2 integer more for the length of each part │ │ │ │ -1606 // (owner/overlap) of the array │ │ │ │ -1607 int buffersize=0; │ │ │ │ -1608 int tsize; │ │ │ │ -1609 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ -&buffersize); │ │ │ │ -1610 MPI_Pack_size(sendOwnerVec.size(), MPITraits::getType(), │ │ │ │ -oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ -1611 buffersize +=tsize; │ │ │ │ -1612 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ -&tsize); │ │ │ │ -1613 buffersize +=tsize; │ │ │ │ -1614 MPI_Pack_size(sendOverlapSet.size(), MPITraits::getType(), │ │ │ │ -oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ -1615 buffersize += tsize; │ │ │ │ -1616 MPI_Pack_size(1, MPITraits::getType(), oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), │ │ │ │ -&tsize); │ │ │ │ -1617 buffersize += tsize; │ │ │ │ -1618 MPI_Pack_size(neighbors.size(), MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &tsize); │ │ │ │ -1619 buffersize += tsize; │ │ │ │ -1620 │ │ │ │ -1621 sendBuffers[i] = new char[buffersize]; │ │ │ │ -1622 │ │ │ │ -1623#ifdef DEBUG_REPART │ │ │ │ -1624 std::cout<0) { │ │ │ │ -1644 // probe for an incoming message │ │ │ │ -1645 MPI_Status stat; │ │ │ │ -1646 MPI_Probe(MPI_ANY_SOURCE, 99, oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), &stat); │ │ │ │ -1647 int buffersize; │ │ │ │ -1648 MPI_Get_count(&stat, MPI_PACKED, &buffersize); │ │ │ │ +1546 template │ │ │ │ +1547 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_e_e_d(const _V_e_r_t_e_x& vertex) │ │ │ │ +1548 { │ │ │ │ +1549 dvverb<<"Connected cleared"<::UNAGGREGATED && │ │ │ │ +1616 !graph_.getVertexProperties(edge.target()).front()) │ │ │ │ +1617 { │ │ │ │ +1618 front_.push_back(edge.target()); │ │ │ │ +1619 graph_.getVertexProperties(edge.target()).setFront(); │ │ │ │ +1620 } │ │ │ │ +1621 dvverb <<" size="< │ │ │ │ +1629 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_l_e_a_r() │ │ │ │ +1630 { │ │ │ │ +1631 vertices_.clear(); │ │ │ │ +1632 connected_.clear(); │ │ │ │ +1633 id_=-1; │ │ │ │ +1634 } │ │ │ │ +1635 │ │ │ │ +1636 template │ │ │ │ +1637 inline typename Aggregate::VertexSet::size_type │ │ │ │ +1638 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_i_z_e() │ │ │ │ +1639 { │ │ │ │ +1640 return vertices_.size(); │ │ │ │ +1641 } │ │ │ │ +1642 │ │ │ │ +1643 template │ │ │ │ +1644 inline typename Aggregate::VertexSet::size_type │ │ │ │ +1645 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_n_e_c_t_S_i_z_e() │ │ │ │ +1646 { │ │ │ │ +1647 return connected_.size(); │ │ │ │ +1648 } │ │ │ │ 1649 │ │ │ │ -1650 if(oldbuffersize │ │ │ │ +1651 inline int _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_i_d() │ │ │ │ +1652 { │ │ │ │ +1653 return id_; │ │ │ │ +1654 } │ │ │ │ +1655 │ │ │ │ +1656 template │ │ │ │ +1657 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_b_e_g_i_n() │ │ │ │ +const │ │ │ │ +1658 { │ │ │ │ +1659 return vertices_.begin(); │ │ │ │ 1660 } │ │ │ │ 1661 │ │ │ │ -1662 if(recvBuf) │ │ │ │ -1663 delete[] recvBuf; │ │ │ │ -1664 │ │ │ │ -1665 time.reset(); │ │ │ │ -1666 // Wait for sending messages to complete │ │ │ │ -1667 MPI_Status *statuses = new MPI_Status[noSendTo]; │ │ │ │ -1668 int send = MPI_Waitall(noSendTo, requests, statuses); │ │ │ │ -1669 │ │ │ │ -1670 // check for errors │ │ │ │ -1671 if(send==MPI_ERR_IN_STATUS) { │ │ │ │ -1672 std::cerr< │ │ │ │ +1663 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_e_n_d() const │ │ │ │ +1664 { │ │ │ │ +1665 return vertices_.end(); │ │ │ │ +1666 } │ │ │ │ +1667 │ │ │ │ +1668 template │ │ │ │ +1669 const V _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D = std::numeric_limits::max(); │ │ │ │ +1670 │ │ │ │ +1671 template │ │ │ │ +1672 const V _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_I_S_O_L_A_T_E_D = std::numeric_limits::max()-1; │ │ │ │ +1673 │ │ │ │ +1674 template │ │ │ │ +1675 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p() │ │ │ │ +1676 : aggregates_(0) │ │ │ │ +1677 {} │ │ │ │ +1678 │ │ │ │ +1679 template │ │ │ │ +1680 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_~_A_g_g_r_e_g_a_t_e_s_M_a_p() │ │ │ │ +1681 { │ │ │ │ +1682 if(aggregates_!=0) │ │ │ │ +1683 delete[] aggregates_; │ │ │ │ 1684 } │ │ │ │ 1685 │ │ │ │ -1686 if(verbose) { │ │ │ │ -1687 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1688 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1689 std::cout<<" Receiving and saving took "<< │ │ │ │ -1690 time.elapsed()< │ │ │ │ +1688 inline _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p(std::size_t noVertices) │ │ │ │ +1689 { │ │ │ │ +1690 allocate(noVertices); │ │ │ │ 1691 } │ │ │ │ -1692 time.reset(); │ │ │ │ -1693 │ │ │ │ -1694 for(int i=0; i < noSendTo; ++i) │ │ │ │ -1695 delete[] sendBuffers[i]; │ │ │ │ -1696 │ │ │ │ -1697 delete[] sendBuffers; │ │ │ │ -1698 delete[] statuses; │ │ │ │ -1699 delete[] requests; │ │ │ │ -1700 │ │ │ │ -1701 redistInf._s_e_t_C_o_m_m_u_n_i_c_a_t_o_r(oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ -1702 │ │ │ │ -1703 // │ │ │ │ -1704 // 4.2) Create the IndexSet etc. │ │ │ │ -1705 // │ │ │ │ -1706 │ │ │ │ -1707 // build the new outputIndexSet │ │ │ │ +1692 │ │ │ │ +1693 template │ │ │ │ +1694 inline std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_n_o_V_e_r_t_i_c_e_s() const │ │ │ │ +1695 { │ │ │ │ +1696 return noVertices_; │ │ │ │ +1697 } │ │ │ │ +1698 │ │ │ │ +1699 template │ │ │ │ +1700 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_a_l_l_o_c_a_t_e(std::size_t noVertices) │ │ │ │ +1701 { │ │ │ │ +1702 aggregates_ = new _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r[noVertices]; │ │ │ │ +1703 noVertices_ = noVertices; │ │ │ │ +1704 │ │ │ │ +1705 for(std::size_t i=0; i < noVertices; i++) │ │ │ │ +1706 aggregates_[i]=UNAGGREGATED; │ │ │ │ +1707 } │ │ │ │ 1708 │ │ │ │ -1709 │ │ │ │ -1710 int color=0; │ │ │ │ -1711 │ │ │ │ -1712 if (!existentOnNextLevel) { │ │ │ │ -1713 // this process is not used anymore │ │ │ │ -1714 color= MPI_UNDEFINED; │ │ │ │ +1709 template │ │ │ │ +1710 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_f_r_e_e() │ │ │ │ +1711 { │ │ │ │ +1712 assert(aggregates_ != 0); │ │ │ │ +1713 delete[] aggregates_; │ │ │ │ +1714 aggregates_=0; │ │ │ │ 1715 } │ │ │ │ -1716 MPI_Comm outputComm; │ │ │ │ -1717 │ │ │ │ -1718 MPI_Comm_split(oocomm._c_o_m_m_u_n_i_c_a_t_o_r(), color, oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank(), │ │ │ │ -&outputComm); │ │ │ │ -1719 outcomm = std::make_shared(outputComm,SolverCategory::category │ │ │ │ -(oocomm),true); │ │ │ │ -1720 │ │ │ │ -1721 // translate neighbor ranks. │ │ │ │ -1722 int newrank=outcomm->communicator().rank(); │ │ │ │ -1723 int *newranks=new int[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ -1724 std::vector tneighbors; │ │ │ │ -1725 tneighbors.reserve(myNeighbors.size()); │ │ │ │ -1726 │ │ │ │ -1727 typename OOComm::ParallelIndexSet& outputIndexSet = outcomm->indexSet(); │ │ │ │ -1728 │ │ │ │ -1729 MPI_Allgather(&newrank, 1, MPI_INT, newranks, 1, │ │ │ │ -1730 MPI_INT, oocomm._c_o_m_m_u_n_i_c_a_t_o_r()); │ │ │ │ -1731 │ │ │ │ -1732#ifdef DEBUG_REPART │ │ │ │ -1733 std::cout<=0); │ │ │ │ -1737 std::cout<<*i<<"->"<first,LocalIndexT(i, OwnerOverlapCopyAttributeSet:: │ │ │ │ -owner, true)); │ │ │ │ -1770 redistInf._a_d_d_R_e_c_e_i_v_e_I_n_d_e_x(g->second, i); │ │ │ │ -1771 } │ │ │ │ -1772 │ │ │ │ -1773 if(verbose) { │ │ │ │ -1774 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1775 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1776 std::cout<<" Adding owner indices took "<< │ │ │ │ -1777 time.elapsed()<local().attribute())) { │ │ │ │ -1813 numOfOwnVtx++; │ │ │ │ -1814 } │ │ │ │ -1815 } │ │ │ │ -1816 numOfOwnVtx = oocomm._c_o_m_m_u_n_i_c_a_t_o_r().sum(numOfOwnVtx); │ │ │ │ -1817 // if(numOfOwnVtx!=indexMap.globalOwnerVertices) │ │ │ │ -1818 // { │ │ │ │ -1819 // std::cerr< │ │ │ │ +1718 inline typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ +1719 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_o_p_e_r_a_t_o_r_[_](const VertexDescriptor& v) │ │ │ │ +1720 { │ │ │ │ +1721 return aggregates_[v]; │ │ │ │ +1722 } │ │ │ │ +1723 │ │ │ │ +1724 template │ │ │ │ +1725 inline const typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ +1726 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_o_p_e_r_a_t_o_r_[_](const VertexDescriptor& v) const │ │ │ │ +1727 { │ │ │ │ +1728 return aggregates_[v]; │ │ │ │ +1729 } │ │ │ │ +1730 │ │ │ │ +1731 template │ │ │ │ +1732 template │ │ │ │ +1733 inline std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const V& start, │ │ │ │ +1734 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1735 const G& graph, F& aggregateVisitor, │ │ │ │ +1736 VM& visitedMap) const │ │ │ │ +1737 { │ │ │ │ +1738 VertexList vlist; │ │ │ │ +1739 │ │ │ │ +1740 DummyEdgeVisitor dummy; │ │ │ │ +1741 return breadthFirstSearch(start, aggregate, graph, vlist, │ │ │ │ +aggregateVisitor, dummy, visitedMap); │ │ │ │ +1742 } │ │ │ │ +1743 │ │ │ │ +1744 template │ │ │ │ +1745 template │ │ │ │ +1746 std::size_t _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h(const V& start, │ │ │ │ +1747 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1748 const G& graph, │ │ │ │ +1749 L& visited, │ │ │ │ +1750 F1& aggregateVisitor, │ │ │ │ +1751 F2& nonAggregateVisitor, │ │ │ │ +1752 VM& visitedMap) const │ │ │ │ +1753 { │ │ │ │ +1754 typedef typename L::const_iterator ListIterator; │ │ │ │ +1755 int visitedSpheres = 0; │ │ │ │ +1756 │ │ │ │ +1757 visited.push_back(start); │ │ │ │ +1758 put(visitedMap, start, true); │ │ │ │ +1759 │ │ │ │ +1760 ListIterator current = visited.begin(); │ │ │ │ +1761 ListIterator end = visited.end(); │ │ │ │ +1762 std::size_t i=0, size=visited.size(); │ │ │ │ +1763 │ │ │ │ +1764 // visit the neighbours of all vertices of the │ │ │ │ +1765 // current sphere. │ │ │ │ +1766 while(current != end) { │ │ │ │ +1767 │ │ │ │ +1768 for(; i │ │ │ │ +1803 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_o_r() │ │ │ │ +1804 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1) │ │ │ │ +1805 {} │ │ │ │ +1806 │ │ │ │ +1807 template │ │ │ │ +1808 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_~_A_g_g_r_e_g_a_t_o_r() │ │ │ │ +1809 { │ │ │ │ +1810 size_=-1; │ │ │ │ +1811 } │ │ │ │ +1812 │ │ │ │ +1813 template │ │ │ │ +1814 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ +1815 const typename C::Matrix& matrix, │ │ │ │ +1816 C criterion, bool firstlevel) │ │ │ │ +1817 { │ │ │ │ +1818 // assert(graph.isBuilt()); │ │ │ │ +1819 typedef typename C::Matrix Matrix; │ │ │ │ +1820 typedef typename G::VertexIterator VertexIterator; │ │ │ │ +1821 │ │ │ │ +1822 criterion.init(&matrix); │ │ │ │ +1823 │ │ │ │ +1824 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); │ │ │ │ +++vertex) { │ │ │ │ +1825 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e Row; │ │ │ │ +1826 │ │ │ │ +1827 const Row& row = matrix[*vertex]; │ │ │ │ +1828 │ │ │ │ +1829 // Tell the criterion what row we will examine now │ │ │ │ +1830 // This might for example be used for calculating the │ │ │ │ +1831 // maximum offdiagonal value │ │ │ │ +1832 criterion.initRow(row, *vertex); │ │ │ │ 1833 │ │ │ │ -1834 │ │ │ │ -1835 if(color != MPI_UNDEFINED) { │ │ │ │ -1836 outcomm->remoteIndices().setNeighbours(tneighbors); │ │ │ │ -1837 outcomm->remoteIndices().template rebuild(); │ │ │ │ -1838 │ │ │ │ -1839 } │ │ │ │ -1840 │ │ │ │ -1841 // release the memory │ │ │ │ -1842 delete[] sendTo; │ │ │ │ -1843 │ │ │ │ -1844 if(verbose) { │ │ │ │ -1845 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1846 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1847 std::cout<<" Storing indexsets took "<< │ │ │ │ -1848 time.elapsed()< │ │ │ │ -1869 bool graphRepartition(const G& graph, P& oocomm, int nparts, │ │ │ │ -1870 std::shared_ptr

& outcomm, │ │ │ │ -1871 R& redistInf, │ │ │ │ -1872 bool v=false) │ │ │ │ -1873 { │ │ │ │ -1874 if(nparts!=oocomm.size()) │ │ │ │ -1875 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ +1834 // On a first path all columns are examined. After this │ │ │ │ +1835 // the calculator should know whether the vertex is isolated. │ │ │ │ +1836 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIterator; │ │ │ │ +1837 ColIterator end = row.end(); │ │ │ │ +1838 typename FieldTraits::real_type │ │ │ │ +absoffdiag=0.; │ │ │ │ +1839 │ │ │ │ +1840 using std::max; │ │ │ │ +1841 if(firstlevel) { │ │ │ │ +1842 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ +1843 if(_c_o_l.index()!=*vertex) { │ │ │ │ +1844 criterion.examine(_c_o_l); │ │ │ │ +1845 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm()); │ │ │ │ +1846 } │ │ │ │ +1847 │ │ │ │ +1848 if(absoffdiag==0) │ │ │ │ +1849 vertex.properties().setExcludedBorder(); │ │ │ │ +1850 } │ │ │ │ +1851 else │ │ │ │ +1852 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ +1853 if(_c_o_l.index()!=*vertex) │ │ │ │ +1854 criterion.examine(_c_o_l); │ │ │ │ +1855 │ │ │ │ +1856 // reset the vertex properties │ │ │ │ +1857 //vertex.properties().reset(); │ │ │ │ +1858 │ │ │ │ +1859 // Check whether the vertex is isolated. │ │ │ │ +1860 if(criterion.isIsolated()) { │ │ │ │ +1861 //std::cout<<"ISOLATED: "<<*vertex< │ │ │ │ -1880 bool _c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(const G& graph, P& oocomm, int nparts, │ │ │ │ -1881 std::shared_ptr

& outcomm, │ │ │ │ -1882 R& redistInf, │ │ │ │ -1883 bool v=false) │ │ │ │ -1884 { │ │ │ │ -1885 if(nparts!=oocomm.size()) │ │ │ │ -1886 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ -1887 } │ │ │ │ -1888#endif // HAVE_MPI │ │ │ │ -1889} // end of namespace Dune │ │ │ │ -1890#endif │ │ │ │ -_g_l_o_b_a_l_O_w_n_e_r_V_e_r_t_i_c_e_s │ │ │ │ -int globalOwnerVertices │ │ │ │ -DDeeffiinniittiioonn repartition.hh:175 │ │ │ │ +1879 │ │ │ │ +1880 template │ │ │ │ +1881 template │ │ │ │ +1882 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_<_V_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r(const │ │ │ │ +AggregatesMap& aggregates, │ │ │ │ +1883 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, V& visitor) │ │ │ │ +1884 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor) │ │ │ │ +1885 {} │ │ │ │ +1886 │ │ │ │ +1887 template │ │ │ │ +1888 template │ │ │ │ +1889 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_<_V_>_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +1890 { │ │ │ │ +1891 if(aggregates_[edge.target()]==aggregate_) │ │ │ │ +1892 visitor_->operator()(edge); │ │ │ │ +1893 } │ │ │ │ +1894 │ │ │ │ +1895 template │ │ │ │ +1896 template │ │ │ │ +1897 inline void Aggregator::visitAggregateNeighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ +1898 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1899 const AggregatesMap& aggregates, │ │ │ │ +1900 V& visitor) const │ │ │ │ +1901 { │ │ │ │ +1902 // Only evaluates for edge pointing to the aggregate │ │ │ │ +1903 AggregateVisitor v(aggregates, aggregate, visitor); │ │ │ │ +1904 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, v); │ │ │ │ +1905 } │ │ │ │ +1906 │ │ │ │ +1907 │ │ │ │ +1908 template │ │ │ │ +1909 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_C_o_u_n_t_e_r() │ │ │ │ +1910 : count_(0) │ │ │ │ +1911 {} │ │ │ │ +1912 │ │ │ │ +1913 template │ │ │ │ +1914 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t() │ │ │ │ +1915 { │ │ │ │ +1916 ++count_; │ │ │ │ +1917 } │ │ │ │ +1918 │ │ │ │ +1919 template │ │ │ │ +1920 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_d_e_c_r_e_m_e_n_t() │ │ │ │ +1921 { │ │ │ │ +1922 --count_; │ │ │ │ +1923 } │ │ │ │ +1924 template │ │ │ │ +1925 inline int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_u_n_t_e_r_:_:_v_a_l_u_e() │ │ │ │ +1926 { │ │ │ │ +1927 return count_; │ │ │ │ +1928 } │ │ │ │ +1929 │ │ │ │ +1930 template │ │ │ │ +1931 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_T_w_o_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +1932 { │ │ │ │ +1933 if(edge.properties().isTwoWay()) │ │ │ │ +1934 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1935 } │ │ │ │ +1936 │ │ │ │ +1937 template │ │ │ │ +1938 int Aggregator::twoWayConnections(const _V_e_r_t_e_x& vertex, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1939 const AggregatesMap& aggregates) const │ │ │ │ +1940 { │ │ │ │ +1941 TwoWayCounter counter; │ │ │ │ +1942 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ +1943 return counter.value(); │ │ │ │ +1944 } │ │ │ │ +1945 │ │ │ │ +1946 template │ │ │ │ +1947 int Aggregator::oneWayConnections(const _V_e_r_t_e_x& vertex, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1948 const AggregatesMap& aggregates) const │ │ │ │ +1949 { │ │ │ │ +1950 OneWayCounter counter; │ │ │ │ +1951 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ +1952 return counter.value(); │ │ │ │ +1953 } │ │ │ │ +1954 │ │ │ │ +1955 template │ │ │ │ +1956 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_O_n_e_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +1957 { │ │ │ │ +1958 if(edge.properties().isOneWay()) │ │ │ │ +1959 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1960 } │ │ │ │ +1961 │ │ │ │ +1962 template │ │ │ │ +1963 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r(const │ │ │ │ +VertexSet& connected, │ │ │ │ +1964 const AggregatesMap& aggregates) │ │ │ │ +1965 : Counter(), connected_(connected), aggregates_(aggregates) │ │ │ │ +1966 {} │ │ │ │ +1967 │ │ │ │ +1968 │ │ │ │ +1969 template │ │ │ │ +1970 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +1971 { │ │ │ │ +1972 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || │ │ │ │ +aggregates_[edge.target()]==AggregatesMap::UNAGGREGATED) │ │ │ │ +1973 // Would be a new connection │ │ │ │ +1974 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1975 else{ │ │ │ │ +1976 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1977 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1978 } │ │ │ │ +1979 } │ │ │ │ +1980 │ │ │ │ +1981 template │ │ │ │ +1982 inline double Aggregator::connectivity(const _V_e_r_t_e_x& vertex, const │ │ │ │ +AggregatesMap& aggregates) const │ │ │ │ +1983 { │ │ │ │ +1984 ConnectivityCounter counter(connected_, aggregates); │ │ │ │ +1985 double noNeighbours=_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ +1986 return (double)counter.value()/noNeighbours; │ │ │ │ +1987 } │ │ │ │ +1988 │ │ │ │ +1989 template │ │ │ │ +1990 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r() │ │ │ │ +1991 : Counter() │ │ │ │ +1992 {} │ │ │ │ +1993 │ │ │ │ +1994 template │ │ │ │ +1995 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +1996 { │ │ │ │ +1997 if(edge.properties().depends()) │ │ │ │ +1998 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1999 if(edge.properties().influences()) │ │ │ │ +2000 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +2001 } │ │ │ │ +2002 │ │ │ │ +2003 template │ │ │ │ +2004 int Aggregator::unusedNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ +AggregatesMap& aggregates) const │ │ │ │ +2005 { │ │ │ │ +2006 return aggregateNeighbours(vertex, AggregatesMap::UNAGGREGATED, │ │ │ │ +aggregates); │ │ │ │ +2007 } │ │ │ │ +2008 │ │ │ │ +2009 template │ │ │ │ +2010 std::pair Aggregator::neighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ +2011 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +2012 const AggregatesMap& aggregates) const │ │ │ │ +2013 { │ │ │ │ +2014 DependencyCounter unused, aggregated; │ │ │ │ +2015 typedef AggregateVisitor CounterT; │ │ │ │ +2016 typedef std::tuple CounterTuple; │ │ │ │ +2017 CombinedFunctor visitors(CounterTuple(CounterT(aggregates, │ │ │ │ +AggregatesMap::UNAGGREGATED, unused), CounterT(aggregates, aggregate, │ │ │ │ +aggregated))); │ │ │ │ +2018 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, visitors); │ │ │ │ +2019 return std::make_pair(unused.value(), aggregated.value()); │ │ │ │ +2020 } │ │ │ │ +2021 │ │ │ │ +2022 │ │ │ │ +2023 template │ │ │ │ +2024 int Aggregator::aggregateNeighbours(const _V_e_r_t_e_x& vertex, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, const AggregatesMap& aggregates) const │ │ │ │ +2025 { │ │ │ │ +2026 DependencyCounter counter; │ │ │ │ +2027 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ +2028 return counter.value(); │ │ │ │ +2029 } │ │ │ │ +2030 │ │ │ │ +2031 template │ │ │ │ +2032 std::size_t Aggregator::distance(const _V_e_r_t_e_x& vertex, const │ │ │ │ +AggregatesMap& aggregates) │ │ │ │ +2033 { │ │ │ │ +2034 return 0; │ │ │ │ +2035 typename PropertyMapTypeSelector::Type visitedMap = │ │ │ │ +_g_e_t(VertexVisitedTag(), *graph_); │ │ │ │ +2036 VertexList vlist; │ │ │ │ +2037 typename AggregatesMap::DummyEdgeVisitor dummy; │ │ │ │ +2038 return aggregates.template breadthFirstSearch(vertex, │ │ │ │ +2039 aggregate_->_i_d(), *graph_, │ │ │ │ +2040 vlist, dummy, dummy, visitedMap); │ │ │ │ +2041 } │ │ │ │ +2042 │ │ │ │ +2043 template │ │ │ │ +2044 inline _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_F_r_o_n_t_M_a_r_k_e_r(std::vector& front, │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h& graph) │ │ │ │ +2045 : front_(front), graph_(graph) │ │ │ │ +2046 {} │ │ │ │ +2047 │ │ │ │ +2048 template │ │ │ │ +2049 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +2050 { │ │ │ │ +2051 _V_e_r_t_e_x target = edge.target(); │ │ │ │ +2052 │ │ │ │ +2053 if(!graph_.getVertexProperties(target).front()) { │ │ │ │ +2054 front_.push_back(target); │ │ │ │ +2055 graph_.getVertexProperties(target).setFront(); │ │ │ │ +2056 } │ │ │ │ +2057 } │ │ │ │ +2058 │ │ │ │ +2059 template │ │ │ │ +2060 inline bool Aggregator::admissible(const _V_e_r_t_e_x& vertex, const │ │ │ │ +_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, const AggregatesMap& aggregates) const │ │ │ │ +2061 { │ │ │ │ +2062 // Todo │ │ │ │ +2063 Dune::dvverb<<" Admissible not yet implemented!"<endEdges(vertex); │ │ │ │ +2071 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ +2072 // if(edge.properties().depends() && !edge.properties().influences() │ │ │ │ +2073 if(edge.properties().isStrong() │ │ │ │ +2074 && aggregates[edge.target()]==aggregate) │ │ │ │ +2075 { │ │ │ │ +2076 // Search for another link to the aggregate │ │ │ │ +2077 Iterator edge1 = edge; │ │ │ │ +2078 for(++edge1; edge1 != vend; ++edge1) { │ │ │ │ +2079 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ +2080 if(edge1.properties().isStrong() │ │ │ │ +2081 && aggregates[edge.target()]==aggregate) │ │ │ │ +2082 { │ │ │ │ +2083 //Search for an edge connecting the two vertices that is │ │ │ │ +2084 //strong │ │ │ │ +2085 bool found=false; │ │ │ │ +2086 Iterator v2end = graph_->endEdges(edge.target()); │ │ │ │ +2087 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; │ │ │ │ +++edge2) { │ │ │ │ +2088 if(edge2.target()==edge1.target() && │ │ │ │ +2089 edge2.properties().isStrong()) { │ │ │ │ +2090 found =true; │ │ │ │ +2091 break; │ │ │ │ +2092 } │ │ │ │ +2093 } │ │ │ │ +2094 if(found) │ │ │ │ +2095 { │ │ │ │ +2096 return true; │ │ │ │ +2097 } │ │ │ │ +2098 } │ │ │ │ +2099 } │ │ │ │ +2100 } │ │ │ │ +2101 } │ │ │ │ +2102 │ │ │ │ +2103 // Situation 2: cluster node depends on front node and other cluster node │ │ │ │ +2105 vend = graph_->endEdges(vertex); │ │ │ │ +2106 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ +2107 //if(!edge.properties().depends() && edge.properties().influences() │ │ │ │ +2108 if(edge.properties().isStrong() │ │ │ │ +2109 && aggregates[edge.target()]==aggregate) │ │ │ │ +2110 { │ │ │ │ +2111 // Search for a link from target that stays within the aggregate │ │ │ │ +2112 Iterator v1end = graph_->endEdges(edge.target()); │ │ │ │ +2113 │ │ │ │ +2114 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; │ │ │ │ +++edge1) { │ │ │ │ +2115 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ +2116 if(edge1.properties().isStrong() │ │ │ │ +2117 && aggregates[edge1.target()]==aggregate) │ │ │ │ +2118 { │ │ │ │ +2119 bool found=false; │ │ │ │ +2120 // Check if front node is also connected to this one │ │ │ │ +2121 Iterator v2end = graph_->endEdges(vertex); │ │ │ │ +2122 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) │ │ │ │ +{ │ │ │ │ +2123 if(edge2.target()==edge1.target()) { │ │ │ │ +2124 if(edge2.properties().isStrong()) │ │ │ │ +2125 found=true; │ │ │ │ +2126 break; │ │ │ │ +2127 } │ │ │ │ +2128 } │ │ │ │ +2129 if(found) │ │ │ │ +2130 { │ │ │ │ +2131 return true; │ │ │ │ +2132 } │ │ │ │ +2133 } │ │ │ │ +2134 } │ │ │ │ +2135 } │ │ │ │ +2136 } │ │ │ │ +2137 return false; │ │ │ │ +2138 } │ │ │ │ +2139 │ │ │ │ +2140 template │ │ │ │ +2141 void Aggregator::unmarkFront() │ │ │ │ +2142 { │ │ │ │ +2143 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2144 │ │ │ │ +2145 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex) │ │ │ │ +2146 graph_->getVertexProperties(*vertex).resetFront(); │ │ │ │ +2147 │ │ │ │ +2148 front_.clear(); │ │ │ │ +2149 } │ │ │ │ +2150 │ │ │ │ +2151 template │ │ │ │ +2152 inline void │ │ │ │ +2153 Aggregator::nonisoNeighbourAggregate(const _V_e_r_t_e_x& vertex, │ │ │ │ +2154 const AggregatesMap& aggregates, │ │ │ │ +2155 SLList& neighbours) const │ │ │ │ +2156 { │ │ │ │ +2157 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +2158 Iterator end=graph_->beginEdges(vertex); │ │ │ │ +2159 neighbours.clear(); │ │ │ │ +2160 │ │ │ │ +2161 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge) │ │ │ │ +2162 { │ │ │ │ +2163 if(aggregates[edge.target()]!=AggregatesMap::UNAGGREGATED && │ │ │ │ +graph_->getVertexProperties(edge.target()).isolated()) │ │ │ │ +2164 neighbours.push_back(aggregates[edge.target()]); │ │ │ │ +2165 } │ │ │ │ +2166 } │ │ │ │ +2167 │ │ │ │ +2168 template │ │ │ │ +2169 inline typename G::VertexDescriptor Aggregator::mergeNeighbour(const │ │ │ │ +_V_e_r_t_e_x& vertex, const AggregatesMap& aggregates) const │ │ │ │ +2170 { │ │ │ │ +2171 typedef typename _M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +2172 │ │ │ │ +2173 Iterator end = graph_->endEdges(vertex); │ │ │ │ +2174 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) { │ │ │ │ +2175 if(aggregates[edge.target()] != AggregatesMap::UNAGGREGATED && │ │ │ │ +2176 graph_->getVertexProperties(edge.target()).isolated() == graph_- │ │ │ │ +>getVertexProperties(edge.source()).isolated()) { │ │ │ │ +2177 if( graph_->getVertexProperties(vertex).isolated() || │ │ │ │ +2178 ((edge.properties().depends() || edge.properties().influences()) │ │ │ │ +2179 && admissible(vertex, aggregates[edge.target()], aggregates))) │ │ │ │ +2180 return edge.target(); │ │ │ │ +2181 } │ │ │ │ +2182 } │ │ │ │ +2183 return AggregatesMap::UNAGGREGATED; │ │ │ │ +2184 } │ │ │ │ +2185 │ │ │ │ +2186 template │ │ │ │ +2187 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r(const │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h& graph) │ │ │ │ +2188 : Counter(), graph_(graph) │ │ │ │ +2189 {} │ │ │ │ +2190 │ │ │ │ +2191 template │ │ │ │ +2192 void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_)(const typename │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ +2193 { │ │ │ │ +2194 if(graph_.getVertexProperties(edge.target()).front()) │ │ │ │ +2195 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +2196 } │ │ │ │ +2197 │ │ │ │ +2198 template │ │ │ │ +2199 int Aggregator::noFrontNeighbours(const _V_e_r_t_e_x& vertex) const │ │ │ │ +2200 { │ │ │ │ +2201 FrontNeighbourCounter counter(*graph_); │ │ │ │ +2202 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ +2203 return counter.value(); │ │ │ │ +2204 } │ │ │ │ +2205 template │ │ │ │ +2206 inline bool Aggregator::connected(const _V_e_r_t_e_x& vertex, │ │ │ │ +2207 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +2208 const AggregatesMap& aggregates) const │ │ │ │ +2209 { │ │ │ │ +2210 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ +2211 const iterator end = graph_->endEdges(vertex); │ │ │ │ +2212 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) │ │ │ │ +2213 if(aggregates[edge.target()]==aggregate) │ │ │ │ +2214 return true; │ │ │ │ +2215 return false; │ │ │ │ +2216 } │ │ │ │ +2217 template │ │ │ │ +2218 inline bool Aggregator::connected(const _V_e_r_t_e_x& vertex, │ │ │ │ +2219 const SLList& aggregateList, │ │ │ │ +2220 const AggregatesMap& aggregates) const │ │ │ │ +2221 { │ │ │ │ +2222 typedef typename SLList::const_iterator Iter; │ │ │ │ +2223 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i) │ │ │ │ +2224 if(connected(vertex, *i, aggregates)) │ │ │ │ +2225 return true; │ │ │ │ +2226 return false; │ │ │ │ +2227 } │ │ │ │ +2228 │ │ │ │ +2229 template │ │ │ │ +2230 template │ │ │ │ +2231 void Aggregator::growIsolatedAggregate(const _V_e_r_t_e_x& seed, const │ │ │ │ +AggregatesMap& aggregates, const C& c) │ │ │ │ +2232 { │ │ │ │ +2233 SLList connectedAggregates; │ │ │ │ +2234 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates); │ │ │ │ +2235 │ │ │ │ +2236 while(aggregate_->_s_i_z_e()< c.minAggregateSize() && aggregate_->_c_o_n_n_e_c_t_S_i_z_e │ │ │ │ +() < c.maxConnectivity()) { │ │ │ │ +2237 double maxCon=-1; │ │ │ │ +2238 std::size_t maxFrontNeighbours=0; │ │ │ │ +2239 │ │ │ │ +2240 _V_e_r_t_e_x candidate=AggregatesMap::UNAGGREGATED; │ │ │ │ +2241 │ │ │ │ +2242 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2243 │ │ │ │ +2244 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ +2245 if(distance(*vertex, aggregates)>c.maxDistance()) │ │ │ │ +2246 continue; // distance of proposes aggregate too big │ │ │ │ +2247 │ │ │ │ +2248 if(connectedAggregates.size()>0) { │ │ │ │ +2249 // there is already a neighbour cluster │ │ │ │ +2250 // front node must be connected to same neighbour cluster │ │ │ │ +2251 │ │ │ │ +2252 if(!connected(*vertex, connectedAggregates, aggregates)) │ │ │ │ +2253 continue; │ │ │ │ +2254 } │ │ │ │ +2255 │ │ │ │ +2256 double con = connectivity(*vertex, aggregates); │ │ │ │ +2257 │ │ │ │ +2258 if(con == maxCon) { │ │ │ │ +2259 std::size_t frontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2260 │ │ │ │ +2261 if(frontNeighbours >= maxFrontNeighbours) { │ │ │ │ +2262 maxFrontNeighbours = frontNeighbours; │ │ │ │ +2263 candidate = *vertex; │ │ │ │ +2264 } │ │ │ │ +2265 }else if(con > maxCon) { │ │ │ │ +2266 maxCon = con; │ │ │ │ +2267 maxFrontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2268 candidate = *vertex; │ │ │ │ +2269 } │ │ │ │ +2270 } │ │ │ │ +2271 │ │ │ │ +2272 if(candidate==AggregatesMap::UNAGGREGATED) │ │ │ │ +2273 break; │ │ │ │ +2274 │ │ │ │ +2275 aggregate_->_a_d_d(candidate); │ │ │ │ +2276 } │ │ │ │ +2277 } │ │ │ │ +2278 │ │ │ │ +2279 template │ │ │ │ +2280 template │ │ │ │ +2281 void Aggregator::growAggregate(const _V_e_r_t_e_x& seed, const │ │ │ │ +AggregatesMap& aggregates, const C& c) │ │ │ │ +2282 { │ │ │ │ +2283 using std::min; │ │ │ │ +2284 │ │ │ │ +2285 std::size_t distance_ =0; │ │ │ │ +2286 while(aggregate_->_s_i_z_e() < c.minAggregateSize()&& distance_ candidates; │ │ │ │ +2291 candidates.reserve(30); │ │ │ │ +2292 │ │ │ │ +2293 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2294 │ │ │ │ +2295 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ +2296 // Only nonisolated nodes are considered │ │ │ │ +2297 if(graph_->getVertexProperties(*vertex).isolated()) │ │ │ │ +2298 continue; │ │ │ │ +2299 │ │ │ │ +2300 int twoWayCons = twoWayConnections(*vertex, aggregate_->_i_d(), aggregates); │ │ │ │ +2301 │ │ │ │ +2302 /* The case of two way connections. */ │ │ │ │ +2303 if( maxTwoCons == twoWayCons && twoWayCons > 0) { │ │ │ │ +2304 double con = connectivity(*vertex, aggregates); │ │ │ │ +2305 │ │ │ │ +2306 if(con == maxCon) { │ │ │ │ +2307 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ +2308 │ │ │ │ +2309 if(neighbours > maxNeighbours) { │ │ │ │ +2310 maxNeighbours = neighbours; │ │ │ │ +2311 candidates.clear(); │ │ │ │ +2312 candidates.push_back(*vertex); │ │ │ │ +2313 }else{ │ │ │ │ +2314 candidates.push_back(*vertex); │ │ │ │ +2315 } │ │ │ │ +2316 }else if( con > maxCon) { │ │ │ │ +2317 maxCon = con; │ │ │ │ +2318 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2319 candidates.clear(); │ │ │ │ +2320 candidates.push_back(*vertex); │ │ │ │ +2321 } │ │ │ │ +2322 }else if(twoWayCons > maxTwoCons) { │ │ │ │ +2323 maxTwoCons = twoWayCons; │ │ │ │ +2324 maxCon = connectivity(*vertex, aggregates); │ │ │ │ +2325 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2326 candidates.clear(); │ │ │ │ +2327 candidates.push_back(*vertex); │ │ │ │ +2328 │ │ │ │ +2329 // two way connections precede │ │ │ │ +2330 maxOneCons = std::numeric_limits::max(); │ │ │ │ +2331 } │ │ │ │ +2332 │ │ │ │ +2333 if(twoWayCons > 0) │ │ │ │ +2334 { │ │ │ │ +2335 continue; // THis is a two-way node, skip tests for one way nodes │ │ │ │ +2336 } │ │ │ │ +2337 │ │ │ │ +2338 /* The one way case */ │ │ │ │ +2339 int oneWayCons = oneWayConnections(*vertex, aggregate_->_i_d(), aggregates); │ │ │ │ +2340 │ │ │ │ +2341 if(oneWayCons==0) │ │ │ │ +2342 continue; // No strong connections, skip the tests. │ │ │ │ +2343 │ │ │ │ +2344 if(!admissible(*vertex, aggregate_->_i_d(), aggregates)) │ │ │ │ +2345 continue; │ │ │ │ +2346 │ │ │ │ +2347 if( maxOneCons == oneWayCons && oneWayCons > 0) { │ │ │ │ +2348 double con = connectivity(*vertex, aggregates); │ │ │ │ +2349 │ │ │ │ +2350 if(con == maxCon) { │ │ │ │ +2351 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ +2352 │ │ │ │ +2353 if(neighbours > maxNeighbours) { │ │ │ │ +2354 maxNeighbours = neighbours; │ │ │ │ +2355 candidates.clear(); │ │ │ │ +2356 candidates.push_back(*vertex); │ │ │ │ +2357 }else{ │ │ │ │ +2358 if(neighbours==maxNeighbours) │ │ │ │ +2359 { │ │ │ │ +2360 candidates.push_back(*vertex); │ │ │ │ +2361 } │ │ │ │ +2362 } │ │ │ │ +2363 }else if( con > maxCon) { │ │ │ │ +2364 maxCon = con; │ │ │ │ +2365 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2366 candidates.clear(); │ │ │ │ +2367 candidates.push_back(*vertex); │ │ │ │ +2368 } │ │ │ │ +2369 }else if(oneWayCons > maxOneCons) { │ │ │ │ +2370 maxOneCons = oneWayCons; │ │ │ │ +2371 maxCon = connectivity(*vertex, aggregates); │ │ │ │ +2372 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2373 candidates.clear(); │ │ │ │ +2374 candidates.push_back(*vertex); │ │ │ │ +2375 } │ │ │ │ +2376 } │ │ │ │ +2377 │ │ │ │ +2378 │ │ │ │ +2379 if(!candidates.size()) │ │ │ │ +2380 break; // No more candidates found │ │ │ │ +2381 distance_=distance(seed, aggregates); │ │ │ │ +2382 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ +2383 aggregate_->_s_i_z_e())); │ │ │ │ +2384 aggregate_->_a_d_d(candidates); │ │ │ │ +2385 } │ │ │ │ +2386 } │ │ │ │ +2387 │ │ │ │ +2388 template │ │ │ │ +2389 template │ │ │ │ +2390 std::tuple _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(const M& │ │ │ │ +matrix, G& graph, const C& criterion, │ │ │ │ +2391 bool finestLevel) │ │ │ │ +2392 { │ │ │ │ +2393 Aggregator aggregator; │ │ │ │ +2394 return aggregator.build(matrix, graph, *this, criterion, finestLevel); │ │ │ │ +2395 } │ │ │ │ +2396 │ │ │ │ +2397 template │ │ │ │ +2398 template │ │ │ │ +2399 std::tuple _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_b_u_i_l_d(const M& m, G& graph, │ │ │ │ +AggregatesMap& aggregates, const C& c, │ │ │ │ +2400 bool finestLevel) │ │ │ │ +2401 { │ │ │ │ +2402 using std::max; │ │ │ │ +2403 using std::min; │ │ │ │ +2404 // Stack for fast vertex access │ │ │ │ +2405 Stack stack_(graph, *this, aggregates); │ │ │ │ +2406 │ │ │ │ +2407 graph_ = &graph; │ │ │ │ +2408 │ │ │ │ +2409 aggregate_ = new Aggregate(graph, aggregates, connected_, │ │ │ │ +front_); │ │ │ │ +2410 │ │ │ │ +2411 Timer watch; │ │ │ │ +2412 watch.reset(); │ │ │ │ +2413 │ │ │ │ +2414 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(graph, m, c, finestLevel); │ │ │ │ +2415 │ │ │ │ +2416 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<::ISOLATED; │ │ │ │ +2437 ++skippedAggregates; │ │ │ │ +2438 continue; │ │ │ │ +2439 } │ │ │ │ +2440 │ │ │ │ +2441 if(graph.getVertexProperties(seed).isolated()) { │ │ │ │ +2442 if(c.skipIsolated()) { │ │ │ │ +2443 // isolated vertices are not aggregated but skipped on the coarser levels. │ │ │ │ +2444 aggregates[seed]=AggregatesMap::ISOLATED; │ │ │ │ +2445 ++skippedAggregates; │ │ │ │ +2446 // skip rest as no agglomeration is done. │ │ │ │ +2447 continue; │ │ │ │ +2448 }else{ │ │ │ │ +2449 aggregate_->_s_e_e_d(seed); │ │ │ │ +2450 growIsolatedAggregate(seed, aggregates, c); │ │ │ │ +2451 } │ │ │ │ +2452 }else{ │ │ │ │ +2453 aggregate_->_s_e_e_d(seed); │ │ │ │ +2454 growAggregate(seed, aggregates, c); │ │ │ │ +2455 } │ │ │ │ +2456 │ │ │ │ +2457 /* The rounding step. */ │ │ │ │ +2458 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->_s_i_z_e() │ │ │ │ +< c.maxAggregateSize()) { │ │ │ │ +2459 │ │ │ │ +2460 std::vector candidates; │ │ │ │ +2461 candidates.reserve(30); │ │ │ │ +2462 │ │ │ │ +2463 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2464 │ │ │ │ +2465 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ +2466 │ │ │ │ +2467 if(graph.getVertexProperties(*vertex).isolated()) │ │ │ │ +2468 continue; // No isolated nodes here │ │ │ │ +2469 │ │ │ │ +2470 if(twoWayConnections( *vertex, aggregate_->_i_d(), aggregates) == 0 && │ │ │ │ +2471 (oneWayConnections( *vertex, aggregate_->_i_d(), aggregates) == 0 || │ │ │ │ +2472 !admissible( *vertex, aggregate_->_i_d(), aggregates) )) │ │ │ │ +2473 continue; │ │ │ │ +2474 │ │ │ │ +2475 std::pair neighbourPair=neighbours(*vertex, aggregate_->_i_d(), │ │ │ │ +2476 aggregates); │ │ │ │ +2477 │ │ │ │ +2478 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= │ │ │ │ +unusedNeighbours(*vertex, aggregates)) │ │ │ │ +2479 // continue; │ │ │ │ +2480 │ │ │ │ +2481 if(neighbourPair.first >= neighbourPair.second) │ │ │ │ +2482 continue; │ │ │ │ +2483 │ │ │ │ +2484 if(distance(*vertex, aggregates) > c.maxDistance()) │ │ │ │ +2485 continue; // Distance too far │ │ │ │ +2486 candidates.push_back(*vertex); │ │ │ │ +2487 break; │ │ │ │ +2488 } │ │ │ │ +2489 │ │ │ │ +2490 if(!candidates.size()) break; // no more candidates found. │ │ │ │ +2491 │ │ │ │ +2492 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ +2493 aggregate_->_s_i_z_e())); │ │ │ │ +2494 aggregate_->_a_d_d(candidates); │ │ │ │ +2495 │ │ │ │ +2496 } │ │ │ │ +2497 │ │ │ │ +2498 // try to merge aggregates consisting of only one nonisolated vertex with │ │ │ │ +other aggregates │ │ │ │ +2499 if(aggregate_->_s_i_z_e()==1 && c.maxAggregateSize()>1) { │ │ │ │ +2500 if(!graph.getVertexProperties(seed).isolated()) { │ │ │ │ +2501 _V_e_r_t_e_x mergedNeighbour = mergeNeighbour(seed, aggregates); │ │ │ │ +2502 │ │ │ │ +2503 if(mergedNeighbour != AggregatesMap::UNAGGREGATED) { │ │ │ │ +2504 // assign vertex to the neighbouring cluster │ │ │ │ +2505 aggregates[seed] = aggregates[mergedNeighbour]; │ │ │ │ +2506 aggregate_->_i_n_v_a_l_i_d_a_t_e(); │ │ │ │ +2507 }else{ │ │ │ │ +2508 ++avg; │ │ │ │ +2509 minA=min(minA,static_cast(1)); │ │ │ │ +2510 maxA=max(maxA,static_cast(1)); │ │ │ │ +2511 ++oneAggregates; │ │ │ │ +2512 ++conAggregates; │ │ │ │ +2513 } │ │ │ │ +2514 }else{ │ │ │ │ +2515 ++avg; │ │ │ │ +2516 minA=min(minA,static_cast(1)); │ │ │ │ +2517 maxA=max(maxA,static_cast(1)); │ │ │ │ +2518 ++oneAggregates; │ │ │ │ +2519 ++isoAggregates; │ │ │ │ +2520 } │ │ │ │ +2521 ++avg; │ │ │ │ +2522 }else{ │ │ │ │ +2523 avg+=aggregate_->_s_i_z_e(); │ │ │ │ +2524 minA=min(minA,aggregate_->_s_i_z_e()); │ │ │ │ +2525 maxA=max(maxA,aggregate_->_s_i_z_e()); │ │ │ │ +2526 if(graph.getVertexProperties(seed).isolated()) │ │ │ │ +2527 ++isoAggregates; │ │ │ │ +2528 else │ │ │ │ +2529 ++conAggregates; │ │ │ │ +2530 } │ │ │ │ +2531 │ │ │ │ +2532 } │ │ │ │ +2533 │ │ │ │ +2534 Dune::dinfo<<"connected aggregates: "<0) │ │ │ │ +2537 Dune::dinfo<<" one node aggregates: "<::iterator valIter_ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:189 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_C_o_l_I_t_e_r │ │ │ │ +Matrix::ConstColIterator ColIter │ │ │ │ +Constant column iterator of the matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:154 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h │ │ │ │ +std::size_t breadthFirstSearch(const VertexDescriptor &start, const │ │ │ │ +AggregateDescriptor &aggregate, const G &graph, L &visited, F1 │ │ │ │ +&aggregateVisitor, F2 &nonAggregateVisitor, VM &visitedMap) const │ │ │ │ +Breadth first search within an aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ +PoolAllocator< VertexDescriptor, 100 > Allocator │ │ │ │ +The allocator we use for our lists and the set. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:586 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ +iterator begin() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:737 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_i_d │ │ │ │ +int id() │ │ │ │ +Get the id identifying the aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ +Norm norm_ │ │ │ │ +The functor for calculating the norm. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:302 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ +MatrixGraph::VertexDescriptor Vertex │ │ │ │ +The vertex identifier. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:920 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ +AggregationCriterion() │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:66 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ +const Matrix * matrix_ │ │ │ │ +The matrix we work on. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:357 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >:: │ │ │ │ +value > *sfinae=nullptr) const │ │ │ │ +Compute the norm of a scalar. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:406 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ +void initRow(const Row &row, int index) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ +SymmetricMatrixDependency(const Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:168 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ +M Matrix │ │ │ │ +The matrix type we build the dependency of. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:258 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_C_o_u_n_t_e_r │ │ │ │ +Counter() │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +G MatrixGraph │ │ │ │ +The matrix graph type used. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:915 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ +Norm norm_ │ │ │ │ +The functor for calculating the norm. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:363 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const EdgeIterator &edge) const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:601 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +SymmetricCriterion() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:524 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ +Dependency() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:290 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ +void examine(const ColIter &col) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ +M Matrix │ │ │ │ +The matrix type we build the dependency of. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:319 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ +real_type diagonal_ │ │ │ │ +The norm of the current diagonal. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:187 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ +N Norm │ │ │ │ +The norm to use for examining the matrix entries. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:263 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ +iterator end() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:742 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +UnSymmetricCriterion(const Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:541 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_T_w_o_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ +void initRow(const Row &row, int index) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:201 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ +bool isIsolated() │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_N_u_l_l_E_n_t_r_y │ │ │ │ +static const Vertex NullEntry │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:1008 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ +void examine(const ColIter &col) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:214 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ +Dependency(const Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:286 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ +int row_ │ │ │ │ +index of the currently evaluated row. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:185 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_b_u_i_l_d │ │ │ │ +std::tuple< int, int, int, int > build(const M &m, G &graph, AggregatesMap< │ │ │ │ +Vertex > &aggregates, const C &c, bool finestLevel) │ │ │ │ +Build the aggregates. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r │ │ │ │ +FrontNeighbourCounter(const MatrixGraph &front) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ +Matrix::row_type Row │ │ │ │ +Constant Row iterator of the matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:329 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ +const Matrix * matrix_ │ │ │ │ +The matrix we work on. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:296 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +const AggregateDescriptor & operator[](const VertexDescriptor &v) const │ │ │ │ +Get the aggregate a vertex belongs to. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ +void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter │ │ │ │ +&col) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r │ │ │ │ +AggregateVisitor(const AggregatesMap< Vertex > &aggregates, const │ │ │ │ +AggregateDescriptor &aggregate, Visitor &visitor) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_C_o_l_I_t_e_r │ │ │ │ +Matrix::ConstColIterator ColIter │ │ │ │ +Constant column iterator of the matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:334 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_~_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +~AggregatesMap() │ │ │ │ +Destructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +Matrix::field_type field_type │ │ │ │ +The current max value. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:179 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ +void decrement() │ │ │ │ +Decrement counter. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ +Aggregate(MatrixGraph &graph, AggregatesMap< Vertex > &aggregates, VertexSet │ │ │ │ +&connectivity, std::vector< Vertex > &front_) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_V_i_s_i_t_o_r │ │ │ │ +V Visitor │ │ │ │ +The type of the adapted visitor. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:1064 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_S_p_h_e_r_e_M_a_p │ │ │ │ +std::size_t * SphereMap │ │ │ │ +Type of the mapping of aggregate members onto distance spheres. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:809 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ +AggregationCriterion(const Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ +Matrix::row_type Row │ │ │ │ +Constant Row iterator of the matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:268 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_o_n_n_e_c_t_S_i_z_e │ │ │ │ +VertexSet::size_type connectSize() │ │ │ │ +Get the number of connections to other aggregates. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_v_a_l_s__ │ │ │ │ +std::vector< real_type > vals_ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:188 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ +N Norm │ │ │ │ +The norm to use for examining the matrix entries. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:324 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_p_r_i_n_t_A_g_g_r_e_g_a_t_e_s_2_d │ │ │ │ +void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, │ │ │ │ +std::ostream &os) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:2583 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_i_n_v_a_l_i_d_a_t_e │ │ │ │ +void invalidate() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:822 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ +const_iterator begin() const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ +real_type maxValue_ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:181 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_n_o_r_m__ │ │ │ │ +Norm norm_ │ │ │ │ +The functor for calculating the norm. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:183 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ +VertexSet::const_iterator const_iterator │ │ │ │ +Const iterator over a vertex list. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:804 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +SymmetricCriterion(const Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:521 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ +MatrixGraph::VertexDescriptor AggregateDescriptor │ │ │ │ +The type of the aggregate descriptor. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:923 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ +real_type maxValue_ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:361 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ +void init(const Matrix *matrix) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:195 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ +real_type diagonal_ │ │ │ │ +The norm of the current diagonal. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:367 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_i_t_e_r_a_t_o_r │ │ │ │ +AggregateDescriptor * iterator │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:735 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ +SymmetricDependency(const Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:348 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:360 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_~_A_g_g_r_e_g_a_t_o_r │ │ │ │ +~Aggregator() │ │ │ │ +Destructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ +void examine(G &graph, const typename G::EdgeIterator &edge, const ColIter │ │ │ │ +&col) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_a_d_d │ │ │ │ +void add(const Vertex &vertex) │ │ │ │ +Add a vertex to the aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y │ │ │ │ +T DependencyPolicy │ │ │ │ +The policy for calculating the dependency graph. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:55 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_a_d_d │ │ │ │ +void add(std::vector< Vertex > &vertex) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_e_x_a_m_i_n_e │ │ │ │ +void examine(const ColIter &col) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_o_r │ │ │ │ +Aggregator() │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_A_g_g_r_e_g_a_t_e_V_i_s_i_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +Examine an edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_M_a_r_k_e_r_:_:_F_r_o_n_t_M_a_r_k_e_r │ │ │ │ +FrontMarker(std::vector< Vertex > &front, MatrixGraph &graph) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ +compute the norm of a matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:506 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ +void init(const Matrix *matrix) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ +int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, │ │ │ │ +V &visitor) │ │ │ │ +Visit all neighbour vertices of a vertex in a graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c │ │ │ │ +void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ +Sets reasonable default values for an isotropic problem. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:82 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ +const_iterator end() const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ +V AggregateDescriptor │ │ │ │ +The aggregate descriptor type. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:580 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ +static const V ISOLATED │ │ │ │ +Identifier of isolated vertices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ +int row_ │ │ │ │ +index of the currently evaluated row. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:365 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ +SymmetricMatrixDependency() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:171 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r │ │ │ │ +DependencyCounter() │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_p_o_p │ │ │ │ +Vertex pop() │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_d_i_a_g_o_n_a_l__ │ │ │ │ +real_type diagonal_ │ │ │ │ +The norm of the current diagonal. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:306 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +Get the number of vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c │ │ │ │ +void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ +Sets reasonable default values for an aisotropic problem. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:105 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +AggregatesMap(std::size_t noVertices) │ │ │ │ +Constructs with allocating memory. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +Matrix::field_type field_type │ │ │ │ +The current max value. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:359 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +AggregateDescriptor & operator[](const VertexDescriptor &v) │ │ │ │ +Get the aggregate a vertex belongs to. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +AggregatesMap() │ │ │ │ +Constructs without allocating memory. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_v_a_l_u_e │ │ │ │ +int value() │ │ │ │ +Access the current count. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_L_i_s_t │ │ │ │ +SLList< VertexDescriptor, Allocator > VertexList │ │ │ │ +The type of a single linked list of vertex descriptors. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:592 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_~_S_t_a_c_k │ │ │ │ +~Stack() │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_u_n_t_e_r │ │ │ │ +ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > │ │ │ │ +&aggregates) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_i_z_e │ │ │ │ +VertexSet::size_type size() │ │ │ │ +Get the size of the aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_e_n_d │ │ │ │ +const_iterator end() const │ │ │ │ +get an iterator over the vertices of the aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t │ │ │ │ +void init(const Matrix *matrix) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +UnSymmetricCriterion() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:544 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_F_r_o_n_t_N_e_i_g_h_b_o_u_r_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ +const AggregateDescriptor * const_iterator │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_r_o_w__ │ │ │ │ +int row_ │ │ │ │ +index of the currently evaluated row. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:304 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_S_t_a_c_k_:_:_S_t_a_c_k │ │ │ │ +Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const │ │ │ │ +AggregatesMap< Vertex > &aggregates) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:180 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_n_i_t_R_o_w │ │ │ │ +void initRow(const Row &row, int index) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_M_a_t_r_i_x │ │ │ │ +M Matrix │ │ │ │ +The matrix type we build the dependency of. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:139 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_r_e_a_l___t_y_p_e │ │ │ │ +FieldTraits< field_type >::real_type real_type │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:299 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_m_a_t_r_i_x__ │ │ │ │ +const Matrix * matrix_ │ │ │ │ +The matrix we work on. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:177 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_V_e_r_t_e_x_S_e_t │ │ │ │ +S VertexSet │ │ │ │ +The type of a single linked list of vertex descriptors. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:801 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ +compute the norm of a matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:490 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_U_N_A_G_G_R_E_G_A_T_E_D │ │ │ │ +static const V UNAGGREGATED │ │ │ │ +Identifier of not yet aggregated vertices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:566 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_r_e_a_d_t_h_F_i_r_s_t_S_e_a_r_c_h │ │ │ │ +std::size_t breadthFirstSearch(const VertexDescriptor &start, const │ │ │ │ +AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM │ │ │ │ +&visitedMap) const │ │ │ │ +Breadth first search within an aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +Matrix::field_type field_type │ │ │ │ +The current max value. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:298 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_O_n_e_W_a_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ +std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > │ │ │ │ +&criterion) │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:113 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ +bool isIsolated() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:240 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_a_l_l_o_c_a_t_e │ │ │ │ +void allocate(std::size_t noVertices) │ │ │ │ +Allocate memory for holding the information. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_N_o_r_m │ │ │ │ +N Norm │ │ │ │ +The norm to use for examining the matrix entries. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:144 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const │ │ │ │ +compute the norm of a matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:473 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_r_e_c_o_n_s_t_r_u_c_t │ │ │ │ +void reconstruct(const Vertex &vertex) │ │ │ │ +Reconstruct the aggregat from an seed node. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_b_e_g_i_n │ │ │ │ +const_iterator begin() const │ │ │ │ +get an iterator over the vertices of the aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +FieldTraits< typenameM::field_type >::real_type operator()(const M &m, typename │ │ │ │ +std::enable_if_t::value > *sfinae=nullptr) const │ │ │ │ +compute the norm of a matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:390 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_V_e_r_t_e_x │ │ │ │ +MatrixGraph::VertexDescriptor Vertex │ │ │ │ +The vertex descriptor type. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:789 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_e_e_d │ │ │ │ +void seed(const Vertex &vertex) │ │ │ │ +Initialize the aggregate with one vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_i_s_I_s_o_l_a_t_e_d │ │ │ │ +bool isIsolated() │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ +SymmetricDependency() │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:351 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_c_l_e_a_r │ │ │ │ +void clear() │ │ │ │ +Clear the aggregate. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ +void free() │ │ │ │ +Free the allocated memory. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ +void increment() │ │ │ │ +Increment counter. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ +void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ +bool finestLevel) │ │ │ │ +Build the dependency of the matrix graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +V VertexDescriptor │ │ │ │ +The vertex descriptor type. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:575 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_:_:_m_a_x_V_a_l_u_e__ │ │ │ │ +real_type maxValue_ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:300 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ +std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ +const C &criterion, bool finestLevel) │ │ │ │ +Build the aggregates. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y_:_:_R_o_w │ │ │ │ +Matrix::row_type Row │ │ │ │ +Constant Row iterator of the matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:149 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ +PoolAllocator< Vertex, 100 > Allocator │ │ │ │ +The allocator we use for our lists and the set. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:795 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +G MatrixGraph │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:785 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r_:_:_D_e_p_e_n_d_e_n_c_y_C_o_u_n_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename MatrixGraph::ConstEdgeIterator &edge) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ +@ is_sign_preserving │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:483 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ +@ is_sign_preserving │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:382 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ +@ is_sign_preserving │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:499 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g │ │ │ │ +@ is_sign_preserving │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:466 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_b_u_i_l_d_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ -bool buildCommunication(const G &graph, std::vector< int > &realparts, Dune:: │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > &oocomm, std::shared_ptr< Dune:: │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ -&redistInf, bool verbose=false) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:1449 │ │ │ │ -_D_u_n_e_:_:_f_i_l_l_I_n_d_e_x_S_e_t_H_o_l_e_s │ │ │ │ -void fillIndexSetHoles(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, │ │ │ │ -T2 > &oocomm) │ │ │ │ -Fills the holes in an index set. │ │ │ │ -DDeeffiinniittiioonn repartition.hh:83 │ │ │ │ -_D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n │ │ │ │ -bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< │ │ │ │ -T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune:: │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ -&redistInf, bool verbose=false) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:822 │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t___c_a_r_r_a_y │ │ │ │ -void print_carray(S &os, T *array, std::size_t l) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:771 │ │ │ │ -_D_u_n_e_:_:_i_s_V_a_l_i_d_G_r_a_p_h │ │ │ │ -bool isValidGraph(std::size_t noVtx, std::size_t gnoVtx, S noEdges, T *xadj, T │ │ │ │ -*adjncy, bool checkSymmetry) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:778 │ │ │ │ -_D_u_n_e_:_:_g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n │ │ │ │ -bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, │ │ │ │ -T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune:: │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ -&redistInf, bool verbose=false) │ │ │ │ -execute a graph repartition for a giving graph and indexset. │ │ │ │ -DDeeffiinniittiioonn repartition.hh:1228 │ │ │ │ -_D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t │ │ │ │ -float real_t │ │ │ │ -DDeeffiinniittiioonn repartition.hh:53 │ │ │ │ -_D_u_n_e_:_:_M_e_t_i_s_:_:_i_d_x___t │ │ │ │ -std::size_t idx_t │ │ │ │ -DDeeffiinniittiioonn repartition.hh:63 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_A_t_t_r_i_b_u_t_e_S_e_t_:_:_o_w_n_e_r │ │ │ │ -@ owner │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:61 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ -A class setting up standard communication for a two-valued attribute set with │ │ │ │ -owner/overlap/copy sema... │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ -const GlobalLookupIndexSet & globalLookup() const │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:526 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ -const ParallelIndexSet & indexSet() const │ │ │ │ -Get the underlying parallel index set. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ -void copyCopyToAll(const T &source, T &dest) const │ │ │ │ -Communicate values from copy data points to all other data points. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ -The type of the reverse lookup of indices. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ -void buildGlobalLookup() │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:495 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ -const Communication< MPI_Comm > & communicator() const │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ -const RemoteIndices & remoteIndices() const │ │ │ │ -Get the underlying remote indices. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ -void freeGlobalLookup() │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:520 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ -Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ -The type of the parallel index set. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -The (undirected) graph of a matrix. │ │ │ │ -DDeeffiinniittiioonn graph.hh:51 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e │ │ │ │ -DDeeffiinniittiioonn repartition.hh:260 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_r_e_s_e_r_v_e_S_p_a_c_e_F_o_r_R_e_c_e_i_v_e_I_n_t_e_r_f_a_c_e │ │ │ │ -void reserveSpaceForReceiveInterface(int proc, int size) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:284 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_b_u_i_l_d_R_e_c_e_i_v_e_I_n_t_e_r_f_a_c_e │ │ │ │ -void buildReceiveInterface(std::vector< std::pair< TG, int > > &indices) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:293 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_s_e_t_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ -void setCommunicator(MPI_Comm comm) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:261 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_b_u_i_l_d_S_e_n_d_I_n_t_e_r_f_a_c_e │ │ │ │ -void buildSendInterface(const std::vector< int > &toPart, const IS &idxset) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:266 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_t_e_r_f_a_c_e_:_:_a_d_d_R_e_c_e_i_v_e_I_n_d_e_x │ │ │ │ -void addReceiveIndex(int proc, std::size_t idx) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:288 │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ +derive error class from the base class in common │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ +Export the type representing the underlying field. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ +row_type::const_iterator ConstColIterator │ │ │ │ +Const iterator for the entries of each row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ +The type implementing a matrix row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ +Base class of all aggregation criterions. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:49 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_M_a_t_r_i_x_D_e_p_e_n_d_e_n_c_y │ │ │ │ +Dependency policy for symmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:134 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y │ │ │ │ +Dependency policy for symmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:253 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y │ │ │ │ +Dependency policy for symmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:314 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_i_a_g_o_n_a_l │ │ │ │ +Norm that uses only the [N][N] entry of the block to determine couplings. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:379 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_i_r_s_t_D_i_a_g_o_n_a_l │ │ │ │ +Norm that uses only the [0][0] entry of the block to determine couplings. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:455 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m │ │ │ │ +Functor using the row sum (infinity) norm to determine strong couplings. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:463 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:480 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:496 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +Criterion taking advantage of symmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:519 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n │ │ │ │ +Criterion suitable for unsymmetric matrices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:539 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_o_r │ │ │ │ +Class for building the aggregates. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:909 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ +A Dummy visitor that does nothing for each visited edge. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:598 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e │ │ │ │ +A class for temporarily storing the vertices of an aggregate in. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:778 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +M::size_type VertexDescriptor │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:73 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator │ │ │ │ +The constant edge iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:298 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +Iterator over all edges starting from a vertex. │ │ │ │ +DDeeffiinniittiioonn graph.hh:95 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +The vertex iterator type of the graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:209 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +All parameters for AMG. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioners.hh File Reference │ │ │ +dune-istl: renumberer.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,111 +65,47 @@ │ │ │

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ -Typedefs | │ │ │ Functions
│ │ │ - │ │ │ +
renumberer.hh File Reference
│ │ │
│ │ │
│ │ │ - │ │ │ -

Define general preconditioner interface. │ │ │ -More...

│ │ │ -
#include <cmath>
│ │ │ -#include <complex>
│ │ │ -#include <iostream>
│ │ │ -#include <iomanip>
│ │ │ -#include <memory>
│ │ │ -#include <string>
│ │ │ -#include <dune/common/simd/simd.hh>
│ │ │ -#include <dune/common/parametertree.hh>
│ │ │ -#include <dune/istl/solverregistry.hh>
│ │ │ -#include "preconditioner.hh"
│ │ │ -#include "solver.hh"
│ │ │ -#include "solvercategory.hh"
│ │ │ -#include "istlexception.hh"
│ │ │ -#include "matrixutils.hh"
│ │ │ -#include "gsetc.hh"
│ │ │ -#include "dilu.hh"
│ │ │ -#include "ildl.hh"
│ │ │ -#include "ilu.hh"
│ │ │ +
#include "aggregates.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::InverseOperator2Preconditioner< O, c >
 Turns an InverseOperator into a Preconditioner. More...
 
class  Dune::SeqSSOR< M, X, Y, l >
 Sequential SSOR preconditioner. More...
 
class  Dune::SeqSOR< M, X, Y, l >
 Sequential SOR preconditioner. More...
 
class  Dune::SeqJac< M, X, Y, l >
 The sequential jacobian preconditioner. More...
 
class  Dune::SeqDILU< M, X, Y, l >
 Sequential DILU preconditioner. More...
 
class  Dune::SeqILU< M, X, Y, l >
 Sequential ILU preconditioner. More...
 
class  Dune::Richardson< X, Y >
 Richardson preconditioner. More...
 
class  Dune::SeqILDL< M, X, Y >
 sequential ILDL preconditioner More...
class  Dune::Amg::AggregateRenumberer< G >
 
│ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ -Typedefs

template<class M , class X , class Y , int l = 1>
using Dune::SeqGS = SeqSOR< M, X, Y, l >
 Sequential Gauss Seidel preconditioner.
 
namespace  Dune::Amg
 
│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ Functions

 Dune::DUNE_REGISTER_PRECONDITIONER ("ssor", defaultPreconditionerBlockLevelCreator< Dune::SeqSSOR >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("sor", defaultPreconditionerBlockLevelCreator< Dune::SeqSOR >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("gs", defaultPreconditionerBlockLevelCreator< Dune::SeqGS >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("jac", defaultPreconditionerBlockLevelCreator< Dune::SeqJac >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("dilu", defaultPreconditionerBlockLevelCreator< Dune::SeqDILU >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("ilu", defaultPreconditionerBlockLevelCreator< Dune::SeqILU >())
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("richardson", [](auto tl, const auto &, const ParameterTree &config){ using D=typename Dune::TypeListElement< 1, decltype(tl)>::type;using R=typename Dune::TypeListElement< 2, decltype(tl)>::type;return std::make_shared< Richardson< D, R > >(config);})
 
 Dune::DUNE_REGISTER_PRECONDITIONER ("ildl", defaultPreconditionerCreator< Dune::SeqILDL >())
 
template<class G , class I , class V >
void Dune::Amg::renumberAggregates (const G &graph, I index, I endIndex, V &visitedMap, AggregatesMap< typename G::VertexDescriptor > &aggregates)
 
│ │ │ -

Detailed Description

│ │ │ -

Define general preconditioner interface.

│ │ │ -

Wrap the methods implemented by ISTL in this interface. However, the interface is extensible such that new preconditioners can be implemented and used with the solvers.

│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,96 +1,26 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -preconditioners.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -Define general preconditioner interface. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ -#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h" │ │ │ │ -#include "_s_o_l_v_e_r_._h_h" │ │ │ │ -#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ -#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ -#include "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ -#include "_g_s_e_t_c_._h_h" │ │ │ │ -#include "_d_i_l_u_._h_h" │ │ │ │ -#include "_i_l_d_l_._h_h" │ │ │ │ -#include "_i_l_u_._h_h" │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +renumberer.hh File Reference │ │ │ │ +#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _O_,_ _c_ _> │ │ │ │ -  Turns an _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r into a _P_r_e_c_o_n_d_i_t_i_o_n_e_r. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _> │ │ │ │ -  Sequential SSOR preconditioner. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _> │ │ │ │ -  Sequential SOR preconditioner. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_J_a_c_<_ _M_,_ _X_,_ _Y_,_ _l_ _> │ │ │ │ -  The sequential jacobian preconditioner. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_D_I_L_U_<_ _M_,_ _X_,_ _Y_,_ _l_ _> │ │ │ │ -  Sequential _D_I_L_U preconditioner. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_I_L_U_<_ _M_,_ _X_,_ _Y_,_ _l_ _> │ │ │ │ -  Sequential _I_L_U preconditioner. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _> │ │ │ │ -  _R_i_c_h_a_r_d_s_o_n preconditioner. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_S_e_q_I_L_D_L_<_ _M_,_ _X_,_ _Y_ _> │ │ │ │ -  sequential ILDL preconditioner _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_ _G_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -TTyyppeeddeeffss │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_S_e_q_G_S = _S_e_q_S_O_R< M, X, Y, l > │ │ │ │ -  Sequential Gauss Seidel preconditioner. │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ FFuunnccttiioonnss │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("ssor", │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_S_S_O_R >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("sor", │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_S_O_R >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("gs", │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_G_S >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("jac", │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_J_a_c >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("dilu", │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_D_I_L_U >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("ilu", │ │ │ │ - _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_B_l_o_c_k_L_e_v_e_l_C_r_e_a_t_o_r< _D_u_n_e_:_:_S_e_q_I_L_U >()) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("richardson", [](auto tl, const auto &, │ │ │ │ - const ParameterTree &config){ using D=typename Dune::TypeListElement< 1, │ │ │ │ - decltype(tl)>::type;using R=typename Dune::TypeListElement< 2, decltype │ │ │ │ - (tl)>::type;return std::make_shared< _R_i_c_h_a_r_d_s_o_n< D, R > >(config);}) │ │ │ │ -  │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R ("ildl", _d_e_f_a_u_l_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_C_r_e_a_t_o_r< │ │ │ │ - _D_u_n_e_:_:_S_e_q_I_L_D_L >()) │ │ │ │ +template │ │ │ │ +void  _D_u_n_e_:_:_A_m_g_:_:_r_e_n_u_m_b_e_r_A_g_g_r_e_g_a_t_e_s (const G &graph, I index, I endIndex, V │ │ │ │ + &visitedMap, _A_g_g_r_e_g_a_t_e_s_M_a_p< typename G::VertexDescriptor > &aggregates) │ │ │ │   │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Define general preconditioner interface. │ │ │ │ -Wrap the methods implemented by ISTL in this interface. However, the interface │ │ │ │ -is extensible such that new preconditioners can be implemented and used with │ │ │ │ -the solvers. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioners.hh Source File │ │ │ +dune-istl: renumberer.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,844 +70,122 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
preconditioners.hh
│ │ │ +
renumberer.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_PRECONDITIONERS_HH
│ │ │ -
6#define DUNE_ISTL_PRECONDITIONERS_HH
│ │ │ +
5#ifndef DUNE_AMG_RENUMBERER_HH
│ │ │ +
6#define DUNE_AMG_RENUMBERER_HH
│ │ │
7
│ │ │ -
8#include <cmath>
│ │ │ -
9#include <complex>
│ │ │ -
10#include <iostream>
│ │ │ -
11#include <iomanip>
│ │ │ -
12#include <memory>
│ │ │ -
13#include <string>
│ │ │ -
14
│ │ │ -
15#include <dune/common/simd/simd.hh>
│ │ │ -
16#include <dune/common/parametertree.hh>
│ │ │ -
17
│ │ │ - │ │ │ -
19#include "preconditioner.hh"
│ │ │ -
20#include "solver.hh"
│ │ │ -
21#include "solvercategory.hh"
│ │ │ -
22#include "istlexception.hh"
│ │ │ -
23#include "matrixutils.hh"
│ │ │ -
24#include "gsetc.hh"
│ │ │ -
25#include "dilu.hh"
│ │ │ -
26#include "ildl.hh"
│ │ │ -
27#include "ilu.hh"
│ │ │ -
28
│ │ │ +
8#include "aggregates.hh"
│ │ │ +
9
│ │ │ +
10namespace Dune
│ │ │ +
11{
│ │ │ +
12 namespace Amg
│ │ │ +
13 {
│ │ │ +
14 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
16 {
│ │ │ +
17 public:
│ │ │ +
19 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
20
│ │ │ + │ │ │ +
26
│ │ │ +
28 operator Vertex() const;
│ │ │
29
│ │ │ -
30namespace Dune {
│ │ │ -
73 template<class O, int c = -1>
│ │ │ -
│ │ │ - │ │ │ -
75 public Preconditioner<typename O::domain_type, typename O::range_type>
│ │ │ -
76 {
│ │ │ -
77 public:
│ │ │ -
79 typedef typename O::domain_type domain_type;
│ │ │ -
81 typedef typename O::range_type range_type;
│ │ │ -
83 typedef typename range_type::field_type field_type;
│ │ │ -
85 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
87 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
89 typedef O InverseOperator;
│ │ │ -
90
│ │ │ -
│ │ │ - │ │ │ -
96 : inverse_operator_(inverse_operator)
│ │ │ -
97 {
│ │ │ -
98 if(c != -1 && SolverCategory::category(inverse_operator_) != c)
│ │ │ -
99 DUNE_THROW(InvalidStateException, "User-supplied solver category does not match that of the given inverse operator");
│ │ │ -
100 }
│ │ │ -
│ │ │ -
101
│ │ │ -
│ │ │ -
102 virtual void pre(domain_type&,range_type&)
│ │ │ -
103 {}
│ │ │ -
│ │ │ -
104
│ │ │ -
│ │ │ -
105 virtual void apply(domain_type& v, const range_type& d)
│ │ │ -
106 {
│ │ │ - │ │ │ -
108 range_type copy(d);
│ │ │ -
109 inverse_operator_.apply(v, copy, res);
│ │ │ -
110 }
│ │ │ -
│ │ │ -
111
│ │ │ -
│ │ │ -
112 virtual void post(domain_type&)
│ │ │ -
113 {}
│ │ │ -
│ │ │ -
114
│ │ │ -
│ │ │ - │ │ │ -
117 {
│ │ │ -
118 return SolverCategory::category(inverse_operator_);
│ │ │ -
119 }
│ │ │ -
│ │ │ -
120
│ │ │ -
121 private:
│ │ │ -
122 InverseOperator& inverse_operator_;
│ │ │ -
123 };
│ │ │ -
│ │ │ -
124
│ │ │ -
125 //=====================================================================
│ │ │ -
126 // Implementation of this interface for sequential ISTL-preconditioners
│ │ │ -
127 //=====================================================================
│ │ │ -
128
│ │ │ -
129
│ │ │ -
141 template<class M, class X, class Y, int l=1>
│ │ │ -
│ │ │ -
142 class SeqSSOR : public Preconditioner<X,Y> {
│ │ │ -
143 public:
│ │ │ -
145 typedef M matrix_type;
│ │ │ -
147 typedef X domain_type;
│ │ │ -
149 typedef Y range_type;
│ │ │ -
151 typedef typename X::field_type field_type;
│ │ │ -
153 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
155 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
156
│ │ │ -
│ │ │ -
164 SeqSSOR (const M& A, int n, real_field_type w)
│ │ │ -
165 : _A_(A), _n(n), _w(w)
│ │ │ -
166 {
│ │ │ - │ │ │ -
168 }
│ │ │ -
│ │ │ -
169
│ │ │ -
│ │ │ -
183 SeqSSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ -
184 : SeqSSOR(A->getmat(), configuration)
│ │ │ -
185 {}
│ │ │ -
│ │ │ -
186
│ │ │ -
│ │ │ -
200 SeqSSOR (const M& A, const ParameterTree& configuration)
│ │ │ -
201 : SeqSSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ -
202 {}
│ │ │ -
│ │ │ -
203
│ │ │ -
│ │ │ -
209 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ -
210 {}
│ │ │ -
│ │ │ -
211
│ │ │ -
│ │ │ -
217 virtual void apply (X& v, const Y& d)
│ │ │ -
218 {
│ │ │ -
219 for (int i=0; i<_n; i++) {
│ │ │ -
220 bsorf(_A_,v,d,_w,BL<l>());
│ │ │ -
221 bsorb(_A_,v,d,_w,BL<l>());
│ │ │ -
222 }
│ │ │ -
223 }
│ │ │ -
│ │ │ -
224
│ │ │ -
│ │ │ -
230 virtual void post ([[maybe_unused]] X& x)
│ │ │ -
231 {}
│ │ │ -
│ │ │ -
232
│ │ │ -
│ │ │ - │ │ │ -
235 {
│ │ │ - │ │ │ -
237 }
│ │ │ -
│ │ │ -
238
│ │ │ -
239 private:
│ │ │ -
241 const M& _A_;
│ │ │ -
243 int _n;
│ │ │ - │ │ │ -
246 };
│ │ │ -
│ │ │ -
247 DUNE_REGISTER_PRECONDITIONER("ssor", defaultPreconditionerBlockLevelCreator<Dune::SeqSSOR>());
│ │ │ -
248
│ │ │ -
249
│ │ │ -
261 template<class M, class X, class Y, int l=1>
│ │ │ -
│ │ │ -
262 class SeqSOR : public Preconditioner<X,Y> {
│ │ │ -
263 public:
│ │ │ -
265 typedef M matrix_type;
│ │ │ -
267 typedef X domain_type;
│ │ │ -
269 typedef Y range_type;
│ │ │ -
271 typedef typename X::field_type field_type;
│ │ │ -
273 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
275 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
276
│ │ │ -
│ │ │ -
284 SeqSOR (const M& A, int n, real_field_type w)
│ │ │ -
285 : _A_(A), _n(n), _w(w)
│ │ │ -
286 {
│ │ │ - │ │ │ -
288 }
│ │ │ -
│ │ │ -
289
│ │ │ -
│ │ │ -
303 SeqSOR (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ -
304 : SeqSOR(A->getmat(), configuration)
│ │ │ -
305 {}
│ │ │ -
│ │ │ -
306
│ │ │ -
│ │ │ -
320 SeqSOR (const M& A, const ParameterTree& configuration)
│ │ │ -
321 : SeqSOR(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ -
322 {}
│ │ │ -
│ │ │ -
323
│ │ │ -
│ │ │ -
329 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ -
330 {}
│ │ │ -
│ │ │ -
331
│ │ │ -
│ │ │ -
337 virtual void apply (X& v, const Y& d)
│ │ │ -
338 {
│ │ │ -
339 this->template apply<true>(v,d);
│ │ │ -
340 }
│ │ │ -
│ │ │ -
341
│ │ │ -
350 template<bool forward>
│ │ │ -
│ │ │ -
351 void apply(X& v, const Y& d)
│ │ │ -
352 {
│ │ │ -
353 if(forward)
│ │ │ -
354 for (int i=0; i<_n; i++) {
│ │ │ -
355 bsorf(_A_,v,d,_w,BL<l>());
│ │ │ -
356 }
│ │ │ -
357 else
│ │ │ -
358 for (int i=0; i<_n; i++) {
│ │ │ -
359 bsorb(_A_,v,d,_w,BL<l>());
│ │ │ -
360 }
│ │ │ -
361 }
│ │ │ -
│ │ │ -
362
│ │ │ -
│ │ │ -
368 virtual void post ([[maybe_unused]] X& x)
│ │ │ -
369 {}
│ │ │ -
│ │ │ -
370
│ │ │ -
│ │ │ - │ │ │ -
373 {
│ │ │ - │ │ │ -
375 }
│ │ │ -
│ │ │ -
376
│ │ │ -
377 private:
│ │ │ -
379 const M& _A_;
│ │ │ -
381 int _n;
│ │ │ - │ │ │ -
384 };
│ │ │ -
│ │ │ -
385 DUNE_REGISTER_PRECONDITIONER("sor", defaultPreconditionerBlockLevelCreator<Dune::SeqSOR>());
│ │ │ -
386
│ │ │ -
387
│ │ │ -
398 template<class M, class X, class Y, int l=1>
│ │ │ - │ │ │ -
400 DUNE_REGISTER_PRECONDITIONER("gs", defaultPreconditionerBlockLevelCreator<Dune::SeqGS>());
│ │ │ -
401
│ │ │ -
412 template<class M, class X, class Y, int l=1>
│ │ │ -
│ │ │ - │ │ │ -
414 public:
│ │ │ -
416 typedef M matrix_type;
│ │ │ -
418 typedef X domain_type;
│ │ │ -
420 typedef Y range_type;
│ │ │ -
422 typedef typename X::field_type field_type;
│ │ │ -
424 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
426 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
427
│ │ │ -
│ │ │ -
435 SeqJac (const M& A, int n, real_field_type w)
│ │ │ -
436 : _A_(A), _n(n), _w(w)
│ │ │ -
437 {
│ │ │ - │ │ │ -
439 }
│ │ │ -
│ │ │ -
440
│ │ │ -
│ │ │ -
454 SeqJac (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ -
455 : SeqJac(A->getmat(), configuration)
│ │ │ -
456 {}
│ │ │ -
│ │ │ -
457
│ │ │ -
│ │ │ -
471 SeqJac (const M& A, const ParameterTree& configuration)
│ │ │ -
472 : SeqJac(A, configuration.get<int>("iterations",1), configuration.get<real_field_type>("relaxation",1.0))
│ │ │ -
473 {}
│ │ │ -
│ │ │ -
474
│ │ │ -
│ │ │ -
480 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ -
481 {}
│ │ │ -
│ │ │ -
482
│ │ │ -
│ │ │ -
488 virtual void apply (X& v, const Y& d)
│ │ │ -
489 {
│ │ │ -
490 for (int i=0; i<_n; i++) {
│ │ │ -
491 dbjac(_A_,v,d,_w,BL<l>());
│ │ │ -
492 }
│ │ │ -
493 }
│ │ │ -
│ │ │ -
494
│ │ │ -
│ │ │ -
500 virtual void post ([[maybe_unused]] X& x)
│ │ │ -
501 {}
│ │ │ -
│ │ │ -
502
│ │ │ -
│ │ │ - │ │ │ -
505 {
│ │ │ - │ │ │ -
507 }
│ │ │ -
│ │ │ -
508
│ │ │ -
509 private:
│ │ │ -
511 const M& _A_;
│ │ │ -
513 int _n;
│ │ │ -
515 real_field_type _w;
│ │ │ -
516 };
│ │ │ -
│ │ │ -
517 DUNE_REGISTER_PRECONDITIONER("jac", defaultPreconditionerBlockLevelCreator<Dune::SeqJac>());
│ │ │ -
518
│ │ │ -
562 template <class M, class X, class Y, int l = 1>
│ │ │ -
│ │ │ - │ │ │ -
564 {
│ │ │ -
565 public:
│ │ │ -
567 using matrix_type = M;
│ │ │ -
569 using block_type = typename matrix_type::block_type;
│ │ │ -
571 using domain_type = X;
│ │ │ -
573 using range_type = Y;
│ │ │ -
574
│ │ │ -
576 using field_type = typename X::field_type;
│ │ │ -
577
│ │ │ -
579 using scalar_field_type = Simd::Scalar<field_type>;
│ │ │ -
581 using real_field_type = typename FieldTraits<scalar_field_type>::real_type;
│ │ │ -
582
│ │ │ -
│ │ │ - │ │ │ -
590 : _A_(A),
│ │ │ -
591 _w(w),
│ │ │ -
592 wNotIdentity_([w]
│ │ │ -
593 {using std::abs; return abs(w - real_field_type(1)) > 1e-15; }())
│ │ │ -
594 {
│ │ │ -
595 Dinv_.resize(_A_.N());
│ │ │ - │ │ │ - │ │ │ -
598 }
│ │ │ -
│ │ │ -
599
│ │ │ -
│ │ │ -
612 SeqDILU(const std::shared_ptr<const AssembledLinearOperator<M, X, Y>> &A, const ParameterTree &configuration)
│ │ │ -
613 : SeqDILU(A->getmat(), configuration)
│ │ │ -
614 {
│ │ │ -
615 }
│ │ │ -
│ │ │ -
616
│ │ │ -
│ │ │ -
629 SeqDILU(const M &A, const ParameterTree &config)
│ │ │ -
630 : SeqDILU(A, config.get<real_field_type>("relaxation", 1.0))
│ │ │ -
631 {
│ │ │ -
632 }
│ │ │ -
│ │ │ -
633
│ │ │ -
│ │ │ -
639 virtual void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b)
│ │ │ -
640 {
│ │ │ -
641 }
│ │ │ -
│ │ │ -
642
│ │ │ -
│ │ │ -
648 virtual void apply(X &v, const Y &d)
│ │ │ -
649 {
│ │ │ -
650
│ │ │ -
651 DILU::blockDILUBacksolve(_A_, Dinv_, v, d);
│ │ │ -
652
│ │ │ -
653 if (wNotIdentity_)
│ │ │ -
654 {
│ │ │ -
655 v *= _w;
│ │ │ -
656 }
│ │ │ -
657 }
│ │ │ -
│ │ │ -
658
│ │ │ -
│ │ │ -
664 virtual void post([[maybe_unused]] X &x)
│ │ │ -
665 {
│ │ │ -
666 }
│ │ │ -
│ │ │ -
667
│ │ │ -
│ │ │ - │ │ │ -
670 {
│ │ │ - │ │ │ -
672 }
│ │ │ -
│ │ │ -
673
│ │ │ -
674 protected:
│ │ │ -
675 std::vector<block_type> Dinv_;
│ │ │ -
677 const M &_A_;
│ │ │ - │ │ │ -
681 const bool wNotIdentity_;
│ │ │ -
682 };
│ │ │ -
│ │ │ -
683 DUNE_REGISTER_PRECONDITIONER("dilu", defaultPreconditionerBlockLevelCreator<Dune::SeqDILU>());
│ │ │ -
684
│ │ │ -
696 template<class M, class X, class Y, int l=1>
│ │ │ -
│ │ │ -
697 class SeqILU : public Preconditioner<X,Y> {
│ │ │ -
698 public:
│ │ │ -
700 typedef typename std::remove_const<M>::type matrix_type;
│ │ │ -
702 typedef typename matrix_type :: block_type block_type;
│ │ │ -
704 typedef X domain_type;
│ │ │ -
706 typedef Y range_type;
│ │ │ -
707
│ │ │ -
709 typedef typename X::field_type field_type;
│ │ │ -
710
│ │ │ -
712 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
714 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
715
│ │ │ - │ │ │ -
718
│ │ │ -
│ │ │ -
726 SeqILU (const M& A, real_field_type w, const bool resort = false )
│ │ │ -
727 : SeqILU( A, 0, w, resort ) // construct ILU(0)
│ │ │ -
728 {
│ │ │ -
729 }
│ │ │ -
│ │ │ -
730
│ │ │ -
│ │ │ -
745 SeqILU (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ -
746 : SeqILU(A->getmat(), configuration)
│ │ │ -
747 {}
│ │ │ -
│ │ │ -
748
│ │ │ -
│ │ │ -
763 SeqILU(const M& A, const ParameterTree& config)
│ │ │ -
764 : SeqILU(A, config.get("n", 0),
│ │ │ -
765 config.get<real_field_type>("relaxation", 1.0),
│ │ │ -
766 config.get("resort", false))
│ │ │ -
767 {}
│ │ │ -
│ │ │ -
768
│ │ │ -
│ │ │ -
777 SeqILU (const M& A, int n, real_field_type w, const bool resort = false )
│ │ │ -
778 : ILU_(),
│ │ │ -
779 lower_(),
│ │ │ -
780 upper_(),
│ │ │ -
781 inv_(),
│ │ │ -
782 w_(w),
│ │ │ -
783 wNotIdentity_([w]{using std::abs; return abs(w - real_field_type(1)) > 1e-15;}() )
│ │ │ -
784 {
│ │ │ -
785 if( n == 0 )
│ │ │ -
786 {
│ │ │ -
787 // copy A
│ │ │ -
788 ILU_.reset( new matrix_type( A ) );
│ │ │ -
789 // create ILU(0) decomposition
│ │ │ - │ │ │ -
791 }
│ │ │ -
792 else
│ │ │ -
793 {
│ │ │ -
794 // create matrix in build mode
│ │ │ -
795 ILU_.reset( new matrix_type( A.N(), A.M(), matrix_type::row_wise) );
│ │ │ -
796 // create ILU(n) decomposition
│ │ │ - │ │ │ -
798 }
│ │ │ -
799
│ │ │ -
800 if( resort )
│ │ │ -
801 {
│ │ │ -
802 // store ILU in simple CRS format
│ │ │ - │ │ │ -
804 ILU_.reset();
│ │ │ -
805 }
│ │ │ -
806 }
│ │ │ -
│ │ │ -
807
│ │ │ -
│ │ │ -
813 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ -
814 {}
│ │ │ -
│ │ │ -
815
│ │ │ -
│ │ │ -
821 virtual void apply (X& v, const Y& d)
│ │ │ -
822 {
│ │ │ -
823 if( ILU_ )
│ │ │ -
824 {
│ │ │ - │ │ │ -
826 }
│ │ │ -
827 else
│ │ │ -
828 {
│ │ │ - │ │ │ -
830 }
│ │ │ -
831
│ │ │ -
832 if( wNotIdentity_ )
│ │ │ -
833 {
│ │ │ -
834 v *= w_;
│ │ │ -
835 }
│ │ │ -
836 }
│ │ │ -
│ │ │ -
837
│ │ │ -
│ │ │ -
843 virtual void post ([[maybe_unused]] X& x)
│ │ │ -
844 {}
│ │ │ -
│ │ │ -
845
│ │ │ -
│ │ │ - │ │ │ -
848 {
│ │ │ - │ │ │ -
850 }
│ │ │ -
│ │ │ -
851
│ │ │ -
852 protected:
│ │ │ -
854 std::unique_ptr< matrix_type > ILU_;
│ │ │ -
855
│ │ │ - │ │ │ - │ │ │ -
859 std::vector< block_type, typename matrix_type::allocator_type > inv_;
│ │ │ -
860
│ │ │ - │ │ │ -
864 const bool wNotIdentity_;
│ │ │ -
865 };
│ │ │ -
│ │ │ -
866 DUNE_REGISTER_PRECONDITIONER("ilu", defaultPreconditionerBlockLevelCreator<Dune::SeqILU>());
│ │ │ -
867
│ │ │ -
868
│ │ │ -
877 template<class X, class Y>
│ │ │ -
│ │ │ -
878 class Richardson : public Preconditioner<X,Y> {
│ │ │ -
879 public:
│ │ │ -
881 typedef X domain_type;
│ │ │ -
883 typedef Y range_type;
│ │ │ -
885 typedef typename X::field_type field_type;
│ │ │ -
887 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
889 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
890
│ │ │ -
│ │ │ - │ │ │ -
897 _w(w)
│ │ │ -
898 {}
│ │ │ -
│ │ │ -
899
│ │ │ -
│ │ │ -
911 Richardson (const ParameterTree& configuration)
│ │ │ -
912 : Richardson(configuration.get<real_field_type>("relaxation", 1.0))
│ │ │ -
913 {}
│ │ │ -
│ │ │ -
914
│ │ │ -
│ │ │ -
920 virtual void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b)
│ │ │ -
921 {}
│ │ │ -
│ │ │ -
922
│ │ │ -
│ │ │ -
928 virtual void apply (X& v, const Y& d)
│ │ │ -
929 {
│ │ │ -
930 v = d;
│ │ │ -
931 v *= _w;
│ │ │ -
932 }
│ │ │ -
│ │ │ -
933
│ │ │ -
│ │ │ -
939 virtual void post ([[maybe_unused]] X& x)
│ │ │ -
940 {}
│ │ │ -
│ │ │ -
941
│ │ │ -
│ │ │ - │ │ │ -
944 {
│ │ │ - │ │ │ -
946 }
│ │ │ -
│ │ │ -
947
│ │ │ -
948 private:
│ │ │ - │ │ │ -
951 };
│ │ │ -
│ │ │ -
952 DUNE_REGISTER_PRECONDITIONER("richardson", [](auto tl, const auto& /* mat */, const ParameterTree& config){
│ │ │ -
953 using D = typename Dune::TypeListElement<1, decltype(tl)>::type;
│ │ │ -
954 using R = typename Dune::TypeListElement<2, decltype(tl)>::type;
│ │ │ -
955 return std::make_shared<Richardson<D,R>>(config);
│ │ │ -
956 });
│ │ │ -
957
│ │ │ -
958
│ │ │ -
969 template< class M, class X, class Y >
│ │ │ -
│ │ │ - │ │ │ -
971 : public Preconditioner< X, Y >
│ │ │ -
972 {
│ │ │ -
973 typedef SeqILDL< M, X, Y > This;
│ │ │ - │ │ │ -
975
│ │ │ -
976 public:
│ │ │ -
978 typedef std::remove_const_t< M > matrix_type;
│ │ │ -
980 typedef X domain_type;
│ │ │ -
982 typedef Y range_type;
│ │ │ -
984 typedef typename X::field_type field_type;
│ │ │ -
986 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
988 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
989
│ │ │ -
│ │ │ -
1002 SeqILDL (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ -
1003 : SeqILDL(A->getmat(), configuration)
│ │ │ -
1004 {}
│ │ │ -
│ │ │ -
1005
│ │ │ -
│ │ │ -
1018 SeqILDL(const matrix_type& A, const ParameterTree& config)
│ │ │ -
1019 : SeqILDL(A, config.get<real_field_type>("relaxation", 1.0))
│ │ │ -
1020 {}
│ │ │ -
│ │ │ -
1021
│ │ │ -
│ │ │ -
1030 explicit SeqILDL ( const matrix_type &A, real_field_type relax = real_field_type( 1 ) )
│ │ │ -
1031 : decomposition_( A.N(), A.M(), matrix_type::random ),
│ │ │ -
1032 relax_( relax )
│ │ │ -
1033 {
│ │ │ -
1034 // setup row sizes for lower triangular matrix
│ │ │ -
1035 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ -
1036 {
│ │ │ -
1037 const auto &A_i = *i;
│ │ │ -
1038 const auto ij = A_i.find( i.index() );
│ │ │ -
1039 if( ij != A_i.end() )
│ │ │ -
1040 decomposition_.setrowsize( i.index(), ij.offset()+1 );
│ │ │ -
1041 else
│ │ │ -
1042 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ -
1043 }
│ │ │ -
1044 decomposition_.endrowsizes();
│ │ │ -
1045
│ │ │ -
1046 // setup row indices for lower triangular matrix
│ │ │ -
1047 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ -
1048 {
│ │ │ -
1049 const auto &A_i = *i;
│ │ │ -
1050 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij )
│ │ │ -
1051 decomposition_.addindex( i.index(), ij.index() );
│ │ │ -
1052 decomposition_.addindex( i.index(), i.index() );
│ │ │ -
1053 }
│ │ │ -
1054 decomposition_.endindices();
│ │ │ -
1055
│ │ │ -
1056 // copy values of lower triangular matrix
│ │ │ -
1057 auto i = A.begin();
│ │ │ -
1058 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row != rowend; ++row, ++i )
│ │ │ -
1059 {
│ │ │ -
1060 auto ij = i->begin();
│ │ │ -
1061 for( auto col = row->begin(), colend = row->end(); col != colend; ++col, ++ij )
│ │ │ -
1062 *col = *ij;
│ │ │ -
1063 }
│ │ │ -
1064
│ │ │ -
1065 // perform ILDL decomposition
│ │ │ -
1066 bildl_decompose( decomposition_ );
│ │ │ -
1067 }
│ │ │ -
│ │ │ -
1068
│ │ │ -
│ │ │ -
1070 void pre ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
│ │ │ -
1071 {}
│ │ │ -
│ │ │ -
1072
│ │ │ -
│ │ │ -
1074 void apply ( X &v, const Y &d ) override
│ │ │ -
1075 {
│ │ │ -
1076 bildl_backsolve( decomposition_, v, d, true );
│ │ │ -
1077 v *= relax_;
│ │ │ -
1078 }
│ │ │ -
│ │ │ -
1079
│ │ │ -
│ │ │ -
1081 void post ([[maybe_unused]] X &x) override
│ │ │ -
1082 {}
│ │ │ -
│ │ │ -
1083
│ │ │ - │ │ │ -
1086
│ │ │ -
1087 private:
│ │ │ -
1088 matrix_type decomposition_;
│ │ │ -
1089 real_field_type relax_;
│ │ │ -
1090 };
│ │ │ -
│ │ │ -
1091 DUNE_REGISTER_PRECONDITIONER("ildl", defaultPreconditionerCreator<Dune::SeqILDL>());
│ │ │ -
1092
│ │ │ -
1095} // end namespace
│ │ │ -
1096
│ │ │ -
1097
│ │ │ -
1098#endif
│ │ │ - │ │ │ -
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:16
│ │ │ - │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ - │ │ │ -
Some handy generic functions for ISTL matrices.
│ │ │ - │ │ │ -
The incomplete LU factorization kernels.
│ │ │ -
Incomplete LDL decomposition.
│ │ │ -
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ -
The diagonal incomplete LU factorization kernels.
│ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ -
void bsorb(const M &A, X &x, const Y &b, const K &w)
SSOR step.
Definition gsetc.hh:646
│ │ │ -
void dbjac(const M &A, X &x, const Y &b, const K &w)
Jacobi step.
Definition gsetc.hh:658
│ │ │ -
void bsorf(const M &A, X &x, const Y &b, const K &w)
SOR step.
Definition gsetc.hh:634
│ │ │ +
30 void operator()(const typename G::ConstEdgeIterator& edge);
│ │ │ +
31
│ │ │ +
32 void operator++();
│ │ │ +
33
│ │ │ +
34 protected:
│ │ │ + │ │ │ + │ │ │ +
37 };
│ │ │ +
│ │ │ +
38
│ │ │ +
39 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
41 : number_(0), aggregates_(aggregates)
│ │ │ +
42 {}
│ │ │ +
│ │ │ +
43
│ │ │ +
44 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
46 {
│ │ │ +
47 return number_;
│ │ │ +
48 }
│ │ │ +
│ │ │ +
49
│ │ │ +
50 template<class G>
│ │ │ +
│ │ │ +
51 void AggregateRenumberer<G>::operator()(const typename G::ConstEdgeIterator& edge)
│ │ │ +
52 {
│ │ │ +
53 aggregates_[edge.target()]=number_;
│ │ │ +
54 }
│ │ │ +
│ │ │ +
55
│ │ │ +
56 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
58 {
│ │ │ +
59 ++number_;
│ │ │ +
60 }
│ │ │ +
│ │ │ +
61
│ │ │ +
62 template<class G, class I, class V>
│ │ │ +
│ │ │ +
63 void renumberAggregates(const G& graph, I index, I endIndex, V& visitedMap,
│ │ │ + │ │ │ +
65 {
│ │ │ +
66 AggregateRenumberer<G> renumberer(aggregates);
│ │ │ +
67
│ │ │ +
68 for(I index1=index; index1 != endIndex; ++index1)
│ │ │ +
69 if(aggregates[index1.index()]!=AggregatesMap<typename G::VertexDescriptor>::ISOLATED &&
│ │ │ +
70 !get(visitedMap, index1.index())) {
│ │ │ +
71
│ │ │ +
72 aggregates.template breadthFirstSearch<false>(index1.index(), aggregates[index1.index()],
│ │ │ +
73 graph, renumberer, visitedMap);
│ │ │ +
74 aggregates[index1.index()] = renumberer;
│ │ │ +
75 ++renumberer;
│ │ │ +
76 }
│ │ │ +
77 for(; index != endIndex; ++index)
│ │ │ +
78 put(visitedMap, index.index(), false);
│ │ │ +
79 }
│ │ │ +
│ │ │ +
80
│ │ │ +
81 } // namespace AMG
│ │ │ +
82} // namespace Dune
│ │ │ +
83#endif
│ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │
Definition allocator.hh:11
│ │ │ -
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition ildl.hh:88
│ │ │
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
Definition ildl.hh:149
│ │ │ -
void blockDILUDecomposition(M &A, std::vector< typename M::block_type > &Dinv_)
Definition dilu.hh:51
│ │ │ -
void blockDILUBacksolve(const M &A, const std::vector< typename M::block_type > Dinv_, X &v, const Y &d)
Definition dilu.hh:107
│ │ │ -
void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv)
convert ILU decomposition into CRS format for lower and upper triangular and inverse.
Definition ilu.hh:307
│ │ │ -
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:94
│ │ │ -
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:33
│ │ │ -
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:167
│ │ │ -
compile-time parameter for block recursion depth
Definition gsetc.hh:45
│ │ │ -
a simple compressed row storage matrix class
Definition ilu.hh:259
│ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
static void check(const Matrix &mat)
Check whether the a matrix has diagonal values on blocklevel recursion levels.
Definition matrixutils.hh:53
│ │ │ -
A linear operator exporting itself in matrix form.
Definition operators.hh:111
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
Turns an InverseOperator into a Preconditioner.
Definition preconditioners.hh:76
│ │ │ -
O::range_type range_type
The range type of the preconditioner.
Definition preconditioners.hh:81
│ │ │ -
O::domain_type domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:79
│ │ │ -
virtual void post(domain_type &)
Clean up.
Definition preconditioners.hh:112
│ │ │ -
range_type::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:83
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:87
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:85
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:116
│ │ │ -
virtual void pre(domain_type &, range_type &)
Prepare the preconditioner.
Definition preconditioners.hh:102
│ │ │ -
InverseOperator2Preconditioner(InverseOperator &inverse_operator)
Construct the preconditioner from the solver.
Definition preconditioners.hh:95
│ │ │ -
O InverseOperator
type of the wrapped inverse operator
Definition preconditioners.hh:89
│ │ │ -
virtual void apply(domain_type &v, const range_type &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:105
│ │ │ -
Sequential SSOR preconditioner.
Definition preconditioners.hh:142
│ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:230
│ │ │ -
SeqSSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:183
│ │ │ -
SeqSSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:200
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:234
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:151
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:153
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:147
│ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:145
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:217
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:209
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:149
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:155
│ │ │ -
SeqSSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:164
│ │ │ -
Sequential SOR preconditioner.
Definition preconditioners.hh:262
│ │ │ -
SeqSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:303
│ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:265
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:275
│ │ │ -
void apply(X &v, const Y &d)
Apply the preconditioner in a special direction.
Definition preconditioners.hh:351
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:267
│ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:368
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:329
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:273
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:372
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:337
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:269
│ │ │ -
SeqSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:320
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:271
│ │ │ -
SeqSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:284
│ │ │ -
The sequential jacobian preconditioner.
Definition preconditioners.hh:413
│ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:500
│ │ │ -
SeqJac(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:471
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:488
│ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:416
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:424
│ │ │ -
SeqJac(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:454
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:422
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:480
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:418
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:426
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:504
│ │ │ -
SeqJac(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:435
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:420
│ │ │ -
Sequential DILU preconditioner.
Definition preconditioners.hh:564
│ │ │ -
const bool wNotIdentity_
true if w != 1.0
Definition preconditioners.hh:681
│ │ │ -
typename X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:576
│ │ │ -
const real_field_type _w
The relaxation factor to use.
Definition preconditioners.hh:679
│ │ │ -
const M & _A_
The matrix we operate on.
Definition preconditioners.hh:677
│ │ │ -
SeqDILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:612
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:579
│ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:664
│ │ │ -
typename FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:581
│ │ │ -
M matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:567
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:571
│ │ │ -
typename matrix_type::block_type block_type
block type of matrix
Definition preconditioners.hh:569
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:648
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:639
│ │ │ -
SeqDILU(const M &A, real_field_type w)
Constructor.
Definition preconditioners.hh:589
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:669
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:573
│ │ │ -
SeqDILU(const M &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:629
│ │ │ -
std::vector< block_type > Dinv_
Definition preconditioners.hh:675
│ │ │ -
Sequential ILU preconditioner.
Definition preconditioners.hh:697
│ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:843
│ │ │ -
SeqILU(const M &A, int n, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:777
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:813
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the preconditioner.
Definition preconditioners.hh:821
│ │ │ -
ILU::CRS< block_type, typename M::allocator_type > CRS
type of ILU storage
Definition preconditioners.hh:717
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:706
│ │ │ -
CRS lower_
The ILU(n) decomposition of the matrix. As storage a CRS structure is used.
Definition preconditioners.hh:857
│ │ │ -
const bool wNotIdentity_
true if w != 1.0
Definition preconditioners.hh:864
│ │ │ -
SeqILU(const M &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:763
│ │ │ -
std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition preconditioners.hh:700
│ │ │ -
matrix_type::block_type block_type
block type of matrix
Definition preconditioners.hh:702
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:714
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:709
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:847
│ │ │ -
SeqILU(const M &A, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:726
│ │ │ -
const real_field_type w_
The relaxation factor to use.
Definition preconditioners.hh:862
│ │ │ -
SeqILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:745
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:704
│ │ │ -
std::vector< block_type, typename matrix_type::allocator_type > inv_
Definition preconditioners.hh:859
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:712
│ │ │ -
std::unique_ptr< matrix_type > ILU_
The ILU(n) decomposition of the matrix. As storage a BCRSMatrix is used.
Definition preconditioners.hh:854
│ │ │ -
CRS upper_
Definition preconditioners.hh:858
│ │ │ -
Richardson preconditioner.
Definition preconditioners.hh:878
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:885
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:943
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:883
│ │ │ -
virtual void pre(X &x, Y &b)
Prepare the preconditioner.
Definition preconditioners.hh:920
│ │ │ -
Richardson(real_field_type w=1.0)
Constructor.
Definition preconditioners.hh:896
│ │ │ -
virtual void post(X &x)
Clean up.
Definition preconditioners.hh:939
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:889
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:887
│ │ │ -
Richardson(const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:911
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:881
│ │ │ -
virtual void apply(X &v, const Y &d)
Apply the precondioner.
Definition preconditioners.hh:928
│ │ │ -
sequential ILDL preconditioner
Definition preconditioners.hh:972
│ │ │ -
SeqILDL(const matrix_type &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:1018
│ │ │ -
SeqILDL(const matrix_type &A, real_field_type relax=real_field_type(1))
constructor
Definition preconditioners.hh:1030
│ │ │ -
X domain_type
domain type of the preconditioner
Definition preconditioners.hh:980
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:1081
│ │ │ -
Y range_type
range type of the preconditioner
Definition preconditioners.hh:982
│ │ │ -
std::remove_const_t< M > matrix_type
type of matrix the preconditioner is for
Definition preconditioners.hh:978
│ │ │ -
void apply(X &v, const Y &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:1074
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:988
│ │ │ -
SeqILDL(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:1002
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:1070
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:986
│ │ │ -
X::field_type field_type
field type of the preconditioner
Definition preconditioners.hh:984
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
Definition preconditioners.hh:1085
│ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ +
void renumberAggregates(const G &graph, I index, I endIndex, V &visitedMap, AggregatesMap< typename G::VertexDescriptor > &aggregates)
Definition renumberer.hh:63
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
Definition renumberer.hh:16
│ │ │ +
void operator++()
Definition renumberer.hh:57
│ │ │ +
G::VertexDescriptor Vertex
The vertex type.
Definition renumberer.hh:19
│ │ │ +
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
│ │ │ +
AggregatesMap< Vertex > & aggregates_
Definition renumberer.hh:36
│ │ │ +
AggregateRenumberer(AggregatesMap< Vertex > &aggregates)
Constructor.
Definition renumberer.hh:40
│ │ │ +
Vertex number_
Definition renumberer.hh:35
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1171 +1,131 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -preconditioners.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +renumberer.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_PRECONDITIONERS_HH │ │ │ │ -6#define DUNE_ISTL_PRECONDITIONERS_HH │ │ │ │ +5#ifndef DUNE_AMG_RENUMBERER_HH │ │ │ │ +6#define DUNE_AMG_RENUMBERER_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14 │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17 │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ -19#include "_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h" │ │ │ │ -20#include "_s_o_l_v_e_r_._h_h" │ │ │ │ -21#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ -22#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ -23#include "_m_a_t_r_i_x_u_t_i_l_s_._h_h" │ │ │ │ -24#include "_g_s_e_t_c_._h_h" │ │ │ │ -25#include "_d_i_l_u_._h_h" │ │ │ │ -26#include "_i_l_d_l_._h_h" │ │ │ │ -27#include "_i_l_u_._h_h" │ │ │ │ -28 │ │ │ │ +8#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +9 │ │ │ │ +10namespace _D_u_n_e │ │ │ │ +11{ │ │ │ │ +12 namespace Amg │ │ │ │ +13 { │ │ │ │ +14 template │ │ │ │ +_1_5 class _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +16 { │ │ │ │ +17 public: │ │ │ │ +_1_9 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +20 │ │ │ │ +25 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates); │ │ │ │ +26 │ │ │ │ +28 operator _V_e_r_t_e_x() const; │ │ │ │ 29 │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ -73 template │ │ │ │ -_7_4 class _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r : │ │ │ │ -75 public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -76 { │ │ │ │ -77 public: │ │ │ │ -_7_9 typedef typename O::domain_type _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_8_1 typedef typename O::range_type _r_a_n_g_e___t_y_p_e; │ │ │ │ -_8_3 typedef typename range_type::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_8_5 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_8_7 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -_8_9 typedef O _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r; │ │ │ │ -90 │ │ │ │ -_9_5 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r(_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r& inverse_operator) │ │ │ │ -96 : inverse_operator_(inverse_operator) │ │ │ │ -97 { │ │ │ │ -98 if(c != -1 && _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(inverse_operator_) != c) │ │ │ │ -99 DUNE_THROW(InvalidStateException, "User-supplied solver category does not │ │ │ │ -match that of the given inverse operator"); │ │ │ │ -100 } │ │ │ │ -101 │ │ │ │ -_1_0_2 virtual void _p_r_e(_d_o_m_a_i_n___t_y_p_e&,_r_a_n_g_e___t_y_p_e&) │ │ │ │ -103 {} │ │ │ │ -104 │ │ │ │ -_1_0_5 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& v, const _r_a_n_g_e___t_y_p_e& d) │ │ │ │ -106 { │ │ │ │ -107 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ -108 _r_a_n_g_e___t_y_p_e copy(d); │ │ │ │ -109 inverse_operator_.apply(v, copy, res); │ │ │ │ -110 } │ │ │ │ -111 │ │ │ │ -_1_1_2 virtual void _p_o_s_t(_d_o_m_a_i_n___t_y_p_e&) │ │ │ │ -113 {} │ │ │ │ -114 │ │ │ │ -_1_1_6 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -117 { │ │ │ │ -118 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(inverse_operator_); │ │ │ │ -119 } │ │ │ │ -120 │ │ │ │ -121 private: │ │ │ │ -122 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r& inverse_operator_; │ │ │ │ -123 }; │ │ │ │ -124 │ │ │ │ -125 //===================================================================== │ │ │ │ -126 // Implementation of this interface for sequential ISTL-preconditioners │ │ │ │ -127 //===================================================================== │ │ │ │ -128 │ │ │ │ -129 │ │ │ │ -141 template │ │ │ │ -_1_4_2 class _S_e_q_S_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -143 public: │ │ │ │ -_1_4_5 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_1_4_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_1_4_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_1_5_1 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_1_5_3 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_1_5_5 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -156 │ │ │ │ -_1_6_4 _S_e_q_S_S_O_R (const M& A, int n, _r_e_a_l___f_i_e_l_d___t_y_p_e w) │ │ │ │ -165 : _A_(A), _n(n), _w(w) │ │ │ │ -166 { │ │ │ │ -167 _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t_<_M_,_l_>_:_:_c_h_e_c_k(_A_); │ │ │ │ -168 } │ │ │ │ -169 │ │ │ │ -_1_8_3 _S_e_q_S_S_O_R (const std::shared_ptr>& A, │ │ │ │ -const ParameterTree& configuration) │ │ │ │ -184 : _S_e_q_S_S_O_R(A->getmat(), configuration) │ │ │ │ -185 {} │ │ │ │ -186 │ │ │ │ -_2_0_0 _S_e_q_S_S_O_R (const M& A, const ParameterTree& configuration) │ │ │ │ -201 : _S_e_q_S_S_O_R(A, configuration._g_e_t("iterations",1), │ │ │ │ -configuration._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation",1.0)) │ │ │ │ -202 {} │ │ │ │ -203 │ │ │ │ -_2_0_9 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ -210 {} │ │ │ │ -211 │ │ │ │ -_2_1_7 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -218 { │ │ │ │ -219 for (int i=0; i<_n; i++) { │ │ │ │ -220 _b_s_o_r_f(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ -221 _b_s_o_r_b(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ -222 } │ │ │ │ -223 } │ │ │ │ -224 │ │ │ │ -_2_3_0 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ -231 {} │ │ │ │ -232 │ │ │ │ -_2_3_4 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -235 { │ │ │ │ -236 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -237 } │ │ │ │ -238 │ │ │ │ -239 private: │ │ │ │ -241 const M& _A_; │ │ │ │ -243 int _n; │ │ │ │ -245 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ -246 }; │ │ │ │ -_2_4_7 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("ssor", │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ -248 │ │ │ │ -249 │ │ │ │ -261 template │ │ │ │ -_2_6_2 class _S_e_q_S_O_R : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -263 public: │ │ │ │ -_2_6_5 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_2_6_7 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_2_6_9 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_2_7_1 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_2_7_3 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_2_7_5 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -276 │ │ │ │ -_2_8_4 _S_e_q_S_O_R (const M& A, int n, _r_e_a_l___f_i_e_l_d___t_y_p_e w) │ │ │ │ -285 : _A_(A), _n(n), _w(w) │ │ │ │ -286 { │ │ │ │ -287 _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t_<_M_,_l_>_:_:_c_h_e_c_k(_A_); │ │ │ │ -288 } │ │ │ │ -289 │ │ │ │ -_3_0_3 _S_e_q_S_O_R (const std::shared_ptr>& A, │ │ │ │ -const ParameterTree& configuration) │ │ │ │ -304 : _S_e_q_S_O_R(A->getmat(), configuration) │ │ │ │ -305 {} │ │ │ │ -306 │ │ │ │ -_3_2_0 _S_e_q_S_O_R (const M& A, const ParameterTree& configuration) │ │ │ │ -321 : _S_e_q_S_O_R(A, configuration._g_e_t("iterations",1), │ │ │ │ -configuration._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation",1.0)) │ │ │ │ -322 {} │ │ │ │ -323 │ │ │ │ -_3_2_9 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ -330 {} │ │ │ │ -331 │ │ │ │ -_3_3_7 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -338 { │ │ │ │ -339 this->template apply(v,d); │ │ │ │ -340 } │ │ │ │ -341 │ │ │ │ -350 template │ │ │ │ -_3_5_1 void _a_p_p_l_y(X& v, const Y& d) │ │ │ │ -352 { │ │ │ │ -353 if(forward) │ │ │ │ -354 for (int i=0; i<_n; i++) { │ │ │ │ -355 _b_s_o_r_f(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ -356 } │ │ │ │ -357 else │ │ │ │ -358 for (int i=0; i<_n; i++) { │ │ │ │ -359 _b_s_o_r_b(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ -360 } │ │ │ │ -361 } │ │ │ │ -362 │ │ │ │ -_3_6_8 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ -369 {} │ │ │ │ -370 │ │ │ │ -_3_7_2 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -373 { │ │ │ │ -374 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -375 } │ │ │ │ -376 │ │ │ │ -377 private: │ │ │ │ -379 const M& _A_; │ │ │ │ -381 int _n; │ │ │ │ -383 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ -384 }; │ │ │ │ -_3_8_5 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("sor", │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ -386 │ │ │ │ -387 │ │ │ │ -398 template │ │ │ │ -_3_9_9 using _S_e_q_G_S = _S_e_q_S_O_R_<_M_,_X_,_Y_,_l_>; │ │ │ │ -_4_0_0 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("gs", │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ -401 │ │ │ │ -412 template │ │ │ │ -_4_1_3 class _S_e_q_J_a_c : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_> { │ │ │ │ -414 public: │ │ │ │ -_4_1_6 typedef M _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_4_1_8 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_4_2_0 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_4_2_2 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_4_2_4 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_4_2_6 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -427 │ │ │ │ -_4_3_5 _S_e_q_J_a_c (const M& A, int n, _r_e_a_l___f_i_e_l_d___t_y_p_e w) │ │ │ │ -436 : _A_(A), _n(n), _w(w) │ │ │ │ -437 { │ │ │ │ -438 _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t_<_M_,_l_>_:_:_c_h_e_c_k(_A_); │ │ │ │ -439 } │ │ │ │ -440 │ │ │ │ -_4_5_4 _S_e_q_J_a_c (const std::shared_ptr>& A, │ │ │ │ -const ParameterTree& configuration) │ │ │ │ -455 : _S_e_q_J_a_c(A->getmat(), configuration) │ │ │ │ -456 {} │ │ │ │ -457 │ │ │ │ -_4_7_1 _S_e_q_J_a_c (const M& A, const ParameterTree& configuration) │ │ │ │ -472 : _S_e_q_J_a_c(A, configuration._g_e_t("iterations",1), │ │ │ │ -configuration._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation",1.0)) │ │ │ │ -473 {} │ │ │ │ -474 │ │ │ │ -_4_8_0 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ -481 {} │ │ │ │ -482 │ │ │ │ -_4_8_8 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -489 { │ │ │ │ -490 for (int i=0; i<_n; i++) { │ │ │ │ -491 _d_b_j_a_c(_A_,v,d,_w,_B_L_<_l_>()); │ │ │ │ -492 } │ │ │ │ -493 } │ │ │ │ -494 │ │ │ │ -_5_0_0 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ -501 {} │ │ │ │ -502 │ │ │ │ -_5_0_4 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -505 { │ │ │ │ -506 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -507 } │ │ │ │ -508 │ │ │ │ -509 private: │ │ │ │ -511 const M& _A_; │ │ │ │ -513 int _n; │ │ │ │ -515 real_field_type _w; │ │ │ │ -516 }; │ │ │ │ -_5_1_7 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("jac", │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ -518 │ │ │ │ -562 template │ │ │ │ -_5_6_3 class _S_e_q_D_I_L_U : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_ _Y_> │ │ │ │ -564 { │ │ │ │ -565 public: │ │ │ │ -_5_6_7 using _m_a_t_r_i_x___t_y_p_e = M; │ │ │ │ -_5_6_9 using _b_l_o_c_k___t_y_p_e = typename matrix_type::block_type; │ │ │ │ -_5_7_1 using _d_o_m_a_i_n___t_y_p_e = X; │ │ │ │ -_5_7_3 using _r_a_n_g_e___t_y_p_e = Y; │ │ │ │ -574 │ │ │ │ -_5_7_6 using _f_i_e_l_d___t_y_p_e = typename X::field_type; │ │ │ │ -577 │ │ │ │ -_5_7_9 using _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e = Simd::Scalar; │ │ │ │ -_5_8_1 using _r_e_a_l___f_i_e_l_d___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ -582 │ │ │ │ -_5_8_9 _S_e_q_D_I_L_U(const M &A, _r_e_a_l___f_i_e_l_d___t_y_p_e w) │ │ │ │ -590 : _A_(A), │ │ │ │ -591 _w(w), │ │ │ │ -592 wNotIdentity_([w] │ │ │ │ -593 {using std::abs; return abs(w - _r_e_a_l___f_i_e_l_d___t_y_p_e(1)) > 1e-15; }()) │ │ │ │ -594 { │ │ │ │ -595 Dinv_.resize(_A_.N()); │ │ │ │ -596 _C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t_<_M_,_ _l_>_:_:_c_h_e_c_k(_A_); │ │ │ │ -597 _D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n(_A_, Dinv_); │ │ │ │ -598 } │ │ │ │ -599 │ │ │ │ -_6_1_2 _S_e_q_D_I_L_U(const std::shared_ptr> &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -613 : _S_e_q_D_I_L_U(A->getmat(), configuration) │ │ │ │ -614 { │ │ │ │ -615 } │ │ │ │ -616 │ │ │ │ -_6_2_9 _S_e_q_D_I_L_U(const M &A, const ParameterTree &config) │ │ │ │ -630 : _S_e_q_D_I_L_U(A, config._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation", 1.0)) │ │ │ │ -631 { │ │ │ │ -632 } │ │ │ │ -633 │ │ │ │ -_6_3_9 virtual void _p_r_e([[maybe_unused]] X &x, [[maybe_unused]] Y &b) │ │ │ │ -640 { │ │ │ │ -641 } │ │ │ │ -642 │ │ │ │ -_6_4_8 virtual void _a_p_p_l_y(X &v, const Y &d) │ │ │ │ -649 { │ │ │ │ -650 │ │ │ │ -651 _D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_B_a_c_k_s_o_l_v_e(_A_, Dinv_, v, d); │ │ │ │ -652 │ │ │ │ -653 if (wNotIdentity_) │ │ │ │ -654 { │ │ │ │ -655 v *= _w; │ │ │ │ -656 } │ │ │ │ -657 } │ │ │ │ -658 │ │ │ │ -_6_6_4 virtual void _p_o_s_t([[maybe_unused]] X &x) │ │ │ │ -665 { │ │ │ │ -666 } │ │ │ │ -667 │ │ │ │ -_6_6_9 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -670 { │ │ │ │ -671 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -672 } │ │ │ │ -673 │ │ │ │ -674 protected: │ │ │ │ -_6_7_5 std::vector _D_i_n_v__; │ │ │ │ -_6_7_7 const M &___A__; │ │ │ │ -_6_7_9 const _r_e_a_l___f_i_e_l_d___t_y_p_e ___w; │ │ │ │ -_6_8_1 const bool _w_N_o_t_I_d_e_n_t_i_t_y__; │ │ │ │ -682 }; │ │ │ │ -_6_8_3 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("dilu", │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ -684 │ │ │ │ -696 template │ │ │ │ -_6_9_7 class _S_e_q_I_L_U : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -698 public: │ │ │ │ -_7_0_0 typedef typename std::remove_const::type _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_7_0_2 typedef typename matrix_type :: block_type _b_l_o_c_k___t_y_p_e; │ │ │ │ -_7_0_4 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_7_0_6 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -707 │ │ │ │ -_7_0_9 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -710 │ │ │ │ -_7_1_2 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_7_1_4 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -715 │ │ │ │ -_7_1_7 typedef typename _I_L_U_:_:_C_R_S_<_ _b_l_o_c_k___t_y_p_e_ _,_ _t_y_p_e_n_a_m_e_ _M_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e_> _C_R_S; │ │ │ │ -718 │ │ │ │ -_7_2_6 _S_e_q_I_L_U (const M& A, _r_e_a_l___f_i_e_l_d___t_y_p_e w, const bool resort = false ) │ │ │ │ -727 : _S_e_q_I_L_U( A, 0, w, resort ) // construct ILU(0) │ │ │ │ -728 { │ │ │ │ -729 } │ │ │ │ -730 │ │ │ │ -_7_4_5 _S_e_q_I_L_U (const std::shared_ptr>& A, │ │ │ │ -const ParameterTree& configuration) │ │ │ │ -746 : _S_e_q_I_L_U(A->getmat(), configuration) │ │ │ │ -747 {} │ │ │ │ -748 │ │ │ │ -_7_6_3 _S_e_q_I_L_U(const M& A, const ParameterTree& config) │ │ │ │ -764 : _S_e_q_I_L_U(A, config._g_e_t("n", 0), │ │ │ │ -765 config._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation", 1.0), │ │ │ │ -766 config._g_e_t("resort", false)) │ │ │ │ -767 {} │ │ │ │ -768 │ │ │ │ -_7_7_7 _S_e_q_I_L_U (const M& A, int n, _r_e_a_l___f_i_e_l_d___t_y_p_e w, const bool resort = false ) │ │ │ │ -778 : _I_L_U__(), │ │ │ │ -779 _l_o_w_e_r__(), │ │ │ │ -780 _u_p_p_e_r__(), │ │ │ │ -781 _i_n_v__(), │ │ │ │ -782 _w__(w), │ │ │ │ -783 _w_N_o_t_I_d_e_n_t_i_t_y__([w]{using std::abs; return abs(w - _r_e_a_l___f_i_e_l_d___t_y_p_e(1)) > 1e- │ │ │ │ -15;}() ) │ │ │ │ -784 { │ │ │ │ -785 if( n == 0 ) │ │ │ │ -786 { │ │ │ │ -787 // copy A │ │ │ │ -788 _I_L_U__.reset( new _m_a_t_r_i_x___t_y_p_e( A ) ); │ │ │ │ -789 // create ILU(0) decomposition │ │ │ │ -790 _I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n( *_I_L_U__ ); │ │ │ │ -791 } │ │ │ │ -792 else │ │ │ │ -793 { │ │ │ │ -794 // create matrix in build mode │ │ │ │ -795 _I_L_U__.reset( new _m_a_t_r_i_x___t_y_p_e( A.N(), A.M(), matrix_type::row_wise) ); │ │ │ │ -796 // create ILU(n) decomposition │ │ │ │ -797 _I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n( A, n, *_I_L_U__ ); │ │ │ │ -798 } │ │ │ │ -799 │ │ │ │ -800 if( resort ) │ │ │ │ -801 { │ │ │ │ -802 // store ILU in simple CRS format │ │ │ │ -803 _I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S( *_I_L_U__, _l_o_w_e_r__, _u_p_p_e_r__, _i_n_v__ ); │ │ │ │ -804 _I_L_U__.reset(); │ │ │ │ -805 } │ │ │ │ -806 } │ │ │ │ -807 │ │ │ │ -_8_1_3 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ -814 {} │ │ │ │ -815 │ │ │ │ -_8_2_1 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -822 { │ │ │ │ -823 if( _I_L_U__ ) │ │ │ │ -824 { │ │ │ │ -825 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e( *_I_L_U__, v, d); │ │ │ │ -826 } │ │ │ │ -827 else │ │ │ │ -828 { │ │ │ │ -829 _I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e(_l_o_w_e_r__, _u_p_p_e_r__, _i_n_v__, v, d); │ │ │ │ -830 } │ │ │ │ -831 │ │ │ │ -832 if( _w_N_o_t_I_d_e_n_t_i_t_y__ ) │ │ │ │ -833 { │ │ │ │ -834 v *= _w__; │ │ │ │ -835 } │ │ │ │ -836 } │ │ │ │ -837 │ │ │ │ -_8_4_3 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ -844 {} │ │ │ │ -845 │ │ │ │ -_8_4_7 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -848 { │ │ │ │ -849 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -850 } │ │ │ │ -851 │ │ │ │ -852 protected: │ │ │ │ -_8_5_4 std::unique_ptr< matrix_type > _I_L_U__; │ │ │ │ -855 │ │ │ │ -_8_5_7 _C_R_S _l_o_w_e_r__; │ │ │ │ -_8_5_8 _C_R_S _u_p_p_e_r__; │ │ │ │ -_8_5_9 std::vector< block_type, typename matrix_type::allocator_type > _i_n_v__; │ │ │ │ -860 │ │ │ │ -_8_6_2 const _r_e_a_l___f_i_e_l_d___t_y_p_e _w__; │ │ │ │ -_8_6_4 const bool _w_N_o_t_I_d_e_n_t_i_t_y__; │ │ │ │ -865 }; │ │ │ │ -_8_6_6 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("ilu", │ │ │ │ -defaultPreconditionerBlockLevelCreator()); │ │ │ │ -867 │ │ │ │ -868 │ │ │ │ -877 template │ │ │ │ -_8_7_8 class _R_i_c_h_a_r_d_s_o_n : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -879 public: │ │ │ │ -_8_8_1 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_8_8_3 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_8_8_5 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_8_8_7 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_8_8_9 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -890 │ │ │ │ -_8_9_6 _R_i_c_h_a_r_d_s_o_n (_r_e_a_l___f_i_e_l_d___t_y_p_e w=1.0) : │ │ │ │ -897 _w(w) │ │ │ │ -898 {} │ │ │ │ -899 │ │ │ │ -_9_1_1 _R_i_c_h_a_r_d_s_o_n (const ParameterTree& configuration) │ │ │ │ -912 : _R_i_c_h_a_r_d_s_o_n(configuration._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation", 1.0)) │ │ │ │ -913 {} │ │ │ │ -914 │ │ │ │ -_9_2_0 virtual void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) │ │ │ │ -921 {} │ │ │ │ -922 │ │ │ │ -_9_2_8 virtual void _a_p_p_l_y (X& v, const Y& d) │ │ │ │ -929 { │ │ │ │ -930 v = d; │ │ │ │ -931 v *= _w; │ │ │ │ -932 } │ │ │ │ -933 │ │ │ │ -_9_3_9 virtual void _p_o_s_t ([[maybe_unused]] X& x) │ │ │ │ -940 {} │ │ │ │ -941 │ │ │ │ -_9_4_3 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -944 { │ │ │ │ -945 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -946 } │ │ │ │ -947 │ │ │ │ -948 private: │ │ │ │ -950 _r_e_a_l___f_i_e_l_d___t_y_p_e _w; │ │ │ │ -951 }; │ │ │ │ -_9_5_2 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("richardson", [](auto tl, const auto& /* mat │ │ │ │ -*/, const ParameterTree& config){ │ │ │ │ -953 using D = typename Dune::TypeListElement<1, decltype(tl)>::type; │ │ │ │ -954 using R = typename Dune::TypeListElement<2, decltype(tl)>::type; │ │ │ │ -955 return std::make_shared>(config); │ │ │ │ -956 }); │ │ │ │ -957 │ │ │ │ -958 │ │ │ │ -969 template< class M, class X, class Y > │ │ │ │ -_9_7_0 class _S_e_q_I_L_D_L │ │ │ │ -971 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ -972 { │ │ │ │ -973 typedef _S_e_q_I_L_D_L_<_ _M_,_ _X_,_ _Y_ _> _T_h_i_s; │ │ │ │ -974 typedef _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_ _> _B_a_s_e; │ │ │ │ -975 │ │ │ │ -976 public: │ │ │ │ -_9_7_8 typedef std::remove_const_t< M > _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_9_8_0 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_9_8_2 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_9_8_4 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_9_8_6 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_9_8_8 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -989 │ │ │ │ -_1_0_0_2 _S_e_q_I_L_D_L (const std::shared_ptr>& A, │ │ │ │ -const ParameterTree& configuration) │ │ │ │ -1003 : _S_e_q_I_L_D_L(A->getmat(), configuration) │ │ │ │ -1004 {} │ │ │ │ -1005 │ │ │ │ -_1_0_1_8 _S_e_q_I_L_D_L(const _m_a_t_r_i_x___t_y_p_e& A, const ParameterTree& config) │ │ │ │ -1019 : _S_e_q_I_L_D_L(A, config._g_e_t<_r_e_a_l___f_i_e_l_d___t_y_p_e>("relaxation", 1.0)) │ │ │ │ -1020 {} │ │ │ │ -1021 │ │ │ │ -_1_0_3_0 explicit _S_e_q_I_L_D_L ( const _m_a_t_r_i_x___t_y_p_e &A, _r_e_a_l___f_i_e_l_d___t_y_p_e relax = │ │ │ │ -_r_e_a_l___f_i_e_l_d___t_y_p_e( 1 ) ) │ │ │ │ -1031 : decomposition_( A.N(), A.M(), _m_a_t_r_i_x___t_y_p_e::random ), │ │ │ │ -1032 relax_( relax ) │ │ │ │ -1033 { │ │ │ │ -1034 // setup row sizes for lower triangular matrix │ │ │ │ -1035 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ -1036 { │ │ │ │ -1037 const auto &A_i = *i; │ │ │ │ -1038 const auto ij = A_i.find( i.index() ); │ │ │ │ -1039 if( ij != A_i.end() ) │ │ │ │ -1040 decomposition_.setrowsize( i.index(), ij.offset()+1 ); │ │ │ │ -1041 else │ │ │ │ -1042 DUNE_THROW( _I_S_T_L_E_r_r_o_r, "diagonal entry missing" ); │ │ │ │ -1043 } │ │ │ │ -1044 decomposition_.endrowsizes(); │ │ │ │ -1045 │ │ │ │ -1046 // setup row indices for lower triangular matrix │ │ │ │ -1047 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ -1048 { │ │ │ │ -1049 const auto &A_i = *i; │ │ │ │ -1050 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij ) │ │ │ │ -1051 decomposition_.addindex( i.index(), ij.index() ); │ │ │ │ -1052 decomposition_.addindex( i.index(), i.index() ); │ │ │ │ -1053 } │ │ │ │ -1054 decomposition_.endindices(); │ │ │ │ -1055 │ │ │ │ -1056 // copy values of lower triangular matrix │ │ │ │ -1057 auto i = A.begin(); │ │ │ │ -1058 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row │ │ │ │ -!= rowend; ++row, ++i ) │ │ │ │ -1059 { │ │ │ │ -1060 auto ij = i->begin(); │ │ │ │ -1061 for( auto _c_o_l = row->begin(), colend = row->end(); _c_o_l != colend; ++_c_o_l, │ │ │ │ -++ij ) │ │ │ │ -1062 *_c_o_l = *ij; │ │ │ │ -1063 } │ │ │ │ -1064 │ │ │ │ -1065 // perform ILDL decomposition │ │ │ │ -1066 _b_i_l_d_l___d_e_c_o_m_p_o_s_e( decomposition_ ); │ │ │ │ -1067 } │ │ │ │ -1068 │ │ │ │ -_1_0_7_0 void _p_r_e ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override │ │ │ │ -1071 {} │ │ │ │ -1072 │ │ │ │ -_1_0_7_4 void _a_p_p_l_y ( X &v, const Y &d ) override │ │ │ │ -1075 { │ │ │ │ -1076 _b_i_l_d_l___b_a_c_k_s_o_l_v_e( decomposition_, v, d, true ); │ │ │ │ -1077 v *= relax_; │ │ │ │ -1078 } │ │ │ │ -1079 │ │ │ │ -_1_0_8_1 void _p_o_s_t ([[maybe_unused]] X &x) override │ │ │ │ -1082 {} │ │ │ │ -1083 │ │ │ │ -_1_0_8_5 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y () const override { return │ │ │ │ -_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; } │ │ │ │ -1086 │ │ │ │ -1087 private: │ │ │ │ -1088 _m_a_t_r_i_x___t_y_p_e decomposition_; │ │ │ │ -1089 _r_e_a_l___f_i_e_l_d___t_y_p_e relax_; │ │ │ │ -1090 }; │ │ │ │ -_1_0_9_1 _D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R("ildl", defaultPreconditionerCreator()); │ │ │ │ -1092 │ │ │ │ -1095} // end namespace │ │ │ │ -1096 │ │ │ │ -1097 │ │ │ │ -1098#endif │ │ │ │ -_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_E_R___P_R_E_C_O_N_D_I_T_I_O_N_E_R │ │ │ │ -#define DUNE_REGISTER_PRECONDITIONER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ -_s_o_l_v_e_r_._h_h │ │ │ │ -Define general, extensible interface for inverse operators. │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_._h_h │ │ │ │ -_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ -Some handy generic functions for ISTL matrices. │ │ │ │ -_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ -_i_l_u_._h_h │ │ │ │ -The incomplete LU factorization kernels. │ │ │ │ -_i_l_d_l_._h_h │ │ │ │ -Incomplete LDL decomposition. │ │ │ │ -_g_s_e_t_c_._h_h │ │ │ │ -Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ -generic way. │ │ │ │ -_d_i_l_u_._h_h │ │ │ │ -The diagonal incomplete LU factorization kernels. │ │ │ │ -_c_o_l │ │ │ │ -Col col │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ -_D_u_n_e_:_:_b_s_o_r_b │ │ │ │ -void bsorb(const M &A, X &x, const Y &b, const K &w) │ │ │ │ -SSOR step. │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:646 │ │ │ │ -_D_u_n_e_:_:_d_b_j_a_c │ │ │ │ -void dbjac(const M &A, X &x, const Y &b, const K &w) │ │ │ │ -Jacobi step. │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:658 │ │ │ │ -_D_u_n_e_:_:_b_s_o_r_f │ │ │ │ -void bsorf(const M &A, X &x, const Y &b, const K &w) │ │ │ │ -SOR step. │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:634 │ │ │ │ +30 void _o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& edge); │ │ │ │ +31 │ │ │ │ +32 void _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ +33 │ │ │ │ +34 protected: │ │ │ │ +_3_5 _V_e_r_t_e_x _n_u_m_b_e_r__; │ │ │ │ +_3_6 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& _a_g_g_r_e_g_a_t_e_s__; │ │ │ │ +37 }; │ │ │ │ +38 │ │ │ │ +39 template │ │ │ │ +_4_0 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ +aggregates) │ │ │ │ +41 : number_(0), aggregates_(aggregates) │ │ │ │ +42 {} │ │ │ │ +43 │ │ │ │ +44 template │ │ │ │ +_4_5 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r _V_e_r_t_e_x() const │ │ │ │ +46 { │ │ │ │ +47 return number_; │ │ │ │ +48 } │ │ │ │ +49 │ │ │ │ +50 template │ │ │ │ +_5_1 void _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& │ │ │ │ +edge) │ │ │ │ +52 { │ │ │ │ +53 aggregates_[edge.target()]=number_; │ │ │ │ +54 } │ │ │ │ +55 │ │ │ │ +56 template │ │ │ │ +_5_7 void _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r_+_+() │ │ │ │ +58 { │ │ │ │ +59 ++number_; │ │ │ │ +60 } │ │ │ │ +61 │ │ │ │ +62 template │ │ │ │ +_6_3 void _r_e_n_u_m_b_e_r_A_g_g_r_e_g_a_t_e_s(const G& graph, I index, I endIndex, V& visitedMap, │ │ │ │ +64 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates) │ │ │ │ +65 { │ │ │ │ +66 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_> renumberer(aggregates); │ │ │ │ +67 │ │ │ │ +68 for(I index1=index; index1 != endIndex; ++index1) │ │ │ │ +69 if(aggregates[index1.index()]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ +_I_S_O_L_A_T_E_D && │ │ │ │ +70 !_g_e_t(visitedMap, index1.index())) { │ │ │ │ +71 │ │ │ │ +72 aggregates.template breadthFirstSearch(index1.index(), aggregates │ │ │ │ +[index1.index()], │ │ │ │ +73 graph, renumberer, visitedMap); │ │ │ │ +74 aggregates[index1.index()] = renumberer; │ │ │ │ +75 ++renumberer; │ │ │ │ +76 } │ │ │ │ +77 for(; index != endIndex; ++index) │ │ │ │ +78 put(visitedMap, index.index(), false); │ │ │ │ +79 } │ │ │ │ +80 │ │ │ │ +81 } // namespace AMG │ │ │ │ +82} // namespace Dune │ │ │ │ +83#endif │ │ │ │ +_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ +Provides classes for the Coloring process of AMG. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e │ │ │ │ -void bildl_decompose(Matrix &A) │ │ │ │ -compute ILDL decomposition of a symmetric matrix A │ │ │ │ -DDeeffiinniittiioonn ildl.hh:88 │ │ │ │ _D_u_n_e_:_:_g_e_t │ │ │ │ PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_b_i_l_d_l___b_a_c_k_s_o_l_v_e │ │ │ │ -void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool │ │ │ │ -isLowerTriangular=false) │ │ │ │ -DDeeffiinniittiioonn ildl.hh:149 │ │ │ │ -_D_u_n_e_:_:_D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ -void blockDILUDecomposition(M &A, std::vector< typename M::block_type > &Dinv_) │ │ │ │ -DDeeffiinniittiioonn dilu.hh:51 │ │ │ │ -_D_u_n_e_:_:_D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ -void blockDILUBacksolve(const M &A, const std::vector< typename M::block_type > │ │ │ │ -Dinv_, X &v, const Y &d) │ │ │ │ -DDeeffiinniittiioonn dilu.hh:107 │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_c_o_n_v_e_r_t_T_o_C_R_S │ │ │ │ -void convertToCRS(const M &A, CRS &lower, CRS &upper, InvVector &inv) │ │ │ │ -convert ILU decomposition into CRS format for lower and upper triangular and │ │ │ │ -inverse. │ │ │ │ -DDeeffiinniittiioonn ilu.hh:307 │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ -void blockILUBacksolve(const M &A, X &v, const Y &d) │ │ │ │ -LU backsolve with stored inverse. │ │ │ │ -DDeeffiinniittiioonn ilu.hh:94 │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_0_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ -void blockILU0Decomposition(M &A) │ │ │ │ -compute ILU decomposition of A. A is overwritten by its decomposition │ │ │ │ -DDeeffiinniittiioonn ilu.hh:33 │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_b_l_o_c_k_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ -void blockILUDecomposition(const M &A, int n, M &ILU) │ │ │ │ -DDeeffiinniittiioonn ilu.hh:167 │ │ │ │ -_D_u_n_e_:_:_B_L │ │ │ │ -compile-time parameter for block recursion depth │ │ │ │ -DDeeffiinniittiioonn gsetc.hh:45 │ │ │ │ -_D_u_n_e_:_:_I_L_U_:_:_C_R_S │ │ │ │ -a simple compressed row storage matrix class │ │ │ │ -DDeeffiinniittiioonn ilu.hh:259 │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ -derive error class from the base class in common │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ -_D_u_n_e_:_:_C_h_e_c_k_I_f_D_i_a_g_o_n_a_l_P_r_e_s_e_n_t_:_:_c_h_e_c_k │ │ │ │ -static void check(const Matrix &mat) │ │ │ │ -Check whether the a matrix has diagonal values on blocklevel recursion levels. │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:53 │ │ │ │ -_D_u_n_e_:_:_A_s_s_e_m_b_l_e_d_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ -A linear operator exporting itself in matrix form. │ │ │ │ -DDeeffiinniittiioonn operators.hh:111 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Turns an InverseOperator into a Preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:76 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -O::range_type range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:81 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -O::domain_type domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:79 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ -virtual void post(domain_type &) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:112 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -range_type::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:83 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:87 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:85 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:116 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ -virtual void pre(domain_type &, range_type &) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:102 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -InverseOperator2Preconditioner(InverseOperator &inverse_operator) │ │ │ │ -Construct the preconditioner from the solver. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:95 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -O InverseOperator │ │ │ │ -type of the wrapped inverse operator │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:89 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_2_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(domain_type &v, const range_type &d) │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:105 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ -Sequential SSOR preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:142 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:230 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_S_e_q_S_S_O_R │ │ │ │ -SeqSSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:183 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_S_e_q_S_S_O_R │ │ │ │ -SeqSSOR(const M &A, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:200 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:234 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:151 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:153 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:147 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:145 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:217 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:209 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:149 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:155 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_S_e_q_S_S_O_R │ │ │ │ -SeqSSOR(const M &A, int n, real_field_type w) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:164 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R │ │ │ │ -Sequential SOR preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:262 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_S_e_q_S_O_R │ │ │ │ -SeqSOR(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:303 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:265 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:275 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner in a special direction. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:351 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:267 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:368 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:329 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:273 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:372 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:337 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:269 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_S_e_q_S_O_R │ │ │ │ -SeqSOR(const M &A, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:320 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:271 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_S_e_q_S_O_R │ │ │ │ -SeqSOR(const M &A, int n, real_field_type w) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:284 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c │ │ │ │ -The sequential jacobian preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:413 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:500 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_S_e_q_J_a_c │ │ │ │ -SeqJac(const M &A, const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:471 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:488 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:416 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:424 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_S_e_q_J_a_c │ │ │ │ -SeqJac(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:454 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:422 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:480 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:418 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:426 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:504 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_S_e_q_J_a_c │ │ │ │ -SeqJac(const M &A, int n, real_field_type w) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:435 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:420 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U │ │ │ │ -Sequential DILU preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:564 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_w_N_o_t_I_d_e_n_t_i_t_y__ │ │ │ │ -const bool wNotIdentity_ │ │ │ │ -true if w != 1.0 │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:681 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -typename X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:576 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:___w │ │ │ │ -const real_field_type _w │ │ │ │ -The relaxation factor to use. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:679 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:___A__ │ │ │ │ -const M & _A_ │ │ │ │ -The matrix we operate on. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:677 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_S_e_q_D_I_L_U │ │ │ │ -SeqDILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:612 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:579 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:664 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -typename FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:581 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:567 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:571 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ -typename matrix_type::block_type block_type │ │ │ │ -block type of matrix │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:569 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:648 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:639 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_S_e_q_D_I_L_U │ │ │ │ -SeqDILU(const M &A, real_field_type w) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:589 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:669 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:573 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_S_e_q_D_I_L_U │ │ │ │ -SeqDILU(const M &A, const ParameterTree &config) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:629 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_D_i_n_v__ │ │ │ │ -std::vector< block_type > Dinv_ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:675 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U │ │ │ │ -Sequential ILU preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:697 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:843 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_S_e_q_I_L_U │ │ │ │ -SeqILU(const M &A, int n, real_field_type w, const bool resort=false) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:777 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:813 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:821 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_C_R_S │ │ │ │ -ILU::CRS< block_type, typename M::allocator_type > CRS │ │ │ │ -type of ILU storage │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:717 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:706 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_l_o_w_e_r__ │ │ │ │ -CRS lower_ │ │ │ │ -The ILU(n) decomposition of the matrix. As storage a CRS structure is used. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:857 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_w_N_o_t_I_d_e_n_t_i_t_y__ │ │ │ │ -const bool wNotIdentity_ │ │ │ │ -true if w != 1.0 │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:864 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_S_e_q_I_L_U │ │ │ │ -SeqILU(const M &A, const ParameterTree &config) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:763 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -std::remove_const< M >::type matrix_type │ │ │ │ -The matrix type the preconditioner is for. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:700 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ -matrix_type::block_type block_type │ │ │ │ -block type of matrix │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:702 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:714 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:709 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:847 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_S_e_q_I_L_U │ │ │ │ -SeqILU(const M &A, real_field_type w, const bool resort=false) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:726 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_w__ │ │ │ │ -const real_field_type w_ │ │ │ │ -The relaxation factor to use. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:862 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_S_e_q_I_L_U │ │ │ │ -SeqILU(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:745 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:704 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_i_n_v__ │ │ │ │ -std::vector< block_type, typename matrix_type::allocator_type > inv_ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:859 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:712 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_I_L_U__ │ │ │ │ -std::unique_ptr< matrix_type > ILU_ │ │ │ │ -The ILU(n) decomposition of the matrix. As storage a BCRSMatrix is used. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:854 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_u_p_p_e_r__ │ │ │ │ -CRS upper_ │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:858 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n │ │ │ │ -Richardson preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:878 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:885 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:943 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:883 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:920 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_R_i_c_h_a_r_d_s_o_n │ │ │ │ -Richardson(real_field_type w=1.0) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:896 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:939 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:889 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:887 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_R_i_c_h_a_r_d_s_o_n │ │ │ │ -Richardson(const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:911 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:881 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d) │ │ │ │ -Apply the precondioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:928 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L │ │ │ │ -sequential ILDL preconditioner │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:972 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_S_e_q_I_L_D_L │ │ │ │ -SeqILDL(const matrix_type &A, const ParameterTree &config) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1018 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_S_e_q_I_L_D_L │ │ │ │ -SeqILDL(const matrix_type &A, real_field_type relax=real_field_type(1)) │ │ │ │ -constructor │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1030 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -domain type of the preconditioner │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:980 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1081 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -range type of the preconditioner │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:982 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -std::remove_const_t< M > matrix_type │ │ │ │ -type of matrix the preconditioner is for │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:978 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1074 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_field_type │ │ │ │ -real scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:988 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_S_e_q_I_L_D_L │ │ │ │ -SeqILDL(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, │ │ │ │ -const ParameterTree &configuration) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1002 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_p_r_e │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1070 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -scalar type underlying the field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:986 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -field type of the preconditioner │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:984 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_D_L_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:1085 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -Statistics about the application of an inverse operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -Abstract base class for all solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:101 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ -static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ -Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ -newly introduced virtu... │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_r_e_n_u_m_b_e_r_A_g_g_r_e_g_a_t_e_s │ │ │ │ +void renumberAggregates(const G &graph, I index, I endIndex, V &visitedMap, │ │ │ │ +AggregatesMap< typename G::VertexDescriptor > &aggregates) │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:63 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:16 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ +void operator++() │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:57 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_V_e_r_t_e_x │ │ │ │ +G::VertexDescriptor Vertex │ │ │ │ +The vertex type. │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:19 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename G::ConstEdgeIterator &edge) │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:51 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_a_g_g_r_e_g_a_t_e_s__ │ │ │ │ +AggregatesMap< Vertex > & aggregates_ │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:36 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +AggregateRenumberer(AggregatesMap< Vertex > &aggregates) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:40 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_n_u_m_b_e_r__ │ │ │ │ +Vertex number_ │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:35 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioner.hh File Reference │ │ │ +dune-istl: matrixhierarchy.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,41 +65,86 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ -
preconditioner.hh File Reference
│ │ │ +Namespaces | │ │ │ +Enumerations | │ │ │ +Functions
│ │ │ + │ │ │ │ │ │
│ │ │ -
#include <dune-istl-config.hh>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include "solvercategory.hh"
│ │ │ + │ │ │ +

Provides a classes representing the hierarchies in AMG. │ │ │ +More...

│ │ │ +
#include <algorithm>
│ │ │ +#include <tuple>
│ │ │ +#include "aggregates.hh"
│ │ │ +#include "graph.hh"
│ │ │ +#include "galerkin.hh"
│ │ │ +#include "renumberer.hh"
│ │ │ +#include "graphcreator.hh"
│ │ │ +#include "hierarchy.hh"
│ │ │ +#include <dune/istl/bvector.hh>
│ │ │ +#include <dune/common/parallel/indexset.hh>
│ │ │ +#include <dune/istl/matrixutils.hh>
│ │ │ +#include <dune/istl/matrixredistribute.hh>
│ │ │ +#include <dune/istl/paamg/dependency.hh>
│ │ │ +#include <dune/istl/paamg/indicescoarsener.hh>
│ │ │ +#include <dune/istl/paamg/globalaggregates.hh>
│ │ │ +#include <dune/istl/paamg/construction.hh>
│ │ │ +#include <dune/istl/paamg/smoother.hh>
│ │ │ +#include <dune/istl/paamg/transfer.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Preconditioner< X, Y >
 Base class for matrix free definition of preconditioners. More...
class  Dune::Amg::MatrixHierarchy< M, PI, A >
 The hierarchies build by the coarsening process. More...
 
struct  Dune::Amg::MatrixHierarchy< M, PI, A >::MatrixStats< Matrix, true >::calc
 
class  Dune::Amg::CoarsenCriterion< T >
 The criterion describing the stop criteria for the coarsening process. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ + │ │ │ + │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ +

│ │ │ +Enumerations

enum  { Dune::Amg::MAX_PROCESSES = 72000 │ │ │ + }
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<typename M , typename C1 >
bool Dune::Amg::repartitionAndDistributeMatrix (const M &origMatrix, std::shared_ptr< M > newMatrix, SequentialInformation &origComm, std::shared_ptr< SequentialInformation > &newComm, RedistributeInformation< SequentialInformation > &ri, int nparts, C1 &criterion)
 
template<typename M , typename C , typename C1 >
bool Dune::Amg::repartitionAndDistributeMatrix (const M &origMatrix, std::shared_ptr< M > newMatrix, C &origComm, std::shared_ptr< C > &newComm, RedistributeInformation< C > &ri, int nparts, C1 &criterion)
 
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Provides a classes representing the hierarchies in AMG.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,21 +1,68 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -preconditioner.hh File Reference │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ + * _p_a_a_m_g │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _E_n_u_m_e_r_a_t_i_o_n_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +matrixhierarchy.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Provides a classes representing the hierarchies in AMG. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +#include "_g_r_a_p_h_._h_h" │ │ │ │ +#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ +#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ +#include "_g_r_a_p_h_c_r_e_a_t_o_r_._h_h" │ │ │ │ +#include "_h_i_e_r_a_r_c_h_y_._h_h" │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_d_e_p_e_n_d_e_n_c_y_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_ _> │ │ │ │ -  Base class for matrix free definition of preconditioners. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_ _M_,_ _P_I_,_ _A_ _> │ │ │ │ +  The hierarchies build by the coarsening process. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_ _M_,_ _P_I_,_ _A_ _>_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_: │ │ │ │ + _c_a_l_c │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_<_ _T_ _> │ │ │ │ +  The criterion describing the stop criteria for the coarsening process. │ │ │ │ + _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +  │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ +enum   { _D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S = 72000 } │ │ │ │ +  │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +bool  _D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (const M &origMatrix, std:: │ │ │ │ + shared_ptr< M > newMatrix, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n &origComm, std:: │ │ │ │ + shared_ptr< _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n > &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< │ │ │ │ + _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n > &ri, int nparts, C1 &criterion) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +bool  _D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (const M &origMatrix, std:: │ │ │ │ + shared_ptr< M > newMatrix, C &origComm, std::shared_ptr< C > &newComm, │ │ │ │ + _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< C > &ri, int nparts, C1 &criterion) │ │ │ │ +  │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: preconditioner.hh Source File │ │ │ +dune-istl: matrixhierarchy.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,78 +70,1009 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
preconditioner.hh
│ │ │ +
matrixhierarchy.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_PRECONDITIONER_HH
│ │ │ -
6#define DUNE_ISTL_PRECONDITIONER_HH
│ │ │ +
5#ifndef DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ +
6#define DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │
7
│ │ │ -
8#include <dune-istl-config.hh> // DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ -
9#include <dune/common/exceptions.hh>
│ │ │ -
10
│ │ │ -
11#include "solvercategory.hh"
│ │ │ -
12
│ │ │ -
13namespace Dune {
│ │ │ -
18 //=====================================================================
│ │ │ -
31 //=====================================================================
│ │ │ -
32 template<class X, class Y>
│ │ │ -
│ │ │ - │ │ │ -
34 public:
│ │ │ -
36 typedef X domain_type;
│ │ │ -
38 typedef Y range_type;
│ │ │ -
40 typedef typename X::field_type field_type;
│ │ │ -
41
│ │ │ -
70 virtual void pre (X& x, Y& b) = 0;
│ │ │ +
8#include <algorithm>
│ │ │ +
9#include <tuple>
│ │ │ +
10#include "aggregates.hh"
│ │ │ +
11#include "graph.hh"
│ │ │ +
12#include "galerkin.hh"
│ │ │ +
13#include "renumberer.hh"
│ │ │ +
14#include "graphcreator.hh"
│ │ │ +
15#include "hierarchy.hh"
│ │ │ +
16#include <dune/istl/bvector.hh>
│ │ │ +
17#include <dune/common/parallel/indexset.hh>
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
27
│ │ │ +
28namespace Dune
│ │ │ +
29{
│ │ │ +
30 namespace Amg
│ │ │ +
31 {
│ │ │ +
42 enum {
│ │ │ +
50 MAX_PROCESSES = 72000
│ │ │ +
51 };
│ │ │ +
52
│ │ │ +
59 template<class M, class PI, class A=std::allocator<M> >
│ │ │ +
│ │ │ + │ │ │ +
61 {
│ │ │ +
62 public:
│ │ │ +
64 typedef M MatrixOperator;
│ │ │ +
65
│ │ │ +
67 typedef typename MatrixOperator::matrix_type Matrix;
│ │ │ +
68
│ │ │ + │ │ │
71
│ │ │ -
82 virtual void apply (X& v, const Y& d) = 0;
│ │ │ +
73 typedef A Allocator;
│ │ │ +
74
│ │ │ + │ │ │ +
77
│ │ │ + │ │ │ +
80
│ │ │ + │ │ │
83
│ │ │ -
92 virtual void post (X& x) = 0;
│ │ │ -
93
│ │ │ - │ │ │ -
96#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE
│ │ │ -
97 {
│ │ │ -
98 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method in a derived classes, in the future this method will pure virtual.");
│ │ │ -
99 }
│ │ │ -
100#else
│ │ │ -
101 = 0;
│ │ │ -
102#endif
│ │ │ -
103
│ │ │ -
105 virtual ~Preconditioner () {}
│ │ │ +
85 using AAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<AggregatesMap*>;
│ │ │ +
86
│ │ │ +
88 typedef std::list<AggregatesMap*,AAllocator> AggregatesMapList;
│ │ │ +
89
│ │ │ + │ │ │ +
92
│ │ │ +
94 using RILAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<RedistributeInfoType>;
│ │ │ +
95
│ │ │ +
97 typedef std::list<RedistributeInfoType,RILAllocator> RedistributeInfoList;
│ │ │ +
98
│ │ │ +
104 MatrixHierarchy(std::shared_ptr<MatrixOperator> fineMatrix,
│ │ │ +
105 std::shared_ptr<ParallelInformation> pinfo = std::make_shared<ParallelInformation>());
│ │ │
106
│ │ │ -
107 };
│ │ │ -
│ │ │ + │ │ │
108
│ │ │ -
112}
│ │ │ -
113#endif
│ │ │ - │ │ │ +
114 template<typename O, typename T>
│ │ │ +
115 void build(const T& criterion);
│ │ │ +
116
│ │ │ +
124 template<class F>
│ │ │ +
125 void recalculateGalerkin(const F& copyFlags);
│ │ │ +
126
│ │ │ +
131 template<class V, class BA, class TA>
│ │ │ +
132 void coarsenVector(Hierarchy<BlockVector<V,BA>, TA>& hierarchy) const;
│ │ │ +
133
│ │ │ +
139 template<class S, class TA>
│ │ │ +
140 void coarsenSmoother(Hierarchy<S,TA>& smoothers,
│ │ │ +
141 const typename SmootherTraits<S>::Arguments& args) const;
│ │ │ +
142
│ │ │ +
147 std::size_t levels() const;
│ │ │ +
148
│ │ │ +
153 std::size_t maxlevels() const;
│ │ │ +
154
│ │ │ +
155 bool hasCoarsest() const;
│ │ │ +
156
│ │ │ +
161 bool isBuilt() const;
│ │ │ +
162
│ │ │ +
167 const ParallelMatrixHierarchy& matrices() const;
│ │ │ +
168
│ │ │ + │ │ │ +
174
│ │ │ +
179 const AggregatesMapList& aggregatesMaps() const;
│ │ │ +
180
│ │ │ + │ │ │ +
187
│ │ │ +
│ │ │ + │ │ │ +
189 {
│ │ │ +
190 return prolongDamp_;
│ │ │ +
191 }
│ │ │ +
│ │ │ +
192
│ │ │ +
203 void getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const;
│ │ │ +
204
│ │ │ +
205 private:
│ │ │ +
206 typedef typename ConstructionTraits<MatrixOperator>::Arguments MatrixArgs;
│ │ │ +
207 typedef typename ConstructionTraits<ParallelInformation>::Arguments CommunicationArgs;
│ │ │ +
209 AggregatesMapList aggregatesMaps_;
│ │ │ +
211 RedistributeInfoList redistributes_;
│ │ │ +
213 ParallelMatrixHierarchy matrices_;
│ │ │ +
215 ParallelInformationHierarchy parallelInformation_;
│ │ │ +
216
│ │ │ +
218 bool built_;
│ │ │ +
219
│ │ │ +
221 int maxlevels_;
│ │ │ +
222
│ │ │ +
223 double prolongDamp_;
│ │ │ +
224
│ │ │ +
228 template<class Matrix, bool print>
│ │ │ +
229 struct MatrixStats
│ │ │ +
230 {
│ │ │ +
231
│ │ │ +
235 static void stats([[maybe_unused]] const Matrix& matrix)
│ │ │ +
236 {}
│ │ │ +
237 };
│ │ │ +
238
│ │ │ +
239 template<class Matrix>
│ │ │ +
240 struct MatrixStats<Matrix,true>
│ │ │ +
241 {
│ │ │ +
│ │ │ +
242 struct calc
│ │ │ +
243 {
│ │ │ +
244 typedef typename Matrix::size_type size_type;
│ │ │ +
245 typedef typename Matrix::row_type matrix_row;
│ │ │ +
246
│ │ │ +
│ │ │ + │ │ │ +
248 {
│ │ │ +
249 min=std::numeric_limits<size_type>::max();
│ │ │ +
250 max=0;
│ │ │ +
251 sum=0;
│ │ │ +
252 }
│ │ │ +
│ │ │ +
253
│ │ │ +
│ │ │ +
254 void operator()(const matrix_row& row)
│ │ │ +
255 {
│ │ │ +
256 min=std::min(min, row.size());
│ │ │ +
257 max=std::max(max, row.size());
│ │ │ +
258 sum += row.size();
│ │ │ +
259 }
│ │ │ +
│ │ │ +
260
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
264 };
│ │ │ +
│ │ │ +
268 static void stats(const Matrix& matrix)
│ │ │ +
269 {
│ │ │ +
270 calc c= for_each(matrix.begin(), matrix.end(), calc());
│ │ │ +
271 dinfo<<"Matrix row: min="<<c.min<<" max="<<c.max
│ │ │ +
272 <<" average="<<static_cast<double>(c.sum)/matrix.N()
│ │ │ +
273 <<std::endl;
│ │ │ +
274 }
│ │ │ +
275 };
│ │ │ +
276 };
│ │ │ +
│ │ │ +
277
│ │ │ +
281 template<class T>
│ │ │ +
│ │ │ +
282 class CoarsenCriterion : public T
│ │ │ +
283 {
│ │ │ +
284 public:
│ │ │ + │ │ │ +
290
│ │ │ +
│ │ │ +
304 CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ +
305 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder = false)
│ │ │ +
306 : AggregationCriterion(Dune::Amg::Parameters(maxLevel, coarsenTarget, minCoarsenRate, prolongDamp, accumulate, useFixedOrder))
│ │ │ +
307 {}
│ │ │ +
│ │ │ +
308
│ │ │ +
│ │ │ + │ │ │ +
310 : AggregationCriterion(parms)
│ │ │ +
311 {}
│ │ │ +
│ │ │ +
312
│ │ │ +
313 };
│ │ │ +
│ │ │ +
314
│ │ │ +
315 template<typename M, typename C1>
│ │ │ +
│ │ │ +
316 bool repartitionAndDistributeMatrix([[maybe_unused]] const M& origMatrix,
│ │ │ +
317 [[maybe_unused]] std::shared_ptr<M> newMatrix,
│ │ │ +
318 [[maybe_unused]] SequentialInformation& origComm,
│ │ │ +
319 [[maybe_unused]] std::shared_ptr<SequentialInformation>& newComm,
│ │ │ + │ │ │ +
321 [[maybe_unused]] int nparts,
│ │ │ +
322 [[maybe_unused]] C1& criterion)
│ │ │ +
323 {
│ │ │ +
324 DUNE_THROW(NotImplemented, "Redistribution does not make sense in sequential code!");
│ │ │ +
325 }
│ │ │ +
│ │ │ +
326
│ │ │ +
327
│ │ │ +
328 template<typename M, typename C, typename C1>
│ │ │ +
│ │ │ +
329 bool repartitionAndDistributeMatrix(const M& origMatrix,
│ │ │ +
330 std::shared_ptr<M> newMatrix,
│ │ │ +
331 C& origComm,
│ │ │ +
332 std::shared_ptr<C>& newComm,
│ │ │ + │ │ │ +
334 int nparts, C1& criterion)
│ │ │ +
335 {
│ │ │ +
336 Timer time;
│ │ │ +
337#ifdef AMG_REPART_ON_COMM_GRAPH
│ │ │ +
338 // Done not repartition the matrix graph, but a graph of the communication scheme.
│ │ │ +
339 bool existentOnRedist=Dune::commGraphRepartition(origMatrix, origComm, nparts, newComm,
│ │ │ +
340 ri.getInterface(),
│ │ │ +
341 criterion.debugLevel()>1);
│ │ │ +
342
│ │ │ +
343#else
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
348 IdentityMap,
│ │ │ +
349 IdentityMap> PropertiesGraph;
│ │ │ +
350 MatrixGraph graph(origMatrix);
│ │ │ +
351 PropertiesGraph pgraph(graph);
│ │ │ +
352 buildDependency(pgraph, origMatrix, criterion, false);
│ │ │ +
353
│ │ │ +
354#ifdef DEBUG_REPART
│ │ │ +
355 if(origComm.communicator().rank()==0)
│ │ │ +
356 std::cout<<"Original matrix"<<std::endl;
│ │ │ +
357 origComm.communicator().barrier();
│ │ │ +
358 printGlobalSparseMatrix(origMatrix, origComm, std::cout);
│ │ │ +
359#endif
│ │ │ +
360 bool existentOnRedist=Dune::graphRepartition(pgraph, origComm, nparts,
│ │ │ +
361 newComm, ri.getInterface(),
│ │ │ +
362 criterion.debugLevel()>1);
│ │ │ +
363#endif // if else AMG_REPART
│ │ │ +
364
│ │ │ +
365 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ +
366 std::cout<<"Repartitioning took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ +
367
│ │ │ +
368 ri.setSetup();
│ │ │ +
369
│ │ │ +
370#ifdef DEBUG_REPART
│ │ │ +
371 ri.checkInterface(origComm.indexSet(), newComm->indexSet(), origComm.communicator());
│ │ │ +
372#endif
│ │ │ +
373
│ │ │ +
374 redistributeMatrix(const_cast<M&>(origMatrix), *newMatrix, origComm, *newComm, ri);
│ │ │ +
375
│ │ │ +
376#ifdef DEBUG_REPART
│ │ │ +
377 if(origComm.communicator().rank()==0)
│ │ │ +
378 std::cout<<"Original matrix"<<std::endl;
│ │ │ +
379 origComm.communicator().barrier();
│ │ │ +
380 if(newComm->communicator().size()>0)
│ │ │ +
381 printGlobalSparseMatrix(*newMatrix, *newComm, std::cout);
│ │ │ +
382 origComm.communicator().barrier();
│ │ │ +
383#endif
│ │ │ +
384
│ │ │ +
385 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ +
386 std::cout<<"Redistributing matrix took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ +
387 return existentOnRedist;
│ │ │ +
388
│ │ │ +
389 }
│ │ │ +
│ │ │ +
390
│ │ │ +
391 template<class M, class IS, class A>
│ │ │ +
│ │ │ +
392 MatrixHierarchy<M,IS,A>::MatrixHierarchy(std::shared_ptr<MatrixOperator> fineMatrix,
│ │ │ +
393 std::shared_ptr<ParallelInformation> pinfo)
│ │ │ +
394 : matrices_(fineMatrix),
│ │ │ +
395 parallelInformation_(pinfo)
│ │ │ +
396 {
│ │ │ +
397 if (SolverCategory::category(*fineMatrix) != SolverCategory::category(*pinfo))
│ │ │ +
398 DUNE_THROW(ISTLError, "MatrixOperator and ParallelInformation must belong to the same category!");
│ │ │ +
399 }
│ │ │ +
│ │ │ +
400
│ │ │ +
401 template<class M, class IS, class A>
│ │ │ +
402 template<typename O, typename T>
│ │ │ +
│ │ │ +
403 void MatrixHierarchy<M,IS,A>::build(const T& criterion)
│ │ │ +
404 {
│ │ │ +
405 prolongDamp_ = criterion.getProlongationDampingFactor();
│ │ │ +
406 typedef O OverlapFlags;
│ │ │ +
407 typedef typename ParallelMatrixHierarchy::Iterator MatIterator;
│ │ │ +
408 typedef typename ParallelInformationHierarchy::Iterator PInfoIterator;
│ │ │ +
409
│ │ │ +
410 static const int noints=(Dune::Amg::MAX_PROCESSES/4096>0) ? (Dune::Amg::MAX_PROCESSES/4096) : 1;
│ │ │ +
411
│ │ │ +
412 typedef bigunsignedint<sizeof(int)*8*noints> BIGINT;
│ │ │ + │ │ │ +
414 MatIterator mlevel = matrices_.finest();
│ │ │ +
415 MatrixStats<typename M::matrix_type,MINIMAL_DEBUG_LEVEL<=INFO_DEBUG_LEVEL>::stats(mlevel->getmat());
│ │ │ +
416
│ │ │ +
417 PInfoIterator infoLevel = parallelInformation_.finest();
│ │ │ +
418 BIGINT finenonzeros=countNonZeros(mlevel->getmat());
│ │ │ +
419 finenonzeros = infoLevel->communicator().sum(finenonzeros);
│ │ │ +
420 BIGINT allnonzeros = finenonzeros;
│ │ │ +
421
│ │ │ +
422
│ │ │ +
423 int level = 0;
│ │ │ +
424 int rank = 0;
│ │ │ +
425
│ │ │ +
426 BIGINT unknowns = mlevel->getmat().N();
│ │ │ +
427
│ │ │ +
428 unknowns = infoLevel->communicator().sum(unknowns);
│ │ │ +
429 double dunknowns=unknowns.todouble();
│ │ │ +
430 infoLevel->buildGlobalLookup(mlevel->getmat().N());
│ │ │ +
431 redistributes_.push_back(RedistributeInfoType());
│ │ │ +
432
│ │ │ +
433 for(; level < criterion.maxLevel(); ++level, ++mlevel) {
│ │ │ +
434 assert(matrices_.levels()==redistributes_.size());
│ │ │ +
435 rank = infoLevel->communicator().rank();
│ │ │ +
436 if(rank==0 && criterion.debugLevel()>1)
│ │ │ +
437 std::cout<<"Level "<<level<<" has "<<dunknowns<<" unknowns, "<<dunknowns/infoLevel->communicator().size()
│ │ │ +
438 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ +
439
│ │ │ +
440 MatrixOperator* matrix=&(*mlevel);
│ │ │ +
441 ParallelInformation* info =&(*infoLevel);
│ │ │ +
442
│ │ │ +
443 if((
│ │ │ +
444#if HAVE_PARMETIS
│ │ │ +
445 criterion.accumulate()==successiveAccu
│ │ │ +
446#else
│ │ │ +
447 false
│ │ │ +
448#endif
│ │ │ +
449 || (criterion.accumulate()==atOnceAccu
│ │ │ +
450 && dunknowns < 30*infoLevel->communicator().size()))
│ │ │ +
451 && infoLevel->communicator().size()>1 &&
│ │ │ +
452 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget())
│ │ │ +
453 {
│ │ │ +
454 // accumulate to fewer processors
│ │ │ +
455 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ +
456 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ +
457 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/(criterion.minAggregateSize()
│ │ │ +
458 *criterion.coarsenTarget()));
│ │ │ +
459 if( nodomains<=criterion.minAggregateSize()/2 ||
│ │ │ +
460 dunknowns <= criterion.coarsenTarget() )
│ │ │ +
461 nodomains=1;
│ │ │ +
462
│ │ │ +
463 bool existentOnNextLevel =
│ │ │ +
464 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ +
465 redistComm, redistributes_.back(), nodomains,
│ │ │ +
466 criterion);
│ │ │ +
467 BIGINT unknownsRedist = redistMat->N();
│ │ │ +
468 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ +
469 dunknowns= unknownsRedist.todouble();
│ │ │ +
470 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ +
471 std::cout<<"Level "<<level<<" (redistributed) has "<<dunknowns<<" unknowns, "<<dunknowns/redistComm->communicator().size()
│ │ │ +
472 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ +
473 MatrixArgs args(redistMat, *redistComm);
│ │ │ +
474 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ +
475 assert(mlevel.isRedistributed());
│ │ │ +
476 infoLevel.addRedistributed(redistComm);
│ │ │ +
477 infoLevel->freeGlobalLookup();
│ │ │ +
478
│ │ │ +
479 if(!existentOnNextLevel)
│ │ │ +
480 // We do not hold any data on the redistributed partitioning
│ │ │ +
481 break;
│ │ │ +
482
│ │ │ +
483 // Work on the redistributed Matrix from now on
│ │ │ +
484 matrix = &(mlevel.getRedistributed());
│ │ │ +
485 info = &(infoLevel.getRedistributed());
│ │ │ +
486 info->buildGlobalLookup(matrix->getmat().N());
│ │ │ +
487 }
│ │ │ +
488
│ │ │ +
489 rank = info->communicator().rank();
│ │ │ +
490 if(dunknowns <= criterion.coarsenTarget())
│ │ │ +
491 // No further coarsening needed
│ │ │ +
492 break;
│ │ │ +
493
│ │ │ + │ │ │ +
495 typedef typename GraphCreator::PropertiesGraph PropertiesGraph;
│ │ │ +
496 typedef typename GraphCreator::GraphTuple GraphTuple;
│ │ │ +
497
│ │ │ +
498 typedef typename PropertiesGraph::VertexDescriptor Vertex;
│ │ │ +
499
│ │ │ +
500 std::vector<bool> excluded(matrix->getmat().N(), false);
│ │ │ +
501
│ │ │ +
502 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, OverlapFlags());
│ │ │ +
503
│ │ │ +
504 AggregatesMap* aggregatesMap=new AggregatesMap(std::get<1>(graphs)->maxVertex()+1);
│ │ │ +
505
│ │ │ +
506 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ +
507
│ │ │ +
508 Timer watch;
│ │ │ +
509 watch.reset();
│ │ │ +
510 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] =
│ │ │ +
511 aggregatesMap->buildAggregates(matrix->getmat(), *(std::get<1>(graphs)), criterion, level==0);
│ │ │ +
512
│ │ │ +
513 if(rank==0 && criterion.debugLevel()>2)
│ │ │ +
514 std::cout<<" Have built "<<noAggregates<<" aggregates totally ("<<isoAggregates<<" isolated aggregates, "<<
│ │ │ +
515 oneAggregates<<" aggregates of one vertex, and skipped "<<
│ │ │ +
516 skippedAggregates<<" aggregates)."<<std::endl;
│ │ │ +
517#ifdef TEST_AGGLO
│ │ │ +
518 {
│ │ │ +
519 // calculate size of local matrix in the distributed direction
│ │ │ +
520 int start, end, overlapStart, overlapEnd;
│ │ │ +
521 int procs=info->communicator().rank();
│ │ │ +
522 int n = UNKNOWNS/procs; // number of unknowns per process
│ │ │ +
523 int bigger = UNKNOWNS%procs; // number of process with n+1 unknowns
│ │ │ +
524
│ │ │ +
525 // Compute owner region
│ │ │ +
526 if(rank<bigger) {
│ │ │ +
527 start = rank*(n+1);
│ │ │ +
528 end = (rank+1)*(n+1);
│ │ │ +
529 }else{
│ │ │ +
530 start = bigger + rank * n;
│ │ │ +
531 end = bigger + (rank + 1) * n;
│ │ │ +
532 }
│ │ │ +
533
│ │ │ +
534 // Compute overlap region
│ │ │ +
535 if(start>0)
│ │ │ +
536 overlapStart = start - 1;
│ │ │ +
537 else
│ │ │ +
538 overlapStart = start;
│ │ │ +
539
│ │ │ +
540 if(end<UNKNOWNS)
│ │ │ +
541 overlapEnd = end + 1;
│ │ │ +
542 else
│ │ │ +
543 overlapEnd = end;
│ │ │ +
544
│ │ │ +
545 assert((UNKNOWNS)*(overlapEnd-overlapStart)==aggregatesMap->noVertices());
│ │ │ +
546 for(int j=0; j< UNKNOWNS; ++j)
│ │ │ +
547 for(int i=0; i < UNKNOWNS; ++i)
│ │ │ +
548 {
│ │ │ +
549 if(i>=overlapStart && i<overlapEnd)
│ │ │ +
550 {
│ │ │ +
551 int no = (j/2)*((UNKNOWNS)/2)+i/2;
│ │ │ +
552 (*aggregatesMap)[j*(overlapEnd-overlapStart)+i-overlapStart]=no;
│ │ │ +
553 }
│ │ │ +
554 }
│ │ │ +
555 }
│ │ │ +
556#endif
│ │ │ +
557 if(criterion.debugLevel()>1 && info->communicator().rank()==0)
│ │ │ +
558 std::cout<<"aggregating finished."<<std::endl;
│ │ │ +
559
│ │ │ +
560 BIGINT gnoAggregates=noAggregates;
│ │ │ +
561 gnoAggregates = info->communicator().sum(gnoAggregates);
│ │ │ +
562 double dgnoAggregates = gnoAggregates.todouble();
│ │ │ +
563#ifdef TEST_AGGLO
│ │ │ +
564 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2);
│ │ │ +
565#endif
│ │ │ +
566
│ │ │ +
567 if(criterion.debugLevel()>2 && rank==0)
│ │ │ +
568 std::cout << "Building "<<dgnoAggregates<<" aggregates took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
569
│ │ │ +
570 if(dgnoAggregates==0 || dunknowns/dgnoAggregates<criterion.minCoarsenRate())
│ │ │ +
571 {
│ │ │ +
572 if(rank==0)
│ │ │ +
573 {
│ │ │ +
574 if(dgnoAggregates>0)
│ │ │ +
575 std::cerr << "Stopped coarsening because of rate breakdown "<<dunknowns<<"/"<<dgnoAggregates
│ │ │ +
576 <<"="<<dunknowns/dgnoAggregates<<"<"
│ │ │ +
577 <<criterion.minCoarsenRate()<<std::endl;
│ │ │ +
578 else
│ │ │ +
579 std::cerr<< "Could not build any aggregates. Probably no connected nodes."<<std::endl;
│ │ │ +
580 }
│ │ │ +
581 aggregatesMap->free();
│ │ │ +
582 delete aggregatesMap;
│ │ │ +
583 aggregatesMaps_.pop_back();
│ │ │ +
584
│ │ │ +
585 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator().size()>1) {
│ │ │ +
586 // coarse level matrix was already redistributed, but to more than 1 process
│ │ │ +
587 // Therefore need to delete the redistribution. Further down it will
│ │ │ +
588 // then be redistributed to 1 process
│ │ │ +
589 delete &(mlevel.getRedistributed().getmat());
│ │ │ +
590 mlevel.deleteRedistributed();
│ │ │ +
591 delete &(infoLevel.getRedistributed());
│ │ │ +
592 infoLevel.deleteRedistributed();
│ │ │ +
593 redistributes_.back().resetSetup();
│ │ │ +
594 }
│ │ │ +
595
│ │ │ +
596 break;
│ │ │ +
597 }
│ │ │ +
598 unknowns = noAggregates;
│ │ │ +
599 dunknowns = dgnoAggregates;
│ │ │ +
600
│ │ │ +
601 CommunicationArgs commargs(info->communicator(),info->category());
│ │ │ +
602 parallelInformation_.addCoarser(commargs);
│ │ │ +
603
│ │ │ +
604 ++infoLevel; // parallel information on coarse level
│ │ │ +
605
│ │ │ +
606 typename PropertyMapTypeSelector<VertexVisitedTag,PropertiesGraph>::Type visitedMap =
│ │ │ +
607 get(VertexVisitedTag(), *(std::get<1>(graphs)));
│ │ │ +
608
│ │ │ +
609 watch.reset();
│ │ │ + │ │ │ +
611 ::coarsen(*info,
│ │ │ +
612 *(std::get<1>(graphs)),
│ │ │ +
613 visitedMap,
│ │ │ +
614 *aggregatesMap,
│ │ │ +
615 *infoLevel,
│ │ │ +
616 noAggregates,
│ │ │ +
617 criterion.useFixedOrder());
│ │ │ +
618 GraphCreator::free(graphs);
│ │ │ +
619
│ │ │ +
620 if(criterion.debugLevel()>2) {
│ │ │ +
621 if(rank==0)
│ │ │ +
622 std::cout<<"Coarsening of index sets took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
623 }
│ │ │ +
624
│ │ │ +
625 watch.reset();
│ │ │ +
626
│ │ │ +
627 infoLevel->buildGlobalLookup(aggregates);
│ │ │ + │ │ │ +
629 *info,
│ │ │ +
630 infoLevel->globalLookup());
│ │ │ +
631
│ │ │ +
632
│ │ │ +
633 if(criterion.debugLevel()>2) {
│ │ │ +
634 if(rank==0)
│ │ │ +
635 std::cout<<"Communicating global aggregate numbers took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
636 }
│ │ │ +
637
│ │ │ +
638 watch.reset();
│ │ │ +
639 std::vector<bool>& visited=excluded;
│ │ │ +
640
│ │ │ +
641 typedef std::vector<bool>::iterator Iterator;
│ │ │ +
642 typedef IteratorPropertyMap<Iterator, IdentityMap> VisitedMap2;
│ │ │ +
643 Iterator end = visited.end();
│ │ │ +
644 for(Iterator iter= visited.begin(); iter != end; ++iter)
│ │ │ +
645 *iter=false;
│ │ │ +
646
│ │ │ +
647 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap());
│ │ │ +
648
│ │ │ +
649 std::shared_ptr<typename MatrixOperator::matrix_type>
│ │ │ +
650 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2,
│ │ │ +
651 *info,
│ │ │ +
652 *aggregatesMap,
│ │ │ +
653 aggregates,
│ │ │ +
654 OverlapFlags()));
│ │ │ +
655 dverb<<"Building of sparsity pattern took "<<watch.elapsed()<<std::endl;
│ │ │ +
656 watch.reset();
│ │ │ +
657 info->freeGlobalLookup();
│ │ │ +
658
│ │ │ +
659 delete std::get<0>(graphs);
│ │ │ +
660 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, *infoLevel, OverlapFlags());
│ │ │ +
661
│ │ │ +
662 if(criterion.debugLevel()>2) {
│ │ │ +
663 if(rank==0)
│ │ │ +
664 std::cout<<"Calculation entries of Galerkin product took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
665 }
│ │ │ +
666
│ │ │ +
667 BIGINT nonzeros = countNonZeros(*coarseMatrix);
│ │ │ +
668 allnonzeros = allnonzeros + infoLevel->communicator().sum(nonzeros);
│ │ │ +
669 MatrixArgs args(coarseMatrix, *infoLevel);
│ │ │ +
670
│ │ │ +
671 matrices_.addCoarser(args);
│ │ │ +
672 redistributes_.push_back(RedistributeInfoType());
│ │ │ +
673 } // end level loop
│ │ │ +
674
│ │ │ +
675
│ │ │ +
676 infoLevel->freeGlobalLookup();
│ │ │ +
677
│ │ │ +
678 built_=true;
│ │ │ +
679 AggregatesMap* aggregatesMap=new AggregatesMap(0);
│ │ │ +
680 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ +
681
│ │ │ +
682 if(criterion.debugLevel()>0) {
│ │ │ +
683 if(level==criterion.maxLevel()) {
│ │ │ +
684 BIGINT unknownsLevel = mlevel->getmat().N();
│ │ │ +
685 unknownsLevel = infoLevel->communicator().sum(unknownsLevel);
│ │ │ +
686 if(rank==0 && criterion.debugLevel()>1) {
│ │ │ +
687 double dunknownsLevel = unknownsLevel.todouble();
│ │ │ +
688 std::cout<<"Level "<<level<<" has "<<dunknownsLevel<<" unknowns, "<<dunknownsLevel/infoLevel->communicator().size()
│ │ │ +
689 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ +
690 }
│ │ │ +
691 }
│ │ │ +
692 }
│ │ │ +
693
│ │ │ +
694 if(criterion.accumulate() && !redistributes_.back().isSetup() &&
│ │ │ +
695 infoLevel->communicator().size()>1) {
│ │ │ +
696#if HAVE_MPI && !HAVE_PARMETIS
│ │ │ +
697 if(criterion.accumulate()==successiveAccu &&
│ │ │ +
698 infoLevel->communicator().rank()==0)
│ │ │ +
699 std::cerr<<"Successive accumulation of data on coarse levels only works with ParMETIS installed."
│ │ │ +
700 <<" Fell back to accumulation to one domain on coarsest level"<<std::endl;
│ │ │ +
701#endif
│ │ │ +
702
│ │ │ +
703 // accumulate to fewer processors
│ │ │ +
704 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ +
705 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ +
706 int nodomains = 1;
│ │ │ +
707
│ │ │ +
708 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ +
709 redistComm, redistributes_.back(), nodomains,criterion);
│ │ │ +
710 MatrixArgs args(redistMat, *redistComm);
│ │ │ +
711 BIGINT unknownsRedist = redistMat->N();
│ │ │ +
712 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ +
713
│ │ │ +
714 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) {
│ │ │ +
715 double dunknownsRedist = unknownsRedist.todouble();
│ │ │ +
716 std::cout<<"Level "<<level<<" redistributed has "<<dunknownsRedist<<" unknowns, "<<dunknownsRedist/redistComm->communicator().size()
│ │ │ +
717 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ +
718 }
│ │ │ +
719 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ +
720 infoLevel.addRedistributed(redistComm);
│ │ │ +
721 infoLevel->freeGlobalLookup();
│ │ │ +
722 }
│ │ │ +
723
│ │ │ +
724 int levels = matrices_.levels();
│ │ │ +
725 maxlevels_ = parallelInformation_.finest()->communicator().max(levels);
│ │ │ +
726 assert(matrices_.levels()==redistributes_.size());
│ │ │ +
727 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1)
│ │ │ +
728 std::cout<<"operator complexity: "<<allnonzeros.todouble()/finenonzeros.todouble()<<std::endl;
│ │ │ +
729
│ │ │ +
730 }
│ │ │ +
│ │ │ +
731
│ │ │ +
732 template<class M, class IS, class A>
│ │ │ + │ │ │ +
│ │ │ + │ │ │ +
735 {
│ │ │ +
736 return matrices_;
│ │ │ +
737 }
│ │ │ +
│ │ │ +
738
│ │ │ +
739 template<class M, class IS, class A>
│ │ │ + │ │ │ +
│ │ │ + │ │ │ +
742 {
│ │ │ +
743 return parallelInformation_;
│ │ │ +
744 }
│ │ │ +
│ │ │ +
745
│ │ │ +
746 template<class M, class IS, class A>
│ │ │ +
│ │ │ +
747 void MatrixHierarchy<M,IS,A>::getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const
│ │ │ +
748 {
│ │ │ +
749 int levels=aggregatesMaps().size();
│ │ │ +
750 int maxlevels=parallelInformation_.finest()->communicator().max(levels);
│ │ │ +
751 std::size_t size=(*(aggregatesMaps().begin()))->noVertices();
│ │ │ +
752 // We need an auxiliary vector for the consecutive prolongation.
│ │ │ +
753 std::vector<std::size_t> tmp;
│ │ │ +
754 std::vector<std::size_t> *coarse, *fine;
│ │ │ +
755
│ │ │ +
756 // make sure the allocated space suffices.
│ │ │ +
757 tmp.reserve(size);
│ │ │ +
758 data.reserve(size);
│ │ │ +
759
│ │ │ +
760 // Correctly assign coarse and fine for the first prolongation such that
│ │ │ +
761 // we end up in data in the end.
│ │ │ +
762 if(levels%2==0) {
│ │ │ +
763 coarse=&tmp;
│ │ │ +
764 fine=&data;
│ │ │ +
765 }else{
│ │ │ +
766 coarse=&data;
│ │ │ +
767 fine=&tmp;
│ │ │ +
768 }
│ │ │ +
769
│ │ │ +
770 // Number the unknowns on the coarsest level consecutively for each process.
│ │ │ +
771 if(levels==maxlevels) {
│ │ │ +
772 const AggregatesMap& map = *(*(++aggregatesMaps().rbegin()));
│ │ │ +
773 std::size_t m=0;
│ │ │ +
774
│ │ │ +
775 for(typename AggregatesMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
│ │ │ +
776 if(*iter< AggregatesMap::ISOLATED)
│ │ │ +
777 m=std::max(*iter,m);
│ │ │ +
778
│ │ │ +
779 coarse->resize(m+1);
│ │ │ +
780 std::size_t i=0;
│ │ │ +
781 srand((unsigned)std::clock());
│ │ │ +
782 std::set<size_t> used;
│ │ │ +
783 for(typename std::vector<std::size_t>::iterator iter=coarse->begin(); iter != coarse->end();
│ │ │ +
784 ++iter, ++i)
│ │ │ +
785 {
│ │ │ +
786 std::pair<std::set<std::size_t>::iterator,bool> ibpair
│ │ │ +
787 = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0)))*coarse->size());
│ │ │ +
788
│ │ │ +
789 while(!ibpair.second)
│ │ │ +
790 ibpair = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0))*coarse->size()));
│ │ │ +
791 *iter=*(ibpair.first);
│ │ │ +
792 }
│ │ │ +
793 }
│ │ │ +
794
│ │ │ +
795 typename ParallelInformationHierarchy::Iterator pinfo = parallelInformation().coarsest();
│ │ │ +
796 --pinfo;
│ │ │ +
797
│ │ │ +
798 // Now consecutively project the numbers to the finest level.
│ │ │ +
799 for(typename AggregatesMapList::const_reverse_iterator aggregates=++aggregatesMaps().rbegin();
│ │ │ +
800 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) {
│ │ │ +
801
│ │ │ +
802 fine->resize((*aggregates)->noVertices());
│ │ │ +
803 fine->assign(fine->size(), 0);
│ │ │ + │ │ │ +
805 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast<std::size_t>(1), *pinfo);
│ │ │ +
806 --pinfo;
│ │ │ +
807 std::swap(coarse, fine);
│ │ │ +
808 }
│ │ │ +
809
│ │ │ +
810 // Assertion to check that we really projected to data on the last step.
│ │ │ +
811 assert(coarse==&data);
│ │ │ +
812 }
│ │ │ +
│ │ │ +
813
│ │ │ +
814 template<class M, class IS, class A>
│ │ │ + │ │ │ +
│ │ │ + │ │ │ +
817 {
│ │ │ +
818 return aggregatesMaps_;
│ │ │ +
819 }
│ │ │ +
│ │ │ +
820 template<class M, class IS, class A>
│ │ │ + │ │ │ +
│ │ │ + │ │ │ +
823 {
│ │ │ +
824 return redistributes_;
│ │ │ +
825 }
│ │ │ +
│ │ │ +
826
│ │ │ +
827 template<class M, class IS, class A>
│ │ │ +
│ │ │ + │ │ │ +
829 {
│ │ │ +
830 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator;
│ │ │ +
831 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ +
832 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ +
833
│ │ │ +
834 AggregatesMapIterator amap = aggregatesMaps_.rbegin();
│ │ │ +
835 InfoIterator info = parallelInformation_.coarsest();
│ │ │ +
836 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level != finest; --level, --info, ++amap) {
│ │ │ +
837 (*amap)->free();
│ │ │ +
838 delete *amap;
│ │ │ +
839 }
│ │ │ +
840 delete *amap;
│ │ │ +
841 }
│ │ │ +
│ │ │ +
842
│ │ │ +
843 template<class M, class IS, class A>
│ │ │ +
844 template<class V, class BA, class TA>
│ │ │ +
│ │ │ + │ │ │ +
846 {
│ │ │ +
847 assert(hierarchy.levels()==1);
│ │ │ +
848 typedef typename ParallelMatrixHierarchy::ConstIterator Iterator;
│ │ │ +
849 typedef typename RedistributeInfoList::const_iterator RIter;
│ │ │ +
850 RIter redist = redistributes_.begin();
│ │ │ +
851
│ │ │ +
852 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ +
853 int level=0;
│ │ │ +
854 if(redist->isSetup())
│ │ │ +
855 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ +
856 Dune::dvverb<<"Level "<<level<<" has "<<matrices_.finest()->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ +
857
│ │ │ +
858 while(matrix != coarsest) {
│ │ │ +
859 ++matrix; ++level; ++redist;
│ │ │ +
860 Dune::dvverb<<"Level "<<level<<" has "<<matrix->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ +
861
│ │ │ +
862 hierarchy.addCoarser(matrix->getmat().N());
│ │ │ +
863 if(redist->isSetup())
│ │ │ +
864 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ +
865
│ │ │ +
866 }
│ │ │ +
867
│ │ │ +
868 }
│ │ │ +
│ │ │ +
869
│ │ │ +
870 template<class M, class IS, class A>
│ │ │ +
871 template<class S, class TA>
│ │ │ +
│ │ │ + │ │ │ +
873 const typename SmootherTraits<S>::Arguments& sargs) const
│ │ │ +
874 {
│ │ │ +
875 assert(smoothers.levels()==0);
│ │ │ +
876 typedef typename ParallelMatrixHierarchy::ConstIterator MatrixIterator;
│ │ │ +
877 typedef typename ParallelInformationHierarchy::ConstIterator PinfoIterator;
│ │ │ +
878 typedef typename AggregatesMapList::const_iterator AggregatesIterator;
│ │ │ +
879
│ │ │ + │ │ │ +
881 cargs.setArgs(sargs);
│ │ │ +
882 PinfoIterator pinfo = parallelInformation_.finest();
│ │ │ +
883 AggregatesIterator aggregates = aggregatesMaps_.begin();
│ │ │ +
884 int level=0;
│ │ │ +
885 for(MatrixIterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ +
886 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) {
│ │ │ +
887 cargs.setMatrix(matrix->getmat(), **aggregates);
│ │ │ +
888 cargs.setComm(*pinfo);
│ │ │ +
889 smoothers.addCoarser(cargs);
│ │ │ +
890 }
│ │ │ +
891 if(maxlevels()>levels()) {
│ │ │ +
892 // This is not the globally coarsest level and therefore smoothing is needed
│ │ │ +
893 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates);
│ │ │ +
894 cargs.setComm(*pinfo);
│ │ │ +
895 smoothers.addCoarser(cargs);
│ │ │ +
896 ++level;
│ │ │ +
897 }
│ │ │ +
898 }
│ │ │ +
│ │ │ +
899
│ │ │ +
900 template<class M, class IS, class A>
│ │ │ +
901 template<class F>
│ │ │ +
│ │ │ + │ │ │ +
903 {
│ │ │ +
904 typedef typename AggregatesMapList::iterator AggregatesMapIterator;
│ │ │ +
905 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ +
906 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ +
907
│ │ │ +
908 AggregatesMapIterator amap = aggregatesMaps_.begin();
│ │ │ +
909 BaseGalerkinProduct productBuilder;
│ │ │ +
910 InfoIterator info = parallelInformation_.finest();
│ │ │ +
911 typename RedistributeInfoList::iterator riIter = redistributes_.begin();
│ │ │ +
912 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest();
│ │ │ +
913 if(level.isRedistributed()) {
│ │ │ +
914 info->buildGlobalLookup(level->getmat().N());
│ │ │ +
915 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ +
916 const_cast<Matrix&>(level.getRedistributed().getmat()),
│ │ │ +
917 *info,info.getRedistributed(), *riIter);
│ │ │ +
918 info->freeGlobalLookup();
│ │ │ +
919 }
│ │ │ +
920
│ │ │ +
921 for(; level!=coarsest; ++amap) {
│ │ │ +
922 const Matrix& fine = (level.isRedistributed() ? level.getRedistributed() : *level).getmat();
│ │ │ +
923 ++level;
│ │ │ +
924 ++info;
│ │ │ +
925 ++riIter;
│ │ │ +
926 productBuilder.calculate(fine, *(*amap), const_cast<Matrix&>(level->getmat()), *info, copyFlags);
│ │ │ +
927 if(level.isRedistributed()) {
│ │ │ +
928 info->buildGlobalLookup(level->getmat().N());
│ │ │ +
929 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ +
930 const_cast<Matrix&>(level.getRedistributed().getmat()), *info,
│ │ │ +
931 info.getRedistributed(), *riIter);
│ │ │ +
932 info->freeGlobalLookup();
│ │ │ +
933 }
│ │ │ +
934 }
│ │ │ +
935 }
│ │ │ +
│ │ │ +
936
│ │ │ +
937 template<class M, class IS, class A>
│ │ │ +
│ │ │ + │ │ │ +
939 {
│ │ │ +
940 return matrices_.levels();
│ │ │ +
941 }
│ │ │ +
│ │ │ +
942
│ │ │ +
943 template<class M, class IS, class A>
│ │ │ +
│ │ │ + │ │ │ +
945 {
│ │ │ +
946 return maxlevels_;
│ │ │ +
947 }
│ │ │ +
│ │ │ +
948
│ │ │ +
949 template<class M, class IS, class A>
│ │ │ +
│ │ │ + │ │ │ +
951 {
│ │ │ +
952 return levels()==maxlevels() &&
│ │ │ +
953 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N()>0);
│ │ │ +
954 }
│ │ │ +
│ │ │ +
955
│ │ │ +
956 template<class M, class IS, class A>
│ │ │ +
│ │ │ + │ │ │ +
958 {
│ │ │ +
959 return built_;
│ │ │ +
960 }
│ │ │ +
│ │ │ +
961
│ │ │ +
963 } // namespace Amg
│ │ │ +
964} // namespace Dune
│ │ │ +
965
│ │ │ +
966#endif // end DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ + │ │ │ +
Prolongation and restriction for amg.
│ │ │ +
Helper classes for the construction of classes without empty constructor.
│ │ │ +
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ +
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │ + │ │ │ +
Provides classes for building the matrix graph.
│ │ │ +
Provides a class for building the index set and remote indices on the coarse level.
│ │ │ +
Provdes class for identifying aggregates globally.
│ │ │ +
Classes for the generic construction and application of the smoothers.
│ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ +
Some handy generic functions for ISTL matrices.
│ │ │ +
Functionality for redistributing a sparse matrix.
│ │ │ +
auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr)
Get the number of nonzero fields in the matrix.
Definition matrixutils.hh:119
│ │ │ +
const AggregatesMapList & aggregatesMaps() const
Get the hierarchy of the mappings of the nodes onto aggregates.
Definition matrixhierarchy.hh:816
│ │ │ +
bool isBuilt() const
Whether the hierarchy was built.
Definition matrixhierarchy.hh:957
│ │ │ +
bool hasCoarsest() const
Definition matrixhierarchy.hh:950
│ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition matrixhierarchy.hh:938
│ │ │ +
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ +
const RedistributeInfoList & redistributeInformation() const
Get the hierarchy of the information about redistributions,.
Definition matrixhierarchy.hh:822
│ │ │ +
const ParallelInformationHierarchy & parallelInformation() const
Get the hierarchy of the parallel data distribution information.
Definition matrixhierarchy.hh:741
│ │ │ +
bool repartitionAndDistributeMatrix(const M &origMatrix, std::shared_ptr< M > newMatrix, SequentialInformation &origComm, std::shared_ptr< SequentialInformation > &newComm, RedistributeInformation< SequentialInformation > &ri, int nparts, C1 &criterion)
Definition matrixhierarchy.hh:316
│ │ │ +
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ +
const ParallelMatrixHierarchy & matrices() const
Get the matrix hierarchy.
Definition matrixhierarchy.hh:734
│ │ │ +
std::size_t maxlevels() const
Get the max number of levels in the hierarchy of processors.
Definition matrixhierarchy.hh:944
│ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ +
void recalculateGalerkin(const F &copyFlags)
Recalculate the galerkin products.
Definition matrixhierarchy.hh:902
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ +
std::size_t noVertices() const
Get the number of vertices.
│ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const
Coarsen the vector hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:845
│ │ │ +
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ +
MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< ParallelInformation > pinfo=std::make_shared< ParallelInformation >())
Constructor.
Definition matrixhierarchy.hh:392
│ │ │ +
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:231
│ │ │ +
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ +
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition matrixhierarchy.hh:403
│ │ │ +
void free()
Free the allocated memory.
│ │ │ +
void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename SmootherTraits< S >::Arguments &args) const
Coarsen the smoother hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:872
│ │ │ +
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ +
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ +
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ +
void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const
Get the mapping of fine level unknowns to coarse level aggregates.
Definition matrixhierarchy.hh:747
│ │ │ +
~MatrixHierarchy()
Definition matrixhierarchy.hh:828
│ │ │ +
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition matrixhierarchy.hh:50
│ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │
Definition allocator.hh:11
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
virtual void post(X &x)=0
Clean up.
│ │ │ -
virtual void apply(X &v, const Y &d)=0
Apply one step of the preconditioner to the system A(v)=d.
│ │ │ -
virtual ~Preconditioner()
every abstract base class has a virtual destructor
Definition preconditioner.hh:105
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioner.hh:38
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioner.hh:36
│ │ │ -
virtual SolverCategory::Category category() const =0
Category of the preconditioner (see SolverCategory::Category)
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioner.hh:40
│ │ │ -
virtual void pre(X &x, Y &b)=0
Prepare the preconditioner.
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ +
void printGlobalSparseMatrix(const M &mat, C &ooc, std::ostream &os)
Definition matrixutils.hh:154
│ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ +
void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition matrixredistribute.hh:757
│ │ │ +
bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
Definition repartition.hh:822
│ │ │ +
void redistributeMatrix(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Redistribute a matrix according to given domain decompositions.
Definition matrixredistribute.hh:820
│ │ │ +
bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
execute a graph repartition for a giving graph and indexset.
Definition repartition.hh:1228
│ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ +
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ +
Definition matrixredistribute.hh:22
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ +
Definition galerkin.hh:99
│ │ │ +
Definition galerkin.hh:118
│ │ │ +
Definition globalaggregates.hh:131
│ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ +
Definition graphcreator.hh:22
│ │ │ +
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ +
LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ +
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ +
Definition indicescoarsener.hh:36
│ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ +
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Allocator for pointers.
Definition matrixhierarchy.hh:85
│ │ │ +
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
The type of the parallel informarion hierarchy.
Definition matrixhierarchy.hh:82
│ │ │ +
std::list< AggregatesMap *, AAllocator > AggregatesMapList
The type of the aggregates maps list.
Definition matrixhierarchy.hh:88
│ │ │ +
PI ParallelInformation
The type of the index set.
Definition matrixhierarchy.hh:70
│ │ │ +
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
The type of the parallel matrix hierarchy.
Definition matrixhierarchy.hh:79
│ │ │ +
A Allocator
The allocator to use.
Definition matrixhierarchy.hh:73
│ │ │ +
RedistributeInformation< ParallelInformation > RedistributeInfoType
The type of the redistribute information.
Definition matrixhierarchy.hh:91
│ │ │ +
double getProlongationDampingFactor() const
Definition matrixhierarchy.hh:188
│ │ │ +
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Allocator for RedistributeInfoType.
Definition matrixhierarchy.hh:94
│ │ │ +
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
The type of the list of redistribute information.
Definition matrixhierarchy.hh:97
│ │ │ +
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
The type of the aggregates map we use.
Definition matrixhierarchy.hh:76
│ │ │ +
MatrixOperator::matrix_type Matrix
The type of the matrix.
Definition matrixhierarchy.hh:67
│ │ │ +
M MatrixOperator
The type of the matrix operator.
Definition matrixhierarchy.hh:64
│ │ │ +
void operator()(const matrix_row &row)
Definition matrixhierarchy.hh:254
│ │ │ +
Matrix::row_type matrix_row
Definition matrixhierarchy.hh:245
│ │ │ +
size_type min
Definition matrixhierarchy.hh:261
│ │ │ + │ │ │ +
size_type max
Definition matrixhierarchy.hh:262
│ │ │ +
size_type sum
Definition matrixhierarchy.hh:263
│ │ │ +
Matrix::size_type size_type
Definition matrixhierarchy.hh:244
│ │ │ +
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ +
CoarsenCriterion(const Dune::Amg::Parameters &parms)
Definition matrixhierarchy.hh:309
│ │ │ +
T AggregationCriterion
The criterion for tagging connections as strong and nodes as isolated. This might be e....
Definition matrixhierarchy.hh:289
│ │ │ +
CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition matrixhierarchy.hh:304
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ +
Definition transfer.hh:32
│ │ │ +
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,92 +1,1290 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -preconditioner.hh │ │ │ │ + * _p_a_a_m_g │ │ │ │ +matrixhierarchy.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_PRECONDITIONER_HH │ │ │ │ -6#define DUNE_ISTL_PRECONDITIONER_HH │ │ │ │ +5#ifndef DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ +6#define DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ 7 │ │ │ │ -8#include // DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ -9#include │ │ │ │ -10 │ │ │ │ -11#include "_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h" │ │ │ │ -12 │ │ │ │ -13namespace _D_u_n_e { │ │ │ │ -18 //===================================================================== │ │ │ │ -31 //===================================================================== │ │ │ │ -32 template │ │ │ │ -_3_3 class _P_r_e_c_o_n_d_i_t_i_o_n_e_r { │ │ │ │ -34 public: │ │ │ │ -_3_6 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_3_8 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_4_0 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -41 │ │ │ │ -_7_0 virtual void _p_r_e (X& x, Y& b) = 0; │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +11#include "_g_r_a_p_h_._h_h" │ │ │ │ +12#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ +13#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ +14#include "_g_r_a_p_h_c_r_e_a_t_o_r_._h_h" │ │ │ │ +15#include "_h_i_e_r_a_r_c_h_y_._h_h" │ │ │ │ +16#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +17#include │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ +19#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ +20#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_d_e_p_e_n_d_e_n_c_y_._h_h> │ │ │ │ +21#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ +22#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h> │ │ │ │ +23#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ +24#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ +25#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ +26#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ +27 │ │ │ │ +28namespace _D_u_n_e │ │ │ │ +29{ │ │ │ │ +30 namespace Amg │ │ │ │ +31 { │ │ │ │ +42 enum { │ │ │ │ +50 _M_A_X___P_R_O_C_E_S_S_E_S = 72000 │ │ │ │ +_5_1 }; │ │ │ │ +52 │ │ │ │ +59 template > │ │ │ │ +_6_0 class _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +61 { │ │ │ │ +62 public: │ │ │ │ +_6_4 typedef M _M_a_t_r_i_x_O_p_e_r_a_t_o_r; │ │ │ │ +65 │ │ │ │ +_6_7 typedef typename MatrixOperator::matrix_type _M_a_t_r_i_x; │ │ │ │ +68 │ │ │ │ +_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ 71 │ │ │ │ -_8_2 virtual void _a_p_p_l_y (X& v, const Y& d) = 0; │ │ │ │ +_7_3 typedef A _A_l_l_o_c_a_t_o_r; │ │ │ │ +74 │ │ │ │ +_7_6 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_>_:_: │ │ │ │ +_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r> _A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ +77 │ │ │ │ +_7_9 typedef _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_A_l_l_o_c_a_t_o_r_> │ │ │ │ +_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y; │ │ │ │ +80 │ │ │ │ +_8_2 typedef _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_A_l_l_o_c_a_t_o_r_> │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ 83 │ │ │ │ -_9_2 virtual void _p_o_s_t (X& x) = 0; │ │ │ │ -93 │ │ │ │ -_9_5 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -96#if DUNE_ISTL_SUPPORT_OLD_CATEGORY_INTERFACE │ │ │ │ -97 { │ │ │ │ -98 DUNE_THROW(Dune::Exception,"It is necessary to implement the category method │ │ │ │ -in a derived classes, in the future this method will pure virtual."); │ │ │ │ -99 } │ │ │ │ -100#else │ │ │ │ -101 = 0; │ │ │ │ -102#endif │ │ │ │ -103 │ │ │ │ -_1_0_5 virtual _~_P_r_e_c_o_n_d_i_t_i_o_n_e_r () {} │ │ │ │ +_8_5 using _A_A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ +rebind_alloc; │ │ │ │ +86 │ │ │ │ +_8_8 typedef std::list _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t; │ │ │ │ +89 │ │ │ │ +_9_1 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e; │ │ │ │ +92 │ │ │ │ +_9_4 using _R_I_L_A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ +rebind_alloc; │ │ │ │ +95 │ │ │ │ +_9_7 typedef std::list _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t; │ │ │ │ +98 │ │ │ │ +104 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(std::shared_ptr fineMatrix, │ │ │ │ +105 std::shared_ptr pinfo = std:: │ │ │ │ +make_shared()); │ │ │ │ 106 │ │ │ │ -107 }; │ │ │ │ +107 _~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(); │ │ │ │ 108 │ │ │ │ -112} │ │ │ │ -113#endif │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ +114 template │ │ │ │ +115 void _b_u_i_l_d(const T& criterion); │ │ │ │ +116 │ │ │ │ +124 template │ │ │ │ +125 void _r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n(const F& copyFlags); │ │ │ │ +126 │ │ │ │ +131 template │ │ │ │ +132 void _c_o_a_r_s_e_n_V_e_c_t_o_r(_H_i_e_r_a_r_c_h_y<_B_l_o_c_k_V_e_c_t_o_r_<_V_,_B_A_>, TA>& hierarchy) const; │ │ │ │ +133 │ │ │ │ +139 template │ │ │ │ +140 void _c_o_a_r_s_e_n_S_m_o_o_t_h_e_r(_H_i_e_r_a_r_c_h_y_<_S_,_T_A_>& smoothers, │ │ │ │ +141 const typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s& args) const; │ │ │ │ +142 │ │ │ │ +147 std::size_t _l_e_v_e_l_s() const; │ │ │ │ +148 │ │ │ │ +153 std::size_t _m_a_x_l_e_v_e_l_s() const; │ │ │ │ +154 │ │ │ │ +155 bool _h_a_s_C_o_a_r_s_e_s_t() const; │ │ │ │ +156 │ │ │ │ +161 bool _i_s_B_u_i_l_t() const; │ │ │ │ +162 │ │ │ │ +167 const _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y& _m_a_t_r_i_c_e_s() const; │ │ │ │ +168 │ │ │ │ +173 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y& _p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ +174 │ │ │ │ +179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t& _a_g_g_r_e_g_a_t_e_s_M_a_p_s() const; │ │ │ │ +180 │ │ │ │ +186 const _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t& _r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ +187 │ │ │ │ +_1_8_8 double _g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r() const │ │ │ │ +189 { │ │ │ │ +190 return prolongDamp_; │ │ │ │ +191 } │ │ │ │ +192 │ │ │ │ +203 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t(std::vector& data) const; │ │ │ │ +204 │ │ │ │ +205 private: │ │ │ │ +206 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_>_:_:_A_r_g_u_m_e_n_t_s MatrixArgs; │ │ │ │ +207 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +CommunicationArgs; │ │ │ │ +209 _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t aggregatesMaps_; │ │ │ │ +211 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t redistributes_; │ │ │ │ +213 _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y matrices_; │ │ │ │ +215 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y parallelInformation_; │ │ │ │ +216 │ │ │ │ +218 bool built_; │ │ │ │ +219 │ │ │ │ +221 int maxlevels_; │ │ │ │ +222 │ │ │ │ +223 double prolongDamp_; │ │ │ │ +224 │ │ │ │ +228 template │ │ │ │ +229 struct MatrixStats │ │ │ │ +230 { │ │ │ │ +231 │ │ │ │ +235 static void stats([[maybe_unused]] const _M_a_t_r_i_x& matrix) │ │ │ │ +236 {} │ │ │ │ +237 }; │ │ │ │ +238 │ │ │ │ +239 template │ │ │ │ +240 struct MatrixStats<_M_a_t_r_i_x,true> │ │ │ │ +241 { │ │ │ │ +_2_4_2 struct calc │ │ │ │ +243 { │ │ │ │ +_2_4_4 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ +_2_4_5 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _m_a_t_r_i_x___r_o_w; │ │ │ │ +246 │ │ │ │ +_2_4_7 _c_a_l_c() │ │ │ │ +248 { │ │ │ │ +249 min=std::numeric_limits::max(); │ │ │ │ +250 max=0; │ │ │ │ +251 sum=0; │ │ │ │ +252 } │ │ │ │ +253 │ │ │ │ +_2_5_4 void _o_p_e_r_a_t_o_r_(_)(const _m_a_t_r_i_x___r_o_w& row) │ │ │ │ +255 { │ │ │ │ +256 min=std::min(min, row.size()); │ │ │ │ +257 max=std::max(max, row.size()); │ │ │ │ +258 sum += row.size(); │ │ │ │ +259 } │ │ │ │ +260 │ │ │ │ +_2_6_1 _s_i_z_e___t_y_p_e _m_i_n; │ │ │ │ +_2_6_2 _s_i_z_e___t_y_p_e _m_a_x; │ │ │ │ +_2_6_3 _s_i_z_e___t_y_p_e _s_u_m; │ │ │ │ +264 }; │ │ │ │ +268 static void stats(const _M_a_t_r_i_x& matrix) │ │ │ │ +269 { │ │ │ │ +270 calc c= for_each(matrix.begin(), matrix.end(), calc()); │ │ │ │ +271 dinfo<<"Matrix row: min="< │ │ │ │ +_3_2_9 bool _r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(const M& origMatrix, │ │ │ │ +330 std::shared_ptr newMatrix, │ │ │ │ +331 C& origComm, │ │ │ │ +332 std::shared_ptr& newComm, │ │ │ │ +333 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_C_>& ri, │ │ │ │ +334 int nparts, C1& criterion) │ │ │ │ +335 { │ │ │ │ +336 Timer time; │ │ │ │ +337#ifdef AMG_REPART_ON_COMM_GRAPH │ │ │ │ +338 // Done not repartition the matrix graph, but a graph of the communication │ │ │ │ +scheme. │ │ │ │ +339 bool existentOnRedist=_D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(origMatrix, origComm, │ │ │ │ +nparts, newComm, │ │ │ │ +340 ri.getInterface(), │ │ │ │ +341 criterion.debugLevel()>1); │ │ │ │ +342 │ │ │ │ +343#else │ │ │ │ +344 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +345 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ +346 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +347 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +348 IdentityMap, │ │ │ │ +349 IdentityMap> _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ +350 _M_a_t_r_i_x_G_r_a_p_h graph(origMatrix); │ │ │ │ +351 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pgraph(graph); │ │ │ │ +352 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(pgraph, origMatrix, criterion, false); │ │ │ │ +353 │ │ │ │ +354#ifdef DEBUG_REPART │ │ │ │ +355 if(origComm.communicator().rank()==0) │ │ │ │ +356 std::cout<<"Original matrix"<1); │ │ │ │ +363#endif // if else AMG_REPART │ │ │ │ +364 │ │ │ │ +365 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ +366 std::cout<<"Repartitioning took "<indexSet(), │ │ │ │ +origComm.communicator()); │ │ │ │ +372#endif │ │ │ │ +373 │ │ │ │ +374 _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(const_cast(origMatrix), *newMatrix, origComm, │ │ │ │ +*newComm, ri); │ │ │ │ +375 │ │ │ │ +376#ifdef DEBUG_REPART │ │ │ │ +377 if(origComm.communicator().rank()==0) │ │ │ │ +378 std::cout<<"Original matrix"<communicator().size()>0) │ │ │ │ +381 _p_r_i_n_t_G_l_o_b_a_l_S_p_a_r_s_e_M_a_t_r_i_x(*newMatrix, *newComm, std::cout); │ │ │ │ +382 origComm.communicator().barrier(); │ │ │ │ +383#endif │ │ │ │ +384 │ │ │ │ +385 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ +386 std::cout<<"Redistributing matrix took "< │ │ │ │ +_3_9_2 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(std::shared_ptr │ │ │ │ +fineMatrix, │ │ │ │ +393 std::shared_ptr pinfo) │ │ │ │ +394 : matrices_(fineMatrix), │ │ │ │ +395 parallelInformation_(pinfo) │ │ │ │ +396 { │ │ │ │ +397 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(*fineMatrix) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ +(*pinfo)) │ │ │ │ +398 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "MatrixOperator and ParallelInformation must belong │ │ │ │ +to the same category!"); │ │ │ │ +399 } │ │ │ │ +400 │ │ │ │ +401 template │ │ │ │ +402 template │ │ │ │ +_4_0_3 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_b_u_i_l_d(const T& criterion) │ │ │ │ +404 { │ │ │ │ +405 prolongDamp_ = criterion.getProlongationDampingFactor(); │ │ │ │ +406 typedef O OverlapFlags; │ │ │ │ +407 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r MatIterator; │ │ │ │ +408 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r PInfoIterator; │ │ │ │ +409 │ │ │ │ +410 static const int noints=(_D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S/4096>0) ? (_D_u_n_e_:_:_A_m_g_:_: │ │ │ │ +_M_A_X___P_R_O_C_E_S_S_E_S/4096) : 1; │ │ │ │ +411 │ │ │ │ +412 typedef bigunsignedint BIGINT; │ │ │ │ +413 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> productBuilder; │ │ │ │ +414 MatIterator mlevel = matrices_.finest(); │ │ │ │ +415 MatrixStats::stats(mlevel->getmat()); │ │ │ │ +416 │ │ │ │ +417 PInfoIterator infoLevel = parallelInformation_.finest(); │ │ │ │ +418 BIGINT finenonzeros=_c_o_u_n_t_N_o_n_Z_e_r_o_s(mlevel->getmat()); │ │ │ │ +419 finenonzeros = infoLevel->communicator().sum(finenonzeros); │ │ │ │ +420 BIGINT allnonzeros = finenonzeros; │ │ │ │ +421 │ │ │ │ +422 │ │ │ │ +423 int level = 0; │ │ │ │ +424 int rank = 0; │ │ │ │ +425 │ │ │ │ +426 BIGINT unknowns = mlevel->getmat().N(); │ │ │ │ +427 │ │ │ │ +428 unknowns = infoLevel->communicator().sum(unknowns); │ │ │ │ +429 double dunknowns=unknowns.todouble(); │ │ │ │ +430 infoLevel->buildGlobalLookup(mlevel->getmat().N()); │ │ │ │ +431 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ +432 │ │ │ │ +433 for(; level < criterion.maxLevel(); ++level, ++mlevel) { │ │ │ │ +434 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ +435 rank = infoLevel->communicator().rank(); │ │ │ │ +436 if(rank==0 && criterion.debugLevel()>1) │ │ │ │ +437 std::cout<<"Level "<communicator().size() │ │ │ │ +438 <<" unknowns per proc (procs="<communicator().size │ │ │ │ +()<<")"<communicator().size())) │ │ │ │ +451 && infoLevel->communicator().size()>1 && │ │ │ │ +452 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget()) │ │ │ │ +453 { │ │ │ │ +454 // accumulate to fewer processors │ │ │ │ +455 std::shared_ptr redistMat = std::make_shared(); │ │ │ │ +456 std::shared_ptr redistComm; │ │ │ │ +457 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/ │ │ │ │ +(criterion.minAggregateSize() │ │ │ │ +458 *criterion.coarsenTarget())); │ │ │ │ +459 if( nodomains<=criterion.minAggregateSize()/2 || │ │ │ │ +460 dunknowns <= criterion.coarsenTarget() ) │ │ │ │ +461 nodomains=1; │ │ │ │ +462 │ │ │ │ +463 bool existentOnNextLevel = │ │ │ │ +464 _r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(mlevel->getmat(), redistMat, *infoLevel, │ │ │ │ +465 redistComm, redistributes_.back(), nodomains, │ │ │ │ +466 criterion); │ │ │ │ +467 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ +468 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ +469 dunknowns= unknownsRedist.todouble(); │ │ │ │ +470 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ +471 std::cout<<"Level "<communicator().size() │ │ │ │ +472 <<" unknowns per proc (procs="<communicator().size │ │ │ │ +()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +(args)); │ │ │ │ +475 assert(mlevel.isRedistributed()); │ │ │ │ +476 infoLevel.addRedistributed(redistComm); │ │ │ │ +477 infoLevel->freeGlobalLookup(); │ │ │ │ +478 │ │ │ │ +479 if(!existentOnNextLevel) │ │ │ │ +480 // We do not hold any data on the redistributed partitioning │ │ │ │ +481 break; │ │ │ │ +482 │ │ │ │ +483 // Work on the redistributed Matrix from now on │ │ │ │ +484 matrix = &(mlevel.getRedistributed()); │ │ │ │ +485 info = &(infoLevel.getRedistributed()); │ │ │ │ +486 info->buildGlobalLookup(matrix->getmat().N()); │ │ │ │ +487 } │ │ │ │ +488 │ │ │ │ +489 rank = info->communicator().rank(); │ │ │ │ +490 if(dunknowns <= criterion.coarsenTarget()) │ │ │ │ +491 // No further coarsening needed │ │ │ │ +492 break; │ │ │ │ +493 │ │ │ │ +494 typedef _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +GraphCreator; │ │ │ │ +495 typedef typename GraphCreator::PropertiesGraph _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ +496 typedef typename GraphCreator::GraphTuple GraphTuple; │ │ │ │ +497 │ │ │ │ +498 typedef typename _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r Vertex; │ │ │ │ +499 │ │ │ │ +500 std::vector excluded(matrix->getmat().N(), false); │ │ │ │ +501 │ │ │ │ +502 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, │ │ │ │ +OverlapFlags()); │ │ │ │ +503 │ │ │ │ +504 _A_g_g_r_e_g_a_t_e_s_M_a_p* aggregatesMap=new _A_g_g_r_e_g_a_t_e_s_M_a_p(std::get<1>(graphs)- │ │ │ │ +>maxVertex()+1); │ │ │ │ +505 │ │ │ │ +506 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ +507 │ │ │ │ +508 Timer watch; │ │ │ │ +509 watch.reset(); │ │ │ │ +510 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] = │ │ │ │ +511 aggregatesMap->_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(matrix->getmat(), *(std::get<1>(graphs)), │ │ │ │ +criterion, level==0); │ │ │ │ +512 │ │ │ │ +513 if(rank==0 && criterion.debugLevel()>2) │ │ │ │ +514 std::cout<<" Have built "<communicator().rank(); │ │ │ │ +522 int n = UNKNOWNS/procs; // number of unknowns per process │ │ │ │ +523 int bigger = UNKNOWNS%procs; // number of process with n+1 unknowns │ │ │ │ +524 │ │ │ │ +525 // Compute owner region │ │ │ │ +526 if(rank0) │ │ │ │ +536 overlapStart = start - 1; │ │ │ │ +537 else │ │ │ │ +538 overlapStart = start; │ │ │ │ +539 │ │ │ │ +540 if(end_n_o_V_e_r_t_i_c_e_s()); │ │ │ │ +546 for(int j=0; j< UNKNOWNS; ++j) │ │ │ │ +547 for(int i=0; i < UNKNOWNS; ++i) │ │ │ │ +548 { │ │ │ │ +549 if(i>=overlapStart && i1 && info->communicator().rank()==0) │ │ │ │ +558 std::cout<<"aggregating finished."<communicator().sum(gnoAggregates); │ │ │ │ +562 double dgnoAggregates = gnoAggregates.todouble(); │ │ │ │ +563#ifdef TEST_AGGLO │ │ │ │ +564 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2); │ │ │ │ +565#endif │ │ │ │ +566 │ │ │ │ +567 if(criterion.debugLevel()>2 && rank==0) │ │ │ │ +568 std::cout << "Building "<0) │ │ │ │ +575 std::cerr << "Stopped coarsening because of rate breakdown "<_f_r_e_e(); │ │ │ │ +582 delete aggregatesMap; │ │ │ │ +583 aggregatesMaps_.pop_back(); │ │ │ │ +584 │ │ │ │ +585 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator │ │ │ │ +().size()>1) { │ │ │ │ +586 // coarse level matrix was already redistributed, but to more than 1 │ │ │ │ +process │ │ │ │ +587 // Therefore need to delete the redistribution. Further down it will │ │ │ │ +588 // then be redistributed to 1 process │ │ │ │ +589 delete &(mlevel.getRedistributed().getmat()); │ │ │ │ +590 mlevel.deleteRedistributed(); │ │ │ │ +591 delete &(infoLevel.getRedistributed()); │ │ │ │ +592 infoLevel.deleteRedistributed(); │ │ │ │ +593 redistributes_.back().resetSetup(); │ │ │ │ +594 } │ │ │ │ +595 │ │ │ │ +596 break; │ │ │ │ +597 } │ │ │ │ +598 unknowns = noAggregates; │ │ │ │ +599 dunknowns = dgnoAggregates; │ │ │ │ +600 │ │ │ │ +601 CommunicationArgs commargs(info->communicator(),info->category()); │ │ │ │ +602 parallelInformation_.addCoarser(commargs); │ │ │ │ +603 │ │ │ │ +604 ++infoLevel; // parallel information on coarse level │ │ │ │ +605 │ │ │ │ +606 typename PropertyMapTypeSelector::Type │ │ │ │ +visitedMap = │ │ │ │ +607 _g_e_t(_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g(), *(std::get<1>(graphs))); │ │ │ │ +608 │ │ │ │ +609 watch.reset(); │ │ │ │ +610 int aggregates = _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_O_v_e_r_l_a_p_F_l_a_g_s_> │ │ │ │ +611_ _:_:_c_o_a_r_s_e_n(*info, │ │ │ │ +612 *(std::get<1>(graphs)), │ │ │ │ +613 visitedMap, │ │ │ │ +614 *aggregatesMap, │ │ │ │ +615 *infoLevel, │ │ │ │ +616 noAggregates, │ │ │ │ +617 criterion.useFixedOrder()); │ │ │ │ +618 GraphCreator::free(graphs); │ │ │ │ +619 │ │ │ │ +620 if(criterion.debugLevel()>2) { │ │ │ │ +621 if(rank==0) │ │ │ │ +622 std::cout<<"Coarsening of index sets took "<buildGlobalLookup(aggregates); │ │ │ │ +628 _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_V_e_r_t_e_x_,_O_v_e_r_l_a_p_F_l_a_g_s_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_u_b_l_i_s_h │ │ │ │ +(*aggregatesMap, │ │ │ │ +629 *info, │ │ │ │ +630 infoLevel->globalLookup()); │ │ │ │ +631 │ │ │ │ +632 │ │ │ │ +633 if(criterion.debugLevel()>2) { │ │ │ │ +634 if(rank==0) │ │ │ │ +635 std::cout<<"Communicating global aggregate numbers took "<& visited=excluded; │ │ │ │ +640 │ │ │ │ +641 typedef std::vector::iterator Iterator; │ │ │ │ +642 typedef IteratorPropertyMap VisitedMap2; │ │ │ │ +643 Iterator end = visited.end(); │ │ │ │ +644 for(Iterator iter= visited.begin(); iter != end; ++iter) │ │ │ │ +645 *iter=false; │ │ │ │ +646 │ │ │ │ +647 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap()); │ │ │ │ +648 │ │ │ │ +649 std::shared_ptr │ │ │ │ +650 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2, │ │ │ │ +651 *info, │ │ │ │ +652 *aggregatesMap, │ │ │ │ +653 aggregates, │ │ │ │ +654 OverlapFlags())); │ │ │ │ +655 dverb<<"Building of sparsity pattern took "<freeGlobalLookup(); │ │ │ │ +658 │ │ │ │ +659 delete std::get<0>(graphs); │ │ │ │ +660 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, │ │ │ │ +*infoLevel, OverlapFlags()); │ │ │ │ +661 │ │ │ │ +662 if(criterion.debugLevel()>2) { │ │ │ │ +663 if(rank==0) │ │ │ │ +664 std::cout<<"Calculation entries of Galerkin product took "<communicator().sum(nonzeros); │ │ │ │ +669 MatrixArgs args(coarseMatrix, *infoLevel); │ │ │ │ +670 │ │ │ │ +671 matrices_.addCoarser(args); │ │ │ │ +672 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ +673 } // end level loop │ │ │ │ +674 │ │ │ │ +675 │ │ │ │ +676 infoLevel->freeGlobalLookup(); │ │ │ │ +677 │ │ │ │ +678 built_=true; │ │ │ │ +679 _A_g_g_r_e_g_a_t_e_s_M_a_p* aggregatesMap=new _A_g_g_r_e_g_a_t_e_s_M_a_p(0); │ │ │ │ +680 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ +681 │ │ │ │ +682 if(criterion.debugLevel()>0) { │ │ │ │ +683 if(level==criterion.maxLevel()) { │ │ │ │ +684 BIGINT unknownsLevel = mlevel->getmat().N(); │ │ │ │ +685 unknownsLevel = infoLevel->communicator().sum(unknownsLevel); │ │ │ │ +686 if(rank==0 && criterion.debugLevel()>1) { │ │ │ │ +687 double dunknownsLevel = unknownsLevel.todouble(); │ │ │ │ +688 std::cout<<"Level "<communicator().size() │ │ │ │ +689 <<" unknowns per proc (procs="<communicator().size │ │ │ │ +()<<")"<communicator().size()>1) { │ │ │ │ +696#if HAVE_MPI && !HAVE_PARMETIS │ │ │ │ +697 if(criterion.accumulate()==_s_u_c_c_e_s_s_i_v_e_A_c_c_u && │ │ │ │ +698 infoLevel->communicator().rank()==0) │ │ │ │ +699 std::cerr<<"Successive accumulation of data on coarse levels only works │ │ │ │ +with ParMETIS installed." │ │ │ │ +700 <<" Fell back to accumulation to one domain on coarsest level"< redistMat = std::make_shared(); │ │ │ │ +705 std::shared_ptr redistComm; │ │ │ │ +706 int nodomains = 1; │ │ │ │ +707 │ │ │ │ +708 _r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(mlevel->getmat(), redistMat, *infoLevel, │ │ │ │ +709 redistComm, redistributes_.back(), nodomains,criterion); │ │ │ │ +710 MatrixArgs args(redistMat, *redistComm); │ │ │ │ +711 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ +712 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ +713 │ │ │ │ +714 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) { │ │ │ │ +715 double dunknownsRedist = unknownsRedist.todouble(); │ │ │ │ +716 std::cout<<"Level "<communicator().size() │ │ │ │ +717 <<" unknowns per proc (procs="<communicator().size │ │ │ │ +()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +(args)); │ │ │ │ +720 infoLevel.addRedistributed(redistComm); │ │ │ │ +721 infoLevel->freeGlobalLookup(); │ │ │ │ +722 } │ │ │ │ +723 │ │ │ │ +724 int levels = matrices_.levels(); │ │ │ │ +725 maxlevels_ = parallelInformation_.finest()->communicator().max(levels); │ │ │ │ +726 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ +727 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1) │ │ │ │ +728 std::cout<<"operator complexity: "< │ │ │ │ +733 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y& │ │ │ │ +_7_3_4 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_m_a_t_r_i_c_e_s() const │ │ │ │ +735 { │ │ │ │ +736 return matrices_; │ │ │ │ +737 } │ │ │ │ +738 │ │ │ │ +739 template │ │ │ │ +740 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y& │ │ │ │ +_7_4_1 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n() const │ │ │ │ +742 { │ │ │ │ +743 return parallelInformation_; │ │ │ │ +744 } │ │ │ │ +745 │ │ │ │ +746 template │ │ │ │ +_7_4_7 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t(std:: │ │ │ │ +vector& data) const │ │ │ │ +748 { │ │ │ │ +749 int levels=aggregatesMaps().size(); │ │ │ │ +750 int maxlevels=parallelInformation_._f_i_n_e_s_t()->communicator().max(levels); │ │ │ │ +751 std::size_t size=(*(aggregatesMaps().begin()))->noVertices(); │ │ │ │ +752 // We need an auxiliary vector for the consecutive prolongation. │ │ │ │ +753 std::vector tmp; │ │ │ │ +754 std::vector *coarse, *fine; │ │ │ │ +755 │ │ │ │ +756 // make sure the allocated space suffices. │ │ │ │ +757 tmp.reserve(size); │ │ │ │ +758 data.reserve(size); │ │ │ │ +759 │ │ │ │ +760 // Correctly assign coarse and fine for the first prolongation such that │ │ │ │ +761 // we end up in data in the end. │ │ │ │ +762 if(levels%2==0) { │ │ │ │ +763 coarse=&tmp; │ │ │ │ +764 fine=&data; │ │ │ │ +765 }else{ │ │ │ │ +766 coarse=&data; │ │ │ │ +767 fine=&tmp; │ │ │ │ +768 } │ │ │ │ +769 │ │ │ │ +770 // Number the unknowns on the coarsest level consecutively for each │ │ │ │ +process. │ │ │ │ +771 if(levels==maxlevels) { │ │ │ │ +772 const _A_g_g_r_e_g_a_t_e_s_M_a_p& map = *(*(++aggregatesMaps().rbegin())); │ │ │ │ +773 std::size_t m=0; │ │ │ │ +774 │ │ │ │ +775 for(typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r iter = map._b_e_g_i_n(); iter != │ │ │ │ +map._e_n_d(); ++iter) │ │ │ │ +776 if(*iter< _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) │ │ │ │ +777 m=std::max(*iter,m); │ │ │ │ +778 │ │ │ │ +779 coarse->resize(m+1); │ │ │ │ +780 std::size_t i=0; │ │ │ │ +781 srand((unsigned)std::clock()); │ │ │ │ +782 std::set used; │ │ │ │ +783 for(typename std::vector::iterator iter=coarse->begin(); iter │ │ │ │ +!= coarse->end(); │ │ │ │ +784 ++iter, ++i) │ │ │ │ +785 { │ │ │ │ +786 std::pair::iterator,bool> ibpair │ │ │ │ +787 = used.insert(static_cast((((double)rand())/ │ │ │ │ +(RAND_MAX+1.0)))*coarse->size()); │ │ │ │ +788 │ │ │ │ +789 while(!ibpair.second) │ │ │ │ +790 ibpair = used.insert(static_cast((((double)rand())/ │ │ │ │ +(RAND_MAX+1.0))*coarse->size())); │ │ │ │ +791 *iter=*(ibpair.first); │ │ │ │ +792 } │ │ │ │ +793 } │ │ │ │ +794 │ │ │ │ +795 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r pinfo = parallelInformation │ │ │ │ +().coarsest(); │ │ │ │ +796 --pinfo; │ │ │ │ +797 │ │ │ │ +798 // Now consecutively project the numbers to the finest level. │ │ │ │ +799 for(typename AggregatesMapList::const_reverse_iterator │ │ │ │ +aggregates=++aggregatesMaps().rbegin(); │ │ │ │ +800 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) { │ │ │ │ +801 │ │ │ │ +802 fine->resize((*aggregates)->noVertices()); │ │ │ │ +803 fine->assign(fine->size(), 0); │ │ │ │ +804 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r_,_ _s_t_d_:_:_v_e_c_t_o_r_<_s_t_d_:_: │ │ │ │ +_s_i_z_e___t_>, _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ +805 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast │ │ │ │ +(1), *pinfo); │ │ │ │ +806 --pinfo; │ │ │ │ +807 std::swap(coarse, fine); │ │ │ │ +808 } │ │ │ │ +809 │ │ │ │ +810 // Assertion to check that we really projected to data on the last step. │ │ │ │ +811 assert(coarse==&data); │ │ │ │ +812 } │ │ │ │ +813 │ │ │ │ +814 template │ │ │ │ +815 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t& │ │ │ │ +_8_1_6 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_a_g_g_r_e_g_a_t_e_s_M_a_p_s() const │ │ │ │ +817 { │ │ │ │ +818 return aggregatesMaps_; │ │ │ │ +819 } │ │ │ │ +820 template │ │ │ │ +821 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t& │ │ │ │ +_8_2_2 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() const │ │ │ │ +823 { │ │ │ │ +824 return redistributes_; │ │ │ │ +825 } │ │ │ │ +826 │ │ │ │ +827 template │ │ │ │ +_8_2_8 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y() │ │ │ │ +829 { │ │ │ │ +830 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator; │ │ │ │ +831 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +832 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r InfoIterator; │ │ │ │ +833 │ │ │ │ +834 AggregatesMapIterator amap = aggregatesMaps_.rbegin(); │ │ │ │ +835 InfoIterator info = parallelInformation_.coarsest(); │ │ │ │ +836 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level │ │ │ │ +!= finest; --level, --info, ++amap) { │ │ │ │ +837 (*amap)->free(); │ │ │ │ +838 delete *amap; │ │ │ │ +839 } │ │ │ │ +840 delete *amap; │ │ │ │ +841 } │ │ │ │ +842 │ │ │ │ +843 template │ │ │ │ +844 template │ │ │ │ +_8_4_5 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_c_o_a_r_s_e_n_V_e_c_t_o_r(_H_i_e_r_a_r_c_h_y<_B_l_o_c_k_V_e_c_t_o_r_<_V_,_B_A_>, │ │ │ │ +TA>& hierarchy) const │ │ │ │ +846 { │ │ │ │ +847 assert(hierarchy.levels()==1); │ │ │ │ +848 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +849 typedef typename RedistributeInfoList::const_iterator RIter; │ │ │ │ +850 RIter redist = redistributes_.begin(); │ │ │ │ +851 │ │ │ │ +852 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest(); │ │ │ │ +853 int level=0; │ │ │ │ +854 if(redist->isSetup()) │ │ │ │ +855 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ +()); │ │ │ │ +856 Dune::dvverb<<"Level "<getmat().N()<<" │ │ │ │ +unknowns!"<getmat().N()<<" │ │ │ │ +unknowns!"<getmat().N()); │ │ │ │ +863 if(redist->isSetup()) │ │ │ │ +864 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ +()); │ │ │ │ +865 │ │ │ │ +866 } │ │ │ │ +867 │ │ │ │ +868 } │ │ │ │ +869 │ │ │ │ +870 template │ │ │ │ +871 template │ │ │ │ +_8_7_2 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_c_o_a_r_s_e_n_S_m_o_o_t_h_e_r(_H_i_e_r_a_r_c_h_y_<_S_,_T_A_>& smoothers, │ │ │ │ +873 const typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s& sargs) const │ │ │ │ +874 { │ │ │ │ +875 assert(smoothers._l_e_v_e_l_s()==0); │ │ │ │ +876 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r MatrixIterator; │ │ │ │ +877 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r PinfoIterator; │ │ │ │ +878 typedef typename AggregatesMapList::const_iterator AggregatesIterator; │ │ │ │ +879 │ │ │ │ +880 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ +881 cargs.setArgs(sargs); │ │ │ │ +882 PinfoIterator pinfo = parallelInformation_.finest(); │ │ │ │ +883 AggregatesIterator aggregates = aggregatesMaps_.begin(); │ │ │ │ +884 int level=0; │ │ │ │ +885 for(MatrixIterator matrix = matrices_.finest(), coarsest = │ │ │ │ +matrices_.coarsest(); │ │ │ │ +886 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) { │ │ │ │ +887 cargs.setMatrix(matrix->getmat(), **aggregates); │ │ │ │ +888 cargs.setComm(*pinfo); │ │ │ │ +889 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ +890 } │ │ │ │ +891 if(maxlevels()>levels()) { │ │ │ │ +892 // This is not the globally coarsest level and therefore smoothing is │ │ │ │ +needed │ │ │ │ +893 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates); │ │ │ │ +894 cargs.setComm(*pinfo); │ │ │ │ +895 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ +896 ++level; │ │ │ │ +897 } │ │ │ │ +898 } │ │ │ │ +899 │ │ │ │ +900 template │ │ │ │ +901 template │ │ │ │ +_9_0_2 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n(const F& copyFlags) │ │ │ │ +903 { │ │ │ │ +904 typedef typename AggregatesMapList::iterator AggregatesMapIterator; │ │ │ │ +905 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ +906 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r InfoIterator; │ │ │ │ +907 │ │ │ │ +908 AggregatesMapIterator amap = aggregatesMaps_.begin(); │ │ │ │ +909 _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t productBuilder; │ │ │ │ +910 InfoIterator info = parallelInformation_.finest(); │ │ │ │ +911 typename RedistributeInfoList::iterator riIter = redistributes_.begin(); │ │ │ │ +912 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest(); │ │ │ │ +913 if(level.isRedistributed()) { │ │ │ │ +914 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ +915 _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x_E_n_t_r_i_e_s(const_cast<_M_a_t_r_i_x&>(level->getmat()), │ │ │ │ +916 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), │ │ │ │ +917 *info,info.getRedistributed(), *riIter); │ │ │ │ +918 info->freeGlobalLookup(); │ │ │ │ +919 } │ │ │ │ +920 │ │ │ │ +921 for(; level!=coarsest; ++amap) { │ │ │ │ +922 const _M_a_t_r_i_x& fine = (level.isRedistributed() ? level.getRedistributed() : │ │ │ │ +*level).getmat(); │ │ │ │ +923 ++level; │ │ │ │ +924 ++info; │ │ │ │ +925 ++riIter; │ │ │ │ +926 productBuilder._c_a_l_c_u_l_a_t_e(fine, *(*amap), const_cast<_M_a_t_r_i_x&>(level->getmat │ │ │ │ +()), *info, copyFlags); │ │ │ │ +927 if(level.isRedistributed()) { │ │ │ │ +928 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ +929 _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x_E_n_t_r_i_e_s(const_cast<_M_a_t_r_i_x&>(level->getmat()), │ │ │ │ +930 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), *info, │ │ │ │ +931 info.getRedistributed(), *riIter); │ │ │ │ +932 info->freeGlobalLookup(); │ │ │ │ +933 } │ │ │ │ +934 } │ │ │ │ +935 } │ │ │ │ +936 │ │ │ │ +937 template │ │ │ │ +_9_3_8 std::size_t _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ +939 { │ │ │ │ +940 return matrices_.levels(); │ │ │ │ +941 } │ │ │ │ +942 │ │ │ │ +943 template │ │ │ │ +_9_4_4 std::size_t _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_m_a_x_l_e_v_e_l_s() const │ │ │ │ +945 { │ │ │ │ +946 return maxlevels_; │ │ │ │ +947 } │ │ │ │ +948 │ │ │ │ +949 template │ │ │ │ +_9_5_0 bool _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_h_a_s_C_o_a_r_s_e_s_t() const │ │ │ │ +951 { │ │ │ │ +952 return levels()==maxlevels() && │ │ │ │ +953 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N │ │ │ │ +()>0); │ │ │ │ +954 } │ │ │ │ +955 │ │ │ │ +956 template │ │ │ │ +_9_5_7 bool _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_i_s_B_u_i_l_t() const │ │ │ │ +958 { │ │ │ │ +959 return built_; │ │ │ │ +960 } │ │ │ │ +961 │ │ │ │ +963 } // namespace Amg │ │ │ │ +964} // namespace Dune │ │ │ │ +965 │ │ │ │ +966#endif // end DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ +_g_r_a_p_h_c_r_e_a_t_o_r_._h_h │ │ │ │ +_t_r_a_n_s_f_e_r_._h_h │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ +_c_o_n_s_t_r_u_c_t_i_o_n_._h_h │ │ │ │ +Helper classes for the construction of classes without empty constructor. │ │ │ │ +_g_a_l_e_r_k_i_n_._h_h │ │ │ │ +Provides a class for building the galerkin product based on a aggregation │ │ │ │ +scheme. │ │ │ │ +_d_e_p_e_n_d_e_n_c_y_._h_h │ │ │ │ +Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ +_h_i_e_r_a_r_c_h_y_._h_h │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ +_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ +Provides classes for the Coloring process of AMG. │ │ │ │ +_r_e_n_u_m_b_e_r_e_r_._h_h │ │ │ │ +_g_r_a_p_h_._h_h │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ +_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h │ │ │ │ +Provides a class for building the index set and remote indices on the coarse │ │ │ │ +level. │ │ │ │ +_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ +Provdes class for identifying aggregates globally. │ │ │ │ +_s_m_o_o_t_h_e_r_._h_h │ │ │ │ +Classes for the generic construction and application of the smoothers. │ │ │ │ +_b_v_e_c_t_o_r_._h_h │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ +space. The number of compon... │ │ │ │ +_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ +Some handy generic functions for ISTL matrices. │ │ │ │ +_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h │ │ │ │ +Functionality for redistributing a sparse matrix. │ │ │ │ +_D_u_n_e_:_:_c_o_u_n_t_N_o_n_Z_e_r_o_s │ │ │ │ +auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >:: │ │ │ │ +value > *sfinae=nullptr) │ │ │ │ +Get the number of nonzero fields in the matrix. │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:119 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_a_g_g_r_e_g_a_t_e_s_M_a_p_s │ │ │ │ +const AggregatesMapList & aggregatesMaps() const │ │ │ │ +Get the hierarchy of the mappings of the nodes onto aggregates. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:816 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_i_s_B_u_i_l_t │ │ │ │ +bool isBuilt() const │ │ │ │ +Whether the hierarchy was built. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:957 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_h_a_s_C_o_a_r_s_e_s_t │ │ │ │ +bool hasCoarsest() const │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:950 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() const │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() const │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:938 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ +void addCoarser(Arguments &args) │ │ │ │ +Add an element on a coarser level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +const RedistributeInfoList & redistributeInformation() const │ │ │ │ +Get the hierarchy of the information about redistributions,. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:822 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +const ParallelInformationHierarchy & parallelInformation() const │ │ │ │ +Get the hierarchy of the parallel data distribution information. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:741 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x │ │ │ │ +bool repartitionAndDistributeMatrix(const M &origMatrix, std::shared_ptr< M > │ │ │ │ +newMatrix, SequentialInformation &origComm, std::shared_ptr< │ │ │ │ +SequentialInformation > &newComm, RedistributeInformation< │ │ │ │ +SequentialInformation > &ri, int nparts, C1 &criterion) │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:316 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ +const_iterator begin() const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_m_a_t_r_i_c_e_s │ │ │ │ +const ParallelMatrixHierarchy & matrices() const │ │ │ │ +Get the matrix hierarchy. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:734 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ +std::size_t maxlevels() const │ │ │ │ +Get the max number of levels in the hierarchy of processors. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:944 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ +const_iterator end() const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ +static const V ISOLATED │ │ │ │ +Identifier of isolated vertices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n │ │ │ │ +void recalculateGalerkin(const F ©Flags) │ │ │ │ +Recalculate the galerkin products. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:902 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const void * Arguments │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +Get the number of vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_V_e_c_t_o_r │ │ │ │ +void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const │ │ │ │ +Coarsen the vector hierarchy according to the matrix hierarchy. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:845 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ +const AggregateDescriptor * const_iterator │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< │ │ │ │ +ParallelInformation > pinfo=std::make_shared< ParallelInformation >()) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:392 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e │ │ │ │ +AccumulationMode │ │ │ │ +Identifiers for the different accumulation modes. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:231 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ +Iterator finest() │ │ │ │ +Get an iterator positioned at the finest level. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_b_u_i_l_d │ │ │ │ +void build(const T &criterion) │ │ │ │ +Build the matrix hierarchy using aggregation. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:403 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ +void free() │ │ │ │ +Free the allocated memory. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_S_m_o_o_t_h_e_r │ │ │ │ +void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename │ │ │ │ +SmootherTraits< S >::Arguments &args) const │ │ │ │ +Coarsen the smoother hierarchy according to the matrix hierarchy. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:872 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ +void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ +bool finestLevel) │ │ │ │ +Build the dependency of the matrix graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ +std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ +const C &criterion, bool finestLevel) │ │ │ │ +Build the aggregates. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_:_:_c_a_l_c_u_l_a_t_e │ │ │ │ +void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, │ │ │ │ +const I &pinfo, const O ©) │ │ │ │ +Calculate the galerkin product. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t │ │ │ │ +void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const │ │ │ │ +Get the mapping of fine level unknowns to coarse level aggregates. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:747 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +~MatrixHierarchy() │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:828 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S │ │ │ │ +@ MAX_PROCESSES │ │ │ │ +Hard limit for the number of processes allowed. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:50 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ +@ atOnceAccu │ │ │ │ +Accumulate data to one process at once. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:243 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u │ │ │ │ +@ successiveAccu │ │ │ │ +Successively accumulate to fewer processes. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:247 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_o_s_t │ │ │ │ -virtual void post(X &x)=0 │ │ │ │ -Clean up. │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_a_p_p_l_y │ │ │ │ -virtual void apply(X &v, const Y &d)=0 │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_~_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -virtual ~Preconditioner() │ │ │ │ -every abstract base class has a virtual destructor │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:105 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -The range type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:38 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -The domain type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:36 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const =0 │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -The field type of the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:40 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_:_:_p_r_e │ │ │ │ -virtual void pre(X &x, Y &b)=0 │ │ │ │ -Prepare the preconditioner. │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ +_D_u_n_e_:_:_p_r_i_n_t_G_l_o_b_a_l_S_p_a_r_s_e_M_a_t_r_i_x │ │ │ │ +void printGlobalSparseMatrix(const M &mat, C &ooc, std::ostream &os) │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:154 │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ +_D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x_E_n_t_r_i_e_s │ │ │ │ +void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C │ │ │ │ +&newComm, RedistributeInformation< C > &ri) │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:757 │ │ │ │ +_D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n │ │ │ │ +bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< │ │ │ │ +T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune:: │ │ │ │ +OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ +&redistInf, bool verbose=false) │ │ │ │ +DDeeffiinniittiioonn repartition.hh:822 │ │ │ │ +_D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x │ │ │ │ +void redistributeMatrix(M &origMatrix, M &newMatrix, C &origComm, C &newComm, │ │ │ │ +RedistributeInformation< C > &ri) │ │ │ │ +Redistribute a matrix according to given domain decompositions. │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:820 │ │ │ │ +_D_u_n_e_:_:_g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n │ │ │ │ +bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, │ │ │ │ +T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune:: │ │ │ │ +OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ +&redistInf, bool verbose=false) │ │ │ │ +execute a graph repartition for a giving graph and indexset. │ │ │ │ +DDeeffiinniittiioonn repartition.hh:1228 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +A vector of blocks with memory management. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ +derive error class from the base class in common │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ +A::size_type size_type │ │ │ │ +Type for indices and sizes. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:577 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ +The type implementing a matrix row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ +_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +Class representing the properties of an edge in the matrix graph. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +Class representing a node in the matrix graph. │ │ │ │ +DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +DDeeffiinniittiioonn galerkin.hh:99 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +DDeeffiinniittiioonn galerkin.hh:118 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:988 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ +DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ +A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > │ │ │ │ +Iterator │ │ │ │ +Type of the mutable iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const │ │ │ │ +MatrixOperator > ConstIterator │ │ │ │ +Type of the const iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:36 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +The hierarchies build by the coarsening process. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_A_l_l_o_c_a_t_o_r │ │ │ │ +typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ +AggregatesMap * > AAllocator │ │ │ │ +Allocator for pointers. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:85 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ +Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ +ParallelInformationHierarchy │ │ │ │ +The type of the parallel informarion hierarchy. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:82 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t │ │ │ │ +std::list< AggregatesMap *, AAllocator > AggregatesMapList │ │ │ │ +The type of the aggregates maps list. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:88 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +PI ParallelInformation │ │ │ │ +The type of the index set. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy │ │ │ │ +The type of the parallel matrix hierarchy. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:79 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ +A Allocator │ │ │ │ +The allocator to use. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:73 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e │ │ │ │ +RedistributeInformation< ParallelInformation > RedistributeInfoType │ │ │ │ +The type of the redistribute information. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:91 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ +double getProlongationDampingFactor() const │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:188 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_I_L_A_l_l_o_c_a_t_o_r │ │ │ │ +typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ +RedistributeInfoType > RILAllocator │ │ │ │ +Allocator for RedistributeInfoType. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:94 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t │ │ │ │ +std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList │ │ │ │ +The type of the list of redistribute information. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:97 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > │ │ │ │ +AggregatesMap │ │ │ │ +The type of the aggregates map we use. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:76 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x │ │ │ │ +MatrixOperator::matrix_type Matrix │ │ │ │ +The type of the matrix. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:67 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ +M MatrixOperator │ │ │ │ +The type of the matrix operator. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:64 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const matrix_row &row) │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:254 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_t_r_i_x___r_o_w │ │ │ │ +Matrix::row_type matrix_row │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:245 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_i_n │ │ │ │ +size_type min │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:261 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_c_a_l_c │ │ │ │ +calc() │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:247 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_x │ │ │ │ +size_type max │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:262 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_u_m │ │ │ │ +size_type sum │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:263 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_i_z_e___t_y_p_e │ │ │ │ +Matrix::size_type size_type │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:244 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ +The criterion describing the stop criteria for the coarsening process. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ +CoarsenCriterion(const Dune::Amg::Parameters &parms) │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:309 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ +T AggregationCriterion │ │ │ │ +The criterion for tagging connections as strong and nodes as isolated. This │ │ │ │ +might be e.... │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:289 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ +CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double │ │ │ │ +minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode │ │ │ │ +accumulate=successiveAccu, bool useFixedOrder=false) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:304 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +All parameters for AMG. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ +Tag idnetifying the visited property of a vertex. │ │ │ │ +DDeeffiinniittiioonn properties.hh:29 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +The default class for the smoother arguments. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ +DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ +static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ +Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ +newly introduced virtu... │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: twolevelmethod.hh File Reference │ │ │ +dune-istl: kamg.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,52 +72,44 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ - │ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

Algebraic twolevel methods. │ │ │ +

Provides an algebraic multigrid using a Krylov cycle. │ │ │ More...

│ │ │ -
#include <tuple>
│ │ │ -#include <dune/istl/operators.hh>
│ │ │ -#include "amg.hh"
│ │ │ -#include "galerkin.hh"
│ │ │ -#include <dune/istl/solver.hh>
│ │ │ +
#include <dune/istl/preconditioners.hh>
│ │ │ +#include "amg.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::LevelTransferPolicy< FO, CO >
 Abstract base class for transfer between levels and creation of the coarse level system. More...
class  Dune::Amg::KAmgTwoGrid< AMG >
 Two grid operator for AMG with Krylov cycle. More...
 
class  Dune::Amg::AggregationLevelTransferPolicy< O, C >
 A LeveTransferPolicy that used aggregation to construct the coarse level system. More...
 
class  Dune::Amg::OneStepAMGCoarseSolverPolicy< O, S, C >
 A policy class for solving the coarse level system using one step of AMG. More...
 
class  Dune::Amg::TwoLevelMethod< FO, CSP, S >
class  Dune::Amg::KAMG< M, X, S, PI, K, A >
 an algebraic multigrid method using a Krylov-cycle. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │

Detailed Description

│ │ │ -

Algebraic twolevel methods.

│ │ │ -
Author
Markus Blatt
│ │ │ +

Provides an algebraic multigrid using a Krylov cycle.

│ │ │ +
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -2,43 +2,32 @@ │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -twolevelmethod.hh File Reference │ │ │ │ +kamg.hh File Reference │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Algebraic twolevel methods. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +Provides an algebraic multigrid using a Krylov cycle. _M_o_r_e_._._. │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ #include "_a_m_g_._h_h" │ │ │ │ -#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_ _F_O_,_ _C_O_ _> │ │ │ │ -  Abstract base class for transfer between levels and creation of the │ │ │ │ - coarse level system. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_<_ _A_M_G_ _> │ │ │ │ +  Two grid operator for _A_M_G with Krylov cycle. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_ _O_,_ _C_ _> │ │ │ │ -  A LeveTransferPolicy that used aggregation to construct the coarse │ │ │ │ - level system. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_O_n_e_S_t_e_p_A_M_G_C_o_a_r_s_e_S_o_l_v_e_r_P_o_l_i_c_y_<_ _O_,_ _S_,_ _C_ _> │ │ │ │ -  A policy class for solving the coarse level system using one step of │ │ │ │ - _A_M_G. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_T_w_o_L_e_v_e_l_M_e_t_h_o_d_<_ _F_O_,_ _C_S_P_,_ _S_ _> │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _K_,_ _A_ _> │ │ │ │ +  an algebraic multigrid method using a Krylov-cycle. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Algebraic twolevel methods. │ │ │ │ +Provides an algebraic multigrid using a Krylov cycle. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: twolevelmethod.hh Source File │ │ │ +dune-istl: kamg.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,478 +74,332 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
twolevelmethod.hh
│ │ │ +
kamg.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_TWOLEVELMETHOD_HH
│ │ │ -
6#define DUNE_ISTL_TWOLEVELMETHOD_HH
│ │ │ +
5#ifndef DUNE_AMG_KAMG_HH
│ │ │ +
6#define DUNE_AMG_KAMG_HH
│ │ │
7
│ │ │ -
8#include <tuple>
│ │ │ -
9
│ │ │ - │ │ │ -
11#include"amg.hh"
│ │ │ -
12#include"galerkin.hh"
│ │ │ -
13#include<dune/istl/solver.hh>
│ │ │ -
14
│ │ │ -
22namespace Dune
│ │ │ -
23{
│ │ │ -
24namespace Amg
│ │ │ -
25{
│ │ │ -
26
│ │ │ -
36template<class FO, class CO>
│ │ │ -
│ │ │ - │ │ │ -
38{
│ │ │ -
39public:
│ │ │ -
44 typedef FO FineOperatorType;
│ │ │ -
48 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ -
52 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ - │ │ │ -
61 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ -
65 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ -
│ │ │ -
70 std::shared_ptr<CoarseOperatorType>& getCoarseLevelOperator()
│ │ │ -
71 {
│ │ │ -
72 return operator_;
│ │ │ -
73 }
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
79 {
│ │ │ -
80 return rhs_;
│ │ │ -
81 }
│ │ │ -
│ │ │ -
82
│ │ │ -
│ │ │ - │ │ │ -
88 {
│ │ │ -
89 return lhs_;
│ │ │ -
90 }
│ │ │ -
│ │ │ -
100 virtual void moveToCoarseLevel(const FineRangeType& fineRhs)=0;
│ │ │ -
110 virtual void moveToFineLevel(FineDomainType& fineLhs)=0;
│ │ │ -
118 virtual void createCoarseLevelSystem(const FineOperatorType& fineOperator)=0;
│ │ │ -
119
│ │ │ -
121 virtual LevelTransferPolicy* clone() const =0;
│ │ │ + │ │ │ +
9#include "amg.hh"
│ │ │ +
10
│ │ │ +
11namespace Dune
│ │ │ +
12{
│ │ │ +
13 namespace Amg
│ │ │ +
14 {
│ │ │ +
15
│ │ │ +
30 template<class AMG>
│ │ │ +
│ │ │ + │ │ │ +
32 : public Preconditioner<typename AMG::Domain,typename AMG::Range>
│ │ │ +
33 {
│ │ │ +
35 typedef typename AMG::Domain Domain;
│ │ │ +
37 typedef typename AMG::Range Range;
│ │ │ +
38 public:
│ │ │ +
39
│ │ │ +
│ │ │ + │ │ │ +
42 {
│ │ │ +
43 return amg_.category();
│ │ │ +
44 };
│ │ │ +
│ │ │ +
45
│ │ │ +
│ │ │ + │ │ │ +
54 : amg_(amg), coarseSolver_(coarseSolver)
│ │ │ +
55 {}
│ │ │ +
│ │ │ +
56
│ │ │ +
│ │ │ +
58 void pre([[maybe_unused]] typename AMG::Domain& x, [[maybe_unused]] typename AMG::Range& b)
│ │ │ +
59 {}
│ │ │ +
│ │ │ +
60
│ │ │ +
│ │ │ +
62 void post([[maybe_unused]] typename AMG::Domain& x)
│ │ │ +
63 {}
│ │ │ +
│ │ │ +
64
│ │ │ +
│ │ │ +
66 void apply(typename AMG::Domain& v, const typename AMG::Range& d)
│ │ │ +
67 {
│ │ │ +
68 // Copy data
│ │ │ +
69 *levelContext_->update=0;
│ │ │ +
70 *levelContext_->rhs = d;
│ │ │ +
71 *levelContext_->lhs = v;
│ │ │ +
72
│ │ │ +
73 presmooth(*levelContext_, amg_.preSteps_);
│ │ │ +
74 bool processFineLevel =
│ │ │ +
75 amg_.moveToCoarseLevel(*levelContext_);
│ │ │ +
76
│ │ │ +
77 if(processFineLevel) {
│ │ │ +
78 typename AMG::Range b=*levelContext_->rhs;
│ │ │ +
79 typename AMG::Domain x=*levelContext_->update;
│ │ │ + │ │ │ +
81 coarseSolver_->apply(x, b, res);
│ │ │ +
82 *levelContext_->update=x;
│ │ │ +
83 }
│ │ │ +
84
│ │ │ +
85 amg_.moveToFineLevel(*levelContext_, processFineLevel);
│ │ │ +
86
│ │ │ +
87 postsmooth(*levelContext_, amg_.postSteps_);
│ │ │ +
88 v=*levelContext_->update;
│ │ │ +
89 }
│ │ │ +
│ │ │ +
90
│ │ │ +
│ │ │ + │ │ │ +
96 {
│ │ │ +
97 return coarseSolver_;
│ │ │ +
98 }
│ │ │ +
│ │ │ +
99
│ │ │ +
│ │ │ +
104 void setLevelContext(std::shared_ptr<typename AMG::LevelContext> p)
│ │ │ +
105 {
│ │ │ +
106 levelContext_=p;
│ │ │ +
107 }
│ │ │ +
│ │ │ +
108
│ │ │ +
│ │ │ + │ │ │ +
111 {}
│ │ │ +
│ │ │ +
112
│ │ │ +
113 private:
│ │ │ +
115 AMG& amg_;
│ │ │ +
117 std::shared_ptr<InverseOperator<Domain,Range> > coarseSolver_;
│ │ │ +
119 std::shared_ptr<typename AMG::LevelContext> levelContext_;
│ │ │ +
120 };
│ │ │ +
│ │ │ +
121
│ │ │
122
│ │ │ - │ │ │ -
125
│ │ │ -
126 protected:
│ │ │ - │ │ │ - │ │ │ -
132 std::shared_ptr<CoarseOperatorType> operator_;
│ │ │ -
133};
│ │ │ -
│ │ │ -
134
│ │ │ -
140template<class O, class C>
│ │ │ -
│ │ │ - │ │ │ -
142 : public LevelTransferPolicy<O,O>
│ │ │ -
143{
│ │ │ - │ │ │ -
145public:
│ │ │ - │ │ │ -
147 typedef C Criterion;
│ │ │ - │ │ │ -
149
│ │ │ -
│ │ │ - │ │ │ -
151 : criterion_(crit)
│ │ │ -
152 {}
│ │ │ -
│ │ │ -
153
│ │ │ -
│ │ │ -
154 void createCoarseLevelSystem(const O& fineOperator)
│ │ │ -
155 {
│ │ │ -
156 prolongDamp_ = criterion_.getProlongationDampingFactor();
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
160 Dune::Amg::EdgeProperties,Dune::IdentityMap,Dune::IdentityMap> PropertiesGraph;
│ │ │ -
161 MatrixGraph mg(fineOperator.getmat());
│ │ │ -
162 PropertiesGraph pg(mg,Dune::IdentityMap(),Dune::IdentityMap());
│ │ │ -
163 typedef NegateSet<typename ParallelInformation::OwnerSet> OverlapFlags;
│ │ │ +
123
│ │ │ +
137 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ +
138 class K=GeneralizedPCGSolver<X>, class A=std::allocator<X> >
│ │ │ +
│ │ │ +
139 class KAMG : public Preconditioner<X,X>
│ │ │ +
140 {
│ │ │ +
141 public:
│ │ │ + │ │ │ +
145 typedef K KrylovSolver;
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
155 typedef typename Amg::Operator Operator;
│ │ │ +
157 typedef typename Amg::Domain Domain;
│ │ │ +
159 typedef typename Amg::Range Range;
│ │ │ + │ │ │ + │ │ │
164
│ │ │ -
165 aggregatesMap_ = std::make_shared<AggregatesMap>(pg.maxVertex()+1);
│ │ │ -
166
│ │ │ -
167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates;
│ │ │ -
168
│ │ │ -
169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) =
│ │ │ -
170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, true);
│ │ │ -
171 std::cout<<"no aggregates="<<noAggregates<<" iso="<<isoAggregates<<" one="<<oneAggregates<<" skipped="<<skippedAggregates<<std::endl;
│ │ │ -
172 // misuse coarsener to renumber aggregates
│ │ │ - │ │ │ -
174 typedef std::vector<bool>::iterator Iterator;
│ │ │ -
175 typedef Dune::IteratorPropertyMap<Iterator, Dune::IdentityMap> VisitedMap;
│ │ │ -
176 std::vector<bool> excluded(fineOperator.getmat().N(), false);
│ │ │ -
177 VisitedMap vm(excluded.begin(), Dune::IdentityMap());
│ │ │ - │ │ │ -
179 std::size_t aggregates = renumberer.coarsen(pinfo, pg, vm,
│ │ │ -
180 *aggregatesMap_, pinfo,
│ │ │ -
181 noAggregates);
│ │ │ -
182 std::vector<bool>& visited=excluded;
│ │ │ -
183
│ │ │ -
184 typedef std::vector<bool>::iterator Iterator;
│ │ │ +
│ │ │ + │ │ │ +
167 {
│ │ │ +
168 return amg.category();
│ │ │ +
169 };
│ │ │ +
│ │ │ +
170
│ │ │ +
182 KAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ +
183 const SmootherArgs& smootherArgs, const Parameters& parms,
│ │ │ +
184 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1);
│ │ │
185
│ │ │ -
186 for(Iterator iter= visited.begin(), end=visited.end();
│ │ │ -
187 iter != end; ++iter)
│ │ │ -
188 *iter=false;
│ │ │ -
189 matrix_.reset(productBuilder.build(mg, vm,
│ │ │ - │ │ │ -
191 *aggregatesMap_,
│ │ │ -
192 aggregates,
│ │ │ -
193 OverlapFlags()));
│ │ │ -
194 productBuilder.calculate(fineOperator.getmat(), *aggregatesMap_, *matrix_, pinfo, OverlapFlags());
│ │ │ -
195 this->lhs_.resize(this->matrix_->M());
│ │ │ -
196 this->rhs_.resize(this->matrix_->N());
│ │ │ -
197 this->operator_ = std::make_shared<O>(*matrix_);
│ │ │ -
198 }
│ │ │ -
│ │ │ -
199
│ │ │ -
│ │ │ -
200 void moveToCoarseLevel(const typename FatherType::FineRangeType& fineRhs)
│ │ │ -
201 {
│ │ │ - │ │ │ -
203 ::restrictVector(*aggregatesMap_, this->rhs_, fineRhs, ParallelInformation());
│ │ │ -
204 this->lhs_=0;
│ │ │ -
205 }
│ │ │ -
│ │ │ -
206
│ │ │ -
│ │ │ - │ │ │ -
208 {
│ │ │ - │ │ │ -
210 ::prolongateVector(*aggregatesMap_, this->lhs_, fineLhs,
│ │ │ -
211 prolongDamp_, ParallelInformation());
│ │ │ -
212 }
│ │ │ -
│ │ │ +
199 template<class C>
│ │ │ +
200 KAMG(const Operator& fineOperator, const C& criterion,
│ │ │ +
201 const SmootherArgs& smootherArgs=SmootherArgs(),
│ │ │ +
202 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1,
│ │ │ + │ │ │ +
204
│ │ │ +
206 void pre(Domain& x, Range& b);
│ │ │ +
208 void post(Domain& x);
│ │ │ +
210 void apply(Domain& v, const Range& d);
│ │ │ +
211
│ │ │ +
212 std::size_t maxlevels();
│ │ │
213
│ │ │ -
│ │ │ - │ │ │ -
215 {
│ │ │ -
216 return new AggregationLevelTransferPolicy(*this);
│ │ │ -
217 }
│ │ │ -
│ │ │ -
218
│ │ │ -
219private:
│ │ │ -
220 typename O::matrix_type::field_type prolongDamp_;
│ │ │ -
221 std::shared_ptr<AggregatesMap> aggregatesMap_;
│ │ │ -
222 Criterion criterion_;
│ │ │ -
223 std::shared_ptr<typename O::matrix_type> matrix_;
│ │ │ -
224};
│ │ │ -
│ │ │ -
225
│ │ │ -
232template<class O, class S, class C>
│ │ │ -
│ │ │ - │ │ │ -
234{
│ │ │ -
235public:
│ │ │ -
237 typedef O Operator;
│ │ │ -
239 typedef typename O::range_type X;
│ │ │ -
241 typedef C Criterion;
│ │ │ -
243 typedef S Smoother;
│ │ │ - │ │ │ - │ │ │ +
214 private:
│ │ │ +
216 Amg amg;
│ │ │ +
217
│ │ │ +
219 std::size_t maxLevelKrylovSteps;
│ │ │ +
220
│ │ │ +
222 double levelDefectReduction;
│ │ │ +
223
│ │ │ +
225 std::vector<std::shared_ptr<typename Amg::ScalarProduct> > scalarproducts;
│ │ │ +
226
│ │ │ +
228 std::vector<std::shared_ptr<KAmgTwoGrid<Amg> > > ksolvers;
│ │ │ +
229 };
│ │ │ +
│ │ │ +
230
│ │ │ +
231
│ │ │ +
232 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
│ │ │ + │ │ │ +
234 const SmootherArgs& smootherArgs, const Parameters& params,
│ │ │ +
235 std::size_t ksteps, double reduction)
│ │ │ +
236 : amg(matrices, coarseSolver, smootherArgs, params),
│ │ │ +
237 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction)
│ │ │ +
238 {}
│ │ │ +
│ │ │ +
239
│ │ │ +
240
│ │ │ +
241 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
242 template<class C>
│ │ │ +
│ │ │ +
243 KAMG<M,X,S,P,K,A>::KAMG(const Operator& fineOperator, const C& criterion,
│ │ │ +
244 const SmootherArgs& smootherArgs,
│ │ │ +
245 std::size_t ksteps, double reduction,
│ │ │ +
246 const ParallelInformation& pinfo)
│ │ │ +
247 : amg(fineOperator, criterion, smootherArgs, pinfo),
│ │ │ +
248 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction)
│ │ │ +
249 {}
│ │ │ +
│ │ │ +
250
│ │ │ +
251
│ │ │ +
252 template<class M, class X, class S, class P, class K, class A>
│ │ │
│ │ │ - │ │ │ -
254 : smootherArgs_(args), criterion_(c)
│ │ │ -
255 {}
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
258 : coarseOperator_(other.coarseOperator_), smootherArgs_(other.smootherArgs_),
│ │ │ -
259 criterion_(other.criterion_)
│ │ │ -
260 {}
│ │ │ -
│ │ │ -
261private:
│ │ │ -
268 struct AMGInverseOperator : public InverseOperator<X,X>
│ │ │ -
269 {
│ │ │ -
270 AMGInverseOperator(const typename AMGType::Operator& op,
│ │ │ -
271 const Criterion& crit,
│ │ │ -
272 const typename AMGType::SmootherArgs& args)
│ │ │ -
273 : amg_(op, crit,args), first_(true)
│ │ │ -
274 {}
│ │ │ + │ │ │ +
254 {
│ │ │ +
255 amg.pre(x,b);
│ │ │ +
256 scalarproducts.reserve(amg.levels());
│ │ │ +
257 ksolvers.reserve(amg.levels());
│ │ │ +
258
│ │ │ +
259 typename OperatorHierarchy::ParallelMatrixHierarchy::Iterator
│ │ │ +
260 matrix = amg.matrices_->matrices().coarsest();
│ │ │ + │ │ │ +
262 pinfo = amg.matrices_->parallelInformation().coarsest();
│ │ │ +
263 bool hasCoarsest=(amg.levels()==amg.maxlevels());
│ │ │ +
264
│ │ │ +
265 if(hasCoarsest) {
│ │ │ +
266 if(matrix==amg.matrices_->matrices().finest())
│ │ │ +
267 return;
│ │ │ +
268 --matrix;
│ │ │ +
269 --pinfo;
│ │ │ +
270 ksolvers.push_back(std::shared_ptr<KAmgTwoGrid<Amg> >(new KAmgTwoGrid<Amg>(amg, amg.solver_)));
│ │ │ +
271 }else
│ │ │ +
272 ksolvers.push_back(std::shared_ptr<KAmgTwoGrid<Amg> >(new KAmgTwoGrid<Amg>(amg, std::shared_ptr<InverseOperator<Domain,Range> >())));
│ │ │ +
273
│ │ │ +
274 std::ostringstream s;
│ │ │
275
│ │ │ -
276 void apply(X& x, X& b, [[maybe_unused]] double reduction, [[maybe_unused]] InverseOperatorResult& res)
│ │ │ -
277 {
│ │ │ -
278 if(first_)
│ │ │ -
279 {
│ │ │ -
280 amg_.pre(x,b);
│ │ │ -
281 first_=false;
│ │ │ -
282 x_=x;
│ │ │ -
283 }
│ │ │ -
284 amg_.apply(x,b);
│ │ │ -
285 }
│ │ │ -
286
│ │ │ -
287 void apply(X& x, X& b, InverseOperatorResult& res)
│ │ │ -
288 {
│ │ │ -
289 return apply(x,b,1e-8,res);
│ │ │ -
290 }
│ │ │ +
276 if(matrix!=amg.matrices_->matrices().finest())
│ │ │ +
277 while(true) {
│ │ │ +
278 scalarproducts.push_back(createScalarProduct<X>(*pinfo,category()));
│ │ │ +
279 std::shared_ptr<InverseOperator<Domain,Range> > ks =
│ │ │ +
280 std::shared_ptr<InverseOperator<Domain,Range> >(new KrylovSolver(*matrix, *(scalarproducts.back()),
│ │ │ +
281 *(ksolvers.back()), levelDefectReduction,
│ │ │ +
282 maxLevelKrylovSteps, 0));
│ │ │ +
283 ksolvers.push_back(std::shared_ptr<KAmgTwoGrid<Amg> >(new KAmgTwoGrid<Amg>(amg, ks)));
│ │ │ +
284 --matrix;
│ │ │ +
285 --pinfo;
│ │ │ +
286 if(matrix==amg.matrices_->matrices().finest())
│ │ │ +
287 break;
│ │ │ +
288 }
│ │ │ +
289 }
│ │ │ +
│ │ │ +
290
│ │ │
291
│ │ │ -
293 virtual SolverCategory::Category category() const
│ │ │ -
294 {
│ │ │ -
295 return amg_.category();
│ │ │ -
296 }
│ │ │ -
297
│ │ │ -
298 ~AMGInverseOperator()
│ │ │ -
299 {
│ │ │ -
300 if(!first_)
│ │ │ -
301 amg_.post(x_);
│ │ │ -
302 }
│ │ │ -
303 AMGInverseOperator(const AMGInverseOperator& other)
│ │ │ -
304 : x_(other.x_), amg_(other.amg_), first_(other.first_)
│ │ │ -
305 {
│ │ │ -
306 }
│ │ │ -
307 private:
│ │ │ -
308 X x_;
│ │ │ -
309 AMGType amg_;
│ │ │ -
310 bool first_;
│ │ │ -
311 };
│ │ │ -
312
│ │ │ -
313public:
│ │ │ -
315 typedef AMGInverseOperator CoarseLevelSolver;
│ │ │ -
316
│ │ │ -
324 template<class P>
│ │ │ -
│ │ │ - │ │ │ -
326 {
│ │ │ -
327 coarseOperator_=transferPolicy.getCoarseLevelOperator();
│ │ │ -
328 AMGInverseOperator* inv = new AMGInverseOperator(*coarseOperator_,
│ │ │ -
329 criterion_,
│ │ │ -
330 smootherArgs_);
│ │ │ -
331
│ │ │ -
332 return inv; //std::shared_ptr<InverseOperator<X,X> >(inv);
│ │ │ -
333
│ │ │ -
334 }
│ │ │ -
│ │ │ -
335
│ │ │ -
336private:
│ │ │ -
338 std::shared_ptr<Operator> coarseOperator_;
│ │ │ -
340 SmootherArgs smootherArgs_;
│ │ │ -
342 Criterion criterion_;
│ │ │ -
343};
│ │ │ -
│ │ │ -
344
│ │ │ -
350template<class FO, class CSP, class S>
│ │ │ -
│ │ │ - │ │ │ -
352 public Preconditioner<typename FO::domain_type, typename FO::range_type>
│ │ │ -
353{
│ │ │ -
354public:
│ │ │ - │ │ │ -
358 typedef typename CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver;
│ │ │ - │ │ │ -
367 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ -
371 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ -
376 typedef typename CSP::Operator CoarseOperatorType;
│ │ │ -
380 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ -
384 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ -
388 typedef S SmootherType;
│ │ │ -
389
│ │ │ -
│ │ │ - │ │ │ -
405 std::shared_ptr<SmootherType> smoother,
│ │ │ - │ │ │ -
407 CoarseOperatorType>& policy,
│ │ │ -
408 CoarseLevelSolverPolicy& coarsePolicy,
│ │ │ -
409 std::size_t preSteps=1, std::size_t postSteps=1)
│ │ │ -
410 : operator_(&op), smoother_(smoother),
│ │ │ -
411 preSteps_(preSteps), postSteps_(postSteps)
│ │ │ -
412 {
│ │ │ -
413 policy_ = policy.clone();
│ │ │ -
414 policy_->createCoarseLevelSystem(*operator_);
│ │ │ -
415 coarseSolver_=coarsePolicy.createCoarseLevelSolver(*policy_);
│ │ │ -
416 }
│ │ │ -
│ │ │ -
417
│ │ │ -
│ │ │ - │ │ │ -
419 : operator_(other.operator_), coarseSolver_(new CoarseLevelSolver(*other.coarseSolver_)),
│ │ │ -
420 smoother_(other.smoother_), policy_(other.policy_->clone()),
│ │ │ -
421 preSteps_(other.preSteps_), postSteps_(other.postSteps_)
│ │ │ -
422 {}
│ │ │ -
│ │ │ -
423
│ │ │ -
│ │ │ - │ │ │ -
425 {
│ │ │ -
426 // Each instance has its own policy.
│ │ │ -
427 delete policy_;
│ │ │ -
428 delete coarseSolver_;
│ │ │ -
429 }
│ │ │ -
│ │ │ -
430
│ │ │ -
│ │ │ - │ │ │ -
432 {
│ │ │ -
433 smoother_->pre(x,b);
│ │ │ -
434 }
│ │ │ -
│ │ │ -
435
│ │ │ -
│ │ │ -
436 void post([[maybe_unused]] FineDomainType& x)
│ │ │ -
437 {}
│ │ │ -
│ │ │ -
438
│ │ │ -
│ │ │ - │ │ │ -
440 {
│ │ │ -
441 FineDomainType u(v);
│ │ │ -
442 FineRangeType rhs(d);
│ │ │ -
443 LevelContext context;
│ │ │ - │ │ │ -
445 context.pinfo=&info;
│ │ │ -
446 context.lhs=&u;
│ │ │ -
447 context.update=&v;
│ │ │ -
448 context.smoother=smoother_;
│ │ │ -
449 context.rhs=&rhs;
│ │ │ -
450 context.matrix=operator_;
│ │ │ -
451 // Presmoothing
│ │ │ -
452 presmooth(context, preSteps_);
│ │ │ -
453 //Coarse grid correction
│ │ │ -
454 policy_->moveToCoarseLevel(*context.rhs);
│ │ │ - │ │ │ -
456 coarseSolver_->apply(policy_->getCoarseLevelLhs(), policy_->getCoarseLevelRhs(), res);
│ │ │ -
457 *context.lhs=0;
│ │ │ -
458 policy_->moveToFineLevel(*context.lhs);
│ │ │ -
459 *context.update += *context.lhs;
│ │ │ -
460 // Postsmoothing
│ │ │ -
461 postsmooth(context, postSteps_);
│ │ │ -
462
│ │ │ -
463 }
│ │ │ -
│ │ │ -
464
│ │ │ -
│ │ │ - │ │ │ -
467 {
│ │ │ - │ │ │ -
469 }
│ │ │ -
│ │ │ -
470
│ │ │ -
471private:
│ │ │ -
475 struct LevelContext
│ │ │ -
476 {
│ │ │ -
478 typedef S SmootherType;
│ │ │ -
480 std::shared_ptr<SmootherType> smoother;
│ │ │ -
482 FineDomainType* lhs;
│ │ │ -
483 /*
│ │ │ -
484 * @brief The right hand side holding the current residual.
│ │ │ -
485 *
│ │ │ -
486 * This is passed to the smoother as the right hand side.
│ │ │ -
487 */
│ │ │ -
488 FineRangeType* rhs;
│ │ │ -
494 FineDomainType* update;
│ │ │ - │ │ │ -
502 const FineOperatorType* matrix;
│ │ │ -
503 };
│ │ │ -
504 const FineOperatorType* operator_;
│ │ │ -
506 CoarseLevelSolver* coarseSolver_;
│ │ │ -
508 std::shared_ptr<S> smoother_;
│ │ │ -
510 LevelTransferPolicy<FO,typename CSP::Operator>* policy_;
│ │ │ -
512 std::size_t preSteps_;
│ │ │ -
514 std::size_t postSteps_;
│ │ │ -
515};
│ │ │ -
│ │ │ -
516}// end namespace Amg
│ │ │ -
517}// end namespace Dune
│ │ │ -
518
│ │ │ -
520#endif
│ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ -
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ -
The AMG preconditioner.
│ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ -
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ -
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ -
Operator Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ +
292 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
│ │ │ + │ │ │ +
294 {
│ │ │ +
295 amg.post(x);
│ │ │ +
296
│ │ │ +
297 }
│ │ │ +
│ │ │ +
298
│ │ │ +
299 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
│ │ │ + │ │ │ +
301 {
│ │ │ +
302 if(ksolvers.size()==0)
│ │ │ +
303 {
│ │ │ +
304 Range td=d;
│ │ │ + │ │ │ +
306 amg.solver_->apply(v,td,res);
│ │ │ +
307 }else
│ │ │ +
308 {
│ │ │ +
309 typedef typename Amg::LevelContext LevelContext;
│ │ │ +
310 std::shared_ptr<LevelContext> levelContext(new LevelContext);
│ │ │ +
311 amg.initIteratorsWithFineLevel(*levelContext);
│ │ │ +
312 typedef typename std::vector<std::shared_ptr<KAmgTwoGrid<Amg> > >::iterator Iter;
│ │ │ +
313 for(Iter solver=ksolvers.begin(); solver!=ksolvers.end(); ++solver)
│ │ │ +
314 (*solver)->setLevelContext(levelContext);
│ │ │ +
315 ksolvers.back()->apply(v,d);
│ │ │ +
316 }
│ │ │ +
317 }
│ │ │ +
│ │ │ +
318
│ │ │ +
319 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
│ │ │ + │ │ │ +
321 {
│ │ │ +
322 return amg.maxlevels();
│ │ │ +
323 }
│ │ │ +
│ │ │ +
324
│ │ │ +
326 } // Amg
│ │ │ +
327} // Dune
│ │ │ +
328
│ │ │ +
329#endif
│ │ │ +
The AMG preconditioner.
│ │ │ +
Define general preconditioner interface.
│ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:300
│ │ │ +
X Domain
The domain type.
Definition amg.hh:87
│ │ │ +
KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms, std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1)
Construct a new amg with a specific coarse solver.
Definition kamg.hh:233
│ │ │ +
std::size_t maxlevels()
Definition kamg.hh:320
│ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ +
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ +
void post(Domain &x)
Clean up.
Definition kamg.hh:293
│ │ │ +
X Range
The range type.
Definition amg.hh:89
│ │ │
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition kamg.hh:253
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ +
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │
Definition allocator.hh:11
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ +
Amg::Domain Domain
the type of the domain.
Definition kamg.hh:157
│ │ │ +
Amg::SmootherArgs SmootherArgs
The type of the arguments for construction of the smoothers.
Definition kamg.hh:153
│ │ │ +
Amg::ParallelInformation ParallelInformation
the type of the parallelinformation to use.
Definition kamg.hh:151
│ │ │ +
Amg::CoarseSolver CoarseSolver
The type of the coarse solver.
Definition kamg.hh:149
│ │ │ +
Amg::OperatorHierarchy OperatorHierarchy
The type of the hierarchy of operators.
Definition kamg.hh:147
│ │ │ +
Amg::Range Range
The type of the range.
Definition kamg.hh:159
│ │ │ +
Amg::ScalarProduct ScalarProduct
The type of the scalar product.
Definition kamg.hh:163
│ │ │ +
AMG< M, X, S, PI, A > Amg
The type of the underlying AMG.
Definition kamg.hh:143
│ │ │ +
Amg::Operator Operator
the type of the lineatr operator.
Definition kamg.hh:155
│ │ │ +
Amg::ParallelInformationHierarchy ParallelInformationHierarchy
The type of the hierarchy of parallel information.
Definition kamg.hh:161
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:166
│ │ │ +
K KrylovSolver
The type of the Krylov solver for the cycle.
Definition kamg.hh:145
│ │ │ +
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ +
void pre(typename AMG::Domain &x, typename AMG::Range &b)
Prepare the preconditioner.
Definition kamg.hh:58
│ │ │ +
KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > coarseSolver)
Constructor.
Definition kamg.hh:53
│ │ │ +
~KAmgTwoGrid()
Destructor.
Definition kamg.hh:110
│ │ │ +
void post(typename AMG::Domain &x)
Clean up.
Definition kamg.hh:62
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:41
│ │ │ +
void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p)
Set the level context pointer.
Definition kamg.hh:104
│ │ │ +
InverseOperator< Domain, Range > * coarseSolver()
Get a pointer to the coarse grid solver.
Definition kamg.hh:95
│ │ │ +
void apply(typename AMG::Domain &v, const typename AMG::Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:66
│ │ │
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ -
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ -
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ -
Definition galerkin.hh:118
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ -
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ -
Definition indicescoarsener.hh:36
│ │ │ -
Definition pinfo.hh:28
│ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ -
Definition transfer.hh:32
│ │ │ -
Abstract base class for transfer between levels and creation of the coarse level system.
Definition twolevelmethod.hh:38
│ │ │ -
CO CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:57
│ │ │ -
virtual void moveToCoarseLevel(const FineRangeType &fineRhs)=0
Transfers the data to the coarse level.
│ │ │ -
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:48
│ │ │ -
virtual void createCoarseLevelSystem(const FineOperatorType &fineOperator)=0
Algebraically creates the coarse level system.
│ │ │ -
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:61
│ │ │ -
virtual ~LevelTransferPolicy()
Destructor.
Definition twolevelmethod.hh:124
│ │ │ -
CoarseDomainType lhs_
The coarse level lhs.
Definition twolevelmethod.hh:130
│ │ │ -
virtual LevelTransferPolicy * clone() const =0
Clone the current object.
│ │ │ -
CoarseDomainType & getCoarseLevelLhs()
Get the coarse level left hand side.
Definition twolevelmethod.hh:87
│ │ │ -
std::shared_ptr< CoarseOperatorType > operator_
the coarse level linear operator.
Definition twolevelmethod.hh:132
│ │ │ -
CoarseRangeType rhs_
The coarse level rhs.
Definition twolevelmethod.hh:128
│ │ │ -
virtual void moveToFineLevel(FineDomainType &fineLhs)=0
Updates the fine level linear system after the correction of the coarse levels system.
│ │ │ -
std::shared_ptr< CoarseOperatorType > & getCoarseLevelOperator()
Get the coarse level operator.
Definition twolevelmethod.hh:70
│ │ │ -
CoarseRangeType & getCoarseLevelRhs()
Get the coarse level right hand side.
Definition twolevelmethod.hh:78
│ │ │ -
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:44
│ │ │ -
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:65
│ │ │ -
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:52
│ │ │ -
A LeveTransferPolicy that used aggregation to construct the coarse level system.
Definition twolevelmethod.hh:143
│ │ │ -
C Criterion
Definition twolevelmethod.hh:147
│ │ │ -
AggregationLevelTransferPolicy(const Criterion &crit)
Definition twolevelmethod.hh:150
│ │ │ -
AggregationLevelTransferPolicy * clone() const
Clone the current object.
Definition twolevelmethod.hh:214
│ │ │ -
void moveToFineLevel(typename FatherType::FineDomainType &fineLhs)
Updates the fine level linear system after the correction of the coarse levels system.
Definition twolevelmethod.hh:207
│ │ │ -
void moveToCoarseLevel(const typename FatherType::FineRangeType &fineRhs)
Definition twolevelmethod.hh:200
│ │ │ -
SequentialInformation ParallelInformation
Definition twolevelmethod.hh:148
│ │ │ -
LevelTransferPolicy< O, O > FatherType
Definition twolevelmethod.hh:146
│ │ │ -
void createCoarseLevelSystem(const O &fineOperator)
Algebraically creates the coarse level system.
Definition twolevelmethod.hh:154
│ │ │ -
A policy class for solving the coarse level system using one step of AMG.
Definition twolevelmethod.hh:234
│ │ │ -
OneStepAMGCoarseSolverPolicy(const SmootherArgs &args, const Criterion &c)
Constructs the coarse solver policy.
Definition twolevelmethod.hh:253
│ │ │ -
AMGInverseOperator CoarseLevelSolver
The type of solver constructed for the coarse level.
Definition twolevelmethod.hh:315
│ │ │ -
OneStepAMGCoarseSolverPolicy(const OneStepAMGCoarseSolverPolicy &other)
Copy constructor.
Definition twolevelmethod.hh:257
│ │ │ -
O::range_type X
The type of the range and domain of the operator.
Definition twolevelmethod.hh:239
│ │ │ -
C Criterion
The type of the crition used for the aggregation within AMG.
Definition twolevelmethod.hh:241
│ │ │ -
Dune::Amg::SmootherTraits< S >::Arguments SmootherArgs
The type of the arguments used for constructing the smoother.
Definition twolevelmethod.hh:245
│ │ │ -
O Operator
The type of the linear operator used.
Definition twolevelmethod.hh:237
│ │ │ -
AMG< Operator, X, Smoother > AMGType
The type of the AMG construct on the coarse level.
Definition twolevelmethod.hh:247
│ │ │ -
CoarseLevelSolver * createCoarseLevelSolver(P &transferPolicy)
Constructs a coarse level solver.
Definition twolevelmethod.hh:325
│ │ │ -
S Smoother
The type of the smoother used in AMG.
Definition twolevelmethod.hh:243
│ │ │ -
Definition twolevelmethod.hh:353
│ │ │ -
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:380
│ │ │ -
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:371
│ │ │ -
TwoLevelMethod(const TwoLevelMethod &other)
Definition twolevelmethod.hh:418
│ │ │ -
void pre(FineDomainType &x, FineRangeType &b)
Definition twolevelmethod.hh:431
│ │ │ -
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:363
│ │ │ -
CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver
The type of the coarse level solver.
Definition twolevelmethod.hh:358
│ │ │ -
void apply(FineDomainType &v, const FineRangeType &d)
Definition twolevelmethod.hh:439
│ │ │ -
CSP CoarseLevelSolverPolicy
The type of the policy for constructing the coarse level solver.
Definition twolevelmethod.hh:356
│ │ │ -
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:384
│ │ │ -
TwoLevelMethod(const FineOperatorType &op, std::shared_ptr< SmootherType > smoother, const LevelTransferPolicy< FineOperatorType, CoarseOperatorType > &policy, CoarseLevelSolverPolicy &coarsePolicy, std::size_t preSteps=1, std::size_t postSteps=1)
Constructs a two level method.
Definition twolevelmethod.hh:404
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition twolevelmethod.hh:466
│ │ │ -
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:367
│ │ │ -
~TwoLevelMethod()
Definition twolevelmethod.hh:424
│ │ │ -
CSP::Operator CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:376
│ │ │ -
void post(FineDomainType &x)
Definition twolevelmethod.hh:436
│ │ │ -
S SmootherType
The type of the fine level smoother.
Definition twolevelmethod.hh:388
│ │ │ + │ │ │ +
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ +
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
virtual void apply(X &x, X &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1307
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,663 +1,433 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -twolevelmethod.hh │ │ │ │ +kamg.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_TWOLEVELMETHOD_HH │ │ │ │ -6#define DUNE_ISTL_TWOLEVELMETHOD_HH │ │ │ │ +5#ifndef DUNE_AMG_KAMG_HH │ │ │ │ +6#define DUNE_AMG_KAMG_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9 │ │ │ │ -10#include<_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ -11#include"_a_m_g_._h_h" │ │ │ │ -12#include"_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ -13#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -14 │ │ │ │ -22namespace _D_u_n_e │ │ │ │ -23{ │ │ │ │ -24namespace Amg │ │ │ │ -25{ │ │ │ │ -26 │ │ │ │ -36template │ │ │ │ -_3_7class _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ -38{ │ │ │ │ -39public: │ │ │ │ -_4_4 typedef FO _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ -_4_8 typedef typename FineOperatorType::range_type _F_i_n_e_R_a_n_g_e_T_y_p_e; │ │ │ │ -_5_2 typedef typename FineOperatorType::domain_type _F_i_n_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ -_5_7 typedef CO _C_o_a_r_s_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ -_6_1 typedef typename CoarseOperatorType::range_type _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e; │ │ │ │ -_6_5 typedef typename CoarseOperatorType::domain_type _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ -_7_0 std::shared_ptr& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_O_p_e_r_a_t_o_r() │ │ │ │ -71 { │ │ │ │ -72 return _o_p_e_r_a_t_o_r__; │ │ │ │ -73 } │ │ │ │ -_7_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_R_h_s() │ │ │ │ -79 { │ │ │ │ -80 return _r_h_s__; │ │ │ │ -81 } │ │ │ │ -82 │ │ │ │ -_8_7 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_L_h_s() │ │ │ │ -88 { │ │ │ │ -89 return _l_h_s__; │ │ │ │ -90 } │ │ │ │ -_1_0_0 virtual void _m_o_v_e_T_o_C_o_a_r_s_e_L_e_v_e_l(const _F_i_n_e_R_a_n_g_e_T_y_p_e& fineRhs)=0; │ │ │ │ -_1_1_0 virtual void _m_o_v_e_T_o_F_i_n_e_L_e_v_e_l(_F_i_n_e_D_o_m_a_i_n_T_y_p_e& fineLhs)=0; │ │ │ │ -_1_1_8 virtual void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e& │ │ │ │ -fineOperator)=0; │ │ │ │ -119 │ │ │ │ -_1_2_1 virtual _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y* _c_l_o_n_e() const =0; │ │ │ │ +8#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ +9#include "_a_m_g_._h_h" │ │ │ │ +10 │ │ │ │ +11namespace _D_u_n_e │ │ │ │ +12{ │ │ │ │ +13 namespace Amg │ │ │ │ +14 { │ │ │ │ +15 │ │ │ │ +30 template │ │ │ │ +_3_1 class _K_A_m_g_T_w_o_G_r_i_d │ │ │ │ +32 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +33 { │ │ │ │ +35 typedef typename _A_M_G_:_:_D_o_m_a_i_n Domain; │ │ │ │ +37 typedef typename _A_M_G_:_:_R_a_n_g_e Range; │ │ │ │ +38 public: │ │ │ │ +39 │ │ │ │ +_4_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ +42 { │ │ │ │ +43 return amg_._c_a_t_e_g_o_r_y(); │ │ │ │ +44 }; │ │ │ │ +45 │ │ │ │ +_5_3 _K_A_m_g_T_w_o_G_r_i_d(_A_M_G& amg, std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_> > │ │ │ │ +_c_o_a_r_s_e_S_o_l_v_e_r) │ │ │ │ +54 : amg_(amg), coarseSolver_(_c_o_a_r_s_e_S_o_l_v_e_r) │ │ │ │ +55 {} │ │ │ │ +56 │ │ │ │ +_5_8 void _p_r_e([[maybe_unused]] typename _A_M_G_:_:_D_o_m_a_i_n& x, [[maybe_unused]] typename │ │ │ │ +_A_M_G_:_:_R_a_n_g_e& b) │ │ │ │ +59 {} │ │ │ │ +60 │ │ │ │ +_6_2 void _p_o_s_t([[maybe_unused]] typename _A_M_G_:_:_D_o_m_a_i_n& x) │ │ │ │ +63 {} │ │ │ │ +64 │ │ │ │ +_6_6 void _a_p_p_l_y(typename _A_M_G_:_:_D_o_m_a_i_n& v, const typename _A_M_G_:_:_R_a_n_g_e& d) │ │ │ │ +67 { │ │ │ │ +68 // Copy data │ │ │ │ +69 *levelContext_->update=0; │ │ │ │ +70 *levelContext_->rhs = d; │ │ │ │ +71 *levelContext_->lhs = v; │ │ │ │ +72 │ │ │ │ +73 _p_r_e_s_m_o_o_t_h(*levelContext_, amg_.preSteps_); │ │ │ │ +74 bool processFineLevel = │ │ │ │ +75 amg_.moveToCoarseLevel(*levelContext_); │ │ │ │ +76 │ │ │ │ +77 if(processFineLevel) { │ │ │ │ +78 typename _A_M_G_:_:_R_a_n_g_e b=*levelContext_->rhs; │ │ │ │ +79 typename _A_M_G_:_:_D_o_m_a_i_n x=*levelContext_->update; │ │ │ │ +80 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ +81 coarseSolver_->apply(x, b, res); │ │ │ │ +82 *levelContext_->update=x; │ │ │ │ +83 } │ │ │ │ +84 │ │ │ │ +85 amg_.moveToFineLevel(*levelContext_, processFineLevel); │ │ │ │ +86 │ │ │ │ +87 _p_o_s_t_s_m_o_o_t_h(*levelContext_, amg_.postSteps_); │ │ │ │ +88 v=*levelContext_->update; │ │ │ │ +89 } │ │ │ │ +90 │ │ │ │ +_9_5 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_>* _c_o_a_r_s_e_S_o_l_v_e_r() │ │ │ │ +96 { │ │ │ │ +97 return coarseSolver_; │ │ │ │ +98 } │ │ │ │ +99 │ │ │ │ +_1_0_4 void _s_e_t_L_e_v_e_l_C_o_n_t_e_x_t(std::shared_ptr p) │ │ │ │ +105 { │ │ │ │ +106 levelContext_=p; │ │ │ │ +107 } │ │ │ │ +108 │ │ │ │ +_1_1_0 _~_K_A_m_g_T_w_o_G_r_i_d() │ │ │ │ +111 {} │ │ │ │ +112 │ │ │ │ +113 private: │ │ │ │ +115 _A_M_G& amg_; │ │ │ │ +117 std::shared_ptr > coarseSolver_; │ │ │ │ +119 std::shared_ptr levelContext_; │ │ │ │ +120 }; │ │ │ │ +121 │ │ │ │ 122 │ │ │ │ -_1_2_4 virtual _~_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(){} │ │ │ │ -125 │ │ │ │ -126 protected: │ │ │ │ -_1_2_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e _r_h_s__; │ │ │ │ -_1_3_0 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e _l_h_s__; │ │ │ │ -_1_3_2 std::shared_ptr _o_p_e_r_a_t_o_r__; │ │ │ │ -133}; │ │ │ │ -134 │ │ │ │ -140template │ │ │ │ -_1_4_1class _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ -142 : public _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ -143{ │ │ │ │ -144 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e_> │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ -145public: │ │ │ │ -_1_4_6 typedef _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_O_,_O_> _F_a_t_h_e_r_T_y_p_e; │ │ │ │ -_1_4_7 typedef C _C_r_i_t_e_r_i_o_n; │ │ │ │ -_1_4_8 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -149 │ │ │ │ -_1_5_0 _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(const _C_r_i_t_e_r_i_o_n& crit) │ │ │ │ -151 : criterion_(crit) │ │ │ │ -152 {} │ │ │ │ -153 │ │ │ │ -_1_5_4 void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const O& fineOperator) │ │ │ │ -155 { │ │ │ │ -156 prolongDamp_ = criterion_.getProlongationDampingFactor(); │ │ │ │ -157 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> productBuilder; │ │ │ │ -158 typedef typename _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_> │ │ │ │ -_M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ -159 typedef typename _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h,_D_u_n_e_:_:_A_m_g_:_: │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -160 _D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s,Dune::IdentityMap,Dune::IdentityMap> │ │ │ │ -_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ -161 _M_a_t_r_i_x_G_r_a_p_h mg(fineOperator.getmat()); │ │ │ │ -162 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pg(mg,Dune::IdentityMap(),Dune::IdentityMap()); │ │ │ │ -163 typedef NegateSet OverlapFlags; │ │ │ │ +123 │ │ │ │ +137 template, class A=std::allocator > │ │ │ │ +_1_3_9 class _K_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +140 { │ │ │ │ +141 public: │ │ │ │ +_1_4_3 typedef _A_M_G_<_M_,_X_,_S_,_P_I_,_A_> _A_m_g; │ │ │ │ +_1_4_5 typedef K _K_r_y_l_o_v_S_o_l_v_e_r; │ │ │ │ +_1_4_7 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ +_1_4_9 typedef typename _A_m_g_:_:_C_o_a_r_s_e_S_o_l_v_e_r _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ +_1_5_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +_1_5_3 typedef typename _A_m_g_:_:_S_m_o_o_t_h_e_r_A_r_g_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ +_1_5_5 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r _O_p_e_r_a_t_o_r; │ │ │ │ +_1_5_7 typedef typename _A_m_g_:_:_D_o_m_a_i_n _D_o_m_a_i_n; │ │ │ │ +_1_5_9 typedef typename _A_m_g_:_:_R_a_n_g_e _R_a_n_g_e; │ │ │ │ +_1_6_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ +_1_6_3 typedef typename _A_m_g_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t _S_c_a_l_a_r_P_r_o_d_u_c_t; │ │ │ │ 164 │ │ │ │ -165 aggregatesMap_ = std::make_shared(pg._m_a_x_V_e_r_t_e_x()+1); │ │ │ │ -166 │ │ │ │ -167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates; │ │ │ │ -168 │ │ │ │ -169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = │ │ │ │ -170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, │ │ │ │ -true); │ │ │ │ -171 std::cout<<"no aggregates="< │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: transfer.hh File Reference │ │ │ +dune-istl: graph.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,49 +71,94 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Functions
│ │ │ + │ │ │ │ │ │
│ │ │ │ │ │ -

Prolongation and restriction for amg. │ │ │ +

Provides classes for building the matrix graph. │ │ │ More...

│ │ │ -
#include <dune/istl/bvector.hh>
│ │ │ -#include <dune/istl/matrixredistribute.hh>
│ │ │ -#include <dune/istl/paamg/pinfo.hh>
│ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ -#include <dune/istl/paamg/aggregates.hh>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ +
#include <cstddef>
│ │ │ +#include <algorithm>
│ │ │ +#include <vector>
│ │ │ +#include <cassert>
│ │ │ +#include <limits>
│ │ │ +#include <dune/common/typetraits.hh>
│ │ │ +#include <dune/common/iteratorfacades.hh>
│ │ │ +#include <dune/istl/istlexception.hh>
│ │ │ +#include <dune/common/propertymap.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::Transfer< V1, V2, T >
class  Dune::Amg::MatrixGraph< M >
 The (undirected) graph of a matrix. More...
 
class  Dune::Amg::Transfer< V, V1, SequentialInformation >
class  Dune::Amg::MatrixGraph< M >::EdgeIteratorT< C >
 Iterator over all edges starting from a vertex. More...
 
class  Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > >
class  Dune::Amg::MatrixGraph< M >::VertexIteratorT< C >
 The vertex iterator type of the graph. More...
 
class  Dune::Amg::SubGraph< G, T >
 A subgraph of a graph. More...
 
class  Dune::Amg::SubGraph< G, T >::EdgeIndexMap
 An index map for mapping the edges to indices. More...
 
class  Dune::Amg::SubGraph< G, T >::EdgeIterator
 The edge iterator of the graph. More...
 
class  Dune::Amg::SubGraph< G, T >::VertexIterator
 The vertex iterator of the graph. More...
 
class  Dune::Amg::VertexPropertiesGraph< G, VP, VM >
 Attaches properties to the vertices of a graph. More...
 
class  Dune::Amg::VertexPropertiesGraph< G, VP, VM >::VertexIteratorT< C >
 
class  Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >
 Attaches properties to the edges and vertices of a graph. More...
 
class  Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::EdgeIteratorT< C >
 
class  Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::VertexIteratorT< C >
 
class  Dune::Amg::GraphVertexPropertiesSelector< G >
 Wrapper to access the internal edge properties of a graph via operator[]() More...
 
class  Dune::Amg::GraphEdgePropertiesSelector< G >
 Wrapper to access the internal vertex properties of a graph via operator[]() More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<class G , class V >
int Dune::Amg::visitNeighbours (const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
 Visit all neighbour vertices of a vertex in a graph.
 
│ │ │

Detailed Description

│ │ │ -

Prolongation and restriction for amg.

│ │ │ +

Provides classes for building the matrix graph.

│ │ │
Author
Markus Blatt
│ │ │ +

During the coarsening process in AMG the matrix graph together with the dependencies, what connections in the graph are considered strong or weak, what vertices are isolated, etc., have to build. This information will be contained in the MatrixGraph class.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,37 +1,85 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -transfer.hh File Reference │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +graph.hh File Reference │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Prolongation and restriction for amg. _M_o_r_e_._._. │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_p_i_n_f_o_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ -#include │ │ │ │ +Provides classes for building the matrix graph. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_1_,_ _V_2_,_ _T_ _> │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_ _M_ _> │ │ │ │ +  The (undirected) graph of a matrix. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_ _M_ _>_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ +  Iterator over all edges starting from a vertex. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _> │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_ _M_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ +  The vertex iterator type of the graph. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _> │ │ │ │ +  A subgraph of a graph. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _>_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +  An index map for mapping the edges to indices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _>_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +  The edge iterator of the graph. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +  The vertex iterator of the graph. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _V_M_ _> │ │ │ │ +  Attaches properties to the vertices of a graph. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _V_M_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _E_P_,_ _V_M_,_ _E_M_ _> │ │ │ │ +  Attaches properties to the edges and vertices of a graph. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _E_P_,_ _V_M_,_ _E_M_ _>_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _E_P_,_ _V_M_,_ _E_M_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_<_ _G_ _> │ │ │ │ +  Wrapper to access the internal edge properties of a graph via _o_p_e_r_a_t_o_r │ │ │ │ + _[_]_(_) _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_<_ _G_ _> │ │ │ │ +  Wrapper to access the internal vertex properties of a graph via │ │ │ │ + _o_p_e_r_a_t_o_r_[_]_(_) _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +int  _D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s (const G &graph, const typename G:: │ │ │ │ + VertexDescriptor &vertex, V &visitor) │ │ │ │ +  Visit all neighbour vertices of a vertex in a graph. │ │ │ │ +  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Prolongation and restriction for amg. │ │ │ │ +Provides classes for building the matrix graph. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ +During the coarsening process in AMG the matrix graph together with the │ │ │ │ +dependencies, what connections in the graph are considered strong or weak, what │ │ │ │ +vertices are isolated, etc., have to build. This information will be contained │ │ │ │ +in the MatrixGraph class. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: transfer.hh Source File │ │ │ +dune-istl: graph.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,246 +74,1821 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
transfer.hh
│ │ │ +
graph.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMGTRANSFER_HH
│ │ │ -
6#define DUNE_AMGTRANSFER_HH
│ │ │ +
5#ifndef DUNE_AMG_GRAPH_HH
│ │ │ +
6#define DUNE_AMG_GRAPH_HH
│ │ │
7
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
13#include <dune/common/exceptions.hh>
│ │ │ -
14
│ │ │ -
15namespace Dune
│ │ │ -
16{
│ │ │ -
17 namespace Amg
│ │ │ -
18 {
│ │ │ -
19
│ │ │ -
30 template<class V1, class V2, class T>
│ │ │ -
│ │ │ - │ │ │ -
32 {
│ │ │ -
33
│ │ │ -
34 public:
│ │ │ -
35 typedef V1 Vertex;
│ │ │ -
36 typedef V2 Vector;
│ │ │ -
37
│ │ │ -
38 template<typename T1, typename R>
│ │ │ -
39 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ -
40 Vector& fineRedist,T1 damp, R& redistributor=R());
│ │ │ -
41
│ │ │ -
42 template<typename T1, typename R>
│ │ │ -
43 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ -
44 T1 damp);
│ │ │ -
45
│ │ │ -
46 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ -
47 T& comm);
│ │ │ -
48 };
│ │ │ -
│ │ │ -
49
│ │ │ -
50 template<class V,class V1>
│ │ │ -
│ │ │ - │ │ │ -
52 {
│ │ │ -
53 public:
│ │ │ -
54 typedef V Vertex;
│ │ │ -
55 typedef V1 Vector;
│ │ │ - │ │ │ -
57 template<typename T1>
│ │ │ -
58 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ -
59 Vector& fineRedist, T1 damp,
│ │ │ - │ │ │ -
61 const Redist& redist=Redist());
│ │ │ -
62 template<typename T1>
│ │ │ -
63 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ -
64 T1 damp,
│ │ │ - │ │ │ -
66
│ │ │ +
8#include <cstddef>
│ │ │ +
9#include <algorithm>
│ │ │ +
10#include <vector>
│ │ │ +
11#include <cassert>
│ │ │ +
12#include <limits>
│ │ │ +
13#include <dune/common/typetraits.hh>
│ │ │ +
14#include <dune/common/iteratorfacades.hh>
│ │ │ + │ │ │ +
16#include <dune/common/propertymap.hh>
│ │ │ +
17
│ │ │ +
18namespace Dune
│ │ │ +
19{
│ │ │ +
20 namespace Amg
│ │ │ +
21 {
│ │ │ +
49 template<class M>
│ │ │ +
│ │ │ + │ │ │ +
51 {
│ │ │ +
52 public:
│ │ │ +
56 typedef M Matrix;
│ │ │ +
57
│ │ │ +
61 typedef typename std::remove_const<M>::type MutableMatrix;
│ │ │ +
62
│ │ │ +
66 typedef typename M::block_type Weight;
│ │ │
67
│ │ │ -
68 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ -
69 const SequentialInformation& comm);
│ │ │ -
70 };
│ │ │ -
│ │ │ -
71
│ │ │ -
72#if HAVE_MPI
│ │ │ -
73
│ │ │ -
74 template<class V,class V1, class T1, class T2>
│ │ │ -
│ │ │ - │ │ │ -
76 {
│ │ │ -
77 public:
│ │ │ -
78 typedef V Vertex;
│ │ │ -
79 typedef V1 Vector;
│ │ │ - │ │ │ -
81 template<typename T3>
│ │ │ -
82 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ -
83 Vector& fineRedist, T3 damp, OwnerOverlapCopyCommunication<T1,T2>& comm,
│ │ │ -
84 const Redist& redist);
│ │ │ -
85 template<typename T3>
│ │ │ -
86 static void prolongateVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, Vector& fine,
│ │ │ - │ │ │ +
73 typedef typename M::size_type VertexDescriptor;
│ │ │ +
74
│ │ │ +
80 typedef std::ptrdiff_t EdgeDescriptor;
│ │ │ +
81
│ │ │ +
82 enum {
│ │ │ +
83 /*
│ │ │ +
84 * @brief Whether Matrix is mutable.
│ │ │ +
85 */
│ │ │ +
86 mutableMatrix = std::is_same<M, typename std::remove_const<M>::type>::value
│ │ │ +
87 };
│ │ │
88
│ │ │ -
89 static void restrictVector(const AggregatesMap<Vertex>& aggregates, Vector& coarse, const Vector& fine,
│ │ │ - │ │ │ -
91 };
│ │ │ -
│ │ │ -
92
│ │ │ -
93#endif
│ │ │ -
94
│ │ │ -
95 template<class V, class V1>
│ │ │ -
96 template<typename T>
│ │ │ -
97 inline void
│ │ │ -
│ │ │ - │ │ │ -
99 Vector& coarse, Vector& fine,
│ │ │ -
100 [[maybe_unused]] Vector& fineRedist,
│ │ │ -
101 T damp,
│ │ │ -
102 [[maybe_unused]] const SequentialInformation& comm,
│ │ │ -
103 [[maybe_unused]] const Redist& redist)
│ │ │ -
104 {
│ │ │ -
105 prolongateVector(aggregates, coarse, fine, damp);
│ │ │ -
106 }
│ │ │ -
│ │ │ -
107 template<class V, class V1>
│ │ │ -
108 template<typename T>
│ │ │ -
109 inline void
│ │ │ -
│ │ │ - │ │ │ -
111 Vector& coarse, Vector& fine,
│ │ │ -
112 T damp,
│ │ │ -
113 [[maybe_unused]] const SequentialInformation& comm)
│ │ │ -
114 {
│ │ │ -
115 typedef typename Vector::iterator Iterator;
│ │ │ -
116
│ │ │ -
117 Iterator end = coarse.end();
│ │ │ -
118 Iterator begin= coarse.begin();
│ │ │ -
119 for(; begin!=end; ++begin)
│ │ │ -
120 *begin*=damp;
│ │ │ -
121 end=fine.end();
│ │ │ -
122 begin=fine.begin();
│ │ │ -
123
│ │ │ -
124 for(Iterator block=begin; block != end; ++block) {
│ │ │ -
125 std::ptrdiff_t index=block-begin;
│ │ │ -
126 const Vertex& vertex = aggregates[index];
│ │ │ - │ │ │ -
128 *block += coarse[aggregates[index]];
│ │ │ -
129 }
│ │ │ -
130 }
│ │ │ -
│ │ │ -
131
│ │ │ -
132 template<class V, class V1>
│ │ │ -
133 inline void
│ │ │ -
│ │ │ - │ │ │ -
135 Vector& coarse,
│ │ │ -
136 const Vector& fine,
│ │ │ -
137 [[maybe_unused]] const SequentialInformation& comm)
│ │ │ -
138 {
│ │ │ -
139 // Set coarse vector to zero
│ │ │ -
140 coarse=0;
│ │ │ -
141
│ │ │ -
142 typedef typename Vector::const_iterator Iterator;
│ │ │ -
143 Iterator end = fine.end();
│ │ │ -
144 Iterator begin=fine.begin();
│ │ │ -
145
│ │ │ -
146 for(Iterator block=begin; block != end; ++block) {
│ │ │ -
147 const Vertex& vertex = aggregates[block-begin];
│ │ │ - │ │ │ -
149 coarse[vertex] += *block;
│ │ │ -
150 }
│ │ │ -
151 }
│ │ │ -
│ │ │ -
152
│ │ │ -
153#if HAVE_MPI
│ │ │ -
154 template<class V, class V1, class T1, class T2>
│ │ │ -
155 template<typename T3>
│ │ │ -
│ │ │ -
156 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::prolongateVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ -
157 Vector& coarse, Vector& fine,
│ │ │ -
158 Vector& fineRedist, T3 damp,
│ │ │ - │ │ │ -
160 const Redist& redist)
│ │ │ -
161 {
│ │ │ -
162 if(fineRedist.size()>0)
│ │ │ -
163 // we operated on the coarse level
│ │ │ -
164 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fineRedist, damp);
│ │ │ +
89
│ │ │ +
93 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
95 {
│ │ │ +
96
│ │ │ +
97 public:
│ │ │ +
101 typedef typename std::remove_const<C>::type MutableContainer;
│ │ │ +
105 typedef const typename std::remove_const<C>::type ConstContainer;
│ │ │ +
106
│ │ │ +
107 friend class EdgeIteratorT<MutableContainer>;
│ │ │ +
108 friend class EdgeIteratorT<ConstContainer>;
│ │ │ +
109
│ │ │ +
110 enum {
│ │ │ +
112 isMutable = std::is_same<C, MutableContainer>::value
│ │ │ +
113 };
│ │ │ +
114
│ │ │ +
118 typedef typename std::conditional<isMutable && C::mutableMatrix,typename Matrix::row_type::Iterator,
│ │ │ +
119 typename Matrix::row_type::ConstIterator>::type
│ │ │ + │ │ │ +
121
│ │ │ +
125 typedef typename std::conditional<isMutable && C::mutableMatrix,typename M::block_type,
│ │ │ +
126 const typename M::block_type>::type
│ │ │ + │ │ │ +
128
│ │ │ + │ │ │ +
137 const ColIterator& end, const EdgeDescriptor& edge);
│ │ │ +
138
│ │ │ + │ │ │ +
146
│ │ │ +
151 template<class C1>
│ │ │ + │ │ │ +
153
│ │ │ +
154 typedef typename std::conditional<std::is_same<C, typename std::remove_const<C>::type>::value && C::mutableMatrix,
│ │ │ +
155 typename M::block_type, const typename M::block_type>::type
│ │ │ + │ │ │ +
157
│ │ │ + │ │ │ +
162
│ │ │ + │ │ │
165
│ │ │ -
166 // TODO This could be accomplished with one communication, too!
│ │ │ -
167 redist.redistributeBackward(fine, fineRedist);
│ │ │ -
168 comm.copyOwnerToAll(fine,fine);
│ │ │ -
169 }
│ │ │ -
│ │ │ -
170
│ │ │ -
171 template<class V, class V1, class T1, class T2>
│ │ │ -
172 template<typename T3>
│ │ │ -
│ │ │ - │ │ │ -
174 const AggregatesMap<Vertex>& aggregates,
│ │ │ -
175 Vector& coarse, Vector& fine, T3 damp,
│ │ │ -
176 [[maybe_unused]] OwnerOverlapCopyCommunication<T1,T2>& comm)
│ │ │ -
177 {
│ │ │ -
178 Transfer<V,V1,SequentialInformation>::prolongateVector(aggregates, coarse, fine, damp);
│ │ │ -
179 }
│ │ │ -
│ │ │ -
180 template<class V, class V1, class T1, class T2>
│ │ │ -
│ │ │ -
181 inline void Transfer<V,V1,OwnerOverlapCopyCommunication<T1,T2> >::restrictVector(const AggregatesMap<Vertex>& aggregates,
│ │ │ -
182 Vector& coarse, const Vector& fine,
│ │ │ - │ │ │ -
184 {
│ │ │ - │ │ │ -
186 // We need this here to avoid it in the smoothers on the coarse level.
│ │ │ -
187 // There (in the preconditioner d is const.
│ │ │ -
188 comm.project(coarse);
│ │ │ -
189 }
│ │ │ -
│ │ │ -
190#endif
│ │ │ -
192 } // namspace Amg
│ │ │ -
193} // namspace Dune
│ │ │ -
194#endif
│ │ │ - │ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ -
Functionality for redistributing a sparse matrix.
│ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ +
167 bool operator!=(const EdgeIteratorT<typename std::remove_const<C>::type>& other) const;
│ │ │ +
168
│ │ │ +
170 bool operator!=(const EdgeIteratorT<const typename std::remove_const<C>::type>& other) const;
│ │ │ +
171
│ │ │ +
173 bool operator==(const EdgeIteratorT<typename std::remove_const<C>::type>& other) const;
│ │ │ +
174
│ │ │ +
176 bool operator==(const EdgeIteratorT<const typename std::remove_const<C>::type>& other) const;
│ │ │ +
177
│ │ │ + │ │ │ +
180
│ │ │ + │ │ │ +
183
│ │ │ +
185 const EdgeDescriptor& operator*() const;
│ │ │ +
186
│ │ │ + │ │ │ +
189
│ │ │ +
190 private:
│ │ │ +
192 VertexDescriptor source_;
│ │ │ +
194 ColIterator block_;
│ │ │ +
195 /***
│ │ │ +
196 * @brief The column iterator positioned at the end of the row
│ │ │ +
197 * of vertex source_
│ │ │ +
198 */
│ │ │ +
199 ColIterator blockEnd_;
│ │ │ +
201 EdgeDescriptor edge_;
│ │ │ +
202 };
│ │ │ +
│ │ │ +
203
│ │ │ +
207 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
209 {
│ │ │ +
210 public:
│ │ │ +
214 typedef typename std::remove_const<C>::type MutableContainer;
│ │ │ +
218 typedef const typename std::remove_const<C>::type ConstContainer;
│ │ │ +
219
│ │ │ +
220 friend class VertexIteratorT<MutableContainer>;
│ │ │ +
221 friend class VertexIteratorT<ConstContainer>;
│ │ │ +
222
│ │ │ +
223 enum {
│ │ │ +
225 isMutable = std::is_same<C, MutableContainer>::value
│ │ │ +
226 };
│ │ │ +
227
│ │ │ +
233 explicit VertexIteratorT(C* graph, const VertexDescriptor& current);
│ │ │ +
234
│ │ │ +
242 explicit VertexIteratorT(const VertexDescriptor& current);
│ │ │ +
243
│ │ │ + │ │ │ +
245
│ │ │ + │ │ │ +
251
│ │ │ + │ │ │ +
254
│ │ │ + │ │ │ +
257
│ │ │ + │ │ │ +
260
│ │ │ + │ │ │ +
263
│ │ │ +
264 typedef typename std::conditional<std::is_same<C, typename std::remove_const<C>::type>::value && C::mutableMatrix,
│ │ │ +
265 typename M::block_type, const typename M::block_type>::type
│ │ │ + │ │ │ + │ │ │ +
269
│ │ │ + │ │ │ +
275
│ │ │ + │ │ │ +
282
│ │ │ + │ │ │ +
289
│ │ │ +
290 private:
│ │ │ +
291 C* graph_;
│ │ │ +
292 VertexDescriptor current_;
│ │ │ +
293 };
│ │ │ +
│ │ │ +
294
│ │ │ + │ │ │ +
299
│ │ │ + │ │ │ +
304
│ │ │ + │ │ │ +
309
│ │ │ + │ │ │ +
314
│ │ │ + │ │ │ +
320
│ │ │ + │ │ │ +
325
│ │ │ + │ │ │ +
331
│ │ │ + │ │ │ +
337
│ │ │ + │ │ │ +
343
│ │ │ + │ │ │ +
349
│ │ │ + │ │ │ +
357
│ │ │ + │ │ │ +
365
│ │ │ +
366
│ │ │ + │ │ │ +
374
│ │ │ + │ │ │ +
382
│ │ │ + │ │ │ +
388
│ │ │ +
393 const Matrix& matrix() const;
│ │ │ +
394
│ │ │ +
398 std::size_t noVertices() const;
│ │ │ +
399
│ │ │ + │ │ │ +
407
│ │ │ +
411 std::size_t noEdges() const;
│ │ │ +
412
│ │ │ + │ │ │ +
420 const VertexDescriptor& target) const;
│ │ │ +
421
│ │ │ +
422 private:
│ │ │ +
424 Matrix& matrix_;
│ │ │ +
426 EdgeDescriptor* start_;
│ │ │ +
428 MatrixGraph(const MatrixGraph&);
│ │ │ +
429
│ │ │ +
430 };
│ │ │ +
│ │ │ +
431
│ │ │ +
441 template<class G, class T>
│ │ │ +
│ │ │ + │ │ │ +
443 {
│ │ │ +
444 public:
│ │ │ +
448 typedef G Graph;
│ │ │ +
449
│ │ │ +
454 typedef T Excluded;
│ │ │ +
455
│ │ │ +
459 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ +
460
│ │ │ + │ │ │ +
462
│ │ │ +
│ │ │ + │ │ │ +
470 {
│ │ │ +
471 public:
│ │ │ +
472 typedef ReadablePropertyMapTag Category;
│ │ │ +
473
│ │ │ +
│ │ │ +
474 EdgeIndexMap(const EdgeDescriptor& firstEdge)
│ │ │ +
475 : firstEdge_(firstEdge)
│ │ │ +
476 {}
│ │ │ +
│ │ │ +
477
│ │ │ +
│ │ │ + │ │ │ +
480 : firstEdge_(emap.firstEdge_)
│ │ │ +
481 {}
│ │ │ +
│ │ │ +
482
│ │ │ +
│ │ │ +
483 std::size_t operator[](const EdgeDescriptor& edge) const
│ │ │ +
484 {
│ │ │ +
485 return edge-firstEdge_;
│ │ │ +
486 }
│ │ │ +
│ │ │ +
487 private:
│ │ │ +
489 EdgeDescriptor firstEdge_;
│ │ │ + │ │ │ +
492 {}
│ │ │ +
493 };
│ │ │ +
│ │ │ +
494
│ │ │ + │ │ │ +
500
│ │ │ +
│ │ │ +
504 class EdgeIterator : public RandomAccessIteratorFacade<EdgeIterator,const EdgeDescriptor>
│ │ │ +
505 {
│ │ │ +
506 public:
│ │ │ +
512 explicit EdgeIterator(const VertexDescriptor& source, const EdgeDescriptor& edge);
│ │ │ +
513
│ │ │ +
521 explicit EdgeIterator(const EdgeDescriptor& edge);
│ │ │ +
522
│ │ │ +
524 bool equals(const EdgeIterator& other) const;
│ │ │ +
525
│ │ │ + │ │ │ +
528
│ │ │ + │ │ │ +
531
│ │ │ +
532 EdgeIterator& advance(std::ptrdiff_t n);
│ │ │ +
533
│ │ │ + │ │ │ +
536
│ │ │ +
538 const VertexDescriptor& target() const;
│ │ │ +
539
│ │ │ +
541 const VertexDescriptor& source() const;
│ │ │ +
542
│ │ │ +
543 std::ptrdiff_t distanceTo(const EdgeIterator& other) const;
│ │ │ +
544
│ │ │ +
545 private:
│ │ │ +
547 VertexDescriptor source_;
│ │ │ +
552 EdgeDescriptor edge_;
│ │ │ +
553 };
│ │ │ +
│ │ │ +
554
│ │ │ +
│ │ │ + │ │ │ +
559 : public ForwardIteratorFacade<VertexIterator,const VertexDescriptor>
│ │ │ +
560 {
│ │ │ +
561 public:
│ │ │ +
568 explicit VertexIterator(const SubGraph<G,T>* graph, const VertexDescriptor& current,
│ │ │ +
569 const VertexDescriptor& end);
│ │ │ +
570
│ │ │ +
571
│ │ │ +
578 explicit VertexIterator(const VertexDescriptor& current);
│ │ │ +
579
│ │ │ + │ │ │ +
582
│ │ │ +
584 bool equals(const VertexIterator& other) const;
│ │ │ +
585
│ │ │ + │ │ │ +
591
│ │ │ + │ │ │ +
598
│ │ │ + │ │ │ +
605
│ │ │ +
606 private:
│ │ │ +
608 const SubGraph<Graph,T>* graph_;
│ │ │ +
610 VertexDescriptor current_;
│ │ │ +
612 VertexDescriptor end_;
│ │ │ +
613 };
│ │ │ +
│ │ │ +
614
│ │ │ + │ │ │ +
619
│ │ │ + │ │ │ +
624
│ │ │ + │ │ │ +
630
│ │ │ + │ │ │ +
636
│ │ │ + │ │ │ +
644
│ │ │ + │ │ │ +
652
│ │ │ +
656 std::size_t noVertices() const;
│ │ │ +
657
│ │ │ + │ │ │ +
665
│ │ │ +
669 std::size_t noEdges() const;
│ │ │ + │ │ │ +
677 const VertexDescriptor& target) const;
│ │ │ +
685 SubGraph(const Graph& graph, const T& excluded);
│ │ │ +
686
│ │ │ + │ │ │ +
691
│ │ │ +
692 private:
│ │ │ +
694 const T& excluded_;
│ │ │ +
696 std::size_t noVertices_;
│ │ │ +
698 VertexDescriptor endVertex_;
│ │ │ +
700 int noEdges_;
│ │ │ +
705 VertexDescriptor maxVertex_;
│ │ │ +
707 VertexDescriptor* edges_;
│ │ │ +
709 std::ptrdiff_t* start_;
│ │ │ +
711 std::ptrdiff_t* end_;
│ │ │ +
713 SubGraph(const SubGraph&)
│ │ │ +
714 {}
│ │ │ +
715 };
│ │ │ +
│ │ │ +
716
│ │ │ +
717
│ │ │ +
721 template<class G, class VP, class VM=IdentityMap>
│ │ │ +
│ │ │ + │ │ │ +
723 {
│ │ │ +
724 public:
│ │ │ +
728 typedef G Graph;
│ │ │ +
729
│ │ │ +
733 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ +
734
│ │ │ +
738 typedef typename Graph::EdgeDescriptor EdgeDescriptor;
│ │ │ +
739
│ │ │ + │ │ │ +
744
│ │ │ +
756 typedef VM VertexMap;
│ │ │ +
757
│ │ │ +
761 typedef typename Graph::EdgeIterator EdgeIterator;
│ │ │ +
762
│ │ │ +
766 typedef typename Graph::ConstEdgeIterator ConstEdgeIterator;
│ │ │ +
767
│ │ │ + │ │ │ +
774
│ │ │ + │ │ │ +
781
│ │ │ + │ │ │ +
788
│ │ │ + │ │ │ +
795
│ │ │ +
796
│ │ │ +
797 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
799 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
800 C>::value,
│ │ │ +
801 typename Graph::VertexIterator,
│ │ │ +
802 typename Graph::ConstVertexIterator>::type
│ │ │ +
803 {
│ │ │ +
804 friend class VertexIteratorT<const typename std::remove_const<C>::type>;
│ │ │ +
805 friend class VertexIteratorT<typename std::remove_const<C>::type>;
│ │ │ +
806 public:
│ │ │ +
810 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
811 C>::value,
│ │ │ +
812 typename Graph::VertexIterator,
│ │ │ +
813 typename Graph::ConstVertexIterator>::type
│ │ │ + │ │ │ +
815
│ │ │ +
819 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
820 C>::value,
│ │ │ +
821 typename Graph::EdgeIterator,
│ │ │ +
822 typename Graph::ConstEdgeIterator>::type
│ │ │ + │ │ │ +
824
│ │ │ +
830 explicit VertexIteratorT(const Father& iter,
│ │ │ +
831 C* graph);
│ │ │ +
832
│ │ │ +
833
│ │ │ +
841 explicit VertexIteratorT(const Father& iter);
│ │ │ +
842
│ │ │ +
847 template<class C1>
│ │ │ +
848 VertexIteratorT(const VertexIteratorT<C1>& other);
│ │ │ +
849
│ │ │ +
853 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ +
854 VertexProperties&,
│ │ │ +
855 const VertexProperties&>::type
│ │ │ +
856 properties() const;
│ │ │ +
857
│ │ │ + │ │ │ +
864
│ │ │ + │ │ │ +
871
│ │ │ +
872 private:
│ │ │ +
876 C* graph_;
│ │ │ +
877 };
│ │ │ +
│ │ │ +
878
│ │ │ +
882 typedef VertexIteratorT<VertexPropertiesGraph<Graph,
│ │ │ +
883 VertexProperties,VM> > VertexIterator;
│ │ │ +
884
│ │ │ +
888 typedef VertexIteratorT<const VertexPropertiesGraph<Graph,
│ │ │ +
889 VertexProperties,VM> > ConstVertexIterator;
│ │ │ +
890
│ │ │ + │ │ │ +
896
│ │ │ + │ │ │ +
902
│ │ │ + │ │ │ +
908
│ │ │ + │ │ │ +
914
│ │ │ +
920 VertexProperties& getVertexProperties(const VertexDescriptor& vertex);
│ │ │ +
921
│ │ │ +
927 const VertexProperties& getVertexProperties(const VertexDescriptor& vertex) const;
│ │ │ +
928
│ │ │ +
933 const Graph& graph() const;
│ │ │ +
934
│ │ │ +
938 std::size_t noVertices() const;
│ │ │ +
939
│ │ │ +
943 std::size_t noEdges() const;
│ │ │ +
944
│ │ │ + │ │ │ +
952
│ │ │ +
958 VertexPropertiesGraph(Graph& graph, const VertexMap vmap=VertexMap());
│ │ │ +
959
│ │ │ +
960 private:
│ │ │ +
961 VertexPropertiesGraph(const VertexPropertiesGraph&)
│ │ │ +
962 {}
│ │ │ +
963
│ │ │ +
965 Graph& graph_;
│ │ │ +
967 VertexMap vmap_;
│ │ │ +
969 std::vector<VertexProperties> vertexProperties_;
│ │ │ +
970
│ │ │ +
971 };
│ │ │ +
│ │ │ +
972
│ │ │ +
976 template<class G, class VP, class EP, class VM=IdentityMap, class EM=IdentityMap>
│ │ │ +
│ │ │ + │ │ │ +
978 {
│ │ │ +
979 public:
│ │ │ +
983 typedef G Graph;
│ │ │ +
984
│ │ │ +
988 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ +
989
│ │ │ +
993 typedef typename Graph::EdgeDescriptor EdgeDescriptor;
│ │ │ +
994
│ │ │ + │ │ │ +
999
│ │ │ +
1011 typedef VM VertexMap;
│ │ │ +
1012
│ │ │ +
1016 typedef EP EdgeProperties;
│ │ │ +
1017
│ │ │ +
1018
│ │ │ +
1030 typedef EM EdgeMap;
│ │ │ +
1031
│ │ │ +
1032 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
1034 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
1035 C>::value,
│ │ │ +
1036 typename Graph::EdgeIterator,
│ │ │ +
1037 typename Graph::ConstEdgeIterator>::type
│ │ │ +
1038 {
│ │ │ +
1039
│ │ │ +
1040 friend class EdgeIteratorT<const typename std::remove_const<C>::type>;
│ │ │ +
1041 friend class EdgeIteratorT<typename std::remove_const<C>::type>;
│ │ │ +
1042 public:
│ │ │ +
1046 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
1047 C>::value,
│ │ │ +
1048 typename Graph::EdgeIterator,
│ │ │ +
1049 typename Graph::ConstEdgeIterator>::type
│ │ │ + │ │ │ +
1051
│ │ │ +
1057 explicit EdgeIteratorT(const Father& iter,
│ │ │ +
1058 C* graph);
│ │ │ +
1059
│ │ │ +
1067 explicit EdgeIteratorT(const Father& iter);
│ │ │ +
1068
│ │ │ +
1073 template<class C1>
│ │ │ +
1074 EdgeIteratorT(const EdgeIteratorT<C1>& other);
│ │ │ +
1075
│ │ │ +
1079 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ +
1080 EdgeProperties&,
│ │ │ +
1081 const EdgeProperties&>::type
│ │ │ +
1082 properties() const;
│ │ │ +
1083
│ │ │ +
1084 private:
│ │ │ +
1088 C* graph_;
│ │ │ +
1089 };
│ │ │ +
│ │ │ +
1090
│ │ │ +
1094 typedef EdgeIteratorT<PropertiesGraph<Graph,
│ │ │ +
1095 VertexProperties,
│ │ │ +
1096 EdgeProperties,VM,EM> > EdgeIterator;
│ │ │ +
1097
│ │ │ +
1101 typedef EdgeIteratorT<const PropertiesGraph<Graph,
│ │ │ +
1102 VertexProperties,
│ │ │ +
1103 EdgeProperties,VM,EM> > ConstEdgeIterator;
│ │ │ +
1104
│ │ │ +
1110 EdgeIterator beginEdges(const VertexDescriptor& source);
│ │ │ +
1111
│ │ │ +
1117 EdgeIterator endEdges(const VertexDescriptor& source);
│ │ │ +
1118
│ │ │ +
1124 ConstEdgeIterator beginEdges(const VertexDescriptor& source) const;
│ │ │ +
1125
│ │ │ +
1131 ConstEdgeIterator endEdges(const VertexDescriptor& source) const;
│ │ │ +
1132
│ │ │ +
1133
│ │ │ +
1134 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
1136 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
1137 C>::value,
│ │ │ +
1138 typename Graph::VertexIterator,
│ │ │ +
1139 typename Graph::ConstVertexIterator>::type
│ │ │ +
1140 {
│ │ │ +
1141 friend class VertexIteratorT<const typename std::remove_const<C>::type>;
│ │ │ +
1142 friend class VertexIteratorT<typename std::remove_const<C>::type>;
│ │ │ +
1143 public:
│ │ │ +
1147 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
1148 C>::value,
│ │ │ +
1149 typename Graph::VertexIterator,
│ │ │ +
1150 typename Graph::ConstVertexIterator>::type
│ │ │ + │ │ │ +
1152
│ │ │ +
1158 explicit VertexIteratorT(const Father& iter,
│ │ │ +
1159 C* graph);
│ │ │ +
1160
│ │ │ +
1161
│ │ │ +
1169 explicit VertexIteratorT(const Father& iter);
│ │ │ +
1170
│ │ │ +
1175 template<class C1>
│ │ │ +
1176 VertexIteratorT(const VertexIteratorT<C1>& other);
│ │ │ +
1177
│ │ │ +
1181 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ +
1182 VertexProperties&,
│ │ │ +
1183 const VertexProperties&>::type
│ │ │ +
1184 properties() const;
│ │ │ +
1185
│ │ │ +
1191 EdgeIteratorT<C> begin() const;
│ │ │ +
1192
│ │ │ +
1198 EdgeIteratorT<C> end() const;
│ │ │ +
1199
│ │ │ +
1200 private:
│ │ │ +
1204 C* graph_;
│ │ │ +
1205 };
│ │ │ +
│ │ │ +
1206
│ │ │ +
1210 typedef VertexIteratorT<PropertiesGraph<Graph,
│ │ │ +
1211 VertexProperties,
│ │ │ +
1212 EdgeProperties,VM,EM> > VertexIterator;
│ │ │ +
1213
│ │ │ +
1217 typedef VertexIteratorT<const PropertiesGraph<Graph,
│ │ │ +
1218 VertexProperties,
│ │ │ +
1219 EdgeProperties,VM,EM> > ConstVertexIterator;
│ │ │ +
1220
│ │ │ + │ │ │ +
1226
│ │ │ + │ │ │ +
1232
│ │ │ +
1237 ConstVertexIterator begin() const;
│ │ │ +
1238
│ │ │ + │ │ │ +
1244
│ │ │ +
1250 VertexProperties& getVertexProperties(const VertexDescriptor& vertex);
│ │ │ +
1251
│ │ │ +
1257 const VertexProperties& getVertexProperties(const VertexDescriptor& vertex) const;
│ │ │ +
1258
│ │ │ +
│ │ │ +
1265 EdgeDescriptor findEdge(const VertexDescriptor& source,
│ │ │ +
1266 const VertexDescriptor& target)
│ │ │ +
1267 {
│ │ │ +
1268 return graph_.findEdge(source,target);
│ │ │ +
1269 }
│ │ │ +
│ │ │ +
1270
│ │ │ + │ │ │ +
1277
│ │ │ +
1278
│ │ │ + │ │ │ +
1285
│ │ │ + │ │ │ +
1293 const VertexDescriptor& target);
│ │ │ +
1294
│ │ │ + │ │ │ +
1302 const VertexDescriptor& target) const;
│ │ │ +
1303
│ │ │ +
1308 const Graph& graph() const;
│ │ │ +
1309
│ │ │ +
1313 std::size_t noVertices() const;
│ │ │ +
1314
│ │ │ +
1318 std::size_t noEdges() const;
│ │ │ +
1319
│ │ │ + │ │ │ +
1327
│ │ │ + │ │ │ +
1335 const EdgeMap& emap=EdgeMap());
│ │ │ +
1336
│ │ │ +
1337 private:
│ │ │ + │ │ │ +
1339 {}
│ │ │ +
1340
│ │ │ +
1342 Graph& graph_;
│ │ │ +
1345 VertexMap vmap_;
│ │ │ +
1346 std::vector<VertexProperties> vertexProperties_;
│ │ │ +
1348 EdgeMap emap_;
│ │ │ +
1350 std::vector<EdgeProperties> edgeProperties_;
│ │ │ +
1351
│ │ │ +
1352 };
│ │ │ +
│ │ │ +
1353
│ │ │ +
1354
│ │ │ +
1359 template<typename G>
│ │ │ +
│ │ │ + │ │ │ +
1361 {
│ │ │ +
1362 public:
│ │ │ +
1366 typedef G Graph;
│ │ │ +
1370 typedef typename G::VertexProperties VertexProperties;
│ │ │ +
1374 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
1375
│ │ │ +
│ │ │ + │ │ │ +
1381 : graph_(g)
│ │ │ +
1382 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
1387 : graph_(0)
│ │ │ +
1388 {}
│ │ │ +
│ │ │ +
1389
│ │ │ +
1390
│ │ │ +
│ │ │ +
1395 VertexProperties& operator[](const Vertex& vertex) const
│ │ │ +
1396 {
│ │ │ +
1397 return graph_->getVertexProperties(vertex);
│ │ │ +
1398 }
│ │ │ +
│ │ │ +
1399 private:
│ │ │ +
1400 Graph* graph_;
│ │ │ +
1401 };
│ │ │ +
│ │ │ +
1402
│ │ │ +
1407 template<typename G>
│ │ │ +
│ │ │ + │ │ │ +
1409 {
│ │ │ +
1410 public:
│ │ │ +
1414 typedef G Graph;
│ │ │ +
1418 typedef typename G::EdgeProperties EdgeProperties;
│ │ │ +
1422 typedef typename G::EdgeDescriptor Edge;
│ │ │ +
1423
│ │ │ +
│ │ │ + │ │ │ +
1429 : graph_(g)
│ │ │ +
1430 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
1435 : graph_(0)
│ │ │ +
1436 {}
│ │ │ +
│ │ │ +
1437
│ │ │ +
│ │ │ +
1442 EdgeProperties& operator[](const Edge& edge) const
│ │ │ +
1443 {
│ │ │ +
1444 return graph_->getEdgeProperties(edge);
│ │ │ +
1445 }
│ │ │ +
│ │ │ +
1446 private:
│ │ │ +
1447 Graph* graph_;
│ │ │ +
1448 };
│ │ │ +
│ │ │ +
1449
│ │ │ +
1450
│ │ │ +
1461 template<class G, class V>
│ │ │ +
1462 int visitNeighbours(const G& graph, const typename G::VertexDescriptor& vertex,
│ │ │ +
1463 V& visitor);
│ │ │ +
1464
│ │ │ +
1465#ifndef DOXYGEN
│ │ │ +
1466
│ │ │ +
1467 template<class M>
│ │ │ + │ │ │ +
1469 : matrix_(matrix)
│ │ │ +
1470 {
│ │ │ +
1471 if(matrix_.N()!=matrix_.M())
│ │ │ +
1472 DUNE_THROW(ISTLError, "Matrix has to have as many columns as rows!");
│ │ │ +
1473
│ │ │ +
1474 start_ = new EdgeDescriptor[matrix_.N()+1];
│ │ │ +
1475
│ │ │ +
1476 typedef typename M::ConstIterator Iterator;
│ │ │ +
1477 start_[matrix_.begin().index()] = 0;
│ │ │ +
1478
│ │ │ +
1479 for(Iterator row=matrix_.begin(); row != matrix_.end(); ++row)
│ │ │ +
1480 start_[row.index()+1] = start_[row.index()] + row->size();
│ │ │ +
1481 }
│ │ │ +
1482
│ │ │ +
1483 template<class M>
│ │ │ +
1484 MatrixGraph<M>::~MatrixGraph()
│ │ │ +
1485 {
│ │ │ +
1486 delete[] start_;
│ │ │ +
1487 }
│ │ │ +
1488
│ │ │ +
1489 template<class M>
│ │ │ +
1490 inline std::size_t MatrixGraph<M>::noEdges() const
│ │ │ +
1491 {
│ │ │ +
1492 return start_[matrix_.N()];
│ │ │ +
1493 }
│ │ │ +
1494
│ │ │ +
1495 template<class M>
│ │ │ +
1496 inline std::size_t MatrixGraph<M>::noVertices() const
│ │ │ +
1497 {
│ │ │ +
1498 return matrix_.N();
│ │ │ +
1499 }
│ │ │ +
1500
│ │ │ +
1501 template<class M>
│ │ │ +
1502 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::maxVertex() const
│ │ │ +
1503 {
│ │ │ +
1504 return matrix_.N()-1;
│ │ │ +
1505 }
│ │ │ +
1506
│ │ │ +
1507 template<class M>
│ │ │ +
1508 typename MatrixGraph<M>::EdgeDescriptor
│ │ │ +
1509 MatrixGraph<M>::findEdge(const VertexDescriptor& source,
│ │ │ +
1510 const VertexDescriptor& target) const
│ │ │ +
1511 {
│ │ │ +
1512 typename M::ConstColIterator found =matrix_[source].find(target);
│ │ │ +
1513 if(found == matrix_[source].end())
│ │ │ +
1514 return std::numeric_limits<EdgeDescriptor>::max();
│ │ │ +
1515 std::size_t offset = found.offset();
│ │ │ +
1516 if(target>source)
│ │ │ +
1517 offset--;
│ │ │ +
1518
│ │ │ +
1519 assert(offset<noEdges());
│ │ │ +
1520
│ │ │ +
1521 return start_[source]+offset;
│ │ │ +
1522 }
│ │ │ +
1523
│ │ │ +
1524
│ │ │ +
1525 template<class M>
│ │ │ +
1526 inline M& MatrixGraph<M>::matrix()
│ │ │ +
1527 {
│ │ │ +
1528 return matrix_;
│ │ │ +
1529 }
│ │ │ +
1530
│ │ │ +
1531 template<class M>
│ │ │ +
1532 inline const M& MatrixGraph<M>::matrix() const
│ │ │ +
1533 {
│ │ │ +
1534 return matrix_;
│ │ │ +
1535 }
│ │ │ +
1536
│ │ │ +
1537 template<class M>
│ │ │ +
1538 template<class C>
│ │ │ +
1539 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const VertexDescriptor& source, const ColIterator& block,
│ │ │ +
1540 const ColIterator& end, const EdgeDescriptor& edge)
│ │ │ +
1541 : source_(source), block_(block), blockEnd_(end), edge_(edge)
│ │ │ +
1542 {
│ │ │ +
1543 if(block_!=blockEnd_ && block_.index() == source_) {
│ │ │ +
1544 // This is the edge from the diagonal to the diagonal. Skip it.
│ │ │ +
1545 ++block_;
│ │ │ +
1546 }
│ │ │ +
1547 }
│ │ │ +
1548
│ │ │ +
1549 template<class M>
│ │ │ +
1550 template<class C>
│ │ │ +
1551 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const ColIterator& block)
│ │ │ +
1552 : block_(block)
│ │ │ +
1553 {}
│ │ │ +
1554
│ │ │ +
1555 template<class M>
│ │ │ +
1556 template<class C>
│ │ │ +
1557 template<class C1>
│ │ │ +
1558 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const EdgeIteratorT<C1>& other)
│ │ │ +
1559 : source_(other.source_), block_(other.block_), blockEnd_(other.blockEnd_), edge_(other.edge_)
│ │ │ +
1560 {}
│ │ │ +
1561
│ │ │ +
1562
│ │ │ +
1563 template<class M>
│ │ │ +
1564 template<class C>
│ │ │ +
1565 inline typename MatrixGraph<M>::template EdgeIteratorT<C>::WeightType&
│ │ │ +
1566 MatrixGraph<M>::EdgeIteratorT<C>::weight() const
│ │ │ +
1567 {
│ │ │ +
1568 return *block_;
│ │ │ +
1569 }
│ │ │ +
1570
│ │ │ +
1571 template<class M>
│ │ │ +
1572 template<class C>
│ │ │ +
1573 inline typename MatrixGraph<M>::template EdgeIteratorT<C>& MatrixGraph<M>::EdgeIteratorT<C>::operator++()
│ │ │ +
1574 {
│ │ │ +
1575 ++block_;
│ │ │ +
1576 ++edge_;
│ │ │ +
1577
│ │ │ +
1578 if(block_!=blockEnd_ && block_.index() == source_) {
│ │ │ +
1579 // This is the edge from the diagonal to the diagonal. Skip it.
│ │ │ +
1580 ++block_;
│ │ │ +
1581 }
│ │ │ +
1582
│ │ │ +
1583 return *this;
│ │ │ +
1584 }
│ │ │ +
1585
│ │ │ +
1586 template<class M>
│ │ │ +
1587 template<class C>
│ │ │ +
1588 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator!=(const typename MatrixGraph<M>::template EdgeIteratorT<typename std::remove_const<C>::type>& other) const
│ │ │ +
1589 {
│ │ │ +
1590 return block_!=other.block_;
│ │ │ +
1591 }
│ │ │ +
1592
│ │ │ +
1593 template<class M>
│ │ │ +
1594 template<class C>
│ │ │ +
1595 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator!=(const typename MatrixGraph<M>::template EdgeIteratorT<const typename std::remove_const<C>::type>& other) const
│ │ │ +
1596 {
│ │ │ +
1597 return block_!=other.block_;
│ │ │ +
1598 }
│ │ │ +
1599
│ │ │ +
1600 template<class M>
│ │ │ +
1601 template<class C>
│ │ │ +
1602 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator==(const typename MatrixGraph<M>::template EdgeIteratorT<typename std::remove_const<C>::type>& other) const
│ │ │ +
1603 {
│ │ │ +
1604 return block_==other.block_;
│ │ │ +
1605 }
│ │ │ +
1606
│ │ │ +
1607 template<class M>
│ │ │ +
1608 template<class C>
│ │ │ +
1609 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator==(const typename MatrixGraph<M>::template EdgeIteratorT<const typename std::remove_const<C>::type>& other) const
│ │ │ +
1610 {
│ │ │ +
1611 return block_==other.block_;
│ │ │ +
1612 }
│ │ │ +
1613
│ │ │ +
1614 template<class M>
│ │ │ +
1615 template<class C>
│ │ │ +
1616 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::EdgeIteratorT<C>::target() const
│ │ │ +
1617 {
│ │ │ +
1618 return block_.index();
│ │ │ +
1619 }
│ │ │ +
1620
│ │ │ +
1621 template<class M>
│ │ │ +
1622 template<class C>
│ │ │ +
1623 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::EdgeIteratorT<C>::source() const
│ │ │ +
1624 {
│ │ │ +
1625 return source_;
│ │ │ +
1626 }
│ │ │ +
1627
│ │ │ +
1628 template<class M>
│ │ │ +
1629 template<class C>
│ │ │ +
1630 inline const typename MatrixGraph<M>::EdgeDescriptor& MatrixGraph<M>::EdgeIteratorT<C>::operator*() const
│ │ │ +
1631 {
│ │ │ +
1632 return edge_;
│ │ │ +
1633 }
│ │ │ +
1634
│ │ │ +
1635 template<class M>
│ │ │ +
1636 template<class C>
│ │ │ +
1637 inline const typename MatrixGraph<M>::EdgeDescriptor* MatrixGraph<M>::EdgeIteratorT<C>::operator->() const
│ │ │ +
1638 {
│ │ │ +
1639 return &edge_;
│ │ │ +
1640 }
│ │ │ +
1641
│ │ │ +
1642 template<class M>
│ │ │ +
1643 template<class C>
│ │ │ +
1644 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(C* graph,
│ │ │ +
1645 const VertexDescriptor& current)
│ │ │ +
1646 : graph_(graph), current_(current)
│ │ │ +
1647 {}
│ │ │ +
1648
│ │ │ +
1649
│ │ │ +
1650 template<class M>
│ │ │ +
1651 template<class C>
│ │ │ +
1652 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(const VertexDescriptor& current)
│ │ │ +
1653 : current_(current)
│ │ │ +
1654 {}
│ │ │ +
1655
│ │ │ +
1656 template<class M>
│ │ │ +
1657 template<class C>
│ │ │ +
1658 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(const VertexIteratorT<MutableContainer>& other)
│ │ │ +
1659 : graph_(other.graph_), current_(other.current_)
│ │ │ +
1660 {}
│ │ │ +
1661
│ │ │ +
1662 template<class M>
│ │ │ +
1663 template<class C>
│ │ │ +
1664 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator!=(const VertexIteratorT<MutableContainer>& other) const
│ │ │ +
1665 {
│ │ │ +
1666 return current_ != other.current_;
│ │ │ +
1667 }
│ │ │ +
1668
│ │ │ +
1669 template<class M>
│ │ │ +
1670 template<class C>
│ │ │ +
1671 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator!=(const VertexIteratorT<ConstContainer>& other) const
│ │ │ +
1672 {
│ │ │ +
1673 return current_ != other.current_;
│ │ │ +
1674 }
│ │ │ +
1675
│ │ │ +
1676
│ │ │ +
1677 template<class M>
│ │ │ +
1678 template<class C>
│ │ │ +
1679 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator==(const VertexIteratorT<MutableContainer>& other) const
│ │ │ +
1680 {
│ │ │ +
1681 return current_ == other.current_;
│ │ │ +
1682 }
│ │ │ +
1683
│ │ │ +
1684 template<class M>
│ │ │ +
1685 template<class C>
│ │ │ +
1686 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator==(const VertexIteratorT<ConstContainer>& other) const
│ │ │ +
1687 {
│ │ │ +
1688 return current_ == other.current_;
│ │ │ +
1689 }
│ │ │ +
1690
│ │ │ +
1691 template<class M>
│ │ │ +
1692 template<class C>
│ │ │ +
1693 inline typename MatrixGraph<M>::template VertexIteratorT<C>& MatrixGraph<M>::VertexIteratorT<C>::operator++()
│ │ │ +
1694 {
│ │ │ +
1695 ++current_;
│ │ │ +
1696 return *this;
│ │ │ +
1697 }
│ │ │ +
1698
│ │ │ +
1699 template<class M>
│ │ │ +
1700 template<class C>
│ │ │ +
1701 inline typename MatrixGraph<M>::template VertexIteratorT<C>::WeightType&
│ │ │ +
1702 MatrixGraph<M>::VertexIteratorT<C>::weight() const
│ │ │ +
1703 {
│ │ │ +
1704 return graph_->matrix()[current_][current_];
│ │ │ +
1705 }
│ │ │ +
1706
│ │ │ +
1707 template<class M>
│ │ │ +
1708 template<class C>
│ │ │ +
1709 inline const typename MatrixGraph<M>::VertexDescriptor&
│ │ │ +
1710 MatrixGraph<M>::VertexIteratorT<C>::operator*() const
│ │ │ +
1711 {
│ │ │ +
1712 return current_;
│ │ │ +
1713 }
│ │ │ +
1714
│ │ │ +
1715 template<class M>
│ │ │ +
1716 template<class C>
│ │ │ +
1717 inline typename MatrixGraph<M>::template EdgeIteratorT<C>
│ │ │ +
1718 MatrixGraph<M>::VertexIteratorT<C>::begin() const
│ │ │ +
1719 {
│ │ │ +
1720 return graph_->beginEdges(current_);
│ │ │ +
1721 }
│ │ │ +
1722
│ │ │ +
1723 template<class M>
│ │ │ +
1724 template<class C>
│ │ │ +
1725 inline typename MatrixGraph<M>::template EdgeIteratorT<C>
│ │ │ +
1726 MatrixGraph<M>::VertexIteratorT<C>::end() const
│ │ │ +
1727 {
│ │ │ +
1728 return graph_->endEdges(current_);
│ │ │ +
1729 }
│ │ │ +
1730
│ │ │ +
1731 template<class M>
│ │ │ +
1732 inline typename MatrixGraph<M>::template VertexIteratorT<MatrixGraph<M> >
│ │ │ +
1733 MatrixGraph<M>::begin()
│ │ │ +
1734 {
│ │ │ +
1735 return VertexIterator(this,0);
│ │ │ +
1736 }
│ │ │ +
1737
│ │ │ +
1738 template<class M>
│ │ │ +
1739 inline typename MatrixGraph<M>::template VertexIteratorT<MatrixGraph<M> >
│ │ │ +
1740 MatrixGraph<M>::end()
│ │ │ +
1741 {
│ │ │ +
1742 return VertexIterator(matrix_.N());
│ │ │ +
1743 }
│ │ │ +
1744
│ │ │ +
1745
│ │ │ +
1746 template<class M>
│ │ │ +
1747 inline typename MatrixGraph<M>::template VertexIteratorT<const MatrixGraph<M> >
│ │ │ +
1748 MatrixGraph<M>::begin() const
│ │ │ +
1749 {
│ │ │ +
1750 return ConstVertexIterator(this, 0);
│ │ │ +
1751 }
│ │ │ +
1752
│ │ │ +
1753 template<class M>
│ │ │ +
1754 inline typename MatrixGraph<M>::template VertexIteratorT<const MatrixGraph<M> >
│ │ │ +
1755 MatrixGraph<M>::end() const
│ │ │ +
1756 {
│ │ │ +
1757 return ConstVertexIterator(matrix_.N());
│ │ │ +
1758 }
│ │ │ +
1759
│ │ │ +
1760 template<class M>
│ │ │ +
1761 inline typename MatrixGraph<M>::template EdgeIteratorT<MatrixGraph<M> >
│ │ │ +
1762 MatrixGraph<M>::beginEdges(const VertexDescriptor& source)
│ │ │ +
1763 {
│ │ │ +
1764 return EdgeIterator(source, matrix_.operator[](source).begin(),
│ │ │ +
1765 matrix_.operator[](source).end(), start_[source]);
│ │ │ +
1766 }
│ │ │ +
1767
│ │ │ +
1768 template<class M>
│ │ │ +
1769 inline typename MatrixGraph<M>::template EdgeIteratorT<MatrixGraph<M> >
│ │ │ +
1770 MatrixGraph<M>::endEdges(const VertexDescriptor& source)
│ │ │ +
1771 {
│ │ │ +
1772 return EdgeIterator(matrix_.operator[](source).end());
│ │ │ +
1773 }
│ │ │ +
1774
│ │ │ +
1775
│ │ │ +
1776 template<class M>
│ │ │ +
1777 inline typename MatrixGraph<M>::template EdgeIteratorT<const MatrixGraph<M> >
│ │ │ +
1778 MatrixGraph<M>::beginEdges(const VertexDescriptor& source) const
│ │ │ +
1779 {
│ │ │ +
1780 return ConstEdgeIterator(source, matrix_.operator[](source).begin(),
│ │ │ +
1781 matrix_.operator[](source).end(), start_[source]);
│ │ │ +
1782 }
│ │ │ +
1783
│ │ │ +
1784 template<class M>
│ │ │ +
1785 inline typename MatrixGraph<M>::template EdgeIteratorT<const MatrixGraph<M> >
│ │ │ +
1786 MatrixGraph<M>::endEdges(const VertexDescriptor& source) const
│ │ │ +
1787 {
│ │ │ +
1788 return ConstEdgeIterator(matrix_.operator[](source).end());
│ │ │ +
1789 }
│ │ │ +
1790
│ │ │ +
1791
│ │ │ +
1792 template<class G, class T>
│ │ │ +
1793 SubGraph<G,T>::EdgeIterator::EdgeIterator(const VertexDescriptor& source,
│ │ │ +
1794 const EdgeDescriptor& edge)
│ │ │ +
1795 : source_(source), edge_(edge)
│ │ │ +
1796 {}
│ │ │ +
1797
│ │ │ +
1798
│ │ │ +
1799 template<class G, class T>
│ │ │ +
1800 SubGraph<G,T>::EdgeIterator::EdgeIterator(const EdgeDescriptor& edge)
│ │ │ +
1801 : edge_(edge)
│ │ │ +
1802 {}
│ │ │ +
1803
│ │ │ +
1804 template<class G, class T>
│ │ │ +
1805 typename SubGraph<G,T>::EdgeIndexMap SubGraph<G,T>::getEdgeIndexMap()
│ │ │ +
1806 {
│ │ │ +
1807 return EdgeIndexMap(edges_);
│ │ │ +
1808 }
│ │ │ +
1809
│ │ │ +
1810 template<class G, class T>
│ │ │ +
1811 inline bool SubGraph<G,T>::EdgeIterator::equals(const EdgeIterator & other) const
│ │ │ +
1812 {
│ │ │ +
1813 return other.edge_==edge_;
│ │ │ +
1814 }
│ │ │ +
1815
│ │ │ +
1816 template<class G, class T>
│ │ │ +
1817 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::increment()
│ │ │ +
1818 {
│ │ │ +
1819 ++edge_;
│ │ │ +
1820 return *this;
│ │ │ +
1821 }
│ │ │ +
1822
│ │ │ +
1823 template<class G, class T>
│ │ │ +
1824 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::decrement()
│ │ │ +
1825 {
│ │ │ +
1826 --edge_;
│ │ │ +
1827 return *this;
│ │ │ +
1828 }
│ │ │ +
1829
│ │ │ +
1830 template<class G, class T>
│ │ │ +
1831 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::advance(std::ptrdiff_t n)
│ │ │ +
1832 {
│ │ │ +
1833 edge_+=n;
│ │ │ +
1834 return *this;
│ │ │ +
1835 }
│ │ │ +
1836 template<class G, class T>
│ │ │ +
1837 inline const typename G::VertexDescriptor& SubGraph<G,T>::EdgeIterator::source() const
│ │ │ +
1838 {
│ │ │ +
1839 return source_;
│ │ │ +
1840 }
│ │ │ +
1841
│ │ │ +
1842 template<class G, class T>
│ │ │ +
1843 inline const typename G::VertexDescriptor& SubGraph<G,T>::EdgeIterator::target() const
│ │ │ +
1844 {
│ │ │ +
1845 return *edge_;
│ │ │ +
1846 }
│ │ │ +
1847
│ │ │ +
1848
│ │ │ +
1849 template<class G, class T>
│ │ │ +
1850 inline const typename SubGraph<G,T>::EdgeDescriptor& SubGraph<G,T>::EdgeIterator::dereference() const
│ │ │ +
1851 {
│ │ │ +
1852 return edge_;
│ │ │ +
1853 }
│ │ │ +
1854
│ │ │ +
1855 template<class G, class T>
│ │ │ +
1856 inline std::ptrdiff_t SubGraph<G,T>::EdgeIterator::distanceTo(const EdgeIterator & other) const
│ │ │ +
1857 {
│ │ │ +
1858 return other.edge_-edge_;
│ │ │ +
1859 }
│ │ │ +
1860
│ │ │ +
1861 template<class G, class T>
│ │ │ +
1862 SubGraph<G,T>::VertexIterator::VertexIterator(const SubGraph<G,T>* graph,
│ │ │ +
1863 const VertexDescriptor& current,
│ │ │ +
1864 const VertexDescriptor& end)
│ │ │ +
1865 : graph_(graph), current_(current), end_(end)
│ │ │ +
1866 {
│ │ │ +
1867 // Skip excluded vertices
│ │ │ +
1868 typedef typename T::const_iterator Iterator;
│ │ │ +
1869
│ │ │ +
1870 for(Iterator vertex = graph_->excluded_.begin();
│ │ │ +
1871 current_ != end_ && *vertex;
│ │ │ +
1872 ++vertex)
│ │ │ +
1873 ++current_;
│ │ │ +
1874 assert(current_ == end_ || !graph_->excluded_[current_]);
│ │ │ +
1875 }
│ │ │ +
1876
│ │ │ +
1877 template<class G, class T>
│ │ │ +
1878 SubGraph<G,T>::VertexIterator::VertexIterator(const VertexDescriptor& current)
│ │ │ +
1879 : current_(current)
│ │ │ +
1880 {}
│ │ │ +
1881
│ │ │ +
1882 template<class G, class T>
│ │ │ +
1883 inline typename SubGraph<G,T>::VertexIterator& SubGraph<G,T>::VertexIterator::increment()
│ │ │ +
1884 {
│ │ │ +
1885 ++current_;
│ │ │ +
1886 //Skip excluded vertices
│ │ │ +
1887 while(current_ != end_ && graph_->excluded_[current_])
│ │ │ +
1888 ++current_;
│ │ │ +
1889
│ │ │ +
1890 assert(current_ == end_ || !graph_->excluded_[current_]);
│ │ │ +
1891 return *this;
│ │ │ +
1892 }
│ │ │ +
1893
│ │ │ +
1894 template<class G, class T>
│ │ │ +
1895 inline bool SubGraph<G,T>::VertexIterator::equals(const VertexIterator & other) const
│ │ │ +
1896 {
│ │ │ +
1897 return current_==other.current_;
│ │ │ +
1898 }
│ │ │ +
1899
│ │ │ +
1900 template<class G, class T>
│ │ │ +
1901 inline const typename G::VertexDescriptor& SubGraph<G,T>::VertexIterator::dereference() const
│ │ │ +
1902 {
│ │ │ +
1903 return current_;
│ │ │ +
1904 }
│ │ │ +
1905
│ │ │ +
1906 template<class G, class T>
│ │ │ +
1907 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::VertexIterator::begin() const
│ │ │ +
1908 {
│ │ │ +
1909 return graph_->beginEdges(current_);
│ │ │ +
1910 }
│ │ │ +
1911
│ │ │ +
1912 template<class G, class T>
│ │ │ +
1913 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::VertexIterator::end() const
│ │ │ +
1914 {
│ │ │ +
1915 return graph_->endEdges(current_);
│ │ │ +
1916 }
│ │ │ +
1917
│ │ │ +
1918 template<class G, class T>
│ │ │ +
1919 inline typename SubGraph<G,T>::VertexIterator SubGraph<G,T>::begin() const
│ │ │ +
1920 {
│ │ │ +
1921 return VertexIterator(this, 0, endVertex_);
│ │ │ +
1922 }
│ │ │ +
1923
│ │ │ +
1924
│ │ │ +
1925 template<class G, class T>
│ │ │ +
1926 inline typename SubGraph<G,T>::VertexIterator SubGraph<G,T>::end() const
│ │ │ +
1927 {
│ │ │ +
1928 return VertexIterator(endVertex_);
│ │ │ +
1929 }
│ │ │ +
1930
│ │ │ +
1931
│ │ │ +
1932 template<class G, class T>
│ │ │ +
1933 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::beginEdges(const VertexDescriptor& source) const
│ │ │ +
1934 {
│ │ │ +
1935 return EdgeIterator(source, edges_+start_[source]);
│ │ │ +
1936 }
│ │ │ +
1937
│ │ │ +
1938 template<class G, class T>
│ │ │ +
1939 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::endEdges(const VertexDescriptor& source) const
│ │ │ +
1940 {
│ │ │ +
1941 return EdgeIterator(edges_+end_[source]);
│ │ │ +
1942 }
│ │ │ +
1943
│ │ │ +
1944 template<class G, class T>
│ │ │ +
1945 std::size_t SubGraph<G,T>::noVertices() const
│ │ │ +
1946 {
│ │ │ +
1947 return noVertices_;
│ │ │ +
1948 }
│ │ │ +
1949
│ │ │ +
1950 template<class G, class T>
│ │ │ +
1951 inline typename SubGraph<G,T>::VertexDescriptor SubGraph<G,T>::maxVertex() const
│ │ │ +
1952 {
│ │ │ +
1953 return maxVertex_;
│ │ │ +
1954 }
│ │ │ +
1955
│ │ │ +
1956 template<class G, class T>
│ │ │ +
1957 inline std::size_t SubGraph<G,T>::noEdges() const
│ │ │ +
1958 {
│ │ │ +
1959 return noEdges_;
│ │ │ +
1960 }
│ │ │ +
1961
│ │ │ +
1962 template<class G, class T>
│ │ │ +
1963 inline typename SubGraph<G,T>::EdgeDescriptor SubGraph<G,T>::findEdge(const VertexDescriptor& source,
│ │ │ +
1964 const VertexDescriptor& target) const
│ │ │ +
1965 {
│ │ │ +
1966 const EdgeDescriptor edge = std::lower_bound(edges_+start_[source], edges_+end_[source], target);
│ │ │ +
1967 if(edge==edges_+end_[source] || *edge!=target)
│ │ │ +
1968 return std::numeric_limits<EdgeDescriptor>::max();
│ │ │ +
1969
│ │ │ +
1970 return edge;
│ │ │ +
1971 }
│ │ │ +
1972
│ │ │ +
1973 template<class G, class T>
│ │ │ +
1974 SubGraph<G,T>::~SubGraph()
│ │ │ +
1975 {
│ │ │ +
1976 delete[] edges_;
│ │ │ +
1977 delete[] end_;
│ │ │ +
1978 delete[] start_;
│ │ │ +
1979 }
│ │ │ +
1980
│ │ │ +
1981 template<class G, class T>
│ │ │ +
1982 SubGraph<G,T>::SubGraph(const G& graph, const T& excluded)
│ │ │ +
1983 : excluded_(excluded), noVertices_(0), endVertex_(0), maxVertex_(graph.maxVertex())
│ │ │ +
1984 {
│ │ │ +
1985 start_ = new std::ptrdiff_t[graph.noVertices()];
│ │ │ +
1986 end_ = new std::ptrdiff_t[graph.noVertices()];
│ │ │ +
1987 edges_ = new VertexDescriptor[graph.noEdges()];
│ │ │ +
1988
│ │ │ +
1989 VertexDescriptor* edge=edges_;
│ │ │ +
1990
│ │ │ +
1991 // Cater for the case that there are no vertices.
│ │ │ +
1992 // Otherwise endVertex_ will get 1 below.
│ │ │ +
1993 if ( graph.noVertices() == 0)
│ │ │ +
1994 return;
│ │ │ +
1995
│ │ │ +
1996 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ +
1997 Iterator endVertex=graph.end();
│ │ │ +
1998
│ │ │ +
1999 for(Iterator vertex = graph.begin(); vertex != endVertex; ++vertex)
│ │ │ +
2000 if(excluded_[*vertex])
│ │ │ +
2001 start_[*vertex]=end_[*vertex]=-1;
│ │ │ +
2002 else{
│ │ │ +
2003 ++noVertices_;
│ │ │ +
2004 endVertex_ = std::max(*vertex, endVertex_);
│ │ │ +
2005
│ │ │ +
2006 start_[*vertex] = edge-edges_;
│ │ │ +
2007
│ │ │ +
2008 auto endEdge = vertex.end();
│ │ │ +
2009
│ │ │ +
2010 for(auto iter=vertex.begin(); iter!= endEdge; ++iter)
│ │ │ +
2011 if(!excluded[iter.target()]) {
│ │ │ +
2012 *edge = iter.target();
│ │ │ +
2013 ++edge;
│ │ │ +
2014 }
│ │ │ +
2015
│ │ │ +
2016 end_[*vertex] = edge - edges_;
│ │ │ +
2017
│ │ │ +
2018 // Sort the edges
│ │ │ +
2019 std::sort(edges_+start_[*vertex], edge);
│ │ │ +
2020 }
│ │ │ +
2021 noEdges_ = edge-edges_;
│ │ │ +
2022 ++endVertex_;
│ │ │ +
2023 }
│ │ │ +
2024
│ │ │ +
2025 template<class G, class V, class VM>
│ │ │ +
2026 inline std::size_t VertexPropertiesGraph<G,V,VM>::noEdges() const
│ │ │ +
2027 {
│ │ │ +
2028 return graph_.noEdges();
│ │ │ +
2029 }
│ │ │ +
2030
│ │ │ +
2031 template<class G, class V, class VM>
│ │ │ +
2032 inline typename VertexPropertiesGraph<G,V,VM>::EdgeIterator
│ │ │ +
2033 VertexPropertiesGraph<G,V,VM>::beginEdges(const VertexDescriptor& source)
│ │ │ +
2034 {
│ │ │ +
2035 return graph_.beginEdges(source);
│ │ │ +
2036 }
│ │ │ +
2037
│ │ │ +
2038 template<class G, class V, class VM>
│ │ │ +
2039 inline typename VertexPropertiesGraph<G,V,VM>::EdgeIterator
│ │ │ +
2040 VertexPropertiesGraph<G,V,VM>::endEdges(const VertexDescriptor& source)
│ │ │ +
2041 {
│ │ │ +
2042 return graph_.endEdges(source);
│ │ │ +
2043 }
│ │ │ +
2044
│ │ │ +
2045 template<class G, class V, class VM>
│ │ │ +
2046 typename VertexPropertiesGraph<G,V,VM>::ConstEdgeIterator
│ │ │ +
2047 inline VertexPropertiesGraph<G,V,VM>::beginEdges(const VertexDescriptor& source) const
│ │ │ +
2048 {
│ │ │ +
2049 return graph_.beginEdges(source);
│ │ │ +
2050 }
│ │ │ +
2051
│ │ │ +
2052 template<class G, class V, class VM>
│ │ │ +
2053 typename VertexPropertiesGraph<G,V,VM>::ConstEdgeIterator
│ │ │ +
2054 VertexPropertiesGraph<G,V,VM>::endEdges(const VertexDescriptor& source) const
│ │ │ +
2055 {
│ │ │ +
2056 return graph_.endEdges(source);
│ │ │ +
2057 }
│ │ │ +
2058
│ │ │ +
2059 template<class G, class V, class VM>
│ │ │ +
2060 template<class C>
│ │ │ +
2061 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ +
2062 ::VertexIteratorT(const Father& iter,
│ │ │ +
2063 C* graph)
│ │ │ +
2064 : Father(iter), graph_(graph)
│ │ │ +
2065 {}
│ │ │ +
2066
│ │ │ +
2067 template<class G, class V, class VM>
│ │ │ +
2068 template<class C>
│ │ │ +
2069 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ +
2070 ::VertexIteratorT(const Father& iter)
│ │ │ +
2071 : Father(iter)
│ │ │ +
2072 {}
│ │ │ +
2073
│ │ │ +
2074 template<class G, class V, class VM>
│ │ │ +
2075 template<class C>
│ │ │ +
2076 template<class C1>
│ │ │ +
2077 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ +
2078 ::VertexIteratorT(const VertexIteratorT<C1>& other)
│ │ │ +
2079 : Father(other), graph_(other.graph_)
│ │ │ +
2080 {}
│ │ │ +
2081
│ │ │ +
2082 template<class G, class V, class VM>
│ │ │ +
2083 template<class C>
│ │ │ +
2084 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ +
2085 V&, const V&>::type
│ │ │ +
2086 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::properties() const
│ │ │ +
2087 {
│ │ │ +
2088 return graph_->getVertexProperties(Father::operator*());
│ │ │ +
2089 }
│ │ │ +
2090
│ │ │ +
2091 template<class G, class V, class VM>
│ │ │ +
2092 template<class C>
│ │ │ +
2093 typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
2094 C>::value,
│ │ │ +
2095 typename G::EdgeIterator,
│ │ │ +
2096 typename G::ConstEdgeIterator>::type
│ │ │ +
2097 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::begin() const
│ │ │ +
2098 {
│ │ │ +
2099 return graph_->beginEdges(Father::operator*());
│ │ │ +
2100 }
│ │ │ +
2101
│ │ │ +
2102 template<class G, class V, class VM>
│ │ │ +
2103 template<class C>
│ │ │ +
2104 typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ +
2105 C>::value,
│ │ │ +
2106 typename G::EdgeIterator,
│ │ │ +
2107 typename G::ConstEdgeIterator>::type
│ │ │ +
2108 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::end() const
│ │ │ +
2109 {
│ │ │ +
2110 return graph_->endEdges(Father::operator*());
│ │ │ +
2111 }
│ │ │ +
2112
│ │ │ +
2113 template<class G, class V, class VM>
│ │ │ +
2114 inline typename VertexPropertiesGraph<G,V,VM>::VertexIterator VertexPropertiesGraph<G,V,VM>::begin()
│ │ │ +
2115 {
│ │ │ +
2116 return VertexIterator(graph_.begin(), this);
│ │ │ +
2117 }
│ │ │ +
2118
│ │ │ +
2119 template<class G, class V, class VM>
│ │ │ +
2120 inline typename VertexPropertiesGraph<G,V,VM>::VertexIterator VertexPropertiesGraph<G,V,VM>::end()
│ │ │ +
2121 {
│ │ │ +
2122 return VertexIterator(graph_.end());
│ │ │ +
2123 }
│ │ │ +
2124
│ │ │ +
2125
│ │ │ +
2126 template<class G, class V, class VM>
│ │ │ +
2127 inline typename VertexPropertiesGraph<G,V,VM>::ConstVertexIterator VertexPropertiesGraph<G,V,VM>::begin() const
│ │ │ +
2128 {
│ │ │ +
2129 return ConstVertexIterator(graph_.begin(), this);
│ │ │ +
2130 }
│ │ │ +
2131
│ │ │ +
2132 template<class G, class V, class VM>
│ │ │ +
2133 inline typename VertexPropertiesGraph<G,V,VM>::ConstVertexIterator VertexPropertiesGraph<G,V,VM>::end() const
│ │ │ +
2134 {
│ │ │ +
2135 return ConstVertexIterator(graph_.end());
│ │ │ +
2136 }
│ │ │ +
2137
│ │ │ +
2138 template<class G, class V, class VM>
│ │ │ +
2139 inline V& VertexPropertiesGraph<G,V,VM>::getVertexProperties(const VertexDescriptor& vertex)
│ │ │ +
2140 {
│ │ │ +
2141 return vertexProperties_[vmap_[vertex]];
│ │ │ +
2142 }
│ │ │ +
2143
│ │ │ +
2144 template<class G, class V, class VM>
│ │ │ +
2145 inline const V& VertexPropertiesGraph<G,V,VM>::getVertexProperties(const VertexDescriptor& vertex) const
│ │ │ +
2146 {
│ │ │ +
2147 return vertexProperties_[vmap_[vertex]];
│ │ │ +
2148 }
│ │ │ +
2149
│ │ │ +
2150 template<class G, class V, class VM>
│ │ │ +
2151 inline const G& VertexPropertiesGraph<G,V,VM>::graph() const
│ │ │ +
2152 {
│ │ │ +
2153 return graph_;
│ │ │ +
2154 }
│ │ │ +
2155
│ │ │ +
2156 template<class G, class V, class VM>
│ │ │ +
2157 inline std::size_t VertexPropertiesGraph<G,V,VM>::noVertices() const
│ │ │ +
2158 {
│ │ │ +
2159 return graph_.noVertices();
│ │ │ +
2160 }
│ │ │ +
2161
│ │ │ +
2162
│ │ │ +
2163 template<class G, class V, class VM>
│ │ │ +
2164 inline typename VertexPropertiesGraph<G,V,VM>::VertexDescriptor VertexPropertiesGraph<G,V,VM>::maxVertex() const
│ │ │ +
2165 {
│ │ │ +
2166 return graph_.maxVertex();
│ │ │ +
2167 }
│ │ │ +
2168
│ │ │ +
2169 template<class G, class V, class VM>
│ │ │ +
2170 VertexPropertiesGraph<G,V,VM>::VertexPropertiesGraph(Graph& graph, const VM vmap)
│ │ │ +
2171 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex()+1], V())
│ │ │ +
2172 {}
│ │ │ +
2173
│ │ │ +
2174 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2175 template<class C>
│ │ │ +
2176 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const Father& iter,
│ │ │ +
2177 C* graph)
│ │ │ +
2178 : Father(iter), graph_(graph)
│ │ │ +
2179 {}
│ │ │ +
2180
│ │ │ +
2181 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2182 template<class C>
│ │ │ +
2183 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const Father& iter)
│ │ │ +
2184 : Father(iter)
│ │ │ +
2185 {}
│ │ │ +
2186
│ │ │ +
2187 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2188 template<class C>
│ │ │ +
2189 template<class C1>
│ │ │ +
2190 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const EdgeIteratorT<C1>& other)
│ │ │ +
2191 : Father(other), graph_(other.graph_)
│ │ │ +
2192 {}
│ │ │ +
2193
│ │ │ +
2194
│ │ │ +
2195 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2196 inline std::size_t PropertiesGraph<G,V,E,VM,EM>::noEdges() const
│ │ │ +
2197 {
│ │ │ +
2198 return graph_.noEdges();
│ │ │ +
2199 }
│ │ │ +
2200
│ │ │ +
2201 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2202 template<class C>
│ │ │ +
2203 inline typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,E&,const E&>::type
│ │ │ +
2204 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::properties() const
│ │ │ +
2205 {
│ │ │ +
2206 return graph_->getEdgeProperties(Father::operator*());
│ │ │ +
2207 }
│ │ │ +
2208
│ │ │ +
2209 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2210 inline typename PropertiesGraph<G,V,E,VM,EM>::EdgeIterator
│ │ │ +
2211 PropertiesGraph<G,V,E,VM,EM>::beginEdges(const VertexDescriptor& source)
│ │ │ +
2212 {
│ │ │ +
2213 return EdgeIterator(graph_.beginEdges(source), this);
│ │ │ +
2214 }
│ │ │ +
2215
│ │ │ +
2216 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2217 inline typename PropertiesGraph<G,V,E,VM,EM>::EdgeIterator
│ │ │ +
2218 PropertiesGraph<G,V,E,VM,EM>::endEdges(const VertexDescriptor& source)
│ │ │ +
2219 {
│ │ │ +
2220 return EdgeIterator(graph_.endEdges(source));
│ │ │ +
2221 }
│ │ │ +
2222
│ │ │ +
2223 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2224 typename PropertiesGraph<G,V,E,VM,EM>::ConstEdgeIterator
│ │ │ +
2225 inline PropertiesGraph<G,V,E,VM,EM>::beginEdges(const VertexDescriptor& source) const
│ │ │ +
2226 {
│ │ │ +
2227 return ConstEdgeIterator(graph_.beginEdges(source), this);
│ │ │ +
2228 }
│ │ │ +
2229
│ │ │ +
2230 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2231 typename PropertiesGraph<G,V,E,VM,EM>::ConstEdgeIterator
│ │ │ +
2232 PropertiesGraph<G,V,E,VM,EM>::endEdges(const VertexDescriptor& source) const
│ │ │ +
2233 {
│ │ │ +
2234 return ConstEdgeIterator(graph_.endEdges(source));
│ │ │ +
2235 }
│ │ │ +
2236
│ │ │ +
2237 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2238 template<class C>
│ │ │ +
2239 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ +
2240 ::VertexIteratorT(const Father& iter,
│ │ │ +
2241 C* graph)
│ │ │ +
2242 : Father(iter), graph_(graph)
│ │ │ +
2243 {}
│ │ │ +
2244
│ │ │ +
2245 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2246 template<class C>
│ │ │ +
2247 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ +
2248 ::VertexIteratorT(const Father& iter)
│ │ │ +
2249 : Father(iter)
│ │ │ +
2250 {}
│ │ │ +
2251
│ │ │ +
2252 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2253 template<class C>
│ │ │ +
2254 template<class C1>
│ │ │ +
2255 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ +
2256 ::VertexIteratorT(const VertexIteratorT<C1>& other)
│ │ │ +
2257 : Father(other), graph_(other.graph_)
│ │ │ +
2258 {}
│ │ │ +
2259
│ │ │ +
2260 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2261 template<class C>
│ │ │ +
2262 inline typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ +
2263 V&, const V&>::type
│ │ │ +
2264 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::properties() const
│ │ │ +
2265 {
│ │ │ +
2266 return graph_->getVertexProperties(Father::operator*());
│ │ │ +
2267 }
│ │ │ +
2268
│ │ │ +
2269 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2270 template<class C>
│ │ │ +
2271 inline typename PropertiesGraph<G,V,E,VM,EM>::template EdgeIteratorT<C>
│ │ │ +
2272 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::begin() const
│ │ │ +
2273 {
│ │ │ +
2274 return graph_->beginEdges(Father::operator*());
│ │ │ +
2275 }
│ │ │ +
2276
│ │ │ +
2277 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2278 template<class C>
│ │ │ +
2279 inline typename PropertiesGraph<G,V,E,VM,EM>::template EdgeIteratorT<C>
│ │ │ +
2280 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::end() const
│ │ │ +
2281 {
│ │ │ +
2282 return graph_->endEdges(Father::operator*());
│ │ │ +
2283 }
│ │ │ +
2284
│ │ │ +
2285 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2286 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexIterator PropertiesGraph<G,V,E,VM,EM>::begin()
│ │ │ +
2287 {
│ │ │ +
2288 return VertexIterator(graph_.begin(), this);
│ │ │ +
2289 }
│ │ │ +
2290
│ │ │ +
2291 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2292 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexIterator PropertiesGraph<G,V,E,VM,EM>::end()
│ │ │ +
2293 {
│ │ │ +
2294 return VertexIterator(graph_.end());
│ │ │ +
2295 }
│ │ │ +
2296
│ │ │ +
2297
│ │ │ +
2298 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2299 inline typename PropertiesGraph<G,V,E,VM,EM>::ConstVertexIterator PropertiesGraph<G,V,E,VM,EM>::begin() const
│ │ │ +
2300 {
│ │ │ +
2301 return ConstVertexIterator(graph_.begin(), this);
│ │ │ +
2302 }
│ │ │ +
2303
│ │ │ +
2304 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2305 inline typename PropertiesGraph<G,V,E,VM,EM>::ConstVertexIterator PropertiesGraph<G,V,E,VM,EM>::end() const
│ │ │ +
2306 {
│ │ │ +
2307 return ConstVertexIterator(graph_.end());
│ │ │ +
2308 }
│ │ │ +
2309
│ │ │ +
2310 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2311 inline V& PropertiesGraph<G,V,E,VM,EM>::getVertexProperties(const VertexDescriptor& vertex)
│ │ │ +
2312 {
│ │ │ +
2313 return vertexProperties_[vmap_[vertex]];
│ │ │ +
2314 }
│ │ │ +
2315
│ │ │ +
2316 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2317 inline const V& PropertiesGraph<G,V,E,VM,EM>::getVertexProperties(const VertexDescriptor& vertex) const
│ │ │ +
2318 {
│ │ │ +
2319 return vertexProperties_[vmap_[vertex]];
│ │ │ +
2320 }
│ │ │ +
2321
│ │ │ +
2322 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2323 inline E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const EdgeDescriptor& edge)
│ │ │ +
2324 {
│ │ │ +
2325 return edgeProperties_[emap_[edge]];
│ │ │ +
2326 }
│ │ │ +
2327
│ │ │ +
2328 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2329 inline const E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const EdgeDescriptor& edge) const
│ │ │ +
2330 {
│ │ │ +
2331 return edgeProperties_[emap_[edge]];
│ │ │ +
2332 }
│ │ │ +
2333
│ │ │ +
2334 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2335 inline E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const VertexDescriptor& source,
│ │ │ +
2336 const VertexDescriptor& target)
│ │ │ +
2337 {
│ │ │ +
2338 return getEdgeProperties(graph_.findEdge(source,target));
│ │ │ +
2339 }
│ │ │ +
2340
│ │ │ +
2341 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2342 inline const E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const VertexDescriptor& source,
│ │ │ +
2343 const VertexDescriptor& target) const
│ │ │ +
2344 {
│ │ │ +
2345 return getEdgeProperties(graph_.findEdge(source,target));
│ │ │ +
2346 }
│ │ │ +
2347
│ │ │ +
2348 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2349 inline const G& PropertiesGraph<G,V,E,VM,EM>::graph() const
│ │ │ +
2350 {
│ │ │ +
2351 return graph_;
│ │ │ +
2352 }
│ │ │ +
2353
│ │ │ +
2354 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2355 inline std::size_t PropertiesGraph<G,V,E,VM,EM>::noVertices() const
│ │ │ +
2356 {
│ │ │ +
2357 return graph_.noVertices();
│ │ │ +
2358 }
│ │ │ +
2359
│ │ │ +
2360
│ │ │ +
2361 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2362 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexDescriptor PropertiesGraph<G,V,E,VM,EM>::maxVertex() const
│ │ │ +
2363 {
│ │ │ +
2364 return graph_.maxVertex();
│ │ │ +
2365 }
│ │ │ +
2366
│ │ │ +
2367 template<class G, class V, class E, class VM, class EM>
│ │ │ +
2368 PropertiesGraph<G,V,E,VM,EM>::PropertiesGraph(Graph& graph, const VM& vmap, const EM& emap)
│ │ │ +
2369 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex()+1], V()),
│ │ │ +
2370 emap_(emap), edgeProperties_(graph_.noEdges(), E())
│ │ │ +
2371 {}
│ │ │ +
2372
│ │ │ +
2373 template<class G, class V>
│ │ │ +
2374 inline int visitNeighbours(const G& graph, const typename G::VertexDescriptor& vertex,
│ │ │ +
2375 V& visitor)
│ │ │ +
2376 {
│ │ │ +
2377 typedef typename G::ConstEdgeIterator iterator;
│ │ │ +
2378 const iterator end = graph.endEdges(vertex);
│ │ │ +
2379 int noNeighbours=0;
│ │ │ +
2380 for(iterator edge = graph.beginEdges(vertex); edge != end; ++edge, ++noNeighbours)
│ │ │ +
2381 visitor(edge);
│ │ │ +
2382 return noNeighbours;
│ │ │ +
2383 }
│ │ │ +
2384
│ │ │ +
2385#endif // DOXYGEN
│ │ │ +
2386
│ │ │ +
2388 }
│ │ │ +
2389}
│ │ │ +
2390#endif
│ │ │ + │ │ │ +
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
Definition matrixredistribute.hh:22
│ │ │ -
void redistributeBackward(D &from, const D &to) const
Definition matrixredistribute.hh:32
│ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ -
void project(T1 &x) const
Set vector to zero at copy dofs.
Definition owneroverlapcopy.hh:538
│ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
Definition pinfo.hh:28
│ │ │ -
Definition transfer.hh:32
│ │ │ -
static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, const Vector &fine, T &comm)
│ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp)
│ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R())
│ │ │ -
V1 Vertex
Definition transfer.hh:35
│ │ │ -
V2 Vector
Definition transfer.hh:36
│ │ │ -
RedistributeInformation< SequentialInformation > Redist
Definition transfer.hh:56
│ │ │ - │ │ │ - │ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation &comm=SequentialInformation(), const Redist &redist=Redist())
│ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, T1 damp, const SequentialInformation &comm=SequentialInformation())
│ │ │ - │ │ │ -
RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist
Definition transfer.hh:80
│ │ │ - │ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ +
MatrixGraph(Matrix &matrix)
Constructor.
│ │ │ +
VertexIterator end()
Get an iterator over the vertices.
│ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ +
M Matrix
The type of the matrix we are a graph for.
Definition graph.hh:56
│ │ │ +
ConstVertexIterator begin() const
Get an iterator over the vertices.
│ │ │ +
VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:308
│ │ │ +
~MatrixGraph()
Destructor.
│ │ │ +
std::ptrdiff_t EdgeDescriptor
The edge descriptor.
Definition graph.hh:80
│ │ │ +
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ +
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ +
const Matrix & matrix() const
Get the underlying matrix.
│ │ │ +
@ mutableMatrix
Definition graph.hh:86
│ │ │ +
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ +
ConstVertexIterator end() const
Get an iterator over the vertices.
│ │ │ +
EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:298
│ │ │ +
EdgeIterator beginEdges(const VertexDescriptor &source)
Get an iterator over the edges starting at a vertex.
│ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ +
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target) const
Find the descriptor of an edge.
│ │ │ +
M::block_type Weight
The type of the weights.
Definition graph.hh:66
│ │ │ +
std::remove_const< M >::type MutableMatrix
The mutable type of the matrix we are a graph for.
Definition graph.hh:61
│ │ │ +
EdgeIteratorT< MatrixGraph< Matrix > > EdgeIterator
The mutable edge iterator type.
Definition graph.hh:303
│ │ │ +
VertexIteratorT< MatrixGraph< Matrix > > VertexIterator
The mutable vertex iterator type.
Definition graph.hh:313
│ │ │ +
EdgeIterator endEdges(const VertexDescriptor &source)
Get an iterator over the edges starting at a vertex.
│ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ +
Matrix & matrix()
Get the underlying matrix.
│ │ │ +
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ +
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ +
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type WeightType
Definition graph.hh:156
│ │ │ +
EdgeIteratorT(const VertexDescriptor &source, const ColIterator &block, const ColIterator &end, const EdgeDescriptor &edge)
Constructor.
│ │ │ +
@ isMutable
whether C is mutable.
Definition graph.hh:112
│ │ │ +
VertexDescriptor target() const
The index of the target vertex of the current edge.
│ │ │ +
EdgeIteratorT< C > & operator++()
preincrement operator.
│ │ │ +
bool operator!=(const EdgeIteratorT< const typename std::remove_const< C >::type > &other) const
Inequality operator.
│ │ │ +
bool operator==(const EdgeIteratorT< const typename std::remove_const< C >::type > &other) const
Equality operator.
│ │ │ +
EdgeIteratorT(const EdgeIteratorT< C1 > &other)
Copy Constructor.
│ │ │ +
bool operator!=(const EdgeIteratorT< typename std::remove_const< C >::type > &other) const
Inequality operator.
│ │ │ +
WeightType & weight() const
Access the edge weight.
│ │ │ +
VertexDescriptor source() const
The index of the source vertex of the current edge.
│ │ │ +
std::conditional< isMutable &&C::mutableMatrix, typenameMatrix::row_type::Iterator, typenameMatrix::row_type::ConstIterator >::type ColIterator
The column iterator of the matrix we use.
Definition graph.hh:120
│ │ │ +
const std::remove_const< C >::type ConstContainer
The constant type of the container type.
Definition graph.hh:105
│ │ │ +
bool operator==(const EdgeIteratorT< typename std::remove_const< C >::type > &other) const
Equality operator.
│ │ │ +
EdgeIteratorT(const ColIterator &block)
Constructor for the end iterator.
│ │ │ +
std::conditional< isMutable &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type Weight
The matrix block type we use as weights.
Definition graph.hh:127
│ │ │ +
const EdgeDescriptor & operator*() const
Get the edge descriptor.
│ │ │ +
const EdgeDescriptor * operator->() const
Get the edge descriptor.
│ │ │ +
std::remove_const< C >::type MutableContainer
The mutable type of the container type.
Definition graph.hh:101
│ │ │ +
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ +
EdgeIteratorT< C > begin() const
Get an iterator over all edges starting at the current vertex.
│ │ │ +
const VertexDescriptor & operator*() const
Get the descriptor of the current vertex.
│ │ │ +
WeightType & weight() const
Access the weight of the vertex.
│ │ │ +
VertexIteratorT(C *graph, const VertexDescriptor &current)
Constructor.
│ │ │ +
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type WeightType
Definition graph.hh:266
│ │ │ +
VertexIteratorT(const VertexIteratorT< MutableContainer > &other)
│ │ │ +
std::remove_const< C >::type MutableContainer
The mutable type of the container type.
Definition graph.hh:214
│ │ │ +
bool operator!=(const VertexIteratorT< MutableContainer > &other) const
Inequality operator.
│ │ │ +
@ isMutable
whether C is mutable.
Definition graph.hh:225
│ │ │ +
bool operator==(const VertexIteratorT< MutableContainer > &other) const
Equality operator.
│ │ │ +
const std::remove_const< C >::type ConstContainer
The constant type of the container type.
Definition graph.hh:218
│ │ │ +
VertexIteratorT< C > & operator++()
Move to the next vertex.
│ │ │ +
EdgeIteratorT< C > end() const
Get an iterator over all edges starting at the current vertex.
│ │ │ +
bool operator==(const VertexIteratorT< ConstContainer > &other) const
Equality operator.
│ │ │ +
bool operator!=(const VertexIteratorT< ConstContainer > &other) const
Inequality operator.
│ │ │ +
VertexIteratorT(const VertexDescriptor &current)
Constructor for the end iterator.
│ │ │ +
A subgraph of a graph.
Definition graph.hh:443
│ │ │ +
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target) const
Find the descriptor of an edge.
│ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ +
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ +
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ +
ConstVertexIterator end() const
Get an iterator over the vertices.
│ │ │ +
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ +
T Excluded
Random access container providing information about which vertices are excluded.
Definition graph.hh:454
│ │ │ +
~SubGraph()
Destructor.
│ │ │ +
EdgeIterator ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:618
│ │ │ +
G Graph
The type of the graph we are a sub graph for.
Definition graph.hh:448
│ │ │ +
VertexIterator ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:623
│ │ │ +
SubGraph(const Graph &graph, const T &excluded)
Constructor.
│ │ │ +
ConstVertexIterator begin() const
Get an iterator over the vertices.
│ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:459
│ │ │ +
VertexDescriptor * EdgeDescriptor
Definition graph.hh:461
│ │ │ +
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ +
EdgeIndexMap(const EdgeIndexMap &emap)
Protect copy construction.
Definition graph.hh:479
│ │ │ +
ReadablePropertyMapTag Category
Definition graph.hh:472
│ │ │ +
EdgeIndexMap(const EdgeDescriptor &firstEdge)
Definition graph.hh:474
│ │ │ +
std::size_t operator[](const EdgeDescriptor &edge) const
Definition graph.hh:483
│ │ │ +
The edge iterator of the graph.
Definition graph.hh:505
│ │ │ +
const EdgeDescriptor & dereference() const
The descriptor of the current edge.
│ │ │ +
EdgeIterator(const EdgeDescriptor &edge)
Constructor for the end iterator.
│ │ │ +
bool equals(const EdgeIterator &other) const
Equality operator.
│ │ │ +
EdgeIterator & advance(std::ptrdiff_t n)
│ │ │ +
EdgeIterator & increment()
Preincrement operator.
│ │ │ +
const VertexDescriptor & target() const
The index of the target vertex of the current edge.
│ │ │ +
const VertexDescriptor & source() const
The index of the source vertex of the current edge.
│ │ │ +
EdgeIterator & decrement()
Preincrement operator.
│ │ │ +
std::ptrdiff_t distanceTo(const EdgeIterator &other) const
│ │ │ +
EdgeIterator(const VertexDescriptor &source, const EdgeDescriptor &edge)
Constructor.
│ │ │ +
The vertex iterator of the graph.
Definition graph.hh:560
│ │ │ +
VertexIterator(const VertexDescriptor &current)
Constructor for end iterator.
│ │ │ +
VertexIterator & increment()
Preincrement operator.
│ │ │ +
EdgeIterator begin() const
Get an iterator over all edges starting at the current vertex.
│ │ │ +
bool equals(const VertexIterator &other) const
Equality iterator.
│ │ │ +
VertexIterator(const SubGraph< G, T > *graph, const VertexDescriptor &current, const VertexDescriptor &end)
Constructor.
│ │ │ +
EdgeIterator end() const
Get an iterator over all edges starting at the current vertex.
│ │ │ +
const VertexDescriptor & dereference() const
Get the descriptor of the current vertex.
│ │ │ +
Attaches properties to the vertices of a graph.
Definition graph.hh:723
│ │ │ +
const Graph & graph() const
Get the graph the properties are attached to.
│ │ │ +
Graph::ConstEdgeIterator ConstEdgeIterator
The type of the constant edge iterator.
Definition graph.hh:766
│ │ │ +
VertexProperties & getVertexProperties(const VertexDescriptor &vertex)
Get the properties associated with a vertex.
│ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ +
Graph::EdgeDescriptor EdgeDescriptor
The edge descritor.
Definition graph.hh:738
│ │ │ +
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:733
│ │ │ +
G Graph
The graph we attach properties to.
Definition graph.hh:728
│ │ │ +
VM VertexMap
The type of the map for converting the VertexDescriptor to std::size_t.
Definition graph.hh:756
│ │ │ +
EdgeIterator endEdges(const VertexDescriptor &source)
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ +
EdgeIterator beginEdges(const VertexDescriptor &source)
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ +
VP VertexProperties
The type of the properties of the vertices.
Definition graph.hh:743
│ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ +
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ +
Graph::EdgeIterator EdgeIterator
The type of the mutable edge iterator.
Definition graph.hh:761
│ │ │ + │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type EdgeIterator
The class of the edge iterator.
Definition graph.hh:823
│ │ │ +
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
Get the properties of the current Vertex.
│ │ │ +
EdgeIterator end() const
Get an iterator over the edges starting from the current vertex.
│ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >::type Father
The father class.
Definition graph.hh:814
│ │ │ +
EdgeIterator begin() const
Get an iterator over the edges starting from the current vertex.
│ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ +
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ +
Graph::EdgeDescriptor EdgeDescriptor
The edge descritor.
Definition graph.hh:993
│ │ │ +
const EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const VertexDescriptor &target) const
Get the properties associated with a edge.
│ │ │ +
const EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) const
Get the properties associated with a edge.
│ │ │ +
const Graph & graph() const
Get the graph the properties are attached to.
│ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ +
G Graph
The graph we attach properties to.
Definition graph.hh:983
│ │ │ +
EM EdgeMap
The type of the map for converting the EdgeDescriptor to std::size_t.
Definition graph.hh:1030
│ │ │ +
VM VertexMap
The type of the map for converting the VertexDescriptor to std::size_t.
Definition graph.hh:1011
│ │ │ +
VP VertexProperties
The type of the properties of the vertices.
Definition graph.hh:998
│ │ │ +
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ +
EP EdgeProperties
The type of the properties of the edges;.
Definition graph.hh:1016
│ │ │ +
EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const VertexDescriptor &target)
Get the properties associated with a edge.
│ │ │ +
EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge)
Get the properties associated with a edge.
│ │ │ +
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ +
PropertiesGraph(Graph &graph, const VertexMap &vmap=VertexMap(), const EdgeMap &emap=EdgeMap())
Constructor.
│ │ │ + │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type Father
The father class.
Definition graph.hh:1050
│ │ │ + │ │ │ +
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >::type Father
The father class.
Definition graph.hh:1151
│ │ │ +
Wrapper to access the internal edge properties of a graph via operator[]()
Definition graph.hh:1361
│ │ │ +
GraphVertexPropertiesSelector(G &g)
Constructor.
Definition graph.hh:1380
│ │ │ +
VertexProperties & operator[](const Vertex &vertex) const
Get the properties associated to a vertex.
Definition graph.hh:1395
│ │ │ +
G Graph
The type of the graph with internal properties.
Definition graph.hh:1366
│ │ │ +
G::VertexProperties VertexProperties
The type of the vertex properties.
Definition graph.hh:1370
│ │ │ +
GraphVertexPropertiesSelector()
Default constructor.
Definition graph.hh:1386
│ │ │ +
G::VertexDescriptor Vertex
The vertex descriptor.
Definition graph.hh:1374
│ │ │ +
Wrapper to access the internal vertex properties of a graph via operator[]()
Definition graph.hh:1409
│ │ │ +
EdgeProperties & operator[](const Edge &edge) const
Get the properties associated to a vertex.
Definition graph.hh:1442
│ │ │ +
G::EdgeProperties EdgeProperties
The type of the vertex properties.
Definition graph.hh:1418
│ │ │ +
G::EdgeDescriptor Edge
The edge descriptor.
Definition graph.hh:1422
│ │ │ +
GraphEdgePropertiesSelector()
Default constructor.
Definition graph.hh:1434
│ │ │ +
G Graph
The type of the graph with internal properties.
Definition graph.hh:1414
│ │ │ +
GraphEdgePropertiesSelector(G &g)
Constructor.
Definition graph.hh:1428
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,294 +1,2286 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -transfer.hh │ │ │ │ +graph.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMGTRANSFER_HH │ │ │ │ -6#define DUNE_AMGTRANSFER_HH │ │ │ │ +5#ifndef DUNE_AMG_GRAPH_HH │ │ │ │ +6#define DUNE_AMG_GRAPH_HH │ │ │ │ 7 │ │ │ │ -8#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ -9#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_p_i_n_f_o_._h_h> │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ -13#include │ │ │ │ -14 │ │ │ │ -15namespace _D_u_n_e │ │ │ │ -16{ │ │ │ │ -17 namespace Amg │ │ │ │ -18 { │ │ │ │ -19 │ │ │ │ -30 template │ │ │ │ -_3_1 class _T_r_a_n_s_f_e_r │ │ │ │ -32 { │ │ │ │ -33 │ │ │ │ -34 public: │ │ │ │ -_3_5 typedef V1 _V_e_r_t_e_x; │ │ │ │ -_3_6 typedef V2 _V_e_c_t_o_r; │ │ │ │ -37 │ │ │ │ -38 template │ │ │ │ -_3_9 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -40 _V_e_c_t_o_r& fineRedist,T1 damp, R& redistributor=R()); │ │ │ │ -41 │ │ │ │ -42 template │ │ │ │ -_4_3 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -44 T1 damp); │ │ │ │ -45 │ │ │ │ -_4_6 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ -coarse, const _V_e_c_t_o_r& fine, │ │ │ │ -47 T& comm); │ │ │ │ -48 }; │ │ │ │ -49 │ │ │ │ -50 template │ │ │ │ -_5_1 class _T_r_a_n_s_f_e_r │ │ │ │ -52 { │ │ │ │ -53 public: │ │ │ │ -_5_4 typedef V _V_e_r_t_e_x; │ │ │ │ -_5_5 typedef V1 _V_e_c_t_o_r; │ │ │ │ -_5_6 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_> _R_e_d_i_s_t; │ │ │ │ -57 template │ │ │ │ -_5_8 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -59 _V_e_c_t_o_r& fineRedist, T1 damp, │ │ │ │ -60 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm=_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(), │ │ │ │ -61 const _R_e_d_i_s_t& redist=_R_e_d_i_s_t()); │ │ │ │ -62 template │ │ │ │ -_6_3 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -64 T1 damp, │ │ │ │ -65 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm=_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ -66 │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ +16#include │ │ │ │ +17 │ │ │ │ +18namespace _D_u_n_e │ │ │ │ +19{ │ │ │ │ +20 namespace Amg │ │ │ │ +21 { │ │ │ │ +49 template │ │ │ │ +_5_0 class _M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +51 { │ │ │ │ +52 public: │ │ │ │ +_5_6 typedef M _M_a_t_r_i_x; │ │ │ │ +57 │ │ │ │ +_6_1 typedef typename std::remove_const::type _M_u_t_a_b_l_e_M_a_t_r_i_x; │ │ │ │ +62 │ │ │ │ +_6_6 typedef typename M::block_type _W_e_i_g_h_t; │ │ │ │ 67 │ │ │ │ -68 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ -coarse, const _V_e_c_t_o_r& fine, │ │ │ │ -69 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm); │ │ │ │ -70 }; │ │ │ │ -71 │ │ │ │ -72#if HAVE_MPI │ │ │ │ -73 │ │ │ │ -74 template │ │ │ │ -_7_5 class _T_r_a_n_s_f_e_r > │ │ │ │ -76 { │ │ │ │ -77 public: │ │ │ │ -_7_8 typedef V _V_e_r_t_e_x; │ │ │ │ -_7_9 typedef V1 _V_e_c_t_o_r; │ │ │ │ -_8_0 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> > │ │ │ │ -_R_e_d_i_s_t; │ │ │ │ -81 template │ │ │ │ -82 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -83 _V_e_c_t_o_r& fineRedist, T3 damp, _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ -84 const _R_e_d_i_s_t& redist); │ │ │ │ -85 template │ │ │ │ -86 static void _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -_V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -87 T3 damp, _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm); │ │ │ │ +_7_3 typedef typename M::size_type _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +74 │ │ │ │ +_8_0 typedef std::ptrdiff_t _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +81 │ │ │ │ +82 enum { │ │ │ │ +83 /* │ │ │ │ +84 * @brief Whether Matrix is mutable. │ │ │ │ +85 */ │ │ │ │ +86 _m_u_t_a_b_l_e_M_a_t_r_i_x = std::is_same::type>::value │ │ │ │ +_8_7 }; │ │ │ │ 88 │ │ │ │ -89 static void _r_e_s_t_r_i_c_t_V_e_c_t_o_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _V_e_c_t_o_r& │ │ │ │ -coarse, const _V_e_c_t_o_r& fine, │ │ │ │ -90 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm); │ │ │ │ -91 }; │ │ │ │ -92 │ │ │ │ -93#endif │ │ │ │ -94 │ │ │ │ -95 template │ │ │ │ -96 template │ │ │ │ -97 inline void │ │ │ │ -_9_8 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -99 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -100 [[maybe_unused]] _V_e_c_t_o_r& fineRedist, │ │ │ │ -101 T damp, │ │ │ │ -102 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm, │ │ │ │ -103 [[maybe_unused]] const _R_e_d_i_s_t& redist) │ │ │ │ -104 { │ │ │ │ -105 prolongateVector(aggregates, coarse, fine, damp); │ │ │ │ -106 } │ │ │ │ -107 template │ │ │ │ -108 template │ │ │ │ -109 inline void │ │ │ │ -_1_1_0 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(const │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -111 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -112 T damp, │ │ │ │ -113 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ -114 { │ │ │ │ -115 typedef typename Vector::iterator Iterator; │ │ │ │ -116 │ │ │ │ -117 Iterator end = coarse.end(); │ │ │ │ -118 Iterator begin= coarse.begin(); │ │ │ │ -119 for(; begin!=end; ++begin) │ │ │ │ -120 *begin*=damp; │ │ │ │ -121 end=fine.end(); │ │ │ │ -122 begin=fine.begin(); │ │ │ │ -123 │ │ │ │ -124 for(Iterator block=begin; block != end; ++block) { │ │ │ │ -125 std::ptrdiff_t index=block-begin; │ │ │ │ -126 const _V_e_r_t_e_x& vertex = aggregates[index]; │ │ │ │ -127 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ -128 *block += coarse[aggregates[index]]; │ │ │ │ -129 } │ │ │ │ -130 } │ │ │ │ -131 │ │ │ │ -132 template │ │ │ │ -133 inline void │ │ │ │ -_1_3_4 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(const │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -135 _V_e_c_t_o_r& coarse, │ │ │ │ -136 const _V_e_c_t_o_r& fine, │ │ │ │ -137 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& comm) │ │ │ │ -138 { │ │ │ │ -139 // Set coarse vector to zero │ │ │ │ -140 coarse=0; │ │ │ │ -141 │ │ │ │ -142 typedef typename Vector::const_iterator Iterator; │ │ │ │ -143 Iterator end = fine._e_n_d(); │ │ │ │ -144 Iterator begin=fine.begin(); │ │ │ │ -145 │ │ │ │ -146 for(Iterator block=begin; block != end; ++block) { │ │ │ │ -147 const _V_e_r_t_e_x& vertex = aggregates[block-begin]; │ │ │ │ -148 if(vertex != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ -149 coarse[vertex] += *block; │ │ │ │ -150 } │ │ │ │ -151 } │ │ │ │ -152 │ │ │ │ -153#if HAVE_MPI │ │ │ │ -154 template │ │ │ │ -155 template │ │ │ │ -_1_5_6 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ -prolongateVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -157 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, │ │ │ │ -158 _V_e_c_t_o_r& fineRedist, T3 damp, │ │ │ │ -159 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm, │ │ │ │ -160 const _R_e_d_i_s_t& redist) │ │ │ │ -161 { │ │ │ │ -162 if(fineRedist.size()>0) │ │ │ │ -163 // we operated on the coarse level │ │ │ │ -164 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ -fineRedist, damp); │ │ │ │ +89 │ │ │ │ +93 template │ │ │ │ +_9_4 class _E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +95 { │ │ │ │ +96 │ │ │ │ +97 public: │ │ │ │ +_1_0_1 typedef typename std::remove_const::type _M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r; │ │ │ │ +_1_0_5 typedef const typename std::remove_const::type _C_o_n_s_t_C_o_n_t_a_i_n_e_r; │ │ │ │ +106 │ │ │ │ +107 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r>; │ │ │ │ +108 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T<_C_o_n_s_t_C_o_n_t_a_i_n_e_r>; │ │ │ │ +109 │ │ │ │ +110 enum { │ │ │ │ +112 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ +_1_1_3 }; │ │ │ │ +114 │ │ │ │ +118 typedef typename std::conditional<_i_s_M_u_t_a_b_l_e && C::mutableMatrix,typename │ │ │ │ +Matrix::row_type::Iterator, │ │ │ │ +119 typename Matrix::row_type::ConstIterator>::type │ │ │ │ +_1_2_0 _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ +121 │ │ │ │ +125 typedef typename std::conditional<_i_s_M_u_t_a_b_l_e && C::mutableMatrix,typename │ │ │ │ +M::block_type, │ │ │ │ +126 const typename M::block_type>::type │ │ │ │ +_1_2_7 _W_e_i_g_h_t; │ │ │ │ +128 │ │ │ │ +_1_3_6 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e, const _C_o_l_I_t_e_r_a_t_o_r& block, │ │ │ │ +137 const _C_o_l_I_t_e_r_a_t_o_r& _e_n_d, const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ +138 │ │ │ │ +_1_4_5 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _C_o_l_I_t_e_r_a_t_o_r& block); │ │ │ │ +146 │ │ │ │ +151 template │ │ │ │ +_1_5_2 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_1_>& other); │ │ │ │ +153 │ │ │ │ +154 typedef typename std::conditional::type>::value && C::mutableMatrix, │ │ │ │ +155 typename M::block_type, const typename M::block_type>::type │ │ │ │ +_1_5_6 _W_e_i_g_h_t_T_y_p_e; │ │ │ │ +157 │ │ │ │ +_1_6_1 _W_e_i_g_h_t_T_y_p_e& _w_e_i_g_h_t() const; │ │ │ │ +162 │ │ │ │ +_1_6_4 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_>& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ 165 │ │ │ │ -166 // TODO This could be accomplished with one communication, too! │ │ │ │ -167 redist._r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d(fine, fineRedist); │ │ │ │ -168 comm._c_o_p_y_O_w_n_e_r_T_o_A_l_l(fine,fine); │ │ │ │ -169 } │ │ │ │ -170 │ │ │ │ -171 template │ │ │ │ -172 template │ │ │ │ -_1_7_3 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ -prolongateVector( │ │ │ │ -174 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -175 _V_e_c_t_o_r& coarse, _V_e_c_t_o_r& fine, T3 damp, │ │ │ │ -176 [[maybe_unused]] _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ -177 { │ │ │ │ -178 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ -fine, damp); │ │ │ │ -179 } │ │ │ │ -180 template │ │ │ │ -_1_8_1 inline void _T_r_a_n_s_f_e_r_<_V_,_V_1_,_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> >:: │ │ │ │ -restrictVector(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -182 _V_e_c_t_o_r& coarse, const _V_e_c_t_o_r& fine, │ │ │ │ -183 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_>& comm) │ │ │ │ -184 { │ │ │ │ -185 _T_r_a_n_s_f_e_r_<_V_,_V_1_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(aggregates, coarse, │ │ │ │ -fine, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ -186 // We need this here to avoid it in the smoothers on the coarse level. │ │ │ │ -187 // There (in the preconditioner d is const. │ │ │ │ -188 comm._p_r_o_j_e_c_t(coarse); │ │ │ │ -189 } │ │ │ │ -190#endif │ │ │ │ -192 } // namspace Amg │ │ │ │ -193} // namspace Dune │ │ │ │ -194#endif │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ -_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ -Provides classes for the Coloring process of AMG. │ │ │ │ -_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ -Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ -_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h │ │ │ │ -Functionality for redistributing a sparse matrix. │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ -const_iterator end() const │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ +_1_6_7 bool _o_p_e_r_a_t_o_r_!_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T::type>& │ │ │ │ +other) const; │ │ │ │ +168 │ │ │ │ +_1_7_0 bool _o_p_e_r_a_t_o_r_!_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T:: │ │ │ │ +type>& other) const; │ │ │ │ +171 │ │ │ │ +_1_7_3 bool _o_p_e_r_a_t_o_r_=_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T::type>& │ │ │ │ +other) const; │ │ │ │ +174 │ │ │ │ +_1_7_6 bool _o_p_e_r_a_t_o_r_=_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T:: │ │ │ │ +type>& other) const; │ │ │ │ +177 │ │ │ │ +_1_7_9 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _t_a_r_g_e_t() const; │ │ │ │ +180 │ │ │ │ +_1_8_2 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _s_o_u_r_c_e() const; │ │ │ │ +183 │ │ │ │ +_1_8_5 const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_*() const; │ │ │ │ +186 │ │ │ │ +_1_8_8 const _E_d_g_e_D_e_s_c_r_i_p_t_o_r* _o_p_e_r_a_t_o_r_-_>() const; │ │ │ │ +189 │ │ │ │ +190 private: │ │ │ │ +192 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r source_; │ │ │ │ +194 _C_o_l_I_t_e_r_a_t_o_r block_; │ │ │ │ +195 /*** │ │ │ │ +196 * @brief The column iterator positioned at the end of the row │ │ │ │ +197 * of vertex source_ │ │ │ │ +198 */ │ │ │ │ +199 _C_o_l_I_t_e_r_a_t_o_r blockEnd_; │ │ │ │ +201 _E_d_g_e_D_e_s_c_r_i_p_t_o_r edge_; │ │ │ │ +202 }; │ │ │ │ +203 │ │ │ │ +207 template │ │ │ │ +_2_0_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +209 { │ │ │ │ +210 public: │ │ │ │ +_2_1_4 typedef typename std::remove_const::type _M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r; │ │ │ │ +_2_1_8 typedef const typename std::remove_const::type _C_o_n_s_t_C_o_n_t_a_i_n_e_r; │ │ │ │ +219 │ │ │ │ +220 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r>; │ │ │ │ +221 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T<_C_o_n_s_t_C_o_n_t_a_i_n_e_r>; │ │ │ │ +222 │ │ │ │ +223 enum { │ │ │ │ +225 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ +_2_2_6 }; │ │ │ │ +227 │ │ │ │ +_2_3_3 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(C* graph, const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ +234 │ │ │ │ +_2_4_2 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ +243 │ │ │ │ +_2_4_4 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other); │ │ │ │ +245 │ │ │ │ +_2_5_0 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_>& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ +251 │ │ │ │ +_2_5_3 bool _o_p_e_r_a_t_o_r_!_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_o_n_s_t_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ +254 │ │ │ │ +_2_5_6 bool _o_p_e_r_a_t_o_r_=_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_o_n_s_t_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ +257 │ │ │ │ +_2_5_9 bool _o_p_e_r_a_t_o_r_!_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ +260 │ │ │ │ +_2_6_2 bool _o_p_e_r_a_t_o_r_=_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ +263 │ │ │ │ +264 typedef typename std::conditional::type>::value && C::mutableMatrix, │ │ │ │ +265 typename M::block_type, const typename M::block_type>::type │ │ │ │ +_2_6_6 _W_e_i_g_h_t_T_y_p_e; │ │ │ │ +_2_6_8 _W_e_i_g_h_t_T_y_p_e& _w_e_i_g_h_t() const; │ │ │ │ +269 │ │ │ │ +_2_7_4 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_*() const; │ │ │ │ +275 │ │ │ │ +_2_8_1 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_> _b_e_g_i_n() const; │ │ │ │ +282 │ │ │ │ +_2_8_8 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_> _e_n_d() const; │ │ │ │ +289 │ │ │ │ +290 private: │ │ │ │ +291 C* graph_; │ │ │ │ +292 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r current_; │ │ │ │ +293 }; │ │ │ │ +294 │ │ │ │ +_2_9_8 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T_<_c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +299 │ │ │ │ +_3_0_3 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T_<_M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +304 │ │ │ │ +_3_0_8 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +309 │ │ │ │ +_3_1_3 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +314 │ │ │ │ +_3_1_9 _M_a_t_r_i_x_G_r_a_p_h(_M_a_t_r_i_x& _m_a_t_r_i_x); │ │ │ │ +320 │ │ │ │ +_3_2_4 _~_M_a_t_r_i_x_G_r_a_p_h(); │ │ │ │ +325 │ │ │ │ +_3_3_0 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ +331 │ │ │ │ +_3_3_6 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ +337 │ │ │ │ +_3_4_2 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +343 │ │ │ │ +_3_4_8 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +349 │ │ │ │ +_3_5_6 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ +357 │ │ │ │ +_3_6_4 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ +365 │ │ │ │ +366 │ │ │ │ +_3_7_3 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +374 │ │ │ │ +_3_8_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +382 │ │ │ │ +_3_8_7 _M_a_t_r_i_x& _m_a_t_r_i_x(); │ │ │ │ +388 │ │ │ │ +_3_9_3 const _M_a_t_r_i_x& _m_a_t_r_i_x() const; │ │ │ │ +394 │ │ │ │ +_3_9_8 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +399 │ │ │ │ +_4_0_6 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ +407 │ │ │ │ +_4_1_1 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ +412 │ │ │ │ +_4_1_9 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ +420 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ +421 │ │ │ │ +422 private: │ │ │ │ +424 _M_a_t_r_i_x& matrix_; │ │ │ │ +426 _E_d_g_e_D_e_s_c_r_i_p_t_o_r* start_; │ │ │ │ +428 _M_a_t_r_i_x_G_r_a_p_h(const _M_a_t_r_i_x_G_r_a_p_h&); │ │ │ │ +429 │ │ │ │ +430 }; │ │ │ │ +431 │ │ │ │ +441 template │ │ │ │ +_4_4_2 class _S_u_b_G_r_a_p_h │ │ │ │ +443 { │ │ │ │ +444 public: │ │ │ │ +_4_4_8 typedef G _G_r_a_p_h; │ │ │ │ +449 │ │ │ │ +_4_5_4 typedef T _E_x_c_l_u_d_e_d; │ │ │ │ +455 │ │ │ │ +_4_5_9 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +460 │ │ │ │ +_4_6_1 typedef _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +462 │ │ │ │ +_4_6_9 class _E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +470 { │ │ │ │ +471 public: │ │ │ │ +_4_7_2 typedef ReadablePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ +473 │ │ │ │ +_4_7_4 _E_d_g_e_I_n_d_e_x_M_a_p(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& firstEdge) │ │ │ │ +475 : firstEdge_(firstEdge) │ │ │ │ +476 {} │ │ │ │ +477 │ │ │ │ +_4_7_9 _E_d_g_e_I_n_d_e_x_M_a_p(const _E_d_g_e_I_n_d_e_x_M_a_p& emap) │ │ │ │ +480 : firstEdge_(emap.firstEdge_) │ │ │ │ +481 {} │ │ │ │ +482 │ │ │ │ +_4_8_3 std::size_t _o_p_e_r_a_t_o_r_[_](const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge) const │ │ │ │ +484 { │ │ │ │ +485 return edge-firstEdge_; │ │ │ │ +486 } │ │ │ │ +487 private: │ │ │ │ +489 _E_d_g_e_D_e_s_c_r_i_p_t_o_r firstEdge_; │ │ │ │ +491 _E_d_g_e_I_n_d_e_x_M_a_p() │ │ │ │ +492 {} │ │ │ │ +493 }; │ │ │ │ +494 │ │ │ │ +_4_9_9 _E_d_g_e_I_n_d_e_x_M_a_p _g_e_t_E_d_g_e_I_n_d_e_x_M_a_p(); │ │ │ │ +500 │ │ │ │ +_5_0_4 class _E_d_g_e_I_t_e_r_a_t_o_r : public RandomAccessIteratorFacade │ │ │ │ +505 { │ │ │ │ +506 public: │ │ │ │ +_5_1_2 explicit _E_d_g_e_I_t_e_r_a_t_o_r(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e, const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ +edge); │ │ │ │ +513 │ │ │ │ +_5_2_1 explicit _E_d_g_e_I_t_e_r_a_t_o_r(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ +522 │ │ │ │ +_5_2_4 bool _e_q_u_a_l_s(const _E_d_g_e_I_t_e_r_a_t_o_r& other) const; │ │ │ │ +525 │ │ │ │ +_5_2_7 _E_d_g_e_I_t_e_r_a_t_o_r& _i_n_c_r_e_m_e_n_t(); │ │ │ │ +528 │ │ │ │ +_5_3_0 _E_d_g_e_I_t_e_r_a_t_o_r& _d_e_c_r_e_m_e_n_t(); │ │ │ │ +531 │ │ │ │ +_5_3_2 _E_d_g_e_I_t_e_r_a_t_o_r& _a_d_v_a_n_c_e(std::ptrdiff_t n); │ │ │ │ +533 │ │ │ │ +_5_3_5 const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ +536 │ │ │ │ +_5_3_8 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _t_a_r_g_e_t() const; │ │ │ │ +539 │ │ │ │ +_5_4_1 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e() const; │ │ │ │ +542 │ │ │ │ +_5_4_3 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _E_d_g_e_I_t_e_r_a_t_o_r& other) const; │ │ │ │ +544 │ │ │ │ +545 private: │ │ │ │ +547 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r source_; │ │ │ │ +552 _E_d_g_e_D_e_s_c_r_i_p_t_o_r edge_; │ │ │ │ +553 }; │ │ │ │ +554 │ │ │ │ +_5_5_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +559 : public ForwardIteratorFacade │ │ │ │ +560 { │ │ │ │ +561 public: │ │ │ │ +_5_6_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r(const _S_u_b_G_r_a_p_h_<_G_,_T_>* graph, const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& │ │ │ │ +current, │ │ │ │ +569 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _e_n_d); │ │ │ │ +570 │ │ │ │ +571 │ │ │ │ +_5_7_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ +579 │ │ │ │ +_5_8_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r& _i_n_c_r_e_m_e_n_t(); │ │ │ │ +582 │ │ │ │ +_5_8_4 bool _e_q_u_a_l_s(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r& other) const; │ │ │ │ +585 │ │ │ │ +_5_9_0 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ +591 │ │ │ │ +_5_9_7 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +598 │ │ │ │ +_6_0_4 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +605 │ │ │ │ +606 private: │ │ │ │ +608 const _S_u_b_G_r_a_p_h_<_G_r_a_p_h_,_T_>* graph_; │ │ │ │ +610 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r current_; │ │ │ │ +612 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r end_; │ │ │ │ +613 }; │ │ │ │ +614 │ │ │ │ +_6_1_8 typedef _E_d_g_e_I_t_e_r_a_t_o_r _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +619 │ │ │ │ +_6_2_3 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +624 │ │ │ │ +_6_2_9 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +630 │ │ │ │ +_6_3_5 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +636 │ │ │ │ +_6_4_3 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +644 │ │ │ │ +_6_5_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +652 │ │ │ │ +_6_5_6 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +657 │ │ │ │ +_6_6_4 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ +665 │ │ │ │ +_6_6_9 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ +_6_7_6 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ +677 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ +_6_8_5 _S_u_b_G_r_a_p_h(const _G_r_a_p_h& graph, const T& excluded); │ │ │ │ +686 │ │ │ │ +_6_9_0 _~_S_u_b_G_r_a_p_h(); │ │ │ │ +691 │ │ │ │ +692 private: │ │ │ │ +694 const T& excluded_; │ │ │ │ +696 std::size_t noVertices_; │ │ │ │ +698 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r endVertex_; │ │ │ │ +700 int noEdges_; │ │ │ │ +705 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r maxVertex_; │ │ │ │ +707 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* edges_; │ │ │ │ +709 std::ptrdiff_t* start_; │ │ │ │ +711 std::ptrdiff_t* end_; │ │ │ │ +713 _S_u_b_G_r_a_p_h(const _S_u_b_G_r_a_p_h&) │ │ │ │ +714 {} │ │ │ │ +715 }; │ │ │ │ +716 │ │ │ │ +717 │ │ │ │ +721 template │ │ │ │ +_7_2_2 class _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +723 { │ │ │ │ +724 public: │ │ │ │ +_7_2_8 typedef G _G_r_a_p_h; │ │ │ │ +729 │ │ │ │ +_7_3_3 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +734 │ │ │ │ +_7_3_8 typedef typename Graph::EdgeDescriptor _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +739 │ │ │ │ +_7_4_3 typedef VP _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ +744 │ │ │ │ +_7_5_6 typedef VM _V_e_r_t_e_x_M_a_p; │ │ │ │ +757 │ │ │ │ +_7_6_1 typedef typename Graph::EdgeIterator _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +762 │ │ │ │ +_7_6_6 typedef typename Graph::ConstEdgeIterator _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +767 │ │ │ │ +_7_7_3 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ +774 │ │ │ │ +_7_8_0 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ +781 │ │ │ │ +_7_8_7 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +788 │ │ │ │ +_7_9_4 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +795 │ │ │ │ +796 │ │ │ │ +797 template │ │ │ │ +_7_9_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +799 : public std::conditional::type, │ │ │ │ +800 C>::value, │ │ │ │ +801 typename Graph::VertexIterator, │ │ │ │ +802 typename Graph::ConstVertexIterator>::type │ │ │ │ +803 { │ │ │ │ +804 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ +805 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ +806 public: │ │ │ │ +810 typedef typename std::conditional::type, │ │ │ │ +811 C>::value, │ │ │ │ +812 typename Graph::VertexIterator, │ │ │ │ +813 typename Graph::ConstVertexIterator>::type │ │ │ │ +_8_1_4 _F_a_t_h_e_r; │ │ │ │ +815 │ │ │ │ +819 typedef typename std::conditional::type, │ │ │ │ +820 C>::value, │ │ │ │ +821 typename Graph::EdgeIterator, │ │ │ │ +822 typename Graph::ConstEdgeIterator>::type │ │ │ │ +_8_2_3 _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +824 │ │ │ │ +_8_3_0 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ +831 C* graph); │ │ │ │ +832 │ │ │ │ +833 │ │ │ │ +_8_4_1 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ +842 │ │ │ │ +847 template │ │ │ │ +_8_4_8 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const VertexIteratorT& other); │ │ │ │ +849 │ │ │ │ +853 typename std::conditional:: │ │ │ │ +type>::value, │ │ │ │ +854 VertexProperties&, │ │ │ │ +855 const VertexProperties&>::type │ │ │ │ +_8_5_6 _p_r_o_p_e_r_t_i_e_s() const; │ │ │ │ +857 │ │ │ │ +_8_6_3 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +864 │ │ │ │ +_8_7_0 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +871 │ │ │ │ +872 private: │ │ │ │ +876 C* graph_; │ │ │ │ +877 }; │ │ │ │ +878 │ │ │ │ +882 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +884 │ │ │ │ +888 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +890 │ │ │ │ +_8_9_5 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ +896 │ │ │ │ +_9_0_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ +902 │ │ │ │ +_9_0_7 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +908 │ │ │ │ +_9_1_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +914 │ │ │ │ +_9_2_0 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s(const VertexDescriptor& vertex); │ │ │ │ +921 │ │ │ │ +_9_2_7 const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s(const VertexDescriptor& vertex) │ │ │ │ +const; │ │ │ │ +928 │ │ │ │ +_9_3_3 const _G_r_a_p_h& _g_r_a_p_h() const; │ │ │ │ +934 │ │ │ │ +_9_3_8 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +939 │ │ │ │ +_9_4_3 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ +944 │ │ │ │ +_9_5_1 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ +952 │ │ │ │ +_9_5_8 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(Graph& graph, const VertexMap vmap=VertexMap()); │ │ │ │ +959 │ │ │ │ +960 private: │ │ │ │ +961 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(const VertexPropertiesGraph&) │ │ │ │ +962 {} │ │ │ │ +963 │ │ │ │ +965 _G_r_a_p_h& graph_; │ │ │ │ +967 _V_e_r_t_e_x_M_a_p vmap_; │ │ │ │ +_9_6_9 std::vector vertexProperties_; │ │ │ │ +970 │ │ │ │ +971 }; │ │ │ │ +972 │ │ │ │ +976 template │ │ │ │ +_9_7_7 class _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +978 { │ │ │ │ +979 public: │ │ │ │ +_9_8_3 typedef G _G_r_a_p_h; │ │ │ │ +984 │ │ │ │ +_9_8_8 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +989 │ │ │ │ +_9_9_3 typedef typename Graph::EdgeDescriptor _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +994 │ │ │ │ +_9_9_8 typedef VP _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ +999 │ │ │ │ +_1_0_1_1 typedef VM _V_e_r_t_e_x_M_a_p; │ │ │ │ +1012 │ │ │ │ +_1_0_1_6 typedef EP _E_d_g_e_P_r_o_p_e_r_t_i_e_s; │ │ │ │ +1017 │ │ │ │ +1018 │ │ │ │ +_1_0_3_0 typedef EM _E_d_g_e_M_a_p; │ │ │ │ +1031 │ │ │ │ +1032 template │ │ │ │ +_1_0_3_3 class _E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +1034 : public std::conditional:: │ │ │ │ +type, │ │ │ │ +1035 C>::value, │ │ │ │ +1036 typename Graph::EdgeIterator, │ │ │ │ +1037 typename Graph::ConstEdgeIterator>::type │ │ │ │ +1038 { │ │ │ │ +1039 │ │ │ │ +1040 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ +1041 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ +1042 public: │ │ │ │ +1046 typedef typename std::conditional::type, │ │ │ │ +1047 C>::value, │ │ │ │ +1048 typename Graph::EdgeIterator, │ │ │ │ +1049 typename Graph::ConstEdgeIterator>::type │ │ │ │ +_1_0_5_0 _F_a_t_h_e_r; │ │ │ │ +1051 │ │ │ │ +_1_0_5_7 explicit _E_d_g_e_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ +1058 C* graph); │ │ │ │ +1059 │ │ │ │ +_1_0_6_7 explicit _E_d_g_e_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ +1068 │ │ │ │ +1073 template │ │ │ │ +_1_0_7_4 _E_d_g_e_I_t_e_r_a_t_o_r_T(const EdgeIteratorT& other); │ │ │ │ +1075 │ │ │ │ +1079 typename std::conditional:: │ │ │ │ +type>::value, │ │ │ │ +1080 EdgeProperties&, │ │ │ │ +1081 const EdgeProperties&>::type │ │ │ │ +_1_0_8_2 properties() const; │ │ │ │ +1083 │ │ │ │ +1084 private: │ │ │ │ +_1_0_8_8 C* graph_; │ │ │ │ +1089 }; │ │ │ │ +1090 │ │ │ │ +1094 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T > _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +1097 │ │ │ │ +1101 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +1104 │ │ │ │ +_1_1_1_0 _E_d_g_e_I_t_e_r_a_t_o_r beginEdges(const VertexDescriptor& source); │ │ │ │ +1111 │ │ │ │ +_1_1_1_7 _E_d_g_e_I_t_e_r_a_t_o_r endEdges(const VertexDescriptor& source); │ │ │ │ +1118 │ │ │ │ +_1_1_2_4 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r beginEdges(const VertexDescriptor& source) const; │ │ │ │ +1125 │ │ │ │ +_1_1_3_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r endEdges(const VertexDescriptor& source) const; │ │ │ │ +1132 │ │ │ │ +1133 │ │ │ │ +1134 template │ │ │ │ +_1_1_3_5 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +1136 : public std::conditional:: │ │ │ │ +type, │ │ │ │ +1137 C>::value, │ │ │ │ +1138 typename Graph::VertexIterator, │ │ │ │ +1139 typename Graph::ConstVertexIterator>::type │ │ │ │ +1140 { │ │ │ │ +1141 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ +1142 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ +1143 public: │ │ │ │ +1147 typedef typename std::conditional::type, │ │ │ │ +1148 C>::value, │ │ │ │ +1149 typename Graph::VertexIterator, │ │ │ │ +1150 typename Graph::ConstVertexIterator>::type │ │ │ │ +_1_1_5_1 _F_a_t_h_e_r; │ │ │ │ +1152 │ │ │ │ +_1_1_5_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ +1159 C* graph); │ │ │ │ +1160 │ │ │ │ +1161 │ │ │ │ +_1_1_6_9 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ +1170 │ │ │ │ +1175 template │ │ │ │ +_1_1_7_6 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const VertexIteratorT& other); │ │ │ │ +1177 │ │ │ │ +1181 typename std::conditional:: │ │ │ │ +type>::value, │ │ │ │ +1182 VertexProperties&, │ │ │ │ +1183 const VertexProperties&>::type │ │ │ │ +_1_1_8_4 properties() const; │ │ │ │ +1185 │ │ │ │ +_1_1_9_1 _E_d_g_e_I_t_e_r_a_t_o_r_T begin() const; │ │ │ │ +1192 │ │ │ │ +_1_1_9_8 _E_d_g_e_I_t_e_r_a_t_o_r_T end() const; │ │ │ │ +1199 │ │ │ │ +1200 private: │ │ │ │ +1204 C* graph_; │ │ │ │ +1205 }; │ │ │ │ +1206 │ │ │ │ +1210 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +1213 │ │ │ │ +1217 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +1220 │ │ │ │ +_1_2_2_5 _V_e_r_t_e_x_I_t_e_r_a_t_o_r begin(); │ │ │ │ +1226 │ │ │ │ +_1_2_3_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r end(); │ │ │ │ +1232 │ │ │ │ +_1_2_3_7 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r begin() const; │ │ │ │ +1238 │ │ │ │ +_1_2_4_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r end() const; │ │ │ │ +1244 │ │ │ │ +_1_2_5_0 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& getVertexProperties(const VertexDescriptor& vertex); │ │ │ │ +1251 │ │ │ │ +_1_2_5_7 const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& getVertexProperties(const VertexDescriptor& │ │ │ │ +vertex) const; │ │ │ │ +1258 │ │ │ │ +_1_2_6_5 _E_d_g_e_D_e_s_c_r_i_p_t_o_r findEdge(const VertexDescriptor& source, │ │ │ │ +1266 const VertexDescriptor& target) │ │ │ │ +1267 { │ │ │ │ +1268 return graph_.findEdge(source,target); │ │ │ │ +1269 } │ │ │ │ +1270 │ │ │ │ +_1_2_7_6 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ +1277 │ │ │ │ +1278 │ │ │ │ +_1_2_8_4 const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge) const; │ │ │ │ +1285 │ │ │ │ +_1_2_9_2 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ +1293 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target); │ │ │ │ +1294 │ │ │ │ +_1_3_0_1 const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ +1302 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ +1303 │ │ │ │ +_1_3_0_8 const _G_r_a_p_h& _g_r_a_p_h() const; │ │ │ │ +1309 │ │ │ │ +_1_3_1_3 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +1314 │ │ │ │ +_1_3_1_8 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ +1319 │ │ │ │ +_1_3_2_6 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ +1327 │ │ │ │ +_1_3_3_4 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(_G_r_a_p_h& graph, const _V_e_r_t_e_x_M_a_p& vmap=_V_e_r_t_e_x_M_a_p(), │ │ │ │ +1335 const _E_d_g_e_M_a_p& emap=_E_d_g_e_M_a_p()); │ │ │ │ +1336 │ │ │ │ +1337 private: │ │ │ │ +1338 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(const _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h&) │ │ │ │ +1339 {} │ │ │ │ +1340 │ │ │ │ +1342 Graph& graph_; │ │ │ │ +1345 VertexMap vmap_; │ │ │ │ +1346 std::vector vertexProperties_; │ │ │ │ +1348 EdgeMap emap_; │ │ │ │ +_1_3_5_0 std::vector edgeProperties_; │ │ │ │ +1351 │ │ │ │ +1352 }; │ │ │ │ +1353 │ │ │ │ +1354 │ │ │ │ +1359 template │ │ │ │ +_1_3_6_0 class _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +1361 { │ │ │ │ +1362 public: │ │ │ │ +_1_3_6_6 typedef G _G_r_a_p_h; │ │ │ │ +_1_3_7_0 typedef typename G::VertexProperties _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ +_1_3_7_4 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +1375 │ │ │ │ +_1_3_8_0 _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r(G& g) │ │ │ │ +1381 : graph_(g) │ │ │ │ +1382 {} │ │ │ │ +_1_3_8_6 _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r() │ │ │ │ +1387 : graph_(0) │ │ │ │ +1388 {} │ │ │ │ +1389 │ │ │ │ +1390 │ │ │ │ +_1_3_9_5 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x& vertex) const │ │ │ │ +1396 { │ │ │ │ +1397 return graph_->getVertexProperties(vertex); │ │ │ │ +1398 } │ │ │ │ +1399 private: │ │ │ │ +1400 Graph* graph_; │ │ │ │ +1401 }; │ │ │ │ +1402 │ │ │ │ +1407 template │ │ │ │ +_1_4_0_8 class _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +1409 { │ │ │ │ +1410 public: │ │ │ │ +_1_4_1_4 typedef G _G_r_a_p_h; │ │ │ │ +_1_4_1_8 typedef typename G::EdgeProperties _E_d_g_e_P_r_o_p_e_r_t_i_e_s; │ │ │ │ +_1_4_2_2 typedef typename G::EdgeDescriptor _E_d_g_e; │ │ │ │ +1423 │ │ │ │ +_1_4_2_8 _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r(G& g) │ │ │ │ +1429 : graph_(g) │ │ │ │ +1430 {} │ │ │ │ +_1_4_3_4 _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r() │ │ │ │ +1435 : graph_(0) │ │ │ │ +1436 {} │ │ │ │ +1437 │ │ │ │ +_1_4_4_2 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _o_p_e_r_a_t_o_r_[_](const _E_d_g_e& edge) const │ │ │ │ +1443 { │ │ │ │ +1444 return graph_->getEdgeProperties(edge); │ │ │ │ +1445 } │ │ │ │ +1446 private: │ │ │ │ +1447 Graph* graph_; │ │ │ │ +1448 }; │ │ │ │ +1449 │ │ │ │ +1450 │ │ │ │ +1461 template │ │ │ │ +_1_4_6_2 int _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(const G& graph, const typename G::VertexDescriptor& │ │ │ │ +vertex, │ │ │ │ +1463 V& visitor); │ │ │ │ +1464 │ │ │ │ +1465#ifndef DOXYGEN │ │ │ │ +1466 │ │ │ │ +1467 template │ │ │ │ +1468 _M_a_t_r_i_x_G_r_a_p_h_<_M_>_:_:_M_a_t_r_i_x_G_r_a_p_h(M& matrix) │ │ │ │ +1469 : matrix_(matrix) │ │ │ │ +1470 { │ │ │ │ +1471 if(matrix_.N()!=matrix_.M()) │ │ │ │ +1472 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Matrix has to have as many columns as rows!"); │ │ │ │ +1473 │ │ │ │ +1474 start_ = new EdgeDescriptor[matrix_.N()+1]; │ │ │ │ +1475 │ │ │ │ +1476 typedef typename M::ConstIterator Iterator; │ │ │ │ +1477 start_[matrix_.begin().index()] = 0; │ │ │ │ +1478 │ │ │ │ +1479 for(Iterator row=matrix_.begin(); row != matrix_.end(); ++row) │ │ │ │ +1480 start_[row.index()+1] = start_[row.index()] + row->size(); │ │ │ │ +1481 } │ │ │ │ +1482 │ │ │ │ +1483 template │ │ │ │ +1484 MatrixGraph::~MatrixGraph() │ │ │ │ +1485 { │ │ │ │ +1486 delete[] start_; │ │ │ │ +1487 } │ │ │ │ +1488 │ │ │ │ +1489 template │ │ │ │ +1490 inline std::size_t MatrixGraph::noEdges() const │ │ │ │ +1491 { │ │ │ │ +1492 return start_[matrix_.N()]; │ │ │ │ +1493 } │ │ │ │ +1494 │ │ │ │ +1495 template │ │ │ │ +1496 inline std::size_t MatrixGraph::noVertices() const │ │ │ │ +1497 { │ │ │ │ +1498 return matrix_.N(); │ │ │ │ +1499 } │ │ │ │ +1500 │ │ │ │ +1501 template │ │ │ │ +1502 inline typename MatrixGraph::VertexDescriptor MatrixGraph::maxVertex │ │ │ │ +() const │ │ │ │ +1503 { │ │ │ │ +1504 return matrix_.N()-1; │ │ │ │ +1505 } │ │ │ │ +1506 │ │ │ │ +1507 template │ │ │ │ +1508 typename MatrixGraph::EdgeDescriptor │ │ │ │ +1509 MatrixGraph::findEdge(const VertexDescriptor& source, │ │ │ │ +1510 const VertexDescriptor& target) const │ │ │ │ +1511 { │ │ │ │ +1512 typename M::ConstColIterator found =matrix_[source].find(target); │ │ │ │ +1513 if(found == matrix_[source].end()) │ │ │ │ +1514 return std::numeric_limits::max(); │ │ │ │ +1515 std::size_t offset = found.offset(); │ │ │ │ +1516 if(target>source) │ │ │ │ +1517 offset--; │ │ │ │ +1518 │ │ │ │ +1519 assert(offset │ │ │ │ +1526 inline M& MatrixGraph::matrix() │ │ │ │ +1527 { │ │ │ │ +1528 return matrix_; │ │ │ │ +1529 } │ │ │ │ +1530 │ │ │ │ +1531 template │ │ │ │ +1532 inline const M& MatrixGraph::matrix() const │ │ │ │ +1533 { │ │ │ │ +1534 return matrix_; │ │ │ │ +1535 } │ │ │ │ +1536 │ │ │ │ +1537 template │ │ │ │ +1538 template │ │ │ │ +1539 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const VertexDescriptor& │ │ │ │ +source, const ColIterator& block, │ │ │ │ +1540 const ColIterator& end, const EdgeDescriptor& edge) │ │ │ │ +1541 : source_(source), block_(block), blockEnd_(end), edge_(edge) │ │ │ │ +1542 { │ │ │ │ +1543 if(block_!=blockEnd_ && block_.index() == source_) { │ │ │ │ +1544 // This is the edge from the diagonal to the diagonal. Skip it. │ │ │ │ +1545 ++block_; │ │ │ │ +1546 } │ │ │ │ +1547 } │ │ │ │ +1548 │ │ │ │ +1549 template │ │ │ │ +1550 template │ │ │ │ +1551 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const ColIterator& block) │ │ │ │ +1552 : block_(block) │ │ │ │ +1553 {} │ │ │ │ +1554 │ │ │ │ +1555 template │ │ │ │ +1556 template │ │ │ │ +1557 template │ │ │ │ +1558 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const EdgeIteratorT& │ │ │ │ +other) │ │ │ │ +1559 : source_(other.source_), block_(other.block_), blockEnd_ │ │ │ │ +(other.blockEnd_), edge_(other.edge_) │ │ │ │ +1560 {} │ │ │ │ +1561 │ │ │ │ +1562 │ │ │ │ +1563 template │ │ │ │ +1564 template │ │ │ │ +1565 inline typename MatrixGraph::template EdgeIteratorT::WeightType& │ │ │ │ +1566 MatrixGraph::EdgeIteratorT::weight() const │ │ │ │ +1567 { │ │ │ │ +1568 return *block_; │ │ │ │ +1569 } │ │ │ │ +1570 │ │ │ │ +1571 template │ │ │ │ +1572 template │ │ │ │ +1573 inline typename MatrixGraph::template EdgeIteratorT& │ │ │ │ +MatrixGraph::EdgeIteratorT::operator++() │ │ │ │ +1574 { │ │ │ │ +1575 ++block_; │ │ │ │ +1576 ++edge_; │ │ │ │ +1577 │ │ │ │ +1578 if(block_!=blockEnd_ && block_.index() == source_) { │ │ │ │ +1579 // This is the edge from the diagonal to the diagonal. Skip it. │ │ │ │ +1580 ++block_; │ │ │ │ +1581 } │ │ │ │ +1582 │ │ │ │ +1583 return *this; │ │ │ │ +1584 } │ │ │ │ +1585 │ │ │ │ +1586 template │ │ │ │ +1587 template │ │ │ │ +1588 inline bool MatrixGraph::EdgeIteratorT::operator!=(const typename │ │ │ │ +MatrixGraph::template EdgeIteratorT::type>& │ │ │ │ +other) const │ │ │ │ +1589 { │ │ │ │ +1590 return block_!=other.block_; │ │ │ │ +1591 } │ │ │ │ +1592 │ │ │ │ +1593 template │ │ │ │ +1594 template │ │ │ │ +1595 inline bool MatrixGraph::EdgeIteratorT::operator!=(const typename │ │ │ │ +MatrixGraph::template EdgeIteratorT:: │ │ │ │ +type>& other) const │ │ │ │ +1596 { │ │ │ │ +1597 return block_!=other.block_; │ │ │ │ +1598 } │ │ │ │ +1599 │ │ │ │ +1600 template │ │ │ │ +1601 template │ │ │ │ +1602 inline bool MatrixGraph::EdgeIteratorT::operator==(const typename │ │ │ │ +MatrixGraph::template EdgeIteratorT::type>& │ │ │ │ +other) const │ │ │ │ +1603 { │ │ │ │ +1604 return block_==other.block_; │ │ │ │ +1605 } │ │ │ │ +1606 │ │ │ │ +1607 template │ │ │ │ +1608 template │ │ │ │ +1609 inline bool MatrixGraph::EdgeIteratorT::operator==(const typename │ │ │ │ +MatrixGraph::template EdgeIteratorT:: │ │ │ │ +type>& other) const │ │ │ │ +1610 { │ │ │ │ +1611 return block_==other.block_; │ │ │ │ +1612 } │ │ │ │ +1613 │ │ │ │ +1614 template │ │ │ │ +1615 template │ │ │ │ +1616 inline typename MatrixGraph::VertexDescriptor MatrixGraph:: │ │ │ │ +EdgeIteratorT::target() const │ │ │ │ +1617 { │ │ │ │ +1618 return block_.index(); │ │ │ │ +1619 } │ │ │ │ +1620 │ │ │ │ +1621 template │ │ │ │ +1622 template │ │ │ │ +1623 inline typename MatrixGraph::VertexDescriptor MatrixGraph:: │ │ │ │ +EdgeIteratorT::source() const │ │ │ │ +1624 { │ │ │ │ +1625 return source_; │ │ │ │ +1626 } │ │ │ │ +1627 │ │ │ │ +1628 template │ │ │ │ +1629 template │ │ │ │ +1630 inline const typename MatrixGraph::EdgeDescriptor& MatrixGraph:: │ │ │ │ +EdgeIteratorT::operator*() const │ │ │ │ +1631 { │ │ │ │ +1632 return edge_; │ │ │ │ +1633 } │ │ │ │ +1634 │ │ │ │ +1635 template │ │ │ │ +1636 template │ │ │ │ +1637 inline const typename MatrixGraph::EdgeDescriptor* MatrixGraph:: │ │ │ │ +EdgeIteratorT::operator->() const │ │ │ │ +1638 { │ │ │ │ +1639 return &edge_; │ │ │ │ +1640 } │ │ │ │ +1641 │ │ │ │ +1642 template │ │ │ │ +1643 template │ │ │ │ +1644 MatrixGraph::VertexIteratorT::VertexIteratorT(C* graph, │ │ │ │ +1645 const VertexDescriptor& current) │ │ │ │ +1646 : graph_(graph), current_(current) │ │ │ │ +1647 {} │ │ │ │ +1648 │ │ │ │ +1649 │ │ │ │ +1650 template │ │ │ │ +1651 template │ │ │ │ +1652 MatrixGraph::VertexIteratorT::VertexIteratorT(const │ │ │ │ +VertexDescriptor& current) │ │ │ │ +1653 : current_(current) │ │ │ │ +1654 {} │ │ │ │ +1655 │ │ │ │ +1656 template │ │ │ │ +1657 template │ │ │ │ +1658 MatrixGraph::VertexIteratorT::VertexIteratorT(const │ │ │ │ +VertexIteratorT& other) │ │ │ │ +1659 : graph_(other.graph_), current_(other.current_) │ │ │ │ +1660 {} │ │ │ │ +1661 │ │ │ │ +1662 template │ │ │ │ +1663 template │ │ │ │ +1664 inline bool MatrixGraph::VertexIteratorT::operator!=(const │ │ │ │ +VertexIteratorT& other) const │ │ │ │ +1665 { │ │ │ │ +1666 return current_ != other.current_; │ │ │ │ +1667 } │ │ │ │ +1668 │ │ │ │ +1669 template │ │ │ │ +1670 template │ │ │ │ +1671 inline bool MatrixGraph::VertexIteratorT::operator!=(const │ │ │ │ +VertexIteratorT& other) const │ │ │ │ +1672 { │ │ │ │ +1673 return current_ != other.current_; │ │ │ │ +1674 } │ │ │ │ +1675 │ │ │ │ +1676 │ │ │ │ +1677 template │ │ │ │ +1678 template │ │ │ │ +1679 inline bool MatrixGraph::VertexIteratorT::operator==(const │ │ │ │ +VertexIteratorT& other) const │ │ │ │ +1680 { │ │ │ │ +1681 return current_ == other.current_; │ │ │ │ +1682 } │ │ │ │ +1683 │ │ │ │ +1684 template │ │ │ │ +1685 template │ │ │ │ +1686 inline bool MatrixGraph::VertexIteratorT::operator==(const │ │ │ │ +VertexIteratorT& other) const │ │ │ │ +1687 { │ │ │ │ +1688 return current_ == other.current_; │ │ │ │ +1689 } │ │ │ │ +1690 │ │ │ │ +1691 template │ │ │ │ +1692 template │ │ │ │ +1693 inline typename MatrixGraph::template VertexIteratorT& │ │ │ │ +MatrixGraph::VertexIteratorT::operator++() │ │ │ │ +1694 { │ │ │ │ +1695 ++current_; │ │ │ │ +1696 return *this; │ │ │ │ +1697 } │ │ │ │ +1698 │ │ │ │ +1699 template │ │ │ │ +1700 template │ │ │ │ +1701 inline typename MatrixGraph::template VertexIteratorT::WeightType& │ │ │ │ +1702 MatrixGraph::VertexIteratorT::weight() const │ │ │ │ +1703 { │ │ │ │ +1704 return graph_->matrix()[current_][current_]; │ │ │ │ +1705 } │ │ │ │ +1706 │ │ │ │ +1707 template │ │ │ │ +1708 template │ │ │ │ +1709 inline const typename MatrixGraph::VertexDescriptor& │ │ │ │ +1710 MatrixGraph::VertexIteratorT::operator*() const │ │ │ │ +1711 { │ │ │ │ +1712 return current_; │ │ │ │ +1713 } │ │ │ │ +1714 │ │ │ │ +1715 template │ │ │ │ +1716 template │ │ │ │ +1717 inline typename MatrixGraph::template EdgeIteratorT │ │ │ │ +1718 MatrixGraph::VertexIteratorT::begin() const │ │ │ │ +1719 { │ │ │ │ +1720 return graph_->beginEdges(current_); │ │ │ │ +1721 } │ │ │ │ +1722 │ │ │ │ +1723 template │ │ │ │ +1724 template │ │ │ │ +1725 inline typename MatrixGraph::template EdgeIteratorT │ │ │ │ +1726 MatrixGraph::VertexIteratorT::end() const │ │ │ │ +1727 { │ │ │ │ +1728 return graph_->endEdges(current_); │ │ │ │ +1729 } │ │ │ │ +1730 │ │ │ │ +1731 template │ │ │ │ +1732 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ +1733 MatrixGraph::begin() │ │ │ │ +1734 { │ │ │ │ +1735 return VertexIterator(this,0); │ │ │ │ +1736 } │ │ │ │ +1737 │ │ │ │ +1738 template │ │ │ │ +1739 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ +1740 MatrixGraph::end() │ │ │ │ +1741 { │ │ │ │ +1742 return VertexIterator(matrix_.N()); │ │ │ │ +1743 } │ │ │ │ +1744 │ │ │ │ +1745 │ │ │ │ +1746 template │ │ │ │ +1747 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ +1748 MatrixGraph::begin() const │ │ │ │ +1749 { │ │ │ │ +1750 return ConstVertexIterator(this, 0); │ │ │ │ +1751 } │ │ │ │ +1752 │ │ │ │ +1753 template │ │ │ │ +1754 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ +1755 MatrixGraph::end() const │ │ │ │ +1756 { │ │ │ │ +1757 return ConstVertexIterator(matrix_.N()); │ │ │ │ +1758 } │ │ │ │ +1759 │ │ │ │ +1760 template │ │ │ │ +1761 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ +1762 MatrixGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ +1763 { │ │ │ │ +1764 return EdgeIterator(source, matrix_.operator[](source).begin(), │ │ │ │ +1765 matrix_.operator[](source).end(), start_[source]); │ │ │ │ +1766 } │ │ │ │ +1767 │ │ │ │ +1768 template │ │ │ │ +1769 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ +1770 MatrixGraph::endEdges(const VertexDescriptor& source) │ │ │ │ +1771 { │ │ │ │ +1772 return EdgeIterator(matrix_.operator[](source).end()); │ │ │ │ +1773 } │ │ │ │ +1774 │ │ │ │ +1775 │ │ │ │ +1776 template │ │ │ │ +1777 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ +1778 MatrixGraph::beginEdges(const VertexDescriptor& source) const │ │ │ │ +1779 { │ │ │ │ +1780 return ConstEdgeIterator(source, matrix_.operator[](source).begin(), │ │ │ │ +1781 matrix_.operator[](source).end(), start_[source]); │ │ │ │ +1782 } │ │ │ │ +1783 │ │ │ │ +1784 template │ │ │ │ +1785 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ +1786 MatrixGraph::endEdges(const VertexDescriptor& source) const │ │ │ │ +1787 { │ │ │ │ +1788 return ConstEdgeIterator(matrix_.operator[](source).end()); │ │ │ │ +1789 } │ │ │ │ +1790 │ │ │ │ +1791 │ │ │ │ +1792 template │ │ │ │ +1793 SubGraph::EdgeIterator::EdgeIterator(const VertexDescriptor& source, │ │ │ │ +1794 const EdgeDescriptor& edge) │ │ │ │ +1795 : source_(source), edge_(edge) │ │ │ │ +1796 {} │ │ │ │ +1797 │ │ │ │ +1798 │ │ │ │ +1799 template │ │ │ │ +1800 SubGraph::EdgeIterator::EdgeIterator(const EdgeDescriptor& edge) │ │ │ │ +1801 : edge_(edge) │ │ │ │ +1802 {} │ │ │ │ +1803 │ │ │ │ +1804 template │ │ │ │ +1805 typename SubGraph::EdgeIndexMap SubGraph::getEdgeIndexMap() │ │ │ │ +1806 { │ │ │ │ +1807 return EdgeIndexMap(edges_); │ │ │ │ +1808 } │ │ │ │ +1809 │ │ │ │ +1810 template │ │ │ │ +1811 inline bool SubGraph::EdgeIterator::equals(const EdgeIterator & │ │ │ │ +other) const │ │ │ │ +1812 { │ │ │ │ +1813 return other.edge_==edge_; │ │ │ │ +1814 } │ │ │ │ +1815 │ │ │ │ +1816 template │ │ │ │ +1817 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ +increment() │ │ │ │ +1818 { │ │ │ │ +1819 ++edge_; │ │ │ │ +1820 return *this; │ │ │ │ +1821 } │ │ │ │ +1822 │ │ │ │ +1823 template │ │ │ │ +1824 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ +decrement() │ │ │ │ +1825 { │ │ │ │ +1826 --edge_; │ │ │ │ +1827 return *this; │ │ │ │ +1828 } │ │ │ │ +1829 │ │ │ │ +1830 template │ │ │ │ +1831 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ +advance(std::ptrdiff_t n) │ │ │ │ +1832 { │ │ │ │ +1833 edge_+=n; │ │ │ │ +1834 return *this; │ │ │ │ +1835 } │ │ │ │ +1836 template │ │ │ │ +1837 inline const typename G::VertexDescriptor& SubGraph::EdgeIterator:: │ │ │ │ +source() const │ │ │ │ +1838 { │ │ │ │ +1839 return source_; │ │ │ │ +1840 } │ │ │ │ +1841 │ │ │ │ +1842 template │ │ │ │ +1843 inline const typename G::VertexDescriptor& SubGraph::EdgeIterator:: │ │ │ │ +target() const │ │ │ │ +1844 { │ │ │ │ +1845 return *edge_; │ │ │ │ +1846 } │ │ │ │ +1847 │ │ │ │ +1848 │ │ │ │ +1849 template │ │ │ │ +1850 inline const typename SubGraph::EdgeDescriptor& SubGraph:: │ │ │ │ +EdgeIterator::dereference() const │ │ │ │ +1851 { │ │ │ │ +1852 return edge_; │ │ │ │ +1853 } │ │ │ │ +1854 │ │ │ │ +1855 template │ │ │ │ +1856 inline std::ptrdiff_t SubGraph::EdgeIterator::distanceTo(const │ │ │ │ +EdgeIterator & other) const │ │ │ │ +1857 { │ │ │ │ +1858 return other.edge_-edge_; │ │ │ │ +1859 } │ │ │ │ +1860 │ │ │ │ +1861 template │ │ │ │ +1862 SubGraph::VertexIterator::VertexIterator(const SubGraph* graph, │ │ │ │ +1863 const VertexDescriptor& current, │ │ │ │ +1864 const VertexDescriptor& end) │ │ │ │ +1865 : graph_(graph), current_(current), end_(end) │ │ │ │ +1866 { │ │ │ │ +1867 // Skip excluded vertices │ │ │ │ +1868 typedef typename T::const_iterator Iterator; │ │ │ │ +1869 │ │ │ │ +1870 for(Iterator vertex = graph_->excluded_.begin(); │ │ │ │ +1871 current_ != end_ && *vertex; │ │ │ │ +1872 ++vertex) │ │ │ │ +1873 ++current_; │ │ │ │ +1874 assert(current_ == end_ || !graph_->excluded_[current_]); │ │ │ │ +1875 } │ │ │ │ +1876 │ │ │ │ +1877 template │ │ │ │ +1878 SubGraph::VertexIterator::VertexIterator(const VertexDescriptor& │ │ │ │ +current) │ │ │ │ +1879 : current_(current) │ │ │ │ +1880 {} │ │ │ │ +1881 │ │ │ │ +1882 template │ │ │ │ +1883 inline typename SubGraph::VertexIterator& SubGraph:: │ │ │ │ +VertexIterator::increment() │ │ │ │ +1884 { │ │ │ │ +1885 ++current_; │ │ │ │ +1886 //Skip excluded vertices │ │ │ │ +1887 while(current_ != end_ && graph_->excluded_[current_]) │ │ │ │ +1888 ++current_; │ │ │ │ +1889 │ │ │ │ +1890 assert(current_ == end_ || !graph_->excluded_[current_]); │ │ │ │ +1891 return *this; │ │ │ │ +1892 } │ │ │ │ +1893 │ │ │ │ +1894 template │ │ │ │ +1895 inline bool SubGraph::VertexIterator::equals(const VertexIterator & │ │ │ │ +other) const │ │ │ │ +1896 { │ │ │ │ +1897 return current_==other.current_; │ │ │ │ +1898 } │ │ │ │ +1899 │ │ │ │ +1900 template │ │ │ │ +1901 inline const typename G::VertexDescriptor& SubGraph::VertexIterator:: │ │ │ │ +dereference() const │ │ │ │ +1902 { │ │ │ │ +1903 return current_; │ │ │ │ +1904 } │ │ │ │ +1905 │ │ │ │ +1906 template │ │ │ │ +1907 inline typename SubGraph::EdgeIterator SubGraph:: │ │ │ │ +VertexIterator::begin() const │ │ │ │ +1908 { │ │ │ │ +1909 return graph_->beginEdges(current_); │ │ │ │ +1910 } │ │ │ │ +1911 │ │ │ │ +1912 template │ │ │ │ +1913 inline typename SubGraph::EdgeIterator SubGraph:: │ │ │ │ +VertexIterator::end() const │ │ │ │ +1914 { │ │ │ │ +1915 return graph_->endEdges(current_); │ │ │ │ +1916 } │ │ │ │ +1917 │ │ │ │ +1918 template │ │ │ │ +1919 inline typename SubGraph::VertexIterator SubGraph::begin() const │ │ │ │ +1920 { │ │ │ │ +1921 return VertexIterator(this, 0, endVertex_); │ │ │ │ +1922 } │ │ │ │ +1923 │ │ │ │ +1924 │ │ │ │ +1925 template │ │ │ │ +1926 inline typename SubGraph::VertexIterator SubGraph::end() const │ │ │ │ +1927 { │ │ │ │ +1928 return VertexIterator(endVertex_); │ │ │ │ +1929 } │ │ │ │ +1930 │ │ │ │ +1931 │ │ │ │ +1932 template │ │ │ │ +1933 inline typename SubGraph::EdgeIterator SubGraph::beginEdges │ │ │ │ +(const VertexDescriptor& source) const │ │ │ │ +1934 { │ │ │ │ +1935 return EdgeIterator(source, edges_+start_[source]); │ │ │ │ +1936 } │ │ │ │ +1937 │ │ │ │ +1938 template │ │ │ │ +1939 inline typename SubGraph::EdgeIterator SubGraph::endEdges(const │ │ │ │ +VertexDescriptor& source) const │ │ │ │ +1940 { │ │ │ │ +1941 return EdgeIterator(edges_+end_[source]); │ │ │ │ +1942 } │ │ │ │ +1943 │ │ │ │ +1944 template │ │ │ │ +1945 std::size_t SubGraph::noVertices() const │ │ │ │ +1946 { │ │ │ │ +1947 return noVertices_; │ │ │ │ +1948 } │ │ │ │ +1949 │ │ │ │ +1950 template │ │ │ │ +1951 inline typename SubGraph::VertexDescriptor SubGraph::maxVertex() │ │ │ │ +const │ │ │ │ +1952 { │ │ │ │ +1953 return maxVertex_; │ │ │ │ +1954 } │ │ │ │ +1955 │ │ │ │ +1956 template │ │ │ │ +1957 inline std::size_t SubGraph::noEdges() const │ │ │ │ +1958 { │ │ │ │ +1959 return noEdges_; │ │ │ │ +1960 } │ │ │ │ +1961 │ │ │ │ +1962 template │ │ │ │ +1963 inline typename SubGraph::EdgeDescriptor SubGraph::findEdge │ │ │ │ +(const VertexDescriptor& source, │ │ │ │ +1964 const VertexDescriptor& target) const │ │ │ │ +1965 { │ │ │ │ +1966 const EdgeDescriptor edge = std::lower_bound(edges_+start_[source], │ │ │ │ +edges_+end_[source], target); │ │ │ │ +1967 if(edge==edges_+end_[source] || *edge!=target) │ │ │ │ +1968 return std::numeric_limits::max(); │ │ │ │ +1969 │ │ │ │ +1970 return edge; │ │ │ │ +1971 } │ │ │ │ +1972 │ │ │ │ +1973 template │ │ │ │ +1974 SubGraph::~SubGraph() │ │ │ │ +1975 { │ │ │ │ +1976 delete[] edges_; │ │ │ │ +1977 delete[] end_; │ │ │ │ +1978 delete[] start_; │ │ │ │ +1979 } │ │ │ │ +1980 │ │ │ │ +1981 template │ │ │ │ +1982 SubGraph::SubGraph(const G& graph, const T& excluded) │ │ │ │ +1983 : excluded_(excluded), noVertices_(0), endVertex_(0), maxVertex_ │ │ │ │ +(graph.maxVertex()) │ │ │ │ +1984 { │ │ │ │ +1985 start_ = new std::ptrdiff_t[graph.noVertices()]; │ │ │ │ +1986 end_ = new std::ptrdiff_t[graph.noVertices()]; │ │ │ │ +1987 edges_ = new VertexDescriptor[graph.noEdges()]; │ │ │ │ +1988 │ │ │ │ +1989 VertexDescriptor* edge=edges_; │ │ │ │ +1990 │ │ │ │ +1991 // Cater for the case that there are no vertices. │ │ │ │ +1992 // Otherwise endVertex_ will get 1 below. │ │ │ │ +1993 if ( graph.noVertices() == 0) │ │ │ │ +1994 return; │ │ │ │ +1995 │ │ │ │ +1996 typedef typename Graph::ConstVertexIterator Iterator; │ │ │ │ +1997 Iterator endVertex=graph.end(); │ │ │ │ +1998 │ │ │ │ +1999 for(Iterator vertex = graph.begin(); vertex != endVertex; ++vertex) │ │ │ │ +2000 if(excluded_[*vertex]) │ │ │ │ +2001 start_[*vertex]=end_[*vertex]=-1; │ │ │ │ +2002 else{ │ │ │ │ +2003 ++noVertices_; │ │ │ │ +2004 endVertex_ = std::max(*vertex, endVertex_); │ │ │ │ +2005 │ │ │ │ +2006 start_[*vertex] = edge-edges_; │ │ │ │ +2007 │ │ │ │ +2008 auto endEdge = vertex.end(); │ │ │ │ +2009 │ │ │ │ +2010 for(auto iter=vertex.begin(); iter!= endEdge; ++iter) │ │ │ │ +2011 if(!excluded[iter.target()]) { │ │ │ │ +2012 *edge = iter.target(); │ │ │ │ +2013 ++edge; │ │ │ │ +2014 } │ │ │ │ +2015 │ │ │ │ +2016 end_[*vertex] = edge - edges_; │ │ │ │ +2017 │ │ │ │ +2018 // Sort the edges │ │ │ │ +2019 std::sort(edges_+start_[*vertex], edge); │ │ │ │ +2020 } │ │ │ │ +2021 noEdges_ = edge-edges_; │ │ │ │ +2022 ++endVertex_; │ │ │ │ +2023 } │ │ │ │ +2024 │ │ │ │ +2025 template │ │ │ │ +2026 inline std::size_t VertexPropertiesGraph::noEdges() const │ │ │ │ +2027 { │ │ │ │ +2028 return graph_.noEdges(); │ │ │ │ +2029 } │ │ │ │ +2030 │ │ │ │ +2031 template │ │ │ │ +2032 inline typename VertexPropertiesGraph::EdgeIterator │ │ │ │ +2033 VertexPropertiesGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ +2034 { │ │ │ │ +2035 return graph_.beginEdges(source); │ │ │ │ +2036 } │ │ │ │ +2037 │ │ │ │ +2038 template │ │ │ │ +2039 inline typename VertexPropertiesGraph::EdgeIterator │ │ │ │ +2040 VertexPropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ +2041 { │ │ │ │ +2042 return graph_.endEdges(source); │ │ │ │ +2043 } │ │ │ │ +2044 │ │ │ │ +2045 template │ │ │ │ +2046 typename VertexPropertiesGraph::ConstEdgeIterator │ │ │ │ +2047 inline VertexPropertiesGraph::beginEdges(const VertexDescriptor& │ │ │ │ +source) const │ │ │ │ +2048 { │ │ │ │ +2049 return graph_.beginEdges(source); │ │ │ │ +2050 } │ │ │ │ +2051 │ │ │ │ +2052 template │ │ │ │ +2053 typename VertexPropertiesGraph::ConstEdgeIterator │ │ │ │ +2054 VertexPropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ +const │ │ │ │ +2055 { │ │ │ │ +2056 return graph_.endEdges(source); │ │ │ │ +2057 } │ │ │ │ +2058 │ │ │ │ +2059 template │ │ │ │ +2060 template │ │ │ │ +2061 VertexPropertiesGraph::VertexIteratorT │ │ │ │ +2062 ::VertexIteratorT(const Father& iter, │ │ │ │ +2063 C* graph) │ │ │ │ +2064 : Father(iter), graph_(graph) │ │ │ │ +2065 {} │ │ │ │ +2066 │ │ │ │ +2067 template │ │ │ │ +2068 template │ │ │ │ +2069 VertexPropertiesGraph::VertexIteratorT │ │ │ │ +2070 ::VertexIteratorT(const Father& iter) │ │ │ │ +2071 : Father(iter) │ │ │ │ +2072 {} │ │ │ │ +2073 │ │ │ │ +2074 template │ │ │ │ +2075 template │ │ │ │ +2076 template │ │ │ │ +2077 VertexPropertiesGraph::VertexIteratorT │ │ │ │ +2078 ::VertexIteratorT(const VertexIteratorT& other) │ │ │ │ +2079 : Father(other), graph_(other.graph_) │ │ │ │ +2080 {} │ │ │ │ +2081 │ │ │ │ +2082 template │ │ │ │ +2083 template │ │ │ │ +2084 typename std::conditional:: │ │ │ │ +type>::value, │ │ │ │ +2085 V&, const V&>::type │ │ │ │ +2086 inline VertexPropertiesGraph::VertexIteratorT::properties() │ │ │ │ +const │ │ │ │ +2087 { │ │ │ │ +2088 return graph_->getVertexProperties(Father::operator*()); │ │ │ │ +2089 } │ │ │ │ +2090 │ │ │ │ +2091 template │ │ │ │ +2092 template │ │ │ │ +2093 typename std::conditional:: │ │ │ │ +type, │ │ │ │ +2094 C>::value, │ │ │ │ +2095 typename G::EdgeIterator, │ │ │ │ +2096 typename G::ConstEdgeIterator>::type │ │ │ │ +2097 inline VertexPropertiesGraph::VertexIteratorT::begin() const │ │ │ │ +2098 { │ │ │ │ +2099 return graph_->beginEdges(Father::operator*()); │ │ │ │ +2100 } │ │ │ │ +2101 │ │ │ │ +2102 template │ │ │ │ +2103 template │ │ │ │ +2104 typename std::conditional:: │ │ │ │ +type, │ │ │ │ +2105 C>::value, │ │ │ │ +2106 typename G::EdgeIterator, │ │ │ │ +2107 typename G::ConstEdgeIterator>::type │ │ │ │ +2108 inline VertexPropertiesGraph::VertexIteratorT::end() const │ │ │ │ +2109 { │ │ │ │ +2110 return graph_->endEdges(Father::operator*()); │ │ │ │ +2111 } │ │ │ │ +2112 │ │ │ │ +2113 template │ │ │ │ +2114 inline typename VertexPropertiesGraph::VertexIterator │ │ │ │ +VertexPropertiesGraph::begin() │ │ │ │ +2115 { │ │ │ │ +2116 return VertexIterator(graph_.begin(), this); │ │ │ │ +2117 } │ │ │ │ +2118 │ │ │ │ +2119 template │ │ │ │ +2120 inline typename VertexPropertiesGraph::VertexIterator │ │ │ │ +VertexPropertiesGraph::end() │ │ │ │ +2121 { │ │ │ │ +2122 return VertexIterator(graph_.end()); │ │ │ │ +2123 } │ │ │ │ +2124 │ │ │ │ +2125 │ │ │ │ +2126 template │ │ │ │ +2127 inline typename VertexPropertiesGraph::ConstVertexIterator │ │ │ │ +VertexPropertiesGraph::begin() const │ │ │ │ +2128 { │ │ │ │ +2129 return ConstVertexIterator(graph_.begin(), this); │ │ │ │ +2130 } │ │ │ │ +2131 │ │ │ │ +2132 template │ │ │ │ +2133 inline typename VertexPropertiesGraph::ConstVertexIterator │ │ │ │ +VertexPropertiesGraph::end() const │ │ │ │ +2134 { │ │ │ │ +2135 return ConstVertexIterator(graph_.end()); │ │ │ │ +2136 } │ │ │ │ +2137 │ │ │ │ +2138 template │ │ │ │ +2139 inline V& VertexPropertiesGraph::getVertexProperties(const │ │ │ │ +VertexDescriptor& vertex) │ │ │ │ +2140 { │ │ │ │ +2141 return vertexProperties_[vmap_[vertex]]; │ │ │ │ +2142 } │ │ │ │ +2143 │ │ │ │ +2144 template │ │ │ │ +2145 inline const V& VertexPropertiesGraph::getVertexProperties(const │ │ │ │ +VertexDescriptor& vertex) const │ │ │ │ +2146 { │ │ │ │ +2147 return vertexProperties_[vmap_[vertex]]; │ │ │ │ +2148 } │ │ │ │ +2149 │ │ │ │ +2150 template │ │ │ │ +2151 inline const G& VertexPropertiesGraph::graph() const │ │ │ │ +2152 { │ │ │ │ +2153 return graph_; │ │ │ │ +2154 } │ │ │ │ +2155 │ │ │ │ +2156 template │ │ │ │ +2157 inline std::size_t VertexPropertiesGraph::noVertices() const │ │ │ │ +2158 { │ │ │ │ +2159 return graph_.noVertices(); │ │ │ │ +2160 } │ │ │ │ +2161 │ │ │ │ +2162 │ │ │ │ +2163 template │ │ │ │ +2164 inline typename VertexPropertiesGraph::VertexDescriptor │ │ │ │ +VertexPropertiesGraph::maxVertex() const │ │ │ │ +2165 { │ │ │ │ +2166 return graph_.maxVertex(); │ │ │ │ +2167 } │ │ │ │ +2168 │ │ │ │ +2169 template │ │ │ │ +2170 VertexPropertiesGraph::VertexPropertiesGraph(Graph& graph, const │ │ │ │ +VM vmap) │ │ │ │ +2171 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex │ │ │ │ +()+1], V()) │ │ │ │ +2172 {} │ │ │ │ +2173 │ │ │ │ +2174 template │ │ │ │ +2175 template │ │ │ │ +2176 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ +Father& iter, │ │ │ │ +2177 C* graph) │ │ │ │ +2178 : Father(iter), graph_(graph) │ │ │ │ +2179 {} │ │ │ │ +2180 │ │ │ │ +2181 template │ │ │ │ +2182 template │ │ │ │ +2183 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ +Father& iter) │ │ │ │ +2184 : Father(iter) │ │ │ │ +2185 {} │ │ │ │ +2186 │ │ │ │ +2187 template │ │ │ │ +2188 template │ │ │ │ +2189 template │ │ │ │ +2190 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ +EdgeIteratorT& other) │ │ │ │ +2191 : Father(other), graph_(other.graph_) │ │ │ │ +2192 {} │ │ │ │ +2193 │ │ │ │ +2194 │ │ │ │ +2195 template │ │ │ │ +2196 inline std::size_t PropertiesGraph::noEdges() const │ │ │ │ +2197 { │ │ │ │ +2198 return graph_.noEdges(); │ │ │ │ +2199 } │ │ │ │ +2200 │ │ │ │ +2201 template │ │ │ │ +2202 template │ │ │ │ +2203 inline typename std::conditional::type>::value,E&,const E&>::type │ │ │ │ +2204 PropertiesGraph::EdgeIteratorT::properties() const │ │ │ │ +2205 { │ │ │ │ +2206 return graph_->getEdgeProperties(Father::operator*()); │ │ │ │ +2207 } │ │ │ │ +2208 │ │ │ │ +2209 template │ │ │ │ +2210 inline typename PropertiesGraph::EdgeIterator │ │ │ │ +2211 PropertiesGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ +2212 { │ │ │ │ +2213 return EdgeIterator(graph_.beginEdges(source), this); │ │ │ │ +2214 } │ │ │ │ +2215 │ │ │ │ +2216 template │ │ │ │ +2217 inline typename PropertiesGraph::EdgeIterator │ │ │ │ +2218 PropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ +2219 { │ │ │ │ +2220 return EdgeIterator(graph_.endEdges(source)); │ │ │ │ +2221 } │ │ │ │ +2222 │ │ │ │ +2223 template │ │ │ │ +2224 typename PropertiesGraph::ConstEdgeIterator │ │ │ │ +2225 inline PropertiesGraph::beginEdges(const VertexDescriptor& │ │ │ │ +source) const │ │ │ │ +2226 { │ │ │ │ +2227 return ConstEdgeIterator(graph_.beginEdges(source), this); │ │ │ │ +2228 } │ │ │ │ +2229 │ │ │ │ +2230 template │ │ │ │ +2231 typename PropertiesGraph::ConstEdgeIterator │ │ │ │ +2232 PropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ +const │ │ │ │ +2233 { │ │ │ │ +2234 return ConstEdgeIterator(graph_.endEdges(source)); │ │ │ │ +2235 } │ │ │ │ +2236 │ │ │ │ +2237 template │ │ │ │ +2238 template │ │ │ │ +2239 PropertiesGraph::VertexIteratorT │ │ │ │ +2240 ::VertexIteratorT(const Father& iter, │ │ │ │ +2241 C* graph) │ │ │ │ +2242 : Father(iter), graph_(graph) │ │ │ │ +2243 {} │ │ │ │ +2244 │ │ │ │ +2245 template │ │ │ │ +2246 template │ │ │ │ +2247 PropertiesGraph::VertexIteratorT │ │ │ │ +2248 ::VertexIteratorT(const Father& iter) │ │ │ │ +2249 : Father(iter) │ │ │ │ +2250 {} │ │ │ │ +2251 │ │ │ │ +2252 template │ │ │ │ +2253 template │ │ │ │ +2254 template │ │ │ │ +2255 PropertiesGraph::VertexIteratorT │ │ │ │ +2256 ::VertexIteratorT(const VertexIteratorT& other) │ │ │ │ +2257 : Father(other), graph_(other.graph_) │ │ │ │ +2258 {} │ │ │ │ +2259 │ │ │ │ +2260 template │ │ │ │ +2261 template │ │ │ │ +2262 inline typename std::conditional::type>::value, │ │ │ │ +2263 V&, const V&>::type │ │ │ │ +2264 PropertiesGraph::VertexIteratorT::properties() const │ │ │ │ +2265 { │ │ │ │ +2266 return graph_->getVertexProperties(Father::operator*()); │ │ │ │ +2267 } │ │ │ │ +2268 │ │ │ │ +2269 template │ │ │ │ +2270 template │ │ │ │ +2271 inline typename PropertiesGraph::template EdgeIteratorT │ │ │ │ +2272 PropertiesGraph::VertexIteratorT::begin() const │ │ │ │ +2273 { │ │ │ │ +2274 return graph_->beginEdges(Father::operator*()); │ │ │ │ +2275 } │ │ │ │ +2276 │ │ │ │ +2277 template │ │ │ │ +2278 template │ │ │ │ +2279 inline typename PropertiesGraph::template EdgeIteratorT │ │ │ │ +2280 PropertiesGraph::VertexIteratorT::end() const │ │ │ │ +2281 { │ │ │ │ +2282 return graph_->endEdges(Father::operator*()); │ │ │ │ +2283 } │ │ │ │ +2284 │ │ │ │ +2285 template │ │ │ │ +2286 inline typename PropertiesGraph::VertexIterator │ │ │ │ +PropertiesGraph::begin() │ │ │ │ +2287 { │ │ │ │ +2288 return VertexIterator(graph_.begin(), this); │ │ │ │ +2289 } │ │ │ │ +2290 │ │ │ │ +2291 template │ │ │ │ +2292 inline typename PropertiesGraph::VertexIterator │ │ │ │ +PropertiesGraph::end() │ │ │ │ +2293 { │ │ │ │ +2294 return VertexIterator(graph_.end()); │ │ │ │ +2295 } │ │ │ │ +2296 │ │ │ │ +2297 │ │ │ │ +2298 template │ │ │ │ +2299 inline typename PropertiesGraph::ConstVertexIterator │ │ │ │ +PropertiesGraph::begin() const │ │ │ │ +2300 { │ │ │ │ +2301 return ConstVertexIterator(graph_.begin(), this); │ │ │ │ +2302 } │ │ │ │ +2303 │ │ │ │ +2304 template │ │ │ │ +2305 inline typename PropertiesGraph::ConstVertexIterator │ │ │ │ +PropertiesGraph::end() const │ │ │ │ +2306 { │ │ │ │ +2307 return ConstVertexIterator(graph_.end()); │ │ │ │ +2308 } │ │ │ │ +2309 │ │ │ │ +2310 template │ │ │ │ +2311 inline V& PropertiesGraph::getVertexProperties(const │ │ │ │ +VertexDescriptor& vertex) │ │ │ │ +2312 { │ │ │ │ +2313 return vertexProperties_[vmap_[vertex]]; │ │ │ │ +2314 } │ │ │ │ +2315 │ │ │ │ +2316 template │ │ │ │ +2317 inline const V& PropertiesGraph::getVertexProperties(const │ │ │ │ +VertexDescriptor& vertex) const │ │ │ │ +2318 { │ │ │ │ +2319 return vertexProperties_[vmap_[vertex]]; │ │ │ │ +2320 } │ │ │ │ +2321 │ │ │ │ +2322 template │ │ │ │ +2323 inline E& PropertiesGraph::getEdgeProperties(const │ │ │ │ +EdgeDescriptor& edge) │ │ │ │ +2324 { │ │ │ │ +2325 return edgeProperties_[emap_[edge]]; │ │ │ │ +2326 } │ │ │ │ +2327 │ │ │ │ +2328 template │ │ │ │ +2329 inline const E& PropertiesGraph::getEdgeProperties(const │ │ │ │ +EdgeDescriptor& edge) const │ │ │ │ +2330 { │ │ │ │ +2331 return edgeProperties_[emap_[edge]]; │ │ │ │ +2332 } │ │ │ │ +2333 │ │ │ │ +2334 template │ │ │ │ +2335 inline E& PropertiesGraph::getEdgeProperties(const │ │ │ │ +VertexDescriptor& source, │ │ │ │ +2336 const VertexDescriptor& target) │ │ │ │ +2337 { │ │ │ │ +2338 return getEdgeProperties(graph_.findEdge(source,target)); │ │ │ │ +2339 } │ │ │ │ +2340 │ │ │ │ +2341 template │ │ │ │ +2342 inline const E& PropertiesGraph::getEdgeProperties(const │ │ │ │ +VertexDescriptor& source, │ │ │ │ +2343 const VertexDescriptor& target) const │ │ │ │ +2344 { │ │ │ │ +2345 return getEdgeProperties(graph_.findEdge(source,target)); │ │ │ │ +2346 } │ │ │ │ +2347 │ │ │ │ +2348 template │ │ │ │ +2349 inline const G& PropertiesGraph::graph() const │ │ │ │ +2350 { │ │ │ │ +2351 return graph_; │ │ │ │ +2352 } │ │ │ │ +2353 │ │ │ │ +2354 template │ │ │ │ +2355 inline std::size_t PropertiesGraph::noVertices() const │ │ │ │ +2356 { │ │ │ │ +2357 return graph_.noVertices(); │ │ │ │ +2358 } │ │ │ │ +2359 │ │ │ │ +2360 │ │ │ │ +2361 template │ │ │ │ +2362 inline typename PropertiesGraph::VertexDescriptor │ │ │ │ +PropertiesGraph::maxVertex() const │ │ │ │ +2363 { │ │ │ │ +2364 return graph_.maxVertex(); │ │ │ │ +2365 } │ │ │ │ +2366 │ │ │ │ +2367 template │ │ │ │ +2368 PropertiesGraph::PropertiesGraph(Graph& graph, const VM& │ │ │ │ +vmap, const EM& emap) │ │ │ │ +2369 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex │ │ │ │ +()+1], V()), │ │ │ │ +2370 emap_(emap), edgeProperties_(graph_.noEdges(), E()) │ │ │ │ +2371 {} │ │ │ │ +2372 │ │ │ │ +2373 template │ │ │ │ +2374 inline int _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(const G& graph, const typename G:: │ │ │ │ +VertexDescriptor& vertex, │ │ │ │ +2375 V& visitor) │ │ │ │ +2376 { │ │ │ │ +2377 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ +2378 const iterator end = graph.endEdges(vertex); │ │ │ │ +2379 int noNeighbours=0; │ │ │ │ +2380 for(iterator edge = graph.beginEdges(vertex); edge != end; ++edge, │ │ │ │ +++noNeighbours) │ │ │ │ +2381 visitor(edge); │ │ │ │ +2382 return noNeighbours; │ │ │ │ +2383 } │ │ │ │ +2384 │ │ │ │ +2385#endif // DOXYGEN │ │ │ │ +2386 │ │ │ │ +2388 } │ │ │ │ +2389} │ │ │ │ +2390#endif │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ +int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, │ │ │ │ +V &visitor) │ │ │ │ +Visit all neighbour vertices of a vertex in a graph. │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_:_:_r_e_d_i_s_t_r_i_b_u_t_e_B_a_c_k_w_a_r_d │ │ │ │ -void redistributeBackward(D &from, const D &to) const │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:32 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ -A class setting up standard communication for a two-valued attribute set with │ │ │ │ -owner/overlap/copy sema... │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ -void project(T1 &x) const │ │ │ │ -Set vector to zero at copy dofs. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:538 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ -DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r │ │ │ │ -static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ -&coarse, const Vector &fine, T &comm) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ -&coarse, Vector &fine, T1 damp) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ -&coarse, Vector &fine, Vector &fineRedist, T1 damp, R &redistributor=R()) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_r_t_e_x │ │ │ │ -V1 Vertex │ │ │ │ -DDeeffiinniittiioonn transfer.hh:35 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_:_:_V_e_c_t_o_r │ │ │ │ -V2 Vector │ │ │ │ -DDeeffiinniittiioonn transfer.hh:36 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_R_e_d_i_s_t │ │ │ │ -RedistributeInformation< SequentialInformation > Redist │ │ │ │ -DDeeffiinniittiioonn transfer.hh:56 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_r_t_e_x │ │ │ │ -V Vertex │ │ │ │ -DDeeffiinniittiioonn transfer.hh:54 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_c_t_o_r │ │ │ │ -V1 Vector │ │ │ │ -DDeeffiinniittiioonn transfer.hh:55 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ -&coarse, Vector &fine, Vector &fineRedist, T1 damp, const SequentialInformation │ │ │ │ -&comm=SequentialInformation(), const Redist &redist=Redist()) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r │ │ │ │ -static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ -&coarse, Vector &fine, T1 damp, const SequentialInformation │ │ │ │ -&comm=SequentialInformation()) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_r_t_e_x │ │ │ │ -V Vertex │ │ │ │ -DDeeffiinniittiioonn transfer.hh:78 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_R_e_d_i_s_t │ │ │ │ -RedistributeInformation< OwnerOverlapCopyCommunication< T1, T2 > > Redist │ │ │ │ -DDeeffiinniittiioonn transfer.hh:80 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r_<_ _V_,_ _V_1_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _>_ _>_:_:_V_e_c_t_o_r │ │ │ │ -V1 Vector │ │ │ │ -DDeeffiinniittiioonn transfer.hh:79 │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ +derive error class from the base class in common │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +The (undirected) graph of a matrix. │ │ │ │ +DDeeffiinniittiioonn graph.hh:51 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +MatrixGraph(Matrix &matrix) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d │ │ │ │ +VertexIterator end() │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_a_t_r_i_x │ │ │ │ +M Matrix │ │ │ │ +The type of the matrix we are a graph for. │ │ │ │ +DDeeffiinniittiioonn graph.hh:56 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ +ConstVertexIterator begin() const │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator │ │ │ │ +The constant vertex iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:308 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_~_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +~MatrixGraph() │ │ │ │ +Destructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ +std::ptrdiff_t EdgeDescriptor │ │ │ │ +The edge descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:80 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ +ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +M::size_type VertexDescriptor │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:73 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_t_r_i_x │ │ │ │ +const Matrix & matrix() const │ │ │ │ +Get the underlying matrix. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_u_t_a_b_l_e_M_a_t_r_i_x │ │ │ │ +@ mutableMatrix │ │ │ │ +DDeeffiinniittiioonn graph.hh:86 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ +ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d │ │ │ │ +ConstVertexIterator end() const │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator │ │ │ │ +The constant edge iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:298 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ +EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_f_i_n_d_E_d_g_e │ │ │ │ +EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ +&target) const │ │ │ │ +Find the descriptor of an edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_W_e_i_g_h_t │ │ │ │ +M::block_type Weight │ │ │ │ +The type of the weights. │ │ │ │ +DDeeffiinniittiioonn graph.hh:66 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_u_t_a_b_l_e_M_a_t_r_i_x │ │ │ │ +std::remove_const< M >::type MutableMatrix │ │ │ │ +The mutable type of the matrix we are a graph for. │ │ │ │ +DDeeffiinniittiioonn graph.hh:61 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIteratorT< MatrixGraph< Matrix > > EdgeIterator │ │ │ │ +The mutable edge iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:303 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIteratorT< MatrixGraph< Matrix > > VertexIterator │ │ │ │ +The mutable vertex iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:313 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ +EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ +std::size_t noEdges() const │ │ │ │ +Get the number of edges in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_t_r_i_x │ │ │ │ +Matrix & matrix() │ │ │ │ +Get the underlying matrix. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ +VertexIterator begin() │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +Iterator over all edges starting from a vertex. │ │ │ │ +DDeeffiinniittiioonn graph.hh:95 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t_T_y_p_e │ │ │ │ +std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ +value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >:: │ │ │ │ +type WeightType │ │ │ │ +DDeeffiinniittiioonn graph.hh:156 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +EdgeIteratorT(const VertexDescriptor &source, const ColIterator &block, const │ │ │ │ +ColIterator &end, const EdgeDescriptor &edge) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ +@ isMutable │ │ │ │ +whether C is mutable. │ │ │ │ +DDeeffiinniittiioonn graph.hh:112 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_t_a_r_g_e_t │ │ │ │ +VertexDescriptor target() const │ │ │ │ +The index of the target vertex of the current edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ +EdgeIteratorT< C > & operator++() │ │ │ │ +preincrement operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ +bool operator!=(const EdgeIteratorT< const typename std::remove_const< C >:: │ │ │ │ +type > &other) const │ │ │ │ +Inequality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ +bool operator==(const EdgeIteratorT< const typename std::remove_const< C >:: │ │ │ │ +type > &other) const │ │ │ │ +Equality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +EdgeIteratorT(const EdgeIteratorT< C1 > &other) │ │ │ │ +Copy Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ +bool operator!=(const EdgeIteratorT< typename std::remove_const< C >::type > │ │ │ │ +&other) const │ │ │ │ +Inequality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_w_e_i_g_h_t │ │ │ │ +WeightType & weight() const │ │ │ │ +Access the edge weight. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_s_o_u_r_c_e │ │ │ │ +VertexDescriptor source() const │ │ │ │ +The index of the source vertex of the current edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ +std::conditional< isMutable &&C::mutableMatrix, typenameMatrix::row_type:: │ │ │ │ +Iterator, typenameMatrix::row_type::ConstIterator >::type ColIterator │ │ │ │ +The column iterator of the matrix we use. │ │ │ │ +DDeeffiinniittiioonn graph.hh:120 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_C_o_n_s_t_C_o_n_t_a_i_n_e_r │ │ │ │ +const std::remove_const< C >::type ConstContainer │ │ │ │ +The constant type of the container type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:105 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ +bool operator==(const EdgeIteratorT< typename std::remove_const< C >::type > │ │ │ │ +&other) const │ │ │ │ +Equality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +EdgeIteratorT(const ColIterator &block) │ │ │ │ +Constructor for the end iterator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t │ │ │ │ +std::conditional< isMutable &&C::mutableMatrix, typenameM::block_type, │ │ │ │ +consttypenameM::block_type >::type Weight │ │ │ │ +The matrix block type we use as weights. │ │ │ │ +DDeeffiinniittiioonn graph.hh:127 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ +const EdgeDescriptor & operator*() const │ │ │ │ +Get the edge descriptor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ +const EdgeDescriptor * operator->() const │ │ │ │ +Get the edge descriptor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r │ │ │ │ +std::remove_const< C >::type MutableContainer │ │ │ │ +The mutable type of the container type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:101 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +The vertex iterator type of the graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:209 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_b_e_g_i_n │ │ │ │ +EdgeIteratorT< C > begin() const │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ +const VertexDescriptor & operator*() const │ │ │ │ +Get the descriptor of the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_w_e_i_g_h_t │ │ │ │ +WeightType & weight() const │ │ │ │ +Access the weight of the vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +VertexIteratorT(C *graph, const VertexDescriptor ¤t) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t_T_y_p_e │ │ │ │ +std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ +value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >:: │ │ │ │ +type WeightType │ │ │ │ +DDeeffiinniittiioonn graph.hh:266 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +VertexIteratorT(const VertexIteratorT< MutableContainer > &other) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r │ │ │ │ +std::remove_const< C >::type MutableContainer │ │ │ │ +The mutable type of the container type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:214 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ +bool operator!=(const VertexIteratorT< MutableContainer > &other) const │ │ │ │ +Inequality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ +@ isMutable │ │ │ │ +whether C is mutable. │ │ │ │ +DDeeffiinniittiioonn graph.hh:225 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ +bool operator==(const VertexIteratorT< MutableContainer > &other) const │ │ │ │ +Equality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_C_o_n_s_t_C_o_n_t_a_i_n_e_r │ │ │ │ +const std::remove_const< C >::type ConstContainer │ │ │ │ +The constant type of the container type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:218 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ +VertexIteratorT< C > & operator++() │ │ │ │ +Move to the next vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_e_n_d │ │ │ │ +EdgeIteratorT< C > end() const │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ +bool operator==(const VertexIteratorT< ConstContainer > &other) const │ │ │ │ +Equality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ +bool operator!=(const VertexIteratorT< ConstContainer > &other) const │ │ │ │ +Inequality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +VertexIteratorT(const VertexDescriptor ¤t) │ │ │ │ +Constructor for the end iterator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h │ │ │ │ +A subgraph of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:443 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_f_i_n_d_E_d_g_e │ │ │ │ +EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ +&target) const │ │ │ │ +Find the descriptor of an edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +EdgeIndexMap getEdgeIndexMap() │ │ │ │ +Get an edge index map for the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ +std::size_t noEdges() const │ │ │ │ +Get the number of edges in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ +ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_e_n_d │ │ │ │ +ConstVertexIterator end() const │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ +ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ +Get an iterator over the edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_x_c_l_u_d_e_d │ │ │ │ +T Excluded │ │ │ │ +Random access container providing information about which vertices are │ │ │ │ +excluded. │ │ │ │ +DDeeffiinniittiioonn graph.hh:454 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_~_S_u_b_G_r_a_p_h │ │ │ │ +~SubGraph() │ │ │ │ +Destructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIterator ConstEdgeIterator │ │ │ │ +The constant edge iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:618 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ +G Graph │ │ │ │ +The type of the graph we are a sub graph for. │ │ │ │ +DDeeffiinniittiioonn graph.hh:448 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIterator ConstVertexIterator │ │ │ │ +The constant vertex iterator type. │ │ │ │ +DDeeffiinniittiioonn graph.hh:623 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_S_u_b_G_r_a_p_h │ │ │ │ +SubGraph(const Graph &graph, const T &excluded) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ +ConstVertexIterator begin() const │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:459 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ +VertexDescriptor * EdgeDescriptor │ │ │ │ +DDeeffiinniittiioonn graph.hh:461 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +An index map for mapping the edges to indices. │ │ │ │ +DDeeffiinniittiioonn graph.hh:470 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +EdgeIndexMap(const EdgeIndexMap &emap) │ │ │ │ +Protect copy construction. │ │ │ │ +DDeeffiinniittiioonn graph.hh:479 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ +ReadablePropertyMapTag Category │ │ │ │ +DDeeffiinniittiioonn graph.hh:472 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ +EdgeIndexMap(const EdgeDescriptor &firstEdge) │ │ │ │ +DDeeffiinniittiioonn graph.hh:474 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +std::size_t operator[](const EdgeDescriptor &edge) const │ │ │ │ +DDeeffiinniittiioonn graph.hh:483 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +The edge iterator of the graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:505 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ +const EdgeDescriptor & dereference() const │ │ │ │ +The descriptor of the current edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIterator(const EdgeDescriptor &edge) │ │ │ │ +Constructor for the end iterator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ +bool equals(const EdgeIterator &other) const │ │ │ │ +Equality operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ +EdgeIterator & advance(std::ptrdiff_t n) │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ +EdgeIterator & increment() │ │ │ │ +Preincrement operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_t_a_r_g_e_t │ │ │ │ +const VertexDescriptor & target() const │ │ │ │ +The index of the target vertex of the current edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_s_o_u_r_c_e │ │ │ │ +const VertexDescriptor & source() const │ │ │ │ +The index of the source vertex of the current edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ +EdgeIterator & decrement() │ │ │ │ +Preincrement operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ +std::ptrdiff_t distanceTo(const EdgeIterator &other) const │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIterator(const VertexDescriptor &source, const EdgeDescriptor &edge) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +The vertex iterator of the graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:560 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIterator(const VertexDescriptor ¤t) │ │ │ │ +Constructor for end iterator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ +VertexIterator & increment() │ │ │ │ +Preincrement operator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_b_e_g_i_n │ │ │ │ +EdgeIterator begin() const │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ +bool equals(const VertexIterator &other) const │ │ │ │ +Equality iterator. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIterator(const SubGraph< G, T > *graph, const VertexDescriptor ¤t, │ │ │ │ +const VertexDescriptor &end) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_e_n_d │ │ │ │ +EdgeIterator end() const │ │ │ │ +Get an iterator over all edges starting at the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ +const VertexDescriptor & dereference() const │ │ │ │ +Get the descriptor of the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Attaches properties to the vertices of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:723 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_r_a_p_h │ │ │ │ +const Graph & graph() const │ │ │ │ +Get the graph the properties are attached to. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +Graph::ConstEdgeIterator ConstEdgeIterator │ │ │ │ +The type of the constant edge iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:766 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +VertexProperties & getVertexProperties(const VertexDescriptor &vertex) │ │ │ │ +Get the properties associated with a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ +std::size_t noEdges() const │ │ │ │ +Get the number of edges in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ +Graph::EdgeDescriptor EdgeDescriptor │ │ │ │ +The edge descritor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:738 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ +ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:733 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ +G Graph │ │ │ │ +The graph we attach properties to. │ │ │ │ +DDeeffiinniittiioonn graph.hh:728 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_M_a_p │ │ │ │ +VM VertexMap │ │ │ │ +The type of the map for converting the VertexDescriptor to std::size_t. │ │ │ │ +DDeeffiinniittiioonn graph.hh:756 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ +EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ +EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +VP VertexProperties │ │ │ │ +The type of the properties of the vertices. │ │ │ │ +DDeeffiinniittiioonn graph.hh:743 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ +ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ +Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +Graph::EdgeIterator EdgeIterator │ │ │ │ +The type of the mutable edge iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:761 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +DDeeffiinniittiioonn graph.hh:803 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ +value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type │ │ │ │ +EdgeIterator │ │ │ │ +The class of the edge iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:823 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ +std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ +value, VertexProperties &, constVertexProperties & >::type properties() const │ │ │ │ +Get the properties of the current Vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_e_n_d │ │ │ │ +EdgeIterator end() const │ │ │ │ +Get an iterator over the edges starting from the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ +value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >:: │ │ │ │ +type Father │ │ │ │ +The father class. │ │ │ │ +DDeeffiinniittiioonn graph.hh:814 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_b_e_g_i_n │ │ │ │ +EdgeIterator begin() const │ │ │ │ +Get an iterator over the edges starting from the current vertex. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +Attaches properties to the edges and vertices of a graph. │ │ │ │ +DDeeffiinniittiioonn graph.hh:978 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +Get the number of vertices in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ +Graph::EdgeDescriptor EdgeDescriptor │ │ │ │ +The edge descritor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:993 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +const EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const │ │ │ │ +VertexDescriptor &target) const │ │ │ │ +Get the properties associated with a edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +const EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) const │ │ │ │ +Get the properties associated with a edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_r_a_p_h │ │ │ │ +const Graph & graph() const │ │ │ │ +Get the graph the properties are attached to. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ +VertexDescriptor maxVertex() const │ │ │ │ +Get the maximal vertex descriptor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ +G Graph │ │ │ │ +The graph we attach properties to. │ │ │ │ +DDeeffiinniittiioonn graph.hh:983 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_M_a_p │ │ │ │ +EM EdgeMap │ │ │ │ +The type of the map for converting the EdgeDescriptor to std::size_t. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1030 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_M_a_p │ │ │ │ +VM VertexMap │ │ │ │ +The type of the map for converting the VertexDescriptor to std::size_t. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1011 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +VP VertexProperties │ │ │ │ +The type of the properties of the vertices. │ │ │ │ +DDeeffiinniittiioonn graph.hh:998 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ +std::size_t noEdges() const │ │ │ │ +Get the number of edges in the graph. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +EP EdgeProperties │ │ │ │ +The type of the properties of the edges;. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1016 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const │ │ │ │ +VertexDescriptor &target) │ │ │ │ +Get the properties associated with a edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) │ │ │ │ +Get the properties associated with a edge. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +Graph::VertexDescriptor VertexDescriptor │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:988 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ +PropertiesGraph(Graph &graph, const VertexMap &vmap=VertexMap(), const EdgeMap │ │ │ │ +&emap=EdgeMap()) │ │ │ │ +Constructor. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +DDeeffiinniittiioonn graph.hh:1038 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ +value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type │ │ │ │ +Father │ │ │ │ +The father class. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1050 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +DDeeffiinniittiioonn graph.hh:1140 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ +std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ +value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >:: │ │ │ │ +type Father │ │ │ │ +The father class. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1151 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +Wrapper to access the internal edge properties of a graph via operator[]() │ │ │ │ +DDeeffiinniittiioonn graph.hh:1361 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +GraphVertexPropertiesSelector(G &g) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1380 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +VertexProperties & operator[](const Vertex &vertex) const │ │ │ │ +Get the properties associated to a vertex. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1395 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h │ │ │ │ +G Graph │ │ │ │ +The type of the graph with internal properties. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1366 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +G::VertexProperties VertexProperties │ │ │ │ +The type of the vertex properties. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1370 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +GraphVertexPropertiesSelector() │ │ │ │ +Default constructor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1386 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ +G::VertexDescriptor Vertex │ │ │ │ +The vertex descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1374 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +Wrapper to access the internal vertex properties of a graph via operator[]() │ │ │ │ +DDeeffiinniittiioonn graph.hh:1409 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +EdgeProperties & operator[](const Edge &edge) const │ │ │ │ +Get the properties associated to a vertex. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1442 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ +G::EdgeProperties EdgeProperties │ │ │ │ +The type of the vertex properties. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1418 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_E_d_g_e │ │ │ │ +G::EdgeDescriptor Edge │ │ │ │ +The edge descriptor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1422 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +GraphEdgePropertiesSelector() │ │ │ │ +Default constructor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1434 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h │ │ │ │ +G Graph │ │ │ │ +The type of the graph with internal properties. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1414 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ +GraphEdgePropertiesSelector(G &g) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1428 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: smoother.hh File Reference │ │ │ +dune-istl: fastamgsmoother.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,120 +71,36 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Namespaces
│ │ │ +
fastamgsmoother.hh File Reference
│ │ │ │ │ │
│ │ │ - │ │ │ -

Classes for the generic construction and application of the smoothers. │ │ │ -More...

│ │ │ -
#include <dune/istl/paamg/construction.hh>
│ │ │ -#include <dune/istl/paamg/aggregates.hh>
│ │ │ -#include <dune/istl/preconditioners.hh>
│ │ │ -#include <dune/istl/schwarz.hh>
│ │ │ -#include <dune/istl/novlpschwarz.hh>
│ │ │ -#include <dune/common/propertymap.hh>
│ │ │ -#include <dune/common/ftraits.hh>
│ │ │ +
#include <cstddef>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::Amg::DefaultSmootherArgs< T >
 The default class for the smoother arguments. More...
 
struct  Dune::Amg::SmootherTraits< T >
 Traits class for getting the attribute class of a smoother. More...
 
struct  Dune::Amg::SmootherTraits< Richardson< X, Y > >
 
struct  Dune::Amg::SmootherTraits< BlockPreconditioner< X, Y, C, T > >
 
struct  Dune::Amg::SmootherTraits< NonoverlappingBlockPreconditioner< C, T > >
 
class  Dune::Amg::DefaultConstructionArgs< T >
 Construction Arguments for the default smoothers. More...
 
struct  Dune::Amg::ConstructionArgs< T >
 
class  Dune::Amg::DefaultParallelConstructionArgs< T, C >
 
class  Dune::Amg::DefaultConstructionArgs< Richardson< X, Y > >
 
struct  Dune::Amg::ConstructionTraits< SeqSSOR< M, X, Y, l > >
 Policy for the construction of the SeqSSOR smoother. More...
 
struct  Dune::Amg::ConstructionTraits< SeqSOR< M, X, Y, l > >
 Policy for the construction of the SeqSOR smoother. More...
 
struct  Dune::Amg::ConstructionTraits< SeqJac< M, X, Y, l > >
 Policy for the construction of the SeqJac smoother. More...
 
struct  Dune::Amg::ConstructionTraits< Richardson< X, Y > >
 Policy for the construction of the Richardson smoother. More...
 
class  Dune::Amg::ConstructionArgs< SeqILU< M, X, Y > >
struct  Dune::Amg::GaussSeidelPresmoothDefect< level >
 
struct  Dune::Amg::ConstructionTraits< SeqILU< M, X, Y > >
 Policy for the construction of the SeqILU smoother. More...
 
struct  Dune::Amg::ConstructionTraits< ParSSOR< M, X, Y, C > >
 Policy for the construction of the ParSSOR smoother. More...
 
struct  Dune::Amg::ConstructionTraits< BlockPreconditioner< X, Y, C, T > >
 
struct  Dune::Amg::ConstructionTraits< NonoverlappingBlockPreconditioner< C, T > >
 
struct  Dune::Amg::SmootherApplier< T >
 Helper class for applying the smoothers. More...
 
struct  Dune::Amg::SmootherApplier< SeqSOR< M, X, Y, l > >
 
struct  Dune::Amg::SmootherApplier< BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > >
 
struct  Dune::Amg::SmootherApplier< NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > >
 
struct  Dune::Amg::SmootherApplier< SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > >
 
struct  Dune::Amg::SeqOverlappingSchwarzSmootherArgs< T >
 
struct  Dune::Amg::SmootherTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > >
 
class  Dune::Amg::ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > >
 
struct  Dune::Amg::ConstructionTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > >
struct  Dune::Amg::GaussSeidelPostsmoothDefect< level >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │

│ │ │ -Functions

template<typename LevelContext >
void Dune::Amg::presmooth (LevelContext &levelContext, size_t steps)
 Apply pre smoothing on the current level.
 
template<typename LevelContext >
void Dune::Amg::postsmooth (LevelContext &levelContext, size_t steps)
 Apply post smoothing on the current level.
 
│ │ │ -

Detailed Description

│ │ │ -

Classes for the generic construction and application of the smoothers.

│ │ │ -
Author
Markus Blatt
│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,111 +1,23 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -smoother.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Classes for the generic construction and application of the smoothers. _M_o_r_e_._._. │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +fastamgsmoother.hh File Reference │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_<_ _T_ _> │ │ │ │ -  The default class for the smoother arguments. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_<_ _l_e_v_e_l_ _> │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ -  Traits class for getting the attribute class of a smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _T_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _C_,_ _T_ _>_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _T_ _> │ │ │ │ -  Construction Arguments for the default smoothers. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _T_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _T_,_ _C_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ -  Policy for the construction of the _S_e_q_S_S_O_R smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ -  Policy for the construction of the _S_e_q_S_O_R smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_J_a_c_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ -  Policy for the construction of the _S_e_q_J_a_c smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _>_ _> │ │ │ │ -  Policy for the construction of the _R_i_c_h_a_r_d_s_o_n smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _S_e_q_I_L_U_<_ _M_,_ _X_,_ _Y_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_I_L_U_<_ _M_,_ _X_,_ _Y_ _>_ _> │ │ │ │ -  Policy for the construction of the _S_e_q_I_L_U smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _P_a_r_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _C_ _>_ _> │ │ │ │ -  Policy for the construction of the _P_a_r_S_S_O_R smoother. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _T_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _C_,_ _T │ │ │ │ - _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _T_ _> │ │ │ │ -  Helper class for applying the smoothers. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _S_e_q_S_O_R_<_ _M_, │ │ │ │ - _X_,_ _Y_,_ _l_ _>_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _C_, │ │ │ │ - _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_, │ │ │ │ - _M_u_l_t_i_p_l_i_c_a_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_ _M_S_,_ _T_A_ _>_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_,_ _T_M_,_ _T_S_,_ _T_A_ _>_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_,_ _T_M_,_ _T_S_,_ _T_A_ _> │ │ │ │ - _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_,_ _T_M_,_ _T_S_,_ _T_A │ │ │ │ - _>_ _> │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t_<_ _l_e_v_e_l_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h (LevelContext &levelContext, size_t steps) │ │ │ │ -  Apply pre smoothing on the current level. │ │ │ │ -  │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h (LevelContext &levelContext, size_t steps) │ │ │ │ -  Apply post smoothing on the current level. │ │ │ │ -  │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Classes for the generic construction and application of the smoothers. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: smoother.hh Source File │ │ │ +dune-istl: fastamgsmoother.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,1126 +74,127 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
smoother.hh
│ │ │ +
fastamgsmoother.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMGSMOOTHER_HH
│ │ │ -
6#define DUNE_AMGSMOOTHER_HH
│ │ │ +
5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH
│ │ │ +
6#define DUNE_ISTL_FASTAMGSMOOTHER_HH
│ │ │
7
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
11#include <dune/istl/schwarz.hh>
│ │ │ - │ │ │ -
13#include <dune/common/propertymap.hh>
│ │ │ -
14#include <dune/common/ftraits.hh>
│ │ │ -
15
│ │ │ -
16namespace Dune
│ │ │ -
17{
│ │ │ -
18 namespace Amg
│ │ │ -
19 {
│ │ │ -
20
│ │ │ -
36 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
38 {
│ │ │ -
42 typedef typename FieldTraits<T>::real_type RelaxationFactor;
│ │ │ +
8#include <cstddef>
│ │ │ +
9
│ │ │ +
10namespace Dune
│ │ │ +
11{
│ │ │ +
12 namespace Amg
│ │ │ +
13 {
│ │ │ +
14
│ │ │ +
15 template<std::size_t level>
│ │ │ +
│ │ │ + │ │ │ +
17
│ │ │ +
18 template<typename M, typename X, typename Y>
│ │ │ +
│ │ │ +
19 static void apply(const M& A, X& x, Y& d,
│ │ │ +
20 const Y& b)
│ │ │ +
21 {
│ │ │ +
22 typedef typename M::ConstRowIterator RowIterator;
│ │ │ +
23 typedef typename M::ConstColIterator ColIterator;
│ │ │ +
24
│ │ │ +
25 typename Y::iterator dIter=d.begin();
│ │ │ +
26 typename Y::const_iterator bIter=b.begin();
│ │ │ +
27 typename X::iterator xIter=x.begin();
│ │ │ +
28
│ │ │ +
29 for(RowIterator row=A.begin(), end=A.end(); row != end;
│ │ │ +
30 ++row, ++dIter, ++xIter, ++bIter)
│ │ │ +
31 {
│ │ │ +
32 ColIterator col=(*row).begin();
│ │ │ +
33 *dIter = *bIter;
│ │ │ +
34
│ │ │ +
35 for (; col.index()<row.index(); ++col)
│ │ │ +
36 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ +
37 assert(row.index()==col.index());
│ │ │ +
38 ColIterator diag=col; // upper diagonal matrix not needed as x was 0 before.
│ │ │ +
39
│ │ │ +
40 // Not recursive yet. Just solve with the diagonal
│ │ │ +
41 diag->solve(*xIter,*dIter);
│ │ │ +
42 *dIter=0; //as r=v
│ │ │
43
│ │ │ - │ │ │ - │ │ │ -
52
│ │ │ -
│ │ │ - │ │ │ - │ │ │ -
58 {}
│ │ │ -
│ │ │ -
59 };
│ │ │ -
│ │ │ -
60
│ │ │ -
64 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
66 {
│ │ │ - │ │ │ -
68
│ │ │ -
69 };
│ │ │ -
│ │ │ -
70
│ │ │ -
71 template<class X, class Y>
│ │ │ -
│ │ │ - │ │ │ -
73 {
│ │ │ - │ │ │ -
75
│ │ │ -
76 };
│ │ │ -
│ │ │ -
77
│ │ │ -
78 template<class X, class Y, class C, class T>
│ │ │ -
│ │ │ - │ │ │ -
80 : public SmootherTraits<T>
│ │ │ -
81 {};
│ │ │ -
│ │ │ -
82
│ │ │ -
83 template<class C, class T>
│ │ │ -
│ │ │ - │ │ │ -
85 : public SmootherTraits<T>
│ │ │ -
86 {};
│ │ │ -
│ │ │ -
87
│ │ │ -
91 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
93 {
│ │ │ -
94 typedef typename T::matrix_type Matrix;
│ │ │ -
95
│ │ │ - │ │ │ -
97
│ │ │ - │ │ │ -
99
│ │ │ -
100 public:
│ │ │ -
│ │ │ - │ │ │ -
102 {}
│ │ │ -
│ │ │ -
103
│ │ │ -
│ │ │ -
104 void setMatrix(const Matrix& matrix)
│ │ │ -
105 {
│ │ │ -
106 matrix_=&matrix;
│ │ │ -
107 }
│ │ │ -
│ │ │ -
│ │ │ -
108 virtual void setMatrix(const Matrix& matrix, [[maybe_unused]] const AggregatesMap& amap)
│ │ │ -
109 {
│ │ │ -
110 setMatrix(matrix);
│ │ │ -
111 }
│ │ │ -
│ │ │ -
112
│ │ │ -
113
│ │ │ -
│ │ │ -
114 const Matrix& getMatrix() const
│ │ │ -
115 {
│ │ │ -
116 return *matrix_;
│ │ │ -
117 }
│ │ │ -
│ │ │ -
118
│ │ │ -
│ │ │ -
119 void setArgs(const SmootherArgs& args)
│ │ │ -
120 {
│ │ │ -
121 args_=&args;
│ │ │ -
122 }
│ │ │ -
│ │ │ -
123
│ │ │ -
124 template<class T1>
│ │ │ -
│ │ │ -
125 void setComm([[maybe_unused]] T1& comm)
│ │ │ -
126 {}
│ │ │ -
│ │ │ -
127
│ │ │ -
│ │ │ - │ │ │ -
129 {
│ │ │ -
130 return comm_;
│ │ │ -
131 }
│ │ │ -
│ │ │ -
132
│ │ │ -
│ │ │ -
133 const SmootherArgs getArgs() const
│ │ │ -
134 {
│ │ │ -
135 return *args_;
│ │ │ -
136 }
│ │ │ -
│ │ │ -
137
│ │ │ -
138 protected:
│ │ │ -
139 const Matrix* matrix_;
│ │ │ -
140 private:
│ │ │ -
141 const SmootherArgs* args_;
│ │ │ - │ │ │ -
143 };
│ │ │ -
│ │ │ -
144
│ │ │ -
145 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
147 : public DefaultConstructionArgs<T>
│ │ │ -
148 {};
│ │ │ -
│ │ │ -
149
│ │ │ -
150 template<class T, class C=SequentialInformation>
│ │ │ -
│ │ │ - │ │ │ -
152 : public ConstructionArgs<T>
│ │ │ -
153 {
│ │ │ -
154 public:
│ │ │ -
│ │ │ - │ │ │ -
156 {}
│ │ │ -
│ │ │ -
157
│ │ │ -
│ │ │ -
158 void setComm(const C& comm)
│ │ │ -
159 {
│ │ │ -
160 comm_ = &comm;
│ │ │ -
161 }
│ │ │ -
│ │ │ -
162
│ │ │ -
│ │ │ -
163 const C& getComm() const
│ │ │ -
164 {
│ │ │ -
165 return *comm_;
│ │ │ -
166 }
│ │ │ -
│ │ │ -
167 private:
│ │ │ -
168 const C* comm_;
│ │ │ -
169 };
│ │ │ -
│ │ │ -
170
│ │ │ -
171
│ │ │ -
172 template<class X, class Y>
│ │ │ -
│ │ │ - │ │ │ -
174 {
│ │ │ -
175 typedef Richardson<X,Y> T;
│ │ │ -
176
│ │ │ - │ │ │ -
178
│ │ │ -
179 public:
│ │ │ -
│ │ │ - │ │ │ -
181 {}
│ │ │ -
│ │ │ -
182
│ │ │ -
183 template <class... Args>
│ │ │ -
│ │ │ -
184 void setMatrix(const Args&...)
│ │ │ -
185 {}
│ │ │ -
│ │ │ -
186
│ │ │ -
│ │ │ -
187 void setArgs(const SmootherArgs& args)
│ │ │ -
188 {
│ │ │ -
189 args_=&args;
│ │ │ -
190 }
│ │ │ -
│ │ │ -
191
│ │ │ -
192 template<class T1>
│ │ │ -
│ │ │ -
193 void setComm([[maybe_unused]] T1& comm)
│ │ │ -
194 {}
│ │ │ -
│ │ │ -
195
│ │ │ -
│ │ │ - │ │ │ -
197 {
│ │ │ -
198 return comm_;
│ │ │ -
199 }
│ │ │ -
│ │ │ -
200
│ │ │ -
│ │ │ -
201 const SmootherArgs getArgs() const
│ │ │ -
202 {
│ │ │ -
203 return *args_;
│ │ │ -
204 }
│ │ │ -
│ │ │ -
205
│ │ │ -
206 private:
│ │ │ -
207 const SmootherArgs* args_;
│ │ │ - │ │ │ -
209 };
│ │ │ -
│ │ │ -
210
│ │ │ -
211
│ │ │ -
212
│ │ │ -
213 template<class T>
│ │ │ -
214 struct ConstructionTraits;
│ │ │ -
215
│ │ │ -
219 template<class M, class X, class Y, int l>
│ │ │ -
│ │ │ -
220 struct ConstructionTraits<SeqSSOR<M,X,Y,l> >
│ │ │ -
221 {
│ │ │ - │ │ │ -
223
│ │ │ -
│ │ │ -
224 static inline std::shared_ptr<SeqSSOR<M,X,Y,l>> construct(Arguments& args)
│ │ │ -
225 {
│ │ │ -
226 return std::make_shared<SeqSSOR<M,X,Y,l>>
│ │ │ -
227 (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
│ │ │ -
228 }
│ │ │ -
│ │ │ -
229 };
│ │ │ -
│ │ │ -
230
│ │ │ -
231
│ │ │ -
235 template<class M, class X, class Y, int l>
│ │ │ -
│ │ │ -
236 struct ConstructionTraits<SeqSOR<M,X,Y,l> >
│ │ │ -
237 {
│ │ │ - │ │ │ -
239
│ │ │ -
│ │ │ -
240 static inline std::shared_ptr<SeqSOR<M,X,Y,l>> construct(Arguments& args)
│ │ │ -
241 {
│ │ │ -
242 return std::make_shared<SeqSOR<M,X,Y,l>>
│ │ │ -
243 (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
│ │ │ -
244 }
│ │ │ -
│ │ │ -
245 };
│ │ │ -
│ │ │ -
246
│ │ │ -
247
│ │ │ -
251 template<class M, class X, class Y, int l>
│ │ │ -
│ │ │ -
252 struct ConstructionTraits<SeqJac<M,X,Y,l> >
│ │ │ -
253 {
│ │ │ - │ │ │ -
255
│ │ │ -
│ │ │ -
256 static inline std::shared_ptr<SeqJac<M,X,Y,l>> construct(Arguments& args)
│ │ │ -
257 {
│ │ │ -
258 return std::make_shared<SeqJac<M,X,Y,l>>
│ │ │ -
259 (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
│ │ │ -
260 }
│ │ │ -
│ │ │ -
261 };
│ │ │ -
│ │ │ -
262
│ │ │ -
266 template<class X, class Y>
│ │ │ -
│ │ │ -
267 struct ConstructionTraits<Richardson<X,Y> >
│ │ │ -
268 {
│ │ │ - │ │ │ -
270
│ │ │ -
│ │ │ -
271 static inline std::shared_ptr<Richardson<X,Y>> construct(Arguments& args)
│ │ │ -
272 {
│ │ │ -
273 return std::make_shared<Richardson<X,Y>>
│ │ │ -
274 (args.getArgs().relaxationFactor);
│ │ │ -
275 }
│ │ │ -
│ │ │ -
276 };
│ │ │ -
│ │ │ -
277
│ │ │ -
278
│ │ │ -
279 template<class M, class X, class Y>
│ │ │ -
│ │ │ - │ │ │ -
281 : public DefaultConstructionArgs<SeqILU<M,X,Y> >
│ │ │ -
282 {
│ │ │ -
283 public:
│ │ │ -
│ │ │ - │ │ │ -
285 : n_(n)
│ │ │ -
286 {}
│ │ │ -
│ │ │ -
287
│ │ │ -
│ │ │ -
288 void setN(int n)
│ │ │ -
289 {
│ │ │ -
290 n_ = n;
│ │ │ -
291 }
│ │ │ -
│ │ │ -
292
│ │ │ -
│ │ │ -
293 int getN()
│ │ │ -
294 {
│ │ │ -
295 return n_;
│ │ │ -
296 }
│ │ │ -
│ │ │ -
297
│ │ │ -
298 private:
│ │ │ -
299 int n_;
│ │ │ -
300 };
│ │ │ -
│ │ │ -
301
│ │ │ -
302
│ │ │ -
306 template<class M, class X, class Y>
│ │ │ -
│ │ │ -
307 struct ConstructionTraits<SeqILU<M,X,Y> >
│ │ │ -
308 {
│ │ │ - │ │ │ -
310
│ │ │ -
│ │ │ -
311 static inline std::shared_ptr<SeqILU<M,X,Y>> construct(Arguments& args)
│ │ │ -
312 {
│ │ │ -
313 return std::make_shared<SeqILU<M,X,Y>>
│ │ │ -
314 (args.getMatrix(), args.getN(), args.getArgs().relaxationFactor);
│ │ │ -
315 }
│ │ │ -
│ │ │ -
316 };
│ │ │ -
│ │ │ -
317
│ │ │ -
321 template<class M, class X, class Y, class C>
│ │ │ -
│ │ │ -
322 struct ConstructionTraits<ParSSOR<M,X,Y,C> >
│ │ │ -
323 {
│ │ │ - │ │ │ -
325
│ │ │ -
│ │ │ -
326 static inline std::shared_ptr<ParSSOR<M,X,Y,C>> construct(Arguments& args)
│ │ │ -
327 {
│ │ │ -
328 return std::make_shared<ParSSOR<M,X,Y,C>>
│ │ │ -
329 (args.getMatrix(), args.getArgs().iterations,
│ │ │ -
330 args.getArgs().relaxationFactor, args.getComm());
│ │ │ -
331 }
│ │ │ -
│ │ │ -
332 };
│ │ │ -
│ │ │ -
333
│ │ │ -
334 template<class X, class Y, class C, class T>
│ │ │ -
│ │ │ -
335 struct ConstructionTraits<BlockPreconditioner<X,Y,C,T> >
│ │ │ -
336 {
│ │ │ - │ │ │ -
338 typedef ConstructionTraits<T> SeqConstructionTraits;
│ │ │ -
│ │ │ -
339 static inline std::shared_ptr<BlockPreconditioner<X,Y,C,T>> construct(Arguments& args)
│ │ │ -
340 {
│ │ │ -
341 auto seqPrec = SeqConstructionTraits::construct(args);
│ │ │ -
342 return std::make_shared<BlockPreconditioner<X,Y,C,T>> (seqPrec, args.getComm());
│ │ │ -
343 }
│ │ │ -
│ │ │ -
344 };
│ │ │ -
│ │ │ -
345
│ │ │ -
346 template<class C, class T>
│ │ │ -
│ │ │ -
347 struct ConstructionTraits<NonoverlappingBlockPreconditioner<C,T> >
│ │ │ -
348 {
│ │ │ - │ │ │ -
350 typedef ConstructionTraits<T> SeqConstructionTraits;
│ │ │ -
│ │ │ -
351 static inline std::shared_ptr<NonoverlappingBlockPreconditioner<C,T>> construct(Arguments& args)
│ │ │ -
352 {
│ │ │ -
353 auto seqPrec = SeqConstructionTraits::construct(args);
│ │ │ -
354 return std::make_shared<NonoverlappingBlockPreconditioner<C,T>> (seqPrec, args.getComm());
│ │ │ -
355 }
│ │ │ -
│ │ │ -
356 };
│ │ │ -
│ │ │ -
357
│ │ │ -
368 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
370 {
│ │ │ -
371 typedef T Smoother;
│ │ │ -
372 typedef typename Smoother::range_type Range;
│ │ │ -
373 typedef typename Smoother::domain_type Domain;
│ │ │ -
374
│ │ │ -
│ │ │ -
382 static void preSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ -
383 {
│ │ │ -
384 smoother.apply(v,d);
│ │ │ -
385 }
│ │ │ -
│ │ │ -
386
│ │ │ -
│ │ │ -
394 static void postSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ -
395 {
│ │ │ -
396 smoother.apply(v,d);
│ │ │ -
397 }
│ │ │ -
│ │ │ -
398 };
│ │ │ -
│ │ │ -
399
│ │ │ -
405 template<typename LevelContext>
│ │ │ -
│ │ │ -
406 void presmooth(LevelContext& levelContext, size_t steps)
│ │ │ -
407 {
│ │ │ -
408 for(std::size_t i=0; i < steps; ++i) {
│ │ │ -
409 *levelContext.lhs=0;
│ │ │ - │ │ │ -
411 ::preSmooth(*levelContext.smoother, *levelContext.lhs,
│ │ │ -
412 *levelContext.rhs);
│ │ │ -
413 // Accumulate update
│ │ │ -
414 *levelContext.update += *levelContext.lhs;
│ │ │ -
415
│ │ │ -
416 // update defect
│ │ │ -
417 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, *levelContext.rhs);
│ │ │ -
418 levelContext.pinfo->project(*levelContext.rhs);
│ │ │ -
419 }
│ │ │ -
420 }
│ │ │ -
│ │ │ -
421
│ │ │ -
427 template<typename LevelContext>
│ │ │ -
│ │ │ -
428 void postsmooth(LevelContext& levelContext, size_t steps)
│ │ │ -
429 {
│ │ │ -
430 for(std::size_t i=0; i < steps; ++i) {
│ │ │ -
431 // update defect
│ │ │ -
432 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs,
│ │ │ -
433 *levelContext.rhs);
│ │ │ -
434 *levelContext.lhs=0;
│ │ │ -
435 levelContext.pinfo->project(*levelContext.rhs);
│ │ │ - │ │ │ -
437 ::postSmooth(*levelContext.smoother, *levelContext.lhs, *levelContext.rhs);
│ │ │ -
438 // Accumulate update
│ │ │ -
439 *levelContext.update += *levelContext.lhs;
│ │ │ -
440 }
│ │ │ -
441 }
│ │ │ -
│ │ │ -
442
│ │ │ -
443 template<class M, class X, class Y, int l>
│ │ │ -
│ │ │ -
444 struct SmootherApplier<SeqSOR<M,X,Y,l> >
│ │ │ -
445 {
│ │ │ - │ │ │ -
447 typedef typename Smoother::range_type Range;
│ │ │ - │ │ │ -
449
│ │ │ -
│ │ │ -
450 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ -
451 {
│ │ │ -
452 smoother.template apply<true>(v,d);
│ │ │ -
453 }
│ │ │ -
│ │ │ -
454
│ │ │ -
455
│ │ │ -
│ │ │ -
456 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ -
457 {
│ │ │ -
458 smoother.template apply<false>(v,d);
│ │ │ -
459 }
│ │ │ -
│ │ │ -
460 };
│ │ │ -
│ │ │ -
461
│ │ │ -
462 template<class M, class X, class Y, class C, int l>
│ │ │ -
│ │ │ - │ │ │ -
464 {
│ │ │ - │ │ │ -
466 typedef typename Smoother::range_type Range;
│ │ │ - │ │ │ -
468
│ │ │ -
│ │ │ -
469 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ -
470 {
│ │ │ -
471 smoother.template apply<true>(v,d);
│ │ │ -
472 }
│ │ │ -
│ │ │ -
473
│ │ │ -
474
│ │ │ -
│ │ │ -
475 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ -
476 {
│ │ │ -
477 smoother.template apply<false>(v,d);
│ │ │ -
478 }
│ │ │ -
│ │ │ -
479 };
│ │ │ -
│ │ │ -
480
│ │ │ -
481 template<class M, class X, class Y, class C, int l>
│ │ │ -
│ │ │ - │ │ │ -
483 {
│ │ │ - │ │ │ -
485 typedef typename Smoother::range_type Range;
│ │ │ - │ │ │ -
487
│ │ │ -
│ │ │ -
488 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ -
489 {
│ │ │ -
490 smoother.template apply<true>(v,d);
│ │ │ -
491 }
│ │ │ -
│ │ │ -
492
│ │ │ -
493
│ │ │ -
│ │ │ -
494 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ -
495 {
│ │ │ -
496 smoother.template apply<false>(v,d);
│ │ │ -
497 }
│ │ │ -
│ │ │ -
498 };
│ │ │ -
│ │ │ -
499
│ │ │ -
500 } // end namespace Amg
│ │ │ -
501
│ │ │ -
502 // forward declarations
│ │ │ -
503 template<class M, class X, class MO, class MS, class A>
│ │ │ -
504 class SeqOverlappingSchwarz;
│ │ │ -
505
│ │ │ -
506 struct MultiplicativeSchwarzMode;
│ │ │ -
507
│ │ │ -
508 namespace Amg
│ │ │ -
509 {
│ │ │ -
510 template<class M, class X, class MS, class TA>
│ │ │ -
│ │ │ - │ │ │ -
512 MS,TA> >
│ │ │ -
513 {
│ │ │ - │ │ │ -
515 typedef typename Smoother::range_type Range;
│ │ │ - │ │ │ -
517
│ │ │ -
│ │ │ -
518 static void preSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ -
519 {
│ │ │ -
520 smoother.template apply<true>(v,d);
│ │ │ -
521 }
│ │ │ -
│ │ │ -
522
│ │ │ -
523
│ │ │ -
│ │ │ -
524 static void postSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ -
525 {
│ │ │ -
526 smoother.template apply<false>(v,d);
│ │ │ -
527
│ │ │ -
528 }
│ │ │ -
│ │ │ -
529 };
│ │ │ -
│ │ │ -
530
│ │ │ -
531 // template<class M, class X, class TM, class TA>
│ │ │ -
532 // class SeqOverlappingSchwarz;
│ │ │ -
533
│ │ │ -
534 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
536 : public DefaultSmootherArgs<T>
│ │ │ -
537 {
│ │ │ - │ │ │ -
539
│ │ │ - │ │ │ - │ │ │ -
542
│ │ │ -
│ │ │ - │ │ │ -
544 bool onthefly_=false)
│ │ │ -
545 : overlap(overlap_), onthefly(onthefly_)
│ │ │ -
546 {}
│ │ │ -
│ │ │ -
547 };
│ │ │ -
│ │ │ -
548
│ │ │ -
549 template<class M, class X, class TM, class TS, class TA>
│ │ │ -
│ │ │ - │ │ │ -
551 {
│ │ │ - │ │ │ -
553 };
│ │ │ -
│ │ │ -
554
│ │ │ -
555 template<class M, class X, class TM, class TS, class TA>
│ │ │ -
│ │ │ - │ │ │ -
557 : public DefaultConstructionArgs<SeqOverlappingSchwarz<M,X,TM,TS,TA> >
│ │ │ -
558 {
│ │ │ - │ │ │ -
560
│ │ │ -
561 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
566 typedef typename Vector::value_type Subdomain;
│ │ │ -
567
│ │ │ -
│ │ │ -
568 virtual void setMatrix(const M& matrix, const AggregatesMap& amap)
│ │ │ -
569 {
│ │ │ -
570 Father::setMatrix(matrix);
│ │ │ -
571
│ │ │ -
572 std::vector<bool> visited(amap.noVertices(), false);
│ │ │ -
573 typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
│ │ │ -
574 VisitedMapType visitedMap(visited.begin());
│ │ │ -
575
│ │ │ -
576 MatrixGraph<const M> graph(matrix);
│ │ │ -
577
│ │ │ - │ │ │ -
579
│ │ │ -
580 switch(Father::getArgs().overlap) {
│ │ │ -
581 case SmootherArgs::vertex :
│ │ │ -
582 {
│ │ │ -
583 VertexAdder visitor(subdomains, amap);
│ │ │ -
584 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ -
585 }
│ │ │ -
586 break;
│ │ │ -
587 case SmootherArgs::pairwise :
│ │ │ -
588 {
│ │ │ -
589 createPairDomains(graph);
│ │ │ -
590 }
│ │ │ -
591 break;
│ │ │ -
592 case SmootherArgs::aggregate :
│ │ │ -
593 {
│ │ │ -
594 AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
│ │ │ -
595 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ -
596 }
│ │ │ -
597 break;
│ │ │ -
598 case SmootherArgs::none :
│ │ │ -
599 NoneAdder visitor;
│ │ │ -
600 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ -
601 break;
│ │ │ -
602 default :
│ │ │ -
603 DUNE_THROW(NotImplemented, "This overlapping scheme is not supported!");
│ │ │ -
604 }
│ │ │ -
605 }
│ │ │ -
│ │ │ -
│ │ │ -
606 void setMatrix(const M& matrix)
│ │ │ -
607 {
│ │ │ -
608 Father::setMatrix(matrix);
│ │ │ -
609
│ │ │ -
610 /* Create aggregates map where each aggregate is just one vertex. */
│ │ │ -
611 AggregatesMap amap(matrix.N());
│ │ │ - │ │ │ -
613 for(typename AggregatesMap::iterator iter=amap.begin();
│ │ │ -
614 iter!=amap.end(); ++iter)
│ │ │ -
615 *iter=v++;
│ │ │ -
616
│ │ │ -
617 std::vector<bool> visited(amap.noVertices(), false);
│ │ │ -
618 typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
│ │ │ -
619 VisitedMapType visitedMap(visited.begin());
│ │ │ -
620
│ │ │ -
621 MatrixGraph<const M> graph(matrix);
│ │ │ -
622
│ │ │ - │ │ │ -
624
│ │ │ -
625 switch(Father::getArgs().overlap) {
│ │ │ -
626 case SmootherArgs::vertex :
│ │ │ -
627 {
│ │ │ -
628 VertexAdder visitor(subdomains, amap);
│ │ │ -
629 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ -
630 }
│ │ │ -
631 break;
│ │ │ -
632 case SmootherArgs::aggregate :
│ │ │ -
633 {
│ │ │ -
634 DUNE_THROW(NotImplemented, "Aggregate overlap is not supported yet");
│ │ │ -
635 /*
│ │ │ -
636 AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
│ │ │ -
637 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ -
638 */
│ │ │ -
639 }
│ │ │ -
640 break;
│ │ │ -
641 case SmootherArgs::pairwise :
│ │ │ -
642 {
│ │ │ -
643 createPairDomains(graph);
│ │ │ -
644 }
│ │ │ -
645 break;
│ │ │ -
646 case SmootherArgs::none :
│ │ │ -
647 NoneAdder visitor;
│ │ │ -
648 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ -
649
│ │ │ -
650 }
│ │ │ -
651 }
│ │ │ -
│ │ │ -
652
│ │ │ -
│ │ │ - │ │ │ -
654 {
│ │ │ -
655 return subdomains;
│ │ │ -
656 }
│ │ │ -
│ │ │ -
657
│ │ │ -
658 private:
│ │ │ -
659 struct VertexAdder
│ │ │ -
660 {
│ │ │ -
│ │ │ -
661 VertexAdder(Vector& subdomains_, const AggregatesMap& aggregates_)
│ │ │ -
662 : subdomains(subdomains_), max(-1), subdomain(-1), aggregates(aggregates_)
│ │ │ -
663 {}
│ │ │ -
│ │ │ -
664 template<class T>
│ │ │ -
│ │ │ -
665 void operator()(const T& edge)
│ │ │ -
666 {
│ │ │ -
667 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED)
│ │ │ -
668 subdomains[subdomain].insert(edge.target());
│ │ │ -
669 }
│ │ │ -
│ │ │ -
│ │ │ -
670 int setAggregate(const AggregateDescriptor& aggregate_)
│ │ │ -
671 {
│ │ │ -
672 subdomain=aggregate_;
│ │ │ -
673 max = std::max(subdomain, aggregate_);
│ │ │ -
674 return subdomain;
│ │ │ -
675 }
│ │ │ -
│ │ │ -
│ │ │ -
676 int noSubdomains() const
│ │ │ -
677 {
│ │ │ -
678 return max+1;
│ │ │ -
679 }
│ │ │ -
│ │ │ -
680 private:
│ │ │ -
681 Vector& subdomains;
│ │ │ - │ │ │ -
683 AggregateDescriptor subdomain;
│ │ │ -
684 const AggregatesMap& aggregates;
│ │ │ -
685 };
│ │ │ -
686 struct NoneAdder
│ │ │ -
687 {
│ │ │ -
688 template<class T>
│ │ │ -
│ │ │ -
689 void operator()(const T& edge)
│ │ │ -
690 {}
│ │ │ -
│ │ │ -
│ │ │ -
691 int setAggregate(const AggregateDescriptor& aggregate_)
│ │ │ -
692 {
│ │ │ -
693 return -1;
│ │ │ -
694 }
│ │ │ -
│ │ │ -
│ │ │ -
695 int noSubdomains() const
│ │ │ -
696 {
│ │ │ -
697 return -1;
│ │ │ -
698 }
│ │ │ -
│ │ │ -
699 };
│ │ │ -
700
│ │ │ -
701 template<class VM>
│ │ │ -
702 struct AggregateAdder
│ │ │ -
703 {
│ │ │ -
│ │ │ -
704 AggregateAdder(Vector& subdomains_, const AggregatesMap& aggregates_,
│ │ │ -
705 const MatrixGraph<const M>& graph_, VM& visitedMap_)
│ │ │ -
706 : subdomains(subdomains_), subdomain(-1), aggregates(aggregates_),
│ │ │ -
707 adder(subdomains_, aggregates_), graph(graph_), visitedMap(visitedMap_)
│ │ │ -
708 {}
│ │ │ -
│ │ │ -
709 template<class T>
│ │ │ -
│ │ │ -
710 void operator()(const T& edge)
│ │ │ -
711 {
│ │ │ -
712 subdomains[subdomain].insert(edge.target());
│ │ │ -
713 // If we (the neighbouring vertex of the aggregate)
│ │ │ -
714 // are not isolated, add the aggregate we belong to
│ │ │ -
715 // to the same subdomain using the OneOverlapAdder
│ │ │ -
716 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) {
│ │ │ -
717 assert(aggregates[edge.target()]!=aggregate);
│ │ │ -
718 typename AggregatesMap::VertexList vlist;
│ │ │ -
719 aggregates.template breadthFirstSearch<true,false>(edge.target(), aggregate,
│ │ │ -
720 graph, vlist, adder, adder,
│ │ │ -
721 visitedMap);
│ │ │ -
722 }
│ │ │ -
723 }
│ │ │ -
│ │ │ -
724
│ │ │ -
│ │ │ -
725 int setAggregate(const AggregateDescriptor& aggregate_)
│ │ │ -
726 {
│ │ │ -
727 adder.setAggregate(aggregate_);
│ │ │ -
728 aggregate=aggregate_;
│ │ │ -
729 return ++subdomain;
│ │ │ -
730 }
│ │ │ -
│ │ │ -
│ │ │ -
731 int noSubdomains() const
│ │ │ -
732 {
│ │ │ -
733 return subdomain+1;
│ │ │ -
734 }
│ │ │ -
│ │ │ -
735
│ │ │ -
736 private:
│ │ │ -
737 AggregateDescriptor aggregate;
│ │ │ -
738 Vector& subdomains;
│ │ │ -
739 int subdomain;
│ │ │ -
740 const AggregatesMap& aggregates;
│ │ │ -
741 VertexAdder adder;
│ │ │ -
742 const MatrixGraph<const M>& graph;
│ │ │ -
743 VM& visitedMap;
│ │ │ -
744 };
│ │ │ -
745
│ │ │ -
746 void createPairDomains(const MatrixGraph<const M>& graph)
│ │ │ -
747 {
│ │ │ -
748 typedef typename MatrixGraph<const M>::ConstVertexIterator VIter;
│ │ │ -
749 typedef typename MatrixGraph<const M>::ConstEdgeIterator EIter;
│ │ │ -
750 typedef typename M::size_type size_type;
│ │ │ -
751
│ │ │ -
752 std::set<std::pair<size_type,size_type> > pairs;
│ │ │ -
753 int total=0;
│ │ │ -
754 for(VIter v=graph.begin(), ve=graph.end(); ve != v; ++v)
│ │ │ -
755 for(EIter e = v.begin(), ee=v.end(); ee!=e; ++e)
│ │ │ -
756 {
│ │ │ -
757 ++total;
│ │ │ -
758 if(e.source()<e.target())
│ │ │ -
759 pairs.insert(std::make_pair(e.source(),e.target()));
│ │ │ -
760 else
│ │ │ -
761 pairs.insert(std::make_pair(e.target(),e.source()));
│ │ │ -
762 }
│ │ │ -
763
│ │ │ -
764
│ │ │ -
765 subdomains.resize(pairs.size());
│ │ │ -
766 Dune::dinfo <<std::endl<< "Created "<<pairs.size()<<" ("<<total<<") pair domains"<<std::endl<<std::endl;
│ │ │ -
767 typedef typename std::set<std::pair<size_type,size_type> >::const_iterator SIter;
│ │ │ -
768 typename Vector::iterator subdomain=subdomains.begin();
│ │ │ -
769
│ │ │ -
770 for(SIter s=pairs.begin(), se =pairs.end(); se!=s; ++s)
│ │ │ -
771 {
│ │ │ -
772 subdomain->insert(s->first);
│ │ │ -
773 subdomain->insert(s->second);
│ │ │ -
774 ++subdomain;
│ │ │ -
775 }
│ │ │ -
776 std::size_t minsize=10000;
│ │ │ -
777 std::size_t maxsize=0;
│ │ │ -
778 int sum=0;
│ │ │ -
779 for(typename Vector::size_type i=0; i < subdomains.size(); ++i) {
│ │ │ -
780 sum+=subdomains[i].size();
│ │ │ -
781 minsize=std::min(minsize, subdomains[i].size());
│ │ │ -
782 maxsize=std::max(maxsize, subdomains[i].size());
│ │ │ -
783 }
│ │ │ -
784 Dune::dinfo<<"Subdomain size: min="<<minsize<<" max="<<maxsize<<" avg="<<(sum/subdomains.size())
│ │ │ -
785 <<" no="<<subdomains.size()<<std::endl;
│ │ │ -
786 }
│ │ │ -
787
│ │ │ -
788 template<class Visitor>
│ │ │ -
789 void createSubdomains(const M& matrix, const MatrixGraph<const M>& graph,
│ │ │ -
790 const AggregatesMap& amap, Visitor& overlapVisitor,
│ │ │ -
791 IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap>& visitedMap )
│ │ │ -
792 {
│ │ │ -
793 // count number ag aggregates. We assume that the
│ │ │ -
794 // aggregates are numbered consecutively from 0 except
│ │ │ -
795 // for the isolated ones. All isolated vertices form
│ │ │ -
796 // one aggregate, here.
│ │ │ -
797 int isolated=0;
│ │ │ -
798 AggregateDescriptor maxAggregate=0;
│ │ │ -
799
│ │ │ -
800 for(std::size_t i=0; i < amap.noVertices(); ++i)
│ │ │ -
801 if(amap[i]==AggregatesMap::ISOLATED)
│ │ │ -
802 isolated++;
│ │ │ -
803 else
│ │ │ -
804 maxAggregate = std::max(maxAggregate, amap[i]);
│ │ │ -
805
│ │ │ -
806 subdomains.resize(maxAggregate+1+isolated);
│ │ │ -
807
│ │ │ -
808 // reset the subdomains
│ │ │ -
809 for(typename Vector::size_type i=0; i < subdomains.size(); ++i)
│ │ │ -
810 subdomains[i].clear();
│ │ │ -
811
│ │ │ -
812 // Create the subdomains from the aggregates mapping.
│ │ │ -
813 // For each aggregate we mark all entries and the
│ │ │ -
814 // neighbouring vertices as belonging to the same subdomain
│ │ │ -
815 VertexAdder aggregateVisitor(subdomains, amap);
│ │ │ -
816
│ │ │ -
817 for(VertexDescriptor i=0; i < amap.noVertices(); ++i)
│ │ │ -
818 if(!get(visitedMap, i)) {
│ │ │ -
819 AggregateDescriptor aggregate=amap[i];
│ │ │ -
820
│ │ │ -
821 if(amap[i]==AggregatesMap::ISOLATED) {
│ │ │ -
822 // isolated vertex gets its own aggregate
│ │ │ -
823 subdomains.push_back(Subdomain());
│ │ │ -
824 aggregate=subdomains.size()-1;
│ │ │ -
825 }
│ │ │ -
826 overlapVisitor.setAggregate(aggregate);
│ │ │ -
827 aggregateVisitor.setAggregate(aggregate);
│ │ │ -
828 subdomains[aggregate].insert(i);
│ │ │ -
829 typename AggregatesMap::VertexList vlist;
│ │ │ -
830 amap.template breadthFirstSearch<false,false>(i, aggregate, graph, vlist, aggregateVisitor,
│ │ │ -
831 overlapVisitor, visitedMap);
│ │ │ -
832 }
│ │ │ -
833
│ │ │ -
834 std::size_t minsize=10000;
│ │ │ -
835 std::size_t maxsize=0;
│ │ │ -
836 int sum=0;
│ │ │ -
837 for(typename Vector::size_type i=0; i < subdomains.size(); ++i) {
│ │ │ -
838 sum+=subdomains[i].size();
│ │ │ -
839 minsize=std::min(minsize, subdomains[i].size());
│ │ │ -
840 maxsize=std::max(maxsize, subdomains[i].size());
│ │ │ -
841 }
│ │ │ -
842 Dune::dinfo<<"Subdomain size: min="<<minsize<<" max="<<maxsize<<" avg="<<(sum/subdomains.size())
│ │ │ -
843 <<" no="<<subdomains.size()<<" isolated="<<isolated<<std::endl;
│ │ │ -
844
│ │ │ -
845
│ │ │ -
846
│ │ │ -
847 }
│ │ │ -
848 Vector subdomains;
│ │ │ -
849 };
│ │ │ -
│ │ │ -
850
│ │ │ -
851
│ │ │ -
852 template<class M, class X, class TM, class TS, class TA>
│ │ │ -
│ │ │ -
853 struct ConstructionTraits<SeqOverlappingSchwarz<M,X,TM,TS,TA> >
│ │ │ -
854 {
│ │ │ - │ │ │ -
856
│ │ │ -
│ │ │ -
857 static inline std::shared_ptr<SeqOverlappingSchwarz<M,X,TM,TS,TA>> construct(Arguments& args)
│ │ │ -
858 {
│ │ │ -
859 return std::make_shared<SeqOverlappingSchwarz<M,X,TM,TS,TA>>
│ │ │ -
860 (args.getMatrix(),
│ │ │ -
861 args.getSubDomains(),
│ │ │ - │ │ │ -
863 args.getArgs().onthefly);
│ │ │ -
864 }
│ │ │ -
│ │ │ -
865 };
│ │ │ -
│ │ │ -
866
│ │ │ -
867
│ │ │ -
868 } // namespace Amg
│ │ │ -
869} // namespace Dune
│ │ │ -
870
│ │ │ -
871
│ │ │ -
872
│ │ │ -
873#endif
│ │ │ - │ │ │ -
Define general preconditioner interface.
│ │ │ -
Helper classes for the construction of classes without empty constructor.
│ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ - │ │ │ -
DefaultSmootherArgs< typename X::field_type > Arguments
Definition smoother.hh:74
│ │ │ -
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:494
│ │ │ - │ │ │ -
static void preSmooth(Smoother &smoother, Domain &v, const Range &d)
Definition smoother.hh:518
│ │ │ -
static std::shared_ptr< SeqJac< M, X, Y, l > > construct(Arguments &args)
Definition smoother.hh:256
│ │ │ -
ConstructionArgs< SeqILU< M, X, Y > > Arguments
Definition smoother.hh:309
│ │ │ -
const Matrix & getMatrix() const
Definition smoother.hh:114
│ │ │ - │ │ │ -
int setAggregate(const AggregateDescriptor &aggregate_)
Definition smoother.hh:691
│ │ │ -
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ -
int setAggregate(const AggregateDescriptor &aggregate_)
Definition smoother.hh:670
│ │ │ -
ConstructionTraits< T > SeqConstructionTraits
Definition smoother.hh:350
│ │ │ -
void setArgs(const SmootherArgs &args)
Definition smoother.hh:119
│ │ │ -
ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Arguments
Definition smoother.hh:855
│ │ │ -
NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > Smoother
Definition smoother.hh:484
│ │ │ -
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:456
│ │ │ -
AggregateAdder(Vector &subdomains_, const AggregatesMap &aggregates_, const MatrixGraph< const M > &graph_, VM &visitedMap_)
Definition smoother.hh:704
│ │ │ - │ │ │ -
void setComm(const C &comm)
Definition smoother.hh:158
│ │ │ -
DefaultConstructionArgs< Richardson< X, Y > > Arguments
Definition smoother.hh:269
│ │ │ -
virtual ~DefaultConstructionArgs()
Definition smoother.hh:180
│ │ │ -
SeqOverlappingSchwarzSmootherArgs< typename M::field_type > Arguments
Definition smoother.hh:552
│ │ │ - │ │ │ -
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:488
│ │ │ -
int getN()
Definition smoother.hh:293
│ │ │ - │ │ │ -
SeqSOR< M, X, Y, l > Smoother
Definition smoother.hh:446
│ │ │ - │ │ │ -
static std::shared_ptr< SeqSSOR< M, X, Y, l > > construct(Arguments &args)
Definition smoother.hh:224
│ │ │ -
AggregatesMap::AggregateDescriptor AggregateDescriptor
Definition smoother.hh:564
│ │ │ -
bool onthefly
Definition smoother.hh:541
│ │ │ -
DefaultConstructionArgs< SeqSOR< M, X, Y, l > > Arguments
Definition smoother.hh:238
│ │ │ -
virtual void setMatrix(const M &matrix, const AggregatesMap &amap)
Definition smoother.hh:568
│ │ │ -
void setMatrix(const Args &...)
Definition smoother.hh:184
│ │ │ -
DefaultConstructionArgs< SeqJac< M, X, Y, l > > Arguments
Definition smoother.hh:254
│ │ │ -
DefaultConstructionArgs< SeqSSOR< M, X, Y, l > > Arguments
Definition smoother.hh:222
│ │ │ -
const SmootherArgs getArgs() const
Definition smoother.hh:133
│ │ │ -
VertexAdder(Vector &subdomains_, const AggregatesMap &aggregates_)
Definition smoother.hh:661
│ │ │ - │ │ │ -
SeqOverlappingSchwarz< M, X, TM, TS, TA >::subdomain_vector Vector
Definition smoother.hh:565
│ │ │ -
static std::shared_ptr< SeqOverlappingSchwarz< M, X, TM, TS, TA > > construct(Arguments &args)
Definition smoother.hh:857
│ │ │ -
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:469
│ │ │ -
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ -
void setMatrix(const Matrix &matrix)
Definition smoother.hh:104
│ │ │ -
T Smoother
Definition smoother.hh:371
│ │ │ -
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:450
│ │ │ -
BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > Smoother
Definition smoother.hh:465
│ │ │ -
void setComm(T1 &comm)
Definition smoother.hh:193
│ │ │ - │ │ │ -
AggregateDescriptor * iterator
Definition aggregates.hh:735
│ │ │ -
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ - │ │ │ -
SeqOverlappingSchwarzSmootherArgs(Overlap overlap_=vertex, bool onthefly_=false)
Definition smoother.hh:543
│ │ │ -
DefaultParallelConstructionArgs< T, C > Arguments
Definition smoother.hh:337
│ │ │ -
DefaultParallelConstructionArgs< T, C > Arguments
Definition smoother.hh:349
│ │ │ -
const Matrix * matrix_
Definition smoother.hh:139
│ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ -
const SequentialInformation & getComm()
Definition smoother.hh:128
│ │ │ -
V AggregateDescriptor
The aggregate descriptor type.
Definition aggregates.hh:580
│ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ -
DefaultSmootherArgs()
Default constructor.
Definition smoother.hh:56
│ │ │ -
void setMatrix(const M &matrix)
Definition smoother.hh:606
│ │ │ -
std::size_t noVertices() const
Get the number of vertices.
│ │ │ - │ │ │ -
static void postSmooth(Smoother &smoother, Domain &v, const Range &d)
apply post smoothing in forward direction
Definition smoother.hh:394
│ │ │ -
FieldTraits< T >::real_type RelaxationFactor
The type of the relaxation factor.
Definition smoother.hh:42
│ │ │ - │ │ │ -
Smoother::domain_type Domain
Definition smoother.hh:373
│ │ │ -
void setN(int n)
Definition smoother.hh:288
│ │ │ -
static std::shared_ptr< BlockPreconditioner< X, Y, C, T > > construct(Arguments &args)
Definition smoother.hh:339
│ │ │ -
SLList< VertexDescriptor, Allocator > VertexList
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:592
│ │ │ -
static std::shared_ptr< NonoverlappingBlockPreconditioner< C, T > > construct(Arguments &args)
Definition smoother.hh:351
│ │ │ -
SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > Smoother
Definition smoother.hh:514
│ │ │ -
static std::shared_ptr< ParSSOR< M, X, Y, C > > construct(Arguments &args)
Definition smoother.hh:326
│ │ │ -
MatrixGraph< M >::VertexDescriptor VertexDescriptor
Definition smoother.hh:562
│ │ │ -
static std::shared_ptr< SeqILU< M, X, Y > > construct(Arguments &args)
Definition smoother.hh:311
│ │ │ - │ │ │ -
const SequentialInformation & getComm()
Definition smoother.hh:196
│ │ │ -
static std::shared_ptr< SeqSOR< M, X, Y, l > > construct(Arguments &args)
Definition smoother.hh:240
│ │ │ -
static std::shared_ptr< Richardson< X, Y > > construct(Arguments &args)
Definition smoother.hh:271
│ │ │ -
virtual void setMatrix(const Matrix &matrix, const AggregatesMap &amap)
Definition smoother.hh:108
│ │ │ - │ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
Dune::Amg::AggregatesMap< VertexDescriptor > AggregatesMap
Definition smoother.hh:563
│ │ │ -
const SmootherArgs getArgs() const
Definition smoother.hh:201
│ │ │ -
void setComm(T1 &comm)
Definition smoother.hh:125
│ │ │ -
static void postSmooth(Smoother &smoother, Domain &v, const Range &d)
Definition smoother.hh:524
│ │ │ -
DefaultParallelConstructionArgs< M, C > Arguments
Definition smoother.hh:324
│ │ │ -
RelaxationFactor relaxationFactor
The relaxation factor to use.
Definition smoother.hh:51
│ │ │ -
virtual ~DefaultParallelConstructionArgs()
Definition smoother.hh:155
│ │ │ -
Smoother::domain_type Domain
Definition smoother.hh:448
│ │ │ -
int setAggregate(const AggregateDescriptor &aggregate_)
Definition smoother.hh:725
│ │ │ -
Smoother::range_type Range
Definition smoother.hh:447
│ │ │ -
const C & getComm() const
Definition smoother.hh:163
│ │ │ -
virtual ~DefaultConstructionArgs()
Definition smoother.hh:101
│ │ │ -
static void preSmooth(Smoother &smoother, Domain &v, const Range &d)
apply pre smoothing in forward direction
Definition smoother.hh:382
│ │ │ -
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:475
│ │ │ -
ConstructionTraits< T > SeqConstructionTraits
Definition smoother.hh:338
│ │ │ -
ConstructionArgs(int n=0)
Definition smoother.hh:284
│ │ │ - │ │ │ -
void setArgs(const SmootherArgs &args)
Definition smoother.hh:187
│ │ │ -
int iterations
The number of iterations to perform.
Definition smoother.hh:47
│ │ │ -
Smoother::range_type Range
Definition smoother.hh:372
│ │ │ -
Overlap overlap
Definition smoother.hh:540
│ │ │ - │ │ │ -
@ aggregate
Definition smoother.hh:538
│ │ │ - │ │ │ -
@ pairwise
Definition smoother.hh:538
│ │ │ - │ │ │ +
44 // Update residual for the symmetric case
│ │ │ +
45 for(col=(*row).begin(); col.index()<row.index(); ++col)
│ │ │ +
46 col->mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ +
47 }
│ │ │ +
48 }
│ │ │ +
│ │ │ +
49 };
│ │ │ +
│ │ │ +
50
│ │ │ +
51 template<std::size_t level>
│ │ │ +
│ │ │ + │ │ │ +
53
│ │ │ +
54 template<typename M, typename X, typename Y>
│ │ │ +
│ │ │ +
55 static void apply(const M& A, X& x, Y& d,
│ │ │ +
56 const Y& b)
│ │ │ +
57 {
│ │ │ +
58 typedef typename M::ConstRowIterator RowIterator;
│ │ │ +
59 typedef typename M::ConstColIterator ColIterator;
│ │ │ +
60 typedef typename Y::block_type YBlock;
│ │ │ +
61
│ │ │ +
62 typename Y::iterator dIter=d.beforeEnd();
│ │ │ +
63 typename X::iterator xIter=x.beforeEnd();
│ │ │ +
64 typename Y::const_iterator bIter=b.beforeEnd();
│ │ │ +
65
│ │ │ +
66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
│ │ │ +
67 --row, --dIter, --xIter, --bIter)
│ │ │ +
68 {
│ │ │ +
69 ColIterator endCol=(*row).beforeBegin();
│ │ │ +
70 ColIterator col=(*row).beforeEnd();
│ │ │ +
71 *dIter = *bIter;
│ │ │ +
72
│ │ │ +
73 for (; col.index()>row.index(); --col)
│ │ │ +
74 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j
│ │ │ +
75 assert(row.index()==col.index());
│ │ │ +
76 ColIterator diag=col;
│ │ │ +
77 YBlock v=*dIter;
│ │ │ +
78 // upper diagonal matrix
│ │ │ +
79 for (--col; col!=endCol; --col)
│ │ │ +
80 (*col).mmv(x[col.index()],v); // v -= sum_{j<i} a_ij * xold_j
│ │ │ +
81
│ │ │ +
82 // Not recursive yet. Just solve with the diagonal
│ │ │ +
83 diag->solve(*xIter,v);
│ │ │ +
84
│ │ │ +
85 *dIter-=v;
│ │ │ +
86
│ │ │ +
87 // Update residual for the symmetric case
│ │ │ +
88 // Skip residual computation as it is not needed.
│ │ │ +
89 //for(col=(*row).begin();col.index()<row.index(); ++col)
│ │ │ +
90 //col.mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ +
91 }
│ │ │ +
92 }
│ │ │ +
│ │ │ +
93 };
│ │ │ +
│ │ │ +
94 } // end namespace Amg
│ │ │ +
95} // end namespace Dune
│ │ │ +
96#endif
│ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │
Definition allocator.hh:11
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ -
X range_type
The range type of the preconditioner.
Definition overlappingschwarz.hh:770
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition overlappingschwarz.hh:765
│ │ │ -
std::vector< subdomain_type, typename std::allocator_traits< TA >::template rebind_alloc< subdomain_type > > subdomain_vector
The vector type containing the subdomain to row index mapping.
Definition overlappingschwarz.hh:797
│ │ │ -
Nonoverlapping parallel preconditioner.
Definition novlpschwarz.hh:276
│ │ │ -
P::range_type range_type
The range type of the preconditioner.
Definition novlpschwarz.hh:284
│ │ │ -
P::domain_type domain_type
The domain type of the preconditioner.
Definition novlpschwarz.hh:282
│ │ │ -
Tag that tells the Schwarz method to be multiplicative.
Definition overlappingschwarz.hh:126
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
VertexIterator end()
Get an iterator over the vertices.
│ │ │ -
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ -
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ -
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ -
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ -
Definition pinfo.hh:28
│ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ -
Traits class for getting the attribute class of a smoother.
Definition smoother.hh:66
│ │ │ -
Construction Arguments for the default smoothers.
Definition smoother.hh:93
│ │ │ -
Definition smoother.hh:148
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
Helper class for applying the smoothers.
Definition smoother.hh:370
│ │ │ - │ │ │ - │ │ │ -
Sequential SSOR preconditioner.
Definition preconditioners.hh:142
│ │ │ -
Sequential SOR preconditioner.
Definition preconditioners.hh:262
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:267
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:269
│ │ │ -
The sequential jacobian preconditioner.
Definition preconditioners.hh:413
│ │ │ -
Sequential ILU preconditioner.
Definition preconditioners.hh:697
│ │ │ -
Richardson preconditioner.
Definition preconditioners.hh:878
│ │ │ -
A parallel SSOR preconditioner.
Definition schwarz.hh:175
│ │ │ -
Block parallel preconditioner.
Definition schwarz.hh:278
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:285
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:290
│ │ │ +
Definition fastamgsmoother.hh:16
│ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ +
Definition fastamgsmoother.hh:52
│ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:55
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1343 +1,123 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -smoother.hh │ │ │ │ +fastamgsmoother.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMGSMOOTHER_HH │ │ │ │ -6#define DUNE_AMGSMOOTHER_HH │ │ │ │ +5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH │ │ │ │ +6#define DUNE_ISTL_FASTAMGSMOOTHER_HH │ │ │ │ 7 │ │ │ │ -8#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ -9#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ -10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15 │ │ │ │ -16namespace _D_u_n_e │ │ │ │ -17{ │ │ │ │ -18 namespace Amg │ │ │ │ -19 { │ │ │ │ -20 │ │ │ │ -36 template │ │ │ │ -_3_7 struct _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -38 { │ │ │ │ -_4_2 typedef typename FieldTraits::real_type _R_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r; │ │ │ │ +8#include │ │ │ │ +9 │ │ │ │ +10namespace _D_u_n_e │ │ │ │ +11{ │ │ │ │ +12 namespace Amg │ │ │ │ +13 { │ │ │ │ +14 │ │ │ │ +15 template │ │ │ │ +_1_6 struct _G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ +17 │ │ │ │ +18 template │ │ │ │ +_1_9 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ +20 const Y& b) │ │ │ │ +21 { │ │ │ │ +22 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ +23 typedef typename M::ConstColIterator ColIterator; │ │ │ │ +24 │ │ │ │ +25 typename Y::iterator dIter=d.begin(); │ │ │ │ +26 typename Y::const_iterator bIter=b.begin(); │ │ │ │ +27 typename X::iterator xIter=x.begin(); │ │ │ │ +28 │ │ │ │ +29 for(RowIterator row=A.begin(), end=A.end(); row != end; │ │ │ │ +30 ++row, ++dIter, ++xIter, ++bIter) │ │ │ │ +31 { │ │ │ │ +32 ColIterator _c_o_l=(*row).begin(); │ │ │ │ +33 *dIter = *bIter; │ │ │ │ +34 │ │ │ │ +35 for (; _c_o_l.index()solve(*xIter,*dIter); │ │ │ │ +42 *dIter=0; //as r=v │ │ │ │ 43 │ │ │ │ -_4_7 int _i_t_e_r_a_t_i_o_n_s; │ │ │ │ -_5_1 _R_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r _r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r; │ │ │ │ -52 │ │ │ │ -_5_6 _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s() │ │ │ │ -57 : _i_t_e_r_a_t_i_o_n_s(1), _r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r(1.0) │ │ │ │ -58 {} │ │ │ │ -59 }; │ │ │ │ -60 │ │ │ │ -64 template │ │ │ │ -_6_5 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s │ │ │ │ -66 { │ │ │ │ -_6_7 typedef _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _T_:_:_m_a_t_r_i_x___t_y_p_e_:_:_f_i_e_l_d___t_y_p_e_> _A_r_g_u_m_e_n_t_s; │ │ │ │ -68 │ │ │ │ -69 }; │ │ │ │ -70 │ │ │ │ -71 template │ │ │ │ -_7_2 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_R_i_c_h_a_r_d_s_o_n> │ │ │ │ -73 { │ │ │ │ -_7_4 typedef _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _X_:_:_f_i_e_l_d___t_y_p_e_> _A_r_g_u_m_e_n_t_s; │ │ │ │ -75 │ │ │ │ -76 }; │ │ │ │ -77 │ │ │ │ -78 template │ │ │ │ -_7_9 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ -80 : public _S_m_o_o_t_h_e_r_T_r_a_i_t_s │ │ │ │ -81 {}; │ │ │ │ -82 │ │ │ │ -83 template │ │ │ │ -_8_4 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ -85 : public _S_m_o_o_t_h_e_r_T_r_a_i_t_s │ │ │ │ -86 {}; │ │ │ │ -87 │ │ │ │ -91 template │ │ │ │ -_9_2 class _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ -93 { │ │ │ │ -94 typedef typename T::matrix_type Matrix; │ │ │ │ -95 │ │ │ │ -96 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ -97 │ │ │ │ -98 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_>_:_: │ │ │ │ -_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r> _A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ -99 │ │ │ │ -100 public: │ │ │ │ -_1_0_1 virtual _~_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s() │ │ │ │ -102 {} │ │ │ │ -103 │ │ │ │ -_1_0_4 void _s_e_t_M_a_t_r_i_x(const Matrix& matrix) │ │ │ │ -105 { │ │ │ │ -106 _m_a_t_r_i_x__=&matrix; │ │ │ │ -107 } │ │ │ │ -_1_0_8 virtual void _s_e_t_M_a_t_r_i_x(const Matrix& matrix, [[maybe_unused]] const │ │ │ │ -_A_g_g_r_e_g_a_t_e_s_M_a_p& amap) │ │ │ │ -109 { │ │ │ │ -110 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ -111 } │ │ │ │ -112 │ │ │ │ -113 │ │ │ │ -_1_1_4 const Matrix& _g_e_t_M_a_t_r_i_x() const │ │ │ │ -115 { │ │ │ │ -116 return *_m_a_t_r_i_x__; │ │ │ │ -117 } │ │ │ │ -118 │ │ │ │ -_1_1_9 void _s_e_t_A_r_g_s(const _S_m_o_o_t_h_e_r_A_r_g_s& args) │ │ │ │ -120 { │ │ │ │ -121 args_=&args; │ │ │ │ -122 } │ │ │ │ -123 │ │ │ │ -124 template │ │ │ │ -_1_2_5 void _s_e_t_C_o_m_m([[maybe_unused]] T1& comm) │ │ │ │ -126 {} │ │ │ │ -127 │ │ │ │ -_1_2_8 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& _g_e_t_C_o_m_m() │ │ │ │ -129 { │ │ │ │ -130 return comm_; │ │ │ │ -131 } │ │ │ │ -132 │ │ │ │ -_1_3_3 const _S_m_o_o_t_h_e_r_A_r_g_s _g_e_t_A_r_g_s() const │ │ │ │ -134 { │ │ │ │ -135 return *args_; │ │ │ │ -136 } │ │ │ │ -137 │ │ │ │ -138 protected: │ │ │ │ -_1_3_9 const Matrix* _m_a_t_r_i_x__; │ │ │ │ -140 private: │ │ │ │ -141 const _S_m_o_o_t_h_e_r_A_r_g_s* args_; │ │ │ │ -142 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n comm_; │ │ │ │ -143 }; │ │ │ │ -144 │ │ │ │ -145 template │ │ │ │ -_1_4_6 struct _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ -147 : public _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ -148 {}; │ │ │ │ -149 │ │ │ │ -150 template │ │ │ │ -_1_5_1 class _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ -152 : public _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ -153 { │ │ │ │ -154 public: │ │ │ │ -_1_5_5 virtual _~_D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s() │ │ │ │ -156 {} │ │ │ │ -157 │ │ │ │ -_1_5_8 void _s_e_t_C_o_m_m(const C& comm) │ │ │ │ -159 { │ │ │ │ -160 comm_ = &comm; │ │ │ │ -161 } │ │ │ │ -162 │ │ │ │ -_1_6_3 const C& _g_e_t_C_o_m_m() const │ │ │ │ -164 { │ │ │ │ -165 return *comm_; │ │ │ │ -166 } │ │ │ │ -167 private: │ │ │ │ -168 const C* comm_; │ │ │ │ -169 }; │ │ │ │ -170 │ │ │ │ -171 │ │ │ │ -172 template │ │ │ │ -_1_7_3 class _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s<_R_i_c_h_a_r_d_s_o_n> │ │ │ │ -174 { │ │ │ │ -175 typedef _R_i_c_h_a_r_d_s_o_n_<_X_,_Y_> _T; │ │ │ │ -176 │ │ │ │ -177 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ -178 │ │ │ │ -179 public: │ │ │ │ -_1_8_0 virtual _~_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s() │ │ │ │ -181 {} │ │ │ │ -182 │ │ │ │ -183 template │ │ │ │ -_1_8_4 void _s_e_t_M_a_t_r_i_x(const Args&...) │ │ │ │ -185 {} │ │ │ │ -186 │ │ │ │ -_1_8_7 void _s_e_t_A_r_g_s(const _S_m_o_o_t_h_e_r_A_r_g_s& args) │ │ │ │ -188 { │ │ │ │ -189 args_=&args; │ │ │ │ -190 } │ │ │ │ -191 │ │ │ │ -192 template │ │ │ │ -_1_9_3 void _s_e_t_C_o_m_m([[maybe_unused]] T1& comm) │ │ │ │ -194 {} │ │ │ │ -195 │ │ │ │ -_1_9_6 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& _g_e_t_C_o_m_m() │ │ │ │ -197 { │ │ │ │ -198 return comm_; │ │ │ │ -199 } │ │ │ │ -200 │ │ │ │ -_2_0_1 const _S_m_o_o_t_h_e_r_A_r_g_s _g_e_t_A_r_g_s() const │ │ │ │ -202 { │ │ │ │ -203 return *args_; │ │ │ │ -204 } │ │ │ │ -205 │ │ │ │ -206 private: │ │ │ │ -207 const SmootherArgs* args_; │ │ │ │ -208 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n comm_; │ │ │ │ -209 }; │ │ │ │ -210 │ │ │ │ -211 │ │ │ │ -212 │ │ │ │ -213 template │ │ │ │ -214 struct ConstructionTraits; │ │ │ │ -215 │ │ │ │ -219 template │ │ │ │ -_2_2_0 struct ConstructionTraits<_S_e_q_S_S_O_R > │ │ │ │ -221 { │ │ │ │ -_2_2_2 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_S_S_O_R_<_M_,_X_,_Y_,_l_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ -223 │ │ │ │ -_2_2_4 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -225 { │ │ │ │ -226 return std::make_shared> │ │ │ │ -227 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, args._g_e_t_A_r_g_s │ │ │ │ -()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ -228 } │ │ │ │ -229 }; │ │ │ │ -230 │ │ │ │ -231 │ │ │ │ -235 template │ │ │ │ -_2_3_6 struct ConstructionTraits<_S_e_q_S_O_R > │ │ │ │ -237 { │ │ │ │ -_2_3_8 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ -239 │ │ │ │ -_2_4_0 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -241 { │ │ │ │ -242 return std::make_shared> │ │ │ │ -243 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, args._g_e_t_A_r_g_s │ │ │ │ -()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ -244 } │ │ │ │ -245 }; │ │ │ │ -246 │ │ │ │ -247 │ │ │ │ -251 template │ │ │ │ -_2_5_2 struct ConstructionTraits<_S_e_q_J_a_c > │ │ │ │ -253 { │ │ │ │ -_2_5_4 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_J_a_c_<_M_,_X_,_Y_,_l_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ -255 │ │ │ │ -_2_5_6 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -257 { │ │ │ │ -258 return std::make_shared> │ │ │ │ -259 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, args._g_e_t_A_r_g_s │ │ │ │ -()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ -260 } │ │ │ │ -261 }; │ │ │ │ -262 │ │ │ │ -266 template │ │ │ │ -_2_6_7 struct ConstructionTraits<_R_i_c_h_a_r_d_s_o_n > │ │ │ │ -268 { │ │ │ │ -_2_6_9 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_R_i_c_h_a_r_d_s_o_n_<_X_,_Y_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ -270 │ │ │ │ -_2_7_1 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -272 { │ │ │ │ -273 return std::make_shared> │ │ │ │ -274 (args._g_e_t_A_r_g_s()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ -275 } │ │ │ │ -276 }; │ │ │ │ -277 │ │ │ │ -278 │ │ │ │ -279 template │ │ │ │ -_2_8_0 class _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s<_S_e_q_I_L_U > │ │ │ │ -281 : public _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s > │ │ │ │ -282 { │ │ │ │ -283 public: │ │ │ │ -_2_8_4 _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s(int n=0) │ │ │ │ -285 : n_(n) │ │ │ │ -286 {} │ │ │ │ -287 │ │ │ │ -_2_8_8 void _s_e_t_N(int n) │ │ │ │ -289 { │ │ │ │ -290 n_ = n; │ │ │ │ -291 } │ │ │ │ -292 │ │ │ │ -_2_9_3 int _g_e_t_N() │ │ │ │ -294 { │ │ │ │ -295 return n_; │ │ │ │ -296 } │ │ │ │ -297 │ │ │ │ -298 private: │ │ │ │ -299 int n_; │ │ │ │ -300 }; │ │ │ │ -301 │ │ │ │ -302 │ │ │ │ -306 template │ │ │ │ -_3_0_7 struct ConstructionTraits<_S_e_q_I_L_U > │ │ │ │ -308 { │ │ │ │ -_3_0_9 typedef _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_I_L_U_<_M_,_X_,_Y_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ -310 │ │ │ │ -_3_1_1 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -312 { │ │ │ │ -313 return std::make_shared> │ │ │ │ -314 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_N(), args._g_e_t_A_r_g_s()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ -315 } │ │ │ │ -316 }; │ │ │ │ -317 │ │ │ │ -321 template │ │ │ │ -_3_2_2 struct ConstructionTraits<_P_a_r_S_S_O_R > │ │ │ │ -323 { │ │ │ │ -_3_2_4 typedef _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ -325 │ │ │ │ -_3_2_6 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -327 { │ │ │ │ -328 return std::make_shared> │ │ │ │ -329 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, │ │ │ │ -330 args._g_e_t_A_r_g_s()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r, args._g_e_t_C_o_m_m()); │ │ │ │ -331 } │ │ │ │ -332 }; │ │ │ │ -333 │ │ │ │ -334 template │ │ │ │ -_3_3_5 struct ConstructionTraits<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ -336 { │ │ │ │ -_3_3_7 typedef _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_T_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ -_3_3_8 typedef ConstructionTraits _S_e_q_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s; │ │ │ │ -_3_3_9 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t │ │ │ │ -(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -340 { │ │ │ │ -341 auto seqPrec = SeqConstructionTraits::construct(args); │ │ │ │ -342 return std::make_shared> (seqPrec, │ │ │ │ -args._g_e_t_C_o_m_m()); │ │ │ │ -343 } │ │ │ │ -344 }; │ │ │ │ -345 │ │ │ │ -346 template │ │ │ │ -_3_4_7 struct ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ -348 { │ │ │ │ -_3_4_9 typedef _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_T_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ -_3_5_0 typedef ConstructionTraits _S_e_q_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s; │ │ │ │ -_3_5_1 static inline std::shared_ptr> │ │ │ │ -_c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -352 { │ │ │ │ -353 auto seqPrec = SeqConstructionTraits::construct(args); │ │ │ │ -354 return std::make_shared> (seqPrec, │ │ │ │ -args._g_e_t_C_o_m_m()); │ │ │ │ -355 } │ │ │ │ -356 }; │ │ │ │ -357 │ │ │ │ -368 template │ │ │ │ -_3_6_9 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r │ │ │ │ -370 { │ │ │ │ -_3_7_1 typedef T _S_m_o_o_t_h_e_r; │ │ │ │ -_3_7_2 typedef typename Smoother::range_type _R_a_n_g_e; │ │ │ │ -_3_7_3 typedef typename Smoother::domain_type _D_o_m_a_i_n; │ │ │ │ -374 │ │ │ │ -_3_8_2 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ -383 { │ │ │ │ -384 smoother.apply(v,d); │ │ │ │ -385 } │ │ │ │ -386 │ │ │ │ -_3_9_4 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ -395 { │ │ │ │ -396 smoother.apply(v,d); │ │ │ │ -397 } │ │ │ │ -398 }; │ │ │ │ -399 │ │ │ │ -405 template │ │ │ │ -_4_0_6 void _p_r_e_s_m_o_o_t_h(LevelContext& levelContext, size_t steps) │ │ │ │ -407 { │ │ │ │ -408 for(std::size_t i=0; i < steps; ++i) { │ │ │ │ -409 *levelContext.lhs=0; │ │ │ │ -410 _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_t_y_p_e_n_a_m_e_ _L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e_> │ │ │ │ -411_ _:_:_p_r_e_S_m_o_o_t_h(*levelContext.smoother, *levelContext.lhs, │ │ │ │ -412 *levelContext.rhs); │ │ │ │ -413 // Accumulate update │ │ │ │ -414 *levelContext.update += *levelContext.lhs; │ │ │ │ -415 │ │ │ │ -416 // update defect │ │ │ │ -417 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, │ │ │ │ -*levelContext.rhs); │ │ │ │ -418 levelContext.pinfo->project(*levelContext.rhs); │ │ │ │ -419 } │ │ │ │ -420 } │ │ │ │ -421 │ │ │ │ -427 template │ │ │ │ -_4_2_8 void _p_o_s_t_s_m_o_o_t_h(LevelContext& levelContext, size_t steps) │ │ │ │ -429 { │ │ │ │ -430 for(std::size_t i=0; i < steps; ++i) { │ │ │ │ -431 // update defect │ │ │ │ -432 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, │ │ │ │ -433 *levelContext.rhs); │ │ │ │ -434 *levelContext.lhs=0; │ │ │ │ -435 levelContext.pinfo->project(*levelContext.rhs); │ │ │ │ -436 _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_t_y_p_e_n_a_m_e_ _L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e_> │ │ │ │ -437_ _:_:_p_o_s_t_S_m_o_o_t_h(*levelContext.smoother, *levelContext.lhs, *levelContext.rhs); │ │ │ │ -438 // Accumulate update │ │ │ │ -439 *levelContext.update += *levelContext.lhs; │ │ │ │ -440 } │ │ │ │ -441 } │ │ │ │ -442 │ │ │ │ -443 template │ │ │ │ -_4_4_4 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_S_e_q_S_O_R > │ │ │ │ -445 { │ │ │ │ -_4_4_6 typedef _S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> _S_m_o_o_t_h_e_r; │ │ │ │ -_4_4_7 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ -_4_4_8 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ -449 │ │ │ │ -_4_5_0 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ -451 { │ │ │ │ -452 smoother.template apply(v,d); │ │ │ │ -453 } │ │ │ │ -454 │ │ │ │ -455 │ │ │ │ -_4_5_6 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ -457 { │ │ │ │ -458 smoother.template apply(v,d); │ │ │ │ -459 } │ │ │ │ -460 }; │ │ │ │ -461 │ │ │ │ -462 template │ │ │ │ -_4_6_3 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > > │ │ │ │ -464 { │ │ │ │ -_4_6_5 typedef _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_,_C_,_S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> > _S_m_o_o_t_h_e_r; │ │ │ │ -_4_6_6 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ -_4_6_7 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ -468 │ │ │ │ -_4_6_9 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ -470 { │ │ │ │ -471 smoother.template apply(v,d); │ │ │ │ -472 } │ │ │ │ -473 │ │ │ │ -474 │ │ │ │ -_4_7_5 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ -476 { │ │ │ │ -477 smoother.template apply(v,d); │ │ │ │ -478 } │ │ │ │ -479 }; │ │ │ │ -480 │ │ │ │ -481 template │ │ │ │ -_4_8_2 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -> > │ │ │ │ -483 { │ │ │ │ -_4_8_4 typedef _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_C_,_S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> > _S_m_o_o_t_h_e_r; │ │ │ │ -_4_8_5 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ -_4_8_6 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ -487 │ │ │ │ -_4_8_8 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ -489 { │ │ │ │ -490 smoother.template apply(v,d); │ │ │ │ -491 } │ │ │ │ -492 │ │ │ │ -493 │ │ │ │ -_4_9_4 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ -495 { │ │ │ │ -496 smoother.template apply(v,d); │ │ │ │ -497 } │ │ │ │ -498 }; │ │ │ │ -499 │ │ │ │ -500 } // end namespace Amg │ │ │ │ -501 │ │ │ │ -502 // forward declarations │ │ │ │ -503 template │ │ │ │ -504 class SeqOverlappingSchwarz; │ │ │ │ -505 │ │ │ │ -506 struct MultiplicativeSchwarzMode; │ │ │ │ -507 │ │ │ │ -508 namespace Amg │ │ │ │ -509 { │ │ │ │ -510 template │ │ │ │ -_5_1_1 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z > │ │ │ │ -513 { │ │ │ │ -_5_1_4 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_M_u_l_t_i_p_l_i_c_a_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_M_S_,_T_A_> │ │ │ │ -_S_m_o_o_t_h_e_r; │ │ │ │ -_5_1_5 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ -_5_1_6 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ -517 │ │ │ │ -_5_1_8 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ -519 { │ │ │ │ -520 smoother.template apply(v,d); │ │ │ │ -521 } │ │ │ │ -522 │ │ │ │ -523 │ │ │ │ -_5_2_4 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ -525 { │ │ │ │ -526 smoother.template apply(v,d); │ │ │ │ -527 │ │ │ │ -528 } │ │ │ │ -529 }; │ │ │ │ -530 │ │ │ │ -531 // template │ │ │ │ -532 // class SeqOverlappingSchwarz; │ │ │ │ -533 │ │ │ │ -534 template │ │ │ │ -_5_3_5 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -536 : public _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -537 { │ │ │ │ -_5_3_8 enum _O_v_e_r_l_a_p {_v_e_r_t_e_x, _a_g_g_r_e_g_a_t_e, _p_a_i_r_w_i_s_e, _n_o_n_e}; │ │ │ │ -539 │ │ │ │ -_5_4_0 _O_v_e_r_l_a_p _o_v_e_r_l_a_p; │ │ │ │ -_5_4_1 bool _o_n_t_h_e_f_l_y; │ │ │ │ -542 │ │ │ │ -_5_4_3 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s(_O_v_e_r_l_a_p overlap_=_v_e_r_t_e_x, │ │ │ │ -544 bool onthefly_=false) │ │ │ │ -545 : _o_v_e_r_l_a_p(overlap_), _o_n_t_h_e_f_l_y(onthefly_) │ │ │ │ -546 {} │ │ │ │ -547 }; │ │ │ │ -548 │ │ │ │ -549 template │ │ │ │ -_5_5_0 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z > │ │ │ │ -551 { │ │ │ │ -_5_5_2 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _M_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ -_A_r_g_u_m_e_n_t_s; │ │ │ │ -553 }; │ │ │ │ -554 │ │ │ │ -555 template │ │ │ │ -_5_5_6 class _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z > │ │ │ │ -557 : public _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s > │ │ │ │ -558 { │ │ │ │ -559 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_T_M_,_T_S_,_T_A_> > │ │ │ │ -_F_a_t_h_e_r; │ │ │ │ -560 │ │ │ │ -561 public: │ │ │ │ -_5_6_2 typedef typename _M_a_t_r_i_x_G_r_a_p_h_<_M_>_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -_5_6_3 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_> _A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ -_5_6_4 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -_5_6_5 typedef typename _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_T_M_,_T_S_,_T_A_>_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ -_V_e_c_t_o_r; │ │ │ │ -_5_6_6 typedef typename Vector::value_type _S_u_b_d_o_m_a_i_n; │ │ │ │ -567 │ │ │ │ -_5_6_8 virtual void _s_e_t_M_a_t_r_i_x(const M& matrix, const _A_g_g_r_e_g_a_t_e_s_M_a_p& amap) │ │ │ │ -569 { │ │ │ │ -570 Father::setMatrix(matrix); │ │ │ │ -571 │ │ │ │ -572 std::vector visited(amap._n_o_V_e_r_t_i_c_e_s(), false); │ │ │ │ -573 typedef IteratorPropertyMap::iterator,IdentityMap> │ │ │ │ -VisitedMapType; │ │ │ │ -574 VisitedMapType visitedMap(visited.begin()); │ │ │ │ -575 │ │ │ │ -576 _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_> graph(matrix); │ │ │ │ -577 │ │ │ │ -578 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _M_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ -_S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ -579 │ │ │ │ -580 switch(Father::getArgs().overlap) { │ │ │ │ -581 case SmootherArgs::vertex : │ │ │ │ -582 { │ │ │ │ -583 VertexAdder visitor(subdomains, amap); │ │ │ │ -584 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ -585 } │ │ │ │ -586 break; │ │ │ │ -587 case SmootherArgs::pairwise : │ │ │ │ -588 { │ │ │ │ -589 createPairDomains(graph); │ │ │ │ -590 } │ │ │ │ -591 break; │ │ │ │ -592 case SmootherArgs::aggregate : │ │ │ │ -593 { │ │ │ │ -594 AggregateAdder visitor(subdomains, amap, graph, │ │ │ │ -visitedMap); │ │ │ │ -595 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ -596 } │ │ │ │ -597 break; │ │ │ │ -598 case SmootherArgs::none : │ │ │ │ -599 NoneAdder visitor; │ │ │ │ -600 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ -601 break; │ │ │ │ -602 default : │ │ │ │ -603 DUNE_THROW(NotImplemented, "This overlapping scheme is not supported!"); │ │ │ │ -604 } │ │ │ │ -605 } │ │ │ │ -_6_0_6 void _s_e_t_M_a_t_r_i_x(const M& matrix) │ │ │ │ -607 { │ │ │ │ -608 Father::setMatrix(matrix); │ │ │ │ -609 │ │ │ │ -610 /* Create aggregates map where each aggregate is just one vertex. */ │ │ │ │ -611 _A_g_g_r_e_g_a_t_e_s_M_a_p amap(matrix.N()); │ │ │ │ -612 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r v=0; │ │ │ │ -613 for(typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_i_t_e_r_a_t_o_r iter=amap._b_e_g_i_n(); │ │ │ │ -614 iter!=amap._e_n_d(); ++iter) │ │ │ │ -615 *iter=v++; │ │ │ │ -616 │ │ │ │ -617 std::vector visited(amap._n_o_V_e_r_t_i_c_e_s(), false); │ │ │ │ -618 typedef IteratorPropertyMap::iterator,IdentityMap> │ │ │ │ -VisitedMapType; │ │ │ │ -619 VisitedMapType visitedMap(visited.begin()); │ │ │ │ -620 │ │ │ │ -621 _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_> graph(matrix); │ │ │ │ -622 │ │ │ │ -623 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _M_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ -_S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ -624 │ │ │ │ -625 switch(Father::getArgs().overlap) { │ │ │ │ -626 case SmootherArgs::vertex : │ │ │ │ -627 { │ │ │ │ -628 VertexAdder visitor(subdomains, amap); │ │ │ │ -629 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ -630 } │ │ │ │ -631 break; │ │ │ │ -632 case SmootherArgs::aggregate : │ │ │ │ -633 { │ │ │ │ -634 DUNE_THROW(NotImplemented, "Aggregate overlap is not supported yet"); │ │ │ │ -635 /* │ │ │ │ -636 AggregateAdder visitor(subdomains, amap, graph, │ │ │ │ -visitedMap); │ │ │ │ -637 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ -638 */ │ │ │ │ -639 } │ │ │ │ -640 break; │ │ │ │ -641 case SmootherArgs::pairwise : │ │ │ │ -642 { │ │ │ │ -643 createPairDomains(graph); │ │ │ │ -644 } │ │ │ │ -645 break; │ │ │ │ -646 case SmootherArgs::none : │ │ │ │ -647 NoneAdder visitor; │ │ │ │ -648 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ -649 │ │ │ │ -650 } │ │ │ │ -651 } │ │ │ │ -652 │ │ │ │ -_6_5_3 const _V_e_c_t_o_r& _g_e_t_S_u_b_D_o_m_a_i_n_s() │ │ │ │ -654 { │ │ │ │ -655 return subdomains; │ │ │ │ -656 } │ │ │ │ -657 │ │ │ │ -658 private: │ │ │ │ -659 struct VertexAdder │ │ │ │ -660 { │ │ │ │ -_6_6_1 _V_e_r_t_e_x_A_d_d_e_r(_V_e_c_t_o_r& subdomains_, const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates_) │ │ │ │ -662 : subdomains(subdomains_), max(-1), subdomain(-1), aggregates(aggregates_) │ │ │ │ -663 {} │ │ │ │ -664 template │ │ │ │ -_6_6_5 void _o_p_e_r_a_t_o_r_(_)(const T& edge) │ │ │ │ -666 { │ │ │ │ -667 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) │ │ │ │ -668 subdomains[subdomain].insert(edge.target()); │ │ │ │ -669 } │ │ │ │ -_6_7_0 int _s_e_t_A_g_g_r_e_g_a_t_e(const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate_) │ │ │ │ -671 { │ │ │ │ -672 subdomain=aggregate_; │ │ │ │ -673 max = std::max(subdomain, aggregate_); │ │ │ │ -674 return subdomain; │ │ │ │ -675 } │ │ │ │ -_6_7_6 int _n_o_S_u_b_d_o_m_a_i_n_s() const │ │ │ │ -677 { │ │ │ │ -678 return max+1; │ │ │ │ -679 } │ │ │ │ -680 private: │ │ │ │ -681 _V_e_c_t_o_r& subdomains; │ │ │ │ -682 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r max; │ │ │ │ -683 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r subdomain; │ │ │ │ -684 const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates; │ │ │ │ -685 }; │ │ │ │ -686 struct NoneAdder │ │ │ │ -687 { │ │ │ │ -688 template │ │ │ │ -_6_8_9 void _o_p_e_r_a_t_o_r_(_)(const T& edge) │ │ │ │ -690 {} │ │ │ │ -_6_9_1 int _s_e_t_A_g_g_r_e_g_a_t_e(const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate_) │ │ │ │ -692 { │ │ │ │ -693 return -1; │ │ │ │ -694 } │ │ │ │ -_6_9_5 int _n_o_S_u_b_d_o_m_a_i_n_s() const │ │ │ │ -696 { │ │ │ │ -697 return -1; │ │ │ │ -698 } │ │ │ │ -699 }; │ │ │ │ -700 │ │ │ │ -701 template │ │ │ │ -702 struct AggregateAdder │ │ │ │ -703 { │ │ │ │ -_7_0_4 _A_g_g_r_e_g_a_t_e_A_d_d_e_r(_V_e_c_t_o_r& subdomains_, const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates_, │ │ │ │ -705 const _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>& graph_, VM& visitedMap_) │ │ │ │ -706 : subdomains(subdomains_), subdomain(-1), aggregates(aggregates_), │ │ │ │ -707 adder(subdomains_, aggregates_), graph(graph_), visitedMap(visitedMap_) │ │ │ │ -708 {} │ │ │ │ -709 template │ │ │ │ -_7_1_0 void _o_p_e_r_a_t_o_r_(_)(const T& edge) │ │ │ │ -711 { │ │ │ │ -712 subdomains[subdomain].insert(edge.target()); │ │ │ │ -713 // If we (the neighbouring vertex of the aggregate) │ │ │ │ -714 // are not isolated, add the aggregate we belong to │ │ │ │ -715 // to the same subdomain using the OneOverlapAdder │ │ │ │ -716 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) { │ │ │ │ -717 assert(aggregates[edge.target()]!=aggregate); │ │ │ │ -718 typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_L_i_s_t vlist; │ │ │ │ -719 aggregates.template breadthFirstSearch(edge.target(), │ │ │ │ -aggregate, │ │ │ │ -720 graph, vlist, adder, adder, │ │ │ │ -721 visitedMap); │ │ │ │ -722 } │ │ │ │ -723 } │ │ │ │ -724 │ │ │ │ -_7_2_5 int _s_e_t_A_g_g_r_e_g_a_t_e(const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate_) │ │ │ │ -726 { │ │ │ │ -727 adder.setAggregate(aggregate_); │ │ │ │ -728 aggregate=aggregate_; │ │ │ │ -729 return ++subdomain; │ │ │ │ -730 } │ │ │ │ -_7_3_1 int _n_o_S_u_b_d_o_m_a_i_n_s() const │ │ │ │ -732 { │ │ │ │ -733 return subdomain+1; │ │ │ │ -734 } │ │ │ │ -735 │ │ │ │ -736 private: │ │ │ │ -737 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r aggregate; │ │ │ │ -738 _V_e_c_t_o_r& subdomains; │ │ │ │ -739 int subdomain; │ │ │ │ -740 const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates; │ │ │ │ -741 VertexAdder adder; │ │ │ │ -742 const _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>& graph; │ │ │ │ -743 VM& visitedMap; │ │ │ │ -744 }; │ │ │ │ -745 │ │ │ │ -746 void createPairDomains(const _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>& graph) │ │ │ │ -747 { │ │ │ │ -748 typedef typename _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r VIter; │ │ │ │ -749 typedef typename _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r EIter; │ │ │ │ -750 typedef typename M::size_type size_type; │ │ │ │ -751 │ │ │ │ -752 std::set > pairs; │ │ │ │ -753 int total=0; │ │ │ │ -754 for(VIter v=graph._b_e_g_i_n(), ve=graph._e_n_d(); ve != v; ++v) │ │ │ │ -755 for(EIter e = v.begin(), ee=v.end(); ee!=e; ++e) │ │ │ │ -756 { │ │ │ │ -757 ++total; │ │ │ │ -758 if(e.source() >::const_iterator │ │ │ │ -SIter; │ │ │ │ -768 typename Vector::iterator subdomain=subdomains.begin(); │ │ │ │ -769 │ │ │ │ -770 for(SIter s=pairs.begin(), se =pairs.end(); se!=s; ++s) │ │ │ │ -771 { │ │ │ │ -772 subdomain->insert(s->first); │ │ │ │ -773 subdomain->insert(s->second); │ │ │ │ -774 ++subdomain; │ │ │ │ -775 } │ │ │ │ -776 std::size_t minsize=10000; │ │ │ │ -777 std::size_t maxsize=0; │ │ │ │ -778 int sum=0; │ │ │ │ -779 for(typename Vector::size_type i=0; i < subdomains.size(); ++i) { │ │ │ │ -780 sum+=subdomains[i].size(); │ │ │ │ -781 minsize=std::min(minsize, subdomains[i].size()); │ │ │ │ -782 maxsize=std::max(maxsize, subdomains[i].size()); │ │ │ │ -783 } │ │ │ │ -784 Dune::dinfo<<"Subdomain size: min="< │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: renumberer.hh File Reference │ │ │ +dune-istl: combinedfunctor.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,40 +71,37 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Functions
│ │ │ -
renumberer.hh File Reference
│ │ │ +Namespaces
│ │ │ +
combinedfunctor.hh File Reference
│ │ │ │ │ │
│ │ │ -
#include "aggregates.hh"
│ │ │ +
#include <tuple>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::AggregateRenumberer< G >
struct  Dune::Amg::ApplyHelper< i >
 
struct  Dune::Amg::ApplyHelper< 0 >
 
class  Dune::Amg::CombinedFunctor< T >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │

│ │ │ -Functions

template<class G , class I , class V >
void Dune::Amg::renumberAggregates (const G &graph, I index, I endIndex, V &visitedMap, AggregatesMap< typename G::VertexDescriptor > &aggregates)
 
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,26 +1,25 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -renumberer.hh File Reference │ │ │ │ -#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +combinedfunctor.hh File Reference │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_ _G_ _> │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _i_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _0_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_<_ _T_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -void  _D_u_n_e_:_:_A_m_g_:_:_r_e_n_u_m_b_e_r_A_g_g_r_e_g_a_t_e_s (const G &graph, I index, I endIndex, V │ │ │ │ - &visitedMap, _A_g_g_r_e_g_a_t_e_s_M_a_p< typename G::VertexDescriptor > &aggregates) │ │ │ │ -  │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: renumberer.hh Source File │ │ │ +dune-istl: combinedfunctor.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,118 +74,90 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
renumberer.hh
│ │ │ +
combinedfunctor.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_RENUMBERER_HH
│ │ │ -
6#define DUNE_AMG_RENUMBERER_HH
│ │ │ +
5#ifndef DUNE_AMG_COMBINEDFUNCTOR_HH
│ │ │ +
6#define DUNE_AMG_COMBINEDFUNCTOR_HH
│ │ │
7
│ │ │ -
8#include "aggregates.hh"
│ │ │ +
8#include <tuple>
│ │ │
9
│ │ │
10namespace Dune
│ │ │
11{
│ │ │
12 namespace Amg
│ │ │
13 {
│ │ │ -
14 template<class G>
│ │ │ -
│ │ │ - │ │ │ -
16 {
│ │ │ -
17 public:
│ │ │ -
19 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
20
│ │ │ - │ │ │ -
26
│ │ │ -
28 operator Vertex() const;
│ │ │ -
29
│ │ │ -
30 void operator()(const typename G::ConstEdgeIterator& edge);
│ │ │ -
31
│ │ │ -
32 void operator++();
│ │ │ -
33
│ │ │ -
34 protected:
│ │ │ - │ │ │ - │ │ │ -
37 };
│ │ │ -
│ │ │ -
38
│ │ │ -
39 template<class G>
│ │ │ -
│ │ │ - │ │ │ -
41 : number_(0), aggregates_(aggregates)
│ │ │ -
42 {}
│ │ │ -
│ │ │ -
43
│ │ │ -
44 template<class G>
│ │ │ -
│ │ │ - │ │ │ -
46 {
│ │ │ -
47 return number_;
│ │ │ -
48 }
│ │ │ +
14
│ │ │ +
15 template<std::size_t i>
│ │ │ +
│ │ │ + │ │ │ +
17 {
│ │ │ +
18 template<class TT, class T>
│ │ │ +
│ │ │ +
19 static void apply(TT tuple, const T& t)
│ │ │ +
20 {
│ │ │ +
21 std::get<i-1>(tuple) (t);
│ │ │ + │ │ │ +
23 }
│ │ │ +
│ │ │ +
24 };
│ │ │ +
│ │ │ +
25 template<>
│ │ │ +
│ │ │ +
26 struct ApplyHelper<0>
│ │ │ +
27 {
│ │ │ +
28 template<class TT, class T>
│ │ │ +
│ │ │ +
29 static void apply([[maybe_unused]] TT tuple, [[maybe_unused]] const T& t)
│ │ │ +
30 {}
│ │ │ +
│ │ │ +
31 };
│ │ │ +
│ │ │ +
32
│ │ │ +
33 template<typename T>
│ │ │ +
│ │ │ + │ │ │ +
35 public T
│ │ │ +
36 {
│ │ │ +
37 public:
│ │ │ +
│ │ │ +
38 CombinedFunctor(const T& tuple_)
│ │ │ +
39 : T(tuple_)
│ │ │ +
40 {}
│ │ │ +
│ │ │ +
41
│ │ │ +
42 template<class T1>
│ │ │ +
│ │ │ +
43 void operator()(const T1& t)
│ │ │ +
44 {
│ │ │ + │ │ │ +
46 }
│ │ │
│ │ │ +
47 };
│ │ │ +
│ │ │ +
48
│ │ │
49
│ │ │ -
50 template<class G>
│ │ │ -
│ │ │ -
51 void AggregateRenumberer<G>::operator()(const typename G::ConstEdgeIterator& edge)
│ │ │ -
52 {
│ │ │ -
53 aggregates_[edge.target()]=number_;
│ │ │ -
54 }
│ │ │ -
│ │ │ -
55
│ │ │ -
56 template<class G>
│ │ │ -
│ │ │ - │ │ │ -
58 {
│ │ │ -
59 ++number_;
│ │ │ -
60 }
│ │ │ -
│ │ │ -
61
│ │ │ -
62 template<class G, class I, class V>
│ │ │ -
│ │ │ -
63 void renumberAggregates(const G& graph, I index, I endIndex, V& visitedMap,
│ │ │ - │ │ │ -
65 {
│ │ │ -
66 AggregateRenumberer<G> renumberer(aggregates);
│ │ │ -
67
│ │ │ -
68 for(I index1=index; index1 != endIndex; ++index1)
│ │ │ -
69 if(aggregates[index1.index()]!=AggregatesMap<typename G::VertexDescriptor>::ISOLATED &&
│ │ │ -
70 !get(visitedMap, index1.index())) {
│ │ │ -
71
│ │ │ -
72 aggregates.template breadthFirstSearch<false>(index1.index(), aggregates[index1.index()],
│ │ │ -
73 graph, renumberer, visitedMap);
│ │ │ -
74 aggregates[index1.index()] = renumberer;
│ │ │ -
75 ++renumberer;
│ │ │ -
76 }
│ │ │ -
77 for(; index != endIndex; ++index)
│ │ │ -
78 put(visitedMap, index.index(), false);
│ │ │ -
79 }
│ │ │ -
│ │ │ -
80
│ │ │ -
81 } // namespace AMG
│ │ │ -
82} // namespace Dune
│ │ │ -
83#endif
│ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ +
50 } //namespace Amg
│ │ │ +
51} // namespace Dune
│ │ │ +
52#endif
│ │ │
Definition allocator.hh:11
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
void renumberAggregates(const G &graph, I index, I endIndex, V &visitedMap, AggregatesMap< typename G::VertexDescriptor > &aggregates)
Definition renumberer.hh:63
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
Definition renumberer.hh:16
│ │ │ -
void operator++()
Definition renumberer.hh:57
│ │ │ -
G::VertexDescriptor Vertex
The vertex type.
Definition renumberer.hh:19
│ │ │ -
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
│ │ │ -
AggregatesMap< Vertex > & aggregates_
Definition renumberer.hh:36
│ │ │ -
AggregateRenumberer(AggregatesMap< Vertex > &aggregates)
Constructor.
Definition renumberer.hh:40
│ │ │ -
Vertex number_
Definition renumberer.hh:35
│ │ │ +
Definition combinedfunctor.hh:17
│ │ │ +
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:19
│ │ │ +
static void apply(TT tuple, const T &t)
Definition combinedfunctor.hh:29
│ │ │ +
Definition combinedfunctor.hh:36
│ │ │ +
CombinedFunctor(const T &tuple_)
Definition combinedfunctor.hh:38
│ │ │ +
void operator()(const T1 &t)
Definition combinedfunctor.hh:43
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,131 +1,82 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -renumberer.hh │ │ │ │ +combinedfunctor.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_RENUMBERER_HH │ │ │ │ -6#define DUNE_AMG_RENUMBERER_HH │ │ │ │ +5#ifndef DUNE_AMG_COMBINEDFUNCTOR_HH │ │ │ │ +6#define DUNE_AMG_COMBINEDFUNCTOR_HH │ │ │ │ 7 │ │ │ │ -8#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +8#include │ │ │ │ 9 │ │ │ │ 10namespace _D_u_n_e │ │ │ │ 11{ │ │ │ │ 12 namespace Amg │ │ │ │ 13 { │ │ │ │ -14 template │ │ │ │ -_1_5 class _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ -16 { │ │ │ │ -17 public: │ │ │ │ -_1_9 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ -20 │ │ │ │ -25 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates); │ │ │ │ -26 │ │ │ │ -28 operator _V_e_r_t_e_x() const; │ │ │ │ -29 │ │ │ │ -30 void _o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& edge); │ │ │ │ -31 │ │ │ │ -32 void _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ -33 │ │ │ │ -34 protected: │ │ │ │ -_3_5 _V_e_r_t_e_x _n_u_m_b_e_r__; │ │ │ │ -_3_6 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& _a_g_g_r_e_g_a_t_e_s__; │ │ │ │ -37 }; │ │ │ │ -38 │ │ │ │ -39 template │ │ │ │ -_4_0 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& │ │ │ │ -aggregates) │ │ │ │ -41 : number_(0), aggregates_(aggregates) │ │ │ │ -42 {} │ │ │ │ -43 │ │ │ │ -44 template │ │ │ │ -_4_5 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r _V_e_r_t_e_x() const │ │ │ │ -46 { │ │ │ │ -47 return number_; │ │ │ │ -48 } │ │ │ │ +14 │ │ │ │ +15 template │ │ │ │ +_1_6 struct _A_p_p_l_y_H_e_l_p_e_r │ │ │ │ +17 { │ │ │ │ +18 template │ │ │ │ +_1_9 static void _a_p_p_l_y(TT tuple, const T& t) │ │ │ │ +20 { │ │ │ │ +21 std::get(tuple) (t); │ │ │ │ +22 _A_p_p_l_y_H_e_l_p_e_r_<_i_-_1_>_:_:_a_p_p_l_y(tuple, t); │ │ │ │ +23 } │ │ │ │ +24 }; │ │ │ │ +25 template<> │ │ │ │ +_2_6 struct _A_p_p_l_y_H_e_l_p_e_r<0> │ │ │ │ +27 { │ │ │ │ +28 template │ │ │ │ +_2_9 static void _a_p_p_l_y([[maybe_unused]] TT tuple, [[maybe_unused]] const T& t) │ │ │ │ +30 {} │ │ │ │ +31 }; │ │ │ │ +32 │ │ │ │ +33 template │ │ │ │ +_3_4 class _C_o_m_b_i_n_e_d_F_u_n_c_t_o_r : │ │ │ │ +35 public T │ │ │ │ +36 { │ │ │ │ +37 public: │ │ │ │ +_3_8 _C_o_m_b_i_n_e_d_F_u_n_c_t_o_r(const T& tuple_) │ │ │ │ +39 : T(tuple_) │ │ │ │ +40 {} │ │ │ │ +41 │ │ │ │ +42 template │ │ │ │ +_4_3 void _o_p_e_r_a_t_o_r_(_)(const T1& t) │ │ │ │ +44 { │ │ │ │ +45 _A_p_p_l_y_H_e_l_p_e_r_<_s_t_d_:_:_t_u_p_l_e___s_i_z_e_<_T_>_:_:_v_a_l_u_e>::apply(*this, t); │ │ │ │ +46 } │ │ │ │ +47 }; │ │ │ │ +48 │ │ │ │ 49 │ │ │ │ -50 template │ │ │ │ -_5_1 void _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& │ │ │ │ -edge) │ │ │ │ -52 { │ │ │ │ -53 aggregates_[edge.target()]=number_; │ │ │ │ -54 } │ │ │ │ -55 │ │ │ │ -56 template │ │ │ │ -_5_7 void _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r_+_+() │ │ │ │ -58 { │ │ │ │ -59 ++number_; │ │ │ │ -60 } │ │ │ │ -61 │ │ │ │ -62 template │ │ │ │ -_6_3 void _r_e_n_u_m_b_e_r_A_g_g_r_e_g_a_t_e_s(const G& graph, I index, I endIndex, V& visitedMap, │ │ │ │ -64 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates) │ │ │ │ -65 { │ │ │ │ -66 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_> renumberer(aggregates); │ │ │ │ -67 │ │ │ │ -68 for(I index1=index; index1 != endIndex; ++index1) │ │ │ │ -69 if(aggregates[index1.index()]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ -_I_S_O_L_A_T_E_D && │ │ │ │ -70 !_g_e_t(visitedMap, index1.index())) { │ │ │ │ -71 │ │ │ │ -72 aggregates.template breadthFirstSearch(index1.index(), aggregates │ │ │ │ -[index1.index()], │ │ │ │ -73 graph, renumberer, visitedMap); │ │ │ │ -74 aggregates[index1.index()] = renumberer; │ │ │ │ -75 ++renumberer; │ │ │ │ -76 } │ │ │ │ -77 for(; index != endIndex; ++index) │ │ │ │ -78 put(visitedMap, index.index(), false); │ │ │ │ -79 } │ │ │ │ -80 │ │ │ │ -81 } // namespace AMG │ │ │ │ -82} // namespace Dune │ │ │ │ -83#endif │ │ │ │ -_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ -Provides classes for the Coloring process of AMG. │ │ │ │ +50 } //namespace Amg │ │ │ │ +51} // namespace Dune │ │ │ │ +52#endif │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_r_e_n_u_m_b_e_r_A_g_g_r_e_g_a_t_e_s │ │ │ │ -void renumberAggregates(const G &graph, I index, I endIndex, V &visitedMap, │ │ │ │ -AggregatesMap< typename G::VertexDescriptor > &aggregates) │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:63 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:16 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ -void operator++() │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:57 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_V_e_r_t_e_x │ │ │ │ -G::VertexDescriptor Vertex │ │ │ │ -The vertex type. │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:19 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -void operator()(const typename G::ConstEdgeIterator &edge) │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:51 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_a_g_g_r_e_g_a_t_e_s__ │ │ │ │ -AggregatesMap< Vertex > & aggregates_ │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:36 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ -AggregateRenumberer(AggregatesMap< Vertex > &aggregates) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:40 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_n_u_m_b_e_r__ │ │ │ │ -Vertex number_ │ │ │ │ -DDeeffiinniittiioonn renumberer.hh:35 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:17 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_:_:_a_p_p_l_y │ │ │ │ +static void apply(TT tuple, const T &t) │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:19 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_p_p_l_y_H_e_l_p_e_r_<_ _0_ _>_:_:_a_p_p_l_y │ │ │ │ +static void apply(TT tuple, const T &t) │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:29 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:36 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r │ │ │ │ +CombinedFunctor(const T &tuple_) │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:38 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_m_b_i_n_e_d_F_u_n_c_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const T1 &t) │ │ │ │ +DDeeffiinniittiioonn combinedfunctor.hh:43 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: properties.hh File Reference │ │ │ +dune-istl: twolevelmethod.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,42 +72,51 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ - │ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

Provides classes for handling internal properties in a graph. │ │ │ +

Algebraic twolevel methods. │ │ │ More...

│ │ │ -
#include <dune/common/propertymap.hh>
│ │ │ +
#include <tuple>
│ │ │ +#include <dune/istl/operators.hh>
│ │ │ +#include "amg.hh"
│ │ │ +#include "galerkin.hh"
│ │ │ +#include <dune/istl/solver.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::Amg::VertexVisitedTag
 Tag idnetifying the visited property of a vertex. More...
class  Dune::Amg::LevelTransferPolicy< FO, CO >
 Abstract base class for transfer between levels and creation of the coarse level system. More...
 
class  Dune::Amg::RandomAccessBundledPropertyMap< C, K, i, T, R >
 A property map that extracts one property out of a bundle using operator[]() More...
class  Dune::Amg::AggregationLevelTransferPolicy< O, C >
 A LeveTransferPolicy that used aggregation to construct the coarse level system. More...
 
class  Dune::Amg::OneStepAMGCoarseSolverPolicy< O, S, C >
 A policy class for solving the coarse level system using one step of AMG. More...
 
class  Dune::Amg::TwoLevelMethod< FO, CSP, S >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │

Detailed Description

│ │ │ -

Provides classes for handling internal properties in a graph.

│ │ │ +

Algebraic twolevel methods.

│ │ │
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -2,32 +2,43 @@ │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -properties.hh File Reference │ │ │ │ +twolevelmethod.hh File Reference │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides classes for handling internal properties in a graph. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ +Algebraic twolevel methods. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +#include "_a_m_g_._h_h" │ │ │ │ +#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ -  Tag idnetifying the visited property of a vertex. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_ _F_O_,_ _C_O_ _> │ │ │ │ +  Abstract base class for transfer between levels and creation of the │ │ │ │ + coarse level system. _M_o_r_e_._._. │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_<_ _C_,_ _K_,_ _i_,_ _T_,_ _R_ _> │ │ │ │ -  A property map that extracts one property out of a bundle using │ │ │ │ - _o_p_e_r_a_t_o_r_[_]_(_) _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_ _O_,_ _C_ _> │ │ │ │ +  A LeveTransferPolicy that used aggregation to construct the coarse │ │ │ │ + level system. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_O_n_e_S_t_e_p_A_M_G_C_o_a_r_s_e_S_o_l_v_e_r_P_o_l_i_c_y_<_ _O_,_ _S_,_ _C_ _> │ │ │ │ +  A policy class for solving the coarse level system using one step of │ │ │ │ + _A_M_G. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_T_w_o_L_e_v_e_l_M_e_t_h_o_d_<_ _F_O_,_ _C_S_P_,_ _S_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides classes for handling internal properties in a graph. │ │ │ │ +Algebraic twolevel methods. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: properties.hh Source File │ │ │ +dune-istl: twolevelmethod.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,95 +74,478 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
properties.hh
│ │ │ +
twolevelmethod.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_AMG_PROPERTIES_HH
│ │ │ -
6#define DUNE_ISTL_AMG_PROPERTIES_HH
│ │ │ +
5#ifndef DUNE_ISTL_TWOLEVELMETHOD_HH
│ │ │ +
6#define DUNE_ISTL_TWOLEVELMETHOD_HH
│ │ │
7
│ │ │ -
8#include <dune/common/propertymap.hh>
│ │ │ +
8#include <tuple>
│ │ │
9
│ │ │ -
10namespace Dune
│ │ │ -
11{
│ │ │ -
12
│ │ │ -
13 namespace Amg
│ │ │ -
14 {
│ │ │ -
│ │ │ - │ │ │ -
29 {};
│ │ │ -
│ │ │ -
30
│ │ │ -
31
│ │ │ -
38 template<typename C, typename K, std::size_t i,typename T=typename C::ValueType,
│ │ │ -
39 typename R = typename C::Reference>
│ │ │ -
│ │ │ - │ │ │ -
41 : public RAPropertyMapHelper<R,
│ │ │ -
42 RandomAccessBundledPropertyMap<C,K,i,T,R> >
│ │ │ -
43 {
│ │ │ -
44 public:
│ │ │ -
46 typedef C Container;
│ │ │ -
47
│ │ │ -
49 typedef R Reference;
│ │ │ -
50
│ │ │ -
52 typedef K Key;
│ │ │ -
53
│ │ │ -
57 typedef LvaluePropertyMapTag Category;
│ │ │ -
58
│ │ │ -
59 enum {
│ │ │ -
61 index = i
│ │ │ -
62 };
│ │ │ -
63
│ │ │ -
│ │ │ -
69 Reference operator[](const Key& key) const
│ │ │ -
70 {
│ │ │ -
71 return container_[key][index];
│ │ │ -
72 }
│ │ │ + │ │ │ +
11#include"amg.hh"
│ │ │ +
12#include"galerkin.hh"
│ │ │ +
13#include<dune/istl/solver.hh>
│ │ │ +
14
│ │ │ +
22namespace Dune
│ │ │ +
23{
│ │ │ +
24namespace Amg
│ │ │ +
25{
│ │ │ +
26
│ │ │ +
36template<class FO, class CO>
│ │ │ +
│ │ │ + │ │ │ +
38{
│ │ │ +
39public:
│ │ │ +
44 typedef FO FineOperatorType;
│ │ │ +
48 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ +
52 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ + │ │ │ +
61 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ +
65 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ +
│ │ │ +
70 std::shared_ptr<CoarseOperatorType>& getCoarseLevelOperator()
│ │ │ +
71 {
│ │ │ +
72 return operator_;
│ │ │ +
73 }
│ │ │
│ │ │ -
73
│ │ │
│ │ │ - │ │ │ -
79 : container_(&container)
│ │ │ -
80 {}
│ │ │ -
│ │ │ -
81
│ │ │ -
│ │ │ - │ │ │ -
84 : container_(0)
│ │ │ -
85 {}
│ │ │ -
│ │ │ -
86
│ │ │ -
87 private:
│ │ │ -
89 Container* container_;
│ │ │ -
90 };
│ │ │ -
│ │ │ -
91 }
│ │ │ -
92}
│ │ │ -
93
│ │ │ -
94#endif
│ │ │ -
Reference operator[](const Key &key) const
Get the property for a key.
Definition properties.hh:69
│ │ │ -
RandomAccessBundledPropertyMap()
The default constructor.
Definition properties.hh:83
│ │ │ -
R Reference
The reference type of the container.
Definition properties.hh:49
│ │ │ -
RandomAccessBundledPropertyMap(Container &container)
Constructor.
Definition properties.hh:78
│ │ │ -
K Key
The key of the property map.
Definition properties.hh:52
│ │ │ -
LvaluePropertyMapTag Category
The category of the property map.
Definition properties.hh:57
│ │ │ -
C Container
The container that holds the properties.
Definition properties.hh:46
│ │ │ -
@ index
The index of the property in the bundle.
Definition properties.hh:61
│ │ │ + │ │ │ +
79 {
│ │ │ +
80 return rhs_;
│ │ │ +
81 }
│ │ │ +
│ │ │ +
82
│ │ │ +
│ │ │ + │ │ │ +
88 {
│ │ │ +
89 return lhs_;
│ │ │ +
90 }
│ │ │ +
│ │ │ +
100 virtual void moveToCoarseLevel(const FineRangeType& fineRhs)=0;
│ │ │ +
110 virtual void moveToFineLevel(FineDomainType& fineLhs)=0;
│ │ │ +
118 virtual void createCoarseLevelSystem(const FineOperatorType& fineOperator)=0;
│ │ │ +
119
│ │ │ +
121 virtual LevelTransferPolicy* clone() const =0;
│ │ │ +
122
│ │ │ + │ │ │ +
125
│ │ │ +
126 protected:
│ │ │ + │ │ │ + │ │ │ +
132 std::shared_ptr<CoarseOperatorType> operator_;
│ │ │ +
133};
│ │ │ +
│ │ │ +
134
│ │ │ +
140template<class O, class C>
│ │ │ +
│ │ │ + │ │ │ +
142 : public LevelTransferPolicy<O,O>
│ │ │ +
143{
│ │ │ + │ │ │ +
145public:
│ │ │ + │ │ │ +
147 typedef C Criterion;
│ │ │ + │ │ │ +
149
│ │ │ +
│ │ │ + │ │ │ +
151 : criterion_(crit)
│ │ │ +
152 {}
│ │ │ +
│ │ │ +
153
│ │ │ +
│ │ │ +
154 void createCoarseLevelSystem(const O& fineOperator)
│ │ │ +
155 {
│ │ │ +
156 prolongDamp_ = criterion_.getProlongationDampingFactor();
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
160 Dune::Amg::EdgeProperties,Dune::IdentityMap,Dune::IdentityMap> PropertiesGraph;
│ │ │ +
161 MatrixGraph mg(fineOperator.getmat());
│ │ │ +
162 PropertiesGraph pg(mg,Dune::IdentityMap(),Dune::IdentityMap());
│ │ │ +
163 typedef NegateSet<typename ParallelInformation::OwnerSet> OverlapFlags;
│ │ │ +
164
│ │ │ +
165 aggregatesMap_ = std::make_shared<AggregatesMap>(pg.maxVertex()+1);
│ │ │ +
166
│ │ │ +
167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates;
│ │ │ +
168
│ │ │ +
169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) =
│ │ │ +
170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, true);
│ │ │ +
171 std::cout<<"no aggregates="<<noAggregates<<" iso="<<isoAggregates<<" one="<<oneAggregates<<" skipped="<<skippedAggregates<<std::endl;
│ │ │ +
172 // misuse coarsener to renumber aggregates
│ │ │ + │ │ │ +
174 typedef std::vector<bool>::iterator Iterator;
│ │ │ +
175 typedef Dune::IteratorPropertyMap<Iterator, Dune::IdentityMap> VisitedMap;
│ │ │ +
176 std::vector<bool> excluded(fineOperator.getmat().N(), false);
│ │ │ +
177 VisitedMap vm(excluded.begin(), Dune::IdentityMap());
│ │ │ + │ │ │ +
179 std::size_t aggregates = renumberer.coarsen(pinfo, pg, vm,
│ │ │ +
180 *aggregatesMap_, pinfo,
│ │ │ +
181 noAggregates);
│ │ │ +
182 std::vector<bool>& visited=excluded;
│ │ │ +
183
│ │ │ +
184 typedef std::vector<bool>::iterator Iterator;
│ │ │ +
185
│ │ │ +
186 for(Iterator iter= visited.begin(), end=visited.end();
│ │ │ +
187 iter != end; ++iter)
│ │ │ +
188 *iter=false;
│ │ │ +
189 matrix_.reset(productBuilder.build(mg, vm,
│ │ │ + │ │ │ +
191 *aggregatesMap_,
│ │ │ +
192 aggregates,
│ │ │ +
193 OverlapFlags()));
│ │ │ +
194 productBuilder.calculate(fineOperator.getmat(), *aggregatesMap_, *matrix_, pinfo, OverlapFlags());
│ │ │ +
195 this->lhs_.resize(this->matrix_->M());
│ │ │ +
196 this->rhs_.resize(this->matrix_->N());
│ │ │ +
197 this->operator_ = std::make_shared<O>(*matrix_);
│ │ │ +
198 }
│ │ │ +
│ │ │ +
199
│ │ │ +
│ │ │ +
200 void moveToCoarseLevel(const typename FatherType::FineRangeType& fineRhs)
│ │ │ +
201 {
│ │ │ + │ │ │ +
203 ::restrictVector(*aggregatesMap_, this->rhs_, fineRhs, ParallelInformation());
│ │ │ +
204 this->lhs_=0;
│ │ │ +
205 }
│ │ │ +
│ │ │ +
206
│ │ │ +
│ │ │ + │ │ │ +
208 {
│ │ │ + │ │ │ +
210 ::prolongateVector(*aggregatesMap_, this->lhs_, fineLhs,
│ │ │ +
211 prolongDamp_, ParallelInformation());
│ │ │ +
212 }
│ │ │ +
│ │ │ +
213
│ │ │ +
│ │ │ + │ │ │ +
215 {
│ │ │ +
216 return new AggregationLevelTransferPolicy(*this);
│ │ │ +
217 }
│ │ │ +
│ │ │ +
218
│ │ │ +
219private:
│ │ │ +
220 typename O::matrix_type::field_type prolongDamp_;
│ │ │ +
221 std::shared_ptr<AggregatesMap> aggregatesMap_;
│ │ │ +
222 Criterion criterion_;
│ │ │ +
223 std::shared_ptr<typename O::matrix_type> matrix_;
│ │ │ +
224};
│ │ │ +
│ │ │ +
225
│ │ │ +
232template<class O, class S, class C>
│ │ │ +
│ │ │ + │ │ │ +
234{
│ │ │ +
235public:
│ │ │ +
237 typedef O Operator;
│ │ │ +
239 typedef typename O::range_type X;
│ │ │ +
241 typedef C Criterion;
│ │ │ +
243 typedef S Smoother;
│ │ │ + │ │ │ + │ │ │ +
│ │ │ + │ │ │ +
254 : smootherArgs_(args), criterion_(c)
│ │ │ +
255 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
258 : coarseOperator_(other.coarseOperator_), smootherArgs_(other.smootherArgs_),
│ │ │ +
259 criterion_(other.criterion_)
│ │ │ +
260 {}
│ │ │ +
│ │ │ +
261private:
│ │ │ +
268 struct AMGInverseOperator : public InverseOperator<X,X>
│ │ │ +
269 {
│ │ │ +
270 AMGInverseOperator(const typename AMGType::Operator& op,
│ │ │ +
271 const Criterion& crit,
│ │ │ +
272 const typename AMGType::SmootherArgs& args)
│ │ │ +
273 : amg_(op, crit,args), first_(true)
│ │ │ +
274 {}
│ │ │ +
275
│ │ │ +
276 void apply(X& x, X& b, [[maybe_unused]] double reduction, [[maybe_unused]] InverseOperatorResult& res)
│ │ │ +
277 {
│ │ │ +
278 if(first_)
│ │ │ +
279 {
│ │ │ +
280 amg_.pre(x,b);
│ │ │ +
281 first_=false;
│ │ │ +
282 x_=x;
│ │ │ +
283 }
│ │ │ +
284 amg_.apply(x,b);
│ │ │ +
285 }
│ │ │ +
286
│ │ │ +
287 void apply(X& x, X& b, InverseOperatorResult& res)
│ │ │ +
288 {
│ │ │ +
289 return apply(x,b,1e-8,res);
│ │ │ +
290 }
│ │ │ +
291
│ │ │ +
293 virtual SolverCategory::Category category() const
│ │ │ +
294 {
│ │ │ +
295 return amg_.category();
│ │ │ +
296 }
│ │ │ +
297
│ │ │ +
298 ~AMGInverseOperator()
│ │ │ +
299 {
│ │ │ +
300 if(!first_)
│ │ │ +
301 amg_.post(x_);
│ │ │ +
302 }
│ │ │ +
303 AMGInverseOperator(const AMGInverseOperator& other)
│ │ │ +
304 : x_(other.x_), amg_(other.amg_), first_(other.first_)
│ │ │ +
305 {
│ │ │ +
306 }
│ │ │ +
307 private:
│ │ │ +
308 X x_;
│ │ │ +
309 AMGType amg_;
│ │ │ +
310 bool first_;
│ │ │ +
311 };
│ │ │ +
312
│ │ │ +
313public:
│ │ │ +
315 typedef AMGInverseOperator CoarseLevelSolver;
│ │ │ +
316
│ │ │ +
324 template<class P>
│ │ │ +
│ │ │ + │ │ │ +
326 {
│ │ │ +
327 coarseOperator_=transferPolicy.getCoarseLevelOperator();
│ │ │ +
328 AMGInverseOperator* inv = new AMGInverseOperator(*coarseOperator_,
│ │ │ +
329 criterion_,
│ │ │ +
330 smootherArgs_);
│ │ │ +
331
│ │ │ +
332 return inv; //std::shared_ptr<InverseOperator<X,X> >(inv);
│ │ │ +
333
│ │ │ +
334 }
│ │ │ +
│ │ │ +
335
│ │ │ +
336private:
│ │ │ +
338 std::shared_ptr<Operator> coarseOperator_;
│ │ │ +
340 SmootherArgs smootherArgs_;
│ │ │ +
342 Criterion criterion_;
│ │ │ +
343};
│ │ │ +
│ │ │ +
344
│ │ │ +
350template<class FO, class CSP, class S>
│ │ │ +
│ │ │ + │ │ │ +
352 public Preconditioner<typename FO::domain_type, typename FO::range_type>
│ │ │ +
353{
│ │ │ +
354public:
│ │ │ + │ │ │ +
358 typedef typename CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver;
│ │ │ + │ │ │ +
367 typedef typename FineOperatorType::range_type FineRangeType;
│ │ │ +
371 typedef typename FineOperatorType::domain_type FineDomainType;
│ │ │ +
376 typedef typename CSP::Operator CoarseOperatorType;
│ │ │ +
380 typedef typename CoarseOperatorType::range_type CoarseRangeType;
│ │ │ +
384 typedef typename CoarseOperatorType::domain_type CoarseDomainType;
│ │ │ +
388 typedef S SmootherType;
│ │ │ +
389
│ │ │ +
│ │ │ + │ │ │ +
405 std::shared_ptr<SmootherType> smoother,
│ │ │ + │ │ │ +
407 CoarseOperatorType>& policy,
│ │ │ +
408 CoarseLevelSolverPolicy& coarsePolicy,
│ │ │ +
409 std::size_t preSteps=1, std::size_t postSteps=1)
│ │ │ +
410 : operator_(&op), smoother_(smoother),
│ │ │ +
411 preSteps_(preSteps), postSteps_(postSteps)
│ │ │ +
412 {
│ │ │ +
413 policy_ = policy.clone();
│ │ │ +
414 policy_->createCoarseLevelSystem(*operator_);
│ │ │ +
415 coarseSolver_=coarsePolicy.createCoarseLevelSolver(*policy_);
│ │ │ +
416 }
│ │ │ +
│ │ │ +
417
│ │ │ +
│ │ │ + │ │ │ +
419 : operator_(other.operator_), coarseSolver_(new CoarseLevelSolver(*other.coarseSolver_)),
│ │ │ +
420 smoother_(other.smoother_), policy_(other.policy_->clone()),
│ │ │ +
421 preSteps_(other.preSteps_), postSteps_(other.postSteps_)
│ │ │ +
422 {}
│ │ │ +
│ │ │ +
423
│ │ │ +
│ │ │ + │ │ │ +
425 {
│ │ │ +
426 // Each instance has its own policy.
│ │ │ +
427 delete policy_;
│ │ │ +
428 delete coarseSolver_;
│ │ │ +
429 }
│ │ │ +
│ │ │ +
430
│ │ │ +
│ │ │ + │ │ │ +
432 {
│ │ │ +
433 smoother_->pre(x,b);
│ │ │ +
434 }
│ │ │ +
│ │ │ +
435
│ │ │ +
│ │ │ +
436 void post([[maybe_unused]] FineDomainType& x)
│ │ │ +
437 {}
│ │ │ +
│ │ │ +
438
│ │ │ +
│ │ │ + │ │ │ +
440 {
│ │ │ +
441 FineDomainType u(v);
│ │ │ +
442 FineRangeType rhs(d);
│ │ │ +
443 LevelContext context;
│ │ │ + │ │ │ +
445 context.pinfo=&info;
│ │ │ +
446 context.lhs=&u;
│ │ │ +
447 context.update=&v;
│ │ │ +
448 context.smoother=smoother_;
│ │ │ +
449 context.rhs=&rhs;
│ │ │ +
450 context.matrix=operator_;
│ │ │ +
451 // Presmoothing
│ │ │ +
452 presmooth(context, preSteps_);
│ │ │ +
453 //Coarse grid correction
│ │ │ +
454 policy_->moveToCoarseLevel(*context.rhs);
│ │ │ + │ │ │ +
456 coarseSolver_->apply(policy_->getCoarseLevelLhs(), policy_->getCoarseLevelRhs(), res);
│ │ │ +
457 *context.lhs=0;
│ │ │ +
458 policy_->moveToFineLevel(*context.lhs);
│ │ │ +
459 *context.update += *context.lhs;
│ │ │ +
460 // Postsmoothing
│ │ │ +
461 postsmooth(context, postSteps_);
│ │ │ +
462
│ │ │ +
463 }
│ │ │ +
│ │ │ +
464
│ │ │ +
│ │ │ + │ │ │ +
467 {
│ │ │ + │ │ │ +
469 }
│ │ │ +
│ │ │ +
470
│ │ │ +
471private:
│ │ │ +
475 struct LevelContext
│ │ │ +
476 {
│ │ │ +
478 typedef S SmootherType;
│ │ │ +
480 std::shared_ptr<SmootherType> smoother;
│ │ │ +
482 FineDomainType* lhs;
│ │ │ +
483 /*
│ │ │ +
484 * @brief The right hand side holding the current residual.
│ │ │ +
485 *
│ │ │ +
486 * This is passed to the smoother as the right hand side.
│ │ │ +
487 */
│ │ │ +
488 FineRangeType* rhs;
│ │ │ +
494 FineDomainType* update;
│ │ │ + │ │ │ +
502 const FineOperatorType* matrix;
│ │ │ +
503 };
│ │ │ +
504 const FineOperatorType* operator_;
│ │ │ +
506 CoarseLevelSolver* coarseSolver_;
│ │ │ +
508 std::shared_ptr<S> smoother_;
│ │ │ +
510 LevelTransferPolicy<FO,typename CSP::Operator>* policy_;
│ │ │ +
512 std::size_t preSteps_;
│ │ │ +
514 std::size_t postSteps_;
│ │ │ +
515};
│ │ │ +
│ │ │ +
516}// end namespace Amg
│ │ │ +
517}// end namespace Dune
│ │ │ +
518
│ │ │ +
520#endif
│ │ │ +
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ +
The AMG preconditioner.
│ │ │ +
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ +
Define general, extensible interface for inverse operators.
│ │ │ +
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ +
Operator Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ +
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ +
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ +
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │
Definition allocator.hh:11
│ │ │ -
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ -
A property map that extracts one property out of a bundle using operator[]()
Definition properties.hh:43
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ +
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ +
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ +
Definition galerkin.hh:118
│ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ +
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ +
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ +
Definition indicescoarsener.hh:36
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ +
Definition transfer.hh:32
│ │ │ +
Abstract base class for transfer between levels and creation of the coarse level system.
Definition twolevelmethod.hh:38
│ │ │ +
CO CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:57
│ │ │ +
virtual void moveToCoarseLevel(const FineRangeType &fineRhs)=0
Transfers the data to the coarse level.
│ │ │ +
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:48
│ │ │ +
virtual void createCoarseLevelSystem(const FineOperatorType &fineOperator)=0
Algebraically creates the coarse level system.
│ │ │ +
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:61
│ │ │ +
virtual ~LevelTransferPolicy()
Destructor.
Definition twolevelmethod.hh:124
│ │ │ +
CoarseDomainType lhs_
The coarse level lhs.
Definition twolevelmethod.hh:130
│ │ │ +
virtual LevelTransferPolicy * clone() const =0
Clone the current object.
│ │ │ +
CoarseDomainType & getCoarseLevelLhs()
Get the coarse level left hand side.
Definition twolevelmethod.hh:87
│ │ │ +
std::shared_ptr< CoarseOperatorType > operator_
the coarse level linear operator.
Definition twolevelmethod.hh:132
│ │ │ +
CoarseRangeType rhs_
The coarse level rhs.
Definition twolevelmethod.hh:128
│ │ │ +
virtual void moveToFineLevel(FineDomainType &fineLhs)=0
Updates the fine level linear system after the correction of the coarse levels system.
│ │ │ +
std::shared_ptr< CoarseOperatorType > & getCoarseLevelOperator()
Get the coarse level operator.
Definition twolevelmethod.hh:70
│ │ │ +
CoarseRangeType & getCoarseLevelRhs()
Get the coarse level right hand side.
Definition twolevelmethod.hh:78
│ │ │ +
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:44
│ │ │ +
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:65
│ │ │ +
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:52
│ │ │ +
A LeveTransferPolicy that used aggregation to construct the coarse level system.
Definition twolevelmethod.hh:143
│ │ │ +
C Criterion
Definition twolevelmethod.hh:147
│ │ │ +
AggregationLevelTransferPolicy(const Criterion &crit)
Definition twolevelmethod.hh:150
│ │ │ +
AggregationLevelTransferPolicy * clone() const
Clone the current object.
Definition twolevelmethod.hh:214
│ │ │ +
void moveToFineLevel(typename FatherType::FineDomainType &fineLhs)
Updates the fine level linear system after the correction of the coarse levels system.
Definition twolevelmethod.hh:207
│ │ │ +
void moveToCoarseLevel(const typename FatherType::FineRangeType &fineRhs)
Definition twolevelmethod.hh:200
│ │ │ +
SequentialInformation ParallelInformation
Definition twolevelmethod.hh:148
│ │ │ +
LevelTransferPolicy< O, O > FatherType
Definition twolevelmethod.hh:146
│ │ │ +
void createCoarseLevelSystem(const O &fineOperator)
Algebraically creates the coarse level system.
Definition twolevelmethod.hh:154
│ │ │ +
A policy class for solving the coarse level system using one step of AMG.
Definition twolevelmethod.hh:234
│ │ │ +
OneStepAMGCoarseSolverPolicy(const SmootherArgs &args, const Criterion &c)
Constructs the coarse solver policy.
Definition twolevelmethod.hh:253
│ │ │ +
AMGInverseOperator CoarseLevelSolver
The type of solver constructed for the coarse level.
Definition twolevelmethod.hh:315
│ │ │ +
OneStepAMGCoarseSolverPolicy(const OneStepAMGCoarseSolverPolicy &other)
Copy constructor.
Definition twolevelmethod.hh:257
│ │ │ +
O::range_type X
The type of the range and domain of the operator.
Definition twolevelmethod.hh:239
│ │ │ +
C Criterion
The type of the crition used for the aggregation within AMG.
Definition twolevelmethod.hh:241
│ │ │ +
Dune::Amg::SmootherTraits< S >::Arguments SmootherArgs
The type of the arguments used for constructing the smoother.
Definition twolevelmethod.hh:245
│ │ │ +
O Operator
The type of the linear operator used.
Definition twolevelmethod.hh:237
│ │ │ +
AMG< Operator, X, Smoother > AMGType
The type of the AMG construct on the coarse level.
Definition twolevelmethod.hh:247
│ │ │ +
CoarseLevelSolver * createCoarseLevelSolver(P &transferPolicy)
Constructs a coarse level solver.
Definition twolevelmethod.hh:325
│ │ │ +
S Smoother
The type of the smoother used in AMG.
Definition twolevelmethod.hh:243
│ │ │ +
Definition twolevelmethod.hh:353
│ │ │ +
CoarseOperatorType::range_type CoarseRangeType
The type of the range of the coarse level operator.
Definition twolevelmethod.hh:380
│ │ │ +
FineOperatorType::domain_type FineDomainType
The type of the domain of the fine level operator.
Definition twolevelmethod.hh:371
│ │ │ +
TwoLevelMethod(const TwoLevelMethod &other)
Definition twolevelmethod.hh:418
│ │ │ +
void pre(FineDomainType &x, FineRangeType &b)
Definition twolevelmethod.hh:431
│ │ │ +
FO FineOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:363
│ │ │ +
CoarseLevelSolverPolicy::CoarseLevelSolver CoarseLevelSolver
The type of the coarse level solver.
Definition twolevelmethod.hh:358
│ │ │ +
void apply(FineDomainType &v, const FineRangeType &d)
Definition twolevelmethod.hh:439
│ │ │ +
CSP CoarseLevelSolverPolicy
The type of the policy for constructing the coarse level solver.
Definition twolevelmethod.hh:356
│ │ │ +
CoarseOperatorType::domain_type CoarseDomainType
The type of the domain of the coarse level operator.
Definition twolevelmethod.hh:384
│ │ │ +
TwoLevelMethod(const FineOperatorType &op, std::shared_ptr< SmootherType > smoother, const LevelTransferPolicy< FineOperatorType, CoarseOperatorType > &policy, CoarseLevelSolverPolicy &coarsePolicy, std::size_t preSteps=1, std::size_t postSteps=1)
Constructs a two level method.
Definition twolevelmethod.hh:404
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition twolevelmethod.hh:466
│ │ │ +
FineOperatorType::range_type FineRangeType
The type of the range of the fine level operator.
Definition twolevelmethod.hh:367
│ │ │ +
~TwoLevelMethod()
Definition twolevelmethod.hh:424
│ │ │ +
CSP::Operator CoarseOperatorType
The linear operator of the finel level system. Has to be derived from AssembledLinearOperator.
Definition twolevelmethod.hh:376
│ │ │ +
void post(FineDomainType &x)
Definition twolevelmethod.hh:436
│ │ │ +
S SmootherType
The type of the fine level smoother.
Definition twolevelmethod.hh:388
│ │ │ +
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ +
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ +
virtual void apply(X &x, X &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,110 +1,663 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -properties.hh │ │ │ │ +twolevelmethod.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_AMG_PROPERTIES_HH │ │ │ │ -6#define DUNE_ISTL_AMG_PROPERTIES_HH │ │ │ │ +5#ifndef DUNE_ISTL_TWOLEVELMETHOD_HH │ │ │ │ +6#define DUNE_ISTL_TWOLEVELMETHOD_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ +8#include │ │ │ │ 9 │ │ │ │ -10namespace _D_u_n_e │ │ │ │ -11{ │ │ │ │ -12 │ │ │ │ -13 namespace Amg │ │ │ │ -14 { │ │ │ │ -_2_8 struct _V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ -29 {}; │ │ │ │ -30 │ │ │ │ -31 │ │ │ │ -38 template │ │ │ │ -_4_0 class _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ -41 : public RAPropertyMapHelper > │ │ │ │ -43 { │ │ │ │ -44 public: │ │ │ │ -_4_6 typedef C _C_o_n_t_a_i_n_e_r; │ │ │ │ -47 │ │ │ │ -_4_9 typedef R _R_e_f_e_r_e_n_c_e; │ │ │ │ -50 │ │ │ │ -_5_2 typedef K _K_e_y; │ │ │ │ -53 │ │ │ │ -_5_7 typedef LvaluePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ -58 │ │ │ │ -59 enum { │ │ │ │ -61 _i_n_d_e_x = i │ │ │ │ -_6_2 }; │ │ │ │ -63 │ │ │ │ -_6_9 _R_e_f_e_r_e_n_c_e _o_p_e_r_a_t_o_r_[_](const _K_e_y& key) const │ │ │ │ -70 { │ │ │ │ -71 return container_[key][_i_n_d_e_x]; │ │ │ │ -72 } │ │ │ │ -73 │ │ │ │ -_7_8 _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p(_C_o_n_t_a_i_n_e_r& container) │ │ │ │ -79 : container_(&container) │ │ │ │ -80 {} │ │ │ │ -81 │ │ │ │ -_8_3 _R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p() │ │ │ │ -84 : container_(0) │ │ │ │ -85 {} │ │ │ │ -86 │ │ │ │ -87 private: │ │ │ │ -89 _C_o_n_t_a_i_n_e_r* container_; │ │ │ │ -90 }; │ │ │ │ -91 } │ │ │ │ -92} │ │ │ │ -93 │ │ │ │ -94#endif │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -Reference operator[](const Key &key) const │ │ │ │ -Get the property for a key. │ │ │ │ -DDeeffiinniittiioonn properties.hh:69 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ -RandomAccessBundledPropertyMap() │ │ │ │ -The default constructor. │ │ │ │ -DDeeffiinniittiioonn properties.hh:83 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_e_f_e_r_e_n_c_e │ │ │ │ -R Reference │ │ │ │ -The reference type of the container. │ │ │ │ -DDeeffiinniittiioonn properties.hh:49 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p │ │ │ │ -RandomAccessBundledPropertyMap(Container &container) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn properties.hh:78 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_K_e_y │ │ │ │ -K Key │ │ │ │ -The key of the property map. │ │ │ │ -DDeeffiinniittiioonn properties.hh:52 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ -LvaluePropertyMapTag Category │ │ │ │ -The category of the property map. │ │ │ │ -DDeeffiinniittiioonn properties.hh:57 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_C_o_n_t_a_i_n_e_r │ │ │ │ -C Container │ │ │ │ -The container that holds the properties. │ │ │ │ -DDeeffiinniittiioonn properties.hh:46 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_R_a_n_d_o_m_A_c_c_e_s_s_B_u_n_d_l_e_d_P_r_o_p_e_r_t_y_M_a_p_:_:_i_n_d_e_x │ │ │ │ -@ index │ │ │ │ -The index of the property in the bundle. │ │ │ │ -DDeeffiinniittiioonn properties.hh:61 │ │ │ │ +10#include<_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ +11#include"_a_m_g_._h_h" │ │ │ │ +12#include"_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ +13#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ +14 │ │ │ │ +22namespace _D_u_n_e │ │ │ │ +23{ │ │ │ │ +24namespace Amg │ │ │ │ +25{ │ │ │ │ +26 │ │ │ │ +36template │ │ │ │ +_3_7class _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ +38{ │ │ │ │ +39public: │ │ │ │ +_4_4 typedef FO _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ +_4_8 typedef typename FineOperatorType::range_type _F_i_n_e_R_a_n_g_e_T_y_p_e; │ │ │ │ +_5_2 typedef typename FineOperatorType::domain_type _F_i_n_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ +_5_7 typedef CO _C_o_a_r_s_e_O_p_e_r_a_t_o_r_T_y_p_e; │ │ │ │ +_6_1 typedef typename CoarseOperatorType::range_type _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e; │ │ │ │ +_6_5 typedef typename CoarseOperatorType::domain_type _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e; │ │ │ │ +_7_0 std::shared_ptr& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_O_p_e_r_a_t_o_r() │ │ │ │ +71 { │ │ │ │ +72 return _o_p_e_r_a_t_o_r__; │ │ │ │ +73 } │ │ │ │ +_7_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_R_h_s() │ │ │ │ +79 { │ │ │ │ +80 return _r_h_s__; │ │ │ │ +81 } │ │ │ │ +82 │ │ │ │ +_8_7 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e& _g_e_t_C_o_a_r_s_e_L_e_v_e_l_L_h_s() │ │ │ │ +88 { │ │ │ │ +89 return _l_h_s__; │ │ │ │ +90 } │ │ │ │ +_1_0_0 virtual void _m_o_v_e_T_o_C_o_a_r_s_e_L_e_v_e_l(const _F_i_n_e_R_a_n_g_e_T_y_p_e& fineRhs)=0; │ │ │ │ +_1_1_0 virtual void _m_o_v_e_T_o_F_i_n_e_L_e_v_e_l(_F_i_n_e_D_o_m_a_i_n_T_y_p_e& fineLhs)=0; │ │ │ │ +_1_1_8 virtual void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const _F_i_n_e_O_p_e_r_a_t_o_r_T_y_p_e& │ │ │ │ +fineOperator)=0; │ │ │ │ +119 │ │ │ │ +_1_2_1 virtual _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y* _c_l_o_n_e() const =0; │ │ │ │ +122 │ │ │ │ +_1_2_4 virtual _~_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(){} │ │ │ │ +125 │ │ │ │ +126 protected: │ │ │ │ +_1_2_8 _C_o_a_r_s_e_R_a_n_g_e_T_y_p_e _r_h_s__; │ │ │ │ +_1_3_0 _C_o_a_r_s_e_D_o_m_a_i_n_T_y_p_e _l_h_s__; │ │ │ │ +_1_3_2 std::shared_ptr _o_p_e_r_a_t_o_r__; │ │ │ │ +133}; │ │ │ │ +134 │ │ │ │ +140template │ │ │ │ +_1_4_1class _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ +142 : public _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y │ │ │ │ +143{ │ │ │ │ +144 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_:_:_s_i_z_e___t_y_p_e_> │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ +145public: │ │ │ │ +_1_4_6 typedef _L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y_<_O_,_O_> _F_a_t_h_e_r_T_y_p_e; │ │ │ │ +_1_4_7 typedef C _C_r_i_t_e_r_i_o_n; │ │ │ │ +_1_4_8 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +149 │ │ │ │ +_1_5_0 _A_g_g_r_e_g_a_t_i_o_n_L_e_v_e_l_T_r_a_n_s_f_e_r_P_o_l_i_c_y(const _C_r_i_t_e_r_i_o_n& crit) │ │ │ │ +151 : criterion_(crit) │ │ │ │ +152 {} │ │ │ │ +153 │ │ │ │ +_1_5_4 void _c_r_e_a_t_e_C_o_a_r_s_e_L_e_v_e_l_S_y_s_t_e_m(const O& fineOperator) │ │ │ │ +155 { │ │ │ │ +156 prolongDamp_ = criterion_.getProlongationDampingFactor(); │ │ │ │ +157 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> productBuilder; │ │ │ │ +158 typedef typename _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _t_y_p_e_n_a_m_e_ _O_:_:_m_a_t_r_i_x___t_y_p_e_> │ │ │ │ +_M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +159 typedef typename _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h,_D_u_n_e_:_:_A_m_g_:_: │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ +160 _D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s,Dune::IdentityMap,Dune::IdentityMap> │ │ │ │ +_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ +161 _M_a_t_r_i_x_G_r_a_p_h mg(fineOperator.getmat()); │ │ │ │ +162 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pg(mg,Dune::IdentityMap(),Dune::IdentityMap()); │ │ │ │ +163 typedef NegateSet OverlapFlags; │ │ │ │ +164 │ │ │ │ +165 aggregatesMap_ = std::make_shared(pg._m_a_x_V_e_r_t_e_x()+1); │ │ │ │ +166 │ │ │ │ +167 int noAggregates, isoAggregates, oneAggregates, skippedAggregates; │ │ │ │ +168 │ │ │ │ +169 std::tie(noAggregates, isoAggregates, oneAggregates, skippedAggregates) = │ │ │ │ +170 aggregatesMap_->buildAggregates(fineOperator.getmat(), pg, criterion_, │ │ │ │ +true); │ │ │ │ +171 std::cout<<"no aggregates="< │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: pinfo.hh File Reference │ │ │ +dune-istl: parameters.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,41 +71,61 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ -
pinfo.hh File Reference
│ │ │ +Namespaces | │ │ │ +Enumerations
│ │ │ + │ │ │ │ │ │
│ │ │ -
#include <dune/common/parallel/communication.hh>
│ │ │ -#include <dune/common/enumset.hh>
│ │ │ -#include <dune/common/parallel/mpicommunication.hh>
│ │ │ -#include <dune/common/parallel/mpitraits.hh>
│ │ │ -#include <dune/common/parallel/remoteindices.hh>
│ │ │ -#include <dune/common/parallel/interface.hh>
│ │ │ -#include <dune/common/parallel/communicator.hh>
│ │ │ -#include <dune/istl/solvercategory.hh>
│ │ │ + │ │ │ +

Parameter classes for customizing AMG. │ │ │ +More...

│ │ │ +
#include <cstddef>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::SequentialInformation
class  Dune::Amg::DependencyParameters
 Parameters needed to check whether a node depends on another. More...
 
class  Dune::Amg::AggregationParameters
 Parameters needed for the aggregation process. More...
 
class  Dune::Amg::CoarseningParameters
 Parameters for the complete coarsening process. More...
 
class  Dune::Amg::Parameters
 All parameters for AMG. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Enumerations

enum  Dune::Amg::AccumulationMode { Dune::Amg::noAccu = 0 │ │ │ +, Dune::Amg::atOnceAccu =1 │ │ │ +, Dune::Amg::successiveAccu =2 │ │ │ + }
 Identifiers for the different accumulation modes. More...
 
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Parameter classes for customizing AMG.

│ │ │ +
Author
Markus Blatt
│ │ │ +

All parameters of the AMG can be set by using the class Parameter, which can be provided to CoarsenCriterion via its constructor.

│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,28 +1,45 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -pinfo.hh File Reference │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _E_n_u_m_e_r_a_t_i_o_n_s │ │ │ │ +parameters.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ +» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ +Parameter classes for customizing AMG. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ +  _P_a_r_a_m_e_t_e_r_s needed to check whether a node depends on another. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ +  _P_a_r_a_m_e_t_e_r_s needed for the aggregation process. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ +  _P_a_r_a_m_e_t_e_r_s for the complete coarsening process. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +  All parameters for _A_M_G. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ +enum   _D_u_n_e_:_:_A_m_g_:_:_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e { _D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u = 0 , _D_u_n_e_:_:_A_m_g_:_: │ │ │ │ + _a_t_O_n_c_e_A_c_c_u =1 , _D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u =2 } │ │ │ │ +  Identifiers for the different accumulation modes. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Parameter classes for customizing AMG. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ +All parameters of the AMG can be set by using the class Parameter, which can be │ │ │ │ +provided to CoarsenCriterion via its constructor. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: pinfo.hh Source File │ │ │ +dune-istl: parameters.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,168 +74,410 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
pinfo.hh
│ │ │ +
parameters.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_PINFO_HH
│ │ │ -
6#define DUNE_AMG_PINFO_HH
│ │ │ +
5#ifndef DUNE_AMG_PARAMETERS_HH
│ │ │ +
6#define DUNE_AMG_PARAMETERS_HH
│ │ │
7
│ │ │ -
8#include <dune/common/parallel/communication.hh>
│ │ │ -
9#include <dune/common/enumset.hh>
│ │ │ -
10
│ │ │ -
11#if HAVE_MPI
│ │ │ -
12
│ │ │ -
13#include <dune/common/parallel/mpicommunication.hh>
│ │ │ -
14#include <dune/common/parallel/mpitraits.hh>
│ │ │ -
15#include <dune/common/parallel/remoteindices.hh>
│ │ │ -
16#include <dune/common/parallel/interface.hh>
│ │ │ -
17#include <dune/common/parallel/communicator.hh>
│ │ │ -
18
│ │ │ -
19#endif
│ │ │ -
20
│ │ │ - │ │ │ -
22namespace Dune
│ │ │ -
23{
│ │ │ -
24 namespace Amg
│ │ │ -
25 {
│ │ │ -
26
│ │ │ -
│ │ │ - │ │ │ -
28 {
│ │ │ -
29 public:
│ │ │ -
30 typedef Communication<void*> MPICommunicator;
│ │ │ -
31 typedef EmptySet<int> CopyFlags;
│ │ │ -
32 typedef AllSet<int> OwnerSet;
│ │ │ -
33
│ │ │ +
8#include <cstddef>
│ │ │ +
9
│ │ │ +
10namespace Dune
│ │ │ +
11{
│ │ │ +
12 namespace Amg
│ │ │ +
13 {
│ │ │ +
│ │ │ + │ │ │ +
31 {
│ │ │ +
32 public:
│ │ │
│ │ │ - │ │ │ - │ │ │ -
36 }
│ │ │ + │ │ │ +
35 : alpha_(1.0/3.0), beta_(1.0E-5)
│ │ │ +
36 {}
│ │ │
│ │ │
37
│ │ │ -
│ │ │ - │ │ │ -
39 {
│ │ │ -
40 return comm_;
│ │ │ -
41 }
│ │ │ -
│ │ │ -
42
│ │ │ -
│ │ │ -
43 int procs() const
│ │ │ -
44 {
│ │ │ -
45 return 1;
│ │ │ -
46 }
│ │ │ -
│ │ │ -
47
│ │ │ -
48 template<typename T>
│ │ │ -
│ │ │ -
49 T globalSum(const T& t) const
│ │ │ -
50 {
│ │ │ -
51 return t;
│ │ │ -
52 }
│ │ │ -
│ │ │ -
53
│ │ │ - │ │ │ -
55
│ │ │ -
56 void buildGlobalLookup(std::size_t){}
│ │ │ -
57
│ │ │ - │ │ │ -
59
│ │ │ -
│ │ │ - │ │ │ -
61 {
│ │ │ -
62 return gli;
│ │ │ -
63 }
│ │ │ -
│ │ │ -
64
│ │ │ -
65 template<class V>
│ │ │ -
│ │ │ -
66 void copyOwnerToAll([[maybe_unused]] V& v, [[maybe_unused]] V& v1) const
│ │ │ -
67 {}
│ │ │ +
│ │ │ +
42 void setBeta(double b)
│ │ │ +
43 {
│ │ │ +
44 beta_ = b;
│ │ │ +
45 }
│ │ │ +
│ │ │ +
46
│ │ │ +
│ │ │ +
52 double beta() const
│ │ │ +
53 {
│ │ │ +
54 return beta_;
│ │ │ +
55 }
│ │ │ +
│ │ │ +
56
│ │ │ +
│ │ │ +
61 void setAlpha(double a)
│ │ │ +
62 {
│ │ │ +
63 alpha_ = a;
│ │ │ +
64 }
│ │ │
│ │ │ -
68
│ │ │ -
69 template<class V>
│ │ │ +
65
│ │ │
│ │ │ -
70 void project([[maybe_unused]] V& v) const
│ │ │ -
71 {}
│ │ │ -
│ │ │ -
72
│ │ │ -
73 template<class T1, class T2>
│ │ │ -
│ │ │ -
74 void dot (const T1& x, const T1& y, T2& result) const
│ │ │ -
75 {
│ │ │ -
76 result = x.dot(y);
│ │ │ -
77 }
│ │ │ +
70 double alpha() const
│ │ │ +
71 {
│ │ │ +
72 return alpha_;
│ │ │ +
73 }
│ │ │ +
│ │ │ +
74
│ │ │ +
75 private:
│ │ │ +
76 double alpha_, beta_;
│ │ │ +
77 };
│ │ │
│ │ │
78
│ │ │ -
79 template<class T1>
│ │ │ -
│ │ │ -
80 typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
│ │ │ -
81 {
│ │ │ -
82 return x.two_norm();
│ │ │ -
83 }
│ │ │ -
│ │ │ -
84
│ │ │ -
85 template<class T>
│ │ │ -
│ │ │ -
86 SequentialInformation(const Communication<T>&)
│ │ │ -
87 {}
│ │ │ -
│ │ │ -
88
│ │ │ -
│ │ │ - │ │ │ -
90 {}
│ │ │ -
│ │ │ -
91
│ │ │ -
│ │ │ - │ │ │ -
93 {}
│ │ │ -
│ │ │ -
94 private:
│ │ │ -
95 MPICommunicator comm_{};
│ │ │ - │ │ │ -
97 };
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
84 {
│ │ │ +
85 public:
│ │ │ +
│ │ │ + │ │ │ +
96 : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6),
│ │ │ +
97 connectivity_(15), skipiso_(false)
│ │ │ +
98 {}
│ │ │
│ │ │ -
98
│ │ │
99
│ │ │ -
100 } // namespace Amg
│ │ │ -
101} //namespace Dune
│ │ │ -
102#endif
│ │ │ - │ │ │ +
│ │ │ +
109 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
│ │ │ +
110 {
│ │ │ +
111 maxDistance_=diameter-1;
│ │ │ +
112 std::size_t csize=1;
│ │ │ +
113
│ │ │ +
114 for(; dim>0; dim--) {
│ │ │ +
115 csize*=diameter;
│ │ │ +
116 maxDistance_+=diameter-1;
│ │ │ +
117 }
│ │ │ +
118 minAggregateSize_=csize;
│ │ │ +
119 maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
│ │ │ +
120 }
│ │ │ +
│ │ │ +
121
│ │ │ +
│ │ │ +
132 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ +
133 {
│ │ │ +
134 setDefaultValuesIsotropic(dim, diameter);
│ │ │ +
135 maxDistance_+=dim-1;
│ │ │ +
136 }
│ │ │ +
│ │ │ +
144 std::size_t maxDistance() const { return maxDistance_;}
│ │ │ +
145
│ │ │ +
154 void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
│ │ │ +
155
│ │ │ +
│ │ │ +
161 bool skipIsolated() const
│ │ │ +
162 {
│ │ │ +
163 return skipiso_;
│ │ │ +
164 }
│ │ │ +
│ │ │ +
165
│ │ │ +
│ │ │ +
171 void setSkipIsolated(bool skip)
│ │ │ +
172 {
│ │ │ +
173 skipiso_=skip;
│ │ │ +
174 }
│ │ │ +
│ │ │ +
175
│ │ │ +
180 std::size_t minAggregateSize() const { return minAggregateSize_;}
│ │ │ +
181
│ │ │ +
187 void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
│ │ │ +
188
│ │ │ +
193 std::size_t maxAggregateSize() const { return maxAggregateSize_;}
│ │ │ +
194
│ │ │ +
201 void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
│ │ │ +
202
│ │ │ +
210 std::size_t maxConnectivity() const { return connectivity_;}
│ │ │ +
211
│ │ │ +
219 void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
│ │ │ +
220
│ │ │ +
221 private:
│ │ │ +
222 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
│ │ │ +
223 bool skipiso_;
│ │ │ +
224
│ │ │ +
225 };
│ │ │ +
│ │ │ +
226
│ │ │ +
227
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
248 };
│ │ │ +
│ │ │ +
249
│ │ │ +
250
│ │ │ +
251
│ │ │ +
252
│ │ │ +
│ │ │ + │ │ │ +
257 {
│ │ │ +
258 public:
│ │ │ +
│ │ │ +
262 void setMaxLevel(int l)
│ │ │ +
263 {
│ │ │ +
264 maxLevel_ = l;
│ │ │ +
265 }
│ │ │ +
│ │ │ +
│ │ │ +
269 int maxLevel() const
│ │ │ +
270 {
│ │ │ +
271 return maxLevel_;
│ │ │ +
272 }
│ │ │ +
│ │ │ +
273
│ │ │ +
│ │ │ +
277 void setCoarsenTarget(int nodes)
│ │ │ +
278 {
│ │ │ +
279 coarsenTarget_ = nodes;
│ │ │ +
280 }
│ │ │ +
│ │ │ +
281
│ │ │ +
│ │ │ +
285 int coarsenTarget() const
│ │ │ +
286 {
│ │ │ +
287 return coarsenTarget_;
│ │ │ +
288 }
│ │ │ +
│ │ │ +
289
│ │ │ +
│ │ │ +
295 void setMinCoarsenRate(double rate)
│ │ │ +
296 {
│ │ │ +
297 minCoarsenRate_ = rate;
│ │ │ +
298 }
│ │ │ +
│ │ │ +
299
│ │ │ +
│ │ │ +
303 double minCoarsenRate() const
│ │ │ +
304 {
│ │ │ +
305 return minCoarsenRate_;
│ │ │ +
306 }
│ │ │ +
│ │ │ +
307
│ │ │ +
│ │ │ + │ │ │ +
312 {
│ │ │ +
313 return accumulate_;
│ │ │ +
314 }
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
319 {
│ │ │ +
320 accumulate_=accu;
│ │ │ +
321 }
│ │ │ +
│ │ │ +
322
│ │ │ +
│ │ │ +
323 void setAccumulate(bool accu){
│ │ │ +
324 accumulate_=accu ? successiveAccu : noAccu;
│ │ │ +
325 }
│ │ │ +
│ │ │ +
326
│ │ │ +
│ │ │ +
330 bool useFixedOrder() const
│ │ │ +
331 {
│ │ │ +
332 return useFixedOrder_;
│ │ │ +
333 }
│ │ │ +
│ │ │ +
334
│ │ │ +
│ │ │ + │ │ │ +
336 {
│ │ │ +
337 useFixedOrder_ = useFixedOrder;
│ │ │ +
338 }
│ │ │ +
│ │ │ +
339
│ │ │ +
│ │ │ + │ │ │ +
346 {
│ │ │ +
347 dampingFactor_ = d;
│ │ │ +
348 }
│ │ │ +
│ │ │ +
349
│ │ │ +
│ │ │ + │ │ │ +
356 {
│ │ │ +
357 return dampingFactor_;
│ │ │ +
358 }
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
373 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu,
│ │ │ +
374 bool useFixedOrder = false)
│ │ │ +
375 : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
│ │ │ +
376 dampingFactor_(prolongDamp), accumulate_( accumulate), useFixedOrder_(useFixedOrder)
│ │ │ +
377 {}
│ │ │ +
│ │ │ +
378
│ │ │ +
379 private:
│ │ │ +
383 int maxLevel_;
│ │ │ +
387 int coarsenTarget_;
│ │ │ +
391 double minCoarsenRate_;
│ │ │ +
395 double dampingFactor_;
│ │ │ +
400 AccumulationMode accumulate_;
│ │ │ +
406 bool useFixedOrder_;
│ │ │ +
407 };
│ │ │ +
│ │ │ +
408
│ │ │ +
│ │ │ + │ │ │ +
416 {
│ │ │ +
417 public:
│ │ │ +
│ │ │ +
424 void setDebugLevel(int level)
│ │ │ +
425 {
│ │ │ +
426 debugLevel_ = level;
│ │ │ +
427 }
│ │ │ +
│ │ │ +
428
│ │ │ +
│ │ │ +
434 int debugLevel() const
│ │ │ +
435 {
│ │ │ +
436 return debugLevel_;
│ │ │ +
437 }
│ │ │ +
│ │ │ +
438
│ │ │ +
│ │ │ +
443 void setNoPreSmoothSteps(std::size_t steps)
│ │ │ +
444 {
│ │ │ +
445 preSmoothSteps_=steps;
│ │ │ +
446 }
│ │ │ +
│ │ │ +
│ │ │ +
451 std::size_t getNoPreSmoothSteps() const
│ │ │ +
452 {
│ │ │ +
453 return preSmoothSteps_;
│ │ │ +
454 }
│ │ │ +
│ │ │ +
455
│ │ │ +
│ │ │ +
460 void setNoPostSmoothSteps(std::size_t steps)
│ │ │ +
461 {
│ │ │ +
462 postSmoothSteps_=steps;
│ │ │ +
463 }
│ │ │ +
│ │ │ +
│ │ │ +
468 std::size_t getNoPostSmoothSteps() const
│ │ │ +
469 {
│ │ │ +
470 return postSmoothSteps_;
│ │ │ +
471 }
│ │ │ +
│ │ │ +
472
│ │ │ +
│ │ │ +
476 void setGamma(std::size_t gamma)
│ │ │ +
477 {
│ │ │ +
478 gamma_=gamma;
│ │ │ +
479 }
│ │ │ +
│ │ │ +
│ │ │ +
483 std::size_t getGamma() const
│ │ │ +
484 {
│ │ │ +
485 return gamma_;
│ │ │ +
486 }
│ │ │ +
│ │ │ +
487
│ │ │ +
│ │ │ +
492 void setAdditive(bool additive)
│ │ │ +
493 {
│ │ │ +
494 additive_=additive;
│ │ │ +
495 }
│ │ │ +
│ │ │ +
496
│ │ │ +
│ │ │ +
501 bool getAdditive() const
│ │ │ +
502 {
│ │ │ +
503 return additive_;
│ │ │ +
504 }
│ │ │ +
│ │ │ +
505
│ │ │ +
│ │ │ +
516 Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ +
517 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder = false)
│ │ │ + │ │ │ +
519 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
│ │ │ +
520 additive_(false)
│ │ │ +
521 {}
│ │ │ +
│ │ │ +
522 private:
│ │ │ +
523 int debugLevel_;
│ │ │ +
524 std::size_t preSmoothSteps_;
│ │ │ +
525 std::size_t postSmoothSteps_;
│ │ │ +
526 std::size_t gamma_;
│ │ │ +
527 bool additive_;
│ │ │ +
528 };
│ │ │ +
│ │ │ +
529
│ │ │ +
530 } //namespace AMG
│ │ │ +
531
│ │ │ +
532} //namespace Dune
│ │ │ +
533#endif
│ │ │ +
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an anisotropic problem.
Definition parameters.hh:132
│ │ │ +
void setAdditive(bool additive)
Set whether to use additive multigrid.
Definition parameters.hh:492
│ │ │ +
void setSkipIsolated(bool skip)
Set whether isolated aggregates will not be represented on the coarse level.
Definition parameters.hh:171
│ │ │ +
void setProlongationDampingFactor(double d)
Set the damping factor for the prolongation.
Definition parameters.hh:345
│ │ │ +
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition parameters.hh:372
│ │ │ +
double alpha() const
Get the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:70
│ │ │ +
void setMaxAggregateSize(std::size_t size)
Set the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:201
│ │ │ +
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition parameters.hh:295
│ │ │ +
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition parameters.hh:303
│ │ │ +
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:193
│ │ │ +
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:61
│ │ │ +
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition parameters.hh:516
│ │ │ +
double beta() const
Get the threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition parameters.hh:52
│ │ │ +
std::size_t maxConnectivity() const
Get the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:210
│ │ │ +
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:285
│ │ │ +
void setAccumulate(AccumulationMode accu)
Set whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:318
│ │ │ +
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition parameters.hh:355
│ │ │ +
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:311
│ │ │ +
void setUseFixedOrder(bool useFixedOrder)
Definition parameters.hh:335
│ │ │ +
bool useFixedOrder() const
Check if the indices for the coarser levels should be created in a fixed order.
Definition parameters.hh:330
│ │ │ +
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:219
│ │ │ +
std::size_t minAggregateSize() const
Get the minimum number of nodes a aggregate has to consist of.
Definition parameters.hh:180
│ │ │ +
bool getAdditive() const
Get whether to use additive multigrid.
Definition parameters.hh:501
│ │ │ +
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:262
│ │ │ +
void setDebugLevel(int level)
Set the debugging level.
Definition parameters.hh:424
│ │ │ +
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:483
│ │ │ +
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition parameters.hh:460
│ │ │ +
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition parameters.hh:451
│ │ │ +
DependencyParameters()
Constructor.
Definition parameters.hh:34
│ │ │ +
void setMinAggregateSize(std::size_t size)
Set the minimum number of nodes a aggregate has to consist of.
Definition parameters.hh:187
│ │ │ +
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:269
│ │ │ +
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition parameters.hh:109
│ │ │ +
AggregationParameters()
Constructor.
Definition parameters.hh:95
│ │ │ +
bool skipIsolated() const
Whether isolated aggregates will not be represented on the coarse level.
Definition parameters.hh:161
│ │ │ +
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:277
│ │ │ +
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition parameters.hh:443
│ │ │ +
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:231
│ │ │ +
void setBeta(double b)
Set threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition parameters.hh:42
│ │ │ +
std::size_t maxDistance() const
Get the maximal distance allowed between two nodes in a aggregate.
Definition parameters.hh:144
│ │ │ +
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:476
│ │ │ +
void setAccumulate(bool accu)
Definition parameters.hh:323
│ │ │ +
void setMaxDistance(std::size_t distance)
Set the maximal distance allowed between two nodes in a aggregate.
Definition parameters.hh:154
│ │ │ +
int debugLevel() const
Get the debugging Level.
Definition parameters.hh:434
│ │ │ +
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition parameters.hh:468
│ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ +
@ noAccu
No data accumulution.
Definition parameters.hh:237
│ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │
Definition allocator.hh:11
│ │ │ -
Definition pinfo.hh:28
│ │ │ -
SequentialInformation()
Definition pinfo.hh:89
│ │ │ -
T globalSum(const T &t) const
Definition pinfo.hh:49
│ │ │ -
EmptySet< int > CopyFlags
Definition pinfo.hh:31
│ │ │ -
void dot(const T1 &x, const T1 &y, T2 &result) const
Definition pinfo.hh:74
│ │ │ -
AllSet< int > OwnerSet
Definition pinfo.hh:32
│ │ │ -
void copyOwnerToAll(V &v, V &v1) const
Definition pinfo.hh:66
│ │ │ -
MPICommunicator communicator() const
Definition pinfo.hh:38
│ │ │ -
void buildGlobalLookup(std::size_t)
Definition pinfo.hh:56
│ │ │ -
void project(V &v) const
Definition pinfo.hh:70
│ │ │ -
Communication< void * > MPICommunicator
Definition pinfo.hh:30
│ │ │ -
SequentialInformation(const Communication< T > &)
Definition pinfo.hh:86
│ │ │ -
const GlobalLookupIndexSet & globalLookup() const
Definition pinfo.hh:60
│ │ │ -
SequentialInformation(const SequentialInformation &)
Definition pinfo.hh:92
│ │ │ -
FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const
Definition pinfo.hh:80
│ │ │ -
void freeGlobalLookup()
Definition pinfo.hh:58
│ │ │ -
int GlobalLookupIndexSet
Definition pinfo.hh:54
│ │ │ -
SolverCategory::Category category() const
Definition pinfo.hh:34
│ │ │ -
int procs() const
Definition pinfo.hh:43
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
Parameters needed to check whether a node depends on another.
Definition parameters.hh:31
│ │ │ +
Parameters needed for the aggregation process.
Definition parameters.hh:84
│ │ │ +
Parameters for the complete coarsening process.
Definition parameters.hh:257
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,181 +1,486 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -pinfo.hh │ │ │ │ +parameters.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_PINFO_HH │ │ │ │ -6#define DUNE_AMG_PINFO_HH │ │ │ │ +5#ifndef DUNE_AMG_PARAMETERS_HH │ │ │ │ +6#define DUNE_AMG_PARAMETERS_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10 │ │ │ │ -11#if HAVE_MPI │ │ │ │ -12 │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17#include │ │ │ │ -18 │ │ │ │ -19#endif │ │ │ │ -20 │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h> │ │ │ │ -22namespace _D_u_n_e │ │ │ │ -23{ │ │ │ │ -24 namespace Amg │ │ │ │ -25 { │ │ │ │ -26 │ │ │ │ -_2_7 class _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -28 { │ │ │ │ -29 public: │ │ │ │ -_3_0 typedef Communication _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r; │ │ │ │ -_3_1 typedef EmptySet _C_o_p_y_F_l_a_g_s; │ │ │ │ -_3_2 typedef AllSet _O_w_n_e_r_S_e_t; │ │ │ │ -33 │ │ │ │ -_3_4 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y () const { │ │ │ │ -35 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -36 } │ │ │ │ +8#include │ │ │ │ +9 │ │ │ │ +10namespace _D_u_n_e │ │ │ │ +11{ │ │ │ │ +12 namespace Amg │ │ │ │ +13 { │ │ │ │ +_3_0 class _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ +31 { │ │ │ │ +32 public: │ │ │ │ +_3_4 _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s() │ │ │ │ +35 : alpha_(1.0/3.0), beta_(1.0E-5) │ │ │ │ +36 {} │ │ │ │ 37 │ │ │ │ -_3_8 _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r _c_o_m_m_u_n_i_c_a_t_o_r() const │ │ │ │ -39 { │ │ │ │ -40 return comm_; │ │ │ │ -41 } │ │ │ │ -42 │ │ │ │ -_4_3 int _p_r_o_c_s() const │ │ │ │ -44 { │ │ │ │ -45 return 1; │ │ │ │ -46 } │ │ │ │ -47 │ │ │ │ -48 template │ │ │ │ -_4_9 T _g_l_o_b_a_l_S_u_m(const T& t) const │ │ │ │ -50 { │ │ │ │ -51 return t; │ │ │ │ -52 } │ │ │ │ -53 │ │ │ │ -_5_4 typedef int _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ -55 │ │ │ │ -_5_6 void _b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p(std::size_t){} │ │ │ │ -57 │ │ │ │ -_5_8 void _f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p(){} │ │ │ │ -59 │ │ │ │ -_6_0 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& _g_l_o_b_a_l_L_o_o_k_u_p() const │ │ │ │ -61 { │ │ │ │ -62 return gli; │ │ │ │ -63 } │ │ │ │ -64 │ │ │ │ -65 template │ │ │ │ -_6_6 void _c_o_p_y_O_w_n_e_r_T_o_A_l_l([[maybe_unused]] V& v, [[maybe_unused]] V& v1) const │ │ │ │ -67 {} │ │ │ │ -68 │ │ │ │ -69 template │ │ │ │ -_7_0 void _p_r_o_j_e_c_t([[maybe_unused]] V& v) const │ │ │ │ -71 {} │ │ │ │ -72 │ │ │ │ -73 template │ │ │ │ -_7_4 void _d_o_t (const T1& x, const T1& y, T2& result) const │ │ │ │ -75 { │ │ │ │ -76 result = x.dot(y); │ │ │ │ -77 } │ │ │ │ +_4_2 void _s_e_t_B_e_t_a(double b) │ │ │ │ +43 { │ │ │ │ +44 beta_ = b; │ │ │ │ +45 } │ │ │ │ +46 │ │ │ │ +_5_2 double _b_e_t_a() const │ │ │ │ +53 { │ │ │ │ +54 return beta_; │ │ │ │ +55 } │ │ │ │ +56 │ │ │ │ +_6_1 void _s_e_t_A_l_p_h_a(double a) │ │ │ │ +62 { │ │ │ │ +63 alpha_ = a; │ │ │ │ +64 } │ │ │ │ +65 │ │ │ │ +_7_0 double _a_l_p_h_a() const │ │ │ │ +71 { │ │ │ │ +72 return alpha_; │ │ │ │ +73 } │ │ │ │ +74 │ │ │ │ +75 private: │ │ │ │ +76 double alpha_, beta_; │ │ │ │ +77 }; │ │ │ │ 78 │ │ │ │ -79 template │ │ │ │ -_8_0 typename FieldTraits::real_type _n_o_r_m (const T1& x) │ │ │ │ -const │ │ │ │ -81 { │ │ │ │ -82 return x.two_norm(); │ │ │ │ -83 } │ │ │ │ -84 │ │ │ │ -85 template │ │ │ │ -_8_6 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(const Communication&) │ │ │ │ -87 {} │ │ │ │ -88 │ │ │ │ -_8_9 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n() │ │ │ │ -90 {} │ │ │ │ -91 │ │ │ │ -_9_2 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n(const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n&) │ │ │ │ -93 {} │ │ │ │ -94 private: │ │ │ │ -95 _M_P_I_C_o_m_m_u_n_i_c_a_t_o_r comm_{}; │ │ │ │ -96 _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t gli{}; │ │ │ │ -97 }; │ │ │ │ -98 │ │ │ │ +_8_2 class _A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s : │ │ │ │ +83 public _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ +84 { │ │ │ │ +85 public: │ │ │ │ +_9_5 _A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s() │ │ │ │ +96 : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6), │ │ │ │ +97 connectivity_(15), skipiso_(false) │ │ │ │ +98 {} │ │ │ │ 99 │ │ │ │ -100 } // namespace Amg │ │ │ │ -101} //namespace Dune │ │ │ │ -102#endif │ │ │ │ -_s_o_l_v_e_r_c_a_t_e_g_o_r_y_._h_h │ │ │ │ +_1_0_9 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(std::size_t dim, std::size_t diameter=2) │ │ │ │ +110 { │ │ │ │ +111 maxDistance_=diameter-1; │ │ │ │ +112 std::size_t csize=1; │ │ │ │ +113 │ │ │ │ +114 for(; dim>0; dim--) { │ │ │ │ +115 csize*=diameter; │ │ │ │ +116 maxDistance_+=diameter-1; │ │ │ │ +117 } │ │ │ │ +118 minAggregateSize_=csize; │ │ │ │ +119 maxAggregateSize_=static_cast(csize*1.5); │ │ │ │ +120 } │ │ │ │ +121 │ │ │ │ +_1_3_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ +133 { │ │ │ │ +134 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ +135 maxDistance_+=dim-1; │ │ │ │ +136 } │ │ │ │ +_1_4_4 std::size_t _m_a_x_D_i_s_t_a_n_c_e() const { return maxDistance_;} │ │ │ │ +145 │ │ │ │ +_1_5_4 void _s_e_t_M_a_x_D_i_s_t_a_n_c_e(std::size_t distance) { maxDistance_ = distance;} │ │ │ │ +155 │ │ │ │ +_1_6_1 bool _s_k_i_p_I_s_o_l_a_t_e_d() const │ │ │ │ +162 { │ │ │ │ +163 return skipiso_; │ │ │ │ +164 } │ │ │ │ +165 │ │ │ │ +_1_7_1 void _s_e_t_S_k_i_p_I_s_o_l_a_t_e_d(bool skip) │ │ │ │ +172 { │ │ │ │ +173 skipiso_=skip; │ │ │ │ +174 } │ │ │ │ +175 │ │ │ │ +_1_8_0 std::size_t _m_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e() const { return minAggregateSize_;} │ │ │ │ +181 │ │ │ │ +_1_8_7 void _s_e_t_M_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e(std::size_t size){ minAggregateSize_=size;} │ │ │ │ +188 │ │ │ │ +_1_9_3 std::size_t _m_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e() const { return maxAggregateSize_;} │ │ │ │ +194 │ │ │ │ +_2_0_1 void _s_e_t_M_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e(std::size_t size){ maxAggregateSize_ = size;} │ │ │ │ +202 │ │ │ │ +_2_1_0 std::size_t _m_a_x_C_o_n_n_e_c_t_i_v_i_t_y() const { return connectivity_;} │ │ │ │ +211 │ │ │ │ +_2_1_9 void _s_e_t_M_a_x_C_o_n_n_e_c_t_i_v_i_t_y(std::size_t connectivity){ connectivity_ = │ │ │ │ +connectivity;} │ │ │ │ +220 │ │ │ │ +221 private: │ │ │ │ +222 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, │ │ │ │ +connectivity_; │ │ │ │ +223 bool skipiso_; │ │ │ │ +224 │ │ │ │ +225 }; │ │ │ │ +226 │ │ │ │ +227 │ │ │ │ +_2_3_1 enum _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e { │ │ │ │ +_2_3_7 _n_o_A_c_c_u = 0, │ │ │ │ +_2_4_3 _a_t_O_n_c_e_A_c_c_u=1, │ │ │ │ +247 _s_u_c_c_e_s_s_i_v_e_A_c_c_u=2 │ │ │ │ +_2_4_8 }; │ │ │ │ +249 │ │ │ │ +250 │ │ │ │ +251 │ │ │ │ +252 │ │ │ │ +_2_5_6 class _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s : public _A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ +257 { │ │ │ │ +258 public: │ │ │ │ +_2_6_2 void _s_e_t_M_a_x_L_e_v_e_l(int l) │ │ │ │ +263 { │ │ │ │ +264 maxLevel_ = l; │ │ │ │ +265 } │ │ │ │ +_2_6_9 int _m_a_x_L_e_v_e_l() const │ │ │ │ +270 { │ │ │ │ +271 return maxLevel_; │ │ │ │ +272 } │ │ │ │ +273 │ │ │ │ +_2_7_7 void _s_e_t_C_o_a_r_s_e_n_T_a_r_g_e_t(int nodes) │ │ │ │ +278 { │ │ │ │ +279 coarsenTarget_ = nodes; │ │ │ │ +280 } │ │ │ │ +281 │ │ │ │ +_2_8_5 int _c_o_a_r_s_e_n_T_a_r_g_e_t() const │ │ │ │ +286 { │ │ │ │ +287 return coarsenTarget_; │ │ │ │ +288 } │ │ │ │ +289 │ │ │ │ +_2_9_5 void _s_e_t_M_i_n_C_o_a_r_s_e_n_R_a_t_e(double rate) │ │ │ │ +296 { │ │ │ │ +297 minCoarsenRate_ = rate; │ │ │ │ +298 } │ │ │ │ +299 │ │ │ │ +_3_0_3 double _m_i_n_C_o_a_r_s_e_n_R_a_t_e() const │ │ │ │ +304 { │ │ │ │ +305 return minCoarsenRate_; │ │ │ │ +306 } │ │ │ │ +307 │ │ │ │ +_3_1_1 _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e _a_c_c_u_m_u_l_a_t_e() const │ │ │ │ +312 { │ │ │ │ +313 return accumulate_; │ │ │ │ +314 } │ │ │ │ +_3_1_8 void _s_e_t_A_c_c_u_m_u_l_a_t_e(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e accu) │ │ │ │ +319 { │ │ │ │ +320 accumulate_=accu; │ │ │ │ +321 } │ │ │ │ +322 │ │ │ │ +_3_2_3 void _s_e_t_A_c_c_u_m_u_l_a_t_e(bool accu){ │ │ │ │ +324 accumulate_=accu ? _s_u_c_c_e_s_s_i_v_e_A_c_c_u : _n_o_A_c_c_u; │ │ │ │ +325 } │ │ │ │ +326 │ │ │ │ +_3_3_0 bool _u_s_e_F_i_x_e_d_O_r_d_e_r() const │ │ │ │ +331 { │ │ │ │ +332 return useFixedOrder_; │ │ │ │ +333 } │ │ │ │ +334 │ │ │ │ +_3_3_5 void _s_e_t_U_s_e_F_i_x_e_d_O_r_d_e_r(bool _u_s_e_F_i_x_e_d_O_r_d_e_r) │ │ │ │ +336 { │ │ │ │ +337 useFixedOrder_ = _u_s_e_F_i_x_e_d_O_r_d_e_r; │ │ │ │ +338 } │ │ │ │ +339 │ │ │ │ +_3_4_5 void _s_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r(double d) │ │ │ │ +346 { │ │ │ │ +347 dampingFactor_ = d; │ │ │ │ +348 } │ │ │ │ +349 │ │ │ │ +_3_5_5 double _g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r() const │ │ │ │ +356 { │ │ │ │ +357 return dampingFactor_; │ │ │ │ +358 } │ │ │ │ +_3_7_2 _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s(int _m_a_x_L_e_v_e_l=100, int _c_o_a_r_s_e_n_T_a_r_g_e_t=1000, double │ │ │ │ +_m_i_n_C_o_a_r_s_e_n_R_a_t_e=1.2, │ │ │ │ +373 double prolongDamp=1.6, _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e _a_c_c_u_m_u_l_a_t_e=_s_u_c_c_e_s_s_i_v_e_A_c_c_u, │ │ │ │ +374 bool _u_s_e_F_i_x_e_d_O_r_d_e_r = false) │ │ │ │ +375 : maxLevel_(_m_a_x_L_e_v_e_l), coarsenTarget_(_c_o_a_r_s_e_n_T_a_r_g_e_t), minCoarsenRate_ │ │ │ │ +(_m_i_n_C_o_a_r_s_e_n_R_a_t_e), │ │ │ │ +376 dampingFactor_(prolongDamp), accumulate_( _a_c_c_u_m_u_l_a_t_e), useFixedOrder_ │ │ │ │ +(_u_s_e_F_i_x_e_d_O_r_d_e_r) │ │ │ │ +377 {} │ │ │ │ +378 │ │ │ │ +379 private: │ │ │ │ +383 int maxLevel_; │ │ │ │ +387 int coarsenTarget_; │ │ │ │ +391 double minCoarsenRate_; │ │ │ │ +395 double dampingFactor_; │ │ │ │ +400 _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e accumulate_; │ │ │ │ +406 bool useFixedOrder_; │ │ │ │ +407 }; │ │ │ │ +408 │ │ │ │ +_4_1_5 class _P_a_r_a_m_e_t_e_r_s : public _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ +416 { │ │ │ │ +417 public: │ │ │ │ +_4_2_4 void _s_e_t_D_e_b_u_g_L_e_v_e_l(int level) │ │ │ │ +425 { │ │ │ │ +426 debugLevel_ = level; │ │ │ │ +427 } │ │ │ │ +428 │ │ │ │ +_4_3_4 int _d_e_b_u_g_L_e_v_e_l() const │ │ │ │ +435 { │ │ │ │ +436 return debugLevel_; │ │ │ │ +437 } │ │ │ │ +438 │ │ │ │ +_4_4_3 void _s_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s(std::size_t steps) │ │ │ │ +444 { │ │ │ │ +445 preSmoothSteps_=steps; │ │ │ │ +446 } │ │ │ │ +_4_5_1 std::size_t _g_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ +452 { │ │ │ │ +453 return preSmoothSteps_; │ │ │ │ +454 } │ │ │ │ +455 │ │ │ │ +_4_6_0 void _s_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s(std::size_t steps) │ │ │ │ +461 { │ │ │ │ +462 postSmoothSteps_=steps; │ │ │ │ +463 } │ │ │ │ +_4_6_8 std::size_t _g_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ +469 { │ │ │ │ +470 return postSmoothSteps_; │ │ │ │ +471 } │ │ │ │ +472 │ │ │ │ +_4_7_6 void _s_e_t_G_a_m_m_a(std::size_t gamma) │ │ │ │ +477 { │ │ │ │ +478 gamma_=gamma; │ │ │ │ +479 } │ │ │ │ +_4_8_3 std::size_t _g_e_t_G_a_m_m_a() const │ │ │ │ +484 { │ │ │ │ +485 return gamma_; │ │ │ │ +486 } │ │ │ │ +487 │ │ │ │ +_4_9_2 void _s_e_t_A_d_d_i_t_i_v_e(bool additive) │ │ │ │ +493 { │ │ │ │ +494 additive_=additive; │ │ │ │ +495 } │ │ │ │ +496 │ │ │ │ +_5_0_1 bool _g_e_t_A_d_d_i_t_i_v_e() const │ │ │ │ +502 { │ │ │ │ +503 return additive_; │ │ │ │ +504 } │ │ │ │ +505 │ │ │ │ +_5_1_6 _P_a_r_a_m_e_t_e_r_s(int _m_a_x_L_e_v_e_l=100, int _c_o_a_r_s_e_n_T_a_r_g_e_t=1000, double │ │ │ │ +_m_i_n_C_o_a_r_s_e_n_R_a_t_e=1.2, │ │ │ │ +517 double prolongDamp=1.6, _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e _a_c_c_u_m_u_l_a_t_e=_s_u_c_c_e_s_s_i_v_e_A_c_c_u, bool │ │ │ │ +_u_s_e_F_i_x_e_d_O_r_d_e_r = false) │ │ │ │ +518 : _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s(_m_a_x_L_e_v_e_l, _c_o_a_r_s_e_n_T_a_r_g_e_t, _m_i_n_C_o_a_r_s_e_n_R_a_t_e, │ │ │ │ +prolongDamp, _a_c_c_u_m_u_l_a_t_e, _u_s_e_F_i_x_e_d_O_r_d_e_r) │ │ │ │ +519 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1), │ │ │ │ +520 additive_(false) │ │ │ │ +521 {} │ │ │ │ +522 private: │ │ │ │ +523 int debugLevel_; │ │ │ │ +524 std::size_t preSmoothSteps_; │ │ │ │ +525 std::size_t postSmoothSteps_; │ │ │ │ +526 std::size_t gamma_; │ │ │ │ +527 bool additive_; │ │ │ │ +528 }; │ │ │ │ +529 │ │ │ │ +530 } //namespace AMG │ │ │ │ +531 │ │ │ │ +532} //namespace Dune │ │ │ │ +533#endif │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c │ │ │ │ +void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ +Sets reasonable default values for an anisotropic problem. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:132 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_d_d_i_t_i_v_e │ │ │ │ +void setAdditive(bool additive) │ │ │ │ +Set whether to use additive multigrid. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:492 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_S_k_i_p_I_s_o_l_a_t_e_d │ │ │ │ +void setSkipIsolated(bool skip) │ │ │ │ +Set whether isolated aggregates will not be represented on the coarse level. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:171 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ +void setProlongationDampingFactor(double d) │ │ │ │ +Set the damping factor for the prolongation. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:345 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ +CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double │ │ │ │ +minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode │ │ │ │ +accumulate=successiveAccu, bool useFixedOrder=false) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:372 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_a_l_p_h_a │ │ │ │ +double alpha() const │ │ │ │ +Get the scaling value for marking connections as strong. Default value is 1/3. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ +void setMaxAggregateSize(std::size_t size) │ │ │ │ +Set the maximum number of nodes a aggregate is allowed to have. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:201 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_i_n_C_o_a_r_s_e_n_R_a_t_e │ │ │ │ +void setMinCoarsenRate(double rate) │ │ │ │ +Set the minimum coarsening rate to be achieved in each coarsening. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:295 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_m_i_n_C_o_a_r_s_e_n_R_a_t_e │ │ │ │ +double minCoarsenRate() const │ │ │ │ +Get the minimum coarsening rate to be achieved. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:303 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ +std::size_t maxAggregateSize() const │ │ │ │ +Get the maximum number of nodes a aggregate is allowed to have. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:193 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_l_p_h_a │ │ │ │ +void setAlpha(double a) │ │ │ │ +Set the scaling value for marking connections as strong. Default value is 1/3. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:61 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, │ │ │ │ +double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool │ │ │ │ +useFixedOrder=false) │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:516 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_b_e_t_a │ │ │ │ +double beta() const │ │ │ │ +Get the threshold for marking nodes as isolated. The default value is 1.0E-5. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:52 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_C_o_n_n_e_c_t_i_v_i_t_y │ │ │ │ +std::size_t maxConnectivity() const │ │ │ │ +Get the maximum number of connections a aggregate is allowed to have. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:210 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_c_o_a_r_s_e_n_T_a_r_g_e_t │ │ │ │ +int coarsenTarget() const │ │ │ │ +Get the maximum number of unknowns allowed on the coarsest level. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:285 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_c_c_u_m_u_l_a_t_e │ │ │ │ +void setAccumulate(AccumulationMode accu) │ │ │ │ +Set whether the data should be accumulated on fewer processes on coarser │ │ │ │ +levels. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:318 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ +double getProlongationDampingFactor() const │ │ │ │ +Get the damping factor for the prolongation. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:355 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_a_c_c_u_m_u_l_a_t_e │ │ │ │ +AccumulationMode accumulate() const │ │ │ │ +Whether the data should be accumulated on fewer processes on coarser levels. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:311 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_U_s_e_F_i_x_e_d_O_r_d_e_r │ │ │ │ +void setUseFixedOrder(bool useFixedOrder) │ │ │ │ +DDeeffiinniittiioonn parameters.hh:335 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_u_s_e_F_i_x_e_d_O_r_d_e_r │ │ │ │ +bool useFixedOrder() const │ │ │ │ +Check if the indices for the coarser levels should be created in a fixed order. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:330 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_C_o_n_n_e_c_t_i_v_i_t_y │ │ │ │ +void setMaxConnectivity(std::size_t connectivity) │ │ │ │ +Set the maximum number of connections a aggregate is allowed to have. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:219 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ +std::size_t minAggregateSize() const │ │ │ │ +Get the minimum number of nodes a aggregate has to consist of. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:180 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_A_d_d_i_t_i_v_e │ │ │ │ +bool getAdditive() const │ │ │ │ +Get whether to use additive multigrid. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:501 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_L_e_v_e_l │ │ │ │ +void setMaxLevel(int l) │ │ │ │ +Set the maximum number of levels allowed in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:262 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_D_e_b_u_g_L_e_v_e_l │ │ │ │ +void setDebugLevel(int level) │ │ │ │ +Set the debugging level. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:424 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_G_a_m_m_a │ │ │ │ +std::size_t getGamma() const │ │ │ │ +Get the value of gamma; 1 for V-cycle, 2 for W-cycle. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:483 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ +void setNoPostSmoothSteps(std::size_t steps) │ │ │ │ +Set the number of postsmoothing steps to apply. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:460 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ +std::size_t getNoPreSmoothSteps() const │ │ │ │ +Get the number of presmoothing steps to apply. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:451 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ +DependencyParameters() │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:34 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ +void setMinAggregateSize(std::size_t size) │ │ │ │ +Set the minimum number of nodes a aggregate has to consist of. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:187 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_L_e_v_e_l │ │ │ │ +int maxLevel() const │ │ │ │ +Get the maximum number of levels allowed in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:269 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c │ │ │ │ +void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ +Sets reasonable default values for an isotropic problem. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:109 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ +AggregationParameters() │ │ │ │ +Constructor. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:95 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_k_i_p_I_s_o_l_a_t_e_d │ │ │ │ +bool skipIsolated() const │ │ │ │ +Whether isolated aggregates will not be represented on the coarse level. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:161 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_C_o_a_r_s_e_n_T_a_r_g_e_t │ │ │ │ +void setCoarsenTarget(int nodes) │ │ │ │ +Set the maximum number of unknowns allowed on the coarsest level. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:277 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ +void setNoPreSmoothSteps(std::size_t steps) │ │ │ │ +Set the number of presmoothing steps to apply. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:443 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e │ │ │ │ +AccumulationMode │ │ │ │ +Identifiers for the different accumulation modes. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:231 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_B_e_t_a │ │ │ │ +void setBeta(double b) │ │ │ │ +Set threshold for marking nodes as isolated. The default value is 1.0E-5. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:42 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_D_i_s_t_a_n_c_e │ │ │ │ +std::size_t maxDistance() const │ │ │ │ +Get the maximal distance allowed between two nodes in a aggregate. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:144 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_G_a_m_m_a │ │ │ │ +void setGamma(std::size_t gamma) │ │ │ │ +Set the value of gamma; 1 for V-cycle, 2 for W-cycle. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:476 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_c_c_u_m_u_l_a_t_e │ │ │ │ +void setAccumulate(bool accu) │ │ │ │ +DDeeffiinniittiioonn parameters.hh:323 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_D_i_s_t_a_n_c_e │ │ │ │ +void setMaxDistance(std::size_t distance) │ │ │ │ +Set the maximal distance allowed between two nodes in a aggregate. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:154 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_d_e_b_u_g_L_e_v_e_l │ │ │ │ +int debugLevel() const │ │ │ │ +Get the debugging Level. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:434 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ +std::size_t getNoPostSmoothSteps() const │ │ │ │ +Get the number of postsmoothing steps to apply. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:468 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ +@ atOnceAccu │ │ │ │ +Accumulate data to one process at once. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:243 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ +@ noAccu │ │ │ │ +No data accumulution. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:237 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u │ │ │ │ +@ successiveAccu │ │ │ │ +Successively accumulate to fewer processes. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:247 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -SequentialInformation() │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:89 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_g_l_o_b_a_l_S_u_m │ │ │ │ -T globalSum(const T &t) const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:49 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_C_o_p_y_F_l_a_g_s │ │ │ │ -EmptySet< int > CopyFlags │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:31 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_d_o_t │ │ │ │ -void dot(const T1 &x, const T1 &y, T2 &result) const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:74 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_O_w_n_e_r_S_e_t │ │ │ │ -AllSet< int > OwnerSet │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:32 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ -void copyOwnerToAll(V &v, V &v1) const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:66 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ -MPICommunicator communicator() const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:38 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_b_u_i_l_d_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ -void buildGlobalLookup(std::size_t) │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:56 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_p_r_o_j_e_c_t │ │ │ │ -void project(V &v) const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:70 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_M_P_I_C_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ -Communication< void * > MPICommunicator │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:30 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -SequentialInformation(const Communication< T > &) │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:86 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_g_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ -const GlobalLookupIndexSet & globalLookup() const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:60 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -SequentialInformation(const SequentialInformation &) │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:92 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_n_o_r_m │ │ │ │ -FieldTraits< typenameT1::field_type >::real_type norm(const T1 &x) const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:80 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_f_r_e_e_G_l_o_b_a_l_L_o_o_k_u_p │ │ │ │ -void freeGlobalLookup() │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:58 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -int GlobalLookupIndexSet │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:54 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:34 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_p_r_o_c_s │ │ │ │ -int procs() const │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:43 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ +Parameters needed to check whether a node depends on another. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:31 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ +Parameters needed for the aggregation process. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:84 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ +Parameters for the complete coarsening process. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:257 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ +All parameters for AMG. │ │ │ │ +DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: parameters.hh File Reference │ │ │ +dune-istl: indicescoarsener.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,61 +71,52 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Enumerations
│ │ │ - │ │ │ +Namespaces
│ │ │ + │ │ │ │ │ │
│ │ │ │ │ │ -

Parameter classes for customizing AMG. │ │ │ +

Provides a class for building the index set and remote indices on the coarse level. │ │ │ More...

│ │ │ -
#include <cstddef>
│ │ │ +
#include <dune/common/parallel/indicessyncer.hh>
│ │ │ +#include <vector>
│ │ │ +#include "renumberer.hh"
│ │ │ +#include <dune/istl/owneroverlapcopy.hh>
│ │ │ +#include "pinfo.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::DependencyParameters
 Parameters needed to check whether a node depends on another. More...
class  Dune::Amg::IndicesCoarsener< T, E >
 
class  Dune::Amg::AggregationParameters
 Parameters needed for the aggregation process. More...
class  Dune::Amg::ParallelIndicesCoarsener< T, E >
 
class  Dune::Amg::CoarseningParameters
 Parameters for the complete coarsening process. More...
class  Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E >
 Coarsen Indices in the parallel case. More...
 
class  Dune::Amg::Parameters
 All parameters for AMG. More...
class  Dune::Amg::IndicesCoarsener< SequentialInformation, E >
 Coarsen Indices in the sequential case. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │

│ │ │ -Enumerations

enum  Dune::Amg::AccumulationMode { Dune::Amg::noAccu = 0 │ │ │ -, Dune::Amg::atOnceAccu =1 │ │ │ -, Dune::Amg::successiveAccu =2 │ │ │ - }
 Identifiers for the different accumulation modes. More...
 
│ │ │

Detailed Description

│ │ │ -

Parameter classes for customizing AMG.

│ │ │ +

Provides a class for building the index set and remote indices on the coarse level.

│ │ │
Author
Markus Blatt
│ │ │ -

All parameters of the AMG can be set by using the class Parameter, which can be provided to CoarsenCriterion via its constructor.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,45 +1,42 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _E_n_u_m_e_r_a_t_i_o_n_s │ │ │ │ -parameters.hh File Reference │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +indicescoarsener.hh File Reference │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Parameter classes for customizing AMG. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ +Provides a class for building the index set and remote indices on the coarse │ │ │ │ +level. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +#include "_p_i_n_f_o_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ -  _P_a_r_a_m_e_t_e_r_s needed to check whether a node depends on another. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _T_,_ _E_ _> │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ -  _P_a_r_a_m_e_t_e_r_s needed for the aggregation process. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _T_,_ _E_ _> │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ -  _P_a_r_a_m_e_t_e_r_s for the complete coarsening process. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _G_,_ _L_ _>_,_ _E_ _> │ │ │ │ +  Coarsen Indices in the parallel case. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ -  All parameters for _A_M_G. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_,_ _E_ _> │ │ │ │ +  Coarsen Indices in the sequential case. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ -EEnnuummeerraattiioonnss │ │ │ │ -enum   _D_u_n_e_:_:_A_m_g_:_:_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e { _D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u = 0 , _D_u_n_e_:_:_A_m_g_:_: │ │ │ │ - _a_t_O_n_c_e_A_c_c_u =1 , _D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u =2 } │ │ │ │ -  Identifiers for the different accumulation modes. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Parameter classes for customizing AMG. │ │ │ │ +Provides a class for building the index set and remote indices on the coarse │ │ │ │ +level. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ -All parameters of the AMG can be set by using the class Parameter, which can be │ │ │ │ -provided to CoarsenCriterion via its constructor. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: parameters.hh Source File │ │ │ +dune-istl: indicescoarsener.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,410 +74,442 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
parameters.hh
│ │ │ +
indicescoarsener.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_PARAMETERS_HH
│ │ │ -
6#define DUNE_AMG_PARAMETERS_HH
│ │ │ +
5#ifndef DUNE_AMG_INDICESCOARSENER_HH
│ │ │ +
6#define DUNE_AMG_INDICESCOARSENER_HH
│ │ │
7
│ │ │ -
8#include <cstddef>
│ │ │ -
9
│ │ │ -
10namespace Dune
│ │ │ -
11{
│ │ │ -
12 namespace Amg
│ │ │ -
13 {
│ │ │ -
│ │ │ - │ │ │ -
31 {
│ │ │ -
32 public:
│ │ │ -
│ │ │ - │ │ │ -
35 : alpha_(1.0/3.0), beta_(1.0E-5)
│ │ │ -
36 {}
│ │ │ +
8#include <dune/common/parallel/indicessyncer.hh>
│ │ │ +
9#include <vector>
│ │ │ +
10#include "renumberer.hh"
│ │ │ +
11
│ │ │ +
12#if HAVE_MPI
│ │ │ + │ │ │ +
14#endif
│ │ │ +
15
│ │ │ +
16#include "pinfo.hh"
│ │ │ +
17
│ │ │ +
18namespace Dune
│ │ │ +
19{
│ │ │ +
20 namespace Amg
│ │ │ +
21 {
│ │ │ +
22
│ │ │ +
34 template<typename T, typename E>
│ │ │ +
│ │ │ + │ │ │ +
36 {};
│ │ │
│ │ │
37
│ │ │ -
│ │ │ -
42 void setBeta(double b)
│ │ │ -
43 {
│ │ │ -
44 beta_ = b;
│ │ │ -
45 }
│ │ │ -
│ │ │ -
46
│ │ │ -
│ │ │ -
52 double beta() const
│ │ │ -
53 {
│ │ │ -
54 return beta_;
│ │ │ -
55 }
│ │ │ -
│ │ │ +
38
│ │ │ +
39#if HAVE_MPI
│ │ │ +
40
│ │ │ +
41 template<typename T, typename E>
│ │ │ +
│ │ │ + │ │ │ +
43 {
│ │ │ +
44 public:
│ │ │ + │ │ │ +
49
│ │ │ + │ │ │ +
54
│ │ │ +
55 typedef typename ParallelInformation::ParallelIndexSet ParallelIndexSet;
│ │ │
56
│ │ │ -
│ │ │ -
61 void setAlpha(double a)
│ │ │ -
62 {
│ │ │ -
63 alpha_ = a;
│ │ │ -
64 }
│ │ │ -
│ │ │ -
65
│ │ │ -
│ │ │ -
70 double alpha() const
│ │ │ -
71 {
│ │ │ -
72 return alpha_;
│ │ │ -
73 }
│ │ │ -
│ │ │ -
74
│ │ │ -
75 private:
│ │ │ -
76 double alpha_, beta_;
│ │ │ -
77 };
│ │ │ -
│ │ │ -
78
│ │ │ -
│ │ │ - │ │ │ - │ │ │ -
84 {
│ │ │ -
85 public:
│ │ │ -
│ │ │ - │ │ │ -
96 : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6),
│ │ │ -
97 connectivity_(15), skipiso_(false)
│ │ │ -
98 {}
│ │ │ -
│ │ │ -
99
│ │ │ -
│ │ │ -
109 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
│ │ │ -
110 {
│ │ │ -
111 maxDistance_=diameter-1;
│ │ │ -
112 std::size_t csize=1;
│ │ │ +
60 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ +
61
│ │ │ +
65 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ +
66
│ │ │ +
70 typedef typename LocalIndex::Attribute Attribute;
│ │ │ +
71
│ │ │ +
75 typedef Dune::RemoteIndices<ParallelIndexSet> RemoteIndices;
│ │ │ +
76
│ │ │ +
92 template<typename Graph, typename VM>
│ │ │ +
93 static typename Graph::VertexDescriptor
│ │ │ +
│ │ │ + │ │ │ +
95 Graph& fineGraph,
│ │ │ +
96 VM& visitedMap,
│ │ │ + │ │ │ +
98 ParallelInformation& coarseInfo,
│ │ │ +
99 typename Graph::VertexDescriptor noAggregates,
│ │ │ +
100 bool useFixedOrder = false);
│ │ │ +
101
│ │ │ +
102 private:
│ │ │ +
103 template<typename G, typename I>
│ │ │ +
104 class ParallelAggregateRenumberer : public AggregateRenumberer<G>
│ │ │ +
105 {
│ │ │ +
106 typedef typename G::VertexDescriptor Vertex;
│ │ │ +
107
│ │ │ +
108 typedef I GlobalLookupIndexSet;
│ │ │ +
109
│ │ │ +
110 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ +
111
│ │ │ +
112 typedef typename IndexPair::GlobalIndex GlobalIndex;
│ │ │
113
│ │ │ -
114 for(; dim>0; dim--) {
│ │ │ -
115 csize*=diameter;
│ │ │ -
116 maxDistance_+=diameter-1;
│ │ │ -
117 }
│ │ │ -
118 minAggregateSize_=csize;
│ │ │ -
119 maxAggregateSize_=static_cast<std::size_t>(csize*1.5);
│ │ │ -
120 }
│ │ │ +
114 public:
│ │ │ +
│ │ │ + │ │ │ +
116 : AggregateRenumberer<G>(aggregates), isPublic_(false), lookup_(lookup),
│ │ │ +
117 globalIndex_(std::numeric_limits<GlobalIndex>::max())
│ │ │ +
118 {}
│ │ │ +
│ │ │ +
119
│ │ │ +
120
│ │ │ +
│ │ │ +
121 void operator()(const typename G::ConstEdgeIterator& edge)
│ │ │ +
122 {
│ │ │ + │ │ │ +
124 const IndexPair* pair= lookup_.pair(edge.target());
│ │ │ +
125 if(pair!=0) {
│ │ │ +
126 globalIndex(pair->global());
│ │ │ +
127 attribute(pair->local().attribute());
│ │ │ +
128 isPublic(pair->local().isPublic());
│ │ │ +
129 }
│ │ │ +
130 }
│ │ │
│ │ │ -
121
│ │ │ +
131
│ │ │
│ │ │ -
132 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ -
133 {
│ │ │ -
134 setDefaultValuesIsotropic(dim, diameter);
│ │ │ -
135 maxDistance_+=dim-1;
│ │ │ -
136 }
│ │ │ -
│ │ │ -
144 std::size_t maxDistance() const { return maxDistance_;}
│ │ │ -
145
│ │ │ -
154 void setMaxDistance(std::size_t distance) { maxDistance_ = distance;}
│ │ │ -
155
│ │ │ -
│ │ │ -
161 bool skipIsolated() const
│ │ │ -
162 {
│ │ │ -
163 return skipiso_;
│ │ │ -
164 }
│ │ │ -
│ │ │ -
165
│ │ │ -
│ │ │ -
171 void setSkipIsolated(bool skip)
│ │ │ -
172 {
│ │ │ -
173 skipiso_=skip;
│ │ │ -
174 }
│ │ │ -
│ │ │ -
175
│ │ │ -
180 std::size_t minAggregateSize() const { return minAggregateSize_;}
│ │ │ +
132 Vertex operator()([[maybe_unused]] const GlobalIndex& global)
│ │ │ +
133 {
│ │ │ +
134 Vertex current = this->number_;
│ │ │ +
135 this->operator++();
│ │ │ +
136 return current;
│ │ │ +
137 }
│ │ │ +
│ │ │ +
138
│ │ │ +
│ │ │ +
139 bool isPublic()
│ │ │ +
140 {
│ │ │ +
141 return isPublic_;
│ │ │ +
142 }
│ │ │ +
│ │ │ +
143
│ │ │ +
│ │ │ +
144 void isPublic(bool b)
│ │ │ +
145 {
│ │ │ +
146 isPublic_ = isPublic_ || b;
│ │ │ +
147 }
│ │ │ +
│ │ │ +
148
│ │ │ +
│ │ │ +
149 void reset()
│ │ │ +
150 {
│ │ │ +
151 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
│ │ │ +
152 isPublic_=false;
│ │ │ +
153 }
│ │ │ +
│ │ │ +
154
│ │ │ +
│ │ │ + │ │ │ +
156 {
│ │ │ +
157 attribute_=attribute;
│ │ │ +
158 }
│ │ │ +
│ │ │ +
159
│ │ │ +
│ │ │ + │ │ │ +
161 {
│ │ │ +
162 return attribute_;
│ │ │ +
163 }
│ │ │ +
│ │ │ +
164
│ │ │ +
│ │ │ +
165 const GlobalIndex& globalIndex() const
│ │ │ +
166 {
│ │ │ +
167 return globalIndex_;
│ │ │ +
168 }
│ │ │ +
│ │ │ +
169
│ │ │ +
│ │ │ +
170 void globalIndex(const GlobalIndex& global)
│ │ │ +
171 {
│ │ │ +
172 globalIndex_ = global;
│ │ │ +
173 }
│ │ │ +
│ │ │ +
174
│ │ │ +
175 private:
│ │ │ +
176 bool isPublic_;
│ │ │ +
177 Attribute attribute_;
│ │ │ +
178 const GlobalLookupIndexSet& lookup_;
│ │ │ +
179 GlobalIndex globalIndex_;
│ │ │ +
180 };
│ │ │
181
│ │ │ -
187 void setMinAggregateSize(std::size_t size){ minAggregateSize_=size;}
│ │ │ -
188
│ │ │ -
193 std::size_t maxAggregateSize() const { return maxAggregateSize_;}
│ │ │ -
194
│ │ │ -
201 void setMaxAggregateSize(std::size_t size){ maxAggregateSize_ = size;}
│ │ │ -
202
│ │ │ -
210 std::size_t maxConnectivity() const { return connectivity_;}
│ │ │ -
211
│ │ │ -
219 void setMaxConnectivity(std::size_t connectivity){ connectivity_ = connectivity;}
│ │ │ -
220
│ │ │ -
221 private:
│ │ │ -
222 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, connectivity_;
│ │ │ -
223 bool skipiso_;
│ │ │ -
224
│ │ │ -
225 };
│ │ │ -
│ │ │ -
226
│ │ │ -
227
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
248 };
│ │ │ -
│ │ │ +
182 template<typename Graph, typename VM, typename I>
│ │ │ +
183 static void buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ +
184 Graph& fineGraph,
│ │ │ +
185 VM& visitedMap,
│ │ │ + │ │ │ +
187 ParallelIndexSet& coarseIndices,
│ │ │ +
188 ParallelAggregateRenumberer<Graph,I>& renumberer);
│ │ │ +
189
│ │ │ +
190 template<typename Graph,typename I>
│ │ │ +
191 static void buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ + │ │ │ +
193 ParallelIndexSet& coarseIndices,
│ │ │ +
194 RemoteIndices& coarseRemote,
│ │ │ +
195 ParallelAggregateRenumberer<Graph,I>& renumberer,
│ │ │ +
196 bool useFixedOrder);
│ │ │ +
197
│ │ │ +
198 };
│ │ │ +
199
│ │ │ +
203 template<typename G, typename L, typename E>
│ │ │ +
│ │ │ + │ │ │ +
205 : public ParallelIndicesCoarsener<OwnerOverlapCopyCommunication<G,L>,E>
│ │ │ +
206 {};
│ │ │ +
│ │ │ +
207
│ │ │ +
208
│ │ │ +
209#endif
│ │ │ +
210
│ │ │ +
217 template<typename E>
│ │ │ +
│ │ │ + │ │ │ +
219 {
│ │ │ +
220 public:
│ │ │ +
221 template<typename Graph, typename VM>
│ │ │ +
222 static typename Graph::VertexDescriptor
│ │ │ +
223 coarsen(const SequentialInformation & fineInfo,
│ │ │ +
224 Graph& fineGraph,
│ │ │ +
225 VM& visitedMap,
│ │ │ + │ │ │ +
227 SequentialInformation& coarseInfo,
│ │ │ +
228 typename Graph::VertexDescriptor noAggregates,
│ │ │ +
229 bool useFixedOrder = false);
│ │ │ +
230 };
│ │ │ +
│ │ │ +
231
│ │ │ +
232#if HAVE_MPI
│ │ │ +
233 template<typename T, typename E>
│ │ │ +
234 template<typename Graph, typename VM>
│ │ │ +
235 inline typename Graph::VertexDescriptor
│ │ │ +
│ │ │ + │ │ │ +
237 Graph& fineGraph,
│ │ │ +
238 VM& visitedMap,
│ │ │ + │ │ │ +
240 ParallelInformation& coarseInfo,
│ │ │ +
241 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates,
│ │ │ +
242 bool useFixedOrder)
│ │ │ +
243 {
│ │ │ +
244 ParallelAggregateRenumberer<Graph,typename ParallelInformation::GlobalLookupIndexSet> renumberer(aggregates, fineInfo.globalLookup());
│ │ │ +
245 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates,
│ │ │ +
246 coarseInfo.indexSet(), renumberer);
│ │ │ +
247 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, coarseInfo.indexSet(),
│ │ │ +
248 coarseInfo.remoteIndices(), renumberer, useFixedOrder);
│ │ │
249
│ │ │ -
250
│ │ │ -
251
│ │ │ -
252
│ │ │ -
│ │ │ - │ │ │ -
257 {
│ │ │ -
258 public:
│ │ │ -
│ │ │ -
262 void setMaxLevel(int l)
│ │ │ -
263 {
│ │ │ -
264 maxLevel_ = l;
│ │ │ -
265 }
│ │ │ -
│ │ │ -
│ │ │ -
269 int maxLevel() const
│ │ │ -
270 {
│ │ │ -
271 return maxLevel_;
│ │ │ -
272 }
│ │ │ -
│ │ │ -
273
│ │ │ -
│ │ │ -
277 void setCoarsenTarget(int nodes)
│ │ │ -
278 {
│ │ │ -
279 coarsenTarget_ = nodes;
│ │ │ -
280 }
│ │ │ -
│ │ │ -
281
│ │ │ -
│ │ │ -
285 int coarsenTarget() const
│ │ │ -
286 {
│ │ │ -
287 return coarsenTarget_;
│ │ │ -
288 }
│ │ │ -
│ │ │ -
289
│ │ │ -
│ │ │ -
295 void setMinCoarsenRate(double rate)
│ │ │ -
296 {
│ │ │ -
297 minCoarsenRate_ = rate;
│ │ │ -
298 }
│ │ │ -
│ │ │ -
299
│ │ │ -
│ │ │ -
303 double minCoarsenRate() const
│ │ │ -
304 {
│ │ │ -
305 return minCoarsenRate_;
│ │ │ -
306 }
│ │ │ -
│ │ │ -
307
│ │ │ -
│ │ │ - │ │ │ -
312 {
│ │ │ -
313 return accumulate_;
│ │ │ -
314 }
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
319 {
│ │ │ -
320 accumulate_=accu;
│ │ │ -
321 }
│ │ │ +
250 return renumberer;
│ │ │ +
251 }
│ │ │ +
│ │ │
│ │ │ +
252
│ │ │ +
253 template<typename T, typename E>
│ │ │ +
254 template<typename Graph, typename VM, typename I>
│ │ │ +
255 void ParallelIndicesCoarsener<T,E>::buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ +
256 Graph& fineGraph,
│ │ │ +
257 VM& visitedMap,
│ │ │ + │ │ │ +
259 ParallelIndexSet& coarseIndices,
│ │ │ +
260 ParallelAggregateRenumberer<Graph,I>& renumberer)
│ │ │ +
261 {
│ │ │ +
262 // fineGraph is the local subgraph corresponding to the vertices the process owns.
│ │ │ +
263 // i.e. no overlap/copy vertices can be visited traversing the graph
│ │ │ +
264 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ +
265 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
│ │ │ +
266
│ │ │ +
267 Iterator end = fineGraph.end();
│ │ │ +
268 const GlobalLookupIndexSet& lookup = pinfo.globalLookup();
│ │ │ +
269
│ │ │ +
270 coarseIndices.beginResize();
│ │ │ +
271
│ │ │ +
272 // Setup the coarse index set and renumber the aggregate consecutively
│ │ │ +
273 // ascending from zero according to the minimum global index belonging
│ │ │ +
274 // to the aggregate
│ │ │ +
275 for(Iterator index = fineGraph.begin(); index != end; ++index) {
│ │ │ + │ │ │ +
277 // Isolated vertices will not be represented on the next level.
│ │ │ +
278 // These should only be there if skipIsolated is activiated in
│ │ │ +
279 // the coarsening criterion as otherwise they will be aggregated
│ │ │ +
280 // and should have real aggregate number in the map right now.
│ │ │ +
281 if(!get(visitedMap, *index)) {
│ │ │ +
282 // This vertex was not visited by breadthFirstSearch yet.
│ │ │ +
283 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ +
284 const IndexPair* pair= lookup.pair(*index);
│ │ │ +
285
│ │ │ +
286 renumberer.reset(); // reset attribute and global index.
│ │ │ +
287 if(pair!=0) {
│ │ │ +
288 // vertex is in the index set. Note that not all vertices have
│ │ │ +
289 // to be in the index set, just the ones where communication
│ │ │ +
290 // will happen.
│ │ │ +
291 assert(!ExcludedAttributes::contains(pair->local().attribute()));
│ │ │ +
292 renumberer.attribute(pair->local().attribute());
│ │ │ +
293 renumberer.isPublic(pair->local().isPublic());
│ │ │ +
294 renumberer.globalIndex(pair->global());
│ │ │ +
295 }
│ │ │ +
296
│ │ │ +
297 // Reconstruct aggregate and mark vertices as visited
│ │ │ +
298 aggregates.template breadthFirstSearch<false>(*index, aggregates[*index],
│ │ │ +
299 fineGraph, renumberer, visitedMap);
│ │ │ +
300
│ │ │ +
301 if(renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
│ │ │ +
302 // vertex is in the index set.
│ │ │ +
303 //std::cout <<" Adding global="<< renumberer.globalIndex()<<" local="<<static_cast<std::size_t>(renumberer)<<std::endl;
│ │ │ +
304 coarseIndices.add(renumberer.globalIndex(),
│ │ │ +
305 LocalIndex(renumberer, renumberer.attribute(),
│ │ │ +
306 renumberer.isPublic()));
│ │ │ +
307 }
│ │ │ +
308
│ │ │ +
309 aggregates[*index] = renumberer;
│ │ │ +
310 ++renumberer;
│ │ │ +
311 }
│ │ │ +
312 }
│ │ │ +
313
│ │ │ +
314 coarseIndices.endResize();
│ │ │ +
315
│ │ │ +
316 assert(static_cast<std::size_t>(renumberer) >= coarseIndices.size());
│ │ │ +
317
│ │ │ +
318 // Reset the visited flags
│ │ │ +
319 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex)
│ │ │ +
320 put(visitedMap, *vertex, false);
│ │ │ +
321 }
│ │ │
322
│ │ │ -
│ │ │ -
323 void setAccumulate(bool accu){
│ │ │ -
324 accumulate_=accu ? successiveAccu : noAccu;
│ │ │ -
325 }
│ │ │ -
│ │ │ -
326
│ │ │ -
│ │ │ -
330 bool useFixedOrder() const
│ │ │ -
331 {
│ │ │ -
332 return useFixedOrder_;
│ │ │ -
333 }
│ │ │ -
│ │ │ -
334
│ │ │ -
│ │ │ - │ │ │ -
336 {
│ │ │ -
337 useFixedOrder_ = useFixedOrder;
│ │ │ -
338 }
│ │ │ -
│ │ │ -
339
│ │ │ -
│ │ │ - │ │ │ -
346 {
│ │ │ -
347 dampingFactor_ = d;
│ │ │ -
348 }
│ │ │ -
│ │ │ -
349
│ │ │ -
│ │ │ - │ │ │ -
356 {
│ │ │ -
357 return dampingFactor_;
│ │ │ -
358 }
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
373 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu,
│ │ │ -
374 bool useFixedOrder = false)
│ │ │ -
375 : maxLevel_(maxLevel), coarsenTarget_(coarsenTarget), minCoarsenRate_(minCoarsenRate),
│ │ │ -
376 dampingFactor_(prolongDamp), accumulate_( accumulate), useFixedOrder_(useFixedOrder)
│ │ │ -
377 {}
│ │ │ -
│ │ │ -
378
│ │ │ -
379 private:
│ │ │ -
383 int maxLevel_;
│ │ │ -
387 int coarsenTarget_;
│ │ │ -
391 double minCoarsenRate_;
│ │ │ -
395 double dampingFactor_;
│ │ │ -
400 AccumulationMode accumulate_;
│ │ │ -
406 bool useFixedOrder_;
│ │ │ -
407 };
│ │ │ -
│ │ │ -
408
│ │ │ -
│ │ │ - │ │ │ -
416 {
│ │ │ -
417 public:
│ │ │ -
│ │ │ -
424 void setDebugLevel(int level)
│ │ │ -
425 {
│ │ │ -
426 debugLevel_ = level;
│ │ │ -
427 }
│ │ │ -
│ │ │ -
428
│ │ │ -
│ │ │ -
434 int debugLevel() const
│ │ │ -
435 {
│ │ │ -
436 return debugLevel_;
│ │ │ -
437 }
│ │ │ -
│ │ │ -
438
│ │ │ -
│ │ │ -
443 void setNoPreSmoothSteps(std::size_t steps)
│ │ │ -
444 {
│ │ │ -
445 preSmoothSteps_=steps;
│ │ │ -
446 }
│ │ │ -
│ │ │ -
│ │ │ -
451 std::size_t getNoPreSmoothSteps() const
│ │ │ -
452 {
│ │ │ -
453 return preSmoothSteps_;
│ │ │ -
454 }
│ │ │ -
│ │ │ -
455
│ │ │ -
│ │ │ -
460 void setNoPostSmoothSteps(std::size_t steps)
│ │ │ -
461 {
│ │ │ -
462 postSmoothSteps_=steps;
│ │ │ -
463 }
│ │ │ -
│ │ │ -
│ │ │ -
468 std::size_t getNoPostSmoothSteps() const
│ │ │ -
469 {
│ │ │ -
470 return postSmoothSteps_;
│ │ │ -
471 }
│ │ │ -
│ │ │ -
472
│ │ │ -
│ │ │ -
476 void setGamma(std::size_t gamma)
│ │ │ -
477 {
│ │ │ -
478 gamma_=gamma;
│ │ │ -
479 }
│ │ │ -
│ │ │ -
│ │ │ -
483 std::size_t getGamma() const
│ │ │ -
484 {
│ │ │ -
485 return gamma_;
│ │ │ -
486 }
│ │ │ -
│ │ │ -
487
│ │ │ -
│ │ │ -
492 void setAdditive(bool additive)
│ │ │ -
493 {
│ │ │ -
494 additive_=additive;
│ │ │ -
495 }
│ │ │ -
│ │ │ -
496
│ │ │ -
│ │ │ -
501 bool getAdditive() const
│ │ │ -
502 {
│ │ │ -
503 return additive_;
│ │ │ -
504 }
│ │ │ -
│ │ │ -
505
│ │ │ -
│ │ │ -
516 Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ -
517 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder = false)
│ │ │ - │ │ │ -
519 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1),
│ │ │ -
520 additive_(false)
│ │ │ -
521 {}
│ │ │ -
│ │ │ -
522 private:
│ │ │ -
523 int debugLevel_;
│ │ │ -
524 std::size_t preSmoothSteps_;
│ │ │ -
525 std::size_t postSmoothSteps_;
│ │ │ -
526 std::size_t gamma_;
│ │ │ -
527 bool additive_;
│ │ │ -
528 };
│ │ │ -
│ │ │ -
529
│ │ │ -
530 } //namespace AMG
│ │ │ -
531
│ │ │ -
532} //namespace Dune
│ │ │ -
533#endif
│ │ │ -
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an anisotropic problem.
Definition parameters.hh:132
│ │ │ -
void setAdditive(bool additive)
Set whether to use additive multigrid.
Definition parameters.hh:492
│ │ │ -
void setSkipIsolated(bool skip)
Set whether isolated aggregates will not be represented on the coarse level.
Definition parameters.hh:171
│ │ │ -
void setProlongationDampingFactor(double d)
Set the damping factor for the prolongation.
Definition parameters.hh:345
│ │ │ -
CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition parameters.hh:372
│ │ │ -
double alpha() const
Get the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:70
│ │ │ -
void setMaxAggregateSize(std::size_t size)
Set the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:201
│ │ │ -
void setMinCoarsenRate(double rate)
Set the minimum coarsening rate to be achieved in each coarsening.
Definition parameters.hh:295
│ │ │ -
double minCoarsenRate() const
Get the minimum coarsening rate to be achieved.
Definition parameters.hh:303
│ │ │ -
std::size_t maxAggregateSize() const
Get the maximum number of nodes a aggregate is allowed to have.
Definition parameters.hh:193
│ │ │ -
void setAlpha(double a)
Set the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:61
│ │ │ -
Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition parameters.hh:516
│ │ │ -
double beta() const
Get the threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition parameters.hh:52
│ │ │ -
std::size_t maxConnectivity() const
Get the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:210
│ │ │ -
int coarsenTarget() const
Get the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:285
│ │ │ -
void setAccumulate(AccumulationMode accu)
Set whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:318
│ │ │ -
double getProlongationDampingFactor() const
Get the damping factor for the prolongation.
Definition parameters.hh:355
│ │ │ -
AccumulationMode accumulate() const
Whether the data should be accumulated on fewer processes on coarser levels.
Definition parameters.hh:311
│ │ │ -
void setUseFixedOrder(bool useFixedOrder)
Definition parameters.hh:335
│ │ │ -
bool useFixedOrder() const
Check if the indices for the coarser levels should be created in a fixed order.
Definition parameters.hh:330
│ │ │ -
void setMaxConnectivity(std::size_t connectivity)
Set the maximum number of connections a aggregate is allowed to have.
Definition parameters.hh:219
│ │ │ -
std::size_t minAggregateSize() const
Get the minimum number of nodes a aggregate has to consist of.
Definition parameters.hh:180
│ │ │ -
bool getAdditive() const
Get whether to use additive multigrid.
Definition parameters.hh:501
│ │ │ -
void setMaxLevel(int l)
Set the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:262
│ │ │ -
void setDebugLevel(int level)
Set the debugging level.
Definition parameters.hh:424
│ │ │ -
std::size_t getGamma() const
Get the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:483
│ │ │ -
void setNoPostSmoothSteps(std::size_t steps)
Set the number of postsmoothing steps to apply.
Definition parameters.hh:460
│ │ │ -
std::size_t getNoPreSmoothSteps() const
Get the number of presmoothing steps to apply.
Definition parameters.hh:451
│ │ │ -
DependencyParameters()
Constructor.
Definition parameters.hh:34
│ │ │ -
void setMinAggregateSize(std::size_t size)
Set the minimum number of nodes a aggregate has to consist of.
Definition parameters.hh:187
│ │ │ -
int maxLevel() const
Get the maximum number of levels allowed in the hierarchy.
Definition parameters.hh:269
│ │ │ -
void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an isotropic problem.
Definition parameters.hh:109
│ │ │ -
AggregationParameters()
Constructor.
Definition parameters.hh:95
│ │ │ -
bool skipIsolated() const
Whether isolated aggregates will not be represented on the coarse level.
Definition parameters.hh:161
│ │ │ -
void setCoarsenTarget(int nodes)
Set the maximum number of unknowns allowed on the coarsest level.
Definition parameters.hh:277
│ │ │ -
void setNoPreSmoothSteps(std::size_t steps)
Set the number of presmoothing steps to apply.
Definition parameters.hh:443
│ │ │ -
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:231
│ │ │ -
void setBeta(double b)
Set threshold for marking nodes as isolated. The default value is 1.0E-5.
Definition parameters.hh:42
│ │ │ -
std::size_t maxDistance() const
Get the maximal distance allowed between two nodes in a aggregate.
Definition parameters.hh:144
│ │ │ -
void setGamma(std::size_t gamma)
Set the value of gamma; 1 for V-cycle, 2 for W-cycle.
Definition parameters.hh:476
│ │ │ -
void setAccumulate(bool accu)
Definition parameters.hh:323
│ │ │ -
void setMaxDistance(std::size_t distance)
Set the maximal distance allowed between two nodes in a aggregate.
Definition parameters.hh:154
│ │ │ -
int debugLevel() const
Get the debugging Level.
Definition parameters.hh:434
│ │ │ -
std::size_t getNoPostSmoothSteps() const
Get the number of postsmoothing steps to apply.
Definition parameters.hh:468
│ │ │ -
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ -
@ noAccu
No data accumulution.
Definition parameters.hh:237
│ │ │ -
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │ +
323 template<typename T, typename E>
│ │ │ +
324 template<typename Graph, typename I>
│ │ │ +
325 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ +
326 const AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ +
327 ParallelIndexSet& coarseIndices,
│ │ │ +
328 RemoteIndices& coarseRemote,
│ │ │ +
329 ParallelAggregateRenumberer<Graph,I>& renumberer,
│ │ │ +
330 bool useFixedOrder)
│ │ │ +
331 {
│ │ │ +
332 std::vector<char> attributes(static_cast<std::size_t>(renumberer));
│ │ │ +
333
│ │ │ +
334 GlobalLookupIndexSet<ParallelIndexSet> coarseLookup(coarseIndices, static_cast<std::size_t>(renumberer));
│ │ │ +
335
│ │ │ +
336 typedef typename RemoteIndices::const_iterator Iterator;
│ │ │ +
337 Iterator end = fineRemote.end();
│ │ │ +
338
│ │ │ +
339 for(Iterator neighbour = fineRemote.begin();
│ │ │ +
340 neighbour != end; ++neighbour) {
│ │ │ +
341 int process = neighbour->first;
│ │ │ +
342
│ │ │ +
343 assert(neighbour->second.first==neighbour->second.second);
│ │ │ +
344
│ │ │ +
345 // Mark all as not known
│ │ │ +
346 typedef typename std::vector<char>::iterator CIterator;
│ │ │ +
347
│ │ │ +
348 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter)
│ │ │ +
349 *iter = std::numeric_limits<char>::max();
│ │ │ +
350
│ │ │ +
351 auto riEnd = neighbour->second.second->end();
│ │ │ +
352
│ │ │ +
353 for(auto index = neighbour->second.second->begin();
│ │ │ +
354 index != riEnd; ++index) {
│ │ │ +
355 if(!E::contains(index->localIndexPair().local().attribute()) &&
│ │ │ +
356 aggregates[index->localIndexPair().local()] !=
│ │ │ + │ │ │ +
358 {
│ │ │ +
359 assert(aggregates[index->localIndexPair().local()]<attributes.size());
│ │ │ +
360 if (attributes[aggregates[index->localIndexPair().local()]] != 3)
│ │ │ +
361 attributes[aggregates[index->localIndexPair().local()]] = index->attribute();
│ │ │ +
362 }
│ │ │ +
363 }
│ │ │ +
364
│ │ │ +
365 // Build remote index list
│ │ │ +
366 typedef RemoteIndexListModifier<ParallelIndexSet,typename RemoteIndices::Allocator,false> Modifier;
│ │ │ +
367 typedef typename RemoteIndices::RemoteIndex RemoteIndex;
│ │ │ +
368 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ +
369
│ │ │ +
370 Modifier coarseList = coarseRemote.template getModifier<false,true>(process);
│ │ │ +
371
│ │ │ +
372 IndexIterator iend = coarseIndices.end();
│ │ │ +
373 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index)
│ │ │ +
374 if(attributes[index->local()] != std::numeric_limits<char>::max()) {
│ │ │ +
375 // remote index is present
│ │ │ +
376 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), &(*index)));
│ │ │ +
377 }
│ │ │ +
378 //std::cout<<coarseRemote<<std::endl;
│ │ │ +
379 }
│ │ │ +
380
│ │ │ +
381 // The number of neighbours should not change!
│ │ │ +
382 assert(coarseRemote.neighbours()==fineRemote.neighbours());
│ │ │ +
383
│ │ │ +
384 // sync the index set and the remote indices to recompute missing
│ │ │ +
385 // indices
│ │ │ +
386 IndicesSyncer<ParallelIndexSet> syncer(coarseIndices, coarseRemote);
│ │ │ +
387 syncer.sync(renumberer, useFixedOrder);
│ │ │ +
388
│ │ │ +
389 }
│ │ │ +
390
│ │ │ +
391#endif
│ │ │ +
392
│ │ │ +
393 template<typename E>
│ │ │ +
394 template<typename Graph, typename VM>
│ │ │ +
395 typename Graph::VertexDescriptor
│ │ │ +
│ │ │ + │ │ │ +
397 [[maybe_unused]] const SequentialInformation& fineInfo,
│ │ │ +
398 [[maybe_unused]] Graph& fineGraph,
│ │ │ +
399 [[maybe_unused]] VM& visitedMap,
│ │ │ +
400 [[maybe_unused]] AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ +
401 [[maybe_unused]] SequentialInformation& coarseInfo,
│ │ │ +
402 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates,
│ │ │ +
403 [[maybe_unused]] bool useFixedOrder)
│ │ │ +
404 {
│ │ │ +
405 return noAggregates;
│ │ │ +
406 }
│ │ │ +
│ │ │ +
407
│ │ │ +
408 } //namespace Amg
│ │ │ +
409} // namespace Dune
│ │ │ +
410#endif
│ │ │ +
│ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
LocalIndex::Attribute Attribute
The type of the attribute.
Definition indicescoarsener.hh:70
│ │ │ +
void operator()(const typename G::ConstEdgeIterator &edge)
Definition indicescoarsener.hh:121
│ │ │ +
void isPublic(bool b)
Definition indicescoarsener.hh:144
│ │ │ +
ParallelInformation::ParallelIndexSet ParallelIndexSet
Definition indicescoarsener.hh:55
│ │ │ + │ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition indicescoarsener.hh:65
│ │ │ +
T ParallelInformation
The type of the parallel information.
Definition indicescoarsener.hh:53
│ │ │ +
Attribute attribute()
Definition indicescoarsener.hh:160
│ │ │ +
Vertex operator()(const GlobalIndex &global)
Definition indicescoarsener.hh:132
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition indicescoarsener.hh:60
│ │ │ +
void attribute(const Attribute &attribute)
Definition indicescoarsener.hh:155
│ │ │ +
E ExcludedAttributes
The set of excluded attributes.
Definition indicescoarsener.hh:48
│ │ │ +
void globalIndex(const GlobalIndex &global)
Definition indicescoarsener.hh:170
│ │ │ +
Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
The type of the remote indices.
Definition indicescoarsener.hh:75
│ │ │ +
static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates, bool useFixedOrder=false)
Build the coarse index set after the aggregatio.
Definition indicescoarsener.hh:236
│ │ │ +
ParallelAggregateRenumberer(AggregatesMap< Vertex > &aggregates, const I &lookup)
Definition indicescoarsener.hh:115
│ │ │ +
const GlobalIndex & globalIndex() const
Definition indicescoarsener.hh:165
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
Parameters needed to check whether a node depends on another.
Definition parameters.hh:31
│ │ │ -
Parameters needed for the aggregation process.
Definition parameters.hh:84
│ │ │ -
Parameters for the complete coarsening process.
Definition parameters.hh:257
│ │ │ -
All parameters for AMG.
Definition parameters.hh:416
│ │ │ +
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ +
Definition indicescoarsener.hh:36
│ │ │ +
Definition indicescoarsener.hh:43
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
Definition renumberer.hh:16
│ │ │ +
void operator++()
Definition renumberer.hh:57
│ │ │ +
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
│ │ │ +
Vertex number_
Definition renumberer.hh:35
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,486 +1,491 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -parameters.hh │ │ │ │ +indicescoarsener.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_PARAMETERS_HH │ │ │ │ -6#define DUNE_AMG_PARAMETERS_HH │ │ │ │ +5#ifndef DUNE_AMG_INDICESCOARSENER_HH │ │ │ │ +6#define DUNE_AMG_INDICESCOARSENER_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9 │ │ │ │ -10namespace _D_u_n_e │ │ │ │ -11{ │ │ │ │ -12 namespace Amg │ │ │ │ -13 { │ │ │ │ -_3_0 class _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ -31 { │ │ │ │ -32 public: │ │ │ │ -_3_4 _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s() │ │ │ │ -35 : alpha_(1.0/3.0), beta_(1.0E-5) │ │ │ │ -36 {} │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ +11 │ │ │ │ +12#if HAVE_MPI │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +14#endif │ │ │ │ +15 │ │ │ │ +16#include "_p_i_n_f_o_._h_h" │ │ │ │ +17 │ │ │ │ +18namespace _D_u_n_e │ │ │ │ +19{ │ │ │ │ +20 namespace Amg │ │ │ │ +21 { │ │ │ │ +22 │ │ │ │ +34 template │ │ │ │ +_3_5 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ +36 {}; │ │ │ │ 37 │ │ │ │ -_4_2 void _s_e_t_B_e_t_a(double b) │ │ │ │ +38 │ │ │ │ +39#if HAVE_MPI │ │ │ │ +40 │ │ │ │ +41 template │ │ │ │ +_4_2 class _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ 43 { │ │ │ │ -44 beta_ = b; │ │ │ │ -45 } │ │ │ │ -46 │ │ │ │ -_5_2 double _b_e_t_a() const │ │ │ │ -53 { │ │ │ │ -54 return beta_; │ │ │ │ -55 } │ │ │ │ +44 public: │ │ │ │ +_4_8 typedef E _E_x_c_l_u_d_e_d_A_t_t_r_i_b_u_t_e_s; │ │ │ │ +49 │ │ │ │ +_5_3 typedef T _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +54 │ │ │ │ +_5_5 typedef typename ParallelInformation::ParallelIndexSet _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ 56 │ │ │ │ -_6_1 void _s_e_t_A_l_p_h_a(double a) │ │ │ │ -62 { │ │ │ │ -63 alpha_ = a; │ │ │ │ -64 } │ │ │ │ -65 │ │ │ │ -_7_0 double _a_l_p_h_a() const │ │ │ │ -71 { │ │ │ │ -72 return alpha_; │ │ │ │ -73 } │ │ │ │ -74 │ │ │ │ -75 private: │ │ │ │ -76 double alpha_, beta_; │ │ │ │ -77 }; │ │ │ │ -78 │ │ │ │ -_8_2 class _A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s : │ │ │ │ -83 public _D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ -84 { │ │ │ │ -85 public: │ │ │ │ -_9_5 _A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s() │ │ │ │ -96 : maxDistance_(2), minAggregateSize_(4), maxAggregateSize_(6), │ │ │ │ -97 connectivity_(15), skipiso_(false) │ │ │ │ -98 {} │ │ │ │ -99 │ │ │ │ -_1_0_9 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(std::size_t dim, std::size_t diameter=2) │ │ │ │ -110 { │ │ │ │ -111 maxDistance_=diameter-1; │ │ │ │ -112 std::size_t csize=1; │ │ │ │ +_6_0 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ +61 │ │ │ │ +_6_5 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ +66 │ │ │ │ +_7_0 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ +71 │ │ │ │ +_7_5 typedef Dune::RemoteIndices _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ +76 │ │ │ │ +92 template │ │ │ │ +93 static typename Graph::VertexDescriptor │ │ │ │ +_9_4 _c_o_a_r_s_e_n(_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& fineInfo, │ │ │ │ +95 Graph& fineGraph, │ │ │ │ +96 VM& visitedMap, │ │ │ │ +97 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +98 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ +99 typename Graph::VertexDescriptor noAggregates, │ │ │ │ +100 bool useFixedOrder = false); │ │ │ │ +101 │ │ │ │ +102 private: │ │ │ │ +103 template │ │ │ │ +104 class ParallelAggregateRenumberer : public _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +105 { │ │ │ │ +106 typedef typename G::VertexDescriptor Vertex; │ │ │ │ +107 │ │ │ │ +108 typedef I GlobalLookupIndexSet; │ │ │ │ +109 │ │ │ │ +110 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ +111 │ │ │ │ +112 typedef typename IndexPair::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ 113 │ │ │ │ -114 for(; dim>0; dim--) { │ │ │ │ -115 csize*=diameter; │ │ │ │ -116 maxDistance_+=diameter-1; │ │ │ │ -117 } │ │ │ │ -118 minAggregateSize_=csize; │ │ │ │ -119 maxAggregateSize_=static_cast(csize*1.5); │ │ │ │ -120 } │ │ │ │ -121 │ │ │ │ -_1_3_2 void _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c(std::size_t dim,std::size_t diameter=2) │ │ │ │ +114 public: │ │ │ │ +_1_1_5 _P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const I& │ │ │ │ +lookup) │ │ │ │ +116 : _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(aggregates), isPublic_(false), lookup_(lookup), │ │ │ │ +117 globalIndex_(_s_t_d::numeric_limits::max()) │ │ │ │ +118 {} │ │ │ │ +119 │ │ │ │ +120 │ │ │ │ +_1_2_1 void _o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& edge) │ │ │ │ +122 { │ │ │ │ +123 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r_(_)(edge); │ │ │ │ +124 const IndexPair* pair= lookup_.pair(edge.target()); │ │ │ │ +125 if(pair!=0) { │ │ │ │ +126 _g_l_o_b_a_l_I_n_d_e_x(pair->global()); │ │ │ │ +127 _a_t_t_r_i_b_u_t_e(pair->local().attribute()); │ │ │ │ +128 _i_s_P_u_b_l_i_c(pair->local().isPublic()); │ │ │ │ +129 } │ │ │ │ +130 } │ │ │ │ +131 │ │ │ │ +_1_3_2 Vertex _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const GlobalIndex& global) │ │ │ │ 133 { │ │ │ │ -134 _s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c(dim, diameter); │ │ │ │ -135 maxDistance_+=dim-1; │ │ │ │ -136 } │ │ │ │ -_1_4_4 std::size_t _m_a_x_D_i_s_t_a_n_c_e() const { return maxDistance_;} │ │ │ │ -145 │ │ │ │ -_1_5_4 void _s_e_t_M_a_x_D_i_s_t_a_n_c_e(std::size_t distance) { maxDistance_ = distance;} │ │ │ │ -155 │ │ │ │ -_1_6_1 bool _s_k_i_p_I_s_o_l_a_t_e_d() const │ │ │ │ -162 { │ │ │ │ -163 return skipiso_; │ │ │ │ -164 } │ │ │ │ -165 │ │ │ │ -_1_7_1 void _s_e_t_S_k_i_p_I_s_o_l_a_t_e_d(bool skip) │ │ │ │ -172 { │ │ │ │ -173 skipiso_=skip; │ │ │ │ -174 } │ │ │ │ -175 │ │ │ │ -_1_8_0 std::size_t _m_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e() const { return minAggregateSize_;} │ │ │ │ +134 Vertex current = this->_n_u_m_b_e_r__; │ │ │ │ +135 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ +136 return current; │ │ │ │ +137 } │ │ │ │ +138 │ │ │ │ +_1_3_9 bool _i_s_P_u_b_l_i_c() │ │ │ │ +140 { │ │ │ │ +141 return isPublic_; │ │ │ │ +142 } │ │ │ │ +143 │ │ │ │ +_1_4_4 void _i_s_P_u_b_l_i_c(bool b) │ │ │ │ +145 { │ │ │ │ +146 isPublic_ = isPublic_ || b; │ │ │ │ +147 } │ │ │ │ +148 │ │ │ │ +_1_4_9 void _r_e_s_e_t() │ │ │ │ +150 { │ │ │ │ +151 globalIndex_ = std::numeric_limits::max(); │ │ │ │ +152 isPublic_=false; │ │ │ │ +153 } │ │ │ │ +154 │ │ │ │ +_1_5_5 void _a_t_t_r_i_b_u_t_e(const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e) │ │ │ │ +156 { │ │ │ │ +157 attribute_=_a_t_t_r_i_b_u_t_e; │ │ │ │ +158 } │ │ │ │ +159 │ │ │ │ +_1_6_0 _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() │ │ │ │ +161 { │ │ │ │ +162 return attribute_; │ │ │ │ +163 } │ │ │ │ +164 │ │ │ │ +_1_6_5 const GlobalIndex& _g_l_o_b_a_l_I_n_d_e_x() const │ │ │ │ +166 { │ │ │ │ +167 return globalIndex_; │ │ │ │ +168 } │ │ │ │ +169 │ │ │ │ +_1_7_0 void _g_l_o_b_a_l_I_n_d_e_x(const GlobalIndex& global) │ │ │ │ +171 { │ │ │ │ +172 globalIndex_ = global; │ │ │ │ +173 } │ │ │ │ +174 │ │ │ │ +175 private: │ │ │ │ +176 bool isPublic_; │ │ │ │ +177 _A_t_t_r_i_b_u_t_e attribute_; │ │ │ │ +178 const GlobalLookupIndexSet& lookup_; │ │ │ │ +179 _G_l_o_b_a_l_I_n_d_e_x globalIndex_; │ │ │ │ +180 }; │ │ │ │ 181 │ │ │ │ -_1_8_7 void _s_e_t_M_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e(std::size_t size){ minAggregateSize_=size;} │ │ │ │ -188 │ │ │ │ -_1_9_3 std::size_t _m_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e() const { return maxAggregateSize_;} │ │ │ │ -194 │ │ │ │ -_2_0_1 void _s_e_t_M_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e(std::size_t size){ maxAggregateSize_ = size;} │ │ │ │ -202 │ │ │ │ -_2_1_0 std::size_t _m_a_x_C_o_n_n_e_c_t_i_v_i_t_y() const { return connectivity_;} │ │ │ │ -211 │ │ │ │ -_2_1_9 void _s_e_t_M_a_x_C_o_n_n_e_c_t_i_v_i_t_y(std::size_t connectivity){ connectivity_ = │ │ │ │ -connectivity;} │ │ │ │ -220 │ │ │ │ -221 private: │ │ │ │ -222 std::size_t maxDistance_, minAggregateSize_, maxAggregateSize_, │ │ │ │ -connectivity_; │ │ │ │ -223 bool skipiso_; │ │ │ │ -224 │ │ │ │ -225 }; │ │ │ │ -226 │ │ │ │ -227 │ │ │ │ -_2_3_1 enum _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e { │ │ │ │ -_2_3_7 _n_o_A_c_c_u = 0, │ │ │ │ -_2_4_3 _a_t_O_n_c_e_A_c_c_u=1, │ │ │ │ -247 _s_u_c_c_e_s_s_i_v_e_A_c_c_u=2 │ │ │ │ -_2_4_8 }; │ │ │ │ +182 template │ │ │ │ +183 static void buildCoarseIndexSet(const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +184 Graph& fineGraph, │ │ │ │ +185 VM& visitedMap, │ │ │ │ +186 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +187 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& coarseIndices, │ │ │ │ +188 ParallelAggregateRenumberer& renumberer); │ │ │ │ +189 │ │ │ │ +190 template │ │ │ │ +191 static void buildCoarseRemoteIndices(const _R_e_m_o_t_e_I_n_d_i_c_e_s& fineRemote, │ │ │ │ +192 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +193 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& coarseIndices, │ │ │ │ +194 _R_e_m_o_t_e_I_n_d_i_c_e_s& coarseRemote, │ │ │ │ +195 ParallelAggregateRenumberer& renumberer, │ │ │ │ +196 bool useFixedOrder); │ │ │ │ +197 │ │ │ │ +198 }; │ │ │ │ +199 │ │ │ │ +203 template │ │ │ │ +_2_0_4 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n,E> │ │ │ │ +205 : public _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r,E> │ │ │ │ +206 {}; │ │ │ │ +207 │ │ │ │ +208 │ │ │ │ +209#endif │ │ │ │ +210 │ │ │ │ +217 template │ │ │ │ +_2_1_8 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n,E> │ │ │ │ +219 { │ │ │ │ +220 public: │ │ │ │ +221 template │ │ │ │ +222 static typename Graph::VertexDescriptor │ │ │ │ +223 coarsen(const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n & fineInfo, │ │ │ │ +224 Graph& fineGraph, │ │ │ │ +225 VM& visitedMap, │ │ │ │ +226 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +227 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ +228 typename Graph::VertexDescriptor noAggregates, │ │ │ │ +229 bool useFixedOrder = false); │ │ │ │ +230 }; │ │ │ │ +231 │ │ │ │ +232#if HAVE_MPI │ │ │ │ +233 template │ │ │ │ +234 template │ │ │ │ +235 inline typename Graph::VertexDescriptor │ │ │ │ +_2_3_6 _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_T_,_E_>_:_:_c_o_a_r_s_e_n(_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& fineInfo, │ │ │ │ +237 Graph& fineGraph, │ │ │ │ +238 VM& visitedMap, │ │ │ │ +239 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +240 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ +241 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates, │ │ │ │ +242 bool useFixedOrder) │ │ │ │ +243 { │ │ │ │ +244 ParallelAggregateRenumberer renumberer(aggregates, fineInfo.globalLookup()); │ │ │ │ +245 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates, │ │ │ │ +246 coarseInfo.indexSet(), renumberer); │ │ │ │ +247 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, │ │ │ │ +coarseInfo.indexSet(), │ │ │ │ +248 coarseInfo.remoteIndices(), renumberer, useFixedOrder); │ │ │ │ 249 │ │ │ │ -250 │ │ │ │ -251 │ │ │ │ +250 return renumberer; │ │ │ │ +251 } │ │ │ │ 252 │ │ │ │ -_2_5_6 class _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s : public _A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ -257 { │ │ │ │ -258 public: │ │ │ │ -_2_6_2 void _s_e_t_M_a_x_L_e_v_e_l(int l) │ │ │ │ -263 { │ │ │ │ -264 maxLevel_ = l; │ │ │ │ -265 } │ │ │ │ -_2_6_9 int _m_a_x_L_e_v_e_l() const │ │ │ │ -270 { │ │ │ │ -271 return maxLevel_; │ │ │ │ -272 } │ │ │ │ -273 │ │ │ │ -_2_7_7 void _s_e_t_C_o_a_r_s_e_n_T_a_r_g_e_t(int nodes) │ │ │ │ -278 { │ │ │ │ -279 coarsenTarget_ = nodes; │ │ │ │ -280 } │ │ │ │ -281 │ │ │ │ -_2_8_5 int _c_o_a_r_s_e_n_T_a_r_g_e_t() const │ │ │ │ -286 { │ │ │ │ -287 return coarsenTarget_; │ │ │ │ -288 } │ │ │ │ -289 │ │ │ │ -_2_9_5 void _s_e_t_M_i_n_C_o_a_r_s_e_n_R_a_t_e(double rate) │ │ │ │ -296 { │ │ │ │ -297 minCoarsenRate_ = rate; │ │ │ │ -298 } │ │ │ │ -299 │ │ │ │ -_3_0_3 double _m_i_n_C_o_a_r_s_e_n_R_a_t_e() const │ │ │ │ -304 { │ │ │ │ -305 return minCoarsenRate_; │ │ │ │ -306 } │ │ │ │ -307 │ │ │ │ -_3_1_1 _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e _a_c_c_u_m_u_l_a_t_e() const │ │ │ │ -312 { │ │ │ │ -313 return accumulate_; │ │ │ │ -314 } │ │ │ │ -_3_1_8 void _s_e_t_A_c_c_u_m_u_l_a_t_e(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e accu) │ │ │ │ -319 { │ │ │ │ -320 accumulate_=accu; │ │ │ │ +253 template │ │ │ │ +254 template │ │ │ │ +255 void _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_T_,_E_>_:_:_b_u_i_l_d_C_o_a_r_s_e_I_n_d_e_x_S_e_t(const │ │ │ │ +ParallelInformation& pinfo, │ │ │ │ +256 Graph& fineGraph, │ │ │ │ +257 VM& visitedMap, │ │ │ │ +258 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ +259 ParallelIndexSet& coarseIndices, │ │ │ │ +260 ParallelAggregateRenumberer& renumberer) │ │ │ │ +261 { │ │ │ │ +262 // fineGraph is the local subgraph corresponding to the vertices the │ │ │ │ +process owns. │ │ │ │ +263 // i.e. no overlap/copy vertices can be visited traversing the graph │ │ │ │ +264 typedef typename Graph::ConstVertexIterator Iterator; │ │ │ │ +265 typedef typename ParallelInformation::GlobalLookupIndexSet │ │ │ │ +GlobalLookupIndexSet; │ │ │ │ +266 │ │ │ │ +267 Iterator end = fineGraph.end(); │ │ │ │ +268 const GlobalLookupIndexSet& lookup = pinfo.globalLookup(); │ │ │ │ +269 │ │ │ │ +270 coarseIndices.beginResize(); │ │ │ │ +271 │ │ │ │ +272 // Setup the coarse index set and renumber the aggregate consecutively │ │ │ │ +273 // ascending from zero according to the minimum global index belonging │ │ │ │ +274 // to the aggregate │ │ │ │ +275 for(Iterator index = fineGraph.begin(); index != end; ++index) { │ │ │ │ +276 if(aggregates[*index]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ +_I_S_O_L_A_T_E_D) │ │ │ │ +277 // Isolated vertices will not be represented on the next level. │ │ │ │ +278 // These should only be there if skipIsolated is activiated in │ │ │ │ +279 // the coarsening criterion as otherwise they will be aggregated │ │ │ │ +280 // and should have real aggregate number in the map right now. │ │ │ │ +281 if(!_g_e_t(visitedMap, *index)) { │ │ │ │ +282 // This vertex was not visited by breadthFirstSearch yet. │ │ │ │ +283 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ +284 const IndexPair* pair= lookup.pair(*index); │ │ │ │ +285 │ │ │ │ +286 renumberer.reset(); // reset attribute and global index. │ │ │ │ +287 if(pair!=0) { │ │ │ │ +288 // vertex is in the index set. Note that not all vertices have │ │ │ │ +289 // to be in the index set, just the ones where communication │ │ │ │ +290 // will happen. │ │ │ │ +291 assert(!ExcludedAttributes::contains(pair->local().attribute())); │ │ │ │ +292 renumberer.attribute(pair->local().attribute()); │ │ │ │ +293 renumberer.isPublic(pair->local().isPublic()); │ │ │ │ +294 renumberer.globalIndex(pair->global()); │ │ │ │ +295 } │ │ │ │ +296 │ │ │ │ +297 // Reconstruct aggregate and mark vertices as visited │ │ │ │ +298 aggregates.template breadthFirstSearch(*index, aggregates[*index], │ │ │ │ +299 fineGraph, renumberer, visitedMap); │ │ │ │ +300 │ │ │ │ +301 if(renumberer.globalIndex()!=std::numeric_limits::max()) { │ │ │ │ +302 // vertex is in the index set. │ │ │ │ +303 //std::cout <<" Adding global="<< renumberer.globalIndex()<<" │ │ │ │ +local="<(renumberer)<(renumberer) >= coarseIndices.size()); │ │ │ │ +317 │ │ │ │ +318 // Reset the visited flags │ │ │ │ +319 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex) │ │ │ │ +320 put(visitedMap, *vertex, false); │ │ │ │ 321 } │ │ │ │ 322 │ │ │ │ -_3_2_3 void _s_e_t_A_c_c_u_m_u_l_a_t_e(bool accu){ │ │ │ │ -324 accumulate_=accu ? _s_u_c_c_e_s_s_i_v_e_A_c_c_u : _n_o_A_c_c_u; │ │ │ │ -325 } │ │ │ │ -326 │ │ │ │ -_3_3_0 bool _u_s_e_F_i_x_e_d_O_r_d_e_r() const │ │ │ │ +323 template │ │ │ │ +324 template │ │ │ │ +325 void ParallelIndicesCoarsener::buildCoarseRemoteIndices(const │ │ │ │ +RemoteIndices& fineRemote, │ │ │ │ +326 const AggregatesMap& aggregates, │ │ │ │ +327 ParallelIndexSet& coarseIndices, │ │ │ │ +328 RemoteIndices& coarseRemote, │ │ │ │ +329 ParallelAggregateRenumberer& renumberer, │ │ │ │ +330 bool useFixedOrder) │ │ │ │ 331 { │ │ │ │ -332 return useFixedOrder_; │ │ │ │ -333 } │ │ │ │ -334 │ │ │ │ -_3_3_5 void _s_e_t_U_s_e_F_i_x_e_d_O_r_d_e_r(bool _u_s_e_F_i_x_e_d_O_r_d_e_r) │ │ │ │ -336 { │ │ │ │ -337 useFixedOrder_ = _u_s_e_F_i_x_e_d_O_r_d_e_r; │ │ │ │ -338 } │ │ │ │ -339 │ │ │ │ -_3_4_5 void _s_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r(double d) │ │ │ │ -346 { │ │ │ │ -347 dampingFactor_ = d; │ │ │ │ -348 } │ │ │ │ -349 │ │ │ │ -_3_5_5 double _g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r() const │ │ │ │ -356 { │ │ │ │ -357 return dampingFactor_; │ │ │ │ -358 } │ │ │ │ -_3_7_2 _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s(int _m_a_x_L_e_v_e_l=100, int _c_o_a_r_s_e_n_T_a_r_g_e_t=1000, double │ │ │ │ -_m_i_n_C_o_a_r_s_e_n_R_a_t_e=1.2, │ │ │ │ -373 double prolongDamp=1.6, _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e _a_c_c_u_m_u_l_a_t_e=_s_u_c_c_e_s_s_i_v_e_A_c_c_u, │ │ │ │ -374 bool _u_s_e_F_i_x_e_d_O_r_d_e_r = false) │ │ │ │ -375 : maxLevel_(_m_a_x_L_e_v_e_l), coarsenTarget_(_c_o_a_r_s_e_n_T_a_r_g_e_t), minCoarsenRate_ │ │ │ │ -(_m_i_n_C_o_a_r_s_e_n_R_a_t_e), │ │ │ │ -376 dampingFactor_(prolongDamp), accumulate_( _a_c_c_u_m_u_l_a_t_e), useFixedOrder_ │ │ │ │ -(_u_s_e_F_i_x_e_d_O_r_d_e_r) │ │ │ │ -377 {} │ │ │ │ -378 │ │ │ │ -379 private: │ │ │ │ -383 int maxLevel_; │ │ │ │ -387 int coarsenTarget_; │ │ │ │ -391 double minCoarsenRate_; │ │ │ │ -395 double dampingFactor_; │ │ │ │ -400 _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e accumulate_; │ │ │ │ -406 bool useFixedOrder_; │ │ │ │ -407 }; │ │ │ │ -408 │ │ │ │ -_4_1_5 class _P_a_r_a_m_e_t_e_r_s : public _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ -416 { │ │ │ │ -417 public: │ │ │ │ -_4_2_4 void _s_e_t_D_e_b_u_g_L_e_v_e_l(int level) │ │ │ │ -425 { │ │ │ │ -426 debugLevel_ = level; │ │ │ │ -427 } │ │ │ │ -428 │ │ │ │ -_4_3_4 int _d_e_b_u_g_L_e_v_e_l() const │ │ │ │ -435 { │ │ │ │ -436 return debugLevel_; │ │ │ │ -437 } │ │ │ │ -438 │ │ │ │ -_4_4_3 void _s_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s(std::size_t steps) │ │ │ │ -444 { │ │ │ │ -445 preSmoothSteps_=steps; │ │ │ │ -446 } │ │ │ │ -_4_5_1 std::size_t _g_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ -452 { │ │ │ │ -453 return preSmoothSteps_; │ │ │ │ -454 } │ │ │ │ -455 │ │ │ │ -_4_6_0 void _s_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s(std::size_t steps) │ │ │ │ -461 { │ │ │ │ -462 postSmoothSteps_=steps; │ │ │ │ -463 } │ │ │ │ -_4_6_8 std::size_t _g_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s() const │ │ │ │ -469 { │ │ │ │ -470 return postSmoothSteps_; │ │ │ │ -471 } │ │ │ │ -472 │ │ │ │ -_4_7_6 void _s_e_t_G_a_m_m_a(std::size_t gamma) │ │ │ │ -477 { │ │ │ │ -478 gamma_=gamma; │ │ │ │ -479 } │ │ │ │ -_4_8_3 std::size_t _g_e_t_G_a_m_m_a() const │ │ │ │ -484 { │ │ │ │ -485 return gamma_; │ │ │ │ -486 } │ │ │ │ -487 │ │ │ │ -_4_9_2 void _s_e_t_A_d_d_i_t_i_v_e(bool additive) │ │ │ │ -493 { │ │ │ │ -494 additive_=additive; │ │ │ │ -495 } │ │ │ │ -496 │ │ │ │ -_5_0_1 bool _g_e_t_A_d_d_i_t_i_v_e() const │ │ │ │ -502 { │ │ │ │ -503 return additive_; │ │ │ │ -504 } │ │ │ │ -505 │ │ │ │ -_5_1_6 _P_a_r_a_m_e_t_e_r_s(int _m_a_x_L_e_v_e_l=100, int _c_o_a_r_s_e_n_T_a_r_g_e_t=1000, double │ │ │ │ -_m_i_n_C_o_a_r_s_e_n_R_a_t_e=1.2, │ │ │ │ -517 double prolongDamp=1.6, _A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e _a_c_c_u_m_u_l_a_t_e=_s_u_c_c_e_s_s_i_v_e_A_c_c_u, bool │ │ │ │ -_u_s_e_F_i_x_e_d_O_r_d_e_r = false) │ │ │ │ -518 : _C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s(_m_a_x_L_e_v_e_l, _c_o_a_r_s_e_n_T_a_r_g_e_t, _m_i_n_C_o_a_r_s_e_n_R_a_t_e, │ │ │ │ -prolongDamp, _a_c_c_u_m_u_l_a_t_e, _u_s_e_F_i_x_e_d_O_r_d_e_r) │ │ │ │ -519 , debugLevel_(2), preSmoothSteps_(2), postSmoothSteps_(2), gamma_(1), │ │ │ │ -520 additive_(false) │ │ │ │ -521 {} │ │ │ │ -522 private: │ │ │ │ -523 int debugLevel_; │ │ │ │ -524 std::size_t preSmoothSteps_; │ │ │ │ -525 std::size_t postSmoothSteps_; │ │ │ │ -526 std::size_t gamma_; │ │ │ │ -527 bool additive_; │ │ │ │ -528 }; │ │ │ │ -529 │ │ │ │ -530 } //namespace AMG │ │ │ │ -531 │ │ │ │ -532} //namespace Dune │ │ │ │ -533#endif │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_A_n_i_s_o_t_r_o_p_i_c │ │ │ │ -void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ -Sets reasonable default values for an anisotropic problem. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:132 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_d_d_i_t_i_v_e │ │ │ │ -void setAdditive(bool additive) │ │ │ │ -Set whether to use additive multigrid. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:492 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_S_k_i_p_I_s_o_l_a_t_e_d │ │ │ │ -void setSkipIsolated(bool skip) │ │ │ │ -Set whether isolated aggregates will not be represented on the coarse level. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:171 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ -void setProlongationDampingFactor(double d) │ │ │ │ -Set the damping factor for the prolongation. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:345 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ -CoarseningParameters(int maxLevel=100, int coarsenTarget=1000, double │ │ │ │ -minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode │ │ │ │ -accumulate=successiveAccu, bool useFixedOrder=false) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:372 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_a_l_p_h_a │ │ │ │ -double alpha() const │ │ │ │ -Get the scaling value for marking connections as strong. Default value is 1/3. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:70 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ -void setMaxAggregateSize(std::size_t size) │ │ │ │ -Set the maximum number of nodes a aggregate is allowed to have. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:201 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_i_n_C_o_a_r_s_e_n_R_a_t_e │ │ │ │ -void setMinCoarsenRate(double rate) │ │ │ │ -Set the minimum coarsening rate to be achieved in each coarsening. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:295 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_m_i_n_C_o_a_r_s_e_n_R_a_t_e │ │ │ │ -double minCoarsenRate() const │ │ │ │ -Get the minimum coarsening rate to be achieved. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:303 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ -std::size_t maxAggregateSize() const │ │ │ │ -Get the maximum number of nodes a aggregate is allowed to have. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:193 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_l_p_h_a │ │ │ │ -void setAlpha(double a) │ │ │ │ -Set the scaling value for marking connections as strong. Default value is 1/3. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:61 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ -Parameters(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, │ │ │ │ -double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool │ │ │ │ -useFixedOrder=false) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:516 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_b_e_t_a │ │ │ │ -double beta() const │ │ │ │ -Get the threshold for marking nodes as isolated. The default value is 1.0E-5. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:52 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_C_o_n_n_e_c_t_i_v_i_t_y │ │ │ │ -std::size_t maxConnectivity() const │ │ │ │ -Get the maximum number of connections a aggregate is allowed to have. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:210 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_c_o_a_r_s_e_n_T_a_r_g_e_t │ │ │ │ -int coarsenTarget() const │ │ │ │ -Get the maximum number of unknowns allowed on the coarsest level. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:285 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_c_c_u_m_u_l_a_t_e │ │ │ │ -void setAccumulate(AccumulationMode accu) │ │ │ │ -Set whether the data should be accumulated on fewer processes on coarser │ │ │ │ -levels. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:318 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ -double getProlongationDampingFactor() const │ │ │ │ -Get the damping factor for the prolongation. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:355 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_a_c_c_u_m_u_l_a_t_e │ │ │ │ -AccumulationMode accumulate() const │ │ │ │ -Whether the data should be accumulated on fewer processes on coarser levels. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:311 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_U_s_e_F_i_x_e_d_O_r_d_e_r │ │ │ │ -void setUseFixedOrder(bool useFixedOrder) │ │ │ │ -DDeeffiinniittiioonn parameters.hh:335 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_u_s_e_F_i_x_e_d_O_r_d_e_r │ │ │ │ -bool useFixedOrder() const │ │ │ │ -Check if the indices for the coarser levels should be created in a fixed order. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:330 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_C_o_n_n_e_c_t_i_v_i_t_y │ │ │ │ -void setMaxConnectivity(std::size_t connectivity) │ │ │ │ -Set the maximum number of connections a aggregate is allowed to have. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:219 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ -std::size_t minAggregateSize() const │ │ │ │ -Get the minimum number of nodes a aggregate has to consist of. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:180 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_A_d_d_i_t_i_v_e │ │ │ │ -bool getAdditive() const │ │ │ │ -Get whether to use additive multigrid. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:501 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_L_e_v_e_l │ │ │ │ -void setMaxLevel(int l) │ │ │ │ -Set the maximum number of levels allowed in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:262 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_D_e_b_u_g_L_e_v_e_l │ │ │ │ -void setDebugLevel(int level) │ │ │ │ -Set the debugging level. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:424 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_G_a_m_m_a │ │ │ │ -std::size_t getGamma() const │ │ │ │ -Get the value of gamma; 1 for V-cycle, 2 for W-cycle. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:483 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ -void setNoPostSmoothSteps(std::size_t steps) │ │ │ │ -Set the number of postsmoothing steps to apply. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:460 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ -std::size_t getNoPreSmoothSteps() const │ │ │ │ -Get the number of presmoothing steps to apply. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:451 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ -DependencyParameters() │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:34 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_i_n_A_g_g_r_e_g_a_t_e_S_i_z_e │ │ │ │ -void setMinAggregateSize(std::size_t size) │ │ │ │ -Set the minimum number of nodes a aggregate has to consist of. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:187 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_L_e_v_e_l │ │ │ │ -int maxLevel() const │ │ │ │ -Get the maximum number of levels allowed in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:269 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_D_e_f_a_u_l_t_V_a_l_u_e_s_I_s_o_t_r_o_p_i_c │ │ │ │ -void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2) │ │ │ │ -Sets reasonable default values for an isotropic problem. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:109 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ -AggregationParameters() │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:95 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_k_i_p_I_s_o_l_a_t_e_d │ │ │ │ -bool skipIsolated() const │ │ │ │ -Whether isolated aggregates will not be represented on the coarse level. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:161 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_C_o_a_r_s_e_n_T_a_r_g_e_t │ │ │ │ -void setCoarsenTarget(int nodes) │ │ │ │ -Set the maximum number of unknowns allowed on the coarsest level. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:277 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_N_o_P_r_e_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ -void setNoPreSmoothSteps(std::size_t steps) │ │ │ │ -Set the number of presmoothing steps to apply. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:443 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e │ │ │ │ -AccumulationMode │ │ │ │ -Identifiers for the different accumulation modes. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:231 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_B_e_t_a │ │ │ │ -void setBeta(double b) │ │ │ │ -Set threshold for marking nodes as isolated. The default value is 1.0E-5. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:42 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_m_a_x_D_i_s_t_a_n_c_e │ │ │ │ -std::size_t maxDistance() const │ │ │ │ -Get the maximal distance allowed between two nodes in a aggregate. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:144 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_G_a_m_m_a │ │ │ │ -void setGamma(std::size_t gamma) │ │ │ │ -Set the value of gamma; 1 for V-cycle, 2 for W-cycle. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:476 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_A_c_c_u_m_u_l_a_t_e │ │ │ │ -void setAccumulate(bool accu) │ │ │ │ -DDeeffiinniittiioonn parameters.hh:323 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s_:_:_s_e_t_M_a_x_D_i_s_t_a_n_c_e │ │ │ │ -void setMaxDistance(std::size_t distance) │ │ │ │ -Set the maximal distance allowed between two nodes in a aggregate. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:154 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_d_e_b_u_g_L_e_v_e_l │ │ │ │ -int debugLevel() const │ │ │ │ -Get the debugging Level. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:434 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s_:_:_g_e_t_N_o_P_o_s_t_S_m_o_o_t_h_S_t_e_p_s │ │ │ │ -std::size_t getNoPostSmoothSteps() const │ │ │ │ -Get the number of postsmoothing steps to apply. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:468 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ -@ atOnceAccu │ │ │ │ -Accumulate data to one process at once. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:243 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_n_o_A_c_c_u │ │ │ │ -@ noAccu │ │ │ │ -No data accumulution. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:237 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u │ │ │ │ -@ successiveAccu │ │ │ │ -Successively accumulate to fewer processes. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:247 │ │ │ │ +332 std::vector attributes(static_cast(renumberer)); │ │ │ │ +333 │ │ │ │ +334 GlobalLookupIndexSet coarseLookup(coarseIndices, │ │ │ │ +static_cast(renumberer)); │ │ │ │ +335 │ │ │ │ +336 typedef typename RemoteIndices::const_iterator Iterator; │ │ │ │ +337 Iterator end = fineRemote.end(); │ │ │ │ +338 │ │ │ │ +339 for(Iterator neighbour = fineRemote.begin(); │ │ │ │ +340 neighbour != end; ++neighbour) { │ │ │ │ +341 int process = neighbour->first; │ │ │ │ +342 │ │ │ │ +343 assert(neighbour->second.first==neighbour->second.second); │ │ │ │ +344 │ │ │ │ +345 // Mark all as not known │ │ │ │ +346 typedef typename std::vector::iterator CIterator; │ │ │ │ +347 │ │ │ │ +348 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter) │ │ │ │ +349 *iter = std::numeric_limits::max(); │ │ │ │ +350 │ │ │ │ +351 auto riEnd = neighbour->second.second->end(); │ │ │ │ +352 │ │ │ │ +353 for(auto index = neighbour->second.second->begin(); │ │ │ │ +354 index != riEnd; ++index) { │ │ │ │ +355 if(!E::contains(index->localIndexPair().local().attribute()) && │ │ │ │ +356 aggregates[index->localIndexPair().local()] != │ │ │ │ +357 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ +358 { │ │ │ │ +359 assert(aggregates[index->localIndexPair().local()]localIndexPair().local()]] != 3) │ │ │ │ +361 attributes[aggregates[index->localIndexPair().local()]] = index->attribute │ │ │ │ +(); │ │ │ │ +362 } │ │ │ │ +363 } │ │ │ │ +364 │ │ │ │ +365 // Build remote index list │ │ │ │ +366 typedef RemoteIndexListModifier Modifier; │ │ │ │ +367 typedef typename RemoteIndices::RemoteIndex RemoteIndex; │ │ │ │ +368 typedef typename ParallelIndexSet::const_iterator IndexIterator; │ │ │ │ +369 │ │ │ │ +370 Modifier coarseList = coarseRemote.template getModifier │ │ │ │ +(process); │ │ │ │ +371 │ │ │ │ +372 IndexIterator iend = coarseIndices.end(); │ │ │ │ +373 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index) │ │ │ │ +374 if(attributes[index->local()] != std::numeric_limits::max()) { │ │ │ │ +375 // remote index is present │ │ │ │ +376 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), & │ │ │ │ +(*index))); │ │ │ │ +377 } │ │ │ │ +378 //std::cout< syncer(coarseIndices, coarseRemote); │ │ │ │ +387 syncer.sync(renumberer, useFixedOrder); │ │ │ │ +388 │ │ │ │ +389 } │ │ │ │ +390 │ │ │ │ +391#endif │ │ │ │ +392 │ │ │ │ +393 template │ │ │ │ +394 template │ │ │ │ +395 typename Graph::VertexDescriptor │ │ │ │ +_3_9_6 _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_,_E_>_:_:_c_o_a_r_s_e_n( │ │ │ │ +397 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& fineInfo, │ │ │ │ +398 [[maybe_unused]] Graph& fineGraph, │ │ │ │ +399 [[maybe_unused]] VM& visitedMap, │ │ │ │ +400 [[maybe_unused]] _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& │ │ │ │ +aggregates, │ │ │ │ +401 [[maybe_unused]] _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ +402 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates, │ │ │ │ +403 [[maybe_unused]] bool useFixedOrder) │ │ │ │ +404 { │ │ │ │ +405 return noAggregates; │ │ │ │ +406 } │ │ │ │ +407 │ │ │ │ +408 } //namespace Amg │ │ │ │ +409} // namespace Dune │ │ │ │ +410#endif │ │ │ │ +_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ +_p_i_n_f_o_._h_h │ │ │ │ +_r_e_n_u_m_b_e_r_e_r_._h_h │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_r_e_s_e_t │ │ │ │ +void reset() │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:149 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ +LocalIndex::Attribute Attribute │ │ │ │ +The type of the attribute. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename G::ConstEdgeIterator &edge) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:121 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_i_s_P_u_b_l_i_c │ │ │ │ +void isPublic(bool b) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:144 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +ParallelInformation::ParallelIndexSet ParallelIndexSet │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:55 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_i_s_P_u_b_l_i_c │ │ │ │ +bool isPublic() │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:139 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ +ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ +The type of the local index. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:65 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +T ParallelInformation │ │ │ │ +The type of the parallel information. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:53 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ +Attribute attribute() │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:160 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +Vertex operator()(const GlobalIndex &global) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:132 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ +static const V ISOLATED │ │ │ │ +Identifier of isolated vertices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ +The type of the global index. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:60 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ +void attribute(const Attribute &attribute) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:155 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_E_x_c_l_u_d_e_d_A_t_t_r_i_b_u_t_e_s │ │ │ │ +E ExcludedAttributes │ │ │ │ +The set of excluded attributes. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:48 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_g_l_o_b_a_l_I_n_d_e_x │ │ │ │ +void globalIndex(const GlobalIndex &global) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:170 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +Dune::RemoteIndices< ParallelIndexSet > RemoteIndices │ │ │ │ +The type of the remote indices. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:75 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_c_o_a_r_s_e_n │ │ │ │ +static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph │ │ │ │ +&fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > │ │ │ │ +&aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor │ │ │ │ +noAggregates, bool useFixedOrder=false) │ │ │ │ +Build the coarse index set after the aggregatio. │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:236 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_: │ │ │ │ +_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +ParallelAggregateRenumberer(AggregatesMap< Vertex > &aggregates, const I │ │ │ │ +&lookup) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:115 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_g_l_o_b_a_l_I_n_d_e_x │ │ │ │ +const GlobalIndex & globalIndex() const │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:165 │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_p_e_n_d_e_n_c_y_P_a_r_a_m_e_t_e_r_s │ │ │ │ -Parameters needed to check whether a node depends on another. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:31 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_i_o_n_P_a_r_a_m_e_t_e_r_s │ │ │ │ -Parameters needed for the aggregation process. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:84 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_i_n_g_P_a_r_a_m_e_t_e_r_s │ │ │ │ -Parameters for the complete coarsening process. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:257 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ -All parameters for AMG. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ +_D_u_n_e_:_:_g_e_t │ │ │ │ +PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ +VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ +Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ +DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ +owner/overlap/copy sema... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:36 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:43 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:16 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ +void operator++() │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:57 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const typename G::ConstEdgeIterator &edge) │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:51 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_n_u_m_b_e_r__ │ │ │ │ +Vertex number_ │ │ │ │ +DDeeffiinniittiioonn renumberer.hh:35 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixhierarchy.hh File Reference │ │ │ +dune-istl: globalaggregates.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,79 +71,54 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Enumerations | │ │ │ -Functions
│ │ │ - │ │ │ +Namespaces
│ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

Provides a classes representing the hierarchies in AMG. │ │ │ +

Provdes class for identifying aggregates globally. │ │ │ More...

│ │ │ -
#include <algorithm>
│ │ │ -#include <tuple>
│ │ │ -#include "aggregates.hh"
│ │ │ -#include "graph.hh"
│ │ │ -#include "galerkin.hh"
│ │ │ -#include "renumberer.hh"
│ │ │ -#include "graphcreator.hh"
│ │ │ -#include "hierarchy.hh"
│ │ │ -#include <dune/istl/bvector.hh>
│ │ │ +
#include "aggregates.hh"
│ │ │ +#include "pinfo.hh"
│ │ │ #include <dune/common/parallel/indexset.hh>
│ │ │ -#include <dune/istl/matrixutils.hh>
│ │ │ -#include <dune/istl/matrixredistribute.hh>
│ │ │ -#include <dune/istl/paamg/dependency.hh>
│ │ │ -#include <dune/istl/paamg/indicescoarsener.hh>
│ │ │ -#include <dune/istl/paamg/globalaggregates.hh>
│ │ │ -#include <dune/istl/paamg/construction.hh>
│ │ │ -#include <dune/istl/paamg/smoother.hh>
│ │ │ -#include <dune/istl/paamg/transfer.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::MatrixHierarchy< M, PI, A >
 The hierarchies build by the coarsening process. More...
struct  Dune::Amg::GlobalAggregatesMap< T, TI >
 
struct  Dune::Amg::MatrixHierarchy< M, PI, A >::MatrixStats< Matrix, true >::calc
class  Dune::Amg::GlobalAggregatesMap< T, TI >::Proxy
 
class  Dune::Amg::CoarsenCriterion< T >
 The criterion describing the stop criteria for the coarsening process. More...
struct  Dune::Amg::AggregatesGatherScatter< T, TI >
 
struct  Dune::Amg::AggregatesPublisher< T, O, I >
 
struct  Dune::Amg::AggregatesPublisher< T, O, OwnerOverlapCopyCommunication< T1, T2 > >
 Utility class for publishing the aggregate number of the DOFs in the overlap to other processors and convert them to local indices. More...
 
struct  Dune::Amg::AggregatesPublisher< T, O, SequentialInformation >
 
struct  Dune::CommPolicy< Amg::GlobalAggregatesMap< T, TI > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Enumerations

enum  { Dune::Amg::MAX_PROCESSES = 72000 │ │ │ - }
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │

│ │ │ -Functions

template<typename M , typename C1 >
bool Dune::Amg::repartitionAndDistributeMatrix (const M &origMatrix, std::shared_ptr< M > newMatrix, SequentialInformation &origComm, std::shared_ptr< SequentialInformation > &newComm, RedistributeInformation< SequentialInformation > &ri, int nparts, C1 &criterion)
 
template<typename M , typename C , typename C1 >
bool Dune::Amg::repartitionAndDistributeMatrix (const M &origMatrix, std::shared_ptr< M > newMatrix, C &origComm, std::shared_ptr< C > &newComm, RedistributeInformation< C > &ri, int nparts, C1 &criterion)
 
│ │ │

Detailed Description

│ │ │ -

Provides a classes representing the hierarchies in AMG.

│ │ │ +

Provdes class for identifying aggregates globally.

│ │ │
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,68 +1,45 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _E_n_u_m_e_r_a_t_i_o_n_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -matrixhierarchy.hh File Reference │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +globalaggregates.hh File Reference │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides a classes representing the hierarchies in AMG. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ +Provdes class for identifying aggregates globally. _M_o_r_e_._._. │ │ │ │ #include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ -#include "_g_r_a_p_h_._h_h" │ │ │ │ -#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ -#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ -#include "_g_r_a_p_h_c_r_e_a_t_o_r_._h_h" │ │ │ │ -#include "_h_i_e_r_a_r_c_h_y_._h_h" │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +#include "_p_i_n_f_o_._h_h" │ │ │ │ #include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_d_e_p_e_n_d_e_n_c_y_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_ _M_,_ _P_I_,_ _A_ _> │ │ │ │ -  The hierarchies build by the coarsening process. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _> │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_ _M_,_ _P_I_,_ _A_ _>_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_: │ │ │ │ - _c_a_l_c │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_:_:_P_r_o_x_y │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_<_ _T_ _> │ │ │ │ -  The criterion describing the stop criteria for the coarsening process. │ │ │ │ - _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _T_,_ _T_I_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _I_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_< │ │ │ │ + _T_1_,_ _T_2_ _>_ _> │ │ │ │ +  Utility class for publishing the aggregate number of the DOFs in the │ │ │ │ + overlap to other processors and convert them to local indices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ -EEnnuummeerraattiioonnss │ │ │ │ -enum   { _D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S = 72000 } │ │ │ │ -  │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -bool  _D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (const M &origMatrix, std:: │ │ │ │ - shared_ptr< M > newMatrix, _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n &origComm, std:: │ │ │ │ - shared_ptr< _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n > &newComm, _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< │ │ │ │ - _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n > &ri, int nparts, C1 &criterion) │ │ │ │ -  │ │ │ │ -template │ │ │ │ -bool  _D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x (const M &origMatrix, std:: │ │ │ │ - shared_ptr< M > newMatrix, C &origComm, std::shared_ptr< C > &newComm, │ │ │ │ - _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n< C > &ri, int nparts, C1 &criterion) │ │ │ │ -  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ +Provdes class for identifying aggregates globally. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: matrixhierarchy.hh Source File │ │ │ +dune-istl: globalaggregates.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,1004 +74,337 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
matrixhierarchy.hh
│ │ │ +
globalaggregates.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ -
6#define DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ +
5#ifndef DUNE_GLOBALAGGREGATES_HH
│ │ │ +
6#define DUNE_GLOBALAGGREGATES_HH
│ │ │
7
│ │ │ -
8#include <algorithm>
│ │ │ -
9#include <tuple>
│ │ │ -
10#include "aggregates.hh"
│ │ │ -
11#include "graph.hh"
│ │ │ -
12#include "galerkin.hh"
│ │ │ -
13#include "renumberer.hh"
│ │ │ -
14#include "graphcreator.hh"
│ │ │ -
15#include "hierarchy.hh"
│ │ │ -
16#include <dune/istl/bvector.hh>
│ │ │ -
17#include <dune/common/parallel/indexset.hh>
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
27
│ │ │ -
28namespace Dune
│ │ │ -
29{
│ │ │ -
30 namespace Amg
│ │ │ -
31 {
│ │ │ -
42 enum {
│ │ │ -
50 MAX_PROCESSES = 72000
│ │ │ -
51 };
│ │ │ -
52
│ │ │ -
59 template<class M, class PI, class A=std::allocator<M> >
│ │ │ -
│ │ │ - │ │ │ -
61 {
│ │ │ -
62 public:
│ │ │ -
64 typedef M MatrixOperator;
│ │ │ -
65
│ │ │ -
67 typedef typename MatrixOperator::matrix_type Matrix;
│ │ │ +
18#include "aggregates.hh"
│ │ │ +
19#include "pinfo.hh"
│ │ │ +
20#include <dune/common/parallel/indexset.hh>
│ │ │ +
21
│ │ │ +
22namespace Dune
│ │ │ +
23{
│ │ │ +
24 namespace Amg
│ │ │ +
25 {
│ │ │ +
26
│ │ │ +
27 template<typename T, typename TI>
│ │ │ +
│ │ │ + │ │ │ +
29 {
│ │ │ +
30 public:
│ │ │ +
31 typedef TI ParallelIndexSet;
│ │ │ +
32
│ │ │ +
33 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ +
34
│ │ │ +
35 typedef typename ParallelIndexSet::GlobalIndex IndexedType;
│ │ │ +
36
│ │ │ +
37 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ +
38
│ │ │ +
39 typedef T Vertex;
│ │ │ +
40
│ │ │ +
│ │ │ + │ │ │ +
42 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
│ │ │ +
43 : aggregates_(aggregates), indexset_(indexset)
│ │ │ +
44 {}
│ │ │ +
│ │ │ +
45
│ │ │ +
│ │ │ +
46 inline const GlobalIndex& operator[](std::size_t index) const
│ │ │ +
47 {
│ │ │ +
48 const Vertex& aggregate = aggregates_[index];
│ │ │ +
49 if(aggregate >= AggregatesMap<Vertex>::ISOLATED) {
│ │ │ +
50 assert(aggregate != AggregatesMap<Vertex>::UNAGGREGATED);
│ │ │ +
51 return isolatedMarker;
│ │ │ +
52 }else{
│ │ │ +
53 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
│ │ │ +
54 assert(pair!=0);
│ │ │ +
55 return pair->global();
│ │ │ +
56 }
│ │ │ +
57 }
│ │ │ +
│ │ │ +
58
│ │ │ +
59
│ │ │ +
│ │ │ +
60 inline GlobalIndex& get(std::size_t index)
│ │ │ +
61 {
│ │ │ +
62 const Vertex& aggregate = aggregates_[index];
│ │ │ +
63 assert(aggregate < AggregatesMap<Vertex>::ISOLATED);
│ │ │ +
64 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
│ │ │ +
65 assert(pair!=0);
│ │ │ +
66 return const_cast<GlobalIndex&>(pair->global());
│ │ │ +
67 }
│ │ │ +
│ │ │
68
│ │ │ - │ │ │ -
71
│ │ │ -
73 typedef A Allocator;
│ │ │ -
74
│ │ │ - │ │ │ -
77
│ │ │ - │ │ │ -
80
│ │ │ - │ │ │ -
83
│ │ │ -
85 using AAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<AggregatesMap*>;
│ │ │ -
86
│ │ │ -
88 typedef std::list<AggregatesMap*,AAllocator> AggregatesMapList;
│ │ │ -
89
│ │ │ - │ │ │ -
92
│ │ │ -
94 using RILAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<RedistributeInfoType>;
│ │ │ +
│ │ │ +
69 class Proxy
│ │ │ +
70 {
│ │ │ +
71 public:
│ │ │ +
│ │ │ +
72 Proxy(const GlobalLookupIndexSet<ParallelIndexSet>& indexset, Vertex& aggregate)
│ │ │ +
73 : indexset_(&indexset), aggregate_(&aggregate)
│ │ │ +
74 {}
│ │ │ +
│ │ │ +
75
│ │ │ +
│ │ │ +
76 Proxy& operator=(const GlobalIndex& global)
│ │ │ +
77 {
│ │ │ +
78 if(global==isolatedMarker)
│ │ │ + │ │ │ +
80 else{
│ │ │ +
81 //assert(global < AggregatesMap<Vertex>::ISOLATED);
│ │ │ +
82 *aggregate_ = indexset_->operator[](global).local();
│ │ │ +
83 }
│ │ │ +
84 return *this;
│ │ │ +
85 }
│ │ │ +
│ │ │ +
86 private:
│ │ │ +
87 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
│ │ │ +
88 Vertex* aggregate_;
│ │ │ +
89 };
│ │ │ +
│ │ │ +
90
│ │ │ +
│ │ │ +
91 inline Proxy operator[](std::size_t index)
│ │ │ +
92 {
│ │ │ +
93 return Proxy(indexset_, aggregates_[index]);
│ │ │ +
94 }
│ │ │ +
│ │ │
95
│ │ │ -
97 typedef std::list<RedistributeInfoType,RILAllocator> RedistributeInfoList;
│ │ │ -
98
│ │ │ -
104 MatrixHierarchy(std::shared_ptr<MatrixOperator> fineMatrix,
│ │ │ -
105 std::shared_ptr<ParallelInformation> pinfo = std::make_shared<ParallelInformation>());
│ │ │ -
106
│ │ │ - │ │ │ -
108
│ │ │ -
114 template<typename O, typename T>
│ │ │ -
115 void build(const T& criterion);
│ │ │ -
116
│ │ │ -
124 template<class F>
│ │ │ -
125 void recalculateGalerkin(const F& copyFlags);
│ │ │ -
126
│ │ │ -
131 template<class V, class BA, class TA>
│ │ │ -
132 void coarsenVector(Hierarchy<BlockVector<V,BA>, TA>& hierarchy) const;
│ │ │ -
133
│ │ │ -
139 template<class S, class TA>
│ │ │ -
140 void coarsenSmoother(Hierarchy<S,TA>& smoothers,
│ │ │ -
141 const typename SmootherTraits<S>::Arguments& args) const;
│ │ │ -
142
│ │ │ -
147 std::size_t levels() const;
│ │ │ -
148
│ │ │ -
153 std::size_t maxlevels() const;
│ │ │ -
154
│ │ │ -
155 bool hasCoarsest() const;
│ │ │ -
156
│ │ │ -
161 bool isBuilt() const;
│ │ │ -
162
│ │ │ -
167 const ParallelMatrixHierarchy& matrices() const;
│ │ │ -
168
│ │ │ - │ │ │ -
174
│ │ │ -
179 const AggregatesMapList& aggregatesMaps() const;
│ │ │ -
180
│ │ │ - │ │ │ -
187
│ │ │ -
│ │ │ - │ │ │ -
189 {
│ │ │ -
190 return prolongDamp_;
│ │ │ -
191 }
│ │ │ -
│ │ │ -
192
│ │ │ -
203 void getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const;
│ │ │ -
204
│ │ │ -
205 private:
│ │ │ -
206 typedef typename ConstructionTraits<MatrixOperator>::Arguments MatrixArgs;
│ │ │ -
207 typedef typename ConstructionTraits<ParallelInformation>::Arguments CommunicationArgs;
│ │ │ -
209 AggregatesMapList aggregatesMaps_;
│ │ │ -
211 RedistributeInfoList redistributes_;
│ │ │ -
213 ParallelMatrixHierarchy matrices_;
│ │ │ -
215 ParallelInformationHierarchy parallelInformation_;
│ │ │ -
216
│ │ │ -
218 bool built_;
│ │ │ -
219
│ │ │ -
221 int maxlevels_;
│ │ │ -
222
│ │ │ -
223 double prolongDamp_;
│ │ │ -
224
│ │ │ -
228 template<class Matrix, bool print>
│ │ │ -
229 struct MatrixStats
│ │ │ -
230 {
│ │ │ +
│ │ │ +
96 inline void put(const GlobalIndex& global, size_t i)
│ │ │ +
97 {
│ │ │ +
98 aggregates_[i]=indexset_[global].local();
│ │ │ +
99
│ │ │ +
100 }
│ │ │ +
│ │ │ +
101
│ │ │ +
102 private:
│ │ │ +
103 AggregatesMap<Vertex>& aggregates_;
│ │ │ +
104 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
│ │ │ +
105 static const GlobalIndex isolatedMarker;
│ │ │ +
106 };
│ │ │ +
│ │ │ +
107
│ │ │ +
108 template<typename T, typename TI>
│ │ │ +
109 const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker =
│ │ │ +
110 std::numeric_limits<typename TI::GlobalIndex>::max();
│ │ │ +
111
│ │ │ +
112 template<typename T, typename TI>
│ │ │ +
│ │ │ + │ │ │ +
114 {
│ │ │ + │ │ │ +
116 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ +
117
│ │ │ +
│ │ │ +
118 static const GlobalIndex& gather(const GlobalAggregatesMap<T,TI>& ga, size_t i)
│ │ │ +
119 {
│ │ │ +
120 return ga[i];
│ │ │ +
121 }
│ │ │ +
│ │ │ +
122
│ │ │ +
│ │ │ +
123 static void scatter(GlobalAggregatesMap<T,TI>& ga, GlobalIndex global, size_t i)
│ │ │ +
124 {
│ │ │ +
125 ga[i]=global;
│ │ │ +
126 }
│ │ │ +
│ │ │ +
127 };
│ │ │ +
│ │ │ +
128
│ │ │ +
129 template<typename T, typename O, typename I>
│ │ │ +
│ │ │ + │ │ │ +
131 {};
│ │ │ +
│ │ │ +
132
│ │ │ +
133#if HAVE_MPI
│ │ │ +
134
│ │ │ +
135#endif
│ │ │ +
136
│ │ │ +
137 } // namespace Amg
│ │ │ +
138
│ │ │ +
139#if HAVE_MPI
│ │ │ +
140 // forward declaration
│ │ │ +
141 template<class T1, class T2>
│ │ │ + │ │ │ +
143#endif
│ │ │ +
144
│ │ │ +
145 namespace Amg
│ │ │ +
146 {
│ │ │ +
147
│ │ │ +
148#if HAVE_MPI
│ │ │ +
158 template<typename T, typename O, typename T1, typename T2>
│ │ │ +
│ │ │ + │ │ │ +
160 {
│ │ │ +
161 typedef T Vertex;
│ │ │ +
162 typedef O OverlapFlags;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
166
│ │ │ +
│ │ │ +
167 static void publish(AggregatesMap<Vertex>& aggregates,
│ │ │ +
168 ParallelInformation& pinfo,
│ │ │ +
169 const GlobalLookupIndexSet& globalLookup)
│ │ │ +
170 {
│ │ │ + │ │ │ +
172 GlobalMap gmap(aggregates, globalLookup);
│ │ │ +
173 pinfo.copyOwnerToAll(gmap,gmap);
│ │ │ +
174 // communication only needed for ALU
│ │ │ +
175 // (ghosts with same global id as owners on the same process)
│ │ │ +
176 if (SolverCategory::category(pinfo) == static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ +
177 pinfo.copyCopyToAll(gmap,gmap);
│ │ │ +
178
│ │ │ +
179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
│ │ │ +
180 Lists lists = pinfo.remoteIndices().find(pinfo.communicator().rank());
│ │ │ +
181 if(lists!=pinfo.remoteIndices().end()) {
│ │ │ +
182
│ │ │ +
183 // For periodic boundary conditions we must renumber
│ │ │ +
184 // the aggregates of vertices in the overlap whose owners are
│ │ │ +
185 // on the same process
│ │ │ +
186 Vertex maxAggregate =0;
│ │ │ +
187 typedef typename AggregatesMap<Vertex>::const_iterator Iter;
│ │ │ +
188 for(Iter i=aggregates.begin(), end=aggregates.end(); i!=end; ++i)
│ │ │ +
189 maxAggregate = std::max(maxAggregate, *i);
│ │ │ +
190
│ │ │ +
191 // Compute new mapping of aggregates in the overlap that we also own
│ │ │ +
192 std::map<Vertex,Vertex> newMapping;
│ │ │ +
193
│ │ │ +
194 // insert all elements into map
│ │ │ +
195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList
│ │ │ +
196 ::const_iterator RIter;
│ │ │ +
197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
│ │ │ +
198 ri!=rend; ++ri)
│ │ │ +
199 if(O::contains(ri->localIndexPair().local().attribute()))
│ │ │ +
200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()],
│ │ │ +
201 maxAggregate));
│ │ │ +
202 // renumber
│ │ │ +
203 typedef typename std::map<Vertex,Vertex>::iterator MIter;
│ │ │ +
204 for(MIter mi=newMapping.begin(), mend=newMapping.end();
│ │ │ +
205 mi != mend; ++mi)
│ │ │ +
206 mi->second=++maxAggregate;
│ │ │ +
207
│ │ │ +
208
│ │ │ +
209 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
│ │ │ +
210 ri!=rend; ++ri)
│ │ │ +
211 if(O::contains(ri->localIndexPair().local().attribute()))
│ │ │ +
212 aggregates[ri->localIndexPair().local()] =
│ │ │ +
213 newMapping[aggregates[ri->localIndexPair().local()]];
│ │ │ +
214 }
│ │ │ +
215 }
│ │ │ +
│ │ │ +
216 };
│ │ │ +
│ │ │ +
217#endif
│ │ │ +
218
│ │ │ +
219 template<typename T, typename O>
│ │ │ +
│ │ │ + │ │ │ +
221 {
│ │ │ +
222 typedef T Vertex;
│ │ │ + │ │ │ + │ │ │ +
225
│ │ │ +
│ │ │ +
226 static void publish([[maybe_unused]] AggregatesMap<Vertex>& aggregates,
│ │ │ +
227 [[maybe_unused]] ParallelInformation& pinfo,
│ │ │ +
228 [[maybe_unused]] const GlobalLookupIndexSet& globalLookup)
│ │ │ +
229 {}
│ │ │ +
│ │ │ +
230 };
│ │ │ +
│ │ │
231
│ │ │ -
235 static void stats([[maybe_unused]] const Matrix& matrix)
│ │ │ -
236 {}
│ │ │ -
237 };
│ │ │ -
238
│ │ │ -
239 template<class Matrix>
│ │ │ -
240 struct MatrixStats<Matrix,true>
│ │ │ -
241 {
│ │ │ -
│ │ │ -
242 struct calc
│ │ │ -
243 {
│ │ │ -
244 typedef typename Matrix::size_type size_type;
│ │ │ -
245 typedef typename Matrix::row_type matrix_row;
│ │ │ -
246
│ │ │ -
│ │ │ - │ │ │ -
248 {
│ │ │ -
249 min=std::numeric_limits<size_type>::max();
│ │ │ -
250 max=0;
│ │ │ -
251 sum=0;
│ │ │ -
252 }
│ │ │ -
│ │ │ -
253
│ │ │ -
│ │ │ -
254 void operator()(const matrix_row& row)
│ │ │ -
255 {
│ │ │ -
256 min=std::min(min, row.size());
│ │ │ -
257 max=std::max(max, row.size());
│ │ │ -
258 sum += row.size();
│ │ │ -
259 }
│ │ │ -
│ │ │ -
260
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
264 };
│ │ │ -
│ │ │ -
268 static void stats(const Matrix& matrix)
│ │ │ -
269 {
│ │ │ -
270 calc c= for_each(matrix.begin(), matrix.end(), calc());
│ │ │ -
271 dinfo<<"Matrix row: min="<<c.min<<" max="<<c.max
│ │ │ -
272 <<" average="<<static_cast<double>(c.sum)/matrix.N()
│ │ │ -
273 <<std::endl;
│ │ │ -
274 }
│ │ │ -
275 };
│ │ │ -
276 };
│ │ │ -
│ │ │ -
277
│ │ │ -
281 template<class T>
│ │ │ -
│ │ │ -
282 class CoarsenCriterion : public T
│ │ │ -
283 {
│ │ │ -
284 public:
│ │ │ - │ │ │ -
290
│ │ │ -
│ │ │ -
304 CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2,
│ │ │ -
305 double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder = false)
│ │ │ -
306 : AggregationCriterion(Dune::Amg::Parameters(maxLevel, coarsenTarget, minCoarsenRate, prolongDamp, accumulate, useFixedOrder))
│ │ │ -
307 {}
│ │ │ -
│ │ │ -
308
│ │ │ -
│ │ │ - │ │ │ -
310 : AggregationCriterion(parms)
│ │ │ -
311 {}
│ │ │ -
│ │ │ -
312
│ │ │ -
313 };
│ │ │ -
│ │ │ -
314
│ │ │ -
315 template<typename M, typename C1>
│ │ │ -
│ │ │ -
316 bool repartitionAndDistributeMatrix([[maybe_unused]] const M& origMatrix,
│ │ │ -
317 [[maybe_unused]] std::shared_ptr<M> newMatrix,
│ │ │ -
318 [[maybe_unused]] SequentialInformation& origComm,
│ │ │ -
319 [[maybe_unused]] std::shared_ptr<SequentialInformation>& newComm,
│ │ │ - │ │ │ -
321 [[maybe_unused]] int nparts,
│ │ │ -
322 [[maybe_unused]] C1& criterion)
│ │ │ -
323 {
│ │ │ -
324 DUNE_THROW(NotImplemented, "Redistribution does not make sense in sequential code!");
│ │ │ -
325 }
│ │ │ -
│ │ │ -
326
│ │ │ -
327
│ │ │ -
328 template<typename M, typename C, typename C1>
│ │ │ -
│ │ │ -
329 bool repartitionAndDistributeMatrix(const M& origMatrix,
│ │ │ -
330 std::shared_ptr<M> newMatrix,
│ │ │ -
331 C& origComm,
│ │ │ -
332 std::shared_ptr<C>& newComm,
│ │ │ - │ │ │ -
334 int nparts, C1& criterion)
│ │ │ -
335 {
│ │ │ -
336 Timer time;
│ │ │ -
337#ifdef AMG_REPART_ON_COMM_GRAPH
│ │ │ -
338 // Done not repartition the matrix graph, but a graph of the communication scheme.
│ │ │ -
339 bool existentOnRedist=Dune::commGraphRepartition(origMatrix, origComm, nparts, newComm,
│ │ │ -
340 ri.getInterface(),
│ │ │ -
341 criterion.debugLevel()>1);
│ │ │ -
342
│ │ │ -
343#else
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
348 IdentityMap,
│ │ │ -
349 IdentityMap> PropertiesGraph;
│ │ │ -
350 MatrixGraph graph(origMatrix);
│ │ │ -
351 PropertiesGraph pgraph(graph);
│ │ │ -
352 buildDependency(pgraph, origMatrix, criterion, false);
│ │ │ -
353
│ │ │ -
354#ifdef DEBUG_REPART
│ │ │ -
355 if(origComm.communicator().rank()==0)
│ │ │ -
356 std::cout<<"Original matrix"<<std::endl;
│ │ │ -
357 origComm.communicator().barrier();
│ │ │ -
358 printGlobalSparseMatrix(origMatrix, origComm, std::cout);
│ │ │ -
359#endif
│ │ │ -
360 bool existentOnRedist=Dune::graphRepartition(pgraph, origComm, nparts,
│ │ │ -
361 newComm, ri.getInterface(),
│ │ │ -
362 criterion.debugLevel()>1);
│ │ │ -
363#endif // if else AMG_REPART
│ │ │ -
364
│ │ │ -
365 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ -
366 std::cout<<"Repartitioning took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ -
367
│ │ │ -
368 ri.setSetup();
│ │ │ -
369
│ │ │ -
370#ifdef DEBUG_REPART
│ │ │ -
371 ri.checkInterface(origComm.indexSet(), newComm->indexSet(), origComm.communicator());
│ │ │ -
372#endif
│ │ │ -
373
│ │ │ -
374 redistributeMatrix(const_cast<M&>(origMatrix), *newMatrix, origComm, *newComm, ri);
│ │ │ -
375
│ │ │ -
376#ifdef DEBUG_REPART
│ │ │ -
377 if(origComm.communicator().rank()==0)
│ │ │ -
378 std::cout<<"Original matrix"<<std::endl;
│ │ │ -
379 origComm.communicator().barrier();
│ │ │ -
380 if(newComm->communicator().size()>0)
│ │ │ -
381 printGlobalSparseMatrix(*newMatrix, *newComm, std::cout);
│ │ │ -
382 origComm.communicator().barrier();
│ │ │ -
383#endif
│ │ │ -
384
│ │ │ -
385 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ -
386 std::cout<<"Redistributing matrix took "<<time.elapsed()<<" seconds."<<std::endl;
│ │ │ -
387 return existentOnRedist;
│ │ │ -
388
│ │ │ -
389 }
│ │ │ -
│ │ │ -
390
│ │ │ -
391 template<class M, class IS, class A>
│ │ │ -
│ │ │ -
392 MatrixHierarchy<M,IS,A>::MatrixHierarchy(std::shared_ptr<MatrixOperator> fineMatrix,
│ │ │ -
393 std::shared_ptr<ParallelInformation> pinfo)
│ │ │ -
394 : matrices_(fineMatrix),
│ │ │ -
395 parallelInformation_(pinfo)
│ │ │ -
396 {
│ │ │ -
397 if (SolverCategory::category(*fineMatrix) != SolverCategory::category(*pinfo))
│ │ │ -
398 DUNE_THROW(ISTLError, "MatrixOperator and ParallelInformation must belong to the same category!");
│ │ │ -
399 }
│ │ │ -
│ │ │ -
400
│ │ │ -
401 template<class M, class IS, class A>
│ │ │ -
402 template<typename O, typename T>
│ │ │ -
│ │ │ -
403 void MatrixHierarchy<M,IS,A>::build(const T& criterion)
│ │ │ -
404 {
│ │ │ -
405 prolongDamp_ = criterion.getProlongationDampingFactor();
│ │ │ -
406 typedef O OverlapFlags;
│ │ │ -
407 typedef typename ParallelMatrixHierarchy::Iterator MatIterator;
│ │ │ -
408 typedef typename ParallelInformationHierarchy::Iterator PInfoIterator;
│ │ │ -
409
│ │ │ -
410 static const int noints=(Dune::Amg::MAX_PROCESSES/4096>0) ? (Dune::Amg::MAX_PROCESSES/4096) : 1;
│ │ │ -
411
│ │ │ -
412 typedef bigunsignedint<sizeof(int)*8*noints> BIGINT;
│ │ │ - │ │ │ -
414 MatIterator mlevel = matrices_.finest();
│ │ │ -
415 MatrixStats<typename M::matrix_type,MINIMAL_DEBUG_LEVEL<=INFO_DEBUG_LEVEL>::stats(mlevel->getmat());
│ │ │ -
416
│ │ │ -
417 PInfoIterator infoLevel = parallelInformation_.finest();
│ │ │ -
418 BIGINT finenonzeros=countNonZeros(mlevel->getmat());
│ │ │ -
419 finenonzeros = infoLevel->communicator().sum(finenonzeros);
│ │ │ -
420 BIGINT allnonzeros = finenonzeros;
│ │ │ -
421
│ │ │ -
422
│ │ │ -
423 int level = 0;
│ │ │ -
424 int rank = 0;
│ │ │ -
425
│ │ │ -
426 BIGINT unknowns = mlevel->getmat().N();
│ │ │ -
427
│ │ │ -
428 unknowns = infoLevel->communicator().sum(unknowns);
│ │ │ -
429 double dunknowns=unknowns.todouble();
│ │ │ -
430 infoLevel->buildGlobalLookup(mlevel->getmat().N());
│ │ │ -
431 redistributes_.push_back(RedistributeInfoType());
│ │ │ -
432
│ │ │ -
433 for(; level < criterion.maxLevel(); ++level, ++mlevel) {
│ │ │ -
434 assert(matrices_.levels()==redistributes_.size());
│ │ │ -
435 rank = infoLevel->communicator().rank();
│ │ │ -
436 if(rank==0 && criterion.debugLevel()>1)
│ │ │ -
437 std::cout<<"Level "<<level<<" has "<<dunknowns<<" unknowns, "<<dunknowns/infoLevel->communicator().size()
│ │ │ -
438 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ -
439
│ │ │ -
440 MatrixOperator* matrix=&(*mlevel);
│ │ │ -
441 ParallelInformation* info =&(*infoLevel);
│ │ │ -
442
│ │ │ -
443 if((
│ │ │ -
444#if HAVE_PARMETIS
│ │ │ -
445 criterion.accumulate()==successiveAccu
│ │ │ -
446#else
│ │ │ -
447 false
│ │ │ -
448#endif
│ │ │ -
449 || (criterion.accumulate()==atOnceAccu
│ │ │ -
450 && dunknowns < 30*infoLevel->communicator().size()))
│ │ │ -
451 && infoLevel->communicator().size()>1 &&
│ │ │ -
452 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget())
│ │ │ -
453 {
│ │ │ -
454 // accumulate to fewer processors
│ │ │ -
455 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ -
456 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ -
457 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/(criterion.minAggregateSize()
│ │ │ -
458 *criterion.coarsenTarget()));
│ │ │ -
459 if( nodomains<=criterion.minAggregateSize()/2 ||
│ │ │ -
460 dunknowns <= criterion.coarsenTarget() )
│ │ │ -
461 nodomains=1;
│ │ │ -
462
│ │ │ -
463 bool existentOnNextLevel =
│ │ │ -
464 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ -
465 redistComm, redistributes_.back(), nodomains,
│ │ │ -
466 criterion);
│ │ │ -
467 BIGINT unknownsRedist = redistMat->N();
│ │ │ -
468 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ -
469 dunknowns= unknownsRedist.todouble();
│ │ │ -
470 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1)
│ │ │ -
471 std::cout<<"Level "<<level<<" (redistributed) has "<<dunknowns<<" unknowns, "<<dunknowns/redistComm->communicator().size()
│ │ │ -
472 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ -
473 MatrixArgs args(redistMat, *redistComm);
│ │ │ -
474 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ -
475 assert(mlevel.isRedistributed());
│ │ │ -
476 infoLevel.addRedistributed(redistComm);
│ │ │ -
477 infoLevel->freeGlobalLookup();
│ │ │ -
478
│ │ │ -
479 if(!existentOnNextLevel)
│ │ │ -
480 // We do not hold any data on the redistributed partitioning
│ │ │ -
481 break;
│ │ │ -
482
│ │ │ -
483 // Work on the redistributed Matrix from now on
│ │ │ -
484 matrix = &(mlevel.getRedistributed());
│ │ │ -
485 info = &(infoLevel.getRedistributed());
│ │ │ -
486 info->buildGlobalLookup(matrix->getmat().N());
│ │ │ -
487 }
│ │ │ -
488
│ │ │ -
489 rank = info->communicator().rank();
│ │ │ -
490 if(dunknowns <= criterion.coarsenTarget())
│ │ │ -
491 // No further coarsening needed
│ │ │ -
492 break;
│ │ │ -
493
│ │ │ - │ │ │ -
495 typedef typename GraphCreator::PropertiesGraph PropertiesGraph;
│ │ │ -
496 typedef typename GraphCreator::GraphTuple GraphTuple;
│ │ │ -
497
│ │ │ -
498 typedef typename PropertiesGraph::VertexDescriptor Vertex;
│ │ │ -
499
│ │ │ -
500 std::vector<bool> excluded(matrix->getmat().N(), false);
│ │ │ -
501
│ │ │ -
502 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, OverlapFlags());
│ │ │ -
503
│ │ │ -
504 AggregatesMap* aggregatesMap=new AggregatesMap(std::get<1>(graphs)->maxVertex()+1);
│ │ │ -
505
│ │ │ -
506 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ -
507
│ │ │ -
508 Timer watch;
│ │ │ -
509 watch.reset();
│ │ │ -
510 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] =
│ │ │ -
511 aggregatesMap->buildAggregates(matrix->getmat(), *(std::get<1>(graphs)), criterion, level==0);
│ │ │ -
512
│ │ │ -
513 if(rank==0 && criterion.debugLevel()>2)
│ │ │ -
514 std::cout<<" Have built "<<noAggregates<<" aggregates totally ("<<isoAggregates<<" isolated aggregates, "<<
│ │ │ -
515 oneAggregates<<" aggregates of one vertex, and skipped "<<
│ │ │ -
516 skippedAggregates<<" aggregates)."<<std::endl;
│ │ │ -
517#ifdef TEST_AGGLO
│ │ │ -
518 {
│ │ │ -
519 // calculate size of local matrix in the distributed direction
│ │ │ -
520 int start, end, overlapStart, overlapEnd;
│ │ │ -
521 int procs=info->communicator().rank();
│ │ │ -
522 int n = UNKNOWNS/procs; // number of unknowns per process
│ │ │ -
523 int bigger = UNKNOWNS%procs; // number of process with n+1 unknowns
│ │ │ -
524
│ │ │ -
525 // Compute owner region
│ │ │ -
526 if(rank<bigger) {
│ │ │ -
527 start = rank*(n+1);
│ │ │ -
528 end = (rank+1)*(n+1);
│ │ │ -
529 }else{
│ │ │ -
530 start = bigger + rank * n;
│ │ │ -
531 end = bigger + (rank + 1) * n;
│ │ │ -
532 }
│ │ │ -
533
│ │ │ -
534 // Compute overlap region
│ │ │ -
535 if(start>0)
│ │ │ -
536 overlapStart = start - 1;
│ │ │ -
537 else
│ │ │ -
538 overlapStart = start;
│ │ │ -
539
│ │ │ -
540 if(end<UNKNOWNS)
│ │ │ -
541 overlapEnd = end + 1;
│ │ │ -
542 else
│ │ │ -
543 overlapEnd = end;
│ │ │ -
544
│ │ │ -
545 assert((UNKNOWNS)*(overlapEnd-overlapStart)==aggregatesMap->noVertices());
│ │ │ -
546 for(int j=0; j< UNKNOWNS; ++j)
│ │ │ -
547 for(int i=0; i < UNKNOWNS; ++i)
│ │ │ -
548 {
│ │ │ -
549 if(i>=overlapStart && i<overlapEnd)
│ │ │ -
550 {
│ │ │ -
551 int no = (j/2)*((UNKNOWNS)/2)+i/2;
│ │ │ -
552 (*aggregatesMap)[j*(overlapEnd-overlapStart)+i-overlapStart]=no;
│ │ │ -
553 }
│ │ │ -
554 }
│ │ │ -
555 }
│ │ │ -
556#endif
│ │ │ -
557 if(criterion.debugLevel()>1 && info->communicator().rank()==0)
│ │ │ -
558 std::cout<<"aggregating finished."<<std::endl;
│ │ │ -
559
│ │ │ -
560 BIGINT gnoAggregates=noAggregates;
│ │ │ -
561 gnoAggregates = info->communicator().sum(gnoAggregates);
│ │ │ -
562 double dgnoAggregates = gnoAggregates.todouble();
│ │ │ -
563#ifdef TEST_AGGLO
│ │ │ -
564 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2);
│ │ │ -
565#endif
│ │ │ -
566
│ │ │ -
567 if(criterion.debugLevel()>2 && rank==0)
│ │ │ -
568 std::cout << "Building "<<dgnoAggregates<<" aggregates took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ -
569
│ │ │ -
570 if(dgnoAggregates==0 || dunknowns/dgnoAggregates<criterion.minCoarsenRate())
│ │ │ -
571 {
│ │ │ -
572 if(rank==0)
│ │ │ -
573 {
│ │ │ -
574 if(dgnoAggregates>0)
│ │ │ -
575 std::cerr << "Stopped coarsening because of rate breakdown "<<dunknowns<<"/"<<dgnoAggregates
│ │ │ -
576 <<"="<<dunknowns/dgnoAggregates<<"<"
│ │ │ -
577 <<criterion.minCoarsenRate()<<std::endl;
│ │ │ -
578 else
│ │ │ -
579 std::cerr<< "Could not build any aggregates. Probably no connected nodes."<<std::endl;
│ │ │ -
580 }
│ │ │ -
581 aggregatesMap->free();
│ │ │ -
582 delete aggregatesMap;
│ │ │ -
583 aggregatesMaps_.pop_back();
│ │ │ -
584
│ │ │ -
585 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator().size()>1) {
│ │ │ -
586 // coarse level matrix was already redistributed, but to more than 1 process
│ │ │ -
587 // Therefore need to delete the redistribution. Further down it will
│ │ │ -
588 // then be redistributed to 1 process
│ │ │ -
589 delete &(mlevel.getRedistributed().getmat());
│ │ │ -
590 mlevel.deleteRedistributed();
│ │ │ -
591 delete &(infoLevel.getRedistributed());
│ │ │ -
592 infoLevel.deleteRedistributed();
│ │ │ -
593 redistributes_.back().resetSetup();
│ │ │ -
594 }
│ │ │ -
595
│ │ │ -
596 break;
│ │ │ -
597 }
│ │ │ -
598 unknowns = noAggregates;
│ │ │ -
599 dunknowns = dgnoAggregates;
│ │ │ -
600
│ │ │ -
601 CommunicationArgs commargs(info->communicator(),info->category());
│ │ │ -
602 parallelInformation_.addCoarser(commargs);
│ │ │ -
603
│ │ │ -
604 ++infoLevel; // parallel information on coarse level
│ │ │ -
605
│ │ │ -
606 typename PropertyMapTypeSelector<VertexVisitedTag,PropertiesGraph>::Type visitedMap =
│ │ │ -
607 get(VertexVisitedTag(), *(std::get<1>(graphs)));
│ │ │ -
608
│ │ │ -
609 watch.reset();
│ │ │ - │ │ │ -
611 ::coarsen(*info,
│ │ │ -
612 *(std::get<1>(graphs)),
│ │ │ -
613 visitedMap,
│ │ │ -
614 *aggregatesMap,
│ │ │ -
615 *infoLevel,
│ │ │ -
616 noAggregates,
│ │ │ -
617 criterion.useFixedOrder());
│ │ │ -
618 GraphCreator::free(graphs);
│ │ │ -
619
│ │ │ -
620 if(criterion.debugLevel()>2) {
│ │ │ -
621 if(rank==0)
│ │ │ -
622 std::cout<<"Coarsening of index sets took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ -
623 }
│ │ │ -
624
│ │ │ -
625 watch.reset();
│ │ │ -
626
│ │ │ -
627 infoLevel->buildGlobalLookup(aggregates);
│ │ │ - │ │ │ -
629 *info,
│ │ │ -
630 infoLevel->globalLookup());
│ │ │ -
631
│ │ │ -
632
│ │ │ -
633 if(criterion.debugLevel()>2) {
│ │ │ -
634 if(rank==0)
│ │ │ -
635 std::cout<<"Communicating global aggregate numbers took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ -
636 }
│ │ │ -
637
│ │ │ -
638 watch.reset();
│ │ │ -
639 std::vector<bool>& visited=excluded;
│ │ │ -
640
│ │ │ -
641 typedef std::vector<bool>::iterator Iterator;
│ │ │ -
642 typedef IteratorPropertyMap<Iterator, IdentityMap> VisitedMap2;
│ │ │ -
643 Iterator end = visited.end();
│ │ │ -
644 for(Iterator iter= visited.begin(); iter != end; ++iter)
│ │ │ -
645 *iter=false;
│ │ │ -
646
│ │ │ -
647 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap());
│ │ │ -
648
│ │ │ -
649 std::shared_ptr<typename MatrixOperator::matrix_type>
│ │ │ -
650 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2,
│ │ │ -
651 *info,
│ │ │ -
652 *aggregatesMap,
│ │ │ -
653 aggregates,
│ │ │ -
654 OverlapFlags()));
│ │ │ -
655 dverb<<"Building of sparsity pattern took "<<watch.elapsed()<<std::endl;
│ │ │ -
656 watch.reset();
│ │ │ -
657 info->freeGlobalLookup();
│ │ │ -
658
│ │ │ -
659 delete std::get<0>(graphs);
│ │ │ -
660 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, *infoLevel, OverlapFlags());
│ │ │ -
661
│ │ │ -
662 if(criterion.debugLevel()>2) {
│ │ │ -
663 if(rank==0)
│ │ │ -
664 std::cout<<"Calculation entries of Galerkin product took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ -
665 }
│ │ │ -
666
│ │ │ -
667 BIGINT nonzeros = countNonZeros(*coarseMatrix);
│ │ │ -
668 allnonzeros = allnonzeros + infoLevel->communicator().sum(nonzeros);
│ │ │ -
669 MatrixArgs args(coarseMatrix, *infoLevel);
│ │ │ -
670
│ │ │ -
671 matrices_.addCoarser(args);
│ │ │ -
672 redistributes_.push_back(RedistributeInfoType());
│ │ │ -
673 } // end level loop
│ │ │ -
674
│ │ │ -
675
│ │ │ -
676 infoLevel->freeGlobalLookup();
│ │ │ -
677
│ │ │ -
678 built_=true;
│ │ │ -
679 AggregatesMap* aggregatesMap=new AggregatesMap(0);
│ │ │ -
680 aggregatesMaps_.push_back(aggregatesMap);
│ │ │ -
681
│ │ │ -
682 if(criterion.debugLevel()>0) {
│ │ │ -
683 if(level==criterion.maxLevel()) {
│ │ │ -
684 BIGINT unknownsLevel = mlevel->getmat().N();
│ │ │ -
685 unknownsLevel = infoLevel->communicator().sum(unknownsLevel);
│ │ │ -
686 if(rank==0 && criterion.debugLevel()>1) {
│ │ │ -
687 double dunknownsLevel = unknownsLevel.todouble();
│ │ │ -
688 std::cout<<"Level "<<level<<" has "<<dunknownsLevel<<" unknowns, "<<dunknownsLevel/infoLevel->communicator().size()
│ │ │ -
689 <<" unknowns per proc (procs="<<infoLevel->communicator().size()<<")"<<std::endl;
│ │ │ -
690 }
│ │ │ -
691 }
│ │ │ -
692 }
│ │ │ -
693
│ │ │ -
694 if(criterion.accumulate() && !redistributes_.back().isSetup() &&
│ │ │ -
695 infoLevel->communicator().size()>1) {
│ │ │ -
696#if HAVE_MPI && !HAVE_PARMETIS
│ │ │ -
697 if(criterion.accumulate()==successiveAccu &&
│ │ │ -
698 infoLevel->communicator().rank()==0)
│ │ │ -
699 std::cerr<<"Successive accumulation of data on coarse levels only works with ParMETIS installed."
│ │ │ -
700 <<" Fell back to accumulation to one domain on coarsest level"<<std::endl;
│ │ │ -
701#endif
│ │ │ -
702
│ │ │ -
703 // accumulate to fewer processors
│ │ │ -
704 std::shared_ptr<Matrix> redistMat = std::make_shared<Matrix>();
│ │ │ -
705 std::shared_ptr<ParallelInformation> redistComm;
│ │ │ -
706 int nodomains = 1;
│ │ │ -
707
│ │ │ -
708 repartitionAndDistributeMatrix(mlevel->getmat(), redistMat, *infoLevel,
│ │ │ -
709 redistComm, redistributes_.back(), nodomains,criterion);
│ │ │ -
710 MatrixArgs args(redistMat, *redistComm);
│ │ │ -
711 BIGINT unknownsRedist = redistMat->N();
│ │ │ -
712 unknownsRedist = infoLevel->communicator().sum(unknownsRedist);
│ │ │ -
713
│ │ │ -
714 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) {
│ │ │ -
715 double dunknownsRedist = unknownsRedist.todouble();
│ │ │ -
716 std::cout<<"Level "<<level<<" redistributed has "<<dunknownsRedist<<" unknowns, "<<dunknownsRedist/redistComm->communicator().size()
│ │ │ -
717 <<" unknowns per proc (procs="<<redistComm->communicator().size()<<")"<<std::endl;
│ │ │ -
718 }
│ │ │ -
719 mlevel.addRedistributed(ConstructionTraits<MatrixOperator>::construct(args));
│ │ │ -
720 infoLevel.addRedistributed(redistComm);
│ │ │ -
721 infoLevel->freeGlobalLookup();
│ │ │ -
722 }
│ │ │ -
723
│ │ │ -
724 int levels = matrices_.levels();
│ │ │ -
725 maxlevels_ = parallelInformation_.finest()->communicator().max(levels);
│ │ │ -
726 assert(matrices_.levels()==redistributes_.size());
│ │ │ -
727 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1)
│ │ │ -
728 std::cout<<"operator complexity: "<<allnonzeros.todouble()/finenonzeros.todouble()<<std::endl;
│ │ │ -
729
│ │ │ -
730 }
│ │ │ -
│ │ │ -
731
│ │ │ -
732 template<class M, class IS, class A>
│ │ │ - │ │ │ -
│ │ │ - │ │ │ -
735 {
│ │ │ -
736 return matrices_;
│ │ │ -
737 }
│ │ │ -
│ │ │ -
738
│ │ │ -
739 template<class M, class IS, class A>
│ │ │ - │ │ │ -
│ │ │ - │ │ │ -
742 {
│ │ │ -
743 return parallelInformation_;
│ │ │ -
744 }
│ │ │ -
│ │ │ -
745
│ │ │ -
746 template<class M, class IS, class A>
│ │ │ -
│ │ │ -
747 void MatrixHierarchy<M,IS,A>::getCoarsestAggregatesOnFinest(std::vector<std::size_t>& data) const
│ │ │ -
748 {
│ │ │ -
749 int levels=aggregatesMaps().size();
│ │ │ -
750 int maxlevels=parallelInformation_.finest()->communicator().max(levels);
│ │ │ -
751 std::size_t size=(*(aggregatesMaps().begin()))->noVertices();
│ │ │ -
752 // We need an auxiliary vector for the consecutive prolongation.
│ │ │ -
753 std::vector<std::size_t> tmp;
│ │ │ -
754 std::vector<std::size_t> *coarse, *fine;
│ │ │ -
755
│ │ │ -
756 // make sure the allocated space suffices.
│ │ │ -
757 tmp.reserve(size);
│ │ │ -
758 data.reserve(size);
│ │ │ -
759
│ │ │ -
760 // Correctly assign coarse and fine for the first prolongation such that
│ │ │ -
761 // we end up in data in the end.
│ │ │ -
762 if(levels%2==0) {
│ │ │ -
763 coarse=&tmp;
│ │ │ -
764 fine=&data;
│ │ │ -
765 }else{
│ │ │ -
766 coarse=&data;
│ │ │ -
767 fine=&tmp;
│ │ │ -
768 }
│ │ │ -
769
│ │ │ -
770 // Number the unknowns on the coarsest level consecutively for each process.
│ │ │ -
771 if(levels==maxlevels) {
│ │ │ -
772 const AggregatesMap& map = *(*(++aggregatesMaps().rbegin()));
│ │ │ -
773 std::size_t m=0;
│ │ │ -
774
│ │ │ -
775 for(typename AggregatesMap::const_iterator iter = map.begin(); iter != map.end(); ++iter)
│ │ │ -
776 if(*iter< AggregatesMap::ISOLATED)
│ │ │ -
777 m=std::max(*iter,m);
│ │ │ -
778
│ │ │ -
779 coarse->resize(m+1);
│ │ │ -
780 std::size_t i=0;
│ │ │ -
781 srand((unsigned)std::clock());
│ │ │ -
782 std::set<size_t> used;
│ │ │ -
783 for(typename std::vector<std::size_t>::iterator iter=coarse->begin(); iter != coarse->end();
│ │ │ -
784 ++iter, ++i)
│ │ │ -
785 {
│ │ │ -
786 std::pair<std::set<std::size_t>::iterator,bool> ibpair
│ │ │ -
787 = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0)))*coarse->size());
│ │ │ -
788
│ │ │ -
789 while(!ibpair.second)
│ │ │ -
790 ibpair = used.insert(static_cast<std::size_t>((((double)rand())/(RAND_MAX+1.0))*coarse->size()));
│ │ │ -
791 *iter=*(ibpair.first);
│ │ │ -
792 }
│ │ │ -
793 }
│ │ │ -
794
│ │ │ -
795 typename ParallelInformationHierarchy::Iterator pinfo = parallelInformation().coarsest();
│ │ │ -
796 --pinfo;
│ │ │ -
797
│ │ │ -
798 // Now consecutively project the numbers to the finest level.
│ │ │ -
799 for(typename AggregatesMapList::const_reverse_iterator aggregates=++aggregatesMaps().rbegin();
│ │ │ -
800 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) {
│ │ │ -
801
│ │ │ -
802 fine->resize((*aggregates)->noVertices());
│ │ │ -
803 fine->assign(fine->size(), 0);
│ │ │ - │ │ │ -
805 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast<std::size_t>(1), *pinfo);
│ │ │ -
806 --pinfo;
│ │ │ -
807 std::swap(coarse, fine);
│ │ │ -
808 }
│ │ │ -
809
│ │ │ -
810 // Assertion to check that we really projected to data on the last step.
│ │ │ -
811 assert(coarse==&data);
│ │ │ -
812 }
│ │ │ -
│ │ │ -
813
│ │ │ -
814 template<class M, class IS, class A>
│ │ │ - │ │ │ -
│ │ │ - │ │ │ -
817 {
│ │ │ -
818 return aggregatesMaps_;
│ │ │ -
819 }
│ │ │ -
│ │ │ -
820 template<class M, class IS, class A>
│ │ │ - │ │ │ -
│ │ │ - │ │ │ -
823 {
│ │ │ -
824 return redistributes_;
│ │ │ -
825 }
│ │ │ -
│ │ │ -
826
│ │ │ -
827 template<class M, class IS, class A>
│ │ │ -
│ │ │ - │ │ │ -
829 {
│ │ │ -
830 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator;
│ │ │ -
831 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ -
832 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ -
833
│ │ │ -
834 AggregatesMapIterator amap = aggregatesMaps_.rbegin();
│ │ │ -
835 InfoIterator info = parallelInformation_.coarsest();
│ │ │ -
836 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level != finest; --level, --info, ++amap) {
│ │ │ -
837 (*amap)->free();
│ │ │ -
838 delete *amap;
│ │ │ -
839 }
│ │ │ -
840 delete *amap;
│ │ │ -
841 }
│ │ │ -
│ │ │ -
842
│ │ │ -
843 template<class M, class IS, class A>
│ │ │ -
844 template<class V, class BA, class TA>
│ │ │ -
│ │ │ - │ │ │ -
846 {
│ │ │ -
847 assert(hierarchy.levels()==1);
│ │ │ -
848 typedef typename ParallelMatrixHierarchy::ConstIterator Iterator;
│ │ │ -
849 typedef typename RedistributeInfoList::const_iterator RIter;
│ │ │ -
850 RIter redist = redistributes_.begin();
│ │ │ -
851
│ │ │ -
852 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ -
853 int level=0;
│ │ │ -
854 if(redist->isSetup())
│ │ │ -
855 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ -
856 Dune::dvverb<<"Level "<<level<<" has "<<matrices_.finest()->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ -
857
│ │ │ -
858 while(matrix != coarsest) {
│ │ │ -
859 ++matrix; ++level; ++redist;
│ │ │ -
860 Dune::dvverb<<"Level "<<level<<" has "<<matrix->getmat().N()<<" unknowns!"<<std::endl;
│ │ │ -
861
│ │ │ -
862 hierarchy.addCoarser(matrix->getmat().N());
│ │ │ -
863 if(redist->isSetup())
│ │ │ -
864 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N());
│ │ │ -
865
│ │ │ -
866 }
│ │ │ -
867
│ │ │ -
868 }
│ │ │ -
│ │ │ -
869
│ │ │ -
870 template<class M, class IS, class A>
│ │ │ -
871 template<class S, class TA>
│ │ │ -
│ │ │ - │ │ │ -
873 const typename SmootherTraits<S>::Arguments& sargs) const
│ │ │ -
874 {
│ │ │ -
875 assert(smoothers.levels()==0);
│ │ │ -
876 typedef typename ParallelMatrixHierarchy::ConstIterator MatrixIterator;
│ │ │ -
877 typedef typename ParallelInformationHierarchy::ConstIterator PinfoIterator;
│ │ │ -
878 typedef typename AggregatesMapList::const_iterator AggregatesIterator;
│ │ │ -
879
│ │ │ - │ │ │ -
881 cargs.setArgs(sargs);
│ │ │ -
882 PinfoIterator pinfo = parallelInformation_.finest();
│ │ │ -
883 AggregatesIterator aggregates = aggregatesMaps_.begin();
│ │ │ -
884 int level=0;
│ │ │ -
885 for(MatrixIterator matrix = matrices_.finest(), coarsest = matrices_.coarsest();
│ │ │ -
886 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) {
│ │ │ -
887 cargs.setMatrix(matrix->getmat(), **aggregates);
│ │ │ -
888 cargs.setComm(*pinfo);
│ │ │ -
889 smoothers.addCoarser(cargs);
│ │ │ -
890 }
│ │ │ -
891 if(maxlevels()>levels()) {
│ │ │ -
892 // This is not the globally coarsest level and therefore smoothing is needed
│ │ │ -
893 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates);
│ │ │ -
894 cargs.setComm(*pinfo);
│ │ │ -
895 smoothers.addCoarser(cargs);
│ │ │ -
896 ++level;
│ │ │ -
897 }
│ │ │ -
898 }
│ │ │ -
│ │ │ -
899
│ │ │ -
900 template<class M, class IS, class A>
│ │ │ -
901 template<class F>
│ │ │ -
│ │ │ - │ │ │ -
903 {
│ │ │ -
904 typedef typename AggregatesMapList::iterator AggregatesMapIterator;
│ │ │ -
905 typedef typename ParallelMatrixHierarchy::Iterator Iterator;
│ │ │ -
906 typedef typename ParallelInformationHierarchy::Iterator InfoIterator;
│ │ │ -
907
│ │ │ -
908 AggregatesMapIterator amap = aggregatesMaps_.begin();
│ │ │ -
909 BaseGalerkinProduct productBuilder;
│ │ │ -
910 InfoIterator info = parallelInformation_.finest();
│ │ │ -
911 typename RedistributeInfoList::iterator riIter = redistributes_.begin();
│ │ │ -
912 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest();
│ │ │ -
913 if(level.isRedistributed()) {
│ │ │ -
914 info->buildGlobalLookup(level->getmat().N());
│ │ │ -
915 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ -
916 const_cast<Matrix&>(level.getRedistributed().getmat()),
│ │ │ -
917 *info,info.getRedistributed(), *riIter);
│ │ │ -
918 info->freeGlobalLookup();
│ │ │ -
919 }
│ │ │ -
920
│ │ │ -
921 for(; level!=coarsest; ++amap) {
│ │ │ -
922 const Matrix& fine = (level.isRedistributed() ? level.getRedistributed() : *level).getmat();
│ │ │ -
923 ++level;
│ │ │ -
924 ++info;
│ │ │ -
925 ++riIter;
│ │ │ -
926 productBuilder.calculate(fine, *(*amap), const_cast<Matrix&>(level->getmat()), *info, copyFlags);
│ │ │ -
927 if(level.isRedistributed()) {
│ │ │ -
928 info->buildGlobalLookup(level->getmat().N());
│ │ │ -
929 redistributeMatrixEntries(const_cast<Matrix&>(level->getmat()),
│ │ │ -
930 const_cast<Matrix&>(level.getRedistributed().getmat()), *info,
│ │ │ -
931 info.getRedistributed(), *riIter);
│ │ │ -
932 info->freeGlobalLookup();
│ │ │ -
933 }
│ │ │ -
934 }
│ │ │ -
935 }
│ │ │ -
│ │ │ -
936
│ │ │ -
937 template<class M, class IS, class A>
│ │ │ -
│ │ │ - │ │ │ -
939 {
│ │ │ -
940 return matrices_.levels();
│ │ │ -
941 }
│ │ │ -
│ │ │ -
942
│ │ │ -
943 template<class M, class IS, class A>
│ │ │ -
│ │ │ - │ │ │ -
945 {
│ │ │ -
946 return maxlevels_;
│ │ │ -
947 }
│ │ │ -
│ │ │ -
948
│ │ │ -
949 template<class M, class IS, class A>
│ │ │ -
│ │ │ - │ │ │ -
951 {
│ │ │ -
952 return levels()==maxlevels() &&
│ │ │ -
953 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N()>0);
│ │ │ -
954 }
│ │ │ -
│ │ │ -
955
│ │ │ -
956 template<class M, class IS, class A>
│ │ │ -
│ │ │ - │ │ │ -
958 {
│ │ │ -
959 return built_;
│ │ │ -
960 }
│ │ │ -
│ │ │ -
961
│ │ │ -
963 } // namespace Amg
│ │ │ -
964} // namespace Dune
│ │ │ -
965
│ │ │ -
966#endif // end DUNE_AMG_MATRIXHIERARCHY_HH
│ │ │ -
Prolongation and restriction for amg.
│ │ │ -
Classes for the generic construction and application of the smoothers.
│ │ │ - │ │ │ -
Provides a class for building the index set and remote indices on the coarse level.
│ │ │ -
Provides a classes representing the hierarchies in AMG.
│ │ │ - │ │ │ -
Provides classes for building the matrix graph.
│ │ │ -
Provdes class for identifying aggregates globally.
│ │ │ -
Provides a class for building the galerkin product based on a aggregation scheme.
│ │ │ -
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ -
Helper classes for the construction of classes without empty constructor.
│ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ -
Some handy generic functions for ISTL matrices.
│ │ │ -
Functionality for redistributing a sparse matrix.
│ │ │ -
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ -
auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr)
Get the number of nonzero fields in the matrix.
Definition matrixutils.hh:119
│ │ │ -
const AggregatesMapList & aggregatesMaps() const
Get the hierarchy of the mappings of the nodes onto aggregates.
Definition matrixhierarchy.hh:816
│ │ │ -
bool isBuilt() const
Whether the hierarchy was built.
Definition matrixhierarchy.hh:957
│ │ │ -
bool hasCoarsest() const
Definition matrixhierarchy.hh:950
│ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition matrixhierarchy.hh:938
│ │ │ -
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ -
const RedistributeInfoList & redistributeInformation() const
Get the hierarchy of the information about redistributions,.
Definition matrixhierarchy.hh:822
│ │ │ -
const ParallelInformationHierarchy & parallelInformation() const
Get the hierarchy of the parallel data distribution information.
Definition matrixhierarchy.hh:741
│ │ │ -
bool repartitionAndDistributeMatrix(const M &origMatrix, std::shared_ptr< M > newMatrix, SequentialInformation &origComm, std::shared_ptr< SequentialInformation > &newComm, RedistributeInformation< SequentialInformation > &ri, int nparts, C1 &criterion)
Definition matrixhierarchy.hh:316
│ │ │ +
232 } // end Amg namespace
│ │ │ +
233
│ │ │ +
234
│ │ │ +
235#if HAVE_MPI
│ │ │ +
236 template<typename T, typename TI>
│ │ │ +
│ │ │ +
237 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
│ │ │ +
238 {
│ │ │ + │ │ │ + │ │ │ +
241 typedef SizeOne IndexedTypeFlag;
│ │ │ +
│ │ │ +
242 static int getSize(const Type&, int)
│ │ │ +
243 {
│ │ │ +
244 return 1;
│ │ │ +
245 }
│ │ │ +
│ │ │ +
246 };
│ │ │ +
│ │ │ +
247#endif
│ │ │ +
248
│ │ │ +
249} // end Dune namespace
│ │ │ +
251#endif
│ │ │ + │ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ -
const ParallelMatrixHierarchy & matrices() const
Get the matrix hierarchy.
Definition matrixhierarchy.hh:734
│ │ │ -
std::size_t maxlevels() const
Get the max number of levels in the hierarchy of processors.
Definition matrixhierarchy.hh:944
│ │ │
const_iterator end() const
Definition aggregates.hh:730
│ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ -
void recalculateGalerkin(const F &copyFlags)
Recalculate the galerkin products.
Definition matrixhierarchy.hh:902
│ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ -
std::size_t noVertices() const
Get the number of vertices.
│ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const
Coarsen the vector hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:845
│ │ │
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ -
MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< ParallelInformation > pinfo=std::make_shared< ParallelInformation >())
Constructor.
Definition matrixhierarchy.hh:392
│ │ │ -
AccumulationMode
Identifiers for the different accumulation modes.
Definition parameters.hh:231
│ │ │ -
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ -
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition matrixhierarchy.hh:403
│ │ │ -
void free()
Free the allocated memory.
│ │ │ -
void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename SmootherTraits< S >::Arguments &args) const
Coarsen the smoother hierarchy according to the matrix hierarchy.
Definition matrixhierarchy.hh:872
│ │ │ -
void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, bool finestLevel)
Build the dependency of the matrix graph.
│ │ │ -
std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, const C &criterion, bool finestLevel)
Build the aggregates.
│ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ -
void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const
Get the mapping of fine level unknowns to coarse level aggregates.
Definition matrixhierarchy.hh:747
│ │ │ -
~MatrixHierarchy()
Definition matrixhierarchy.hh:828
│ │ │ -
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition matrixhierarchy.hh:50
│ │ │ -
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ -
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │
Definition allocator.hh:11
│ │ │ -
void printGlobalSparseMatrix(const M &mat, C &ooc, std::ostream &os)
Definition matrixutils.hh:154
│ │ │ -
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Definition matrixredistribute.hh:757
│ │ │ -
bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
Definition repartition.hh:822
│ │ │ -
void redistributeMatrix(M &origMatrix, M &newMatrix, C &origComm, C &newComm, RedistributeInformation< C > &ri)
Redistribute a matrix according to given domain decompositions.
Definition matrixredistribute.hh:820
│ │ │ -
bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune::OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface &redistInf, bool verbose=false)
execute a graph repartition for a giving graph and indexset.
Definition repartition.hh:1228
│ │ │ -
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ -
A::size_type size_type
Type for indices and sizes.
Definition matrix.hh:577
│ │ │ -
MatrixImp::DenseMatrixBase< T, A >::window_type row_type
The type implementing a matrix row.
Definition matrix.hh:574
│ │ │ -
Definition matrixredistribute.hh:22
│ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ +
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ +
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ +
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ +
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ -
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ -
Definition galerkin.hh:99
│ │ │ -
Definition galerkin.hh:118
│ │ │ +
Definition globalaggregates.hh:29
│ │ │ +
const GlobalIndex & operator[](std::size_t index) const
Definition globalaggregates.hh:46
│ │ │ +
GlobalIndex & get(std::size_t index)
Definition globalaggregates.hh:60
│ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:33
│ │ │ +
void put(const GlobalIndex &global, size_t i)
Definition globalaggregates.hh:96
│ │ │ +
T Vertex
Definition globalaggregates.hh:39
│ │ │ +
GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const GlobalLookupIndexSet< ParallelIndexSet > &indexset)
Definition globalaggregates.hh:41
│ │ │ +
TI ParallelIndexSet
Definition globalaggregates.hh:31
│ │ │ +
ParallelIndexSet::LocalIndex LocalIndex
Definition globalaggregates.hh:37
│ │ │ +
ParallelIndexSet::GlobalIndex IndexedType
Definition globalaggregates.hh:35
│ │ │ +
Proxy operator[](std::size_t index)
Definition globalaggregates.hh:91
│ │ │ +
Definition globalaggregates.hh:70
│ │ │ +
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition globalaggregates.hh:72
│ │ │ +
Proxy & operator=(const GlobalIndex &global)
Definition globalaggregates.hh:76
│ │ │ +
Definition globalaggregates.hh:114
│ │ │ +
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition globalaggregates.hh:123
│ │ │ +
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:116
│ │ │ +
TI ParallelIndexSet
Definition globalaggregates.hh:115
│ │ │ +
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition globalaggregates.hh:118
│ │ │
Definition globalaggregates.hh:131
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ -
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ -
Definition graphcreator.hh:22
│ │ │ -
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ -
LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ -
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ -
Definition indicescoarsener.hh:36
│ │ │ -
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ -
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Allocator for pointers.
Definition matrixhierarchy.hh:85
│ │ │ -
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
The type of the parallel informarion hierarchy.
Definition matrixhierarchy.hh:82
│ │ │ -
std::list< AggregatesMap *, AAllocator > AggregatesMapList
The type of the aggregates maps list.
Definition matrixhierarchy.hh:88
│ │ │ -
PI ParallelInformation
The type of the index set.
Definition matrixhierarchy.hh:70
│ │ │ -
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
The type of the parallel matrix hierarchy.
Definition matrixhierarchy.hh:79
│ │ │ -
A Allocator
The allocator to use.
Definition matrixhierarchy.hh:73
│ │ │ -
RedistributeInformation< ParallelInformation > RedistributeInfoType
The type of the redistribute information.
Definition matrixhierarchy.hh:91
│ │ │ -
double getProlongationDampingFactor() const
Definition matrixhierarchy.hh:188
│ │ │ -
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Allocator for RedistributeInfoType.
Definition matrixhierarchy.hh:94
│ │ │ -
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
The type of the list of redistribute information.
Definition matrixhierarchy.hh:97
│ │ │ -
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
The type of the aggregates map we use.
Definition matrixhierarchy.hh:76
│ │ │ -
MatrixOperator::matrix_type Matrix
The type of the matrix.
Definition matrixhierarchy.hh:67
│ │ │ -
M MatrixOperator
The type of the matrix operator.
Definition matrixhierarchy.hh:64
│ │ │ -
void operator()(const matrix_row &row)
Definition matrixhierarchy.hh:254
│ │ │ -
Matrix::row_type matrix_row
Definition matrixhierarchy.hh:245
│ │ │ -
size_type min
Definition matrixhierarchy.hh:261
│ │ │ - │ │ │ -
size_type max
Definition matrixhierarchy.hh:262
│ │ │ -
size_type sum
Definition matrixhierarchy.hh:263
│ │ │ -
Matrix::size_type size_type
Definition matrixhierarchy.hh:244
│ │ │ -
The criterion describing the stop criteria for the coarsening process.
Definition matrixhierarchy.hh:283
│ │ │ -
CoarsenCriterion(const Dune::Amg::Parameters &parms)
Definition matrixhierarchy.hh:309
│ │ │ -
T AggregationCriterion
The criterion for tagging connections as strong and nodes as isolated. This might be e....
Definition matrixhierarchy.hh:289
│ │ │ -
CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode accumulate=successiveAccu, bool useFixedOrder=false)
Constructor.
Definition matrixhierarchy.hh:304
│ │ │ -
All parameters for AMG.
Definition parameters.hh:416
│ │ │ +
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:164
│ │ │ + │ │ │ + │ │ │ +
ParallelInformation::ParallelIndexSet IndexSet
Definition globalaggregates.hh:165
│ │ │ +
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition globalaggregates.hh:163
│ │ │ +
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:167
│ │ │ +
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:226
│ │ │ +
SequentialInformation ParallelInformation
Definition globalaggregates.hh:223
│ │ │ + │ │ │ +
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:224
│ │ │ +
static int getSize(const Type &, int)
Definition globalaggregates.hh:242
│ │ │ +
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition globalaggregates.hh:240
│ │ │ +
Amg::AggregatesMap< T > Type
Definition globalaggregates.hh:239
│ │ │ +
SizeOne IndexedTypeFlag
Definition globalaggregates.hh:241
│ │ │
Definition pinfo.hh:28
│ │ │ -
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ -
Definition transfer.hh:32
│ │ │ +
int GlobalLookupIndexSet
Definition pinfo.hh:54
│ │ │ +
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1290 +1,423 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -matrixhierarchy.hh │ │ │ │ +globalaggregates.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ -6#define DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ +5#ifndef DUNE_GLOBALAGGREGATES_HH │ │ │ │ +6#define DUNE_GLOBALAGGREGATES_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ -11#include "_g_r_a_p_h_._h_h" │ │ │ │ -12#include "_g_a_l_e_r_k_i_n_._h_h" │ │ │ │ -13#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ -14#include "_g_r_a_p_h_c_r_e_a_t_o_r_._h_h" │ │ │ │ -15#include "_h_i_e_r_a_r_c_h_y_._h_h" │ │ │ │ -16#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ -17#include │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h> │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_d_e_p_e_n_d_e_n_c_y_._h_h> │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_r_a_p_h_._h_h> │ │ │ │ -22#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h> │ │ │ │ -23#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ -24#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ -25#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ -26#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ -27 │ │ │ │ -28namespace _D_u_n_e │ │ │ │ -29{ │ │ │ │ -30 namespace Amg │ │ │ │ -31 { │ │ │ │ -42 enum { │ │ │ │ -50 _M_A_X___P_R_O_C_E_S_S_E_S = 72000 │ │ │ │ -_5_1 }; │ │ │ │ -52 │ │ │ │ -59 template > │ │ │ │ -_6_0 class _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +18#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ +19#include "_p_i_n_f_o_._h_h" │ │ │ │ +20#include │ │ │ │ +21 │ │ │ │ +22namespace _D_u_n_e │ │ │ │ +23{ │ │ │ │ +24 namespace Amg │ │ │ │ +25 { │ │ │ │ +26 │ │ │ │ +27 template │ │ │ │ +_2_8 struct _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +29 { │ │ │ │ +30 public: │ │ │ │ +_3_1 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ +32 │ │ │ │ +_3_3 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ +34 │ │ │ │ +_3_5 typedef typename ParallelIndexSet::GlobalIndex _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ +36 │ │ │ │ +_3_7 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ +38 │ │ │ │ +_3_9 typedef T _V_e_r_t_e_x; │ │ │ │ +40 │ │ │ │ +_4_1 _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +42 const GlobalLookupIndexSet& indexset) │ │ │ │ +43 : aggregates_(aggregates), indexset_(indexset) │ │ │ │ +44 {} │ │ │ │ +45 │ │ │ │ +_4_6 inline const _G_l_o_b_a_l_I_n_d_e_x& _o_p_e_r_a_t_o_r_[_](std::size_t index) const │ │ │ │ +47 { │ │ │ │ +48 const _V_e_r_t_e_x& aggregate = aggregates_[index]; │ │ │ │ +49 if(aggregate >= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ +50 assert(aggregate != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ +51 return isolatedMarker; │ │ │ │ +52 }else{ │ │ │ │ +53 const Dune::IndexPair* pair = indexset_.pair │ │ │ │ +(aggregate); │ │ │ │ +54 assert(pair!=0); │ │ │ │ +55 return pair->global(); │ │ │ │ +56 } │ │ │ │ +57 } │ │ │ │ +58 │ │ │ │ +59 │ │ │ │ +_6_0 inline _G_l_o_b_a_l_I_n_d_e_x& _g_e_t(std::size_t index) │ │ │ │ 61 { │ │ │ │ -62 public: │ │ │ │ -_6_4 typedef M _M_a_t_r_i_x_O_p_e_r_a_t_o_r; │ │ │ │ -65 │ │ │ │ -_6_7 typedef typename MatrixOperator::matrix_type _M_a_t_r_i_x; │ │ │ │ +62 const _V_e_r_t_e_x& aggregate = aggregates_[index]; │ │ │ │ +63 assert(aggregate < _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D); │ │ │ │ +64 const Dune::IndexPair* pair = indexset_.pair │ │ │ │ +(aggregate); │ │ │ │ +65 assert(pair!=0); │ │ │ │ +66 return const_cast<_G_l_o_b_a_l_I_n_d_e_x&>(pair->global()); │ │ │ │ +67 } │ │ │ │ 68 │ │ │ │ -_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -71 │ │ │ │ -_7_3 typedef A _A_l_l_o_c_a_t_o_r; │ │ │ │ -74 │ │ │ │ -_7_6 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_>_:_: │ │ │ │ -_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r> _A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ -77 │ │ │ │ -_7_9 typedef _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_A_l_l_o_c_a_t_o_r_> │ │ │ │ -_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y; │ │ │ │ -80 │ │ │ │ -_8_2 typedef _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_A_l_l_o_c_a_t_o_r_> │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ -83 │ │ │ │ -_8_5 using _A_A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ -rebind_alloc; │ │ │ │ -86 │ │ │ │ -_8_8 typedef std::list _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t; │ │ │ │ -89 │ │ │ │ -_9_1 typedef _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e; │ │ │ │ -92 │ │ │ │ -_9_4 using _R_I_L_A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ -rebind_alloc; │ │ │ │ +_6_9 class _P_r_o_x_y │ │ │ │ +70 { │ │ │ │ +71 public: │ │ │ │ +_7_2 _P_r_o_x_y(const GlobalLookupIndexSet& indexset, _V_e_r_t_e_x& │ │ │ │ +aggregate) │ │ │ │ +73 : indexset_(&indexset), aggregate_(&aggregate) │ │ │ │ +74 {} │ │ │ │ +75 │ │ │ │ +_7_6 _P_r_o_x_y& _o_p_e_r_a_t_o_r_=(const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ +77 { │ │ │ │ +78 if(global==isolatedMarker) │ │ │ │ +79 *aggregate_ = _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D; │ │ │ │ +80 else{ │ │ │ │ +81 //assert(global < AggregatesMap::ISOLATED); │ │ │ │ +82 *aggregate_ = indexset_->operator[](global).local(); │ │ │ │ +83 } │ │ │ │ +84 return *this; │ │ │ │ +85 } │ │ │ │ +86 private: │ │ │ │ +87 const GlobalLookupIndexSet* indexset_; │ │ │ │ +88 _V_e_r_t_e_x* aggregate_; │ │ │ │ +89 }; │ │ │ │ +90 │ │ │ │ +_9_1 inline _P_r_o_x_y _o_p_e_r_a_t_o_r_[_](std::size_t index) │ │ │ │ +92 { │ │ │ │ +93 return _P_r_o_x_y(indexset_, aggregates_[index]); │ │ │ │ +94 } │ │ │ │ 95 │ │ │ │ -_9_7 typedef std::list _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t; │ │ │ │ -98 │ │ │ │ -104 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(std::shared_ptr fineMatrix, │ │ │ │ -105 std::shared_ptr pinfo = std:: │ │ │ │ -make_shared()); │ │ │ │ -106 │ │ │ │ -107 _~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(); │ │ │ │ -108 │ │ │ │ -114 template │ │ │ │ -115 void _b_u_i_l_d(const T& criterion); │ │ │ │ -116 │ │ │ │ -124 template │ │ │ │ -125 void _r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n(const F& copyFlags); │ │ │ │ -126 │ │ │ │ -131 template │ │ │ │ -132 void _c_o_a_r_s_e_n_V_e_c_t_o_r(_H_i_e_r_a_r_c_h_y<_B_l_o_c_k_V_e_c_t_o_r_<_V_,_B_A_>, TA>& hierarchy) const; │ │ │ │ -133 │ │ │ │ -139 template │ │ │ │ -140 void _c_o_a_r_s_e_n_S_m_o_o_t_h_e_r(_H_i_e_r_a_r_c_h_y_<_S_,_T_A_>& smoothers, │ │ │ │ -141 const typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s& args) const; │ │ │ │ -142 │ │ │ │ -147 std::size_t _l_e_v_e_l_s() const; │ │ │ │ -148 │ │ │ │ -153 std::size_t _m_a_x_l_e_v_e_l_s() const; │ │ │ │ -154 │ │ │ │ -155 bool _h_a_s_C_o_a_r_s_e_s_t() const; │ │ │ │ -156 │ │ │ │ -161 bool _i_s_B_u_i_l_t() const; │ │ │ │ -162 │ │ │ │ -167 const _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y& _m_a_t_r_i_c_e_s() const; │ │ │ │ -168 │ │ │ │ -173 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y& _p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ -174 │ │ │ │ -179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t& _a_g_g_r_e_g_a_t_e_s_M_a_p_s() const; │ │ │ │ -180 │ │ │ │ -186 const _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t& _r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() const; │ │ │ │ -187 │ │ │ │ -_1_8_8 double _g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r() const │ │ │ │ -189 { │ │ │ │ -190 return prolongDamp_; │ │ │ │ -191 } │ │ │ │ -192 │ │ │ │ -203 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t(std::vector& data) const; │ │ │ │ -204 │ │ │ │ -205 private: │ │ │ │ -206 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_>_:_:_A_r_g_u_m_e_n_t_s MatrixArgs; │ │ │ │ -207 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ -CommunicationArgs; │ │ │ │ -209 _A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t aggregatesMaps_; │ │ │ │ -211 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t redistributes_; │ │ │ │ -213 _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y matrices_; │ │ │ │ -215 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y parallelInformation_; │ │ │ │ -216 │ │ │ │ -218 bool built_; │ │ │ │ -219 │ │ │ │ -221 int maxlevels_; │ │ │ │ -222 │ │ │ │ -223 double prolongDamp_; │ │ │ │ -224 │ │ │ │ -228 template │ │ │ │ -229 struct MatrixStats │ │ │ │ -230 { │ │ │ │ +_9_6 inline void _p_u_t(const _G_l_o_b_a_l_I_n_d_e_x& global, size_t i) │ │ │ │ +97 { │ │ │ │ +98 aggregates_[i]=indexset_[global].local(); │ │ │ │ +99 │ │ │ │ +100 } │ │ │ │ +101 │ │ │ │ +102 private: │ │ │ │ +103 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +104 const GlobalLookupIndexSet& indexset_; │ │ │ │ +105 static const _G_l_o_b_a_l_I_n_d_e_x isolatedMarker; │ │ │ │ +106 }; │ │ │ │ +107 │ │ │ │ +108 template │ │ │ │ +109 const typename TI::GlobalIndex GlobalAggregatesMap::isolatedMarker = │ │ │ │ +110 std::numeric_limits::max(); │ │ │ │ +111 │ │ │ │ +112 template │ │ │ │ +_1_1_3 struct _A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ +114 { │ │ │ │ +_1_1_5 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ +_1_1_6 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ +117 │ │ │ │ +_1_1_8 static const _G_l_o_b_a_l_I_n_d_e_x& _g_a_t_h_e_r(const _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, │ │ │ │ +size_t i) │ │ │ │ +119 { │ │ │ │ +120 return ga[i]; │ │ │ │ +121 } │ │ │ │ +122 │ │ │ │ +_1_2_3 static void _s_c_a_t_t_e_r(_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, _G_l_o_b_a_l_I_n_d_e_x global, │ │ │ │ +size_t i) │ │ │ │ +124 { │ │ │ │ +125 ga[i]=global; │ │ │ │ +126 } │ │ │ │ +127 }; │ │ │ │ +128 │ │ │ │ +129 template │ │ │ │ +_1_3_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ +131 {}; │ │ │ │ +132 │ │ │ │ +133#if HAVE_MPI │ │ │ │ +134 │ │ │ │ +135#endif │ │ │ │ +136 │ │ │ │ +137 } // namespace Amg │ │ │ │ +138 │ │ │ │ +139#if HAVE_MPI │ │ │ │ +140 // forward declaration │ │ │ │ +141 template │ │ │ │ +142 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ +143#endif │ │ │ │ +144 │ │ │ │ +145 namespace Amg │ │ │ │ +146 { │ │ │ │ +147 │ │ │ │ +148#if HAVE_MPI │ │ │ │ +158 template │ │ │ │ +_1_5_9 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r > │ │ │ │ +160 { │ │ │ │ +_1_6_1 typedef T _V_e_r_t_e_x; │ │ │ │ +_1_6_2 typedef O _O_v_e_r_l_a_p_F_l_a_g_s; │ │ │ │ +_1_6_3 typedef _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +_1_6_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ +_1_6_5 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t _I_n_d_e_x_S_e_t; │ │ │ │ +166 │ │ │ │ +_1_6_7 static void _p_u_b_l_i_s_h(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +168 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +169 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ +170 { │ │ │ │ +171 typedef _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_,_I_n_d_e_x_S_e_t_> GlobalMap; │ │ │ │ +172 GlobalMap gmap(aggregates, globalLookup); │ │ │ │ +173 pinfo._c_o_p_y_O_w_n_e_r_T_o_A_l_l(gmap,gmap); │ │ │ │ +174 // communication only needed for ALU │ │ │ │ +175 // (ghosts with same global id as owners on the same process) │ │ │ │ +176 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo) == static_cast(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ +_n_o_n_o_v_e_r_l_a_p_p_i_n_g)) │ │ │ │ +177 pinfo._c_o_p_y_C_o_p_y_T_o_A_l_l(gmap,gmap); │ │ │ │ +178 │ │ │ │ +179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists; │ │ │ │ +180 Lists lists = pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().find(pinfo._c_o_m_m_u_n_i_c_a_t_o_r().rank()); │ │ │ │ +181 if(lists!=pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end()) { │ │ │ │ +182 │ │ │ │ +183 // For periodic boundary conditions we must renumber │ │ │ │ +184 // the aggregates of vertices in the overlap whose owners are │ │ │ │ +185 // on the same process │ │ │ │ +186 _V_e_r_t_e_x maxAggregate =0; │ │ │ │ +187 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iter; │ │ │ │ +188 for(Iter i=aggregates._b_e_g_i_n(), end=aggregates._e_n_d(); i!=end; ++i) │ │ │ │ +189 maxAggregate = std::max(maxAggregate, *i); │ │ │ │ +190 │ │ │ │ +191 // Compute new mapping of aggregates in the overlap that we also own │ │ │ │ +192 std::map newMapping; │ │ │ │ +193 │ │ │ │ +194 // insert all elements into map │ │ │ │ +195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList │ │ │ │ +196 ::const_iterator RIter; │ │ │ │ +197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ +(); │ │ │ │ +198 ri!=rend; ++ri) │ │ │ │ +199 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ +200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()], │ │ │ │ +201 maxAggregate)); │ │ │ │ +202 // renumber │ │ │ │ +203 typedef typename std::map::iterator MIter; │ │ │ │ +204 for(MIter mi=newMapping.begin(), mend=newMapping.end(); │ │ │ │ +205 mi != mend; ++mi) │ │ │ │ +206 mi->second=++maxAggregate; │ │ │ │ +207 │ │ │ │ +208 │ │ │ │ +209 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ +(); │ │ │ │ +210 ri!=rend; ++ri) │ │ │ │ +211 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ +212 aggregates[ri->localIndexPair().local()] = │ │ │ │ +213 newMapping[aggregates[ri->localIndexPair().local()]]; │ │ │ │ +214 } │ │ │ │ +215 } │ │ │ │ +216 }; │ │ │ │ +217#endif │ │ │ │ +218 │ │ │ │ +219 template │ │ │ │ +_2_2_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ +221 { │ │ │ │ +_2_2_2 typedef T _V_e_r_t_e_x; │ │ │ │ +_2_2_3 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +_2_2_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ +225 │ │ │ │ +_2_2_6 static void _p_u_b_l_i_s_h([[maybe_unused]] _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +227 [[maybe_unused]] _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ +228 [[maybe_unused]] const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ +229 {} │ │ │ │ +230 }; │ │ │ │ 231 │ │ │ │ -235 static void stats([[maybe_unused]] const _M_a_t_r_i_x& matrix) │ │ │ │ -236 {} │ │ │ │ -237 }; │ │ │ │ -238 │ │ │ │ -239 template │ │ │ │ -240 struct MatrixStats<_M_a_t_r_i_x,true> │ │ │ │ -241 { │ │ │ │ -_2_4_2 struct calc │ │ │ │ +232 } // end Amg namespace │ │ │ │ +233 │ │ │ │ +234 │ │ │ │ +235#if HAVE_MPI │ │ │ │ +236 template │ │ │ │ +_2_3_7 struct CommPolicy > │ │ │ │ +238 { │ │ │ │ +_2_3_9 typedef _A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_> _T_y_p_e; │ │ │ │ +_2_4_0 typedef typename _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>_:_:_I_n_d_e_x_e_d_T_y_p_e _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ +_2_4_1 typedef SizeOne _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ +_2_4_2 static int _g_e_t_S_i_z_e(const _T_y_p_e&, int) │ │ │ │ 243 { │ │ │ │ -_2_4_4 typedef typename _M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e _s_i_z_e___t_y_p_e; │ │ │ │ -_2_4_5 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _m_a_t_r_i_x___r_o_w; │ │ │ │ -246 │ │ │ │ -_2_4_7 _c_a_l_c() │ │ │ │ -248 { │ │ │ │ -249 min=std::numeric_limits::max(); │ │ │ │ -250 max=0; │ │ │ │ -251 sum=0; │ │ │ │ -252 } │ │ │ │ -253 │ │ │ │ -_2_5_4 void _o_p_e_r_a_t_o_r_(_)(const _m_a_t_r_i_x___r_o_w& row) │ │ │ │ -255 { │ │ │ │ -256 min=std::min(min, row.size()); │ │ │ │ -257 max=std::max(max, row.size()); │ │ │ │ -258 sum += row.size(); │ │ │ │ -259 } │ │ │ │ -260 │ │ │ │ -_2_6_1 _s_i_z_e___t_y_p_e _m_i_n; │ │ │ │ -_2_6_2 _s_i_z_e___t_y_p_e _m_a_x; │ │ │ │ -_2_6_3 _s_i_z_e___t_y_p_e _s_u_m; │ │ │ │ -264 }; │ │ │ │ -268 static void stats(const _M_a_t_r_i_x& matrix) │ │ │ │ -269 { │ │ │ │ -270 calc c= for_each(matrix.begin(), matrix.end(), calc()); │ │ │ │ -271 dinfo<<"Matrix row: min="< │ │ │ │ -_3_2_9 bool _r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(const M& origMatrix, │ │ │ │ -330 std::shared_ptr newMatrix, │ │ │ │ -331 C& origComm, │ │ │ │ -332 std::shared_ptr& newComm, │ │ │ │ -333 _R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n_<_C_>& ri, │ │ │ │ -334 int nparts, C1& criterion) │ │ │ │ -335 { │ │ │ │ -336 Timer time; │ │ │ │ -337#ifdef AMG_REPART_ON_COMM_GRAPH │ │ │ │ -338 // Done not repartition the matrix graph, but a graph of the communication │ │ │ │ -scheme. │ │ │ │ -339 bool existentOnRedist=_D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n(origMatrix, origComm, │ │ │ │ -nparts, newComm, │ │ │ │ -340 ri.getInterface(), │ │ │ │ -341 criterion.debugLevel()>1); │ │ │ │ -342 │ │ │ │ -343#else │ │ │ │ -344 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ -345 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ -346 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -347 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -348 IdentityMap, │ │ │ │ -349 IdentityMap> _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ -350 _M_a_t_r_i_x_G_r_a_p_h graph(origMatrix); │ │ │ │ -351 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h pgraph(graph); │ │ │ │ -352 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(pgraph, origMatrix, criterion, false); │ │ │ │ -353 │ │ │ │ -354#ifdef DEBUG_REPART │ │ │ │ -355 if(origComm.communicator().rank()==0) │ │ │ │ -356 std::cout<<"Original matrix"<1); │ │ │ │ -363#endif // if else AMG_REPART │ │ │ │ -364 │ │ │ │ -365 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ -366 std::cout<<"Repartitioning took "<indexSet(), │ │ │ │ -origComm.communicator()); │ │ │ │ -372#endif │ │ │ │ -373 │ │ │ │ -374 _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(const_cast(origMatrix), *newMatrix, origComm, │ │ │ │ -*newComm, ri); │ │ │ │ -375 │ │ │ │ -376#ifdef DEBUG_REPART │ │ │ │ -377 if(origComm.communicator().rank()==0) │ │ │ │ -378 std::cout<<"Original matrix"<communicator().size()>0) │ │ │ │ -381 _p_r_i_n_t_G_l_o_b_a_l_S_p_a_r_s_e_M_a_t_r_i_x(*newMatrix, *newComm, std::cout); │ │ │ │ -382 origComm.communicator().barrier(); │ │ │ │ -383#endif │ │ │ │ -384 │ │ │ │ -385 if(origComm.communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ -386 std::cout<<"Redistributing matrix took "< │ │ │ │ -_3_9_2 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(std::shared_ptr │ │ │ │ -fineMatrix, │ │ │ │ -393 std::shared_ptr pinfo) │ │ │ │ -394 : matrices_(fineMatrix), │ │ │ │ -395 parallelInformation_(pinfo) │ │ │ │ -396 { │ │ │ │ -397 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(*fineMatrix) != _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ -(*pinfo)) │ │ │ │ -398 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "MatrixOperator and ParallelInformation must belong │ │ │ │ -to the same category!"); │ │ │ │ -399 } │ │ │ │ -400 │ │ │ │ -401 template │ │ │ │ -402 template │ │ │ │ -_4_0_3 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_b_u_i_l_d(const T& criterion) │ │ │ │ -404 { │ │ │ │ -405 prolongDamp_ = criterion.getProlongationDampingFactor(); │ │ │ │ -406 typedef O OverlapFlags; │ │ │ │ -407 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r MatIterator; │ │ │ │ -408 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r PInfoIterator; │ │ │ │ -409 │ │ │ │ -410 static const int noints=(_D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S/4096>0) ? (_D_u_n_e_:_:_A_m_g_:_: │ │ │ │ -_M_A_X___P_R_O_C_E_S_S_E_S/4096) : 1; │ │ │ │ -411 │ │ │ │ -412 typedef bigunsignedint BIGINT; │ │ │ │ -413 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> productBuilder; │ │ │ │ -414 MatIterator mlevel = matrices_.finest(); │ │ │ │ -415 MatrixStats::stats(mlevel->getmat()); │ │ │ │ -416 │ │ │ │ -417 PInfoIterator infoLevel = parallelInformation_.finest(); │ │ │ │ -418 BIGINT finenonzeros=_c_o_u_n_t_N_o_n_Z_e_r_o_s(mlevel->getmat()); │ │ │ │ -419 finenonzeros = infoLevel->communicator().sum(finenonzeros); │ │ │ │ -420 BIGINT allnonzeros = finenonzeros; │ │ │ │ -421 │ │ │ │ -422 │ │ │ │ -423 int level = 0; │ │ │ │ -424 int rank = 0; │ │ │ │ -425 │ │ │ │ -426 BIGINT unknowns = mlevel->getmat().N(); │ │ │ │ -427 │ │ │ │ -428 unknowns = infoLevel->communicator().sum(unknowns); │ │ │ │ -429 double dunknowns=unknowns.todouble(); │ │ │ │ -430 infoLevel->buildGlobalLookup(mlevel->getmat().N()); │ │ │ │ -431 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ -432 │ │ │ │ -433 for(; level < criterion.maxLevel(); ++level, ++mlevel) { │ │ │ │ -434 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ -435 rank = infoLevel->communicator().rank(); │ │ │ │ -436 if(rank==0 && criterion.debugLevel()>1) │ │ │ │ -437 std::cout<<"Level "<communicator().size() │ │ │ │ -438 <<" unknowns per proc (procs="<communicator().size │ │ │ │ -()<<")"<communicator().size())) │ │ │ │ -451 && infoLevel->communicator().size()>1 && │ │ │ │ -452 dunknowns/infoLevel->communicator().size() <= criterion.coarsenTarget()) │ │ │ │ -453 { │ │ │ │ -454 // accumulate to fewer processors │ │ │ │ -455 std::shared_ptr redistMat = std::make_shared(); │ │ │ │ -456 std::shared_ptr redistComm; │ │ │ │ -457 std::size_t nodomains = (std::size_t)std::ceil(dunknowns/ │ │ │ │ -(criterion.minAggregateSize() │ │ │ │ -458 *criterion.coarsenTarget())); │ │ │ │ -459 if( nodomains<=criterion.minAggregateSize()/2 || │ │ │ │ -460 dunknowns <= criterion.coarsenTarget() ) │ │ │ │ -461 nodomains=1; │ │ │ │ -462 │ │ │ │ -463 bool existentOnNextLevel = │ │ │ │ -464 _r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(mlevel->getmat(), redistMat, *infoLevel, │ │ │ │ -465 redistComm, redistributes_.back(), nodomains, │ │ │ │ -466 criterion); │ │ │ │ -467 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ -468 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ -469 dunknowns= unknownsRedist.todouble(); │ │ │ │ -470 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) │ │ │ │ -471 std::cout<<"Level "<communicator().size() │ │ │ │ -472 <<" unknowns per proc (procs="<communicator().size │ │ │ │ -()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ -(args)); │ │ │ │ -475 assert(mlevel.isRedistributed()); │ │ │ │ -476 infoLevel.addRedistributed(redistComm); │ │ │ │ -477 infoLevel->freeGlobalLookup(); │ │ │ │ -478 │ │ │ │ -479 if(!existentOnNextLevel) │ │ │ │ -480 // We do not hold any data on the redistributed partitioning │ │ │ │ -481 break; │ │ │ │ -482 │ │ │ │ -483 // Work on the redistributed Matrix from now on │ │ │ │ -484 matrix = &(mlevel.getRedistributed()); │ │ │ │ -485 info = &(infoLevel.getRedistributed()); │ │ │ │ -486 info->buildGlobalLookup(matrix->getmat().N()); │ │ │ │ -487 } │ │ │ │ -488 │ │ │ │ -489 rank = info->communicator().rank(); │ │ │ │ -490 if(dunknowns <= criterion.coarsenTarget()) │ │ │ │ -491 // No further coarsening needed │ │ │ │ -492 break; │ │ │ │ -493 │ │ │ │ -494 typedef _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ -GraphCreator; │ │ │ │ -495 typedef typename GraphCreator::PropertiesGraph _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ -496 typedef typename GraphCreator::GraphTuple GraphTuple; │ │ │ │ -497 │ │ │ │ -498 typedef typename _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r Vertex; │ │ │ │ -499 │ │ │ │ -500 std::vector excluded(matrix->getmat().N(), false); │ │ │ │ -501 │ │ │ │ -502 GraphTuple graphs = GraphCreator::create(*matrix, excluded, *info, │ │ │ │ -OverlapFlags()); │ │ │ │ -503 │ │ │ │ -504 _A_g_g_r_e_g_a_t_e_s_M_a_p* aggregatesMap=new _A_g_g_r_e_g_a_t_e_s_M_a_p(std::get<1>(graphs)- │ │ │ │ ->maxVertex()+1); │ │ │ │ -505 │ │ │ │ -506 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ -507 │ │ │ │ -508 Timer watch; │ │ │ │ -509 watch.reset(); │ │ │ │ -510 auto [noAggregates, isoAggregates, oneAggregates, skippedAggregates] = │ │ │ │ -511 aggregatesMap->_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s(matrix->getmat(), *(std::get<1>(graphs)), │ │ │ │ -criterion, level==0); │ │ │ │ -512 │ │ │ │ -513 if(rank==0 && criterion.debugLevel()>2) │ │ │ │ -514 std::cout<<" Have built "<communicator().rank(); │ │ │ │ -522 int n = UNKNOWNS/procs; // number of unknowns per process │ │ │ │ -523 int bigger = UNKNOWNS%procs; // number of process with n+1 unknowns │ │ │ │ -524 │ │ │ │ -525 // Compute owner region │ │ │ │ -526 if(rank0) │ │ │ │ -536 overlapStart = start - 1; │ │ │ │ -537 else │ │ │ │ -538 overlapStart = start; │ │ │ │ -539 │ │ │ │ -540 if(end_n_o_V_e_r_t_i_c_e_s()); │ │ │ │ -546 for(int j=0; j< UNKNOWNS; ++j) │ │ │ │ -547 for(int i=0; i < UNKNOWNS; ++i) │ │ │ │ -548 { │ │ │ │ -549 if(i>=overlapStart && i1 && info->communicator().rank()==0) │ │ │ │ -558 std::cout<<"aggregating finished."<communicator().sum(gnoAggregates); │ │ │ │ -562 double dgnoAggregates = gnoAggregates.todouble(); │ │ │ │ -563#ifdef TEST_AGGLO │ │ │ │ -564 BIGINT gnoAggregates=((UNKNOWNS)/2)*((UNKNOWNS)/2); │ │ │ │ -565#endif │ │ │ │ -566 │ │ │ │ -567 if(criterion.debugLevel()>2 && rank==0) │ │ │ │ -568 std::cout << "Building "<0) │ │ │ │ -575 std::cerr << "Stopped coarsening because of rate breakdown "<_f_r_e_e(); │ │ │ │ -582 delete aggregatesMap; │ │ │ │ -583 aggregatesMaps_.pop_back(); │ │ │ │ -584 │ │ │ │ -585 if(criterion.accumulate() && mlevel.isRedistributed() && info->communicator │ │ │ │ -().size()>1) { │ │ │ │ -586 // coarse level matrix was already redistributed, but to more than 1 │ │ │ │ -process │ │ │ │ -587 // Therefore need to delete the redistribution. Further down it will │ │ │ │ -588 // then be redistributed to 1 process │ │ │ │ -589 delete &(mlevel.getRedistributed().getmat()); │ │ │ │ -590 mlevel.deleteRedistributed(); │ │ │ │ -591 delete &(infoLevel.getRedistributed()); │ │ │ │ -592 infoLevel.deleteRedistributed(); │ │ │ │ -593 redistributes_.back().resetSetup(); │ │ │ │ -594 } │ │ │ │ -595 │ │ │ │ -596 break; │ │ │ │ -597 } │ │ │ │ -598 unknowns = noAggregates; │ │ │ │ -599 dunknowns = dgnoAggregates; │ │ │ │ -600 │ │ │ │ -601 CommunicationArgs commargs(info->communicator(),info->category()); │ │ │ │ -602 parallelInformation_.addCoarser(commargs); │ │ │ │ -603 │ │ │ │ -604 ++infoLevel; // parallel information on coarse level │ │ │ │ -605 │ │ │ │ -606 typename PropertyMapTypeSelector::Type │ │ │ │ -visitedMap = │ │ │ │ -607 _g_e_t(_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g(), *(std::get<1>(graphs))); │ │ │ │ -608 │ │ │ │ -609 watch.reset(); │ │ │ │ -610 int aggregates = _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_O_v_e_r_l_a_p_F_l_a_g_s_> │ │ │ │ -611_ _:_:_c_o_a_r_s_e_n(*info, │ │ │ │ -612 *(std::get<1>(graphs)), │ │ │ │ -613 visitedMap, │ │ │ │ -614 *aggregatesMap, │ │ │ │ -615 *infoLevel, │ │ │ │ -616 noAggregates, │ │ │ │ -617 criterion.useFixedOrder()); │ │ │ │ -618 GraphCreator::free(graphs); │ │ │ │ -619 │ │ │ │ -620 if(criterion.debugLevel()>2) { │ │ │ │ -621 if(rank==0) │ │ │ │ -622 std::cout<<"Coarsening of index sets took "<buildGlobalLookup(aggregates); │ │ │ │ -628 _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_V_e_r_t_e_x_,_O_v_e_r_l_a_p_F_l_a_g_s_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_p_u_b_l_i_s_h │ │ │ │ -(*aggregatesMap, │ │ │ │ -629 *info, │ │ │ │ -630 infoLevel->globalLookup()); │ │ │ │ -631 │ │ │ │ -632 │ │ │ │ -633 if(criterion.debugLevel()>2) { │ │ │ │ -634 if(rank==0) │ │ │ │ -635 std::cout<<"Communicating global aggregate numbers took "<& visited=excluded; │ │ │ │ -640 │ │ │ │ -641 typedef std::vector::iterator Iterator; │ │ │ │ -642 typedef IteratorPropertyMap VisitedMap2; │ │ │ │ -643 Iterator end = visited.end(); │ │ │ │ -644 for(Iterator iter= visited.begin(); iter != end; ++iter) │ │ │ │ -645 *iter=false; │ │ │ │ -646 │ │ │ │ -647 VisitedMap2 visitedMap2(visited.begin(), Dune::IdentityMap()); │ │ │ │ -648 │ │ │ │ -649 std::shared_ptr │ │ │ │ -650 coarseMatrix(productBuilder.build(*(std::get<0>(graphs)), visitedMap2, │ │ │ │ -651 *info, │ │ │ │ -652 *aggregatesMap, │ │ │ │ -653 aggregates, │ │ │ │ -654 OverlapFlags())); │ │ │ │ -655 dverb<<"Building of sparsity pattern took "<freeGlobalLookup(); │ │ │ │ -658 │ │ │ │ -659 delete std::get<0>(graphs); │ │ │ │ -660 productBuilder.calculate(matrix->getmat(), *aggregatesMap, *coarseMatrix, │ │ │ │ -*infoLevel, OverlapFlags()); │ │ │ │ -661 │ │ │ │ -662 if(criterion.debugLevel()>2) { │ │ │ │ -663 if(rank==0) │ │ │ │ -664 std::cout<<"Calculation entries of Galerkin product took "<communicator().sum(nonzeros); │ │ │ │ -669 MatrixArgs args(coarseMatrix, *infoLevel); │ │ │ │ -670 │ │ │ │ -671 matrices_.addCoarser(args); │ │ │ │ -672 redistributes_.push_back(_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e()); │ │ │ │ -673 } // end level loop │ │ │ │ -674 │ │ │ │ -675 │ │ │ │ -676 infoLevel->freeGlobalLookup(); │ │ │ │ -677 │ │ │ │ -678 built_=true; │ │ │ │ -679 _A_g_g_r_e_g_a_t_e_s_M_a_p* aggregatesMap=new _A_g_g_r_e_g_a_t_e_s_M_a_p(0); │ │ │ │ -680 aggregatesMaps_.push_back(aggregatesMap); │ │ │ │ -681 │ │ │ │ -682 if(criterion.debugLevel()>0) { │ │ │ │ -683 if(level==criterion.maxLevel()) { │ │ │ │ -684 BIGINT unknownsLevel = mlevel->getmat().N(); │ │ │ │ -685 unknownsLevel = infoLevel->communicator().sum(unknownsLevel); │ │ │ │ -686 if(rank==0 && criterion.debugLevel()>1) { │ │ │ │ -687 double dunknownsLevel = unknownsLevel.todouble(); │ │ │ │ -688 std::cout<<"Level "<communicator().size() │ │ │ │ -689 <<" unknowns per proc (procs="<communicator().size │ │ │ │ -()<<")"<communicator().size()>1) { │ │ │ │ -696#if HAVE_MPI && !HAVE_PARMETIS │ │ │ │ -697 if(criterion.accumulate()==_s_u_c_c_e_s_s_i_v_e_A_c_c_u && │ │ │ │ -698 infoLevel->communicator().rank()==0) │ │ │ │ -699 std::cerr<<"Successive accumulation of data on coarse levels only works │ │ │ │ -with ParMETIS installed." │ │ │ │ -700 <<" Fell back to accumulation to one domain on coarsest level"< redistMat = std::make_shared(); │ │ │ │ -705 std::shared_ptr redistComm; │ │ │ │ -706 int nodomains = 1; │ │ │ │ -707 │ │ │ │ -708 _r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x(mlevel->getmat(), redistMat, *infoLevel, │ │ │ │ -709 redistComm, redistributes_.back(), nodomains,criterion); │ │ │ │ -710 MatrixArgs args(redistMat, *redistComm); │ │ │ │ -711 BIGINT unknownsRedist = redistMat->N(); │ │ │ │ -712 unknownsRedist = infoLevel->communicator().sum(unknownsRedist); │ │ │ │ -713 │ │ │ │ -714 if(redistComm->communicator().rank()==0 && criterion.debugLevel()>1) { │ │ │ │ -715 double dunknownsRedist = unknownsRedist.todouble(); │ │ │ │ -716 std::cout<<"Level "<communicator().size() │ │ │ │ -717 <<" unknowns per proc (procs="<communicator().size │ │ │ │ -()<<")"<_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ -(args)); │ │ │ │ -720 infoLevel.addRedistributed(redistComm); │ │ │ │ -721 infoLevel->freeGlobalLookup(); │ │ │ │ -722 } │ │ │ │ -723 │ │ │ │ -724 int levels = matrices_.levels(); │ │ │ │ -725 maxlevels_ = parallelInformation_.finest()->communicator().max(levels); │ │ │ │ -726 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ -727 if(hasCoarsest() && rank==0 && criterion.debugLevel()>1) │ │ │ │ -728 std::cout<<"operator complexity: "< │ │ │ │ -733 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y& │ │ │ │ -_7_3_4 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_m_a_t_r_i_c_e_s() const │ │ │ │ -735 { │ │ │ │ -736 return matrices_; │ │ │ │ -737 } │ │ │ │ -738 │ │ │ │ -739 template │ │ │ │ -740 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y& │ │ │ │ -_7_4_1 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n() const │ │ │ │ -742 { │ │ │ │ -743 return parallelInformation_; │ │ │ │ -744 } │ │ │ │ -745 │ │ │ │ -746 template │ │ │ │ -_7_4_7 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t(std:: │ │ │ │ -vector& data) const │ │ │ │ -748 { │ │ │ │ -749 int levels=aggregatesMaps().size(); │ │ │ │ -750 int maxlevels=parallelInformation_._f_i_n_e_s_t()->communicator().max(levels); │ │ │ │ -751 std::size_t size=(*(aggregatesMaps().begin()))->noVertices(); │ │ │ │ -752 // We need an auxiliary vector for the consecutive prolongation. │ │ │ │ -753 std::vector tmp; │ │ │ │ -754 std::vector *coarse, *fine; │ │ │ │ -755 │ │ │ │ -756 // make sure the allocated space suffices. │ │ │ │ -757 tmp.reserve(size); │ │ │ │ -758 data.reserve(size); │ │ │ │ -759 │ │ │ │ -760 // Correctly assign coarse and fine for the first prolongation such that │ │ │ │ -761 // we end up in data in the end. │ │ │ │ -762 if(levels%2==0) { │ │ │ │ -763 coarse=&tmp; │ │ │ │ -764 fine=&data; │ │ │ │ -765 }else{ │ │ │ │ -766 coarse=&data; │ │ │ │ -767 fine=&tmp; │ │ │ │ -768 } │ │ │ │ -769 │ │ │ │ -770 // Number the unknowns on the coarsest level consecutively for each │ │ │ │ -process. │ │ │ │ -771 if(levels==maxlevels) { │ │ │ │ -772 const _A_g_g_r_e_g_a_t_e_s_M_a_p& map = *(*(++aggregatesMaps().rbegin())); │ │ │ │ -773 std::size_t m=0; │ │ │ │ -774 │ │ │ │ -775 for(typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r iter = map._b_e_g_i_n(); iter != │ │ │ │ -map._e_n_d(); ++iter) │ │ │ │ -776 if(*iter< _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) │ │ │ │ -777 m=std::max(*iter,m); │ │ │ │ -778 │ │ │ │ -779 coarse->resize(m+1); │ │ │ │ -780 std::size_t i=0; │ │ │ │ -781 srand((unsigned)std::clock()); │ │ │ │ -782 std::set used; │ │ │ │ -783 for(typename std::vector::iterator iter=coarse->begin(); iter │ │ │ │ -!= coarse->end(); │ │ │ │ -784 ++iter, ++i) │ │ │ │ -785 { │ │ │ │ -786 std::pair::iterator,bool> ibpair │ │ │ │ -787 = used.insert(static_cast((((double)rand())/ │ │ │ │ -(RAND_MAX+1.0)))*coarse->size()); │ │ │ │ -788 │ │ │ │ -789 while(!ibpair.second) │ │ │ │ -790 ibpair = used.insert(static_cast((((double)rand())/ │ │ │ │ -(RAND_MAX+1.0))*coarse->size())); │ │ │ │ -791 *iter=*(ibpair.first); │ │ │ │ -792 } │ │ │ │ -793 } │ │ │ │ -794 │ │ │ │ -795 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r pinfo = parallelInformation │ │ │ │ -().coarsest(); │ │ │ │ -796 --pinfo; │ │ │ │ -797 │ │ │ │ -798 // Now consecutively project the numbers to the finest level. │ │ │ │ -799 for(typename AggregatesMapList::const_reverse_iterator │ │ │ │ -aggregates=++aggregatesMaps().rbegin(); │ │ │ │ -800 aggregates != aggregatesMaps().rend(); ++aggregates,--levels) { │ │ │ │ -801 │ │ │ │ -802 fine->resize((*aggregates)->noVertices()); │ │ │ │ -803 fine->assign(fine->size(), 0); │ │ │ │ -804 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r_,_ _s_t_d_:_:_v_e_c_t_o_r_<_s_t_d_:_: │ │ │ │ -_s_i_z_e___t_>, _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ -805 ::prolongateVector(*(*aggregates), *coarse, *fine, static_cast │ │ │ │ -(1), *pinfo); │ │ │ │ -806 --pinfo; │ │ │ │ -807 std::swap(coarse, fine); │ │ │ │ -808 } │ │ │ │ -809 │ │ │ │ -810 // Assertion to check that we really projected to data on the last step. │ │ │ │ -811 assert(coarse==&data); │ │ │ │ -812 } │ │ │ │ -813 │ │ │ │ -814 template │ │ │ │ -815 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t& │ │ │ │ -_8_1_6 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_a_g_g_r_e_g_a_t_e_s_M_a_p_s() const │ │ │ │ -817 { │ │ │ │ -818 return aggregatesMaps_; │ │ │ │ -819 } │ │ │ │ -820 template │ │ │ │ -821 const typename _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t& │ │ │ │ -_8_2_2 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n() const │ │ │ │ -823 { │ │ │ │ -824 return redistributes_; │ │ │ │ -825 } │ │ │ │ -826 │ │ │ │ -827 template │ │ │ │ -_8_2_8 _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y() │ │ │ │ -829 { │ │ │ │ -830 typedef typename AggregatesMapList::reverse_iterator AggregatesMapIterator; │ │ │ │ -831 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ -832 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r InfoIterator; │ │ │ │ -833 │ │ │ │ -834 AggregatesMapIterator amap = aggregatesMaps_.rbegin(); │ │ │ │ -835 InfoIterator info = parallelInformation_.coarsest(); │ │ │ │ -836 for(Iterator level=matrices_.coarsest(), finest=matrices_.finest(); level │ │ │ │ -!= finest; --level, --info, ++amap) { │ │ │ │ -837 (*amap)->free(); │ │ │ │ -838 delete *amap; │ │ │ │ -839 } │ │ │ │ -840 delete *amap; │ │ │ │ -841 } │ │ │ │ -842 │ │ │ │ -843 template │ │ │ │ -844 template │ │ │ │ -_8_4_5 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_c_o_a_r_s_e_n_V_e_c_t_o_r(_H_i_e_r_a_r_c_h_y<_B_l_o_c_k_V_e_c_t_o_r_<_V_,_B_A_>, │ │ │ │ -TA>& hierarchy) const │ │ │ │ -846 { │ │ │ │ -847 assert(hierarchy.levels()==1); │ │ │ │ -848 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r Iterator; │ │ │ │ -849 typedef typename RedistributeInfoList::const_iterator RIter; │ │ │ │ -850 RIter redist = redistributes_.begin(); │ │ │ │ -851 │ │ │ │ -852 Iterator matrix = matrices_.finest(), coarsest = matrices_.coarsest(); │ │ │ │ -853 int level=0; │ │ │ │ -854 if(redist->isSetup()) │ │ │ │ -855 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ -()); │ │ │ │ -856 Dune::dvverb<<"Level "<getmat().N()<<" │ │ │ │ -unknowns!"<getmat().N()<<" │ │ │ │ -unknowns!"<getmat().N()); │ │ │ │ -863 if(redist->isSetup()) │ │ │ │ -864 hierarchy.addRedistributedOnCoarsest(matrix.getRedistributed().getmat().N │ │ │ │ -()); │ │ │ │ -865 │ │ │ │ -866 } │ │ │ │ -867 │ │ │ │ -868 } │ │ │ │ -869 │ │ │ │ -870 template │ │ │ │ -871 template │ │ │ │ -_8_7_2 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_c_o_a_r_s_e_n_S_m_o_o_t_h_e_r(_H_i_e_r_a_r_c_h_y_<_S_,_T_A_>& smoothers, │ │ │ │ -873 const typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s& sargs) const │ │ │ │ -874 { │ │ │ │ -875 assert(smoothers._l_e_v_e_l_s()==0); │ │ │ │ -876 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r MatrixIterator; │ │ │ │ -877 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r PinfoIterator; │ │ │ │ -878 typedef typename AggregatesMapList::const_iterator AggregatesIterator; │ │ │ │ -879 │ │ │ │ -880 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ -881 cargs.setArgs(sargs); │ │ │ │ -882 PinfoIterator pinfo = parallelInformation_.finest(); │ │ │ │ -883 AggregatesIterator aggregates = aggregatesMaps_.begin(); │ │ │ │ -884 int level=0; │ │ │ │ -885 for(MatrixIterator matrix = matrices_.finest(), coarsest = │ │ │ │ -matrices_.coarsest(); │ │ │ │ -886 matrix != coarsest; ++matrix, ++pinfo, ++aggregates, ++level) { │ │ │ │ -887 cargs.setMatrix(matrix->getmat(), **aggregates); │ │ │ │ -888 cargs.setComm(*pinfo); │ │ │ │ -889 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ -890 } │ │ │ │ -891 if(maxlevels()>levels()) { │ │ │ │ -892 // This is not the globally coarsest level and therefore smoothing is │ │ │ │ -needed │ │ │ │ -893 cargs.setMatrix(matrices_.coarsest()->getmat(), **aggregates); │ │ │ │ -894 cargs.setComm(*pinfo); │ │ │ │ -895 smoothers._a_d_d_C_o_a_r_s_e_r(cargs); │ │ │ │ -896 ++level; │ │ │ │ -897 } │ │ │ │ -898 } │ │ │ │ -899 │ │ │ │ -900 template │ │ │ │ -901 template │ │ │ │ -_9_0_2 void _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n(const F& copyFlags) │ │ │ │ -903 { │ │ │ │ -904 typedef typename AggregatesMapList::iterator AggregatesMapIterator; │ │ │ │ -905 typedef typename _P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r Iterator; │ │ │ │ -906 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r InfoIterator; │ │ │ │ -907 │ │ │ │ -908 AggregatesMapIterator amap = aggregatesMaps_.begin(); │ │ │ │ -909 _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t productBuilder; │ │ │ │ -910 InfoIterator info = parallelInformation_.finest(); │ │ │ │ -911 typename RedistributeInfoList::iterator riIter = redistributes_.begin(); │ │ │ │ -912 Iterator level = matrices_.finest(), coarsest=matrices_.coarsest(); │ │ │ │ -913 if(level.isRedistributed()) { │ │ │ │ -914 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ -915 _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x_E_n_t_r_i_e_s(const_cast<_M_a_t_r_i_x&>(level->getmat()), │ │ │ │ -916 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), │ │ │ │ -917 *info,info.getRedistributed(), *riIter); │ │ │ │ -918 info->freeGlobalLookup(); │ │ │ │ -919 } │ │ │ │ -920 │ │ │ │ -921 for(; level!=coarsest; ++amap) { │ │ │ │ -922 const _M_a_t_r_i_x& fine = (level.isRedistributed() ? level.getRedistributed() : │ │ │ │ -*level).getmat(); │ │ │ │ -923 ++level; │ │ │ │ -924 ++info; │ │ │ │ -925 ++riIter; │ │ │ │ -926 productBuilder._c_a_l_c_u_l_a_t_e(fine, *(*amap), const_cast<_M_a_t_r_i_x&>(level->getmat │ │ │ │ -()), *info, copyFlags); │ │ │ │ -927 if(level.isRedistributed()) { │ │ │ │ -928 info->buildGlobalLookup(level->getmat().N()); │ │ │ │ -929 _r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x_E_n_t_r_i_e_s(const_cast<_M_a_t_r_i_x&>(level->getmat()), │ │ │ │ -930 const_cast<_M_a_t_r_i_x&>(level.getRedistributed().getmat()), *info, │ │ │ │ -931 info.getRedistributed(), *riIter); │ │ │ │ -932 info->freeGlobalLookup(); │ │ │ │ -933 } │ │ │ │ -934 } │ │ │ │ -935 } │ │ │ │ -936 │ │ │ │ -937 template │ │ │ │ -_9_3_8 std::size_t _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ -939 { │ │ │ │ -940 return matrices_.levels(); │ │ │ │ -941 } │ │ │ │ -942 │ │ │ │ -943 template │ │ │ │ -_9_4_4 std::size_t _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_m_a_x_l_e_v_e_l_s() const │ │ │ │ -945 { │ │ │ │ -946 return maxlevels_; │ │ │ │ -947 } │ │ │ │ -948 │ │ │ │ -949 template │ │ │ │ -_9_5_0 bool _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_h_a_s_C_o_a_r_s_e_s_t() const │ │ │ │ -951 { │ │ │ │ -952 return levels()==maxlevels() && │ │ │ │ -953 (!matrices_.coarsest().isRedistributed() ||matrices_.coarsest()->getmat().N │ │ │ │ -()>0); │ │ │ │ -954 } │ │ │ │ -955 │ │ │ │ -956 template │ │ │ │ -_9_5_7 bool _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_I_S_,_A_>_:_:_i_s_B_u_i_l_t() const │ │ │ │ -958 { │ │ │ │ -959 return built_; │ │ │ │ -960 } │ │ │ │ -961 │ │ │ │ -963 } // namespace Amg │ │ │ │ -964} // namespace Dune │ │ │ │ -965 │ │ │ │ -966#endif // end DUNE_AMG_MATRIXHIERARCHY_HH │ │ │ │ -_t_r_a_n_s_f_e_r_._h_h │ │ │ │ -Prolongation and restriction for amg. │ │ │ │ -_s_m_o_o_t_h_e_r_._h_h │ │ │ │ -Classes for the generic construction and application of the smoothers. │ │ │ │ -_r_e_n_u_m_b_e_r_e_r_._h_h │ │ │ │ -_i_n_d_i_c_e_s_c_o_a_r_s_e_n_e_r_._h_h │ │ │ │ -Provides a class for building the index set and remote indices on the coarse │ │ │ │ -level. │ │ │ │ -_h_i_e_r_a_r_c_h_y_._h_h │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ -_g_r_a_p_h_c_r_e_a_t_o_r_._h_h │ │ │ │ -_g_r_a_p_h_._h_h │ │ │ │ -Provides classes for building the matrix graph. │ │ │ │ -_g_l_o_b_a_l_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ -Provdes class for identifying aggregates globally. │ │ │ │ -_g_a_l_e_r_k_i_n_._h_h │ │ │ │ -Provides a class for building the galerkin product based on a aggregation │ │ │ │ -scheme. │ │ │ │ -_d_e_p_e_n_d_e_n_c_y_._h_h │ │ │ │ -Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ -_c_o_n_s_t_r_u_c_t_i_o_n_._h_h │ │ │ │ -Helper classes for the construction of classes without empty constructor. │ │ │ │ +244 return 1; │ │ │ │ +245 } │ │ │ │ +246 }; │ │ │ │ +247#endif │ │ │ │ +248 │ │ │ │ +249} // end Dune namespace │ │ │ │ +251#endif │ │ │ │ +_p_i_n_f_o_._h_h │ │ │ │ _a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ Provides classes for the Coloring process of AMG. │ │ │ │ -_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ -Some handy generic functions for ISTL matrices. │ │ │ │ -_m_a_t_r_i_x_r_e_d_i_s_t_r_i_b_u_t_e_._h_h │ │ │ │ -Functionality for redistributing a sparse matrix. │ │ │ │ -_b_v_e_c_t_o_r_._h_h │ │ │ │ -This file implements a vector space as a tensor product of a given vector │ │ │ │ -space. The number of compon... │ │ │ │ -_D_u_n_e_:_:_c_o_u_n_t_N_o_n_Z_e_r_o_s │ │ │ │ -auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >:: │ │ │ │ -value > *sfinae=nullptr) │ │ │ │ -Get the number of nonzero fields in the matrix. │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:119 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_a_g_g_r_e_g_a_t_e_s_M_a_p_s │ │ │ │ -const AggregatesMapList & aggregatesMaps() const │ │ │ │ -Get the hierarchy of the mappings of the nodes onto aggregates. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:816 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_i_s_B_u_i_l_t │ │ │ │ -bool isBuilt() const │ │ │ │ -Whether the hierarchy was built. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:957 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_h_a_s_C_o_a_r_s_e_s_t │ │ │ │ -bool hasCoarsest() const │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:950 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ -std::size_t levels() const │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ -std::size_t levels() const │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:938 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ -void addCoarser(Arguments &args) │ │ │ │ -Add an element on a coarser level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -const RedistributeInfoList & redistributeInformation() const │ │ │ │ -Get the hierarchy of the information about redistributions,. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:822 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -const ParallelInformationHierarchy & parallelInformation() const │ │ │ │ -Get the hierarchy of the parallel data distribution information. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:741 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_r_e_p_a_r_t_i_t_i_o_n_A_n_d_D_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x │ │ │ │ -bool repartitionAndDistributeMatrix(const M &origMatrix, std::shared_ptr< M > │ │ │ │ -newMatrix, SequentialInformation &origComm, std::shared_ptr< │ │ │ │ -SequentialInformation > &newComm, RedistributeInformation< │ │ │ │ -SequentialInformation > &ri, int nparts, C1 &criterion) │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:316 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ const_iterator begin() const │ │ │ │ DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_m_a_t_r_i_c_e_s │ │ │ │ -const ParallelMatrixHierarchy & matrices() const │ │ │ │ -Get the matrix hierarchy. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:734 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ -std::size_t maxlevels() const │ │ │ │ -Get the max number of levels in the hierarchy of processors. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:944 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ const_iterator end() const │ │ │ │ DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D │ │ │ │ -static const V ISOLATED │ │ │ │ -Identifier of isolated vertices. │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:571 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_r_e_c_a_l_c_u_l_a_t_e_G_a_l_e_r_k_i_n │ │ │ │ -void recalculateGalerkin(const F ©Flags) │ │ │ │ -Recalculate the galerkin products. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:902 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ -const void * Arguments │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ -std::size_t noVertices() const │ │ │ │ -Get the number of vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_V_e_c_t_o_r │ │ │ │ -void coarsenVector(Hierarchy< BlockVector< V, BA >, TA > &hierarchy) const │ │ │ │ -Coarsen the vector hierarchy according to the matrix hierarchy. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:845 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ const AggregateDescriptor * const_iterator │ │ │ │ DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ -MatrixHierarchy(std::shared_ptr< MatrixOperator > fineMatrix, std::shared_ptr< │ │ │ │ -ParallelInformation > pinfo=std::make_shared< ParallelInformation >()) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:392 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e │ │ │ │ -AccumulationMode │ │ │ │ -Identifiers for the different accumulation modes. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:231 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ -Iterator finest() │ │ │ │ -Get an iterator positioned at the finest level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_b_u_i_l_d │ │ │ │ -void build(const T &criterion) │ │ │ │ -Build the matrix hierarchy using aggregation. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:403 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_f_r_e_e │ │ │ │ -void free() │ │ │ │ -Free the allocated memory. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_n_S_m_o_o_t_h_e_r │ │ │ │ -void coarsenSmoother(Hierarchy< S, TA > &smoothers, const typename │ │ │ │ -SmootherTraits< S >::Arguments &args) const │ │ │ │ -Coarsen the smoother hierarchy according to the matrix hierarchy. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:872 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_b_u_i_l_d_D_e_p_e_n_d_e_n_c_y │ │ │ │ -void buildDependency(G &graph, const typename C::Matrix &matrix, C criterion, │ │ │ │ -bool finestLevel) │ │ │ │ -Build the dependency of the matrix graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_u_i_l_d_A_g_g_r_e_g_a_t_e_s │ │ │ │ -std::tuple< int, int, int, int > buildAggregates(const M &matrix, G &graph, │ │ │ │ -const C &criterion, bool finestLevel) │ │ │ │ -Build the aggregates. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_:_:_c_a_l_c_u_l_a_t_e │ │ │ │ -void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, │ │ │ │ -const I &pinfo, const O ©) │ │ │ │ -Calculate the galerkin product. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_s_O_n_F_i_n_e_s_t │ │ │ │ -void getCoarsestAggregatesOnFinest(std::vector< std::size_t > &data) const │ │ │ │ -Get the mapping of fine level unknowns to coarse level aggregates. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:747 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ -~MatrixHierarchy() │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:828 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_A_X___P_R_O_C_E_S_S_E_S │ │ │ │ -@ MAX_PROCESSES │ │ │ │ -Hard limit for the number of processes allowed. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:50 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_a_t_O_n_c_e_A_c_c_u │ │ │ │ -@ atOnceAccu │ │ │ │ -Accumulate data to one process at once. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:243 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_s_u_c_c_e_s_s_i_v_e_A_c_c_u │ │ │ │ -@ successiveAccu │ │ │ │ -Successively accumulate to fewer processes. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:247 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_p_r_i_n_t_G_l_o_b_a_l_S_p_a_r_s_e_M_a_t_r_i_x │ │ │ │ -void printGlobalSparseMatrix(const M &mat, C &ooc, std::ostream &os) │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:154 │ │ │ │ -_D_u_n_e_:_:_g_e_t │ │ │ │ -PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ -VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ -Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ -DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x_E_n_t_r_i_e_s │ │ │ │ -void redistributeMatrixEntries(M &origMatrix, M &newMatrix, C &origComm, C │ │ │ │ -&newComm, RedistributeInformation< C > &ri) │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:757 │ │ │ │ -_D_u_n_e_:_:_c_o_m_m_G_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n │ │ │ │ -bool commGraphRepartition(const M &mat, Dune::OwnerOverlapCopyCommunication< │ │ │ │ -T1, T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune:: │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ -&redistInf, bool verbose=false) │ │ │ │ -DDeeffiinniittiioonn repartition.hh:822 │ │ │ │ -_D_u_n_e_:_:_r_e_d_i_s_t_r_i_b_u_t_e_M_a_t_r_i_x │ │ │ │ -void redistributeMatrix(M &origMatrix, M &newMatrix, C &origComm, C &newComm, │ │ │ │ -RedistributeInformation< C > &ri) │ │ │ │ -Redistribute a matrix according to given domain decompositions. │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:820 │ │ │ │ -_D_u_n_e_:_:_g_r_a_p_h_R_e_p_a_r_t_i_t_i_o_n │ │ │ │ -bool graphRepartition(const G &graph, Dune::OwnerOverlapCopyCommunication< T1, │ │ │ │ -T2 > &oocomm, Metis::idx_t nparts, std::shared_ptr< Dune:: │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > > &outcomm, RedistributeInterface │ │ │ │ -&redistInf, bool verbose=false) │ │ │ │ -execute a graph repartition for a giving graph and indexset. │ │ │ │ -DDeeffiinniittiioonn repartition.hh:1228 │ │ │ │ -_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ -A vector of blocks with memory management. │ │ │ │ -DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ -derive error class from the base class in common │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ -A generic dynamic dense matrix. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_s_i_z_e___t_y_p_e │ │ │ │ -A::size_type size_type │ │ │ │ -Type for indices and sizes. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:577 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_r_o_w___t_y_p_e │ │ │ │ -MatrixImp::DenseMatrixBase< T, A >::window_type row_type │ │ │ │ -The type implementing a matrix row. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:574 │ │ │ │ -_D_u_n_e_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:22 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ +owner/overlap/copy sema... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ +void copyCopyToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from copy data points to all other data points. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ +The type of the reverse lookup of indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ +const Communication< MPI_Comm > & communicator() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ +void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ +Communicate values from owner data points to all other data points. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +const RemoteIndices & remoteIndices() const │ │ │ │ +Get the underlying remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ +The type of the parallel index set. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -Class representing the properties of an edge in the matrix graph. │ │ │ │ -DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -Class representing a node in the matrix graph. │ │ │ │ -DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:99 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:118 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:29 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +const GlobalIndex & operator[](std::size_t index) const │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:46 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_g_e_t │ │ │ │ +GlobalIndex & get(std::size_t index) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:60 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:33 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_p_u_t │ │ │ │ +void put(const GlobalIndex &global, size_t i) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:96 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x │ │ │ │ +T Vertex │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:39 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const │ │ │ │ +GlobalLookupIndexSet< ParallelIndexSet > &indexset) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:41 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +TI ParallelIndexSet │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:31 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ +ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:37 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ +ParallelIndexSet::GlobalIndex IndexedType │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:35 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +Proxy operator[](std::size_t index) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:91 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y_:_:_P_r_o_x_y │ │ │ │ +Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex │ │ │ │ +&aggregate) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:72 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ +Proxy & operator=(const GlobalIndex &global) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:76 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:114 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ +static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, │ │ │ │ +size_t i) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:123 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ +ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:116 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +TI ParallelIndexSet │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:115 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ +static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, │ │ │ │ +size_t i) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:118 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -The (undirected) graph of a matrix. │ │ │ │ -DDeeffiinniittiioonn graph.hh:51 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -Attaches properties to the edges and vertices of a graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:978 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ -Graph::VertexDescriptor VertexDescriptor │ │ │ │ -The vertex descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:988 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ -A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator< Hierarchy< MatrixOperator, Allocator >, MatrixOperator > │ │ │ │ -Iterator │ │ │ │ -Type of the mutable iterator. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _M_a_t_r_i_x_O_p_e_r_a_t_o_r_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const │ │ │ │ -MatrixOperator > ConstIterator │ │ │ │ -Type of the const iterator. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:36 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ -The hierarchies build by the coarsening process. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_A_l_l_o_c_a_t_o_r │ │ │ │ -typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ -AggregatesMap * > AAllocator │ │ │ │ -Allocator for pointers. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:85 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ -Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ -ParallelInformationHierarchy │ │ │ │ -The type of the parallel informarion hierarchy. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:82 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t │ │ │ │ -std::list< AggregatesMap *, AAllocator > AggregatesMapList │ │ │ │ -The type of the aggregates maps list. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:88 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -PI ParallelInformation │ │ │ │ -The type of the index set. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:70 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ -Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy │ │ │ │ -The type of the parallel matrix hierarchy. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:79 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ -A Allocator │ │ │ │ -The allocator to use. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:73 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e │ │ │ │ -RedistributeInformation< ParallelInformation > RedistributeInfoType │ │ │ │ -The type of the redistribute information. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:91 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_g_e_t_P_r_o_l_o_n_g_a_t_i_o_n_D_a_m_p_i_n_g_F_a_c_t_o_r │ │ │ │ -double getProlongationDampingFactor() const │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:188 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_I_L_A_l_l_o_c_a_t_o_r │ │ │ │ -typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ -RedistributeInfoType > RILAllocator │ │ │ │ -Allocator for RedistributeInfoType. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:94 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_L_i_s_t │ │ │ │ -std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList │ │ │ │ -The type of the list of redistribute information. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:97 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > │ │ │ │ -AggregatesMap │ │ │ │ -The type of the aggregates map we use. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:76 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x │ │ │ │ -MatrixOperator::matrix_type Matrix │ │ │ │ -The type of the matrix. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:67 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ -M MatrixOperator │ │ │ │ -The type of the matrix operator. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:64 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -void operator()(const matrix_row &row) │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:254 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_t_r_i_x___r_o_w │ │ │ │ -Matrix::row_type matrix_row │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:245 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_i_n │ │ │ │ -size_type min │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:261 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_c_a_l_c │ │ │ │ -calc() │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:247 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_m_a_x │ │ │ │ -size_type max │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:262 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_u_m │ │ │ │ -size_type sum │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:263 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_:_:_M_a_t_r_i_x_S_t_a_t_s_<_ _M_a_t_r_i_x_,_ _t_r_u_e_ _>_:_:_c_a_l_c_:_:_s_i_z_e___t_y_p_e │ │ │ │ -Matrix::size_type size_type │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:244 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ -The criterion describing the stop criteria for the coarsening process. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:283 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ -CoarsenCriterion(const Dune::Amg::Parameters &parms) │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:309 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n │ │ │ │ -T AggregationCriterion │ │ │ │ -The criterion for tagging connections as strong and nodes as isolated. This │ │ │ │ -might be e.... │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:289 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n_:_:_C_o_a_r_s_e_n_C_r_i_t_e_r_i_o_n │ │ │ │ -CoarsenCriterion(int maxLevel=100, int coarsenTarget=1000, double │ │ │ │ -minCoarsenRate=1.2, double prolongDamp=1.6, AccumulationMode │ │ │ │ -accumulate=successiveAccu, bool useFixedOrder=false) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:304 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ -All parameters for AMG. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ +_>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:164 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ +_>_:_:_O_v_e_r_l_a_p_F_l_a_g_s │ │ │ │ +O OverlapFlags │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:162 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ +_>_:_:_V_e_r_t_e_x │ │ │ │ +T Vertex │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:161 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ +_>_:_:_I_n_d_e_x_S_e_t │ │ │ │ +ParallelInformation::ParallelIndexSet IndexSet │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:165 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ +_>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:163 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ +_>_:_:_p_u_b_l_i_s_h │ │ │ │ +static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation │ │ │ │ +&pinfo, const GlobalLookupIndexSet &globalLookup) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:167 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_u_b_l_i_s_h │ │ │ │ +static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation │ │ │ │ +&pinfo, const GlobalLookupIndexSet &globalLookup) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:226 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_: │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +SequentialInformation ParallelInformation │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:223 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_r_t_e_x │ │ │ │ +T Vertex │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:222 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_: │ │ │ │ +_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:224 │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_g_e_t_S_i_z_e │ │ │ │ +static int getSize(const Type &, int) │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:242 │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ +Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:240 │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_T_y_p_e │ │ │ │ +Amg::AggregatesMap< T > Type │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:239 │ │ │ │ +_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ +SizeOne IndexedTypeFlag │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:241 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ -Tag idnetifying the visited property of a vertex. │ │ │ │ -DDeeffiinniittiioonn properties.hh:29 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -The default class for the smoother arguments. │ │ │ │ -DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_T_r_a_n_s_f_e_r │ │ │ │ -DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +int GlobalLookupIndexSet │ │ │ │ +DDeeffiinniittiioonn pinfo.hh:54 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_n_o_n_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ +@ nonoverlapping │ │ │ │ +Category for non-overlapping solvers. │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:27 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ newly introduced virtu... │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: kamg.hh File Reference │ │ │ +dune-istl: fastamg.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,45 +71,75 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Macros
│ │ │ +
fastamg.hh File Reference
│ │ │ │ │ │
│ │ │ │ │ │ -

Provides an algebraic multigrid using a Krylov cycle. │ │ │ +

A fast AMG method, that currently only allows only Gauss-Seidel smoothing and is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep with the defect calculation to reduce memory transfers. │ │ │ More...

│ │ │ -
#include <dune/istl/preconditioners.hh>
│ │ │ -#include "amg.hh"
│ │ │ +
#include <memory>
│ │ │ +#include <dune/common/exceptions.hh>
│ │ │ +#include <dune/common/typetraits.hh>
│ │ │ +#include <dune/istl/paamg/smoother.hh>
│ │ │ +#include <dune/istl/paamg/transfer.hh>
│ │ │ +#include <dune/istl/paamg/matrixhierarchy.hh>
│ │ │ +#include <dune/istl/solvers.hh>
│ │ │ +#include <dune/istl/scalarproducts.hh>
│ │ │ +#include <dune/istl/superlu.hh>
│ │ │ +#include <dune/istl/umfpack.hh>
│ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ +#include <dune/istl/io.hh>
│ │ │ +#include <dune/istl/preconditioners.hh>
│ │ │ +#include "fastamgsmoother.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::KAmgTwoGrid< AMG >
 Two grid operator for AMG with Krylov cycle. More...
 
class  Dune::Amg::KAMG< M, X, S, PI, K, A >
 an algebraic multigrid method using a Krylov-cycle. More...
class  Dune::Amg::FastAMG< M, X, PI, A >
 A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Macros

#define DIRECTSOLVER   SuperLU
 
│ │ │

Detailed Description

│ │ │ -

Provides an algebraic multigrid using a Krylov cycle.

│ │ │ -
Author
Markus Blatt
│ │ │ -
│ │ │ +

A fast AMG method, that currently only allows only Gauss-Seidel smoothing and is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep with the defect calculation to reduce memory transfers.

│ │ │ +
Author
Markus Blatt
│ │ │ +

Macro Definition Documentation

│ │ │ + │ │ │ +

◆ DIRECTSOLVER

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
#define DIRECTSOLVER   SuperLU
│ │ │ +
│ │ │ + │ │ │ +
│ │ │ +
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,33 +1,51 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -kamg.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides an algebraic multigrid using a Krylov cycle. _M_o_r_e_._._. │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ +fastamg.hh File Reference │ │ │ │ +A fast AMG method, that currently only allows only Gauss-Seidel smoothing and │ │ │ │ +is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep │ │ │ │ +with the defect calculation to reduce memory transfers. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ #include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ -#include "_a_m_g_._h_h" │ │ │ │ +#include "_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_<_ _A_M_G_ _> │ │ │ │ -  Two grid operator for _A_M_G with Krylov cycle. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _K_,_ _A_ _> │ │ │ │ -  an algebraic multigrid method using a Krylov-cycle. _M_o_r_e_._._. │ │ │ │ +class   _D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_<_ _M_,_ _X_,_ _P_I_,_ _A_ _> │ │ │ │ +  A fast (sequential) algebraic multigrid based on agglomeration that │ │ │ │ + saves memory bandwidth. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ +MMaaccrrooss │ │ │ │ +#define  _D_I_R_E_C_T_S_O_L_V_E_R   SuperLU │ │ │ │ +  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides an algebraic multigrid using a Krylov cycle. │ │ │ │ +A fast AMG method, that currently only allows only Gauss-Seidel smoothing and │ │ │ │ +is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep │ │ │ │ +with the defect calculation to reduce memory transfers. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? DDIIRREECCTTSSOOLLVVEERR ********** │ │ │ │ +#define DIRECTSOLVER   SuperLU │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: kamg.hh Source File │ │ │ +dune-istl: fastamg.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,332 +74,675 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
kamg.hh
│ │ │ +
fastamg.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_KAMG_HH
│ │ │ -
6#define DUNE_AMG_KAMG_HH
│ │ │ +
5#ifndef DUNE_ISTL_FASTAMG_HH
│ │ │ +
6#define DUNE_ISTL_FASTAMG_HH
│ │ │
7
│ │ │ - │ │ │ -
9#include "amg.hh"
│ │ │ -
10
│ │ │ -
11namespace Dune
│ │ │ -
12{
│ │ │ -
13 namespace Amg
│ │ │ -
14 {
│ │ │ -
15
│ │ │ -
30 template<class AMG>
│ │ │ -
│ │ │ - │ │ │ -
32 : public Preconditioner<typename AMG::Domain,typename AMG::Range>
│ │ │ -
33 {
│ │ │ -
35 typedef typename AMG::Domain Domain;
│ │ │ -
37 typedef typename AMG::Range Range;
│ │ │ -
38 public:
│ │ │ -
39
│ │ │ -
│ │ │ - │ │ │ -
42 {
│ │ │ -
43 return amg_.category();
│ │ │ -
44 };
│ │ │ -
│ │ │ -
45
│ │ │ -
│ │ │ - │ │ │ -
54 : amg_(amg), coarseSolver_(coarseSolver)
│ │ │ -
55 {}
│ │ │ -
│ │ │ -
56
│ │ │ -
│ │ │ -
58 void pre([[maybe_unused]] typename AMG::Domain& x, [[maybe_unused]] typename AMG::Range& b)
│ │ │ -
59 {}
│ │ │ -
│ │ │ -
60
│ │ │ -
│ │ │ -
62 void post([[maybe_unused]] typename AMG::Domain& x)
│ │ │ -
63 {}
│ │ │ -
│ │ │ -
64
│ │ │ -
│ │ │ -
66 void apply(typename AMG::Domain& v, const typename AMG::Range& d)
│ │ │ -
67 {
│ │ │ -
68 // Copy data
│ │ │ -
69 *levelContext_->update=0;
│ │ │ -
70 *levelContext_->rhs = d;
│ │ │ -
71 *levelContext_->lhs = v;
│ │ │ -
72
│ │ │ -
73 presmooth(*levelContext_, amg_.preSteps_);
│ │ │ -
74 bool processFineLevel =
│ │ │ -
75 amg_.moveToCoarseLevel(*levelContext_);
│ │ │ -
76
│ │ │ -
77 if(processFineLevel) {
│ │ │ -
78 typename AMG::Range b=*levelContext_->rhs;
│ │ │ -
79 typename AMG::Domain x=*levelContext_->update;
│ │ │ - │ │ │ -
81 coarseSolver_->apply(x, b, res);
│ │ │ -
82 *levelContext_->update=x;
│ │ │ -
83 }
│ │ │ -
84
│ │ │ -
85 amg_.moveToFineLevel(*levelContext_, processFineLevel);
│ │ │ -
86
│ │ │ -
87 postsmooth(*levelContext_, amg_.postSteps_);
│ │ │ -
88 v=*levelContext_->update;
│ │ │ -
89 }
│ │ │ -
│ │ │ -
90
│ │ │ -
│ │ │ - │ │ │ -
96 {
│ │ │ -
97 return coarseSolver_;
│ │ │ -
98 }
│ │ │ -
│ │ │ -
99
│ │ │ -
│ │ │ -
104 void setLevelContext(std::shared_ptr<typename AMG::LevelContext> p)
│ │ │ -
105 {
│ │ │ -
106 levelContext_=p;
│ │ │ -
107 }
│ │ │ -
│ │ │ -
108
│ │ │ -
│ │ │ - │ │ │ -
111 {}
│ │ │ -
│ │ │ -
112
│ │ │ -
113 private:
│ │ │ -
115 AMG& amg_;
│ │ │ -
117 std::shared_ptr<InverseOperator<Domain,Range> > coarseSolver_;
│ │ │ -
119 std::shared_ptr<typename AMG::LevelContext> levelContext_;
│ │ │ -
120 };
│ │ │ -
│ │ │ -
121
│ │ │ -
122
│ │ │ -
123
│ │ │ -
137 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ -
138 class K=GeneralizedPCGSolver<X>, class A=std::allocator<X> >
│ │ │ -
│ │ │ -
139 class KAMG : public Preconditioner<X,X>
│ │ │ -
140 {
│ │ │ -
141 public:
│ │ │ - │ │ │ -
145 typedef K KrylovSolver;
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
155 typedef typename Amg::Operator Operator;
│ │ │ -
157 typedef typename Amg::Domain Domain;
│ │ │ -
159 typedef typename Amg::Range Range;
│ │ │ - │ │ │ - │ │ │ +
8#include <memory>
│ │ │ +
9#include <dune/common/exceptions.hh>
│ │ │ +
10#include <dune/common/typetraits.hh>
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
14#include <dune/istl/solvers.hh>
│ │ │ + │ │ │ +
16#include <dune/istl/superlu.hh>
│ │ │ +
17#include <dune/istl/umfpack.hh>
│ │ │ + │ │ │ +
19#include <dune/istl/io.hh>
│ │ │ + │ │ │ +
21
│ │ │ +
22#include "fastamgsmoother.hh"
│ │ │ +
23
│ │ │ +
32namespace Dune
│ │ │ +
33{
│ │ │ +
34 namespace Amg
│ │ │ +
35 {
│ │ │ +
58 template<class M, class X, class PI=SequentialInformation, class A=std::allocator<X> >
│ │ │ +
│ │ │ +
59 class FastAMG : public Preconditioner<X,X>
│ │ │ +
60 {
│ │ │ +
61 public:
│ │ │ +
63 typedef M Operator;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
75
│ │ │ +
77 typedef X Domain;
│ │ │ +
79 typedef X Range;
│ │ │ + │ │ │ +
82
│ │ │ +
90 FastAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ +
91 const Parameters& parms,
│ │ │ +
92 bool symmetric=true);
│ │ │ +
93
│ │ │ +
105 template<class C>
│ │ │ +
106 FastAMG(std::shared_ptr<const Operator> fineOperator,
│ │ │ +
107 const C& criterion,
│ │ │ +
108 const Parameters& parms=Parameters(),
│ │ │ +
109 bool symmetric=true,
│ │ │ + │ │ │ +
111
│ │ │ +
124 template<class C>
│ │ │ +
│ │ │ +
125 FastAMG(const Operator& fineOperator,
│ │ │ +
126 const C& criterion,
│ │ │ +
127 const Parameters& parms=Parameters(),
│ │ │ +
128 bool symmetric=true,
│ │ │ + │ │ │ +
130 : FastAMG(stackobject_to_shared_ptr(fineOperator),
│ │ │ +
131 criterion, parms, symmetric, pinfo)
│ │ │ +
132 {}
│ │ │ +
│ │ │ +
133
│ │ │ +
137 FastAMG(const FastAMG& amg);
│ │ │ +
138
│ │ │ +
140 void pre(Domain& x, Range& b);
│ │ │ +
141
│ │ │ +
143 void apply(Domain& v, const Range& d);
│ │ │ +
144
│ │ │ +
│ │ │ + │ │ │ +
147 {
│ │ │ + │ │ │ +
149 }
│ │ │ +
│ │ │ +
150
│ │ │ +
152 void post(Domain& x);
│ │ │ +
153
│ │ │ +
158 template<class A1>
│ │ │ +
159 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ +
160
│ │ │ +
161 std::size_t levels();
│ │ │ +
162
│ │ │ +
163 std::size_t maxlevels();
│ │ │
164
│ │ │ -
│ │ │ - │ │ │ -
167 {
│ │ │ -
168 return amg.category();
│ │ │ -
169 };
│ │ │ -
│ │ │ -
170
│ │ │ -
182 KAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ -
183 const SmootherArgs& smootherArgs, const Parameters& parms,
│ │ │ -
184 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1);
│ │ │ -
185
│ │ │ -
199 template<class C>
│ │ │ -
200 KAMG(const Operator& fineOperator, const C& criterion,
│ │ │ -
201 const SmootherArgs& smootherArgs=SmootherArgs(),
│ │ │ -
202 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1,
│ │ │ - │ │ │ -
204
│ │ │ -
206 void pre(Domain& x, Range& b);
│ │ │ -
208 void post(Domain& x);
│ │ │ -
210 void apply(Domain& v, const Range& d);
│ │ │ -
211
│ │ │ -
212 std::size_t maxlevels();
│ │ │ -
213
│ │ │ -
214 private:
│ │ │ -
216 Amg amg;
│ │ │ -
217
│ │ │ -
219 std::size_t maxLevelKrylovSteps;
│ │ │ -
220
│ │ │ -
222 double levelDefectReduction;
│ │ │ -
223
│ │ │ -
225 std::vector<std::shared_ptr<typename Amg::ScalarProduct> > scalarproducts;
│ │ │ -
226
│ │ │ -
228 std::vector<std::shared_ptr<KAmgTwoGrid<Amg> > > ksolvers;
│ │ │ -
229 };
│ │ │ -
│ │ │ -
230
│ │ │ -
231
│ │ │ -
232 template<class M, class X, class S, class P, class K, class A>
│ │ │ -
│ │ │ - │ │ │ -
234 const SmootherArgs& smootherArgs, const Parameters& params,
│ │ │ -
235 std::size_t ksteps, double reduction)
│ │ │ -
236 : amg(matrices, coarseSolver, smootherArgs, params),
│ │ │ -
237 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction)
│ │ │ -
238 {}
│ │ │ -
│ │ │ -
239
│ │ │ +
│ │ │ + │ │ │ +
174 {
│ │ │ +
175 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ +
176 }
│ │ │ +
│ │ │ +
177
│ │ │ +
182 bool usesDirectCoarseLevelSolver() const;
│ │ │ +
183
│ │ │ +
184 private:
│ │ │ +
191 template<class C>
│ │ │ +
192 void createHierarchies(C& criterion,
│ │ │ +
193 std::shared_ptr<const Operator> fineOperator,
│ │ │ +
194 const PI& pinfo);
│ │ │ +
195
│ │ │ +
202 struct LevelContext
│ │ │ +
203 {
│ │ │ +
207 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ + │ │ │ +
215 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ +
219 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
235 std::size_t level;
│ │ │ +
236 };
│ │ │ +
237
│ │ │ +
239 void mgc(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │
240
│ │ │ -
241 template<class M, class X, class S, class P, class K, class A>
│ │ │ -
242 template<class C>
│ │ │ -
│ │ │ -
243 KAMG<M,X,S,P,K,A>::KAMG(const Operator& fineOperator, const C& criterion,
│ │ │ -
244 const SmootherArgs& smootherArgs,
│ │ │ -
245 std::size_t ksteps, double reduction,
│ │ │ -
246 const ParallelInformation& pinfo)
│ │ │ -
247 : amg(fineOperator, criterion, smootherArgs, pinfo),
│ │ │ -
248 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction)
│ │ │ -
249 {}
│ │ │ -
│ │ │ -
250
│ │ │ -
251
│ │ │ -
252 template<class M, class X, class S, class P, class K, class A>
│ │ │ -
│ │ │ - │ │ │ -
254 {
│ │ │ -
255 amg.pre(x,b);
│ │ │ -
256 scalarproducts.reserve(amg.levels());
│ │ │ -
257 ksolvers.reserve(amg.levels());
│ │ │ -
258
│ │ │ -
259 typename OperatorHierarchy::ParallelMatrixHierarchy::Iterator
│ │ │ -
260 matrix = amg.matrices_->matrices().coarsest();
│ │ │ - │ │ │ -
262 pinfo = amg.matrices_->parallelInformation().coarsest();
│ │ │ -
263 bool hasCoarsest=(amg.levels()==amg.maxlevels());
│ │ │ -
264
│ │ │ -
265 if(hasCoarsest) {
│ │ │ -
266 if(matrix==amg.matrices_->matrices().finest())
│ │ │ -
267 return;
│ │ │ -
268 --matrix;
│ │ │ -
269 --pinfo;
│ │ │ -
270 ksolvers.push_back(std::shared_ptr<KAmgTwoGrid<Amg> >(new KAmgTwoGrid<Amg>(amg, amg.solver_)));
│ │ │ -
271 }else
│ │ │ -
272 ksolvers.push_back(std::shared_ptr<KAmgTwoGrid<Amg> >(new KAmgTwoGrid<Amg>(amg, std::shared_ptr<InverseOperator<Domain,Range> >())));
│ │ │ -
273
│ │ │ -
274 std::ostringstream s;
│ │ │ -
275
│ │ │ -
276 if(matrix!=amg.matrices_->matrices().finest())
│ │ │ -
277 while(true) {
│ │ │ -
278 scalarproducts.push_back(createScalarProduct<X>(*pinfo,category()));
│ │ │ -
279 std::shared_ptr<InverseOperator<Domain,Range> > ks =
│ │ │ -
280 std::shared_ptr<InverseOperator<Domain,Range> >(new KrylovSolver(*matrix, *(scalarproducts.back()),
│ │ │ -
281 *(ksolvers.back()), levelDefectReduction,
│ │ │ -
282 maxLevelKrylovSteps, 0));
│ │ │ -
283 ksolvers.push_back(std::shared_ptr<KAmgTwoGrid<Amg> >(new KAmgTwoGrid<Amg>(amg, ks)));
│ │ │ -
284 --matrix;
│ │ │ -
285 --pinfo;
│ │ │ -
286 if(matrix==amg.matrices_->matrices().finest())
│ │ │ -
287 break;
│ │ │ -
288 }
│ │ │ -
289 }
│ │ │ -
│ │ │ -
290
│ │ │ -
291
│ │ │ -
292 template<class M, class X, class S, class P, class K, class A>
│ │ │ -
│ │ │ - │ │ │ -
294 {
│ │ │ -
295 amg.post(x);
│ │ │ -
296
│ │ │ -
297 }
│ │ │ -
│ │ │ -
298
│ │ │ -
299 template<class M, class X, class S, class P, class K, class A>
│ │ │ -
│ │ │ - │ │ │ -
301 {
│ │ │ -
302 if(ksolvers.size()==0)
│ │ │ -
303 {
│ │ │ -
304 Range td=d;
│ │ │ - │ │ │ -
306 amg.solver_->apply(v,td,res);
│ │ │ -
307 }else
│ │ │ -
308 {
│ │ │ -
309 typedef typename Amg::LevelContext LevelContext;
│ │ │ -
310 std::shared_ptr<LevelContext> levelContext(new LevelContext);
│ │ │ -
311 amg.initIteratorsWithFineLevel(*levelContext);
│ │ │ -
312 typedef typename std::vector<std::shared_ptr<KAmgTwoGrid<Amg> > >::iterator Iter;
│ │ │ -
313 for(Iter solver=ksolvers.begin(); solver!=ksolvers.end(); ++solver)
│ │ │ -
314 (*solver)->setLevelContext(levelContext);
│ │ │ -
315 ksolvers.back()->apply(v,d);
│ │ │ -
316 }
│ │ │ -
317 }
│ │ │ +
247 void presmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ +
248
│ │ │ +
255 void postsmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ +
256
│ │ │ +
263 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel,
│ │ │ +
264 Domain& fineX);
│ │ │ +
265
│ │ │ +
270 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ +
271
│ │ │ +
276 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ +
277
│ │ │ +
279 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ +
281 std::shared_ptr<CoarseSolver> solver_;
│ │ │ +
283 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ +
285 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ +
287 std::shared_ptr<Hierarchy<Domain,A>> residual_;
│ │ │ +
288
│ │ │ + │ │ │ +
292 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ +
294 std::size_t gamma_;
│ │ │ +
296 std::size_t preSteps_;
│ │ │ +
298 std::size_t postSteps_;
│ │ │ +
299 std::size_t level;
│ │ │ +
300 bool buildHierarchy_;
│ │ │ +
301 bool symmetric;
│ │ │ +
302 bool coarsesolverconverged;
│ │ │ + │ │ │ +
304 typedef std::shared_ptr<Smoother> SmootherPointer;
│ │ │ +
305 SmootherPointer coarseSmoother_;
│ │ │ +
307 std::size_t verbosity_;
│ │ │ +
308 };
│ │ │ +
│ │ │ +
309
│ │ │ +
310 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
312 : matrices_(amg.matrices_), solver_(amg.solver_),
│ │ │ +
313 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_),
│ │ │ +
314 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ +
315 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ +
316 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_)
│ │ │ +
317 {}
│ │ │
│ │ │
318
│ │ │ -
319 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
319 template<class M, class X, class PI, class A>
│ │ │
│ │ │ - │ │ │ -
321 {
│ │ │ -
322 return amg.maxlevels();
│ │ │ -
323 }
│ │ │ -
│ │ │ -
324
│ │ │ -
326 } // Amg
│ │ │ -
327} // Dune
│ │ │ -
328
│ │ │ -
329#endif
│ │ │ -
Define general preconditioner interface.
│ │ │ -
The AMG preconditioner.
│ │ │ -
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:300
│ │ │ -
X Domain
The domain type.
Definition amg.hh:87
│ │ │ -
KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms, std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1)
Construct a new amg with a specific coarse solver.
Definition kamg.hh:233
│ │ │ -
std::size_t maxlevels()
Definition kamg.hh:320
│ │ │ -
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:100
│ │ │ -
M Operator
The matrix operator type.
Definition amg.hh:73
│ │ │ -
void post(Domain &x)
Clean up.
Definition kamg.hh:293
│ │ │ -
X Range
The range type.
Definition amg.hh:89
│ │ │ + │ │ │ +
321 const Parameters& parms, bool symmetric_)
│ │ │ +
322 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver),
│ │ │ +
323 rhs_(), lhs_(), residual_(), scalarProduct_(),
│ │ │ +
324 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ +
325 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ +
326 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ +
327 coarseSmoother_(), verbosity_(parms.debugLevel())
│ │ │ +
328 {
│ │ │ +
329 if(preSteps_>1||postSteps_>1)
│ │ │ +
330 {
│ │ │ +
331 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ +
332 preSteps_=postSteps_=0;
│ │ │ +
333 }
│ │ │ +
334 assert(matrices_->isBuilt());
│ │ │ +
335 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ +
336 "Currently only sequential runs are supported");
│ │ │ +
337 }
│ │ │ +
│ │ │ +
338 template<class M, class X, class PI, class A>
│ │ │ +
339 template<class C>
│ │ │ +
│ │ │ +
340 FastAMG<M,X,PI,A>::FastAMG(std::shared_ptr<const Operator> fineOperator,
│ │ │ +
341 const C& criterion,
│ │ │ +
342 const Parameters& parms,
│ │ │ +
343 bool symmetric_,
│ │ │ +
344 const PI& pinfo)
│ │ │ +
345 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_(parms.getGamma()),
│ │ │ +
346 preSteps_(parms.getNoPreSmoothSteps()), postSteps_(parms.getNoPostSmoothSteps()),
│ │ │ +
347 buildHierarchy_(true),
│ │ │ +
348 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ +
349 coarseSmoother_(), verbosity_(criterion.debugLevel())
│ │ │ +
350 {
│ │ │ +
351 if(preSteps_>1||postSteps_>1)
│ │ │ +
352 {
│ │ │ +
353 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ +
354 preSteps_=postSteps_=1;
│ │ │ +
355 }
│ │ │ +
356 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ +
357 "Currently only sequential runs are supported");
│ │ │ +
358 // TODO: reestablish compile time checks.
│ │ │ +
359 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ +
360 // "Matrix and Solver must match in terms of category!");
│ │ │ +
361 createHierarchies(criterion, std::move(fineOperator), pinfo);
│ │ │ +
362 }
│ │ │ +
│ │ │ +
363
│ │ │ +
364 template<class M, class X, class PI, class A>
│ │ │ +
365 template<class C>
│ │ │ +
366 void FastAMG<M,X,PI,A>::createHierarchies(C& criterion,
│ │ │ +
367 std::shared_ptr<const Operator> fineOperator,
│ │ │ +
368 const PI& pinfo)
│ │ │ +
369 {
│ │ │ +
370 Timer watch;
│ │ │ +
371 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ +
372 std::const_pointer_cast<Operator>(std::move(fineOperator)),
│ │ │ +
373 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ +
374
│ │ │ +
375 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ +
376
│ │ │ +
377 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ +
378 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
379
│ │ │ +
380 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()) {
│ │ │ +
381 // We have the carsest level. Create the coarse Solver
│ │ │ +
382 typedef typename SmootherTraits<Smoother>::Arguments SmootherArgs;
│ │ │ +
383 SmootherArgs sargs;
│ │ │ +
384 sargs.iterations = 1;
│ │ │ +
385
│ │ │ + │ │ │ +
387 cargs.setArgs(sargs);
│ │ │ +
388 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ +
389 // Solve on the redistributed partitioning
│ │ │ +
390 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ +
391 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ +
392 }else{
│ │ │ +
393 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ +
394 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ +
395 }
│ │ │ +
396
│ │ │ +
397 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ +
398 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ +
399
│ │ │ +
400#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ +
401#if HAVE_SUITESPARSE_UMFPACK
│ │ │ +
402#define DIRECTSOLVER UMFPack
│ │ │ +
403#else
│ │ │ +
404#define DIRECTSOLVER SuperLU
│ │ │ +
405#endif
│ │ │ +
406 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ +
407 if(std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ +
408 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ +
409 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ +
410 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ +
411 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0)) { // redistribute and 1 proc
│ │ │ +
412 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ +
413 std::cout<<"Using superlu"<<std::endl;
│ │ │ +
414 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ +
415 {
│ │ │ +
416 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ +
417 // We are still participating on this level
│ │ │ +
418 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ +
419 else
│ │ │ +
420 solver_.reset();
│ │ │ +
421 }else
│ │ │ +
422 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ +
423 }else
│ │ │ +
424#undef DIRECTSOLVER
│ │ │ +
425#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ +
426 {
│ │ │ +
427 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ +
428 {
│ │ │ +
429 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ +
430 // We are still participating on this level
│ │ │ +
431 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ +
432 *scalarProduct_,
│ │ │ +
433 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ +
434 else
│ │ │ +
435 solver_.reset();
│ │ │ +
436 }else
│ │ │ +
437 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ +
438 *scalarProduct_,
│ │ │ +
439 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ +
440 }
│ │ │ +
441 }
│ │ │ +
442
│ │ │ +
443 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ +
444 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
445 }
│ │ │ +
446
│ │ │ +
447
│ │ │ +
448 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
450 {
│ │ │ +
451 Timer watch, watch1;
│ │ │ +
452 // Detect Matrix rows where all offdiagonal entries are
│ │ │ +
453 // zero and set x such that A_dd*x_d=b_d
│ │ │ +
454 // Thus users can be more careless when setting up their linear
│ │ │ +
455 // systems.
│ │ │ +
456 typedef typename M::matrix_type Matrix;
│ │ │ +
457 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ +
458 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ +
459 typedef typename Matrix::block_type Block;
│ │ │ +
460 Block zero;
│ │ │ +
461 zero=typename Matrix::field_type();
│ │ │ +
462
│ │ │ +
463 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ +
464 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ +
465 bool isDirichlet = true;
│ │ │ +
466 bool hasDiagonal = false;
│ │ │ +
467 ColIter diag;
│ │ │ +
468 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ +
469 if(row.index()==col.index()) {
│ │ │ +
470 diag = col;
│ │ │ +
471 hasDiagonal = (*col != zero);
│ │ │ +
472 }else{
│ │ │ +
473 if(*col!=zero)
│ │ │ +
474 isDirichlet = false;
│ │ │ +
475 }
│ │ │ +
476 }
│ │ │ +
477 if(isDirichlet && hasDiagonal)
│ │ │ +
478 diag->solve(x[row.index()], b[row.index()]);
│ │ │ +
479 }
│ │ │ +
480 if (verbosity_>0)
│ │ │ +
481 std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
│ │ │ +
482 watch1.reset();
│ │ │ +
483 // No smoother to make x consistent! Do it by hand
│ │ │ +
484 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ +
485 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ +
486 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
487 residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
488 matrices_->coarsenVector(*rhs_);
│ │ │ +
489 matrices_->coarsenVector(*lhs_);
│ │ │ +
490 matrices_->coarsenVector(*residual_);
│ │ │ +
491
│ │ │ +
492 // The preconditioner might change x and b. So we have to
│ │ │ +
493 // copy the changes to the original vectors.
│ │ │ +
494 x = *lhs_->finest();
│ │ │ +
495 b = *rhs_->finest();
│ │ │ +
496 }
│ │ │ +
│ │ │ +
497 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
499 {
│ │ │ +
500 return matrices_->levels();
│ │ │ +
501 }
│ │ │ +
│ │ │ +
502 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
504 {
│ │ │ +
505 return matrices_->maxlevels();
│ │ │ +
506 }
│ │ │ +
│ │ │ +
507
│ │ │ +
509 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
511 {
│ │ │ +
512 LevelContext levelContext;
│ │ │ +
513 // Init all iterators for the current level
│ │ │ +
514 initIteratorsWithFineLevel(levelContext);
│ │ │ +
515
│ │ │ +
516 assert(v.two_norm()==0);
│ │ │ +
517
│ │ │ +
518 level=0;
│ │ │ +
519 if(matrices_->maxlevels()==1){
│ │ │ +
520 // The coarse solver might modify the d!
│ │ │ +
521 Range b(d);
│ │ │ +
522 mgc(levelContext, v, b);
│ │ │ +
523 }else
│ │ │ +
524 mgc(levelContext, v, d);
│ │ │ +
525 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ +
526 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ +
527 }
│ │ │ +
│ │ │ +
528
│ │ │ +
529 template<class M, class X, class PI, class A>
│ │ │ +
530 void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ +
531 {
│ │ │ +
532 levelContext.matrix = matrices_->matrices().finest();
│ │ │ +
533 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ +
534 levelContext.redist =
│ │ │ +
535 matrices_->redistributeInformation().begin();
│ │ │ +
536 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ +
537 levelContext.lhs = lhs_->finest();
│ │ │ +
538 levelContext.residual = residual_->finest();
│ │ │ +
539 levelContext.rhs = rhs_->finest();
│ │ │ +
540 levelContext.level=0;
│ │ │ +
541 }
│ │ │ +
542
│ │ │ +
543 template<class M, class X, class PI, class A>
│ │ │ +
544 bool FastAMG<M,X,PI,A>
│ │ │ +
545 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ +
546 {
│ │ │ +
547 bool processNextLevel=true;
│ │ │ +
548
│ │ │ +
549 if(levelContext.redist->isSetup()) {
│ │ │ +
550 throw "bla";
│ │ │ +
551 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
│ │ │ +
552 levelContext.residual.getRedistributed());
│ │ │ +
553 processNextLevel = levelContext.residual.getRedistributed().size()>0;
│ │ │ +
554 if(processNextLevel) {
│ │ │ +
555 //restrict defect to coarse level right hand side.
│ │ │ +
556 ++levelContext.pinfo;
│ │ │ +
557 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
558 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ +
559 static_cast<const Range&>(levelContext.residual.getRedistributed()),
│ │ │ +
560 *levelContext.pinfo);
│ │ │ +
561 }
│ │ │ +
562 }else{
│ │ │ +
563 //restrict defect to coarse level right hand side.
│ │ │ +
564 ++levelContext.rhs;
│ │ │ +
565 ++levelContext.pinfo;
│ │ │ +
566 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
567 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ +
568 static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
│ │ │ +
569 }
│ │ │ +
570
│ │ │ +
571 if(processNextLevel) {
│ │ │ +
572 // prepare coarse system
│ │ │ +
573 ++levelContext.residual;
│ │ │ +
574 ++levelContext.lhs;
│ │ │ +
575 ++levelContext.matrix;
│ │ │ +
576 ++levelContext.level;
│ │ │ +
577 ++levelContext.redist;
│ │ │ +
578
│ │ │ +
579 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
580 // next level is not the globally coarsest one
│ │ │ +
581 ++levelContext.aggregates;
│ │ │ +
582 }
│ │ │ +
583 // prepare the lhs on the next level
│ │ │ +
584 *levelContext.lhs=0;
│ │ │ +
585 *levelContext.residual=0;
│ │ │ +
586 }
│ │ │ +
587 return processNextLevel;
│ │ │ +
588 }
│ │ │ +
589
│ │ │ +
590 template<class M, class X, class PI, class A>
│ │ │ +
591 void FastAMG<M,X,PI,A>
│ │ │ +
592 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
│ │ │ +
593 {
│ │ │ +
594 if(processNextLevel) {
│ │ │ +
595 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
596 // previous level is not the globally coarsest one
│ │ │ +
597 --levelContext.aggregates;
│ │ │ +
598 }
│ │ │ +
599 --levelContext.redist;
│ │ │ +
600 --levelContext.level;
│ │ │ +
601 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ +
602 --levelContext.matrix;
│ │ │ +
603 --levelContext.residual;
│ │ │ +
604
│ │ │ +
605 }
│ │ │ +
606
│ │ │ +
607 typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
│ │ │ +
608 if(levelContext.redist->isSetup()) {
│ │ │ +
609
│ │ │ +
610 // Need to redistribute during prolongate
│ │ │ +
611 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
612 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ +
613 levelContext.lhs.getRedistributed(),
│ │ │ +
614 matrices_->getProlongationDampingFactor(),
│ │ │ +
615 *levelContext.pinfo, *levelContext.redist);
│ │ │ +
616 }else{
│ │ │ +
617 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
618 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ +
619 matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
│ │ │ +
620
│ │ │ +
621 // printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
│ │ │ +
622 }
│ │ │ +
623
│ │ │ +
624
│ │ │ +
625 if(processNextLevel) {
│ │ │ +
626 --levelContext.rhs;
│ │ │ +
627 }
│ │ │ +
628
│ │ │ +
629 }
│ │ │ +
630
│ │ │ +
631
│ │ │ +
632 template<class M, class X, class PI, class A>
│ │ │ +
633 void FastAMG<M,X,PI,A>
│ │ │ +
634 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ +
635 {
│ │ │ +
636 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ +
637 GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
│ │ │ +
638 x,
│ │ │ +
639 *levelContext.residual,
│ │ │ +
640 b);
│ │ │ +
641 }
│ │ │ +
642
│ │ │ +
643 template<class M, class X, class PI, class A>
│ │ │ +
644 void FastAMG<M,X,PI,A>
│ │ │ +
645 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ +
646 {
│ │ │ +
647 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ +
648 GaussSeidelPostsmoothDefect<bl>
│ │ │ +
649 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
│ │ │ +
650 }
│ │ │ +
651
│ │ │ +
652
│ │ │ +
653 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
655 {
│ │ │ + │ │ │ +
657 }
│ │ │ +
│ │ │ +
658
│ │ │ +
659 template<class M, class X, class PI, class A>
│ │ │ +
660 void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
│ │ │ +
661
│ │ │ +
662 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ +
663 // Solve directly
│ │ │ + │ │ │ +
665 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ +
666 if(levelContext.redist->isSetup()) {
│ │ │ +
667 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
│ │ │ +
668 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ +
669 // We are still participating in the computation
│ │ │ +
670 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ +
671 levelContext.rhs.getRedistributed());
│ │ │ +
672 solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
│ │ │ +
673 }
│ │ │ +
674 levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
│ │ │ +
675 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ +
676 }else{
│ │ │ +
677 levelContext.pinfo->copyOwnerToAll(b, b);
│ │ │ +
678 solver_->apply(v, const_cast<Range&>(b), res);
│ │ │ +
679 }
│ │ │ +
680
│ │ │ +
681 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
│ │ │ +
682 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
│ │ │ +
683 if (!res.converged)
│ │ │ +
684 coarsesolverconverged = false;
│ │ │ +
685 }else{
│ │ │ +
686 // presmoothing
│ │ │ +
687 presmooth(levelContext, v, b);
│ │ │ +
688 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
│ │ │ +
689 // printvector(std::cout, *residual, "post presmooth residual", "r", 10);
│ │ │ +
690#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ +
691 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ +
692
│ │ │ +
693 if(processNextLevel) {
│ │ │ +
694 // next level
│ │ │ +
695 for(std::size_t i=0; i<gamma_; i++)
│ │ │ +
696 mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
│ │ │ +
697 }
│ │ │ +
698
│ │ │ +
699 moveToFineLevel(levelContext, processNextLevel, v);
│ │ │ +
700#else
│ │ │ +
701 *lhs=0;
│ │ │ +
702#endif
│ │ │ +
703
│ │ │ +
704 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ +
705 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ +
706 if(!coarsesolverconverged)
│ │ │ +
707 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ +
708 }
│ │ │ +
709
│ │ │ +
710 postsmooth(levelContext, v, b);
│ │ │ +
711 }
│ │ │ +
712 }
│ │ │ +
713
│ │ │ +
714
│ │ │ +
716 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ +
717 void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ +
718 {
│ │ │ +
719 lhs_=nullptr;
│ │ │ +
720 rhs_=nullptr;
│ │ │ +
721 residual_=nullptr;
│ │ │ +
722 }
│ │ │ +
│ │ │ +
723
│ │ │ +
724 template<class M, class X, class PI, class A>
│ │ │ +
725 template<class A1>
│ │ │ +
│ │ │ +
726 void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ +
727 {
│ │ │ +
728 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ +
729 }
│ │ │ +
│ │ │ +
730
│ │ │ +
731 } // end namespace Amg
│ │ │ +
732} // end namespace Dune
│ │ │ +
733
│ │ │ +
734#endif
│ │ │ +
Prolongation and restriction for amg.
│ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ + │ │ │ +
Classes for the generic construction and application of the smoothers.
│ │ │ +
Define base class for scalar product and norm.
│ │ │ +
Classes for using UMFPack with ISTL matrices.
│ │ │ +
Define general preconditioner interface.
│ │ │ +
Templates characterizing the type of a solver.
│ │ │ +
Implementations of the inverse operator interface.
│ │ │ +
Classes for using SuperLU with ISTL matrices.
│ │ │ +
Some generic functions for pretty printing vectors and matrices.
│ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ +
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition kamg.hh:253
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition amg.hh:194
│ │ │ -
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:80
│ │ │ +
int iterations
The number of iterations to perform.
Definition smoother.hh:47
│ │ │ +
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition fastamg.hh:207
│ │ │ +
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition fastamg.hh:726
│ │ │ +
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition fastamg.hh:211
│ │ │ +
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition fastamg.hh:173
│ │ │ +
void post(Domain &x)
Clean up.
Definition fastamg.hh:717
│ │ │ +
std::size_t maxlevels()
Definition fastamg.hh:503
│ │ │ +
X Domain
The domain type.
Definition fastamg.hh:77
│ │ │ +
Hierarchy< Domain, A >::Iterator residual
The iterator over the residuals.
Definition fastamg.hh:227
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition fastamg.hh:146
│ │ │ +
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition fastamg.hh:72
│ │ │ +
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition fastamg.hh:215
│ │ │ +
X Range
The range type.
Definition fastamg.hh:79
│ │ │ +
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition fastamg.hh:70
│ │ │ +
M Operator
The matrix operator type.
Definition fastamg.hh:63
│ │ │ +
std::size_t levels()
Definition fastamg.hh:498
│ │ │ +
FastAMG(const Operator &fineOperator, const C &criterion, const Parameters &parms=Parameters(), bool symmetric=true, const ParallelInformation &pinfo=ParallelInformation())
Construct an AMG with an inexact coarse solver based on the smoother.
Definition fastamg.hh:125
│ │ │ +
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition fastamg.hh:81
│ │ │ +
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition fastamg.hh:654
│ │ │ +
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition fastamg.hh:223
│ │ │ +
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition fastamg.hh:231
│ │ │ +
std::size_t level
The level index.
Definition fastamg.hh:235
│ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition fastamg.hh:510
│ │ │ +
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition fastamg.hh:74
│ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition fastamg.hh:449
│ │ │ +
FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const Parameters &parms, bool symmetric=true)
Construct a new amg with a specific coarse solver.
Definition fastamg.hh:320
│ │ │ +
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition fastamg.hh:219
│ │ │
Definition allocator.hh:11
│ │ │ -
an algebraic multigrid method using a Krylov-cycle.
Definition kamg.hh:140
│ │ │ -
Amg::Domain Domain
the type of the domain.
Definition kamg.hh:157
│ │ │ -
Amg::SmootherArgs SmootherArgs
The type of the arguments for construction of the smoothers.
Definition kamg.hh:153
│ │ │ -
Amg::ParallelInformation ParallelInformation
the type of the parallelinformation to use.
Definition kamg.hh:151
│ │ │ -
Amg::CoarseSolver CoarseSolver
The type of the coarse solver.
Definition kamg.hh:149
│ │ │ -
Amg::OperatorHierarchy OperatorHierarchy
The type of the hierarchy of operators.
Definition kamg.hh:147
│ │ │ -
Amg::Range Range
The type of the range.
Definition kamg.hh:159
│ │ │ -
Amg::ScalarProduct ScalarProduct
The type of the scalar product.
Definition kamg.hh:163
│ │ │ -
AMG< M, X, S, PI, A > Amg
The type of the underlying AMG.
Definition kamg.hh:143
│ │ │ -
Amg::Operator Operator
the type of the lineatr operator.
Definition kamg.hh:155
│ │ │ -
Amg::ParallelInformationHierarchy ParallelInformationHierarchy
The type of the hierarchy of parallel information.
Definition kamg.hh:161
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:166
│ │ │ -
K KrylovSolver
The type of the Krylov solver for the cycle.
Definition kamg.hh:145
│ │ │ -
Two grid operator for AMG with Krylov cycle.
Definition kamg.hh:33
│ │ │ -
void pre(typename AMG::Domain &x, typename AMG::Range &b)
Prepare the preconditioner.
Definition kamg.hh:58
│ │ │ -
KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > coarseSolver)
Constructor.
Definition kamg.hh:53
│ │ │ -
~KAmgTwoGrid()
Destructor.
Definition kamg.hh:110
│ │ │ -
void post(typename AMG::Domain &x)
Clean up.
Definition kamg.hh:62
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition kamg.hh:41
│ │ │ -
void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p)
Set the level context pointer.
Definition kamg.hh:104
│ │ │ -
InverseOperator< Domain, Range > * coarseSolver()
Get a pointer to the coarse grid solver.
Definition kamg.hh:95
│ │ │ -
void apply(typename AMG::Domain &v, const typename AMG::Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition kamg.hh:66
│ │ │ -
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:65
│ │ │ +
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ +
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ +
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ +
A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth.
Definition fastamg.hh:60
│ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ │ │ │
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ +
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │
All parameters for AMG.
Definition parameters.hh:416
│ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ +
Sequential SSOR preconditioner.
Definition preconditioners.hh:142
│ │ │
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ +
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │
Category
Definition solvercategory.hh:23
│ │ │ -
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1307
│ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
Definition solvertype.hh:16
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,433 +1,841 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -kamg.hh │ │ │ │ +fastamg.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_KAMG_HH │ │ │ │ -6#define DUNE_AMG_KAMG_HH │ │ │ │ +5#ifndef DUNE_ISTL_FASTAMG_HH │ │ │ │ +6#define DUNE_ISTL_FASTAMG_HH │ │ │ │ 7 │ │ │ │ -8#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ -9#include "_a_m_g_._h_h" │ │ │ │ -10 │ │ │ │ -11namespace _D_u_n_e │ │ │ │ -12{ │ │ │ │ -13 namespace Amg │ │ │ │ -14 { │ │ │ │ -15 │ │ │ │ -30 template │ │ │ │ -_3_1 class _K_A_m_g_T_w_o_G_r_i_d │ │ │ │ -32 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -33 { │ │ │ │ -35 typedef typename _A_M_G_:_:_D_o_m_a_i_n Domain; │ │ │ │ -37 typedef typename _A_M_G_:_:_R_a_n_g_e Range; │ │ │ │ -38 public: │ │ │ │ -39 │ │ │ │ -_4_1 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -42 { │ │ │ │ -43 return amg_._c_a_t_e_g_o_r_y(); │ │ │ │ -44 }; │ │ │ │ -45 │ │ │ │ -_5_3 _K_A_m_g_T_w_o_G_r_i_d(_A_M_G& amg, std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_> > │ │ │ │ -_c_o_a_r_s_e_S_o_l_v_e_r) │ │ │ │ -54 : amg_(amg), coarseSolver_(_c_o_a_r_s_e_S_o_l_v_e_r) │ │ │ │ -55 {} │ │ │ │ -56 │ │ │ │ -_5_8 void _p_r_e([[maybe_unused]] typename _A_M_G_:_:_D_o_m_a_i_n& x, [[maybe_unused]] typename │ │ │ │ -_A_M_G_:_:_R_a_n_g_e& b) │ │ │ │ -59 {} │ │ │ │ -60 │ │ │ │ -_6_2 void _p_o_s_t([[maybe_unused]] typename _A_M_G_:_:_D_o_m_a_i_n& x) │ │ │ │ -63 {} │ │ │ │ -64 │ │ │ │ -_6_6 void _a_p_p_l_y(typename _A_M_G_:_:_D_o_m_a_i_n& v, const typename _A_M_G_:_:_R_a_n_g_e& d) │ │ │ │ -67 { │ │ │ │ -68 // Copy data │ │ │ │ -69 *levelContext_->update=0; │ │ │ │ -70 *levelContext_->rhs = d; │ │ │ │ -71 *levelContext_->lhs = v; │ │ │ │ -72 │ │ │ │ -73 _p_r_e_s_m_o_o_t_h(*levelContext_, amg_.preSteps_); │ │ │ │ -74 bool processFineLevel = │ │ │ │ -75 amg_.moveToCoarseLevel(*levelContext_); │ │ │ │ -76 │ │ │ │ -77 if(processFineLevel) { │ │ │ │ -78 typename _A_M_G_:_:_R_a_n_g_e b=*levelContext_->rhs; │ │ │ │ -79 typename _A_M_G_:_:_D_o_m_a_i_n x=*levelContext_->update; │ │ │ │ -80 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ -81 coarseSolver_->apply(x, b, res); │ │ │ │ -82 *levelContext_->update=x; │ │ │ │ -83 } │ │ │ │ -84 │ │ │ │ -85 amg_.moveToFineLevel(*levelContext_, processFineLevel); │ │ │ │ -86 │ │ │ │ -87 _p_o_s_t_s_m_o_o_t_h(*levelContext_, amg_.postSteps_); │ │ │ │ -88 v=*levelContext_->update; │ │ │ │ -89 } │ │ │ │ -90 │ │ │ │ -_9_5 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_>* _c_o_a_r_s_e_S_o_l_v_e_r() │ │ │ │ -96 { │ │ │ │ -97 return coarseSolver_; │ │ │ │ -98 } │ │ │ │ -99 │ │ │ │ -_1_0_4 void _s_e_t_L_e_v_e_l_C_o_n_t_e_x_t(std::shared_ptr p) │ │ │ │ -105 { │ │ │ │ -106 levelContext_=p; │ │ │ │ -107 } │ │ │ │ -108 │ │ │ │ -_1_1_0 _~_K_A_m_g_T_w_o_G_r_i_d() │ │ │ │ -111 {} │ │ │ │ -112 │ │ │ │ -113 private: │ │ │ │ -115 _A_M_G& amg_; │ │ │ │ -117 std::shared_ptr > coarseSolver_; │ │ │ │ -119 std::shared_ptr levelContext_; │ │ │ │ -120 }; │ │ │ │ -121 │ │ │ │ -122 │ │ │ │ -123 │ │ │ │ -137 template, class A=std::allocator > │ │ │ │ -_1_3_9 class _K_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -140 { │ │ │ │ -141 public: │ │ │ │ -_1_4_3 typedef _A_M_G_<_M_,_X_,_S_,_P_I_,_A_> _A_m_g; │ │ │ │ -_1_4_5 typedef K _K_r_y_l_o_v_S_o_l_v_e_r; │ │ │ │ -_1_4_7 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ -_1_4_9 typedef typename _A_m_g_:_:_C_o_a_r_s_e_S_o_l_v_e_r _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ -_1_5_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -_1_5_3 typedef typename _A_m_g_:_:_S_m_o_o_t_h_e_r_A_r_g_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ -_1_5_5 typedef typename _A_m_g_:_:_O_p_e_r_a_t_o_r _O_p_e_r_a_t_o_r; │ │ │ │ -_1_5_7 typedef typename _A_m_g_:_:_D_o_m_a_i_n _D_o_m_a_i_n; │ │ │ │ -_1_5_9 typedef typename _A_m_g_:_:_R_a_n_g_e _R_a_n_g_e; │ │ │ │ -_1_6_1 typedef typename _A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ +13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ +14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ +15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ +16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ +17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ +18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ +19#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ +20#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ +21 │ │ │ │ +22#include "_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h" │ │ │ │ +23 │ │ │ │ +32namespace _D_u_n_e │ │ │ │ +33{ │ │ │ │ +34 namespace Amg │ │ │ │ +35 { │ │ │ │ +58 template > │ │ │ │ +_5_9 class _F_a_s_t_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +60 { │ │ │ │ +61 public: │ │ │ │ +_6_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ +_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +_7_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ +_7_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ -_1_6_3 typedef typename _A_m_g_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t _S_c_a_l_a_r_P_r_o_d_u_c_t; │ │ │ │ +75 │ │ │ │ +_7_7 typedef X _D_o_m_a_i_n; │ │ │ │ +_7_9 typedef X _R_a_n_g_e; │ │ │ │ +_8_1 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_X_> _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ +82 │ │ │ │ +90 _F_a_s_t_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ +91 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ +92 bool symmetric=true); │ │ │ │ +93 │ │ │ │ +105 template │ │ │ │ +106 _F_a_s_t_A_M_G(std::shared_ptr fineOperator, │ │ │ │ +107 const C& criterion, │ │ │ │ +108 const _P_a_r_a_m_e_t_e_r_s& parms=_P_a_r_a_m_e_t_e_r_s(), │ │ │ │ +109 bool symmetric=true, │ │ │ │ +110 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ +111 │ │ │ │ +124 template │ │ │ │ +_1_2_5 _F_a_s_t_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, │ │ │ │ +126 const C& criterion, │ │ │ │ +127 const _P_a_r_a_m_e_t_e_r_s& parms=_P_a_r_a_m_e_t_e_r_s(), │ │ │ │ +128 bool symmetric=true, │ │ │ │ +129 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()) │ │ │ │ +130 : _F_a_s_t_A_M_G(stackobject_to_shared_ptr(fineOperator), │ │ │ │ +131 criterion, parms, symmetric, pinfo) │ │ │ │ +132 {} │ │ │ │ +133 │ │ │ │ +137 _F_a_s_t_A_M_G(const _F_a_s_t_A_M_G& amg); │ │ │ │ +138 │ │ │ │ +140 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ +141 │ │ │ │ +143 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ +144 │ │ │ │ +_1_4_6 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ +147 { │ │ │ │ +148 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ +149 } │ │ │ │ +150 │ │ │ │ +152 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ +153 │ │ │ │ +158 template │ │ │ │ +159 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont); │ │ │ │ +160 │ │ │ │ +161 std::size_t _l_e_v_e_l_s(); │ │ │ │ +162 │ │ │ │ +163 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ 164 │ │ │ │ -_1_6_6 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -167 { │ │ │ │ -168 return amg._c_a_t_e_g_o_r_y(); │ │ │ │ -169 }; │ │ │ │ -170 │ │ │ │ -182 _K_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ -183 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ -184 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1); │ │ │ │ -185 │ │ │ │ -199 template │ │ │ │ -200 _K_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ -201 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs=_S_m_o_o_t_h_e_r_A_r_g_s(), │ │ │ │ -202 std::size_t maxLevelKrylovSteps=3, double minDefectReduction=1e-1, │ │ │ │ -203 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ -204 │ │ │ │ -206 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ -208 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ -210 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ -211 │ │ │ │ -212 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ -213 │ │ │ │ -214 private: │ │ │ │ -216 _A_m_g amg; │ │ │ │ -217 │ │ │ │ -219 std::size_t maxLevelKrylovSteps; │ │ │ │ -220 │ │ │ │ -222 double levelDefectReduction; │ │ │ │ -223 │ │ │ │ -225 std::vector > scalarproducts; │ │ │ │ -226 │ │ │ │ -228 std::vector > > ksolvers; │ │ │ │ -229 }; │ │ │ │ -230 │ │ │ │ -231 │ │ │ │ -232 template │ │ │ │ -_2_3_3 _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_K_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ -coarseSolver, │ │ │ │ -234 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, const _P_a_r_a_m_e_t_e_r_s& params, │ │ │ │ -235 std::size_t ksteps, double reduction) │ │ │ │ -236 : amg(matrices, coarseSolver, smootherArgs, params), │ │ │ │ -237 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction) │ │ │ │ -238 {} │ │ │ │ -239 │ │ │ │ +_1_7_3 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ +174 { │ │ │ │ +175 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ +176 } │ │ │ │ +177 │ │ │ │ +182 bool _u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const; │ │ │ │ +183 │ │ │ │ +184 private: │ │ │ │ +191 template │ │ │ │ +192 void createHierarchies(C& criterion, │ │ │ │ +193 std::shared_ptr fineOperator, │ │ │ │ +194 const PI& pinfo); │ │ │ │ +195 │ │ │ │ +202 struct LevelContext │ │ │ │ +203 { │ │ │ │ +_2_0_7 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ +_2_1_1 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r _p_i_n_f_o; │ │ │ │ +_2_1_5 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ +_2_1_9 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ +_2_2_3 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _l_h_s; │ │ │ │ +_2_2_7 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _r_e_s_i_d_u_a_l; │ │ │ │ +_2_3_1 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r _r_h_s; │ │ │ │ +_2_3_5 std::size_t _l_e_v_e_l; │ │ │ │ +236 }; │ │ │ │ +237 │ │ │ │ +239 void mgc(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ 240 │ │ │ │ -241 template │ │ │ │ -242 template │ │ │ │ -_2_4_3 _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_K_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ -244 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ -245 std::size_t ksteps, double reduction, │ │ │ │ -246 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) │ │ │ │ -247 : amg(fineOperator, criterion, smootherArgs, pinfo), │ │ │ │ -248 maxLevelKrylovSteps(ksteps), levelDefectReduction(reduction) │ │ │ │ -249 {} │ │ │ │ -250 │ │ │ │ -251 │ │ │ │ -252 template │ │ │ │ -_2_5_3 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ -254 { │ │ │ │ -255 amg.pre(x,b); │ │ │ │ -256 scalarproducts.reserve(amg.levels()); │ │ │ │ -257 ksolvers.reserve(amg.levels()); │ │ │ │ -258 │ │ │ │ -259 typename OperatorHierarchy::ParallelMatrixHierarchy::Iterator │ │ │ │ -260 matrix = amg.matrices_->matrices().coarsest(); │ │ │ │ -261 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ -262 pinfo = amg.matrices_->parallelInformation().coarsest(); │ │ │ │ -263 bool hasCoarsest=(amg.levels()==amg.maxlevels()); │ │ │ │ -264 │ │ │ │ -265 if(hasCoarsest) { │ │ │ │ -266 if(matrix==amg.matrices_->matrices().finest()) │ │ │ │ -267 return; │ │ │ │ -268 --matrix; │ │ │ │ -269 --pinfo; │ │ │ │ -270 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ -(amg, amg.solver_))); │ │ │ │ -271 }else │ │ │ │ -272 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ -(amg, std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_D_o_m_a_i_n_,_R_a_n_g_e_> >()))); │ │ │ │ -273 │ │ │ │ -274 std::ostringstream s; │ │ │ │ -275 │ │ │ │ -276 if(matrix!=amg.matrices_->matrices().finest()) │ │ │ │ -277 while(true) { │ │ │ │ -278 scalarproducts.push_back(createScalarProduct(*pinfo,category())); │ │ │ │ -279 std::shared_ptr > ks = │ │ │ │ -280 std::shared_ptr >(new _K_r_y_l_o_v_S_o_l_v_e_r(*matrix, * │ │ │ │ -(scalarproducts.back()), │ │ │ │ -281 *(ksolvers.back()), levelDefectReduction, │ │ │ │ -282 maxLevelKrylovSteps, 0)); │ │ │ │ -283 ksolvers.push_back(std::shared_ptr<_K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> >(new _K_A_m_g_T_w_o_G_r_i_d_<_A_m_g_> │ │ │ │ -(amg, ks))); │ │ │ │ -284 --matrix; │ │ │ │ -285 --pinfo; │ │ │ │ -286 if(matrix==amg.matrices_->matrices().finest()) │ │ │ │ -287 break; │ │ │ │ -288 } │ │ │ │ -289 } │ │ │ │ -290 │ │ │ │ -291 │ │ │ │ -292 template │ │ │ │ -_2_9_3 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_p_o_s_t(_D_o_m_a_i_n& x) │ │ │ │ -294 { │ │ │ │ -295 amg.post(x); │ │ │ │ -296 │ │ │ │ -297 } │ │ │ │ -298 │ │ │ │ -299 template │ │ │ │ -_3_0_0 void _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ -301 { │ │ │ │ -302 if(ksolvers.size()==0) │ │ │ │ -303 { │ │ │ │ -304 _R_a_n_g_e td=d; │ │ │ │ -305 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ -306 amg.solver_->apply(v,td,res); │ │ │ │ -307 }else │ │ │ │ -308 { │ │ │ │ -309 typedef typename Amg::LevelContext LevelContext; │ │ │ │ -310 std::shared_ptr levelContext(new LevelContext); │ │ │ │ -311 amg.initIteratorsWithFineLevel(*levelContext); │ │ │ │ -312 typedef typename std::vector > >::iterator │ │ │ │ -Iter; │ │ │ │ -313 for(Iter solver=ksolvers.begin(); solver!=ksolvers.end(); ++solver) │ │ │ │ -314 (*solver)->setLevelContext(levelContext); │ │ │ │ -315 ksolvers.back()->apply(v,d); │ │ │ │ -316 } │ │ │ │ -317 } │ │ │ │ +247 void presmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ +248 │ │ │ │ +255 void postsmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ +256 │ │ │ │ +263 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel, │ │ │ │ +264 _D_o_m_a_i_n& fineX); │ │ │ │ +265 │ │ │ │ +270 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ +271 │ │ │ │ +276 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ +277 │ │ │ │ +279 std::shared_ptr matrices_; │ │ │ │ +281 std::shared_ptr solver_; │ │ │ │ +283 std::shared_ptr> rhs_; │ │ │ │ +285 std::shared_ptr> lhs_; │ │ │ │ +287 std::shared_ptr> residual_; │ │ │ │ +288 │ │ │ │ +290 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ +292 std::shared_ptr scalarProduct_; │ │ │ │ +294 std::size_t gamma_; │ │ │ │ +296 std::size_t preSteps_; │ │ │ │ +298 std::size_t postSteps_; │ │ │ │ +299 std::size_t level; │ │ │ │ +300 bool buildHierarchy_; │ │ │ │ +301 bool symmetric; │ │ │ │ +302 bool coarsesolverconverged; │ │ │ │ +303 typedef _S_e_q_S_S_O_R_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_X_,_X_> _S_m_o_o_t_h_e_r; │ │ │ │ +304 typedef std::shared_ptr SmootherPointer; │ │ │ │ +305 SmootherPointer coarseSmoother_; │ │ │ │ +307 std::size_t verbosity_; │ │ │ │ +308 }; │ │ │ │ +309 │ │ │ │ +310 template │ │ │ │ +_3_1_1 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(const _F_a_s_t_A_M_G& amg) │ │ │ │ +312 : matrices_(amg.matrices_), solver_(amg.solver_), │ │ │ │ +313 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_), │ │ │ │ +314 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ +315 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ +316 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_) │ │ │ │ +317 {} │ │ │ │ 318 │ │ │ │ -319 template │ │ │ │ -_3_2_0 std::size_t _K_A_M_G_<_M_,_X_,_S_,_P_,_K_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ -321 { │ │ │ │ -322 return amg.maxlevels(); │ │ │ │ -323 } │ │ │ │ -324 │ │ │ │ -326 } // Amg │ │ │ │ -327} // Dune │ │ │ │ -328 │ │ │ │ -329#endif │ │ │ │ +319 template │ │ │ │ +_3_2_0 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ +coarseSolver, │ │ │ │ +321 const _P_a_r_a_m_e_t_e_r_s& parms, bool symmetric_) │ │ │ │ +322 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver), │ │ │ │ +323 rhs_(), lhs_(), residual_(), scalarProduct_(), │ │ │ │ +324 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ +325 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ +326 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ +327 coarseSmoother_(), verbosity_(parms.debugLevel()) │ │ │ │ +328 { │ │ │ │ +329 if(preSteps_>1||postSteps_>1) │ │ │ │ +330 { │ │ │ │ +331 std::cerr<<"WARNING only one step of smoothing is supported!"<isBuilt()); │ │ │ │ +335 static_assert(std::is_same::value, │ │ │ │ +336 "Currently only sequential runs are supported"); │ │ │ │ +337 } │ │ │ │ +338 template │ │ │ │ +339 template │ │ │ │ +_3_4_0 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(std::shared_ptr fineOperator, │ │ │ │ +341 const C& criterion, │ │ │ │ +342 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ +343 bool symmetric_, │ │ │ │ +344 const PI& pinfo) │ │ │ │ +345 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_ │ │ │ │ +(parms.getGamma()), │ │ │ │ +346 preSteps_(parms.getNoPreSmoothSteps()), postSteps_ │ │ │ │ +(parms.getNoPostSmoothSteps()), │ │ │ │ +347 buildHierarchy_(true), │ │ │ │ +348 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ +349 coarseSmoother_(), verbosity_(criterion.debugLevel()) │ │ │ │ +350 { │ │ │ │ +351 if(preSteps_>1||postSteps_>1) │ │ │ │ +352 { │ │ │ │ +353 std::cerr<<"WARNING only one step of smoothing is supported!"<::value, │ │ │ │ +357 "Currently only sequential runs are supported"); │ │ │ │ +358 // TODO: reestablish compile time checks. │ │ │ │ +359 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ +category), │ │ │ │ +360 // "Matrix and Solver must match in terms of category!"); │ │ │ │ +361 createHierarchies(criterion, std::move(fineOperator), pinfo); │ │ │ │ +362 } │ │ │ │ +363 │ │ │ │ +364 template │ │ │ │ +365 template │ │ │ │ +366 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_c_r_e_a_t_e_H_i_e_r_a_r_c_h_i_e_s(C& criterion, │ │ │ │ +367 std::shared_ptr fineOperator, │ │ │ │ +368 const PI& pinfo) │ │ │ │ +369 { │ │ │ │ +370 Timer watch; │ │ │ │ +371 matrices_ = std::make_shared( │ │ │ │ +372 std::const_pointer_cast(std::move(fineOperator)), │ │ │ │ +373 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ +374 │ │ │ │ +375 matrices_->template build >(criterion); │ │ │ │ +376 │ │ │ │ +377 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ +().rank()==0) │ │ │ │ +378 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ +"<levels()==matrices_->maxlevels()) { │ │ │ │ +381 // We have the carsest level. Create the coarse Solver │ │ │ │ +382 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s SmootherArgs; │ │ │ │ +383 SmootherArgs sargs; │ │ │ │ +384 sargs._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ +385 │ │ │ │ +386 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ +387 cargs.setArgs(sargs); │ │ │ │ +388 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ +389 // Solve on the redistributed partitioning │ │ │ │ +390 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ +()); │ │ │ │ +391 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +()); │ │ │ │ +392 }else{ │ │ │ │ +393 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ +394 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ +395 } │ │ │ │ +396 │ │ │ │ +397 coarseSmoother_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_c_o_n_s_t_r_u_c_t(cargs); │ │ │ │ +398 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ +399 │ │ │ │ +400#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ +401#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ +402#define DIRECTSOLVER UMFPack │ │ │ │ +403#else │ │ │ │ +404#define DIRECTSOLVER SuperLU │ │ │ │ +405#endif │ │ │ │ +406 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ +the coarsest level. │ │ │ │ +407 if(std::is_same::value / │ │ │ │ +/ sequential mode │ │ │ │ +408 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ +parallel mode and only one processor │ │ │ │ +409 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ +410 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +().communicator().size()==1 │ │ │ │ +411 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +().communicator().size()>0)) { // redistribute and 1 proc │ │ │ │ +412 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ +>communicator().rank()==0) │ │ │ │ +413 std::cout<<"Using superlu"<parallelInformation().coarsest().isRedistributed()) │ │ │ │ +415 { │ │ │ │ +416 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ +417 // We are still participating on this level │ │ │ │ +418 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ +().coarsest().getRedistributed().getmat(), false, false)); │ │ │ │ +419 else │ │ │ │ +420 solver_.reset(); │ │ │ │ +421 }else │ │ │ │ +422 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ +().coarsest()->getmat(), false, false)); │ │ │ │ +423 }else │ │ │ │ +424#undef DIRECTSOLVER │ │ │ │ +425#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ +426 { │ │ │ │ +427 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ +428 { │ │ │ │ +429 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ +430 // We are still participating on this level │ │ │ │ +431 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ +().coarsest().getRedistributed()), │ │ │ │ +432 *scalarProduct_, │ │ │ │ +433 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ +434 else │ │ │ │ +435 solver_.reset(); │ │ │ │ +436 }else │ │ │ │ +437 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ +().coarsest()), │ │ │ │ +438 *scalarProduct_, │ │ │ │ +439 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ +440 } │ │ │ │ +441 } │ │ │ │ +442 │ │ │ │ +443 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ +().rank()==0) │ │ │ │ +444 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ +"< │ │ │ │ +_4_4_9 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ +450 { │ │ │ │ +451 Timer watch, watch1; │ │ │ │ +452 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ +453 // zero and set x such that A_dd*x_d=b_d │ │ │ │ +454 // Thus users can be more careless when setting up their linear │ │ │ │ +455 // systems. │ │ │ │ +456 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ +457 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r RowIter; │ │ │ │ +458 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIter; │ │ │ │ +459 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ +460 Block zero; │ │ │ │ +461 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ +462 │ │ │ │ +463 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ +464 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ +465 bool isDirichlet = true; │ │ │ │ +466 bool hasDiagonal = false; │ │ │ │ +467 ColIter diag; │ │ │ │ +468 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ +469 if(row.index()==_c_o_l.index()) { │ │ │ │ +470 diag = _c_o_l; │ │ │ │ +471 hasDiagonal = (*_c_o_l != zero); │ │ │ │ +472 }else{ │ │ │ │ +473 if(*_c_o_l!=zero) │ │ │ │ +474 isDirichlet = false; │ │ │ │ +475 } │ │ │ │ +476 } │ │ │ │ +477 if(isDirichlet && hasDiagonal) │ │ │ │ +478 diag->solve(x[row.index()], b[row.index()]); │ │ │ │ +479 } │ │ │ │ +480 if (verbosity_>0) │ │ │ │ +481 std::cout<<" Preprocessing Dirichlet took "<parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ +485 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ +486 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ +487 residual_ = std::make_shared>(std::make_shared │ │ │ │ +(x)); │ │ │ │ +488 matrices_->coarsenVector(*rhs_); │ │ │ │ +489 matrices_->coarsenVector(*lhs_); │ │ │ │ +490 matrices_->coarsenVector(*residual_); │ │ │ │ +491 │ │ │ │ +492 // The preconditioner might change x and b. So we have to │ │ │ │ +493 // copy the changes to the original vectors. │ │ │ │ +494 x = *lhs_->finest(); │ │ │ │ +495 b = *rhs_->finest(); │ │ │ │ +496 } │ │ │ │ +497 template │ │ │ │ +_4_9_8 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ +499 { │ │ │ │ +500 return matrices_->levels(); │ │ │ │ +501 } │ │ │ │ +502 template │ │ │ │ +_5_0_3 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ +504 { │ │ │ │ +505 return matrices_->maxlevels(); │ │ │ │ +506 } │ │ │ │ +507 │ │ │ │ +509 template │ │ │ │ +_5_1_0 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ +511 { │ │ │ │ +512 LevelContext levelContext; │ │ │ │ +513 // Init all iterators for the current level │ │ │ │ +514 initIteratorsWithFineLevel(levelContext); │ │ │ │ +515 │ │ │ │ +516 assert(v.two_norm()==0); │ │ │ │ +517 │ │ │ │ +518 level=0; │ │ │ │ +519 if(matrices_->maxlevels()==1){ │ │ │ │ +520 // The coarse solver might modify the d! │ │ │ │ +521 _R_a_n_g_e b(d); │ │ │ │ +522 mgc(levelContext, v, b); │ │ │ │ +523 }else │ │ │ │ +524 mgc(levelContext, v, d); │ │ │ │ +525 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ +526 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ +527 } │ │ │ │ +528 │ │ │ │ +529 template │ │ │ │ +530 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ +levelContext) │ │ │ │ +531 { │ │ │ │ +532 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ +533 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ +534 levelContext.redist = │ │ │ │ +535 matrices_->redistributeInformation().begin(); │ │ │ │ +536 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ +537 levelContext.lhs = lhs_->finest(); │ │ │ │ +538 levelContext.residual = residual_->finest(); │ │ │ │ +539 levelContext.rhs = rhs_->finest(); │ │ │ │ +540 levelContext.level=0; │ │ │ │ +541 } │ │ │ │ +542 │ │ │ │ +543 template │ │ │ │ +544 bool FastAMG │ │ │ │ +545 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ +546 { │ │ │ │ +547 bool processNextLevel=true; │ │ │ │ +548 │ │ │ │ +549 if(levelContext.redist->isSetup()) { │ │ │ │ +550 throw "bla"; │ │ │ │ +551 levelContext.redist->redistribute(static_cast │ │ │ │ +(*levelContext.residual), │ │ │ │ +552 levelContext.residual.getRedistributed()); │ │ │ │ +553 processNextLevel = levelContext.residual.getRedistributed().size()>0; │ │ │ │ +554 if(processNextLevel) { │ │ │ │ +555 //restrict defect to coarse level right hand side. │ │ │ │ +556 ++levelContext.pinfo; │ │ │ │ +557 Transfer │ │ │ │ +558 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ +559 static_cast(levelContext.residual.getRedistributed()), │ │ │ │ +560 *levelContext.pinfo); │ │ │ │ +561 } │ │ │ │ +562 }else{ │ │ │ │ +563 //restrict defect to coarse level right hand side. │ │ │ │ +564 ++levelContext.rhs; │ │ │ │ +565 ++levelContext.pinfo; │ │ │ │ +566 Transfer │ │ │ │ +567 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ +568 static_cast(*levelContext.residual), *levelContext.pinfo); │ │ │ │ +569 } │ │ │ │ +570 │ │ │ │ +571 if(processNextLevel) { │ │ │ │ +572 // prepare coarse system │ │ │ │ +573 ++levelContext.residual; │ │ │ │ +574 ++levelContext.lhs; │ │ │ │ +575 ++levelContext.matrix; │ │ │ │ +576 ++levelContext.level; │ │ │ │ +577 ++levelContext.redist; │ │ │ │ +578 │ │ │ │ +579 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +580 // next level is not the globally coarsest one │ │ │ │ +581 ++levelContext.aggregates; │ │ │ │ +582 } │ │ │ │ +583 // prepare the lhs on the next level │ │ │ │ +584 *levelContext.lhs=0; │ │ │ │ +585 *levelContext.residual=0; │ │ │ │ +586 } │ │ │ │ +587 return processNextLevel; │ │ │ │ +588 } │ │ │ │ +589 │ │ │ │ +590 template │ │ │ │ +591 void FastAMG │ │ │ │ +592 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, │ │ │ │ +Domain& x) │ │ │ │ +593 { │ │ │ │ +594 if(processNextLevel) { │ │ │ │ +595 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +596 // previous level is not the globally coarsest one │ │ │ │ +597 --levelContext.aggregates; │ │ │ │ +598 } │ │ │ │ +599 --levelContext.redist; │ │ │ │ +600 --levelContext.level; │ │ │ │ +601 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ +602 --levelContext.matrix; │ │ │ │ +603 --levelContext.residual; │ │ │ │ +604 │ │ │ │ +605 } │ │ │ │ +606 │ │ │ │ +607 typename Hierarchy::Iterator coarseLhs = levelContext.lhs--; │ │ │ │ +608 if(levelContext.redist->isSetup()) { │ │ │ │ +609 │ │ │ │ +610 // Need to redistribute during prolongate │ │ │ │ +611 Transfer │ │ │ │ +612 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ +613 levelContext.lhs.getRedistributed(), │ │ │ │ +614 matrices_->getProlongationDampingFactor(), │ │ │ │ +615 *levelContext.pinfo, *levelContext.redist); │ │ │ │ +616 }else{ │ │ │ │ +617 Transfer │ │ │ │ +618 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ +619 matrices_->getProlongationDampingFactor(), *levelContext.pinfo); │ │ │ │ +620 │ │ │ │ +621 // printvector(std::cout, *lhs, "prolongated coarse grid correction", │ │ │ │ +"lhs", 10, 10, 10); │ │ │ │ +622 } │ │ │ │ +623 │ │ │ │ +624 │ │ │ │ +625 if(processNextLevel) { │ │ │ │ +626 --levelContext.rhs; │ │ │ │ +627 } │ │ │ │ +628 │ │ │ │ +629 } │ │ │ │ +630 │ │ │ │ +631 │ │ │ │ +632 template │ │ │ │ +633 void FastAMG │ │ │ │ +634 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ +635 { │ │ │ │ +636 constexpr auto bl = blockLevel(); │ │ │ │ +637 _G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_<_b_l_>_:_:_a_p_p_l_y(levelContext.matrix->getmat(), │ │ │ │ +638 x, │ │ │ │ +639 *levelContext.residual, │ │ │ │ +640 b); │ │ │ │ +641 } │ │ │ │ +642 │ │ │ │ +643 template │ │ │ │ +644 void FastAMG │ │ │ │ +645 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ +646 { │ │ │ │ +647 constexpr auto bl = blockLevel(); │ │ │ │ +648 GaussSeidelPostsmoothDefect │ │ │ │ +649 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b); │ │ │ │ +650 } │ │ │ │ +651 │ │ │ │ +652 │ │ │ │ +653 template │ │ │ │ +_6_5_4 bool _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const │ │ │ │ +655 { │ │ │ │ +656 return _I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _C_o_a_r_s_e_S_o_l_v_e_r_>_:_:_v_a_l_u_e; │ │ │ │ +657 } │ │ │ │ +658 │ │ │ │ +659 template │ │ │ │ +660 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext, Domain& v, const │ │ │ │ +Range& b){ │ │ │ │ +661 │ │ │ │ +662 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ +()==maxlevels()) { │ │ │ │ +663 // Solve directly │ │ │ │ +664 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ +665 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ +666 if(levelContext.redist->isSetup()) { │ │ │ │ +667 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed()); │ │ │ │ +668 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ +669 // We are still participating in the computation │ │ │ │ +670 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ +(levelContext.rhs.getRedistributed(), │ │ │ │ +671 levelContext.rhs.getRedistributed()); │ │ │ │ +672 solver_->apply(levelContext.lhs.getRedistributed(), │ │ │ │ +levelContext.rhs.getRedistributed(), res); │ │ │ │ +673 } │ │ │ │ +674 levelContext.redist->redistributeBackward(v, │ │ │ │ +levelContext.lhs.getRedistributed()); │ │ │ │ +675 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ +676 }else{ │ │ │ │ +677 levelContext.pinfo->copyOwnerToAll(b, b); │ │ │ │ +678 solver_->apply(v, const_cast(b), res); │ │ │ │ +679 } │ │ │ │ +680 │ │ │ │ +681 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10); │ │ │ │ +682 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10); │ │ │ │ +683 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ +684 coarsesolverconverged = false; │ │ │ │ +685 }else{ │ │ │ │ +686 // presmoothing │ │ │ │ +687 _p_r_e_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ +688 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10); │ │ │ │ +689 // printvector(std::cout, *residual, "post presmooth residual", "r", 10); │ │ │ │ +690#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ +691 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ +692 │ │ │ │ +693 if(processNextLevel) { │ │ │ │ +694 // next level │ │ │ │ +695 for(std::size_t i=0; imatrices().finest()) { │ │ │ │ +705 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ +>communicator().prod(coarsesolverconverged); │ │ │ │ +706 if(!coarsesolverconverged) │ │ │ │ +707 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ +708 } │ │ │ │ +709 │ │ │ │ +710 _p_o_s_t_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ +711 } │ │ │ │ +712 } │ │ │ │ +713 │ │ │ │ +714 │ │ │ │ +716 template │ │ │ │ +_7_1_7 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_p_o_s_t([[maybe_unused]] _D_o_m_a_i_n& x) │ │ │ │ +718 { │ │ │ │ +719 lhs_=nullptr; │ │ │ │ +720 rhs_=nullptr; │ │ │ │ +721 residual_=nullptr; │ │ │ │ +722 } │ │ │ │ +723 │ │ │ │ +724 template │ │ │ │ +725 template │ │ │ │ +_7_2_6 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont) │ │ │ │ +727 { │ │ │ │ +728 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ +729 } │ │ │ │ +730 │ │ │ │ +731 } // end namespace Amg │ │ │ │ +732} // end namespace Dune │ │ │ │ +733 │ │ │ │ +734#endif │ │ │ │ +_t_r_a_n_s_f_e_r_._h_h │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ +_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h │ │ │ │ +Provides a classes representing the hierarchies in AMG. │ │ │ │ +_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h │ │ │ │ +_s_m_o_o_t_h_e_r_._h_h │ │ │ │ +Classes for the generic construction and application of the smoothers. │ │ │ │ +_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ +Define base class for scalar product and norm. │ │ │ │ +_u_m_f_p_a_c_k_._h_h │ │ │ │ +Classes for using UMFPack with ISTL matrices. │ │ │ │ _p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ Define general preconditioner interface. │ │ │ │ -_a_m_g_._h_h │ │ │ │ -The AMG preconditioner. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_a_p_p_l_y │ │ │ │ -void apply(Domain &v, const Range &d) │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:300 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ -X Domain │ │ │ │ -The domain type. │ │ │ │ -DDeeffiinniittiioonn amg.hh:87 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_K_A_M_G │ │ │ │ -KAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const │ │ │ │ -SmootherArgs &smootherArgs, const Parameters &parms, std::size_t │ │ │ │ -maxLevelKrylovSteps=3, double minDefectReduction=1e-1) │ │ │ │ -Construct a new amg with a specific coarse solver. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:233 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ -std::size_t maxlevels() │ │ │ │ -DDeeffiinniittiioonn kamg.hh:320 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ -The argument type for the construction of the smoother. │ │ │ │ -DDeeffiinniittiioonn amg.hh:100 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ -M Operator │ │ │ │ -The matrix operator type. │ │ │ │ -DDeeffiinniittiioonn amg.hh:73 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_o_s_t │ │ │ │ -void post(Domain &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:293 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ -X Range │ │ │ │ -The range type. │ │ │ │ -DDeeffiinniittiioonn amg.hh:89 │ │ │ │ +_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ +_s_o_l_v_e_r_s_._h_h │ │ │ │ +Implementations of the inverse operator interface. │ │ │ │ +_s_u_p_e_r_l_u_._h_h │ │ │ │ +Classes for using SuperLU with ISTL matrices. │ │ │ │ +_i_o_._h_h │ │ │ │ +Some generic functions for pretty printing vectors and matrices. │ │ │ │ +_c_o_l │ │ │ │ +Col col │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ +_m_a_t │ │ │ │ +Matrix & mat │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h │ │ │ │ void presmooth(LevelContext &levelContext, size_t steps) │ │ │ │ Apply pre smoothing on the current level. │ │ │ │ DDeeffiinniittiioonn smoother.hh:406 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +const void * Arguments │ │ │ │ +A type holding all the arguments needed to call the constructor. │ │ │ │ +DDeeffiinniittiioonn construction.hh:44 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ Apply post smoothing on the current level. │ │ │ │ DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_r_e │ │ │ │ -void pre(Domain &x, Range &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:253 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ +int iterations │ │ │ │ +The number of iterations to perform. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:47 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ +OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ +The iterator over the matrices. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:207 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s │ │ │ │ +void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont) │ │ │ │ +Get the aggregate number of each unknown on the coarsest level. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:726 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_p_i_n_f_o │ │ │ │ +ParallelInformationHierarchy::Iterator pinfo │ │ │ │ +The iterator over the parallel information. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:211 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y │ │ │ │ +void recalculateHierarchy() │ │ │ │ +Recalculate the matrix hierarchy. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:173 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_p_o_s_t │ │ │ │ +void post(Domain &x) │ │ │ │ +Clean up. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:717 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ +std::size_t maxlevels() │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:503 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ +X Domain │ │ │ │ +The domain type. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:77 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_s_i_d_u_a_l │ │ │ │ +Hierarchy< Domain, A >::Iterator residual │ │ │ │ +The iterator over the residuals. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:227 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ virtual SolverCategory::Category category() const │ │ │ │ Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn amg.hh:194 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:146 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ +MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ +The operator hierarchy type. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:72 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ +OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ +The iterator over the redistribution information. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:215 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_R_a_n_g_e │ │ │ │ +X Range │ │ │ │ +The range type. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:79 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ PI ParallelInformation │ │ │ │ The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ another type describing the... │ │ │ │ -DDeeffiinniittiioonn amg.hh:80 │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:70 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ +M Operator │ │ │ │ +The matrix operator type. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:63 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:498 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_F_a_s_t_A_M_G │ │ │ │ +FastAMG(const Operator &fineOperator, const C &criterion, const Parameters │ │ │ │ +&parms=Parameters(), bool symmetric=true, const ParallelInformation │ │ │ │ +&pinfo=ParallelInformation()) │ │ │ │ +Construct an AMG with an inexact coarse solver based on the smoother. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:125 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ +InverseOperator< X, X > CoarseSolver │ │ │ │ +the type of the coarse solver. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:81 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r │ │ │ │ +bool usesDirectCoarseLevelSolver() const │ │ │ │ +Check whether the coarse solver used is a direct solver. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:654 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_h_s │ │ │ │ +Hierarchy< Domain, A >::Iterator lhs │ │ │ │ +The iterator over the left hand side. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:223 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_h_s │ │ │ │ +Hierarchy< Range, A >::Iterator rhs │ │ │ │ +The iterator over the right hand sided. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:231 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_e_v_e_l │ │ │ │ +std::size_t level │ │ │ │ +The level index. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:235 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_a_p_p_l_y │ │ │ │ +void apply(Domain &v, const Range &d) │ │ │ │ +Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:510 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ +OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ +The parallal data distribution hierarchy type. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:74 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_p_r_e │ │ │ │ +void pre(Domain &x, Range &b) │ │ │ │ +Prepare the preconditioner. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:449 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_F_a_s_t_A_M_G │ │ │ │ +FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const │ │ │ │ +Parameters &parms, bool symmetric=true) │ │ │ │ +Construct a new amg with a specific coarse solver. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:320 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_a_g_g_r_e_g_a_t_e_s │ │ │ │ +OperatorHierarchy::AggregatesMapList::const_iterator aggregates │ │ │ │ +The iterator over the aggregates maps. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:219 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G │ │ │ │ -an algebraic multigrid method using a Krylov-cycle. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:140 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ -Amg::Domain Domain │ │ │ │ -the type of the domain. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:157 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -Amg::SmootherArgs SmootherArgs │ │ │ │ -The type of the arguments for construction of the smoothers. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:153 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -Amg::ParallelInformation ParallelInformation │ │ │ │ -the type of the parallelinformation to use. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:151 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ -Amg::CoarseSolver CoarseSolver │ │ │ │ -The type of the coarse solver. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:149 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ -Amg::OperatorHierarchy OperatorHierarchy │ │ │ │ -The type of the hierarchy of operators. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:147 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_R_a_n_g_e │ │ │ │ -Amg::Range Range │ │ │ │ -The type of the range. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:159 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Amg::ScalarProduct ScalarProduct │ │ │ │ -The type of the scalar product. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:163 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_A_m_g │ │ │ │ -AMG< M, X, S, PI, A > Amg │ │ │ │ -The type of the underlying AMG. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:143 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ -Amg::Operator Operator │ │ │ │ -the type of the lineatr operator. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:155 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ -Amg::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ -The type of the hierarchy of parallel information. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:161 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn kamg.hh:166 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_K_r_y_l_o_v_S_o_l_v_e_r │ │ │ │ -K KrylovSolver │ │ │ │ -The type of the Krylov solver for the cycle. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:145 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ -Two grid operator for AMG with Krylov cycle. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:33 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_p_r_e │ │ │ │ -void pre(typename AMG::Domain &x, typename AMG::Range &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:58 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ -KAmgTwoGrid(AMG &amg, std::shared_ptr< InverseOperator< Domain, Range > > │ │ │ │ -coarseSolver) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:53 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_~_K_A_m_g_T_w_o_G_r_i_d │ │ │ │ -~KAmgTwoGrid() │ │ │ │ -Destructor. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:110 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_p_o_s_t │ │ │ │ -void post(typename AMG::Domain &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:62 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn kamg.hh:41 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_s_e_t_L_e_v_e_l_C_o_n_t_e_x_t │ │ │ │ -void setLevelContext(std::shared_ptr< typename AMG::LevelContext > p) │ │ │ │ -Set the level context pointer. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:104 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_c_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ -InverseOperator< Domain, Range > * coarseSolver() │ │ │ │ -Get a pointer to the coarse grid solver. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:95 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_m_g_T_w_o_G_r_i_d_:_:_a_p_p_l_y │ │ │ │ -void apply(typename AMG::Domain &v, const typename AMG::Range &d) │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -DDeeffiinniittiioonn kamg.hh:66 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G │ │ │ │ -Parallel algebraic multigrid based on agglomeration. │ │ │ │ -DDeeffiinniittiioonn amg.hh:65 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ +ConstIterator class for sequential access. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ +Export the type representing the underlying field. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ +row_type::const_iterator ConstColIterator │ │ │ │ +Const iterator for the entries of each row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ +T block_type │ │ │ │ +Export the type representing the components. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G │ │ │ │ +A fast (sequential) algebraic multigrid based on agglomeration that saves │ │ │ │ +memory bandwidth. │ │ │ │ +DDeeffiinniittiioonn fastamg.hh:60 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ +static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ +DDeeffiinniittiioonn fastamgsmoother.hh:19 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ > Iterator │ │ │ │ Type of the mutable iterator. │ │ │ │ DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ +Iterator over the levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ The hierarchies build by the coarsening process. │ │ │ │ DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ All parameters for AMG. │ │ │ │ DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +The default class for the smoother arguments. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ Base class for matrix free definition of preconditioners. │ │ │ │ DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ +_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ +Sequential SSOR preconditioner. │ │ │ │ +DDeeffiinniittiioonn preconditioners.hh:142 │ │ │ │ _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ Base class for scalar product and norm computation. │ │ │ │ DDeeffiinniittiioonn scalarproducts.hh:52 │ │ │ │ _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ Statistics about the application of an inverse operator. │ │ │ │ DDeeffiinniittiioonn solver.hh:50 │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ +bool converged │ │ │ │ +True if convergence criterion has been met. │ │ │ │ +DDeeffiinniittiioonn solver.hh:75 │ │ │ │ _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ Abstract base class for all solvers. │ │ │ │ DDeeffiinniittiioonn solver.hh:101 │ │ │ │ _D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ Category │ │ │ │ DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_G_e_n_e_r_a_l_i_z_e_d_P_C_G_S_o_l_v_e_r │ │ │ │ -Generalized preconditioned conjugate gradient solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1307 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ +@ sequential │ │ │ │ +Category for sequential solvers. │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: indicescoarsener.hh File Reference │ │ │ +dune-istl: smoother.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,51 +71,119 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Functions
│ │ │ + │ │ │ │ │ │
│ │ │ │ │ │ -

Provides a class for building the index set and remote indices on the coarse level. │ │ │ +

Classes for the generic construction and application of the smoothers. │ │ │ More...

│ │ │ -
#include <dune/common/parallel/indicessyncer.hh>
│ │ │ -#include <vector>
│ │ │ -#include "renumberer.hh"
│ │ │ -#include <dune/istl/owneroverlapcopy.hh>
│ │ │ -#include "pinfo.hh"
│ │ │ +
#include <dune/istl/paamg/construction.hh>
│ │ │ +#include <dune/istl/paamg/aggregates.hh>
│ │ │ +#include <dune/istl/preconditioners.hh>
│ │ │ +#include <dune/istl/schwarz.hh>
│ │ │ +#include <dune/istl/novlpschwarz.hh>
│ │ │ +#include <dune/common/propertymap.hh>
│ │ │ +#include <dune/common/ftraits.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::IndicesCoarsener< T, E >
struct  Dune::Amg::DefaultSmootherArgs< T >
 The default class for the smoother arguments. More...
 
class  Dune::Amg::ParallelIndicesCoarsener< T, E >
struct  Dune::Amg::SmootherTraits< T >
 Traits class for getting the attribute class of a smoother. More...
 
class  Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E >
 Coarsen Indices in the parallel case. More...
struct  Dune::Amg::SmootherTraits< Richardson< X, Y > >
 
class  Dune::Amg::IndicesCoarsener< SequentialInformation, E >
 Coarsen Indices in the sequential case. More...
struct  Dune::Amg::SmootherTraits< BlockPreconditioner< X, Y, C, T > >
 
struct  Dune::Amg::SmootherTraits< NonoverlappingBlockPreconditioner< C, T > >
 
class  Dune::Amg::DefaultConstructionArgs< T >
 Construction Arguments for the default smoothers. More...
 
struct  Dune::Amg::ConstructionArgs< T >
 
class  Dune::Amg::DefaultParallelConstructionArgs< T, C >
 
class  Dune::Amg::DefaultConstructionArgs< Richardson< X, Y > >
 
struct  Dune::Amg::ConstructionTraits< SeqSSOR< M, X, Y, l > >
 Policy for the construction of the SeqSSOR smoother. More...
 
struct  Dune::Amg::ConstructionTraits< SeqSOR< M, X, Y, l > >
 Policy for the construction of the SeqSOR smoother. More...
 
struct  Dune::Amg::ConstructionTraits< SeqJac< M, X, Y, l > >
 Policy for the construction of the SeqJac smoother. More...
 
struct  Dune::Amg::ConstructionTraits< Richardson< X, Y > >
 Policy for the construction of the Richardson smoother. More...
 
class  Dune::Amg::ConstructionArgs< SeqILU< M, X, Y > >
 
struct  Dune::Amg::ConstructionTraits< SeqILU< M, X, Y > >
 Policy for the construction of the SeqILU smoother. More...
 
struct  Dune::Amg::ConstructionTraits< ParSSOR< M, X, Y, C > >
 Policy for the construction of the ParSSOR smoother. More...
 
struct  Dune::Amg::ConstructionTraits< BlockPreconditioner< X, Y, C, T > >
 
struct  Dune::Amg::ConstructionTraits< NonoverlappingBlockPreconditioner< C, T > >
 
struct  Dune::Amg::SmootherApplier< T >
 Helper class for applying the smoothers. More...
 
struct  Dune::Amg::SmootherApplier< SeqSOR< M, X, Y, l > >
 
struct  Dune::Amg::SmootherApplier< BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > >
 
struct  Dune::Amg::SmootherApplier< NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > >
 
struct  Dune::Amg::SmootherApplier< SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > >
 
struct  Dune::Amg::SeqOverlappingSchwarzSmootherArgs< T >
 
struct  Dune::Amg::SmootherTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > >
 
class  Dune::Amg::ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > >
 
struct  Dune::Amg::ConstructionTraits< SeqOverlappingSchwarz< M, X, TM, TS, TA > >
 
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<typename LevelContext >
void Dune::Amg::presmooth (LevelContext &levelContext, size_t steps)
 Apply pre smoothing on the current level.
 
template<typename LevelContext >
void Dune::Amg::postsmooth (LevelContext &levelContext, size_t steps)
 Apply post smoothing on the current level.
 
│ │ │

Detailed Description

│ │ │ -

Provides a class for building the index set and remote indices on the coarse level.

│ │ │ +

Classes for the generic construction and application of the smoothers.

│ │ │
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,42 +1,111 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -indicescoarsener.hh File Reference │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +smoother.hh File Reference │ │ │ │ _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ » _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides a class for building the index set and remote indices on the coarse │ │ │ │ -level. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ -#include "_p_i_n_f_o_._h_h" │ │ │ │ +Classes for the generic construction and application of the smoothers. _M_o_r_e_._._. │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _T_,_ _E_ _> │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_<_ _T_ _> │ │ │ │ +  The default class for the smoother arguments. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _T_,_ _E_ _> │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _T_ _> │ │ │ │ +  Traits class for getting the attribute class of a smoother. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _G_,_ _L_ _>_,_ _E_ _> │ │ │ │ -  Coarsen Indices in the parallel case. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _>_ _> │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_,_ _E_ _> │ │ │ │ -  Coarsen Indices in the sequential case. _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _T_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _C_,_ _T_ _>_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _T_ _> │ │ │ │ +  Construction Arguments for the default smoothers. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _T_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _T_,_ _C_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ +  Policy for the construction of the _S_e_q_S_S_O_R smoother. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ +  Policy for the construction of the _S_e_q_S_O_R smoother. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_J_a_c_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ +  Policy for the construction of the _S_e_q_J_a_c smoother. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _R_i_c_h_a_r_d_s_o_n_<_ _X_,_ _Y_ _>_ _> │ │ │ │ +  Policy for the construction of the _R_i_c_h_a_r_d_s_o_n smoother. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _S_e_q_I_L_U_<_ _M_,_ _X_,_ _Y_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_I_L_U_<_ _M_,_ _X_,_ _Y_ _>_ _> │ │ │ │ +  Policy for the construction of the _S_e_q_I_L_U smoother. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _P_a_r_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _C_ _>_ _> │ │ │ │ +  Policy for the construction of the _P_a_r_S_S_O_R smoother. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _T_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _C_,_ _T │ │ │ │ + _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _T_ _> │ │ │ │ +  Helper class for applying the smoothers. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_,_ _C_,_ _S_e_q_S_O_R_<_ _M_, │ │ │ │ + _X_,_ _Y_,_ _l_ _>_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _C_, │ │ │ │ + _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_, │ │ │ │ + _M_u_l_t_i_p_l_i_c_a_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_ _M_S_,_ _T_A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_ _T_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_,_ _T_M_,_ _T_S_,_ _T_A_ _>_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_,_ _T_M_,_ _T_S_,_ _T_A_ _> │ │ │ │ + _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_ _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_ _M_,_ _X_,_ _T_M_,_ _T_S_,_ _T_A │ │ │ │ + _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ namespace   _D_u_n_e_:_:_A_m_g │ │ │ │   │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +void  _D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h (LevelContext &levelContext, size_t steps) │ │ │ │ +  Apply pre smoothing on the current level. │ │ │ │ +  │ │ │ │ +template │ │ │ │ +void  _D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h (LevelContext &levelContext, size_t steps) │ │ │ │ +  Apply post smoothing on the current level. │ │ │ │ +  │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides a class for building the index set and remote indices on the coarse │ │ │ │ -level. │ │ │ │ +Classes for the generic construction and application of the smoothers. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: indicescoarsener.hh Source File │ │ │ +dune-istl: smoother.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,442 +74,1126 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
indicescoarsener.hh
│ │ │ +
smoother.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_INDICESCOARSENER_HH
│ │ │ -
6#define DUNE_AMG_INDICESCOARSENER_HH
│ │ │ +
5#ifndef DUNE_AMGSMOOTHER_HH
│ │ │ +
6#define DUNE_AMGSMOOTHER_HH
│ │ │
7
│ │ │ -
8#include <dune/common/parallel/indicessyncer.hh>
│ │ │ -
9#include <vector>
│ │ │ -
10#include "renumberer.hh"
│ │ │ -
11
│ │ │ -
12#if HAVE_MPI
│ │ │ - │ │ │ -
14#endif
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
11#include <dune/istl/schwarz.hh>
│ │ │ + │ │ │ +
13#include <dune/common/propertymap.hh>
│ │ │ +
14#include <dune/common/ftraits.hh>
│ │ │
15
│ │ │ -
16#include "pinfo.hh"
│ │ │ -
17
│ │ │ -
18namespace Dune
│ │ │ -
19{
│ │ │ -
20 namespace Amg
│ │ │ -
21 {
│ │ │ -
22
│ │ │ -
34 template<typename T, typename E>
│ │ │ -
│ │ │ - │ │ │ -
36 {};
│ │ │ -
│ │ │ -
37
│ │ │ -
38
│ │ │ -
39#if HAVE_MPI
│ │ │ -
40
│ │ │ -
41 template<typename T, typename E>
│ │ │ -
│ │ │ - │ │ │ -
43 {
│ │ │ -
44 public:
│ │ │ - │ │ │ -
49
│ │ │ - │ │ │ -
54
│ │ │ -
55 typedef typename ParallelInformation::ParallelIndexSet ParallelIndexSet;
│ │ │ -
56
│ │ │ -
60 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ -
61
│ │ │ -
65 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ -
66
│ │ │ -
70 typedef typename LocalIndex::Attribute Attribute;
│ │ │ -
71
│ │ │ -
75 typedef Dune::RemoteIndices<ParallelIndexSet> RemoteIndices;
│ │ │ -
76
│ │ │ -
92 template<typename Graph, typename VM>
│ │ │ -
93 static typename Graph::VertexDescriptor
│ │ │ -
│ │ │ - │ │ │ -
95 Graph& fineGraph,
│ │ │ -
96 VM& visitedMap,
│ │ │ - │ │ │ -
98 ParallelInformation& coarseInfo,
│ │ │ -
99 typename Graph::VertexDescriptor noAggregates,
│ │ │ -
100 bool useFixedOrder = false);
│ │ │ -
101
│ │ │ -
102 private:
│ │ │ -
103 template<typename G, typename I>
│ │ │ -
104 class ParallelAggregateRenumberer : public AggregateRenumberer<G>
│ │ │ +
16namespace Dune
│ │ │ +
17{
│ │ │ +
18 namespace Amg
│ │ │ +
19 {
│ │ │ +
20
│ │ │ +
36 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
38 {
│ │ │ +
42 typedef typename FieldTraits<T>::real_type RelaxationFactor;
│ │ │ +
43
│ │ │ + │ │ │ + │ │ │ +
52
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
58 {}
│ │ │ +
│ │ │ +
59 };
│ │ │ +
│ │ │ +
60
│ │ │ +
64 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
66 {
│ │ │ + │ │ │ +
68
│ │ │ +
69 };
│ │ │ +
│ │ │ +
70
│ │ │ +
71 template<class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
73 {
│ │ │ + │ │ │ +
75
│ │ │ +
76 };
│ │ │ +
│ │ │ +
77
│ │ │ +
78 template<class X, class Y, class C, class T>
│ │ │ +
│ │ │ + │ │ │ +
80 : public SmootherTraits<T>
│ │ │ +
81 {};
│ │ │ +
│ │ │ +
82
│ │ │ +
83 template<class C, class T>
│ │ │ +
│ │ │ + │ │ │ +
85 : public SmootherTraits<T>
│ │ │ +
86 {};
│ │ │ +
│ │ │ +
87
│ │ │ +
91 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
93 {
│ │ │ +
94 typedef typename T::matrix_type Matrix;
│ │ │ +
95
│ │ │ + │ │ │ +
97
│ │ │ + │ │ │ +
99
│ │ │ +
100 public:
│ │ │ +
│ │ │ + │ │ │ +
102 {}
│ │ │ +
│ │ │ +
103
│ │ │ +
│ │ │ +
104 void setMatrix(const Matrix& matrix)
│ │ │
105 {
│ │ │ -
106 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
107
│ │ │ -
108 typedef I GlobalLookupIndexSet;
│ │ │ -
109
│ │ │ -
110 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ -
111
│ │ │ -
112 typedef typename IndexPair::GlobalIndex GlobalIndex;
│ │ │ -
113
│ │ │ -
114 public:
│ │ │ -
│ │ │ - │ │ │ -
116 : AggregateRenumberer<G>(aggregates), isPublic_(false), lookup_(lookup),
│ │ │ -
117 globalIndex_(std::numeric_limits<GlobalIndex>::max())
│ │ │ -
118 {}
│ │ │ -
│ │ │ -
119
│ │ │ -
120
│ │ │ -
│ │ │ -
121 void operator()(const typename G::ConstEdgeIterator& edge)
│ │ │ -
122 {
│ │ │ - │ │ │ -
124 const IndexPair* pair= lookup_.pair(edge.target());
│ │ │ -
125 if(pair!=0) {
│ │ │ -
126 globalIndex(pair->global());
│ │ │ -
127 attribute(pair->local().attribute());
│ │ │ -
128 isPublic(pair->local().isPublic());
│ │ │ -
129 }
│ │ │ -
130 }
│ │ │ -
│ │ │ -
131
│ │ │ -
│ │ │ -
132 Vertex operator()([[maybe_unused]] const GlobalIndex& global)
│ │ │ -
133 {
│ │ │ -
134 Vertex current = this->number_;
│ │ │ -
135 this->operator++();
│ │ │ -
136 return current;
│ │ │ -
137 }
│ │ │ -
│ │ │ -
138
│ │ │ -
│ │ │ -
139 bool isPublic()
│ │ │ -
140 {
│ │ │ -
141 return isPublic_;
│ │ │ -
142 }
│ │ │ -
│ │ │ -
143
│ │ │ -
│ │ │ -
144 void isPublic(bool b)
│ │ │ -
145 {
│ │ │ -
146 isPublic_ = isPublic_ || b;
│ │ │ -
147 }
│ │ │ -
│ │ │ -
148
│ │ │ -
│ │ │ -
149 void reset()
│ │ │ -
150 {
│ │ │ -
151 globalIndex_ = std::numeric_limits<GlobalIndex>::max();
│ │ │ -
152 isPublic_=false;
│ │ │ -
153 }
│ │ │ +
106 matrix_=&matrix;
│ │ │ +
107 }
│ │ │ +
│ │ │ +
│ │ │ +
108 virtual void setMatrix(const Matrix& matrix, [[maybe_unused]] const AggregatesMap& amap)
│ │ │ +
109 {
│ │ │ +
110 setMatrix(matrix);
│ │ │ +
111 }
│ │ │
│ │ │ -
154
│ │ │ +
112
│ │ │ +
113
│ │ │ +
│ │ │ +
114 const Matrix& getMatrix() const
│ │ │ +
115 {
│ │ │ +
116 return *matrix_;
│ │ │ +
117 }
│ │ │ +
│ │ │ +
118
│ │ │ +
│ │ │ +
119 void setArgs(const SmootherArgs& args)
│ │ │ +
120 {
│ │ │ +
121 args_=&args;
│ │ │ +
122 }
│ │ │ +
│ │ │ +
123
│ │ │ +
124 template<class T1>
│ │ │ +
│ │ │ +
125 void setComm([[maybe_unused]] T1& comm)
│ │ │ +
126 {}
│ │ │ +
│ │ │ +
127
│ │ │ +
│ │ │ + │ │ │ +
129 {
│ │ │ +
130 return comm_;
│ │ │ +
131 }
│ │ │ +
│ │ │ +
132
│ │ │ +
│ │ │ +
133 const SmootherArgs getArgs() const
│ │ │ +
134 {
│ │ │ +
135 return *args_;
│ │ │ +
136 }
│ │ │ +
│ │ │ +
137
│ │ │ +
138 protected:
│ │ │ +
139 const Matrix* matrix_;
│ │ │ +
140 private:
│ │ │ +
141 const SmootherArgs* args_;
│ │ │ + │ │ │ +
143 };
│ │ │ +
│ │ │ +
144
│ │ │ +
145 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
147 : public DefaultConstructionArgs<T>
│ │ │ +
148 {};
│ │ │ +
│ │ │ +
149
│ │ │ +
150 template<class T, class C=SequentialInformation>
│ │ │ +
│ │ │ + │ │ │ +
152 : public ConstructionArgs<T>
│ │ │ +
153 {
│ │ │ +
154 public:
│ │ │
│ │ │ - │ │ │ -
156 {
│ │ │ -
157 attribute_=attribute;
│ │ │ -
158 }
│ │ │ -
│ │ │ -
159
│ │ │ -
│ │ │ - │ │ │ -
161 {
│ │ │ -
162 return attribute_;
│ │ │ -
163 }
│ │ │ -
│ │ │ -
164
│ │ │ -
│ │ │ -
165 const GlobalIndex& globalIndex() const
│ │ │ -
166 {
│ │ │ -
167 return globalIndex_;
│ │ │ -
168 }
│ │ │ -
│ │ │ -
169
│ │ │ -
│ │ │ -
170 void globalIndex(const GlobalIndex& global)
│ │ │ -
171 {
│ │ │ -
172 globalIndex_ = global;
│ │ │ -
173 }
│ │ │ -
│ │ │ -
174
│ │ │ -
175 private:
│ │ │ -
176 bool isPublic_;
│ │ │ -
177 Attribute attribute_;
│ │ │ -
178 const GlobalLookupIndexSet& lookup_;
│ │ │ -
179 GlobalIndex globalIndex_;
│ │ │ -
180 };
│ │ │ -
181
│ │ │ -
182 template<typename Graph, typename VM, typename I>
│ │ │ -
183 static void buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ -
184 Graph& fineGraph,
│ │ │ -
185 VM& visitedMap,
│ │ │ - │ │ │ -
187 ParallelIndexSet& coarseIndices,
│ │ │ -
188 ParallelAggregateRenumberer<Graph,I>& renumberer);
│ │ │ -
189
│ │ │ -
190 template<typename Graph,typename I>
│ │ │ -
191 static void buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ - │ │ │ -
193 ParallelIndexSet& coarseIndices,
│ │ │ -
194 RemoteIndices& coarseRemote,
│ │ │ -
195 ParallelAggregateRenumberer<Graph,I>& renumberer,
│ │ │ -
196 bool useFixedOrder);
│ │ │ -
197
│ │ │ -
198 };
│ │ │ -
199
│ │ │ -
203 template<typename G, typename L, typename E>
│ │ │ -
│ │ │ - │ │ │ -
205 : public ParallelIndicesCoarsener<OwnerOverlapCopyCommunication<G,L>,E>
│ │ │ -
206 {};
│ │ │ -
│ │ │ -
207
│ │ │ -
208
│ │ │ -
209#endif
│ │ │ + │ │ │ +
156 {}
│ │ │ +
│ │ │ +
157
│ │ │ +
│ │ │ +
158 void setComm(const C& comm)
│ │ │ +
159 {
│ │ │ +
160 comm_ = &comm;
│ │ │ +
161 }
│ │ │ +
│ │ │ +
162
│ │ │ +
│ │ │ +
163 const C& getComm() const
│ │ │ +
164 {
│ │ │ +
165 return *comm_;
│ │ │ +
166 }
│ │ │ +
│ │ │ +
167 private:
│ │ │ +
168 const C* comm_;
│ │ │ +
169 };
│ │ │ +
│ │ │ +
170
│ │ │ +
171
│ │ │ +
172 template<class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
174 {
│ │ │ +
175 typedef Richardson<X,Y> T;
│ │ │ +
176
│ │ │ + │ │ │ +
178
│ │ │ +
179 public:
│ │ │ +
│ │ │ + │ │ │ +
181 {}
│ │ │ +
│ │ │ +
182
│ │ │ +
183 template <class... Args>
│ │ │ +
│ │ │ +
184 void setMatrix(const Args&...)
│ │ │ +
185 {}
│ │ │ +
│ │ │ +
186
│ │ │ +
│ │ │ +
187 void setArgs(const SmootherArgs& args)
│ │ │ +
188 {
│ │ │ +
189 args_=&args;
│ │ │ +
190 }
│ │ │ +
│ │ │ +
191
│ │ │ +
192 template<class T1>
│ │ │ +
│ │ │ +
193 void setComm([[maybe_unused]] T1& comm)
│ │ │ +
194 {}
│ │ │ +
│ │ │ +
195
│ │ │ +
│ │ │ + │ │ │ +
197 {
│ │ │ +
198 return comm_;
│ │ │ +
199 }
│ │ │ +
│ │ │ +
200
│ │ │ +
│ │ │ +
201 const SmootherArgs getArgs() const
│ │ │ +
202 {
│ │ │ +
203 return *args_;
│ │ │ +
204 }
│ │ │ +
│ │ │ +
205
│ │ │ +
206 private:
│ │ │ +
207 const SmootherArgs* args_;
│ │ │ + │ │ │ +
209 };
│ │ │ +
│ │ │
210
│ │ │ -
217 template<typename E>
│ │ │ -
│ │ │ - │ │ │ -
219 {
│ │ │ -
220 public:
│ │ │ -
221 template<typename Graph, typename VM>
│ │ │ -
222 static typename Graph::VertexDescriptor
│ │ │ -
223 coarsen(const SequentialInformation & fineInfo,
│ │ │ -
224 Graph& fineGraph,
│ │ │ -
225 VM& visitedMap,
│ │ │ - │ │ │ -
227 SequentialInformation& coarseInfo,
│ │ │ -
228 typename Graph::VertexDescriptor noAggregates,
│ │ │ -
229 bool useFixedOrder = false);
│ │ │ -
230 };
│ │ │ +
211
│ │ │ +
212
│ │ │ +
213 template<class T>
│ │ │ +
214 struct ConstructionTraits;
│ │ │ +
215
│ │ │ +
219 template<class M, class X, class Y, int l>
│ │ │ +
│ │ │ +
220 struct ConstructionTraits<SeqSSOR<M,X,Y,l> >
│ │ │ +
221 {
│ │ │ + │ │ │ +
223
│ │ │ +
│ │ │ +
224 static inline std::shared_ptr<SeqSSOR<M,X,Y,l>> construct(Arguments& args)
│ │ │ +
225 {
│ │ │ +
226 return std::make_shared<SeqSSOR<M,X,Y,l>>
│ │ │ +
227 (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
│ │ │ +
228 }
│ │ │
│ │ │ +
229 };
│ │ │ +
│ │ │ +
230
│ │ │
231
│ │ │ -
232#if HAVE_MPI
│ │ │ -
233 template<typename T, typename E>
│ │ │ -
234 template<typename Graph, typename VM>
│ │ │ -
235 inline typename Graph::VertexDescriptor
│ │ │ -
│ │ │ - │ │ │ -
237 Graph& fineGraph,
│ │ │ -
238 VM& visitedMap,
│ │ │ - │ │ │ -
240 ParallelInformation& coarseInfo,
│ │ │ -
241 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates,
│ │ │ -
242 bool useFixedOrder)
│ │ │ -
243 {
│ │ │ -
244 ParallelAggregateRenumberer<Graph,typename ParallelInformation::GlobalLookupIndexSet> renumberer(aggregates, fineInfo.globalLookup());
│ │ │ -
245 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates,
│ │ │ -
246 coarseInfo.indexSet(), renumberer);
│ │ │ -
247 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, coarseInfo.indexSet(),
│ │ │ -
248 coarseInfo.remoteIndices(), renumberer, useFixedOrder);
│ │ │ -
249
│ │ │ -
250 return renumberer;
│ │ │ -
251 }
│ │ │ -
│ │ │ -
│ │ │ -
252
│ │ │ -
253 template<typename T, typename E>
│ │ │ -
254 template<typename Graph, typename VM, typename I>
│ │ │ -
255 void ParallelIndicesCoarsener<T,E>::buildCoarseIndexSet(const ParallelInformation& pinfo,
│ │ │ -
256 Graph& fineGraph,
│ │ │ -
257 VM& visitedMap,
│ │ │ - │ │ │ -
259 ParallelIndexSet& coarseIndices,
│ │ │ -
260 ParallelAggregateRenumberer<Graph,I>& renumberer)
│ │ │ -
261 {
│ │ │ -
262 // fineGraph is the local subgraph corresponding to the vertices the process owns.
│ │ │ -
263 // i.e. no overlap/copy vertices can be visited traversing the graph
│ │ │ -
264 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ -
265 typedef typename ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet;
│ │ │ -
266
│ │ │ -
267 Iterator end = fineGraph.end();
│ │ │ -
268 const GlobalLookupIndexSet& lookup = pinfo.globalLookup();
│ │ │ -
269
│ │ │ -
270 coarseIndices.beginResize();
│ │ │ -
271
│ │ │ -
272 // Setup the coarse index set and renumber the aggregate consecutively
│ │ │ -
273 // ascending from zero according to the minimum global index belonging
│ │ │ -
274 // to the aggregate
│ │ │ -
275 for(Iterator index = fineGraph.begin(); index != end; ++index) {
│ │ │ - │ │ │ -
277 // Isolated vertices will not be represented on the next level.
│ │ │ -
278 // These should only be there if skipIsolated is activiated in
│ │ │ -
279 // the coarsening criterion as otherwise they will be aggregated
│ │ │ -
280 // and should have real aggregate number in the map right now.
│ │ │ -
281 if(!get(visitedMap, *index)) {
│ │ │ -
282 // This vertex was not visited by breadthFirstSearch yet.
│ │ │ -
283 typedef typename GlobalLookupIndexSet::IndexPair IndexPair;
│ │ │ -
284 const IndexPair* pair= lookup.pair(*index);
│ │ │ -
285
│ │ │ -
286 renumberer.reset(); // reset attribute and global index.
│ │ │ -
287 if(pair!=0) {
│ │ │ -
288 // vertex is in the index set. Note that not all vertices have
│ │ │ -
289 // to be in the index set, just the ones where communication
│ │ │ -
290 // will happen.
│ │ │ -
291 assert(!ExcludedAttributes::contains(pair->local().attribute()));
│ │ │ -
292 renumberer.attribute(pair->local().attribute());
│ │ │ -
293 renumberer.isPublic(pair->local().isPublic());
│ │ │ -
294 renumberer.globalIndex(pair->global());
│ │ │ -
295 }
│ │ │ -
296
│ │ │ -
297 // Reconstruct aggregate and mark vertices as visited
│ │ │ -
298 aggregates.template breadthFirstSearch<false>(*index, aggregates[*index],
│ │ │ -
299 fineGraph, renumberer, visitedMap);
│ │ │ -
300
│ │ │ -
301 if(renumberer.globalIndex()!=std::numeric_limits<GlobalIndex>::max()) {
│ │ │ -
302 // vertex is in the index set.
│ │ │ -
303 //std::cout <<" Adding global="<< renumberer.globalIndex()<<" local="<<static_cast<std::size_t>(renumberer)<<std::endl;
│ │ │ -
304 coarseIndices.add(renumberer.globalIndex(),
│ │ │ -
305 LocalIndex(renumberer, renumberer.attribute(),
│ │ │ -
306 renumberer.isPublic()));
│ │ │ -
307 }
│ │ │ -
308
│ │ │ -
309 aggregates[*index] = renumberer;
│ │ │ -
310 ++renumberer;
│ │ │ -
311 }
│ │ │ -
312 }
│ │ │ -
313
│ │ │ -
314 coarseIndices.endResize();
│ │ │ -
315
│ │ │ -
316 assert(static_cast<std::size_t>(renumberer) >= coarseIndices.size());
│ │ │ +
235 template<class M, class X, class Y, int l>
│ │ │ +
│ │ │ +
236 struct ConstructionTraits<SeqSOR<M,X,Y,l> >
│ │ │ +
237 {
│ │ │ + │ │ │ +
239
│ │ │ +
│ │ │ +
240 static inline std::shared_ptr<SeqSOR<M,X,Y,l>> construct(Arguments& args)
│ │ │ +
241 {
│ │ │ +
242 return std::make_shared<SeqSOR<M,X,Y,l>>
│ │ │ +
243 (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
│ │ │ +
244 }
│ │ │ +
│ │ │ +
245 };
│ │ │ +
│ │ │ +
246
│ │ │ +
247
│ │ │ +
251 template<class M, class X, class Y, int l>
│ │ │ +
│ │ │ +
252 struct ConstructionTraits<SeqJac<M,X,Y,l> >
│ │ │ +
253 {
│ │ │ + │ │ │ +
255
│ │ │ +
│ │ │ +
256 static inline std::shared_ptr<SeqJac<M,X,Y,l>> construct(Arguments& args)
│ │ │ +
257 {
│ │ │ +
258 return std::make_shared<SeqJac<M,X,Y,l>>
│ │ │ +
259 (args.getMatrix(), args.getArgs().iterations, args.getArgs().relaxationFactor);
│ │ │ +
260 }
│ │ │ +
│ │ │ +
261 };
│ │ │ +
│ │ │ +
262
│ │ │ +
266 template<class X, class Y>
│ │ │ +
│ │ │ +
267 struct ConstructionTraits<Richardson<X,Y> >
│ │ │ +
268 {
│ │ │ + │ │ │ +
270
│ │ │ +
│ │ │ +
271 static inline std::shared_ptr<Richardson<X,Y>> construct(Arguments& args)
│ │ │ +
272 {
│ │ │ +
273 return std::make_shared<Richardson<X,Y>>
│ │ │ +
274 (args.getArgs().relaxationFactor);
│ │ │ +
275 }
│ │ │ +
│ │ │ +
276 };
│ │ │ +
│ │ │ +
277
│ │ │ +
278
│ │ │ +
279 template<class M, class X, class Y>
│ │ │ +
│ │ │ + │ │ │ +
281 : public DefaultConstructionArgs<SeqILU<M,X,Y> >
│ │ │ +
282 {
│ │ │ +
283 public:
│ │ │ +
│ │ │ + │ │ │ +
285 : n_(n)
│ │ │ +
286 {}
│ │ │ +
│ │ │ +
287
│ │ │ +
│ │ │ +
288 void setN(int n)
│ │ │ +
289 {
│ │ │ +
290 n_ = n;
│ │ │ +
291 }
│ │ │ +
│ │ │ +
292
│ │ │ +
│ │ │ +
293 int getN()
│ │ │ +
294 {
│ │ │ +
295 return n_;
│ │ │ +
296 }
│ │ │ +
│ │ │ +
297
│ │ │ +
298 private:
│ │ │ +
299 int n_;
│ │ │ +
300 };
│ │ │ +
│ │ │ +
301
│ │ │ +
302
│ │ │ +
306 template<class M, class X, class Y>
│ │ │ +
│ │ │ +
307 struct ConstructionTraits<SeqILU<M,X,Y> >
│ │ │ +
308 {
│ │ │ + │ │ │ +
310
│ │ │ +
│ │ │ +
311 static inline std::shared_ptr<SeqILU<M,X,Y>> construct(Arguments& args)
│ │ │ +
312 {
│ │ │ +
313 return std::make_shared<SeqILU<M,X,Y>>
│ │ │ +
314 (args.getMatrix(), args.getN(), args.getArgs().relaxationFactor);
│ │ │ +
315 }
│ │ │ +
│ │ │ +
316 };
│ │ │ +
│ │ │
317
│ │ │ -
318 // Reset the visited flags
│ │ │ -
319 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex)
│ │ │ -
320 put(visitedMap, *vertex, false);
│ │ │ -
321 }
│ │ │ -
322
│ │ │ -
323 template<typename T, typename E>
│ │ │ -
324 template<typename Graph, typename I>
│ │ │ -
325 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ -
326 const AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ -
327 ParallelIndexSet& coarseIndices,
│ │ │ -
328 RemoteIndices& coarseRemote,
│ │ │ -
329 ParallelAggregateRenumberer<Graph,I>& renumberer,
│ │ │ -
330 bool useFixedOrder)
│ │ │ -
331 {
│ │ │ -
332 std::vector<char> attributes(static_cast<std::size_t>(renumberer));
│ │ │ +
321 template<class M, class X, class Y, class C>
│ │ │ +
│ │ │ +
322 struct ConstructionTraits<ParSSOR<M,X,Y,C> >
│ │ │ +
323 {
│ │ │ + │ │ │ +
325
│ │ │ +
│ │ │ +
326 static inline std::shared_ptr<ParSSOR<M,X,Y,C>> construct(Arguments& args)
│ │ │ +
327 {
│ │ │ +
328 return std::make_shared<ParSSOR<M,X,Y,C>>
│ │ │ +
329 (args.getMatrix(), args.getArgs().iterations,
│ │ │ +
330 args.getArgs().relaxationFactor, args.getComm());
│ │ │ +
331 }
│ │ │ +
│ │ │ +
332 };
│ │ │ +
│ │ │
333
│ │ │ -
334 GlobalLookupIndexSet<ParallelIndexSet> coarseLookup(coarseIndices, static_cast<std::size_t>(renumberer));
│ │ │ -
335
│ │ │ -
336 typedef typename RemoteIndices::const_iterator Iterator;
│ │ │ -
337 Iterator end = fineRemote.end();
│ │ │ -
338
│ │ │ -
339 for(Iterator neighbour = fineRemote.begin();
│ │ │ -
340 neighbour != end; ++neighbour) {
│ │ │ -
341 int process = neighbour->first;
│ │ │ -
342
│ │ │ -
343 assert(neighbour->second.first==neighbour->second.second);
│ │ │ -
344
│ │ │ -
345 // Mark all as not known
│ │ │ -
346 typedef typename std::vector<char>::iterator CIterator;
│ │ │ -
347
│ │ │ -
348 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter)
│ │ │ -
349 *iter = std::numeric_limits<char>::max();
│ │ │ -
350
│ │ │ -
351 auto riEnd = neighbour->second.second->end();
│ │ │ -
352
│ │ │ -
353 for(auto index = neighbour->second.second->begin();
│ │ │ -
354 index != riEnd; ++index) {
│ │ │ -
355 if(!E::contains(index->localIndexPair().local().attribute()) &&
│ │ │ -
356 aggregates[index->localIndexPair().local()] !=
│ │ │ - │ │ │ -
358 {
│ │ │ -
359 assert(aggregates[index->localIndexPair().local()]<attributes.size());
│ │ │ -
360 if (attributes[aggregates[index->localIndexPair().local()]] != 3)
│ │ │ -
361 attributes[aggregates[index->localIndexPair().local()]] = index->attribute();
│ │ │ -
362 }
│ │ │ -
363 }
│ │ │ -
364
│ │ │ -
365 // Build remote index list
│ │ │ -
366 typedef RemoteIndexListModifier<ParallelIndexSet,typename RemoteIndices::Allocator,false> Modifier;
│ │ │ -
367 typedef typename RemoteIndices::RemoteIndex RemoteIndex;
│ │ │ -
368 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ -
369
│ │ │ -
370 Modifier coarseList = coarseRemote.template getModifier<false,true>(process);
│ │ │ -
371
│ │ │ -
372 IndexIterator iend = coarseIndices.end();
│ │ │ -
373 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index)
│ │ │ -
374 if(attributes[index->local()] != std::numeric_limits<char>::max()) {
│ │ │ -
375 // remote index is present
│ │ │ -
376 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), &(*index)));
│ │ │ -
377 }
│ │ │ -
378 //std::cout<<coarseRemote<<std::endl;
│ │ │ -
379 }
│ │ │ -
380
│ │ │ -
381 // The number of neighbours should not change!
│ │ │ -
382 assert(coarseRemote.neighbours()==fineRemote.neighbours());
│ │ │ -
383
│ │ │ -
384 // sync the index set and the remote indices to recompute missing
│ │ │ -
385 // indices
│ │ │ -
386 IndicesSyncer<ParallelIndexSet> syncer(coarseIndices, coarseRemote);
│ │ │ -
387 syncer.sync(renumberer, useFixedOrder);
│ │ │ -
388
│ │ │ -
389 }
│ │ │ -
390
│ │ │ -
391#endif
│ │ │ -
392
│ │ │ -
393 template<typename E>
│ │ │ -
394 template<typename Graph, typename VM>
│ │ │ -
395 typename Graph::VertexDescriptor
│ │ │ -
│ │ │ - │ │ │ -
397 [[maybe_unused]] const SequentialInformation& fineInfo,
│ │ │ -
398 [[maybe_unused]] Graph& fineGraph,
│ │ │ -
399 [[maybe_unused]] VM& visitedMap,
│ │ │ -
400 [[maybe_unused]] AggregatesMap<typename Graph::VertexDescriptor>& aggregates,
│ │ │ -
401 [[maybe_unused]] SequentialInformation& coarseInfo,
│ │ │ -
402 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates,
│ │ │ -
403 [[maybe_unused]] bool useFixedOrder)
│ │ │ -
404 {
│ │ │ -
405 return noAggregates;
│ │ │ -
406 }
│ │ │ -
│ │ │ -
407
│ │ │ -
408 } //namespace Amg
│ │ │ -
409} // namespace Dune
│ │ │ -
410#endif
│ │ │ -
│ │ │ - │ │ │ - │ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ - │ │ │ -
LocalIndex::Attribute Attribute
The type of the attribute.
Definition indicescoarsener.hh:70
│ │ │ -
void operator()(const typename G::ConstEdgeIterator &edge)
Definition indicescoarsener.hh:121
│ │ │ -
void isPublic(bool b)
Definition indicescoarsener.hh:144
│ │ │ -
ParallelInformation::ParallelIndexSet ParallelIndexSet
Definition indicescoarsener.hh:55
│ │ │ - │ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
The type of the local index.
Definition indicescoarsener.hh:65
│ │ │ -
T ParallelInformation
The type of the parallel information.
Definition indicescoarsener.hh:53
│ │ │ -
Attribute attribute()
Definition indicescoarsener.hh:160
│ │ │ -
Vertex operator()(const GlobalIndex &global)
Definition indicescoarsener.hh:132
│ │ │ +
334 template<class X, class Y, class C, class T>
│ │ │ +
│ │ │ +
335 struct ConstructionTraits<BlockPreconditioner<X,Y,C,T> >
│ │ │ +
336 {
│ │ │ + │ │ │ +
338 typedef ConstructionTraits<T> SeqConstructionTraits;
│ │ │ +
│ │ │ +
339 static inline std::shared_ptr<BlockPreconditioner<X,Y,C,T>> construct(Arguments& args)
│ │ │ +
340 {
│ │ │ +
341 auto seqPrec = SeqConstructionTraits::construct(args);
│ │ │ +
342 return std::make_shared<BlockPreconditioner<X,Y,C,T>> (seqPrec, args.getComm());
│ │ │ +
343 }
│ │ │ +
│ │ │ +
344 };
│ │ │ +
│ │ │ +
345
│ │ │ +
346 template<class C, class T>
│ │ │ +
│ │ │ +
347 struct ConstructionTraits<NonoverlappingBlockPreconditioner<C,T> >
│ │ │ +
348 {
│ │ │ + │ │ │ +
350 typedef ConstructionTraits<T> SeqConstructionTraits;
│ │ │ +
│ │ │ +
351 static inline std::shared_ptr<NonoverlappingBlockPreconditioner<C,T>> construct(Arguments& args)
│ │ │ +
352 {
│ │ │ +
353 auto seqPrec = SeqConstructionTraits::construct(args);
│ │ │ +
354 return std::make_shared<NonoverlappingBlockPreconditioner<C,T>> (seqPrec, args.getComm());
│ │ │ +
355 }
│ │ │ +
│ │ │ +
356 };
│ │ │ +
│ │ │ +
357
│ │ │ +
368 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
370 {
│ │ │ +
371 typedef T Smoother;
│ │ │ +
372 typedef typename Smoother::range_type Range;
│ │ │ +
373 typedef typename Smoother::domain_type Domain;
│ │ │ +
374
│ │ │ +
│ │ │ +
382 static void preSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ +
383 {
│ │ │ +
384 smoother.apply(v,d);
│ │ │ +
385 }
│ │ │ +
│ │ │ +
386
│ │ │ +
│ │ │ +
394 static void postSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ +
395 {
│ │ │ +
396 smoother.apply(v,d);
│ │ │ +
397 }
│ │ │ +
│ │ │ +
398 };
│ │ │ +
│ │ │ +
399
│ │ │ +
405 template<typename LevelContext>
│ │ │ +
│ │ │ +
406 void presmooth(LevelContext& levelContext, size_t steps)
│ │ │ +
407 {
│ │ │ +
408 for(std::size_t i=0; i < steps; ++i) {
│ │ │ +
409 *levelContext.lhs=0;
│ │ │ + │ │ │ +
411 ::preSmooth(*levelContext.smoother, *levelContext.lhs,
│ │ │ +
412 *levelContext.rhs);
│ │ │ +
413 // Accumulate update
│ │ │ +
414 *levelContext.update += *levelContext.lhs;
│ │ │ +
415
│ │ │ +
416 // update defect
│ │ │ +
417 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, *levelContext.rhs);
│ │ │ +
418 levelContext.pinfo->project(*levelContext.rhs);
│ │ │ +
419 }
│ │ │ +
420 }
│ │ │ +
│ │ │ +
421
│ │ │ +
427 template<typename LevelContext>
│ │ │ +
│ │ │ +
428 void postsmooth(LevelContext& levelContext, size_t steps)
│ │ │ +
429 {
│ │ │ +
430 for(std::size_t i=0; i < steps; ++i) {
│ │ │ +
431 // update defect
│ │ │ +
432 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs,
│ │ │ +
433 *levelContext.rhs);
│ │ │ +
434 *levelContext.lhs=0;
│ │ │ +
435 levelContext.pinfo->project(*levelContext.rhs);
│ │ │ + │ │ │ +
437 ::postSmooth(*levelContext.smoother, *levelContext.lhs, *levelContext.rhs);
│ │ │ +
438 // Accumulate update
│ │ │ +
439 *levelContext.update += *levelContext.lhs;
│ │ │ +
440 }
│ │ │ +
441 }
│ │ │ +
│ │ │ +
442
│ │ │ +
443 template<class M, class X, class Y, int l>
│ │ │ +
│ │ │ +
444 struct SmootherApplier<SeqSOR<M,X,Y,l> >
│ │ │ +
445 {
│ │ │ + │ │ │ +
447 typedef typename Smoother::range_type Range;
│ │ │ + │ │ │ +
449
│ │ │ +
│ │ │ +
450 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ +
451 {
│ │ │ +
452 smoother.template apply<true>(v,d);
│ │ │ +
453 }
│ │ │ +
│ │ │ +
454
│ │ │ +
455
│ │ │ +
│ │ │ +
456 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ +
457 {
│ │ │ +
458 smoother.template apply<false>(v,d);
│ │ │ +
459 }
│ │ │ +
│ │ │ +
460 };
│ │ │ +
│ │ │ +
461
│ │ │ +
462 template<class M, class X, class Y, class C, int l>
│ │ │ +
│ │ │ + │ │ │ +
464 {
│ │ │ + │ │ │ +
466 typedef typename Smoother::range_type Range;
│ │ │ + │ │ │ +
468
│ │ │ +
│ │ │ +
469 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ +
470 {
│ │ │ +
471 smoother.template apply<true>(v,d);
│ │ │ +
472 }
│ │ │ +
│ │ │ +
473
│ │ │ +
474
│ │ │ +
│ │ │ +
475 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ +
476 {
│ │ │ +
477 smoother.template apply<false>(v,d);
│ │ │ +
478 }
│ │ │ +
│ │ │ +
479 };
│ │ │ +
│ │ │ +
480
│ │ │ +
481 template<class M, class X, class Y, class C, int l>
│ │ │ +
│ │ │ + │ │ │ +
483 {
│ │ │ + │ │ │ +
485 typedef typename Smoother::range_type Range;
│ │ │ + │ │ │ +
487
│ │ │ +
│ │ │ +
488 static void preSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ +
489 {
│ │ │ +
490 smoother.template apply<true>(v,d);
│ │ │ +
491 }
│ │ │ +
│ │ │ +
492
│ │ │ +
493
│ │ │ +
│ │ │ +
494 static void postSmooth(Smoother& smoother, Domain& v, Range& d)
│ │ │ +
495 {
│ │ │ +
496 smoother.template apply<false>(v,d);
│ │ │ +
497 }
│ │ │ +
│ │ │ +
498 };
│ │ │ +
│ │ │ +
499
│ │ │ +
500 } // end namespace Amg
│ │ │ +
501
│ │ │ +
502 // forward declarations
│ │ │ +
503 template<class M, class X, class MO, class MS, class A>
│ │ │ +
504 class SeqOverlappingSchwarz;
│ │ │ +
505
│ │ │ +
506 struct MultiplicativeSchwarzMode;
│ │ │ +
507
│ │ │ +
508 namespace Amg
│ │ │ +
509 {
│ │ │ +
510 template<class M, class X, class MS, class TA>
│ │ │ +
│ │ │ + │ │ │ +
512 MS,TA> >
│ │ │ +
513 {
│ │ │ + │ │ │ +
515 typedef typename Smoother::range_type Range;
│ │ │ + │ │ │ +
517
│ │ │ +
│ │ │ +
518 static void preSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ +
519 {
│ │ │ +
520 smoother.template apply<true>(v,d);
│ │ │ +
521 }
│ │ │ +
│ │ │ +
522
│ │ │ +
523
│ │ │ +
│ │ │ +
524 static void postSmooth(Smoother& smoother, Domain& v, const Range& d)
│ │ │ +
525 {
│ │ │ +
526 smoother.template apply<false>(v,d);
│ │ │ +
527
│ │ │ +
528 }
│ │ │ +
│ │ │ +
529 };
│ │ │ +
│ │ │ +
530
│ │ │ +
531 // template<class M, class X, class TM, class TA>
│ │ │ +
532 // class SeqOverlappingSchwarz;
│ │ │ +
533
│ │ │ +
534 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
536 : public DefaultSmootherArgs<T>
│ │ │ +
537 {
│ │ │ + │ │ │ +
539
│ │ │ + │ │ │ + │ │ │ +
542
│ │ │ +
│ │ │ + │ │ │ +
544 bool onthefly_=false)
│ │ │ +
545 : overlap(overlap_), onthefly(onthefly_)
│ │ │ +
546 {}
│ │ │ +
│ │ │ +
547 };
│ │ │ +
│ │ │ +
548
│ │ │ +
549 template<class M, class X, class TM, class TS, class TA>
│ │ │ +
│ │ │ + │ │ │ +
551 {
│ │ │ + │ │ │ +
553 };
│ │ │ +
│ │ │ +
554
│ │ │ +
555 template<class M, class X, class TM, class TS, class TA>
│ │ │ +
│ │ │ + │ │ │ +
557 : public DefaultConstructionArgs<SeqOverlappingSchwarz<M,X,TM,TS,TA> >
│ │ │ +
558 {
│ │ │ + │ │ │ +
560
│ │ │ +
561 public:
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
566 typedef typename Vector::value_type Subdomain;
│ │ │ +
567
│ │ │ +
│ │ │ +
568 virtual void setMatrix(const M& matrix, const AggregatesMap& amap)
│ │ │ +
569 {
│ │ │ +
570 Father::setMatrix(matrix);
│ │ │ +
571
│ │ │ +
572 std::vector<bool> visited(amap.noVertices(), false);
│ │ │ +
573 typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
│ │ │ +
574 VisitedMapType visitedMap(visited.begin());
│ │ │ +
575
│ │ │ +
576 MatrixGraph<const M> graph(matrix);
│ │ │ +
577
│ │ │ + │ │ │ +
579
│ │ │ +
580 switch(Father::getArgs().overlap) {
│ │ │ +
581 case SmootherArgs::vertex :
│ │ │ +
582 {
│ │ │ +
583 VertexAdder visitor(subdomains, amap);
│ │ │ +
584 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ +
585 }
│ │ │ +
586 break;
│ │ │ +
587 case SmootherArgs::pairwise :
│ │ │ +
588 {
│ │ │ +
589 createPairDomains(graph);
│ │ │ +
590 }
│ │ │ +
591 break;
│ │ │ +
592 case SmootherArgs::aggregate :
│ │ │ +
593 {
│ │ │ +
594 AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
│ │ │ +
595 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ +
596 }
│ │ │ +
597 break;
│ │ │ +
598 case SmootherArgs::none :
│ │ │ +
599 NoneAdder visitor;
│ │ │ +
600 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ +
601 break;
│ │ │ +
602 default :
│ │ │ +
603 DUNE_THROW(NotImplemented, "This overlapping scheme is not supported!");
│ │ │ +
604 }
│ │ │ +
605 }
│ │ │ +
│ │ │ +
│ │ │ +
606 void setMatrix(const M& matrix)
│ │ │ +
607 {
│ │ │ +
608 Father::setMatrix(matrix);
│ │ │ +
609
│ │ │ +
610 /* Create aggregates map where each aggregate is just one vertex. */
│ │ │ +
611 AggregatesMap amap(matrix.N());
│ │ │ + │ │ │ +
613 for(typename AggregatesMap::iterator iter=amap.begin();
│ │ │ +
614 iter!=amap.end(); ++iter)
│ │ │ +
615 *iter=v++;
│ │ │ +
616
│ │ │ +
617 std::vector<bool> visited(amap.noVertices(), false);
│ │ │ +
618 typedef IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap> VisitedMapType;
│ │ │ +
619 VisitedMapType visitedMap(visited.begin());
│ │ │ +
620
│ │ │ +
621 MatrixGraph<const M> graph(matrix);
│ │ │ +
622
│ │ │ + │ │ │ +
624
│ │ │ +
625 switch(Father::getArgs().overlap) {
│ │ │ +
626 case SmootherArgs::vertex :
│ │ │ +
627 {
│ │ │ +
628 VertexAdder visitor(subdomains, amap);
│ │ │ +
629 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ +
630 }
│ │ │ +
631 break;
│ │ │ +
632 case SmootherArgs::aggregate :
│ │ │ +
633 {
│ │ │ +
634 DUNE_THROW(NotImplemented, "Aggregate overlap is not supported yet");
│ │ │ +
635 /*
│ │ │ +
636 AggregateAdder<VisitedMapType> visitor(subdomains, amap, graph, visitedMap);
│ │ │ +
637 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ +
638 */
│ │ │ +
639 }
│ │ │ +
640 break;
│ │ │ +
641 case SmootherArgs::pairwise :
│ │ │ +
642 {
│ │ │ +
643 createPairDomains(graph);
│ │ │ +
644 }
│ │ │ +
645 break;
│ │ │ +
646 case SmootherArgs::none :
│ │ │ +
647 NoneAdder visitor;
│ │ │ +
648 createSubdomains(matrix, graph, amap, visitor, visitedMap);
│ │ │ +
649
│ │ │ +
650 }
│ │ │ +
651 }
│ │ │ +
│ │ │ +
652
│ │ │ +
│ │ │ + │ │ │ +
654 {
│ │ │ +
655 return subdomains;
│ │ │ +
656 }
│ │ │ +
│ │ │ +
657
│ │ │ +
658 private:
│ │ │ +
659 struct VertexAdder
│ │ │ +
660 {
│ │ │ +
│ │ │ +
661 VertexAdder(Vector& subdomains_, const AggregatesMap& aggregates_)
│ │ │ +
662 : subdomains(subdomains_), max(-1), subdomain(-1), aggregates(aggregates_)
│ │ │ +
663 {}
│ │ │ +
│ │ │ +
664 template<class T>
│ │ │ +
│ │ │ +
665 void operator()(const T& edge)
│ │ │ +
666 {
│ │ │ +
667 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED)
│ │ │ +
668 subdomains[subdomain].insert(edge.target());
│ │ │ +
669 }
│ │ │ +
│ │ │ +
│ │ │ +
670 int setAggregate(const AggregateDescriptor& aggregate_)
│ │ │ +
671 {
│ │ │ +
672 subdomain=aggregate_;
│ │ │ +
673 max = std::max(subdomain, aggregate_);
│ │ │ +
674 return subdomain;
│ │ │ +
675 }
│ │ │ +
│ │ │ +
│ │ │ +
676 int noSubdomains() const
│ │ │ +
677 {
│ │ │ +
678 return max+1;
│ │ │ +
679 }
│ │ │ +
│ │ │ +
680 private:
│ │ │ +
681 Vector& subdomains;
│ │ │ + │ │ │ +
683 AggregateDescriptor subdomain;
│ │ │ +
684 const AggregatesMap& aggregates;
│ │ │ +
685 };
│ │ │ +
686 struct NoneAdder
│ │ │ +
687 {
│ │ │ +
688 template<class T>
│ │ │ +
│ │ │ +
689 void operator()(const T& edge)
│ │ │ +
690 {}
│ │ │ +
│ │ │ +
│ │ │ +
691 int setAggregate(const AggregateDescriptor& aggregate_)
│ │ │ +
692 {
│ │ │ +
693 return -1;
│ │ │ +
694 }
│ │ │ +
│ │ │ +
│ │ │ +
695 int noSubdomains() const
│ │ │ +
696 {
│ │ │ +
697 return -1;
│ │ │ +
698 }
│ │ │ +
│ │ │ +
699 };
│ │ │ +
700
│ │ │ +
701 template<class VM>
│ │ │ +
702 struct AggregateAdder
│ │ │ +
703 {
│ │ │ +
│ │ │ +
704 AggregateAdder(Vector& subdomains_, const AggregatesMap& aggregates_,
│ │ │ +
705 const MatrixGraph<const M>& graph_, VM& visitedMap_)
│ │ │ +
706 : subdomains(subdomains_), subdomain(-1), aggregates(aggregates_),
│ │ │ +
707 adder(subdomains_, aggregates_), graph(graph_), visitedMap(visitedMap_)
│ │ │ +
708 {}
│ │ │ +
│ │ │ +
709 template<class T>
│ │ │ +
│ │ │ +
710 void operator()(const T& edge)
│ │ │ +
711 {
│ │ │ +
712 subdomains[subdomain].insert(edge.target());
│ │ │ +
713 // If we (the neighbouring vertex of the aggregate)
│ │ │ +
714 // are not isolated, add the aggregate we belong to
│ │ │ +
715 // to the same subdomain using the OneOverlapAdder
│ │ │ +
716 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) {
│ │ │ +
717 assert(aggregates[edge.target()]!=aggregate);
│ │ │ +
718 typename AggregatesMap::VertexList vlist;
│ │ │ +
719 aggregates.template breadthFirstSearch<true,false>(edge.target(), aggregate,
│ │ │ +
720 graph, vlist, adder, adder,
│ │ │ +
721 visitedMap);
│ │ │ +
722 }
│ │ │ +
723 }
│ │ │ +
│ │ │ +
724
│ │ │ +
│ │ │ +
725 int setAggregate(const AggregateDescriptor& aggregate_)
│ │ │ +
726 {
│ │ │ +
727 adder.setAggregate(aggregate_);
│ │ │ +
728 aggregate=aggregate_;
│ │ │ +
729 return ++subdomain;
│ │ │ +
730 }
│ │ │ +
│ │ │ +
│ │ │ +
731 int noSubdomains() const
│ │ │ +
732 {
│ │ │ +
733 return subdomain+1;
│ │ │ +
734 }
│ │ │ +
│ │ │ +
735
│ │ │ +
736 private:
│ │ │ +
737 AggregateDescriptor aggregate;
│ │ │ +
738 Vector& subdomains;
│ │ │ +
739 int subdomain;
│ │ │ +
740 const AggregatesMap& aggregates;
│ │ │ +
741 VertexAdder adder;
│ │ │ +
742 const MatrixGraph<const M>& graph;
│ │ │ +
743 VM& visitedMap;
│ │ │ +
744 };
│ │ │ +
745
│ │ │ +
746 void createPairDomains(const MatrixGraph<const M>& graph)
│ │ │ +
747 {
│ │ │ +
748 typedef typename MatrixGraph<const M>::ConstVertexIterator VIter;
│ │ │ +
749 typedef typename MatrixGraph<const M>::ConstEdgeIterator EIter;
│ │ │ +
750 typedef typename M::size_type size_type;
│ │ │ +
751
│ │ │ +
752 std::set<std::pair<size_type,size_type> > pairs;
│ │ │ +
753 int total=0;
│ │ │ +
754 for(VIter v=graph.begin(), ve=graph.end(); ve != v; ++v)
│ │ │ +
755 for(EIter e = v.begin(), ee=v.end(); ee!=e; ++e)
│ │ │ +
756 {
│ │ │ +
757 ++total;
│ │ │ +
758 if(e.source()<e.target())
│ │ │ +
759 pairs.insert(std::make_pair(e.source(),e.target()));
│ │ │ +
760 else
│ │ │ +
761 pairs.insert(std::make_pair(e.target(),e.source()));
│ │ │ +
762 }
│ │ │ +
763
│ │ │ +
764
│ │ │ +
765 subdomains.resize(pairs.size());
│ │ │ +
766 Dune::dinfo <<std::endl<< "Created "<<pairs.size()<<" ("<<total<<") pair domains"<<std::endl<<std::endl;
│ │ │ +
767 typedef typename std::set<std::pair<size_type,size_type> >::const_iterator SIter;
│ │ │ +
768 typename Vector::iterator subdomain=subdomains.begin();
│ │ │ +
769
│ │ │ +
770 for(SIter s=pairs.begin(), se =pairs.end(); se!=s; ++s)
│ │ │ +
771 {
│ │ │ +
772 subdomain->insert(s->first);
│ │ │ +
773 subdomain->insert(s->second);
│ │ │ +
774 ++subdomain;
│ │ │ +
775 }
│ │ │ +
776 std::size_t minsize=10000;
│ │ │ +
777 std::size_t maxsize=0;
│ │ │ +
778 int sum=0;
│ │ │ +
779 for(typename Vector::size_type i=0; i < subdomains.size(); ++i) {
│ │ │ +
780 sum+=subdomains[i].size();
│ │ │ +
781 minsize=std::min(minsize, subdomains[i].size());
│ │ │ +
782 maxsize=std::max(maxsize, subdomains[i].size());
│ │ │ +
783 }
│ │ │ +
784 Dune::dinfo<<"Subdomain size: min="<<minsize<<" max="<<maxsize<<" avg="<<(sum/subdomains.size())
│ │ │ +
785 <<" no="<<subdomains.size()<<std::endl;
│ │ │ +
786 }
│ │ │ +
787
│ │ │ +
788 template<class Visitor>
│ │ │ +
789 void createSubdomains(const M& matrix, const MatrixGraph<const M>& graph,
│ │ │ +
790 const AggregatesMap& amap, Visitor& overlapVisitor,
│ │ │ +
791 IteratorPropertyMap<std::vector<bool>::iterator,IdentityMap>& visitedMap )
│ │ │ +
792 {
│ │ │ +
793 // count number ag aggregates. We assume that the
│ │ │ +
794 // aggregates are numbered consecutively from 0 except
│ │ │ +
795 // for the isolated ones. All isolated vertices form
│ │ │ +
796 // one aggregate, here.
│ │ │ +
797 int isolated=0;
│ │ │ +
798 AggregateDescriptor maxAggregate=0;
│ │ │ +
799
│ │ │ +
800 for(std::size_t i=0; i < amap.noVertices(); ++i)
│ │ │ +
801 if(amap[i]==AggregatesMap::ISOLATED)
│ │ │ +
802 isolated++;
│ │ │ +
803 else
│ │ │ +
804 maxAggregate = std::max(maxAggregate, amap[i]);
│ │ │ +
805
│ │ │ +
806 subdomains.resize(maxAggregate+1+isolated);
│ │ │ +
807
│ │ │ +
808 // reset the subdomains
│ │ │ +
809 for(typename Vector::size_type i=0; i < subdomains.size(); ++i)
│ │ │ +
810 subdomains[i].clear();
│ │ │ +
811
│ │ │ +
812 // Create the subdomains from the aggregates mapping.
│ │ │ +
813 // For each aggregate we mark all entries and the
│ │ │ +
814 // neighbouring vertices as belonging to the same subdomain
│ │ │ +
815 VertexAdder aggregateVisitor(subdomains, amap);
│ │ │ +
816
│ │ │ +
817 for(VertexDescriptor i=0; i < amap.noVertices(); ++i)
│ │ │ +
818 if(!get(visitedMap, i)) {
│ │ │ +
819 AggregateDescriptor aggregate=amap[i];
│ │ │ +
820
│ │ │ +
821 if(amap[i]==AggregatesMap::ISOLATED) {
│ │ │ +
822 // isolated vertex gets its own aggregate
│ │ │ +
823 subdomains.push_back(Subdomain());
│ │ │ +
824 aggregate=subdomains.size()-1;
│ │ │ +
825 }
│ │ │ +
826 overlapVisitor.setAggregate(aggregate);
│ │ │ +
827 aggregateVisitor.setAggregate(aggregate);
│ │ │ +
828 subdomains[aggregate].insert(i);
│ │ │ +
829 typename AggregatesMap::VertexList vlist;
│ │ │ +
830 amap.template breadthFirstSearch<false,false>(i, aggregate, graph, vlist, aggregateVisitor,
│ │ │ +
831 overlapVisitor, visitedMap);
│ │ │ +
832 }
│ │ │ +
833
│ │ │ +
834 std::size_t minsize=10000;
│ │ │ +
835 std::size_t maxsize=0;
│ │ │ +
836 int sum=0;
│ │ │ +
837 for(typename Vector::size_type i=0; i < subdomains.size(); ++i) {
│ │ │ +
838 sum+=subdomains[i].size();
│ │ │ +
839 minsize=std::min(minsize, subdomains[i].size());
│ │ │ +
840 maxsize=std::max(maxsize, subdomains[i].size());
│ │ │ +
841 }
│ │ │ +
842 Dune::dinfo<<"Subdomain size: min="<<minsize<<" max="<<maxsize<<" avg="<<(sum/subdomains.size())
│ │ │ +
843 <<" no="<<subdomains.size()<<" isolated="<<isolated<<std::endl;
│ │ │ +
844
│ │ │ +
845
│ │ │ +
846
│ │ │ +
847 }
│ │ │ +
848 Vector subdomains;
│ │ │ +
849 };
│ │ │ +
│ │ │ +
850
│ │ │ +
851
│ │ │ +
852 template<class M, class X, class TM, class TS, class TA>
│ │ │ +
│ │ │ +
853 struct ConstructionTraits<SeqOverlappingSchwarz<M,X,TM,TS,TA> >
│ │ │ +
854 {
│ │ │ + │ │ │ +
856
│ │ │ +
│ │ │ +
857 static inline std::shared_ptr<SeqOverlappingSchwarz<M,X,TM,TS,TA>> construct(Arguments& args)
│ │ │ +
858 {
│ │ │ +
859 return std::make_shared<SeqOverlappingSchwarz<M,X,TM,TS,TA>>
│ │ │ +
860 (args.getMatrix(),
│ │ │ +
861 args.getSubDomains(),
│ │ │ + │ │ │ +
863 args.getArgs().onthefly);
│ │ │ +
864 }
│ │ │ +
│ │ │ +
865 };
│ │ │ +
│ │ │ +
866
│ │ │ +
867
│ │ │ +
868 } // namespace Amg
│ │ │ +
869} // namespace Dune
│ │ │ +
870
│ │ │ +
871
│ │ │ +
872
│ │ │ +
873#endif
│ │ │ +
Helper classes for the construction of classes without empty constructor.
│ │ │ +
Provides classes for the Coloring process of AMG.
│ │ │ + │ │ │ + │ │ │ +
Define general preconditioner interface.
│ │ │ +
DefaultSmootherArgs< typename X::field_type > Arguments
Definition smoother.hh:74
│ │ │ +
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:494
│ │ │ + │ │ │ +
static void preSmooth(Smoother &smoother, Domain &v, const Range &d)
Definition smoother.hh:518
│ │ │ +
static std::shared_ptr< SeqJac< M, X, Y, l > > construct(Arguments &args)
Definition smoother.hh:256
│ │ │ +
ConstructionArgs< SeqILU< M, X, Y > > Arguments
Definition smoother.hh:309
│ │ │ +
const Matrix & getMatrix() const
Definition smoother.hh:114
│ │ │ + │ │ │ +
int setAggregate(const AggregateDescriptor &aggregate_)
Definition smoother.hh:691
│ │ │ +
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ +
int setAggregate(const AggregateDescriptor &aggregate_)
Definition smoother.hh:670
│ │ │ +
ConstructionTraits< T > SeqConstructionTraits
Definition smoother.hh:350
│ │ │ +
void setArgs(const SmootherArgs &args)
Definition smoother.hh:119
│ │ │ +
ConstructionArgs< SeqOverlappingSchwarz< M, X, TM, TS, TA > > Arguments
Definition smoother.hh:855
│ │ │ +
NonoverlappingBlockPreconditioner< C, SeqSOR< M, X, Y, l > > Smoother
Definition smoother.hh:484
│ │ │ +
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:456
│ │ │ +
AggregateAdder(Vector &subdomains_, const AggregatesMap &aggregates_, const MatrixGraph< const M > &graph_, VM &visitedMap_)
Definition smoother.hh:704
│ │ │ + │ │ │ +
void setComm(const C &comm)
Definition smoother.hh:158
│ │ │ +
DefaultConstructionArgs< Richardson< X, Y > > Arguments
Definition smoother.hh:269
│ │ │ +
virtual ~DefaultConstructionArgs()
Definition smoother.hh:180
│ │ │ +
SeqOverlappingSchwarzSmootherArgs< typename M::field_type > Arguments
Definition smoother.hh:552
│ │ │ + │ │ │ +
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:488
│ │ │ +
int getN()
Definition smoother.hh:293
│ │ │ + │ │ │ +
SeqSOR< M, X, Y, l > Smoother
Definition smoother.hh:446
│ │ │ + │ │ │ +
static std::shared_ptr< SeqSSOR< M, X, Y, l > > construct(Arguments &args)
Definition smoother.hh:224
│ │ │ +
AggregatesMap::AggregateDescriptor AggregateDescriptor
Definition smoother.hh:564
│ │ │ +
bool onthefly
Definition smoother.hh:541
│ │ │ +
DefaultConstructionArgs< SeqSOR< M, X, Y, l > > Arguments
Definition smoother.hh:238
│ │ │ +
virtual void setMatrix(const M &matrix, const AggregatesMap &amap)
Definition smoother.hh:568
│ │ │ +
void setMatrix(const Args &...)
Definition smoother.hh:184
│ │ │ +
DefaultConstructionArgs< SeqJac< M, X, Y, l > > Arguments
Definition smoother.hh:254
│ │ │ +
DefaultConstructionArgs< SeqSSOR< M, X, Y, l > > Arguments
Definition smoother.hh:222
│ │ │ +
const SmootherArgs getArgs() const
Definition smoother.hh:133
│ │ │ +
VertexAdder(Vector &subdomains_, const AggregatesMap &aggregates_)
Definition smoother.hh:661
│ │ │ + │ │ │ +
SeqOverlappingSchwarz< M, X, TM, TS, TA >::subdomain_vector Vector
Definition smoother.hh:565
│ │ │ +
static std::shared_ptr< SeqOverlappingSchwarz< M, X, TM, TS, TA > > construct(Arguments &args)
Definition smoother.hh:857
│ │ │ +
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:469
│ │ │ +
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ +
void setMatrix(const Matrix &matrix)
Definition smoother.hh:104
│ │ │ +
T Smoother
Definition smoother.hh:371
│ │ │ +
static void preSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:450
│ │ │ +
BlockPreconditioner< X, Y, C, SeqSOR< M, X, Y, l > > Smoother
Definition smoother.hh:465
│ │ │ +
void setComm(T1 &comm)
Definition smoother.hh:193
│ │ │ + │ │ │ +
AggregateDescriptor * iterator
Definition aggregates.hh:735
│ │ │ +
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ + │ │ │ +
SeqOverlappingSchwarzSmootherArgs(Overlap overlap_=vertex, bool onthefly_=false)
Definition smoother.hh:543
│ │ │ +
DefaultParallelConstructionArgs< T, C > Arguments
Definition smoother.hh:337
│ │ │ +
DefaultParallelConstructionArgs< T, C > Arguments
Definition smoother.hh:349
│ │ │ +
const Matrix * matrix_
Definition smoother.hh:139
│ │ │ +
const_iterator end() const
Definition aggregates.hh:730
│ │ │ +
const SequentialInformation & getComm()
Definition smoother.hh:128
│ │ │ +
V AggregateDescriptor
The aggregate descriptor type.
Definition aggregates.hh:580
│ │ │
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:571
│ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
The type of the global index.
Definition indicescoarsener.hh:60
│ │ │ -
void attribute(const Attribute &attribute)
Definition indicescoarsener.hh:155
│ │ │ -
E ExcludedAttributes
The set of excluded attributes.
Definition indicescoarsener.hh:48
│ │ │ -
void globalIndex(const GlobalIndex &global)
Definition indicescoarsener.hh:170
│ │ │ -
Dune::RemoteIndices< ParallelIndexSet > RemoteIndices
The type of the remote indices.
Definition indicescoarsener.hh:75
│ │ │ -
static Graph::VertexDescriptor coarsen(ParallelInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, ParallelInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates, bool useFixedOrder=false)
Build the coarse index set after the aggregatio.
Definition indicescoarsener.hh:236
│ │ │ -
ParallelAggregateRenumberer(AggregatesMap< Vertex > &aggregates, const I &lookup)
Definition indicescoarsener.hh:115
│ │ │ -
const GlobalIndex & globalIndex() const
Definition indicescoarsener.hh:165
│ │ │ -
STL namespace.
│ │ │ +
DefaultSmootherArgs()
Default constructor.
Definition smoother.hh:56
│ │ │ +
void setMatrix(const M &matrix)
Definition smoother.hh:606
│ │ │ +
std::size_t noVertices() const
Get the number of vertices.
│ │ │ + │ │ │ +
static void postSmooth(Smoother &smoother, Domain &v, const Range &d)
apply post smoothing in forward direction
Definition smoother.hh:394
│ │ │ +
FieldTraits< T >::real_type RelaxationFactor
The type of the relaxation factor.
Definition smoother.hh:42
│ │ │ + │ │ │ +
Smoother::domain_type Domain
Definition smoother.hh:373
│ │ │ +
void setN(int n)
Definition smoother.hh:288
│ │ │ +
static std::shared_ptr< BlockPreconditioner< X, Y, C, T > > construct(Arguments &args)
Definition smoother.hh:339
│ │ │ +
SLList< VertexDescriptor, Allocator > VertexList
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:592
│ │ │ +
static std::shared_ptr< NonoverlappingBlockPreconditioner< C, T > > construct(Arguments &args)
Definition smoother.hh:351
│ │ │ +
SeqOverlappingSchwarz< M, X, MultiplicativeSchwarzMode, MS, TA > Smoother
Definition smoother.hh:514
│ │ │ +
static std::shared_ptr< ParSSOR< M, X, Y, C > > construct(Arguments &args)
Definition smoother.hh:326
│ │ │ +
MatrixGraph< M >::VertexDescriptor VertexDescriptor
Definition smoother.hh:562
│ │ │ +
static std::shared_ptr< SeqILU< M, X, Y > > construct(Arguments &args)
Definition smoother.hh:311
│ │ │ + │ │ │ +
const SequentialInformation & getComm()
Definition smoother.hh:196
│ │ │ +
static std::shared_ptr< SeqSOR< M, X, Y, l > > construct(Arguments &args)
Definition smoother.hh:240
│ │ │ +
static std::shared_ptr< Richardson< X, Y > > construct(Arguments &args)
Definition smoother.hh:271
│ │ │ +
virtual void setMatrix(const Matrix &matrix, const AggregatesMap &amap)
Definition smoother.hh:108
│ │ │ + │ │ │ +
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ +
Dune::Amg::AggregatesMap< VertexDescriptor > AggregatesMap
Definition smoother.hh:563
│ │ │ +
const SmootherArgs getArgs() const
Definition smoother.hh:201
│ │ │ +
void setComm(T1 &comm)
Definition smoother.hh:125
│ │ │ +
static void postSmooth(Smoother &smoother, Domain &v, const Range &d)
Definition smoother.hh:524
│ │ │ +
DefaultParallelConstructionArgs< M, C > Arguments
Definition smoother.hh:324
│ │ │ +
RelaxationFactor relaxationFactor
The relaxation factor to use.
Definition smoother.hh:51
│ │ │ +
virtual ~DefaultParallelConstructionArgs()
Definition smoother.hh:155
│ │ │ +
Smoother::domain_type Domain
Definition smoother.hh:448
│ │ │ +
int setAggregate(const AggregateDescriptor &aggregate_)
Definition smoother.hh:725
│ │ │ +
Smoother::range_type Range
Definition smoother.hh:447
│ │ │ +
const C & getComm() const
Definition smoother.hh:163
│ │ │ +
virtual ~DefaultConstructionArgs()
Definition smoother.hh:101
│ │ │ +
static void preSmooth(Smoother &smoother, Domain &v, const Range &d)
apply pre smoothing in forward direction
Definition smoother.hh:382
│ │ │ +
static void postSmooth(Smoother &smoother, Domain &v, Range &d)
Definition smoother.hh:475
│ │ │ +
ConstructionTraits< T > SeqConstructionTraits
Definition smoother.hh:338
│ │ │ +
ConstructionArgs(int n=0)
Definition smoother.hh:284
│ │ │ + │ │ │ +
void setArgs(const SmootherArgs &args)
Definition smoother.hh:187
│ │ │ +
int iterations
The number of iterations to perform.
Definition smoother.hh:47
│ │ │ +
Smoother::range_type Range
Definition smoother.hh:372
│ │ │ +
Overlap overlap
Definition smoother.hh:540
│ │ │ + │ │ │ +
@ aggregate
Definition smoother.hh:538
│ │ │ + │ │ │ +
@ pairwise
Definition smoother.hh:538
│ │ │ + │ │ │
Definition allocator.hh:11
│ │ │
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ +
X range_type
The range type of the preconditioner.
Definition overlappingschwarz.hh:770
│ │ │ +
X domain_type
The domain type of the preconditioner.
Definition overlappingschwarz.hh:765
│ │ │ +
std::vector< subdomain_type, typename std::allocator_traits< TA >::template rebind_alloc< subdomain_type > > subdomain_vector
The vector type containing the subdomain to row index mapping.
Definition overlappingschwarz.hh:797
│ │ │ +
Nonoverlapping parallel preconditioner.
Definition novlpschwarz.hh:276
│ │ │ +
P::range_type range_type
The range type of the preconditioner.
Definition novlpschwarz.hh:284
│ │ │ +
P::domain_type domain_type
The domain type of the preconditioner.
Definition novlpschwarz.hh:282
│ │ │ +
Tag that tells the Schwarz method to be multiplicative.
Definition overlappingschwarz.hh:126
│ │ │
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
Definition indicescoarsener.hh:36
│ │ │ -
Definition indicescoarsener.hh:43
│ │ │ +
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ +
VertexIterator end()
Get an iterator over the vertices.
│ │ │ +
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ +
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ +
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ +
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │
Definition pinfo.hh:28
│ │ │ -
Definition renumberer.hh:16
│ │ │ -
void operator++()
Definition renumberer.hh:57
│ │ │ -
void operator()(const typename G::ConstEdgeIterator &edge)
Definition renumberer.hh:51
│ │ │ -
Vertex number_
Definition renumberer.hh:35
│ │ │ +
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ +
Traits class for getting the attribute class of a smoother.
Definition smoother.hh:66
│ │ │ +
Construction Arguments for the default smoothers.
Definition smoother.hh:93
│ │ │ +
Definition smoother.hh:148
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
Helper class for applying the smoothers.
Definition smoother.hh:370
│ │ │ + │ │ │ + │ │ │ +
Sequential SSOR preconditioner.
Definition preconditioners.hh:142
│ │ │ +
Sequential SOR preconditioner.
Definition preconditioners.hh:262
│ │ │ +
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:267
│ │ │ +
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:269
│ │ │ +
The sequential jacobian preconditioner.
Definition preconditioners.hh:413
│ │ │ +
Sequential ILU preconditioner.
Definition preconditioners.hh:697
│ │ │ +
Richardson preconditioner.
Definition preconditioners.hh:878
│ │ │ +
A parallel SSOR preconditioner.
Definition schwarz.hh:175
│ │ │ +
Block parallel preconditioner.
Definition schwarz.hh:278
│ │ │ +
X domain_type
The domain type of the preconditioner.
Definition schwarz.hh:285
│ │ │ +
Y range_type
The range type of the preconditioner.
Definition schwarz.hh:290
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,491 +1,1343 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ * _p_a_a_m_g │ │ │ │ -indicescoarsener.hh │ │ │ │ +smoother.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_INDICESCOARSENER_HH │ │ │ │ -6#define DUNE_AMG_INDICESCOARSENER_HH │ │ │ │ +5#ifndef DUNE_AMGSMOOTHER_HH │ │ │ │ +6#define DUNE_AMGSMOOTHER_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include "_r_e_n_u_m_b_e_r_e_r_._h_h" │ │ │ │ -11 │ │ │ │ -12#if HAVE_MPI │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ -14#endif │ │ │ │ +8#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ +9#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_a_g_g_r_e_g_a_t_e_s_._h_h> │ │ │ │ +10#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ +11#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ +12#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ 15 │ │ │ │ -16#include "_p_i_n_f_o_._h_h" │ │ │ │ -17 │ │ │ │ -18namespace _D_u_n_e │ │ │ │ -19{ │ │ │ │ -20 namespace Amg │ │ │ │ -21 { │ │ │ │ -22 │ │ │ │ -34 template │ │ │ │ -_3_5 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ -36 {}; │ │ │ │ -37 │ │ │ │ -38 │ │ │ │ -39#if HAVE_MPI │ │ │ │ -40 │ │ │ │ -41 template │ │ │ │ -_4_2 class _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r │ │ │ │ -43 { │ │ │ │ -44 public: │ │ │ │ -_4_8 typedef E _E_x_c_l_u_d_e_d_A_t_t_r_i_b_u_t_e_s; │ │ │ │ -49 │ │ │ │ -_5_3 typedef T _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -54 │ │ │ │ -_5_5 typedef typename ParallelInformation::ParallelIndexSet _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ -56 │ │ │ │ -_6_0 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ -61 │ │ │ │ -_6_5 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ -66 │ │ │ │ -_7_0 typedef typename LocalIndex::Attribute _A_t_t_r_i_b_u_t_e; │ │ │ │ -71 │ │ │ │ -_7_5 typedef Dune::RemoteIndices _R_e_m_o_t_e_I_n_d_i_c_e_s; │ │ │ │ -76 │ │ │ │ -92 template │ │ │ │ -93 static typename Graph::VertexDescriptor │ │ │ │ -_9_4 _c_o_a_r_s_e_n(_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& fineInfo, │ │ │ │ -95 Graph& fineGraph, │ │ │ │ -96 VM& visitedMap, │ │ │ │ -97 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -98 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ -99 typename Graph::VertexDescriptor noAggregates, │ │ │ │ -100 bool useFixedOrder = false); │ │ │ │ -101 │ │ │ │ -102 private: │ │ │ │ -103 template │ │ │ │ -104 class ParallelAggregateRenumberer : public _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r │ │ │ │ +16namespace _D_u_n_e │ │ │ │ +17{ │ │ │ │ +18 namespace Amg │ │ │ │ +19 { │ │ │ │ +20 │ │ │ │ +36 template │ │ │ │ +_3_7 struct _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +38 { │ │ │ │ +_4_2 typedef typename FieldTraits::real_type _R_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r; │ │ │ │ +43 │ │ │ │ +_4_7 int _i_t_e_r_a_t_i_o_n_s; │ │ │ │ +_5_1 _R_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r _r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r; │ │ │ │ +52 │ │ │ │ +_5_6 _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s() │ │ │ │ +57 : _i_t_e_r_a_t_i_o_n_s(1), _r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r(1.0) │ │ │ │ +58 {} │ │ │ │ +59 }; │ │ │ │ +60 │ │ │ │ +64 template │ │ │ │ +_6_5 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s │ │ │ │ +66 { │ │ │ │ +_6_7 typedef _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _T_:_:_m_a_t_r_i_x___t_y_p_e_:_:_f_i_e_l_d___t_y_p_e_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +68 │ │ │ │ +69 }; │ │ │ │ +70 │ │ │ │ +71 template │ │ │ │ +_7_2 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_R_i_c_h_a_r_d_s_o_n> │ │ │ │ +73 { │ │ │ │ +_7_4 typedef _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _X_:_:_f_i_e_l_d___t_y_p_e_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +75 │ │ │ │ +76 }; │ │ │ │ +77 │ │ │ │ +78 template │ │ │ │ +_7_9 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ +80 : public _S_m_o_o_t_h_e_r_T_r_a_i_t_s │ │ │ │ +81 {}; │ │ │ │ +82 │ │ │ │ +83 template │ │ │ │ +_8_4 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ +85 : public _S_m_o_o_t_h_e_r_T_r_a_i_t_s │ │ │ │ +86 {}; │ │ │ │ +87 │ │ │ │ +91 template │ │ │ │ +_9_2 class _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ +93 { │ │ │ │ +94 typedef typename T::matrix_type Matrix; │ │ │ │ +95 │ │ │ │ +96 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ +97 │ │ │ │ +98 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_>_:_: │ │ │ │ +_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r> _A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ +99 │ │ │ │ +100 public: │ │ │ │ +_1_0_1 virtual _~_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s() │ │ │ │ +102 {} │ │ │ │ +103 │ │ │ │ +_1_0_4 void _s_e_t_M_a_t_r_i_x(const Matrix& matrix) │ │ │ │ 105 { │ │ │ │ -106 typedef typename G::VertexDescriptor Vertex; │ │ │ │ -107 │ │ │ │ -108 typedef I GlobalLookupIndexSet; │ │ │ │ -109 │ │ │ │ -110 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ -111 │ │ │ │ -112 typedef typename IndexPair::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ +106 _m_a_t_r_i_x__=&matrix; │ │ │ │ +107 } │ │ │ │ +_1_0_8 virtual void _s_e_t_M_a_t_r_i_x(const Matrix& matrix, [[maybe_unused]] const │ │ │ │ +_A_g_g_r_e_g_a_t_e_s_M_a_p& amap) │ │ │ │ +109 { │ │ │ │ +110 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ +111 } │ │ │ │ +112 │ │ │ │ 113 │ │ │ │ -114 public: │ │ │ │ -_1_1_5 _P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const I& │ │ │ │ -lookup) │ │ │ │ -116 : _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r(aggregates), isPublic_(false), lookup_(lookup), │ │ │ │ -117 globalIndex_(_s_t_d::numeric_limits::max()) │ │ │ │ -118 {} │ │ │ │ -119 │ │ │ │ -120 │ │ │ │ -_1_2_1 void _o_p_e_r_a_t_o_r_(_)(const typename G::ConstEdgeIterator& edge) │ │ │ │ -122 { │ │ │ │ -123 _A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_<_G_>_:_:_o_p_e_r_a_t_o_r_(_)(edge); │ │ │ │ -124 const IndexPair* pair= lookup_.pair(edge.target()); │ │ │ │ -125 if(pair!=0) { │ │ │ │ -126 _g_l_o_b_a_l_I_n_d_e_x(pair->global()); │ │ │ │ -127 _a_t_t_r_i_b_u_t_e(pair->local().attribute()); │ │ │ │ -128 _i_s_P_u_b_l_i_c(pair->local().isPublic()); │ │ │ │ -129 } │ │ │ │ -130 } │ │ │ │ -131 │ │ │ │ -_1_3_2 Vertex _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const GlobalIndex& global) │ │ │ │ -133 { │ │ │ │ -134 Vertex current = this->_n_u_m_b_e_r__; │ │ │ │ -135 this->_o_p_e_r_a_t_o_r_+_+(); │ │ │ │ -136 return current; │ │ │ │ -137 } │ │ │ │ -138 │ │ │ │ -_1_3_9 bool _i_s_P_u_b_l_i_c() │ │ │ │ -140 { │ │ │ │ -141 return isPublic_; │ │ │ │ -142 } │ │ │ │ -143 │ │ │ │ -_1_4_4 void _i_s_P_u_b_l_i_c(bool b) │ │ │ │ -145 { │ │ │ │ -146 isPublic_ = isPublic_ || b; │ │ │ │ -147 } │ │ │ │ -148 │ │ │ │ -_1_4_9 void _r_e_s_e_t() │ │ │ │ -150 { │ │ │ │ -151 globalIndex_ = std::numeric_limits::max(); │ │ │ │ -152 isPublic_=false; │ │ │ │ -153 } │ │ │ │ -154 │ │ │ │ -_1_5_5 void _a_t_t_r_i_b_u_t_e(const _A_t_t_r_i_b_u_t_e& _a_t_t_r_i_b_u_t_e) │ │ │ │ -156 { │ │ │ │ -157 attribute_=_a_t_t_r_i_b_u_t_e; │ │ │ │ -158 } │ │ │ │ -159 │ │ │ │ -_1_6_0 _A_t_t_r_i_b_u_t_e _a_t_t_r_i_b_u_t_e() │ │ │ │ -161 { │ │ │ │ -162 return attribute_; │ │ │ │ -163 } │ │ │ │ -164 │ │ │ │ -_1_6_5 const GlobalIndex& _g_l_o_b_a_l_I_n_d_e_x() const │ │ │ │ -166 { │ │ │ │ -167 return globalIndex_; │ │ │ │ -168 } │ │ │ │ -169 │ │ │ │ -_1_7_0 void _g_l_o_b_a_l_I_n_d_e_x(const GlobalIndex& global) │ │ │ │ -171 { │ │ │ │ -172 globalIndex_ = global; │ │ │ │ -173 } │ │ │ │ -174 │ │ │ │ -175 private: │ │ │ │ -176 bool isPublic_; │ │ │ │ -177 _A_t_t_r_i_b_u_t_e attribute_; │ │ │ │ -178 const GlobalLookupIndexSet& lookup_; │ │ │ │ -179 _G_l_o_b_a_l_I_n_d_e_x globalIndex_; │ │ │ │ -180 }; │ │ │ │ -181 │ │ │ │ -182 template │ │ │ │ -183 static void buildCoarseIndexSet(const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -184 Graph& fineGraph, │ │ │ │ -185 VM& visitedMap, │ │ │ │ -186 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -187 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& coarseIndices, │ │ │ │ -188 ParallelAggregateRenumberer& renumberer); │ │ │ │ -189 │ │ │ │ -190 template │ │ │ │ -191 static void buildCoarseRemoteIndices(const _R_e_m_o_t_e_I_n_d_i_c_e_s& fineRemote, │ │ │ │ -192 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -193 _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t& coarseIndices, │ │ │ │ -194 _R_e_m_o_t_e_I_n_d_i_c_e_s& coarseRemote, │ │ │ │ -195 ParallelAggregateRenumberer& renumberer, │ │ │ │ -196 bool useFixedOrder); │ │ │ │ -197 │ │ │ │ -198 }; │ │ │ │ -199 │ │ │ │ -203 template │ │ │ │ -_2_0_4 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r<_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n,E> │ │ │ │ -205 : public _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r,E> │ │ │ │ -206 {}; │ │ │ │ -207 │ │ │ │ -208 │ │ │ │ -209#endif │ │ │ │ +_1_1_4 const Matrix& _g_e_t_M_a_t_r_i_x() const │ │ │ │ +115 { │ │ │ │ +116 return *_m_a_t_r_i_x__; │ │ │ │ +117 } │ │ │ │ +118 │ │ │ │ +_1_1_9 void _s_e_t_A_r_g_s(const _S_m_o_o_t_h_e_r_A_r_g_s& args) │ │ │ │ +120 { │ │ │ │ +121 args_=&args; │ │ │ │ +122 } │ │ │ │ +123 │ │ │ │ +124 template │ │ │ │ +_1_2_5 void _s_e_t_C_o_m_m([[maybe_unused]] T1& comm) │ │ │ │ +126 {} │ │ │ │ +127 │ │ │ │ +_1_2_8 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& _g_e_t_C_o_m_m() │ │ │ │ +129 { │ │ │ │ +130 return comm_; │ │ │ │ +131 } │ │ │ │ +132 │ │ │ │ +_1_3_3 const _S_m_o_o_t_h_e_r_A_r_g_s _g_e_t_A_r_g_s() const │ │ │ │ +134 { │ │ │ │ +135 return *args_; │ │ │ │ +136 } │ │ │ │ +137 │ │ │ │ +138 protected: │ │ │ │ +_1_3_9 const Matrix* _m_a_t_r_i_x__; │ │ │ │ +140 private: │ │ │ │ +141 const _S_m_o_o_t_h_e_r_A_r_g_s* args_; │ │ │ │ +142 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n comm_; │ │ │ │ +143 }; │ │ │ │ +144 │ │ │ │ +145 template │ │ │ │ +_1_4_6 struct _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ +147 : public _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ +148 {}; │ │ │ │ +149 │ │ │ │ +150 template │ │ │ │ +_1_5_1 class _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ +152 : public _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s │ │ │ │ +153 { │ │ │ │ +154 public: │ │ │ │ +_1_5_5 virtual _~_D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s() │ │ │ │ +156 {} │ │ │ │ +157 │ │ │ │ +_1_5_8 void _s_e_t_C_o_m_m(const C& comm) │ │ │ │ +159 { │ │ │ │ +160 comm_ = &comm; │ │ │ │ +161 } │ │ │ │ +162 │ │ │ │ +_1_6_3 const C& _g_e_t_C_o_m_m() const │ │ │ │ +164 { │ │ │ │ +165 return *comm_; │ │ │ │ +166 } │ │ │ │ +167 private: │ │ │ │ +168 const C* comm_; │ │ │ │ +169 }; │ │ │ │ +170 │ │ │ │ +171 │ │ │ │ +172 template │ │ │ │ +_1_7_3 class _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s<_R_i_c_h_a_r_d_s_o_n> │ │ │ │ +174 { │ │ │ │ +175 typedef _R_i_c_h_a_r_d_s_o_n_<_X_,_Y_> _T; │ │ │ │ +176 │ │ │ │ +177 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ +178 │ │ │ │ +179 public: │ │ │ │ +_1_8_0 virtual _~_D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s() │ │ │ │ +181 {} │ │ │ │ +182 │ │ │ │ +183 template │ │ │ │ +_1_8_4 void _s_e_t_M_a_t_r_i_x(const Args&...) │ │ │ │ +185 {} │ │ │ │ +186 │ │ │ │ +_1_8_7 void _s_e_t_A_r_g_s(const _S_m_o_o_t_h_e_r_A_r_g_s& args) │ │ │ │ +188 { │ │ │ │ +189 args_=&args; │ │ │ │ +190 } │ │ │ │ +191 │ │ │ │ +192 template │ │ │ │ +_1_9_3 void _s_e_t_C_o_m_m([[maybe_unused]] T1& comm) │ │ │ │ +194 {} │ │ │ │ +195 │ │ │ │ +_1_9_6 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& _g_e_t_C_o_m_m() │ │ │ │ +197 { │ │ │ │ +198 return comm_; │ │ │ │ +199 } │ │ │ │ +200 │ │ │ │ +_2_0_1 const _S_m_o_o_t_h_e_r_A_r_g_s _g_e_t_A_r_g_s() const │ │ │ │ +202 { │ │ │ │ +203 return *args_; │ │ │ │ +204 } │ │ │ │ +205 │ │ │ │ +206 private: │ │ │ │ +207 const SmootherArgs* args_; │ │ │ │ +208 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n comm_; │ │ │ │ +209 }; │ │ │ │ 210 │ │ │ │ -217 template │ │ │ │ -_2_1_8 class _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n,E> │ │ │ │ -219 { │ │ │ │ -220 public: │ │ │ │ -221 template │ │ │ │ -222 static typename Graph::VertexDescriptor │ │ │ │ -223 coarsen(const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n & fineInfo, │ │ │ │ -224 Graph& fineGraph, │ │ │ │ -225 VM& visitedMap, │ │ │ │ -226 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -227 _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ -228 typename Graph::VertexDescriptor noAggregates, │ │ │ │ -229 bool useFixedOrder = false); │ │ │ │ -230 }; │ │ │ │ +211 │ │ │ │ +212 │ │ │ │ +213 template │ │ │ │ +214 struct ConstructionTraits; │ │ │ │ +215 │ │ │ │ +219 template │ │ │ │ +_2_2_0 struct ConstructionTraits<_S_e_q_S_S_O_R > │ │ │ │ +221 { │ │ │ │ +_2_2_2 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_S_S_O_R_<_M_,_X_,_Y_,_l_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ +223 │ │ │ │ +_2_2_4 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +225 { │ │ │ │ +226 return std::make_shared> │ │ │ │ +227 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, args._g_e_t_A_r_g_s │ │ │ │ +()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ +228 } │ │ │ │ +229 }; │ │ │ │ +230 │ │ │ │ 231 │ │ │ │ -232#if HAVE_MPI │ │ │ │ -233 template │ │ │ │ -234 template │ │ │ │ -235 inline typename Graph::VertexDescriptor │ │ │ │ -_2_3_6 _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_T_,_E_>_:_:_c_o_a_r_s_e_n(_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& fineInfo, │ │ │ │ -237 Graph& fineGraph, │ │ │ │ -238 VM& visitedMap, │ │ │ │ -239 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -240 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ -241 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates, │ │ │ │ -242 bool useFixedOrder) │ │ │ │ -243 { │ │ │ │ -244 ParallelAggregateRenumberer renumberer(aggregates, fineInfo.globalLookup()); │ │ │ │ -245 buildCoarseIndexSet(fineInfo, fineGraph, visitedMap, aggregates, │ │ │ │ -246 coarseInfo.indexSet(), renumberer); │ │ │ │ -247 buildCoarseRemoteIndices(fineInfo.remoteIndices(), aggregates, │ │ │ │ -coarseInfo.indexSet(), │ │ │ │ -248 coarseInfo.remoteIndices(), renumberer, useFixedOrder); │ │ │ │ -249 │ │ │ │ -250 return renumberer; │ │ │ │ -251 } │ │ │ │ -252 │ │ │ │ -253 template │ │ │ │ -254 template │ │ │ │ -255 void _P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_T_,_E_>_:_:_b_u_i_l_d_C_o_a_r_s_e_I_n_d_e_x_S_e_t(const │ │ │ │ -ParallelInformation& pinfo, │ │ │ │ -256 Graph& fineGraph, │ │ │ │ -257 VM& visitedMap, │ │ │ │ -258 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -259 ParallelIndexSet& coarseIndices, │ │ │ │ -260 ParallelAggregateRenumberer& renumberer) │ │ │ │ -261 { │ │ │ │ -262 // fineGraph is the local subgraph corresponding to the vertices the │ │ │ │ -process owns. │ │ │ │ -263 // i.e. no overlap/copy vertices can be visited traversing the graph │ │ │ │ -264 typedef typename Graph::ConstVertexIterator Iterator; │ │ │ │ -265 typedef typename ParallelInformation::GlobalLookupIndexSet │ │ │ │ -GlobalLookupIndexSet; │ │ │ │ -266 │ │ │ │ -267 Iterator end = fineGraph.end(); │ │ │ │ -268 const GlobalLookupIndexSet& lookup = pinfo.globalLookup(); │ │ │ │ -269 │ │ │ │ -270 coarseIndices.beginResize(); │ │ │ │ -271 │ │ │ │ -272 // Setup the coarse index set and renumber the aggregate consecutively │ │ │ │ -273 // ascending from zero according to the minimum global index belonging │ │ │ │ -274 // to the aggregate │ │ │ │ -275 for(Iterator index = fineGraph.begin(); index != end; ++index) { │ │ │ │ -276 if(aggregates[*index]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ -_I_S_O_L_A_T_E_D) │ │ │ │ -277 // Isolated vertices will not be represented on the next level. │ │ │ │ -278 // These should only be there if skipIsolated is activiated in │ │ │ │ -279 // the coarsening criterion as otherwise they will be aggregated │ │ │ │ -280 // and should have real aggregate number in the map right now. │ │ │ │ -281 if(!_g_e_t(visitedMap, *index)) { │ │ │ │ -282 // This vertex was not visited by breadthFirstSearch yet. │ │ │ │ -283 typedef typename GlobalLookupIndexSet::IndexPair IndexPair; │ │ │ │ -284 const IndexPair* pair= lookup.pair(*index); │ │ │ │ -285 │ │ │ │ -286 renumberer.reset(); // reset attribute and global index. │ │ │ │ -287 if(pair!=0) { │ │ │ │ -288 // vertex is in the index set. Note that not all vertices have │ │ │ │ -289 // to be in the index set, just the ones where communication │ │ │ │ -290 // will happen. │ │ │ │ -291 assert(!ExcludedAttributes::contains(pair->local().attribute())); │ │ │ │ -292 renumberer.attribute(pair->local().attribute()); │ │ │ │ -293 renumberer.isPublic(pair->local().isPublic()); │ │ │ │ -294 renumberer.globalIndex(pair->global()); │ │ │ │ -295 } │ │ │ │ -296 │ │ │ │ -297 // Reconstruct aggregate and mark vertices as visited │ │ │ │ -298 aggregates.template breadthFirstSearch(*index, aggregates[*index], │ │ │ │ -299 fineGraph, renumberer, visitedMap); │ │ │ │ -300 │ │ │ │ -301 if(renumberer.globalIndex()!=std::numeric_limits::max()) { │ │ │ │ -302 // vertex is in the index set. │ │ │ │ -303 //std::cout <<" Adding global="<< renumberer.globalIndex()<<" │ │ │ │ -local="<(renumberer)<(renumberer) >= coarseIndices.size()); │ │ │ │ +235 template │ │ │ │ +_2_3_6 struct ConstructionTraits<_S_e_q_S_O_R > │ │ │ │ +237 { │ │ │ │ +_2_3_8 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ +239 │ │ │ │ +_2_4_0 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +241 { │ │ │ │ +242 return std::make_shared> │ │ │ │ +243 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, args._g_e_t_A_r_g_s │ │ │ │ +()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ +244 } │ │ │ │ +245 }; │ │ │ │ +246 │ │ │ │ +247 │ │ │ │ +251 template │ │ │ │ +_2_5_2 struct ConstructionTraits<_S_e_q_J_a_c > │ │ │ │ +253 { │ │ │ │ +_2_5_4 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_J_a_c_<_M_,_X_,_Y_,_l_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ +255 │ │ │ │ +_2_5_6 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +257 { │ │ │ │ +258 return std::make_shared> │ │ │ │ +259 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, args._g_e_t_A_r_g_s │ │ │ │ +()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ +260 } │ │ │ │ +261 }; │ │ │ │ +262 │ │ │ │ +266 template │ │ │ │ +_2_6_7 struct ConstructionTraits<_R_i_c_h_a_r_d_s_o_n > │ │ │ │ +268 { │ │ │ │ +_2_6_9 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_R_i_c_h_a_r_d_s_o_n_<_X_,_Y_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ +270 │ │ │ │ +_2_7_1 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +272 { │ │ │ │ +273 return std::make_shared> │ │ │ │ +274 (args._g_e_t_A_r_g_s()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ +275 } │ │ │ │ +276 }; │ │ │ │ +277 │ │ │ │ +278 │ │ │ │ +279 template │ │ │ │ +_2_8_0 class _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s<_S_e_q_I_L_U > │ │ │ │ +281 : public _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s > │ │ │ │ +282 { │ │ │ │ +283 public: │ │ │ │ +_2_8_4 _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s(int n=0) │ │ │ │ +285 : n_(n) │ │ │ │ +286 {} │ │ │ │ +287 │ │ │ │ +_2_8_8 void _s_e_t_N(int n) │ │ │ │ +289 { │ │ │ │ +290 n_ = n; │ │ │ │ +291 } │ │ │ │ +292 │ │ │ │ +_2_9_3 int _g_e_t_N() │ │ │ │ +294 { │ │ │ │ +295 return n_; │ │ │ │ +296 } │ │ │ │ +297 │ │ │ │ +298 private: │ │ │ │ +299 int n_; │ │ │ │ +300 }; │ │ │ │ +301 │ │ │ │ +302 │ │ │ │ +306 template │ │ │ │ +_3_0_7 struct ConstructionTraits<_S_e_q_I_L_U > │ │ │ │ +308 { │ │ │ │ +_3_0_9 typedef _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_I_L_U_<_M_,_X_,_Y_> > _A_r_g_u_m_e_n_t_s; │ │ │ │ +310 │ │ │ │ +_3_1_1 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +312 { │ │ │ │ +313 return std::make_shared> │ │ │ │ +314 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_N(), args._g_e_t_A_r_g_s()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r); │ │ │ │ +315 } │ │ │ │ +316 }; │ │ │ │ 317 │ │ │ │ -318 // Reset the visited flags │ │ │ │ -319 for(Iterator vertex=fineGraph.begin(); vertex != end; ++vertex) │ │ │ │ -320 put(visitedMap, *vertex, false); │ │ │ │ -321 } │ │ │ │ -322 │ │ │ │ -323 template │ │ │ │ -324 template │ │ │ │ -325 void ParallelIndicesCoarsener::buildCoarseRemoteIndices(const │ │ │ │ -RemoteIndices& fineRemote, │ │ │ │ -326 const AggregatesMap& aggregates, │ │ │ │ -327 ParallelIndexSet& coarseIndices, │ │ │ │ -328 RemoteIndices& coarseRemote, │ │ │ │ -329 ParallelAggregateRenumberer& renumberer, │ │ │ │ -330 bool useFixedOrder) │ │ │ │ -331 { │ │ │ │ -332 std::vector attributes(static_cast(renumberer)); │ │ │ │ +321 template │ │ │ │ +_3_2_2 struct ConstructionTraits<_P_a_r_S_S_O_R > │ │ │ │ +323 { │ │ │ │ +_3_2_4 typedef _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_M_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +325 │ │ │ │ +_3_2_6 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +327 { │ │ │ │ +328 return std::make_shared> │ │ │ │ +329 (args._g_e_t_M_a_t_r_i_x(), args._g_e_t_A_r_g_s()._i_t_e_r_a_t_i_o_n_s, │ │ │ │ +330 args._g_e_t_A_r_g_s()._r_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r, args._g_e_t_C_o_m_m()); │ │ │ │ +331 } │ │ │ │ +332 }; │ │ │ │ 333 │ │ │ │ -334 GlobalLookupIndexSet coarseLookup(coarseIndices, │ │ │ │ -static_cast(renumberer)); │ │ │ │ -335 │ │ │ │ -336 typedef typename RemoteIndices::const_iterator Iterator; │ │ │ │ -337 Iterator end = fineRemote.end(); │ │ │ │ -338 │ │ │ │ -339 for(Iterator neighbour = fineRemote.begin(); │ │ │ │ -340 neighbour != end; ++neighbour) { │ │ │ │ -341 int process = neighbour->first; │ │ │ │ -342 │ │ │ │ -343 assert(neighbour->second.first==neighbour->second.second); │ │ │ │ -344 │ │ │ │ -345 // Mark all as not known │ │ │ │ -346 typedef typename std::vector::iterator CIterator; │ │ │ │ -347 │ │ │ │ -348 for(CIterator iter=attributes.begin(); iter!= attributes.end(); ++iter) │ │ │ │ -349 *iter = std::numeric_limits::max(); │ │ │ │ -350 │ │ │ │ -351 auto riEnd = neighbour->second.second->end(); │ │ │ │ -352 │ │ │ │ -353 for(auto index = neighbour->second.second->begin(); │ │ │ │ -354 index != riEnd; ++index) { │ │ │ │ -355 if(!E::contains(index->localIndexPair().local().attribute()) && │ │ │ │ -356 aggregates[index->localIndexPair().local()] != │ │ │ │ -357 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ -358 { │ │ │ │ -359 assert(aggregates[index->localIndexPair().local()]localIndexPair().local()]] != 3) │ │ │ │ -361 attributes[aggregates[index->localIndexPair().local()]] = index->attribute │ │ │ │ -(); │ │ │ │ -362 } │ │ │ │ -363 } │ │ │ │ -364 │ │ │ │ -365 // Build remote index list │ │ │ │ -366 typedef RemoteIndexListModifier Modifier; │ │ │ │ -367 typedef typename RemoteIndices::RemoteIndex RemoteIndex; │ │ │ │ -368 typedef typename ParallelIndexSet::const_iterator IndexIterator; │ │ │ │ -369 │ │ │ │ -370 Modifier coarseList = coarseRemote.template getModifier │ │ │ │ -(process); │ │ │ │ -371 │ │ │ │ -372 IndexIterator iend = coarseIndices.end(); │ │ │ │ -373 for(IndexIterator index = coarseIndices.begin(); index != iend; ++index) │ │ │ │ -374 if(attributes[index->local()] != std::numeric_limits::max()) { │ │ │ │ -375 // remote index is present │ │ │ │ -376 coarseList.insert(RemoteIndex(Attribute(attributes[index->local()]), & │ │ │ │ -(*index))); │ │ │ │ -377 } │ │ │ │ -378 //std::cout< syncer(coarseIndices, coarseRemote); │ │ │ │ -387 syncer.sync(renumberer, useFixedOrder); │ │ │ │ -388 │ │ │ │ -389 } │ │ │ │ -390 │ │ │ │ -391#endif │ │ │ │ -392 │ │ │ │ -393 template │ │ │ │ -394 template │ │ │ │ -395 typename Graph::VertexDescriptor │ │ │ │ -_3_9_6 _I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_,_E_>_:_:_c_o_a_r_s_e_n( │ │ │ │ -397 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& fineInfo, │ │ │ │ -398 [[maybe_unused]] Graph& fineGraph, │ │ │ │ -399 [[maybe_unused]] VM& visitedMap, │ │ │ │ -400 [[maybe_unused]] _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& │ │ │ │ -aggregates, │ │ │ │ -401 [[maybe_unused]] _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& coarseInfo, │ │ │ │ -402 [[maybe_unused]] typename Graph::VertexDescriptor noAggregates, │ │ │ │ -403 [[maybe_unused]] bool useFixedOrder) │ │ │ │ -404 { │ │ │ │ -405 return noAggregates; │ │ │ │ -406 } │ │ │ │ -407 │ │ │ │ -408 } //namespace Amg │ │ │ │ -409} // namespace Dune │ │ │ │ -410#endif │ │ │ │ -_r_e_n_u_m_b_e_r_e_r_._h_h │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ -_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ -Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_r_e_s_e_t │ │ │ │ -void reset() │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:149 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_A_t_t_r_i_b_u_t_e │ │ │ │ -LocalIndex::Attribute Attribute │ │ │ │ -The type of the attribute. │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:70 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -void operator()(const typename G::ConstEdgeIterator &edge) │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:121 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_i_s_P_u_b_l_i_c │ │ │ │ -void isPublic(bool b) │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:144 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ -ParallelInformation::ParallelIndexSet ParallelIndexSet │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:55 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_i_s_P_u_b_l_i_c │ │ │ │ -bool isPublic() │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:139 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ -ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ -The type of the local index. │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:65 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -T ParallelInformation │ │ │ │ -The type of the parallel information. │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:53 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_a_t_t_r_i_b_u_t_e │ │ │ │ -Attribute attribute() │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:160 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_l_l_e_l_I_n_d_i_c_e_s_C_o_a_r_s_e_n_e_r_:_:_P_a_r_a_l_l_e_l_A_g_g_r_e_g_a_t_e_R_e_n_u_m_b_e_r_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ -Vertex operator()(const GlobalIndex &global) │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:132 │ │ │ │ +334 template │ │ │ │ +_3_3_5 struct ConstructionTraits<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ +336 { │ │ │ │ +_3_3_7 typedef _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_T_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +_3_3_8 typedef ConstructionTraits _S_e_q_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s; │ │ │ │ +_3_3_9 static inline std::shared_ptr> _c_o_n_s_t_r_u_c_t │ │ │ │ +(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +340 { │ │ │ │ +341 auto seqPrec = SeqConstructionTraits::construct(args); │ │ │ │ +342 return std::make_shared> (seqPrec, │ │ │ │ +args._g_e_t_C_o_m_m()); │ │ │ │ +343 } │ │ │ │ +344 }; │ │ │ │ +345 │ │ │ │ +346 template │ │ │ │ +_3_4_7 struct ConstructionTraits<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > │ │ │ │ +348 { │ │ │ │ +_3_4_9 typedef _D_e_f_a_u_l_t_P_a_r_a_l_l_e_l_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_T_,_C_> _A_r_g_u_m_e_n_t_s; │ │ │ │ +_3_5_0 typedef ConstructionTraits _S_e_q_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s; │ │ │ │ +_3_5_1 static inline std::shared_ptr> │ │ │ │ +_c_o_n_s_t_r_u_c_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ +352 { │ │ │ │ +353 auto seqPrec = SeqConstructionTraits::construct(args); │ │ │ │ +354 return std::make_shared> (seqPrec, │ │ │ │ +args._g_e_t_C_o_m_m()); │ │ │ │ +355 } │ │ │ │ +356 }; │ │ │ │ +357 │ │ │ │ +368 template │ │ │ │ +_3_6_9 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r │ │ │ │ +370 { │ │ │ │ +_3_7_1 typedef T _S_m_o_o_t_h_e_r; │ │ │ │ +_3_7_2 typedef typename Smoother::range_type _R_a_n_g_e; │ │ │ │ +_3_7_3 typedef typename Smoother::domain_type _D_o_m_a_i_n; │ │ │ │ +374 │ │ │ │ +_3_8_2 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ +383 { │ │ │ │ +384 smoother.apply(v,d); │ │ │ │ +385 } │ │ │ │ +386 │ │ │ │ +_3_9_4 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ +395 { │ │ │ │ +396 smoother.apply(v,d); │ │ │ │ +397 } │ │ │ │ +398 }; │ │ │ │ +399 │ │ │ │ +405 template │ │ │ │ +_4_0_6 void _p_r_e_s_m_o_o_t_h(LevelContext& levelContext, size_t steps) │ │ │ │ +407 { │ │ │ │ +408 for(std::size_t i=0; i < steps; ++i) { │ │ │ │ +409 *levelContext.lhs=0; │ │ │ │ +410 _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_t_y_p_e_n_a_m_e_ _L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e_> │ │ │ │ +411_ _:_:_p_r_e_S_m_o_o_t_h(*levelContext.smoother, *levelContext.lhs, │ │ │ │ +412 *levelContext.rhs); │ │ │ │ +413 // Accumulate update │ │ │ │ +414 *levelContext.update += *levelContext.lhs; │ │ │ │ +415 │ │ │ │ +416 // update defect │ │ │ │ +417 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, │ │ │ │ +*levelContext.rhs); │ │ │ │ +418 levelContext.pinfo->project(*levelContext.rhs); │ │ │ │ +419 } │ │ │ │ +420 } │ │ │ │ +421 │ │ │ │ +427 template │ │ │ │ +_4_2_8 void _p_o_s_t_s_m_o_o_t_h(LevelContext& levelContext, size_t steps) │ │ │ │ +429 { │ │ │ │ +430 for(std::size_t i=0; i < steps; ++i) { │ │ │ │ +431 // update defect │ │ │ │ +432 levelContext.matrix->applyscaleadd(-1, *levelContext.lhs, │ │ │ │ +433 *levelContext.rhs); │ │ │ │ +434 *levelContext.lhs=0; │ │ │ │ +435 levelContext.pinfo->project(*levelContext.rhs); │ │ │ │ +436 _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r_<_t_y_p_e_n_a_m_e_ _L_e_v_e_l_C_o_n_t_e_x_t_:_:_S_m_o_o_t_h_e_r_T_y_p_e_> │ │ │ │ +437_ _:_:_p_o_s_t_S_m_o_o_t_h(*levelContext.smoother, *levelContext.lhs, *levelContext.rhs); │ │ │ │ +438 // Accumulate update │ │ │ │ +439 *levelContext.update += *levelContext.lhs; │ │ │ │ +440 } │ │ │ │ +441 } │ │ │ │ +442 │ │ │ │ +443 template │ │ │ │ +_4_4_4 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_S_e_q_S_O_R > │ │ │ │ +445 { │ │ │ │ +_4_4_6 typedef _S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> _S_m_o_o_t_h_e_r; │ │ │ │ +_4_4_7 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ +_4_4_8 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ +449 │ │ │ │ +_4_5_0 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ +451 { │ │ │ │ +452 smoother.template apply(v,d); │ │ │ │ +453 } │ │ │ │ +454 │ │ │ │ +455 │ │ │ │ +_4_5_6 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ +457 { │ │ │ │ +458 smoother.template apply(v,d); │ │ │ │ +459 } │ │ │ │ +460 }; │ │ │ │ +461 │ │ │ │ +462 template │ │ │ │ +_4_6_3 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r > > │ │ │ │ +464 { │ │ │ │ +_4_6_5 typedef _B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_,_C_,_S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> > _S_m_o_o_t_h_e_r; │ │ │ │ +_4_6_6 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ +_4_6_7 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ +468 │ │ │ │ +_4_6_9 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ +470 { │ │ │ │ +471 smoother.template apply(v,d); │ │ │ │ +472 } │ │ │ │ +473 │ │ │ │ +474 │ │ │ │ +_4_7_5 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ +476 { │ │ │ │ +477 smoother.template apply(v,d); │ │ │ │ +478 } │ │ │ │ +479 }; │ │ │ │ +480 │ │ │ │ +481 template │ │ │ │ +_4_8_2 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +> > │ │ │ │ +483 { │ │ │ │ +_4_8_4 typedef _N_o_n_o_v_e_r_l_a_p_p_i_n_g_B_l_o_c_k_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_C_,_S_e_q_S_O_R_<_M_,_X_,_Y_,_l_> > _S_m_o_o_t_h_e_r; │ │ │ │ +_4_8_5 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ +_4_8_6 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ +487 │ │ │ │ +_4_8_8 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ +489 { │ │ │ │ +490 smoother.template apply(v,d); │ │ │ │ +491 } │ │ │ │ +492 │ │ │ │ +493 │ │ │ │ +_4_9_4 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, _R_a_n_g_e& d) │ │ │ │ +495 { │ │ │ │ +496 smoother.template apply(v,d); │ │ │ │ +497 } │ │ │ │ +498 }; │ │ │ │ +499 │ │ │ │ +500 } // end namespace Amg │ │ │ │ +501 │ │ │ │ +502 // forward declarations │ │ │ │ +503 template │ │ │ │ +504 class SeqOverlappingSchwarz; │ │ │ │ +505 │ │ │ │ +506 struct MultiplicativeSchwarzMode; │ │ │ │ +507 │ │ │ │ +508 namespace Amg │ │ │ │ +509 { │ │ │ │ +510 template │ │ │ │ +_5_1_1 struct _S_m_o_o_t_h_e_r_A_p_p_l_i_e_r<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z > │ │ │ │ +513 { │ │ │ │ +_5_1_4 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_M_u_l_t_i_p_l_i_c_a_t_i_v_e_S_c_h_w_a_r_z_M_o_d_e_,_M_S_,_T_A_> │ │ │ │ +_S_m_o_o_t_h_e_r; │ │ │ │ +_5_1_5 typedef typename _S_m_o_o_t_h_e_r_:_:_r_a_n_g_e___t_y_p_e _R_a_n_g_e; │ │ │ │ +_5_1_6 typedef typename _S_m_o_o_t_h_e_r_:_:_d_o_m_a_i_n___t_y_p_e _D_o_m_a_i_n; │ │ │ │ +517 │ │ │ │ +_5_1_8 static void _p_r_e_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ +519 { │ │ │ │ +520 smoother.template apply(v,d); │ │ │ │ +521 } │ │ │ │ +522 │ │ │ │ +523 │ │ │ │ +_5_2_4 static void _p_o_s_t_S_m_o_o_t_h(_S_m_o_o_t_h_e_r& smoother, _D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ +525 { │ │ │ │ +526 smoother.template apply(v,d); │ │ │ │ +527 │ │ │ │ +528 } │ │ │ │ +529 }; │ │ │ │ +530 │ │ │ │ +531 // template │ │ │ │ +532 // class SeqOverlappingSchwarz; │ │ │ │ +533 │ │ │ │ +534 template │ │ │ │ +_5_3_5 struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +536 : public _D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ +537 { │ │ │ │ +_5_3_8 enum _O_v_e_r_l_a_p {_v_e_r_t_e_x, _a_g_g_r_e_g_a_t_e, _p_a_i_r_w_i_s_e, _n_o_n_e}; │ │ │ │ +539 │ │ │ │ +_5_4_0 _O_v_e_r_l_a_p _o_v_e_r_l_a_p; │ │ │ │ +_5_4_1 bool _o_n_t_h_e_f_l_y; │ │ │ │ +542 │ │ │ │ +_5_4_3 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s(_O_v_e_r_l_a_p overlap_=_v_e_r_t_e_x, │ │ │ │ +544 bool onthefly_=false) │ │ │ │ +545 : _o_v_e_r_l_a_p(overlap_), _o_n_t_h_e_f_l_y(onthefly_) │ │ │ │ +546 {} │ │ │ │ +547 }; │ │ │ │ +548 │ │ │ │ +549 template │ │ │ │ +_5_5_0 struct _S_m_o_o_t_h_e_r_T_r_a_i_t_s<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z > │ │ │ │ +551 { │ │ │ │ +_5_5_2 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _M_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ +_A_r_g_u_m_e_n_t_s; │ │ │ │ +553 }; │ │ │ │ +554 │ │ │ │ +555 template │ │ │ │ +_5_5_6 class _C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z > │ │ │ │ +557 : public _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s > │ │ │ │ +558 { │ │ │ │ +559 typedef _D_e_f_a_u_l_t_C_o_n_s_t_r_u_c_t_i_o_n_A_r_g_s_<_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_T_M_,_T_S_,_T_A_> > │ │ │ │ +_F_a_t_h_e_r; │ │ │ │ +560 │ │ │ │ +561 public: │ │ │ │ +_5_6_2 typedef typename _M_a_t_r_i_x_G_r_a_p_h_<_M_>_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +_5_6_3 typedef _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_> _A_g_g_r_e_g_a_t_e_s_M_a_p; │ │ │ │ +_5_6_4 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +_5_6_5 typedef typename _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_<_M_,_X_,_T_M_,_T_S_,_T_A_>_:_:_s_u_b_d_o_m_a_i_n___v_e_c_t_o_r │ │ │ │ +_V_e_c_t_o_r; │ │ │ │ +_5_6_6 typedef typename Vector::value_type _S_u_b_d_o_m_a_i_n; │ │ │ │ +567 │ │ │ │ +_5_6_8 virtual void _s_e_t_M_a_t_r_i_x(const M& matrix, const _A_g_g_r_e_g_a_t_e_s_M_a_p& amap) │ │ │ │ +569 { │ │ │ │ +570 Father::setMatrix(matrix); │ │ │ │ +571 │ │ │ │ +572 std::vector visited(amap._n_o_V_e_r_t_i_c_e_s(), false); │ │ │ │ +573 typedef IteratorPropertyMap::iterator,IdentityMap> │ │ │ │ +VisitedMapType; │ │ │ │ +574 VisitedMapType visitedMap(visited.begin()); │ │ │ │ +575 │ │ │ │ +576 _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_> graph(matrix); │ │ │ │ +577 │ │ │ │ +578 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _M_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ +_S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ +579 │ │ │ │ +580 switch(Father::getArgs().overlap) { │ │ │ │ +581 case SmootherArgs::vertex : │ │ │ │ +582 { │ │ │ │ +583 VertexAdder visitor(subdomains, amap); │ │ │ │ +584 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ +585 } │ │ │ │ +586 break; │ │ │ │ +587 case SmootherArgs::pairwise : │ │ │ │ +588 { │ │ │ │ +589 createPairDomains(graph); │ │ │ │ +590 } │ │ │ │ +591 break; │ │ │ │ +592 case SmootherArgs::aggregate : │ │ │ │ +593 { │ │ │ │ +594 AggregateAdder visitor(subdomains, amap, graph, │ │ │ │ +visitedMap); │ │ │ │ +595 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ +596 } │ │ │ │ +597 break; │ │ │ │ +598 case SmootherArgs::none : │ │ │ │ +599 NoneAdder visitor; │ │ │ │ +600 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ +601 break; │ │ │ │ +602 default : │ │ │ │ +603 DUNE_THROW(NotImplemented, "This overlapping scheme is not supported!"); │ │ │ │ +604 } │ │ │ │ +605 } │ │ │ │ +_6_0_6 void _s_e_t_M_a_t_r_i_x(const M& matrix) │ │ │ │ +607 { │ │ │ │ +608 Father::setMatrix(matrix); │ │ │ │ +609 │ │ │ │ +610 /* Create aggregates map where each aggregate is just one vertex. */ │ │ │ │ +611 _A_g_g_r_e_g_a_t_e_s_M_a_p amap(matrix.N()); │ │ │ │ +612 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r v=0; │ │ │ │ +613 for(typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_i_t_e_r_a_t_o_r iter=amap._b_e_g_i_n(); │ │ │ │ +614 iter!=amap._e_n_d(); ++iter) │ │ │ │ +615 *iter=v++; │ │ │ │ +616 │ │ │ │ +617 std::vector visited(amap._n_o_V_e_r_t_i_c_e_s(), false); │ │ │ │ +618 typedef IteratorPropertyMap::iterator,IdentityMap> │ │ │ │ +VisitedMapType; │ │ │ │ +619 VisitedMapType visitedMap(visited.begin()); │ │ │ │ +620 │ │ │ │ +621 _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_> graph(matrix); │ │ │ │ +622 │ │ │ │ +623 typedef _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_S_m_o_o_t_h_e_r_A_r_g_s_<_t_y_p_e_n_a_m_e_ _M_:_:_f_i_e_l_d___t_y_p_e_> │ │ │ │ +_S_m_o_o_t_h_e_r_A_r_g_s; │ │ │ │ +624 │ │ │ │ +625 switch(Father::getArgs().overlap) { │ │ │ │ +626 case SmootherArgs::vertex : │ │ │ │ +627 { │ │ │ │ +628 VertexAdder visitor(subdomains, amap); │ │ │ │ +629 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ +630 } │ │ │ │ +631 break; │ │ │ │ +632 case SmootherArgs::aggregate : │ │ │ │ +633 { │ │ │ │ +634 DUNE_THROW(NotImplemented, "Aggregate overlap is not supported yet"); │ │ │ │ +635 /* │ │ │ │ +636 AggregateAdder visitor(subdomains, amap, graph, │ │ │ │ +visitedMap); │ │ │ │ +637 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ +638 */ │ │ │ │ +639 } │ │ │ │ +640 break; │ │ │ │ +641 case SmootherArgs::pairwise : │ │ │ │ +642 { │ │ │ │ +643 createPairDomains(graph); │ │ │ │ +644 } │ │ │ │ +645 break; │ │ │ │ +646 case SmootherArgs::none : │ │ │ │ +647 NoneAdder visitor; │ │ │ │ +648 createSubdomains(matrix, graph, amap, visitor, visitedMap); │ │ │ │ +649 │ │ │ │ +650 } │ │ │ │ +651 } │ │ │ │ +652 │ │ │ │ +_6_5_3 const _V_e_c_t_o_r& _g_e_t_S_u_b_D_o_m_a_i_n_s() │ │ │ │ +654 { │ │ │ │ +655 return subdomains; │ │ │ │ +656 } │ │ │ │ +657 │ │ │ │ +658 private: │ │ │ │ +659 struct VertexAdder │ │ │ │ +660 { │ │ │ │ +_6_6_1 _V_e_r_t_e_x_A_d_d_e_r(_V_e_c_t_o_r& subdomains_, const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates_) │ │ │ │ +662 : subdomains(subdomains_), max(-1), subdomain(-1), aggregates(aggregates_) │ │ │ │ +663 {} │ │ │ │ +664 template │ │ │ │ +_6_6_5 void _o_p_e_r_a_t_o_r_(_)(const T& edge) │ │ │ │ +666 { │ │ │ │ +667 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) │ │ │ │ +668 subdomains[subdomain].insert(edge.target()); │ │ │ │ +669 } │ │ │ │ +_6_7_0 int _s_e_t_A_g_g_r_e_g_a_t_e(const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate_) │ │ │ │ +671 { │ │ │ │ +672 subdomain=aggregate_; │ │ │ │ +673 max = std::max(subdomain, aggregate_); │ │ │ │ +674 return subdomain; │ │ │ │ +675 } │ │ │ │ +_6_7_6 int _n_o_S_u_b_d_o_m_a_i_n_s() const │ │ │ │ +677 { │ │ │ │ +678 return max+1; │ │ │ │ +679 } │ │ │ │ +680 private: │ │ │ │ +681 _V_e_c_t_o_r& subdomains; │ │ │ │ +682 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r max; │ │ │ │ +683 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r subdomain; │ │ │ │ +684 const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates; │ │ │ │ +685 }; │ │ │ │ +686 struct NoneAdder │ │ │ │ +687 { │ │ │ │ +688 template │ │ │ │ +_6_8_9 void _o_p_e_r_a_t_o_r_(_)(const T& edge) │ │ │ │ +690 {} │ │ │ │ +_6_9_1 int _s_e_t_A_g_g_r_e_g_a_t_e(const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate_) │ │ │ │ +692 { │ │ │ │ +693 return -1; │ │ │ │ +694 } │ │ │ │ +_6_9_5 int _n_o_S_u_b_d_o_m_a_i_n_s() const │ │ │ │ +696 { │ │ │ │ +697 return -1; │ │ │ │ +698 } │ │ │ │ +699 }; │ │ │ │ +700 │ │ │ │ +701 template │ │ │ │ +702 struct AggregateAdder │ │ │ │ +703 { │ │ │ │ +_7_0_4 _A_g_g_r_e_g_a_t_e_A_d_d_e_r(_V_e_c_t_o_r& subdomains_, const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates_, │ │ │ │ +705 const _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>& graph_, VM& visitedMap_) │ │ │ │ +706 : subdomains(subdomains_), subdomain(-1), aggregates(aggregates_), │ │ │ │ +707 adder(subdomains_, aggregates_), graph(graph_), visitedMap(visitedMap_) │ │ │ │ +708 {} │ │ │ │ +709 template │ │ │ │ +_7_1_0 void _o_p_e_r_a_t_o_r_(_)(const T& edge) │ │ │ │ +711 { │ │ │ │ +712 subdomains[subdomain].insert(edge.target()); │ │ │ │ +713 // If we (the neighbouring vertex of the aggregate) │ │ │ │ +714 // are not isolated, add the aggregate we belong to │ │ │ │ +715 // to the same subdomain using the OneOverlapAdder │ │ │ │ +716 if(aggregates[edge.target()]!=AggregatesMap::ISOLATED) { │ │ │ │ +717 assert(aggregates[edge.target()]!=aggregate); │ │ │ │ +718 typename _A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x_L_i_s_t vlist; │ │ │ │ +719 aggregates.template breadthFirstSearch(edge.target(), │ │ │ │ +aggregate, │ │ │ │ +720 graph, vlist, adder, adder, │ │ │ │ +721 visitedMap); │ │ │ │ +722 } │ │ │ │ +723 } │ │ │ │ +724 │ │ │ │ +_7_2_5 int _s_e_t_A_g_g_r_e_g_a_t_e(const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate_) │ │ │ │ +726 { │ │ │ │ +727 adder.setAggregate(aggregate_); │ │ │ │ +728 aggregate=aggregate_; │ │ │ │ +729 return ++subdomain; │ │ │ │ +730 } │ │ │ │ +_7_3_1 int _n_o_S_u_b_d_o_m_a_i_n_s() const │ │ │ │ +732 { │ │ │ │ +733 return subdomain+1; │ │ │ │ +734 } │ │ │ │ +735 │ │ │ │ +736 private: │ │ │ │ +737 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r aggregate; │ │ │ │ +738 _V_e_c_t_o_r& subdomains; │ │ │ │ +739 int subdomain; │ │ │ │ +740 const _A_g_g_r_e_g_a_t_e_s_M_a_p& aggregates; │ │ │ │ +741 VertexAdder adder; │ │ │ │ +742 const _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>& graph; │ │ │ │ +743 VM& visitedMap; │ │ │ │ +744 }; │ │ │ │ +745 │ │ │ │ +746 void createPairDomains(const _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>& graph) │ │ │ │ +747 { │ │ │ │ +748 typedef typename _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r VIter; │ │ │ │ +749 typedef typename _M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_>_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r EIter; │ │ │ │ +750 typedef typename M::size_type size_type; │ │ │ │ +751 │ │ │ │ +752 std::set > pairs; │ │ │ │ +753 int total=0; │ │ │ │ +754 for(VIter v=graph._b_e_g_i_n(), ve=graph._e_n_d(); ve != v; ++v) │ │ │ │ +755 for(EIter e = v.begin(), ee=v.end(); ee!=e; ++e) │ │ │ │ +756 { │ │ │ │ +757 ++total; │ │ │ │ +758 if(e.source() >::const_iterator │ │ │ │ +SIter; │ │ │ │ +768 typename Vector::iterator subdomain=subdomains.begin(); │ │ │ │ +769 │ │ │ │ +770 for(SIter s=pairs.begin(), se =pairs.end(); se!=s; ++s) │ │ │ │ +771 { │ │ │ │ +772 subdomain->insert(s->first); │ │ │ │ +773 subdomain->insert(s->second); │ │ │ │ +774 ++subdomain; │ │ │ │ +775 } │ │ │ │ +776 std::size_t minsize=10000; │ │ │ │ +777 std::size_t maxsize=0; │ │ │ │ +778 int sum=0; │ │ │ │ +779 for(typename Vector::size_type i=0; i < subdomains.size(); ++i) { │ │ │ │ +780 sum+=subdomains[i].size(); │ │ │ │ +781 minsize=std::min(minsize, subdomains[i].size()); │ │ │ │ +782 maxsize=std::max(maxsize, subdomains[i].size()); │ │ │ │ +783 } │ │ │ │ +784 Dune::dinfo<<"Subdomain size: min="< │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: hierarchy.hh File Reference │ │ │ +dune-istl: dilu.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,56 +65,56 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Functions
│ │ │ +
dilu.hh File Reference
│ │ │ │ │ │
│ │ │ │ │ │ -

Provides a classes representing the hierarchies in AMG. │ │ │ +

The diagonal incomplete LU factorization kernels. │ │ │ More...

│ │ │ -
#include <list>
│ │ │ -#include <memory>
│ │ │ -#include <limits>
│ │ │ -#include <dune/common/stdstreams.hh>
│ │ │ -#include <dune/common/timer.hh>
│ │ │ -#include <dune/common/bigunsignedint.hh>
│ │ │ -#include <dune/istl/paamg/construction.hh>
│ │ │ +
#include <cmath>
│ │ │ +#include <complex>
│ │ │ +#include <map>
│ │ │ +#include <vector>
│ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ +#include "istlexception.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Classes

class  Dune::Amg::Hierarchy< T, A >
 A hierarchy of containers (e.g. matrices or vectors) More...
 
class  Dune::Amg::Hierarchy< T, A >::LevelIterator< C, T1 >
 Iterator over the levels in the hierarchy. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
namespace  Dune::DILU
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<class M >
void Dune::DILU::blockDILUDecomposition (M &A, std::vector< typename M::block_type > &Dinv_)
 
template<class M , class X , class Y >
void Dune::DILU::blockDILUBacksolve (const M &A, const std::vector< typename M::block_type > Dinv_, X &v, const Y &d)
 
│ │ │

Detailed Description

│ │ │ -

Provides a classes representing the hierarchies in AMG.

│ │ │ -
Author
Markus Blatt
│ │ │ +

The diagonal incomplete LU factorization kernels.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,38 +1,36 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -hierarchy.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides a classes representing the hierarchies in AMG. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +dilu.hh File Reference │ │ │ │ +The diagonal incomplete LU factorization kernels. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ -CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _T_,_ _A_ _> │ │ │ │ -  A hierarchy of containers (e.g. matrices or vectors) _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _T_,_ _A_ _>_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_<_ _C_,_ _T_1_ _> │ │ │ │ -  Iterator over the levels in the hierarchy. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +namespace   _D_u_n_e_:_:_D_I_L_U │ │ │ │ +  │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +void  _D_u_n_e_:_:_D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n (M &A, std::vector< typename M:: │ │ │ │ + block_type > &Dinv_) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +void  _D_u_n_e_:_:_D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_B_a_c_k_s_o_l_v_e (const M &A, const std::vector< typename │ │ │ │ + M::block_type > Dinv_, X &v, const Y &d) │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ +The diagonal incomplete LU factorization kernels. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: hierarchy.hh Source File │ │ │ +dune-istl: dilu.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,423 +70,150 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
hierarchy.hh
│ │ │ +
dilu.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMGHIERARCHY_HH
│ │ │ -
6#define DUNE_AMGHIERARCHY_HH
│ │ │ +
5#ifndef DUNE_ISTL_DILU_HH
│ │ │ +
6#define DUNE_ISTL_DILU_HH
│ │ │
7
│ │ │ -
8#include <list>
│ │ │ -
9#include <memory>
│ │ │ -
10#include <limits>
│ │ │ -
11#include <dune/common/stdstreams.hh>
│ │ │ -
12#include <dune/common/timer.hh>
│ │ │ -
13#include <dune/common/bigunsignedint.hh>
│ │ │ - │ │ │ -
15
│ │ │ -
16namespace Dune
│ │ │ -
17{
│ │ │ -
18 namespace Amg
│ │ │ -
19 {
│ │ │ -
38 template<typename T, typename A=std::allocator<T> >
│ │ │ -
│ │ │ - │ │ │ -
40 {
│ │ │ -
41 public:
│ │ │ -
45 typedef T MemberType;
│ │ │ -
46
│ │ │ -
47 template<typename T1, typename T2>
│ │ │ -
48 class LevelIterator;
│ │ │ -
49
│ │ │ -
50 private:
│ │ │ -
54 struct Element
│ │ │ +
8#include <cmath>
│ │ │ +
9#include <complex>
│ │ │ +
10#include <map>
│ │ │ +
11#include <vector>
│ │ │ +
12
│ │ │ +
13#include <dune/common/fmatrix.hh>
│ │ │ +
14#include <dune/common/scalarvectorview.hh>
│ │ │ +
15#include <dune/common/scalarmatrixview.hh>
│ │ │ +
16
│ │ │ +
17#include "istlexception.hh"
│ │ │ +
18
│ │ │ +
23namespace Dune
│ │ │ +
24{
│ │ │ +
25
│ │ │ +
│ │ │ +
30 namespace DILU
│ │ │ +
31 {
│ │ │ +
32
│ │ │ +
50 template <class M>
│ │ │ +
│ │ │ +
51 void blockDILUDecomposition(M &A, std::vector<typename M::block_type> &Dinv_)
│ │ │ +
52 {
│ │ │ +
53 auto endi = A.end();
│ │ │ +
54 for (auto row = A.begin(); row != endi; ++row)
│ │ │
55 {
│ │ │ -
56 friend class LevelIterator<Hierarchy<T,A>, T>;
│ │ │ -
57 friend class LevelIterator<const Hierarchy<T,A>, const T>;
│ │ │ -
58
│ │ │ -
60 std::weak_ptr<Element> coarser_;
│ │ │ +
56 const auto row_i = row.index();
│ │ │ +
57 const auto col = row->find(row_i);
│ │ │ +
58 // initialise Dinv[i] = A[i, i]
│ │ │ +
59 Dinv_[row_i] = *col;
│ │ │ +
60 }
│ │ │
61
│ │ │ -
63 std::shared_ptr<Element> finer_;
│ │ │ -
64
│ │ │ -
66 std::shared_ptr<MemberType> element_;
│ │ │ -
67
│ │ │ -
69 std::shared_ptr<MemberType> redistributed_;
│ │ │ -
70 };
│ │ │ -
71 public:
│ │ │ -
72
│ │ │ -
76 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<Element>;
│ │ │ -
77
│ │ │ - │ │ │ -
79
│ │ │ -
│ │ │ -
84 Hierarchy(const std::shared_ptr<MemberType> & first);
│ │ │ -
85
│ │ │ -
│ │ │ -
89 Hierarchy() : levels_(0)
│ │ │ -
90 {}
│ │ │ -
│ │ │ -
91
│ │ │ -
│ │ │ -
95 Hierarchy(const Hierarchy& other);
│ │ │ -
96
│ │ │ -
│ │ │ - │ │ │ -
102
│ │ │ -
│ │ │ - │ │ │ -
104
│ │ │ -
│ │ │ -
109 void addFiner(Arguments& args);
│ │ │ -
110
│ │ │ -
117 template<class C, class T1>
│ │ │ -
│ │ │ - │ │ │ -
119 : public BidirectionalIteratorFacade<LevelIterator<C,T1>,T1,T1&>
│ │ │ -
120 {
│ │ │ -
121 friend class LevelIterator<typename std::remove_const<C>::type,
│ │ │ -
122 typename std::remove_const<T1>::type >;
│ │ │ -
123 friend class LevelIterator<const typename std::remove_const<C>::type,
│ │ │ -
124 const typename std::remove_const<T1>::type >;
│ │ │ -
125
│ │ │ -
126 public:
│ │ │ -
│ │ │ - │ │ │ -
129 {}
│ │ │ -
│ │ │ -
130
│ │ │ -
│ │ │ -
131 LevelIterator(std::shared_ptr<Element> element)
│ │ │ -
132 : element_(element)
│ │ │ -
133 {}
│ │ │ -
│ │ │ -
134
│ │ │ -
│ │ │ -
136 LevelIterator(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ -
137 typename std::remove_const<T1>::type>& other)
│ │ │ -
138 : element_(other.element_)
│ │ │ -
139 {}
│ │ │ -
│ │ │ -
140
│ │ │ -
│ │ │ -
142 LevelIterator(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ -
143 const typename std::remove_const<T1>::type>& other)
│ │ │ -
144 : element_(other.element_)
│ │ │ -
145 {}
│ │ │ -
│ │ │ -
146
│ │ │ -
│ │ │ -
150 bool equals(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ -
151 typename std::remove_const<T1>::type>& other) const
│ │ │ -
152 {
│ │ │ -
153 return element_ == other.element_;
│ │ │ -
154 }
│ │ │ -
│ │ │ -
155
│ │ │ -
│ │ │ -
159 bool equals(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ -
160 const typename std::remove_const<T1>::type>& other) const
│ │ │ -
161 {
│ │ │ -
162 return element_ == other.element_;
│ │ │ -
163 }
│ │ │ -
│ │ │ -
164
│ │ │ -
│ │ │ -
166 T1& dereference() const
│ │ │ -
167 {
│ │ │ -
168 return *(element_->element_);
│ │ │ -
169 }
│ │ │ -
│ │ │ -
170
│ │ │ -
│ │ │ - │ │ │ -
173 {
│ │ │ -
174 element_ = element_->coarser_.lock();
│ │ │ -
175 }
│ │ │ -
│ │ │ -
176
│ │ │ -
│ │ │ - │ │ │ -
179 {
│ │ │ -
180 element_ = element_->finer_;
│ │ │ -
181 }
│ │ │ -
│ │ │ -
182
│ │ │ -
│ │ │ -
187 bool isRedistributed() const
│ │ │ -
188 {
│ │ │ -
189 return (bool)element_->redistributed_;
│ │ │ -
190 }
│ │ │ -
│ │ │ -
191
│ │ │ -
│ │ │ - │ │ │ -
197 {
│ │ │ -
198 assert(element_->redistributed_);
│ │ │ -
199 return *element_->redistributed_;
│ │ │ -
200 }
│ │ │ -
│ │ │ -
│ │ │ -
201 void addRedistributed(std::shared_ptr<T1> t)
│ │ │ -
202 {
│ │ │ -
203 element_->redistributed_ = t;
│ │ │ -
204 }
│ │ │ -
│ │ │ -
205
│ │ │ -
│ │ │ - │ │ │ -
207 {
│ │ │ -
208 element_->redistributed_ = nullptr;
│ │ │ -
209 }
│ │ │ -
│ │ │ -
210
│ │ │ -
211 private:
│ │ │ -
212 std::shared_ptr<Element> element_;
│ │ │ -
213 };
│ │ │ -
│ │ │ -
214
│ │ │ - │ │ │ -
217
│ │ │ - │ │ │ -
220
│ │ │ -
│ │ │ - │ │ │ -
226
│ │ │ -
│ │ │ - │ │ │ -
232
│ │ │ -
233
│ │ │ -
│ │ │ - │ │ │ -
239
│ │ │ -
│ │ │ - │ │ │ -
245
│ │ │ -
│ │ │ -
250 std::size_t levels() const;
│ │ │ -
251
│ │ │ -
252 private:
│ │ │ -
258 std::shared_ptr<MemberType> originalFinest_;
│ │ │ -
260 std::shared_ptr<Element> finest_;
│ │ │ -
262 std::shared_ptr<Element> coarsest_;
│ │ │ -
264 Allocator allocator_;
│ │ │ -
266 int levels_;
│ │ │ -
267 };
│ │ │ -
268
│ │ │ -
269 template<class T, class A>
│ │ │ -
│ │ │ -
270 Hierarchy<T,A>::Hierarchy(const std::shared_ptr<MemberType> & first)
│ │ │ -
271 : originalFinest_(first)
│ │ │ -
272 {
│ │ │ -
273 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
274 finest_->element_ = originalFinest_;
│ │ │ -
275 coarsest_ = finest_;
│ │ │ -
276 levels_ = 1;
│ │ │ -
277 }
│ │ │ -
│ │ │ -
278
│ │ │ -
280 //TODO: do we actually want to support this? This might be very expensive?!
│ │ │ -
281 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
283 : allocator_(other.allocator_),
│ │ │ -
284 levels_(other.levels_)
│ │ │ -
285 {
│ │ │ -
286 if(!other.finest_)
│ │ │ -
287 {
│ │ │ -
288 finest_=coarsest_=nullptr;
│ │ │ -
289 return;
│ │ │ -
290 }
│ │ │ -
291 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
292 std::shared_ptr<Element> finer_;
│ │ │ -
293 std::shared_ptr<Element> current_ = finest_;
│ │ │ -
294 std::weak_ptr<Element> otherWeak_ = other.finest_;
│ │ │ -
295
│ │ │ -
296 while(! otherWeak_.expired())
│ │ │ -
297 {
│ │ │ -
298 // create shared_ptr from weak_ptr, we just checked that this is safe
│ │ │ -
299 std::shared_ptr<Element> otherCurrent_ = std::shared_ptr<Element>(otherWeak_);
│ │ │ -
300 // clone current level
│ │ │ -
301 //TODO: should we use the allocator?
│ │ │ -
302 current_->element_ =
│ │ │ -
303 std::make_shared<MemberType>(*(otherCurrent_->element_));
│ │ │ -
304 current_->finer_=finer_;
│ │ │ -
305 if(otherCurrent_->redistributed_)
│ │ │ -
306 current_->redistributed_ =
│ │ │ -
307 std::make_shared<MemberType>(*(otherCurrent_->redistributed_));
│ │ │ -
308 finer_=current_;
│ │ │ -
309 if(not otherCurrent_->coarser_.expired())
│ │ │ -
310 {
│ │ │ -
311 auto c = std::allocate_shared<Element>(allocator_);
│ │ │ -
312 current_->coarser_ = c;
│ │ │ -
313 current_ = c;
│ │ │ -
314 }
│ │ │ -
315 // go to coarser level
│ │ │ -
316 otherWeak_ = otherCurrent_->coarser_;
│ │ │ -
317 }
│ │ │ -
318 coarsest_=current_;
│ │ │ -
319 }
│ │ │ -
│ │ │ -
320
│ │ │ -
321 template<class T, class A>
│ │ │ -
│ │ │ -
322 std::size_t Hierarchy<T,A>::levels() const
│ │ │ -
323 {
│ │ │ -
324 return levels_;
│ │ │ -
325 }
│ │ │ -
│ │ │ -
│ │ │ -
326
│ │ │ -
327 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
329 {
│ │ │ -
330 coarsest_->redistributed_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
331 }
│ │ │ -
│ │ │ -
332
│ │ │ -
333 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
335 {
│ │ │ -
336 if(!coarsest_) {
│ │ │ -
337 // we have no levels at all...
│ │ │ -
338 assert(!finest_);
│ │ │ -
339 // allocate into the shared_ptr
│ │ │ -
340 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
341 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
342 coarsest_->element_ = originalFinest_;
│ │ │ -
343 finest_ = coarsest_;
│ │ │ -
344 }else{
│ │ │ -
345 auto old_coarsest = coarsest_;
│ │ │ -
346 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
347 coarsest_->finer_ = old_coarsest;
│ │ │ -
348 coarsest_->element_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
349 old_coarsest->coarser_ = coarsest_;
│ │ │ -
350 }
│ │ │ -
351 ++levels_;
│ │ │ -
352 }
│ │ │ -
│ │ │ -
353
│ │ │ -
354
│ │ │ -
355 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
357 {
│ │ │ -
358 //TODO: wouldn't it be better to do this in the constructor?'
│ │ │ -
359 if(!finest_) {
│ │ │ -
360 // we have no levels at all...
│ │ │ -
361 assert(!coarsest_);
│ │ │ -
362 // allocate into the shared_ptr
│ │ │ -
363 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
364 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
365 finest_->element = originalFinest_;
│ │ │ -
366 coarsest_ = finest_;
│ │ │ -
367 }else{
│ │ │ -
368 finest_->finer_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
369 finest_->finer_->coarser_ = finest_;
│ │ │ -
370 finest_ = finest_->finer_;
│ │ │ -
371 finest_->element = ConstructionTraits<T>::construct(args);
│ │ │ -
372 }
│ │ │ -
373 ++levels_;
│ │ │ -
374 }
│ │ │ -
│ │ │ -
375
│ │ │ -
376 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
378 {
│ │ │ -
379 return Iterator(finest_);
│ │ │ -
380 }
│ │ │ -
│ │ │ -
381
│ │ │ -
382 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
384 {
│ │ │ -
385 return Iterator(coarsest_);
│ │ │ -
386 }
│ │ │ -
│ │ │ -
387
│ │ │ -
388 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
390 {
│ │ │ -
391 return ConstIterator(finest_);
│ │ │ -
392 }
│ │ │ -
│ │ │ -
393
│ │ │ -
394 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
396 {
│ │ │ -
397 return ConstIterator(coarsest_);
│ │ │ -
398 }
│ │ │ -
│ │ │ -
│ │ │ -
400 } // namespace Amg
│ │ │ -
401} // namespace Dune
│ │ │ -
402
│ │ │ -
403#endif
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
Helper classes for the construction of classes without empty constructor.
│ │ │ -
Hierarchy(const Hierarchy &other)
Copy constructor (deep copy!).
Definition hierarchy.hh:282
│ │ │ -
void addRedistributedOnCoarsest(Arguments &args)
Definition hierarchy.hh:328
│ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:322
│ │ │ -
ConstIterator coarsest() const
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:395
│ │ │ -
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:334
│ │ │ -
void addFiner(Arguments &args)
Add an element on a finer level.
Definition hierarchy.hh:356
│ │ │ -
Hierarchy(const std::shared_ptr< MemberType > &first)
Construct a new hierarchy.
Definition hierarchy.hh:270
│ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
Iterator coarsest()
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:383
│ │ │ -
ConstIterator finest() const
Get an iterator positioned at the finest level.
Definition hierarchy.hh:389
│ │ │ -
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:377
│ │ │ -
STL namespace.
│ │ │ +
62 for (auto row = A.begin(); row != endi; ++row)
│ │ │ +
63 {
│ │ │ +
64 const auto row_i = row.index();
│ │ │ +
65 for (auto a_ij = row->begin(); a_ij.index() < row_i; ++a_ij)
│ │ │ +
66 {
│ │ │ +
67 const auto col_j = a_ij.index();
│ │ │ +
68 const auto a_ji = A[col_j].find(row_i);
│ │ │ +
69 // if A[i, j] != 0 and A[j, i] != 0
│ │ │ +
70 if (a_ji != A[col_j].end())
│ │ │ +
71 {
│ │ │ +
72 // Dinv[i] -= A[i, j] * d[j] * A[j, i]
│ │ │ +
73 Dinv_[row_i] -= (*a_ij) * Dinv_[col_j] * (*a_ji);
│ │ │ +
74 }
│ │ │ +
75 }
│ │ │ +
76
│ │ │ +
77 // store the inverse
│ │ │ +
78 try
│ │ │ +
79 {
│ │ │ +
80 Impl::asMatrix(Dinv_[row_i]).invert(); // compute inverse of diagonal block
│ │ │ +
81 }
│ │ │ +
82 catch (Dune::FMatrixError &e)
│ │ │ +
83 {
│ │ │ +
84 DUNE_THROW(MatrixBlockError, "DILU failed to invert matrix block D[" << row_i << "]"
│ │ │ +
85 << e.what();
│ │ │ +
86 th__ex.r = row_i;);
│ │ │ +
87 }
│ │ │ +
88 }
│ │ │ +
89 }
│ │ │ +
│ │ │ +
90
│ │ │ +
106 template <class M, class X, class Y>
│ │ │ +
│ │ │ +
107 void blockDILUBacksolve(const M &A, const std::vector<typename M::block_type> Dinv_, X &v, const Y &d)
│ │ │ +
108 {
│ │ │ +
109 using dblock = typename Y::block_type;
│ │ │ +
110 using vblock = typename X::block_type;
│ │ │ +
111
│ │ │ +
112 // lower triangular solve: (D + L_A) y = d
│ │ │ +
113 auto endi = A.end();
│ │ │ +
114 for (auto row = A.begin(); row != endi; ++row)
│ │ │ +
115 {
│ │ │ +
116 const auto row_i = row.index();
│ │ │ +
117 dblock rhsValue(d[row_i]);
│ │ │ +
118 auto &&rhs = Impl::asVector(rhsValue);
│ │ │ +
119 for (auto a_ij = (*row).begin(); a_ij.index() < row_i; ++a_ij)
│ │ │ +
120 {
│ │ │ +
121 // if A[i][j] != 0
│ │ │ +
122 // rhs -= A[i][j]* y[j], where v_j stores y_j
│ │ │ +
123 const auto col_j = a_ij.index();
│ │ │ +
124 Impl::asMatrix(*a_ij).mmv(v[col_j], rhs);
│ │ │ +
125 }
│ │ │ +
126 // y_i = Dinv_i * rhs
│ │ │ +
127 // storing y_i in v_i
│ │ │ +
128 auto &&vi = Impl::asVector(v[row_i]);
│ │ │ +
129 Impl::asMatrix(Dinv_[row_i]).mv(rhs, vi); // (D + L_A)_ii = D_i
│ │ │ +
130 }
│ │ │ +
131
│ │ │ +
132 // upper triangular solve: (D + U_A) v = Dy
│ │ │ +
133 auto rendi = A.beforeBegin();
│ │ │ +
134 for (auto row = A.beforeEnd(); row != rendi; --row)
│ │ │ +
135 {
│ │ │ +
136 const auto row_i = row.index();
│ │ │ +
137 // rhs = 0
│ │ │ +
138 vblock rhs(0.0);
│ │ │ +
139 for (auto a_ij = (*row).beforeEnd(); a_ij.index() > row_i; --a_ij)
│ │ │ +
140 {
│ │ │ +
141 // if A[i][j] != 0
│ │ │ +
142 // rhs += A[i][j]*v[j]
│ │ │ +
143 const auto col_j = a_ij.index();
│ │ │ +
144 Impl::asMatrix(*a_ij).umv(v[col_j], rhs);
│ │ │ +
145 }
│ │ │ +
146 // calculate update v = M^-1*d
│ │ │ +
147 // v_i = y_i - Dinv_i*rhs
│ │ │ +
148 // before update v_i is y_i
│ │ │ +
149 auto &&vi = Impl::asVector(v[row_i]);
│ │ │ +
150 Impl::asMatrix(Dinv_[row_i]).mmv(rhs, vi);
│ │ │ +
151 }
│ │ │ +
152 }
│ │ │ +
│ │ │ +
153 } // end namespace DILU
│ │ │ +
│ │ │ +
154
│ │ │ +
157} // end namespace
│ │ │ +
158
│ │ │ +
159#endif
│ │ │ + │ │ │ +
Col col
Definition matrixmatrix.hh:351
│ │ │
Definition allocator.hh:11
│ │ │ -
A hierarchy of containers (e.g. matrices or vectors)
Definition hierarchy.hh:40
│ │ │ -
T MemberType
The type of the container we store.
Definition hierarchy.hh:45
│ │ │ -
LevelIterator< Hierarchy< T, A >, T > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ -
LevelIterator< const Hierarchy< T, A >, const T > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:219
│ │ │ -
ConstructionTraits< T >::Arguments Arguments
Definition hierarchy.hh:78
│ │ │ -
Hierarchy()
Construct an empty hierarchy.
Definition hierarchy.hh:89
│ │ │ -
typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator
The allocator to use for the list elements.
Definition hierarchy.hh:76
│ │ │ -
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ -
LevelIterator(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:136
│ │ │ -
void addRedistributed(std::shared_ptr< T1 > t)
Definition hierarchy.hh:201
│ │ │ -
T1 & dereference() const
Dereference the iterator.
Definition hierarchy.hh:166
│ │ │ -
bool equals(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:150
│ │ │ -
bool isRedistributed() const
Check whether there was a redistribution at the current level.
Definition hierarchy.hh:187
│ │ │ -
bool equals(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:159
│ │ │ -
void increment()
Move to the next coarser level.
Definition hierarchy.hh:172
│ │ │ -
LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T1 >::type > &other)
Copy constructor.
Definition hierarchy.hh:142
│ │ │ -
void deleteRedistributed()
Definition hierarchy.hh:206
│ │ │ -
void decrement()
Move to the next fine level.
Definition hierarchy.hh:178
│ │ │ -
LevelIterator(std::shared_ptr< Element > element)
Definition hierarchy.hh:131
│ │ │ -
T1 & getRedistributed() const
Get the redistributed container.
Definition hierarchy.hh:196
│ │ │ +
void blockDILUDecomposition(M &A, std::vector< typename M::block_type > &Dinv_)
Definition dilu.hh:51
│ │ │ +
void blockDILUBacksolve(const M &A, const std::vector< typename M::block_type > Dinv_, X &v, const Y &d)
Definition dilu.hh:107
│ │ │ +
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,442 +1,147 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -hierarchy.hh │ │ │ │ +dilu.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMGHIERARCHY_HH │ │ │ │ -6#define DUNE_AMGHIERARCHY_HH │ │ │ │ +5#ifndef DUNE_ISTL_DILU_HH │ │ │ │ +6#define DUNE_ISTL_DILU_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_c_o_n_s_t_r_u_c_t_i_o_n_._h_h> │ │ │ │ -15 │ │ │ │ -16namespace _D_u_n_e │ │ │ │ -17{ │ │ │ │ -18 namespace Amg │ │ │ │ -19 { │ │ │ │ -38 template > │ │ │ │ -_3_9 class _H_i_e_r_a_r_c_h_y │ │ │ │ -40 { │ │ │ │ -41 public: │ │ │ │ -_4_5 typedef T _M_e_m_b_e_r_T_y_p_e; │ │ │ │ -46 │ │ │ │ -47 template │ │ │ │ -48 class _L_e_v_e_l_I_t_e_r_a_t_o_r; │ │ │ │ -49 │ │ │ │ -50 private: │ │ │ │ -54 struct Element │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12 │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16 │ │ │ │ +17#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ +18 │ │ │ │ +23namespace _D_u_n_e │ │ │ │ +24{ │ │ │ │ +25 │ │ │ │ +_3_0 namespace DILU │ │ │ │ +31 { │ │ │ │ +32 │ │ │ │ +50 template │ │ │ │ +_5_1 void _b_l_o_c_k_D_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n(M &A, std::vector │ │ │ │ +&Dinv_) │ │ │ │ +52 { │ │ │ │ +53 auto endi = A.end(); │ │ │ │ +54 for (auto row = A.begin(); row != endi; ++row) │ │ │ │ 55 { │ │ │ │ -56 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r<_H_i_e_r_a_r_c_h_y, T>; │ │ │ │ -57 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r, const T>; │ │ │ │ -58 │ │ │ │ -60 std::weak_ptr coarser_; │ │ │ │ +56 const auto row_i = row.index(); │ │ │ │ +57 const auto _c_o_l = row->find(row_i); │ │ │ │ +58 // initialise Dinv[i] = A[i, i] │ │ │ │ +59 Dinv_[row_i] = *_c_o_l; │ │ │ │ +60 } │ │ │ │ 61 │ │ │ │ -63 std::shared_ptr finer_; │ │ │ │ -64 │ │ │ │ -66 std::shared_ptr element_; │ │ │ │ -67 │ │ │ │ -_6_9 std::shared_ptr redistributed_; │ │ │ │ -70 }; │ │ │ │ -71 public: │ │ │ │ -72 │ │ │ │ -_7_6 using _A_l_l_o_c_a_t_o_r = typename std::allocator_traits::template │ │ │ │ -rebind_alloc; │ │ │ │ -77 │ │ │ │ -_7_8 typedef typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_A_r_g_u_m_e_n_t_s _A_r_g_u_m_e_n_t_s; │ │ │ │ -79 │ │ │ │ -_8_4 _H_i_e_r_a_r_c_h_y(const std::shared_ptr & first); │ │ │ │ -85 │ │ │ │ -_8_9 _H_i_e_r_a_r_c_h_y() : levels_(0) │ │ │ │ -90 {} │ │ │ │ -91 │ │ │ │ -_9_5 _H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other); │ │ │ │ -96 │ │ │ │ -_1_0_1 void _a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ -102 │ │ │ │ -_1_0_3 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ -104 │ │ │ │ -_1_0_9 void _a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args); │ │ │ │ -110 │ │ │ │ -117 template │ │ │ │ -_1_1_8 class _L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ -119 : public BidirectionalIteratorFacade,T1,T1&> │ │ │ │ +62 for (auto row = A.begin(); row != endi; ++row) │ │ │ │ +63 { │ │ │ │ +64 const auto row_i = row.index(); │ │ │ │ +65 for (auto a_ij = row->begin(); a_ij.index() < row_i; ++a_ij) │ │ │ │ +66 { │ │ │ │ +67 const auto col_j = a_ij.index(); │ │ │ │ +68 const auto a_ji = A[col_j].find(row_i); │ │ │ │ +69 // if A[i, j] != 0 and A[j, i] != 0 │ │ │ │ +70 if (a_ji != A[col_j].end()) │ │ │ │ +71 { │ │ │ │ +72 // Dinv[i] -= A[i, j] * d[j] * A[j, i] │ │ │ │ +73 Dinv_[row_i] -= (*a_ij) * Dinv_[col_j] * (*a_ji); │ │ │ │ +74 } │ │ │ │ +75 } │ │ │ │ +76 │ │ │ │ +77 // store the inverse │ │ │ │ +78 try │ │ │ │ +79 { │ │ │ │ +80 Impl::asMatrix(Dinv_[row_i]).invert(); // compute inverse of diagonal block │ │ │ │ +81 } │ │ │ │ +82 catch (Dune::FMatrixError &e) │ │ │ │ +83 { │ │ │ │ +84 DUNE_THROW(_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r, "DILU failed to invert matrix block D[" << │ │ │ │ +row_i << "]" │ │ │ │ +85 << e.what(); │ │ │ │ +86 th__ex.r = row_i;); │ │ │ │ +87 } │ │ │ │ +88 } │ │ │ │ +89 } │ │ │ │ +90 │ │ │ │ +106 template │ │ │ │ +_1_0_7 void _b_l_o_c_k_D_I_L_U_B_a_c_k_s_o_l_v_e(const M &A, const std::vector Dinv_, X &v, const Y &d) │ │ │ │ +108 { │ │ │ │ +109 using dblock = typename Y::block_type; │ │ │ │ +110 using vblock = typename X::block_type; │ │ │ │ +111 │ │ │ │ +112 // lower triangular solve: (D + L_A) y = d │ │ │ │ +113 auto endi = A.end(); │ │ │ │ +114 for (auto row = A.begin(); row != endi; ++row) │ │ │ │ +115 { │ │ │ │ +116 const auto row_i = row.index(); │ │ │ │ +117 dblock rhsValue(d[row_i]); │ │ │ │ +118 auto &&rhs = Impl::asVector(rhsValue); │ │ │ │ +119 for (auto a_ij = (*row).begin(); a_ij.index() < row_i; ++a_ij) │ │ │ │ 120 { │ │ │ │ -121 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -122 typename std::remove_const::type >; │ │ │ │ -123 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -124 const typename std::remove_const::type >; │ │ │ │ -125 │ │ │ │ -126 public: │ │ │ │ -_1_2_8 _L_e_v_e_l_I_t_e_r_a_t_o_r() │ │ │ │ -129 {} │ │ │ │ -130 │ │ │ │ -_1_3_1 _L_e_v_e_l_I_t_e_r_a_t_o_r(std::shared_ptr element) │ │ │ │ -132 : element_(element) │ │ │ │ -133 {} │ │ │ │ -134 │ │ │ │ -_1_3_6 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -137 typename std::remove_const::type>& other) │ │ │ │ -138 : element_(other.element_) │ │ │ │ -139 {} │ │ │ │ -140 │ │ │ │ -_1_4_2 _L_e_v_e_l_I_t_e_r_a_t_o_r(const _L_e_v_e_l_I_t_e_r_a_t_o_r:: │ │ │ │ -type, │ │ │ │ -143 const typename std::remove_const::type>& other) │ │ │ │ -144 : element_(other.element_) │ │ │ │ -145 {} │ │ │ │ -146 │ │ │ │ -_1_5_0 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -151 typename std::remove_const::type>& other) const │ │ │ │ -152 { │ │ │ │ -153 return element_ == other.element_; │ │ │ │ -154 } │ │ │ │ -155 │ │ │ │ -_1_5_9 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -160 const typename std::remove_const::type>& other) const │ │ │ │ -161 { │ │ │ │ -162 return element_ == other.element_; │ │ │ │ -163 } │ │ │ │ -164 │ │ │ │ -_1_6_6 T1& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ -167 { │ │ │ │ -168 return *(element_->element_); │ │ │ │ -169 } │ │ │ │ -170 │ │ │ │ -_1_7_2 void _i_n_c_r_e_m_e_n_t() │ │ │ │ -173 { │ │ │ │ -174 element_ = element_->coarser_.lock(); │ │ │ │ -175 } │ │ │ │ -176 │ │ │ │ -_1_7_8 void _d_e_c_r_e_m_e_n_t() │ │ │ │ -179 { │ │ │ │ -180 element_ = element_->finer_; │ │ │ │ -181 } │ │ │ │ -182 │ │ │ │ -_1_8_7 bool _i_s_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ -188 { │ │ │ │ -189 return (bool)element_->redistributed_; │ │ │ │ -190 } │ │ │ │ -191 │ │ │ │ -_1_9_6 T1& _g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ -197 { │ │ │ │ -198 assert(element_->redistributed_); │ │ │ │ -199 return *element_->redistributed_; │ │ │ │ -200 } │ │ │ │ -_2_0_1 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d(std::shared_ptr t) │ │ │ │ -202 { │ │ │ │ -203 element_->redistributed_ = t; │ │ │ │ -204 } │ │ │ │ -205 │ │ │ │ -_2_0_6 void _d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d() │ │ │ │ -207 { │ │ │ │ -208 element_->redistributed_ = nullptr; │ │ │ │ -209 } │ │ │ │ -210 │ │ │ │ -211 private: │ │ │ │ -212 std::shared_ptr element_; │ │ │ │ -213 }; │ │ │ │ -214 │ │ │ │ -_2_1_6 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_H_i_e_r_a_r_c_h_y_<_T_,_A_>,T> _I_t_e_r_a_t_o_r; │ │ │ │ -217 │ │ │ │ -_2_1_9 typedef _L_e_v_e_l_I_t_e_r_a_t_o_r_<_c_o_n_s_t_ _H_i_e_r_a_r_c_h_y_<_T_,_A_>, const T> _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ -220 │ │ │ │ -_2_2_5 _I_t_e_r_a_t_o_r _f_i_n_e_s_t(); │ │ │ │ -226 │ │ │ │ -_2_3_1 _I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t(); │ │ │ │ -232 │ │ │ │ -233 │ │ │ │ -_2_3_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_e_s_t() const; │ │ │ │ -239 │ │ │ │ -_2_4_4 _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t() const; │ │ │ │ -245 │ │ │ │ -_2_5_0 std::size_t _l_e_v_e_l_s() const; │ │ │ │ -251 │ │ │ │ -252 private: │ │ │ │ -258 std::shared_ptr originalFinest_; │ │ │ │ -260 std::shared_ptr finest_; │ │ │ │ -262 std::shared_ptr coarsest_; │ │ │ │ -264 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ -266 int levels_; │ │ │ │ -267 }; │ │ │ │ -268 │ │ │ │ -269 template │ │ │ │ -_2_7_0 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const std::shared_ptr & first) │ │ │ │ -271 : originalFinest_(first) │ │ │ │ -272 { │ │ │ │ -273 finest_ = std::allocate_shared(allocator_); │ │ │ │ -274 finest_->element_ = originalFinest_; │ │ │ │ -275 coarsest_ = finest_; │ │ │ │ -276 levels_ = 1; │ │ │ │ -277 } │ │ │ │ -278 │ │ │ │ -280 //TODO: do we actually want to support this? This might be very expensive?! │ │ │ │ -281 template │ │ │ │ -_2_8_2 _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_H_i_e_r_a_r_c_h_y(const _H_i_e_r_a_r_c_h_y& other) │ │ │ │ -283 : allocator_(other.allocator_), │ │ │ │ -284 levels_(other.levels_) │ │ │ │ -285 { │ │ │ │ -286 if(!other.finest_) │ │ │ │ -287 { │ │ │ │ -288 finest_=coarsest_=nullptr; │ │ │ │ -289 return; │ │ │ │ -290 } │ │ │ │ -291 finest_ = std::allocate_shared(allocator_); │ │ │ │ -292 std::shared_ptr finer_; │ │ │ │ -293 std::shared_ptr current_ = finest_; │ │ │ │ -294 std::weak_ptr otherWeak_ = other.finest_; │ │ │ │ -295 │ │ │ │ -296 while(! otherWeak_.expired()) │ │ │ │ -297 { │ │ │ │ -298 // create shared_ptr from weak_ptr, we just checked that this is safe │ │ │ │ -299 std::shared_ptr otherCurrent_ = std::shared_ptr │ │ │ │ -(otherWeak_); │ │ │ │ -300 // clone current level │ │ │ │ -301 //TODO: should we use the allocator? │ │ │ │ -302 current_->element_ = │ │ │ │ -303 std::make_shared(*(otherCurrent_->element_)); │ │ │ │ -304 current_->finer_=finer_; │ │ │ │ -305 if(otherCurrent_->redistributed_) │ │ │ │ -306 current_->redistributed_ = │ │ │ │ -307 std::make_shared(*(otherCurrent_->redistributed_)); │ │ │ │ -308 finer_=current_; │ │ │ │ -309 if(not otherCurrent_->coarser_.expired()) │ │ │ │ -310 { │ │ │ │ -311 auto c = std::allocate_shared(allocator_); │ │ │ │ -312 current_->coarser_ = c; │ │ │ │ -313 current_ = c; │ │ │ │ -314 } │ │ │ │ -315 // go to coarser level │ │ │ │ -316 otherWeak_ = otherCurrent_->coarser_; │ │ │ │ -317 } │ │ │ │ -318 coarsest_=current_; │ │ │ │ -319 } │ │ │ │ -320 │ │ │ │ -321 template │ │ │ │ -_3_2_2 std::size_t _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ -323 { │ │ │ │ -324 return levels_; │ │ │ │ -325 } │ │ │ │ -326 │ │ │ │ -327 template │ │ │ │ -_3_2_8 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -329 { │ │ │ │ -330 coarsest_->redistributed_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ -(args); │ │ │ │ -331 } │ │ │ │ -332 │ │ │ │ -333 template │ │ │ │ -_3_3_4 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_C_o_a_r_s_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -335 { │ │ │ │ -336 if(!coarsest_) { │ │ │ │ -337 // we have no levels at all... │ │ │ │ -338 assert(!finest_); │ │ │ │ -339 // allocate into the shared_ptr │ │ │ │ -340 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ -341 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ -342 coarsest_->element_ = originalFinest_; │ │ │ │ -343 finest_ = coarsest_; │ │ │ │ -344 }else{ │ │ │ │ -345 auto old_coarsest = coarsest_; │ │ │ │ -346 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ -347 coarsest_->finer_ = old_coarsest; │ │ │ │ -348 coarsest_->element_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ -349 old_coarsest->coarser_ = coarsest_; │ │ │ │ -350 } │ │ │ │ -351 ++levels_; │ │ │ │ -352 } │ │ │ │ -353 │ │ │ │ -354 │ │ │ │ -355 template │ │ │ │ -_3_5_6 void _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_a_d_d_F_i_n_e_r(_A_r_g_u_m_e_n_t_s& args) │ │ │ │ -357 { │ │ │ │ -358 //TODO: wouldn't it be better to do this in the constructor?' │ │ │ │ -359 if(!finest_) { │ │ │ │ -360 // we have no levels at all... │ │ │ │ -361 assert(!coarsest_); │ │ │ │ -362 // allocate into the shared_ptr │ │ │ │ -363 originalFinest_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_M_e_m_b_e_r_T_y_p_e_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ -364 finest_ = std::allocate_shared(allocator_); │ │ │ │ -365 finest_->element = originalFinest_; │ │ │ │ -366 coarsest_ = finest_; │ │ │ │ -367 }else{ │ │ │ │ -368 finest_->finer_ = std::allocate_shared(allocator_); │ │ │ │ -369 finest_->finer_->coarser_ = finest_; │ │ │ │ -370 finest_ = finest_->finer_; │ │ │ │ -371 finest_->element = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_>_:_:_c_o_n_s_t_r_u_c_t(args); │ │ │ │ -372 } │ │ │ │ -373 ++levels_; │ │ │ │ -374 } │ │ │ │ -375 │ │ │ │ -376 template │ │ │ │ -_3_7_7 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() │ │ │ │ -378 { │ │ │ │ -379 return _I_t_e_r_a_t_o_r(finest_); │ │ │ │ -380 } │ │ │ │ -381 │ │ │ │ -382 template │ │ │ │ -_3_8_3 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() │ │ │ │ -384 { │ │ │ │ -385 return _I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ -386 } │ │ │ │ -387 │ │ │ │ -388 template │ │ │ │ -_3_8_9 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_f_i_n_e_s_t() const │ │ │ │ -390 { │ │ │ │ -391 return _C_o_n_s_t_I_t_e_r_a_t_o_r(finest_); │ │ │ │ -392 } │ │ │ │ -393 │ │ │ │ -394 template │ │ │ │ -_3_9_5 typename _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_c_o_a_r_s_e_s_t() const │ │ │ │ -396 { │ │ │ │ -397 return _C_o_n_s_t_I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ -398 } │ │ │ │ -400 } // namespace Amg │ │ │ │ -401} // namespace Dune │ │ │ │ -402 │ │ │ │ -403#endif │ │ │ │ -_c_o_n_s_t_r_u_c_t_i_o_n_._h_h │ │ │ │ -Helper classes for the construction of classes without empty constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ -Hierarchy(const Hierarchy &other) │ │ │ │ -Copy constructor (deep copy!). │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:282 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d_O_n_C_o_a_r_s_e_s_t │ │ │ │ -void addRedistributedOnCoarsest(Arguments &args) │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:328 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_l_e_v_e_l_s │ │ │ │ -std::size_t levels() const │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:322 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ -ConstIterator coarsest() const │ │ │ │ -Get an iterator positioned at the coarsest level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:395 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_C_o_a_r_s_e_r │ │ │ │ -void addCoarser(Arguments &args) │ │ │ │ -Add an element on a coarser level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:334 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_a_d_d_F_i_n_e_r │ │ │ │ -void addFiner(Arguments &args) │ │ │ │ -Add an element on a finer level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:356 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ -Hierarchy(const std::shared_ptr< MemberType > &first) │ │ │ │ -Construct a new hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:270 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ -const void * Arguments │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_c_o_a_r_s_e_s_t │ │ │ │ -Iterator coarsest() │ │ │ │ -Get an iterator positioned at the coarsest level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:383 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ -ConstIterator finest() const │ │ │ │ -Get an iterator positioned at the finest level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:389 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_f_i_n_e_s_t │ │ │ │ -Iterator finest() │ │ │ │ -Get an iterator positioned at the finest level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:377 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +121 // if A[i][j] != 0 │ │ │ │ +122 // rhs -= A[i][j]* y[j], where v_j stores y_j │ │ │ │ +123 const auto col_j = a_ij.index(); │ │ │ │ +124 Impl::asMatrix(*a_ij).mmv(v[col_j], rhs); │ │ │ │ +125 } │ │ │ │ +126 // y_i = Dinv_i * rhs │ │ │ │ +127 // storing y_i in v_i │ │ │ │ +128 auto &&vi = Impl::asVector(v[row_i]); │ │ │ │ +129 Impl::asMatrix(Dinv_[row_i]).mv(rhs, vi); // (D + L_A)_ii = D_i │ │ │ │ +130 } │ │ │ │ +131 │ │ │ │ +132 // upper triangular solve: (D + U_A) v = Dy │ │ │ │ +133 auto rendi = A.beforeBegin(); │ │ │ │ +134 for (auto row = A.beforeEnd(); row != rendi; --row) │ │ │ │ +135 { │ │ │ │ +136 const auto row_i = row.index(); │ │ │ │ +137 // rhs = 0 │ │ │ │ +138 vblock rhs(0.0); │ │ │ │ +139 for (auto a_ij = (*row).beforeEnd(); a_ij.index() > row_i; --a_ij) │ │ │ │ +140 { │ │ │ │ +141 // if A[i][j] != 0 │ │ │ │ +142 // rhs += A[i][j]*v[j] │ │ │ │ +143 const auto col_j = a_ij.index(); │ │ │ │ +144 Impl::asMatrix(*a_ij).umv(v[col_j], rhs); │ │ │ │ +145 } │ │ │ │ +146 // calculate update v = M^-1*d │ │ │ │ +147 // v_i = y_i - Dinv_i*rhs │ │ │ │ +148 // before update v_i is y_i │ │ │ │ +149 auto &&vi = Impl::asVector(v[row_i]); │ │ │ │ +150 Impl::asMatrix(Dinv_[row_i]).mmv(rhs, vi); │ │ │ │ +151 } │ │ │ │ +152 } │ │ │ │ +153 } // end namespace DILU │ │ │ │ +154 │ │ │ │ +157} // end namespace │ │ │ │ +158 │ │ │ │ +159#endif │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ +_c_o_l │ │ │ │ +Col col │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ -A hierarchy of containers (e.g. matrices or vectors) │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:40 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_M_e_m_b_e_r_T_y_p_e │ │ │ │ -T MemberType │ │ │ │ -The type of the container we store. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:45 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator< Hierarchy< T, A >, T > Iterator │ │ │ │ -Type of the mutable iterator. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator< const Hierarchy< T, A >, const T > ConstIterator │ │ │ │ -Type of the const iterator. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:219 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ -ConstructionTraits< T >::Arguments Arguments │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:78 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_H_i_e_r_a_r_c_h_y │ │ │ │ -Hierarchy() │ │ │ │ -Construct an empty hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:89 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ -typename std::allocator_traits< A >::template rebind_alloc< Element > Allocator │ │ │ │ -The allocator to use for the list elements. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:76 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ -Iterator over the levels in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ -typename std::remove_const< T1 >::type > &other) │ │ │ │ -Copy constructor. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:136 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ -void addRedistributed(std::shared_ptr< T1 > t) │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:201 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ -T1 & dereference() const │ │ │ │ -Dereference the iterator. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:166 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ -bool equals(const LevelIterator< typename std::remove_const< C >::type, │ │ │ │ -typename std::remove_const< T1 >::type > &other) const │ │ │ │ -Equality check. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:150 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_s_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ -bool isRedistributed() const │ │ │ │ -Check whether there was a redistribution at the current level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:187 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ -bool equals(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ -const typename std::remove_const< T1 >::type > &other) const │ │ │ │ -Equality check. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:159 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ -void increment() │ │ │ │ -Move to the next coarser level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:172 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator(const LevelIterator< const typename std::remove_const< C >::type, │ │ │ │ -const typename std::remove_const< T1 >::type > &other) │ │ │ │ -Copy constructor. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:142 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ -void deleteRedistributed() │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:206 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ -void decrement() │ │ │ │ -Move to the next fine level. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:178 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator(std::shared_ptr< Element > element) │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:131 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d │ │ │ │ -T1 & getRedistributed() const │ │ │ │ -Get the redistributed container. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:196 │ │ │ │ +_D_u_n_e_:_:_D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_D_e_c_o_m_p_o_s_i_t_i_o_n │ │ │ │ +void blockDILUDecomposition(M &A, std::vector< typename M::block_type > &Dinv_) │ │ │ │ +DDeeffiinniittiioonn dilu.hh:51 │ │ │ │ +_D_u_n_e_:_:_D_I_L_U_:_:_b_l_o_c_k_D_I_L_U_B_a_c_k_s_o_l_v_e │ │ │ │ +void blockDILUBacksolve(const M &A, const std::vector< typename M::block_type > │ │ │ │ +Dinv_, X &v, const Y &d) │ │ │ │ +DDeeffiinniittiioonn dilu.hh:107 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r │ │ │ │ +Error when performing an operation on a matrix block. │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:52 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graphcreator.hh File Reference │ │ │ +dune-istl: multitypeblockvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,46 +65,66 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ -
graphcreator.hh File Reference
│ │ │ +Namespaces | │ │ │ +Functions
│ │ │ +
multitypeblockvector.hh File Reference
│ │ │ │ │ │
│ │ │ -
#include <tuple>
│ │ │ -#include "graph.hh"
│ │ │ -#include "dependency.hh"
│ │ │ -#include "pinfo.hh"
│ │ │ -#include <dune/istl/operators.hh>
│ │ │ -#include <dune/istl/bcrsmatrix.hh>
│ │ │ +
#include <cmath>
│ │ │ +#include <iostream>
│ │ │ +#include <tuple>
│ │ │ +#include <dune/common/dotproduct.hh>
│ │ │ +#include <dune/common/ftraits.hh>
│ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ +#include <dune/common/typetraits.hh>
│ │ │ +#include <dune/common/std/type_traits.hh>
│ │ │ +#include "istlexception.hh"
│ │ │ +#include "gsetc.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::Amg::PropertiesGraphCreator< M, PI >
struct  Dune::FieldTraits< MultiTypeBlockVector< Args... > >
 
struct  Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >
class  Dune::MultiTypeBlockVector< Args >
 A Vector class to support different block types. More...
 
struct  std::tuple_element< i, Dune::MultiTypeBlockVector< Args... > >
 Make std::tuple_element work for MultiTypeBlockVector. More...
 
struct  std::tuple_size< Dune::MultiTypeBlockVector< Args... > >
 Make std::tuple_size work for MultiTypeBlockVector. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
namespace  std
 STL namespace.
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<typename... Args>
std::ostream & Dune::operator<< (std::ostream &s, const MultiTypeBlockVector< Args... > &v)
 Send MultiTypeBlockVector to an outstream.
 
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,28 +1,45 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -graphcreator.hh File Reference │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +multitypeblockvector.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ #include │ │ │ │ -#include "_g_r_a_p_h_._h_h" │ │ │ │ -#include "_d_e_p_e_n_d_e_n_c_y_._h_h" │ │ │ │ -#include "_p_i_n_f_o_._h_h" │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ +#include "_g_s_e_t_c_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _P_I_ _> │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ + class   _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_ _> │ │ │ │ +  A Vector class to support different block types. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _s_t_d_:_:_t_u_p_l_e___e_l_e_m_e_n_t_<_ _i_,_ _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ +  Make std::tuple_element work for MultiTypeBlockVector. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _s_t_d_:_:_t_u_p_l_e___s_i_z_e_<_ _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _> │ │ │ │ +  Make std::tuple_size work for MultiTypeBlockVector. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +namespace   _s_t_d │ │ │ │ +  STL namespace. │ │ │ │ +  │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &s, const _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r< │ │ │ │ + Args... > &v) │ │ │ │ +  Send _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r to an outstream. │ │ │ │   │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graphcreator.hh Source File │ │ │ +dune-istl: multitypeblockvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,156 +70,358 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
graphcreator.hh
│ │ │ +
multitypeblockvector.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_GRAPHCREATOR_HH
│ │ │ -
6#define DUNE_AMG_GRAPHCREATOR_HH
│ │ │ +
5#ifndef DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH
│ │ │ +
6#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH
│ │ │
7
│ │ │ -
8#include <tuple>
│ │ │ -
9
│ │ │ -
10#include "graph.hh"
│ │ │ -
11#include "dependency.hh"
│ │ │ -
12#include "pinfo.hh"
│ │ │ - │ │ │ - │ │ │ -
15
│ │ │ -
16namespace Dune
│ │ │ -
17{
│ │ │ -
18 namespace Amg
│ │ │ -
19 {
│ │ │ -
20 template<class M, class PI>
│ │ │ -
│ │ │ - │ │ │ -
22 {
│ │ │ -
23 typedef typename M::matrix_type Matrix;
│ │ │ - │ │ │ - │ │ │ -
26 std::vector<bool> > SubGraph;
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
30 IdentityMap,
│ │ │ - │ │ │ - │ │ │ -
33
│ │ │ -
34 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
│ │ │ -
35
│ │ │ -
36 template<class OF, class T>
│ │ │ -
│ │ │ -
37 static GraphTuple create(const M& matrix, T& excluded,
│ │ │ -
38 PI& pinfo, const OF& of)
│ │ │ -
39 {
│ │ │ -
40 MatrixGraph* mg = new MatrixGraph(matrix.getmat());
│ │ │ -
41 typedef typename PI::ParallelIndexSet ParallelIndexSet;
│ │ │ -
42 typedef typename ParallelIndexSet::const_iterator IndexIterator;
│ │ │ -
43 IndexIterator iend = pinfo.indexSet().end();
│ │ │ -
44
│ │ │ -
45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index)
│ │ │ -
46 excluded[index->local()] = of.contains(index->local().attribute());
│ │ │ -
47
│ │ │ -
48 SubGraph* sg= new SubGraph(*mg, excluded);
│ │ │ -
49 PropertiesGraph* pg = new PropertiesGraph(*sg, IdentityMap(), sg->getEdgeIndexMap());
│ │ │ -
50 return GraphTuple(mg,pg,sg);
│ │ │ -
51 }
│ │ │ -
│ │ │ -
52
│ │ │ -
│ │ │ -
53 static void free(GraphTuple& graphs)
│ │ │ -
54 {
│ │ │ -
55 delete std::get<2>(graphs);
│ │ │ -
56 delete std::get<1>(graphs);
│ │ │ -
57 }
│ │ │ -
│ │ │ -
58 };
│ │ │ -
│ │ │ -
59
│ │ │ -
60 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
62 {
│ │ │ -
63 typedef typename M::matrix_type Matrix;
│ │ │ -
64
│ │ │ - │ │ │ +
8#include <cmath>
│ │ │ +
9#include <iostream>
│ │ │ +
10#include <tuple>
│ │ │ +
11
│ │ │ +
12#include <dune/common/dotproduct.hh>
│ │ │ +
13#include <dune/common/ftraits.hh>
│ │ │ +
14#include <dune/common/hybridutilities.hh>
│ │ │ +
15#include <dune/common/typetraits.hh>
│ │ │ +
16#include <dune/common/std/type_traits.hh>
│ │ │ +
17
│ │ │ +
18#include "istlexception.hh"
│ │ │ +
19
│ │ │ +
20// forward declaration
│ │ │ +
21namespace Dune {
│ │ │ +
22 template < typename... Args >
│ │ │ +
23 class MultiTypeBlockVector;
│ │ │ +
24}
│ │ │ +
25
│ │ │ +
26#include "gsetc.hh"
│ │ │ +
27
│ │ │ +
28namespace Dune {
│ │ │ +
29
│ │ │ +
41 template <typename... Args>
│ │ │ +
│ │ │ +
42 struct FieldTraits< MultiTypeBlockVector<Args...> >
│ │ │ +
43 {
│ │ │ +
44 using field_type = typename MultiTypeBlockVector<Args...>::field_type;
│ │ │ +
45 using real_type = typename MultiTypeBlockVector<Args...>::real_type;
│ │ │ +
46 };
│ │ │ +
│ │ │ +
56 template < typename... Args >
│ │ │ +
│ │ │ + │ │ │ +
58 : public std::tuple<Args...>
│ │ │ +
59 {
│ │ │ +
61 typedef std::tuple<Args...> TupleType;
│ │ │ +
62 public:
│ │ │ +
63
│ │ │ +
65 using size_type = std::size_t;
│ │ │
66
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
70 IdentityMap,
│ │ │ -
71 IdentityMap> PropertiesGraph;
│ │ │ -
72
│ │ │ -
73 typedef std::tuple<MatrixGraph*,PropertiesGraph*> GraphTuple;
│ │ │ -
74
│ │ │ -
75 template<class OF, class T>
│ │ │ -
│ │ │ -
76 static GraphTuple create([[maybe_unused]] const M& matrix,
│ │ │ -
77 [[maybe_unused]] T& excluded,
│ │ │ -
78 [[maybe_unused]] const SequentialInformation& pinfo,
│ │ │ -
79 const OF&)
│ │ │ -
80 {
│ │ │ -
81 MatrixGraph* mg = new MatrixGraph(matrix.getmat());
│ │ │ -
82 PropertiesGraph* pg = new PropertiesGraph(*mg, IdentityMap(), IdentityMap());
│ │ │ -
83 return GraphTuple(mg,pg);
│ │ │ -
84 }
│ │ │ -
│ │ │ -
85
│ │ │ -
│ │ │ -
86 static void free(GraphTuple& graphs)
│ │ │ -
87 {
│ │ │ -
88 delete std::get<1>(graphs);
│ │ │ -
89 }
│ │ │ -
│ │ │ +
70 using TupleType::TupleType;
│ │ │ +
71
│ │ │ +
75 typedef MultiTypeBlockVector<Args...> type;
│ │ │ +
76
│ │ │ +
82 using field_type = Std::detected_t<std::common_type_t, typename FieldTraits< std::decay_t<Args> >::field_type...>;
│ │ │ +
83
│ │ │ +
89 using real_type = Std::detected_t<std::common_type_t, typename FieldTraits< std::decay_t<Args> >::real_type...>;
│ │ │
90
│ │ │ -
91 };
│ │ │ -
│ │ │ -
92
│ │ │ -
93 } //namespace Amg
│ │ │ -
94} // namespace Dune
│ │ │ -
95#endif
│ │ │ - │ │ │ -
Provides classes for building the matrix graph.
│ │ │ -
Provides classes for initializing the link attributes of a matrix graph.
│ │ │ -
Define general, extensible interface for operators. The available implementation wraps a matrix.
│ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ +
91 // make sure that we have an std::common_type: using an assertion produces a more readable error message
│ │ │ +
92 // than a compiler template instantiation error
│ │ │ +
93 static_assert ( sizeof...(Args) == 0 or
│ │ │ +
94 not (std::is_same_v<field_type, Std::nonesuch> or std::is_same_v<real_type, Std::nonesuch>),
│ │ │ +
95 "No std::common_type implemented for the given field_type/real_type of the Args. Please provide an implementation and check that a FieldTraits class is present for your type.");
│ │ │ +
96
│ │ │ +
97
│ │ │ +
│ │ │ +
103 static constexpr size_type size()
│ │ │ +
104 {
│ │ │ +
105 return sizeof...(Args);
│ │ │ +
106 }
│ │ │ +
│ │ │ +
107
│ │ │ +
│ │ │ +
110 static constexpr size_type N()
│ │ │ +
111 {
│ │ │ +
112 return sizeof...(Args);
│ │ │ +
113 }
│ │ │ +
│ │ │ +
114
│ │ │ +
│ │ │ + │ │ │ +
117 {
│ │ │ +
118 size_type result = 0;
│ │ │ +
119 Hybrid::forEach(std::make_index_sequence<N()>{},
│ │ │ +
120 [&](auto i){result += std::get<i>(*this).dim();});
│ │ │ +
121
│ │ │ +
122 return result;
│ │ │ +
123 }
│ │ │ +
│ │ │ +
124
│ │ │ +
143 template< size_type index >
│ │ │ +
144 typename std::tuple_element<index,TupleType>::type&
│ │ │ +
│ │ │ +
145 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable)
│ │ │ +
146 {
│ │ │ +
147 return std::get<index>(*this);
│ │ │ +
148 }
│ │ │ +
│ │ │ +
149
│ │ │ +
155 template< size_type index >
│ │ │ +
156 const typename std::tuple_element<index,TupleType>::type&
│ │ │ +
│ │ │ +
157 operator[] ([[maybe_unused]] const std::integral_constant< size_type, index > indexVariable) const
│ │ │ +
158 {
│ │ │ +
159 return std::get<index>(*this);
│ │ │ +
160 }
│ │ │ +
│ │ │ +
161
│ │ │ +
164 template<typename T>
│ │ │ +
│ │ │ +
165 void operator= (const T& newval) {
│ │ │ +
166 Dune::Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ +
167 entry = newval;
│ │ │ +
168 });
│ │ │ +
169 }
│ │ │ +
│ │ │ +
170
│ │ │ +
│ │ │ +
174 void operator+= (const type& newv) {
│ │ │ +
175 using namespace Dune::Hybrid;
│ │ │ +
176 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ +
177 (*this)[i] += newv[i];
│ │ │ +
178 });
│ │ │ +
179 }
│ │ │ +
│ │ │ +
180
│ │ │ +
│ │ │ +
184 void operator-= (const type& newv) {
│ │ │ +
185 using namespace Dune::Hybrid;
│ │ │ +
186 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ +
187 (*this)[i] -= newv[i];
│ │ │ +
188 });
│ │ │ +
189 }
│ │ │ +
│ │ │ +
190
│ │ │ +
192 template<class T,
│ │ │ +
193 std::enable_if_t< IsNumber<T>::value, int> = 0>
│ │ │ +
│ │ │ +
194 void operator*= (const T& w) {
│ │ │ +
195 Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ +
196 entry *= w;
│ │ │ +
197 });
│ │ │ +
198 }
│ │ │ +
│ │ │ +
199
│ │ │ +
201 template<class T,
│ │ │ +
202 std::enable_if_t< IsNumber<T>::value, int> = 0>
│ │ │ +
│ │ │ +
203 void operator/= (const T& w) {
│ │ │ +
204 Hybrid::forEach(*this, [&](auto&& entry) {
│ │ │ +
205 entry /= w;
│ │ │ +
206 });
│ │ │ +
207 }
│ │ │ +
│ │ │ +
208
│ │ │ +
│ │ │ +
209 field_type operator* (const type& newv) const {
│ │ │ +
210 using namespace Dune::Hybrid;
│ │ │ +
211 return accumulate(integralRange(Hybrid::size(*this)), field_type(0), [&](auto&& a, auto&& i) {
│ │ │ +
212 return a + (*this)[i]*newv[i];
│ │ │ +
213 });
│ │ │ +
214 }
│ │ │ +
│ │ │ +
215
│ │ │ +
│ │ │ +
216 field_type dot (const type& newv) const {
│ │ │ +
217 using namespace Dune::Hybrid;
│ │ │ +
218 return accumulate(integralRange(Hybrid::size(*this)), field_type(0), [&](auto&& a, auto&& i) {
│ │ │ +
219 return a + (*this)[i].dot(newv[i]);
│ │ │ +
220 });
│ │ │ +
221 }
│ │ │ +
│ │ │ +
222
│ │ │ +
│ │ │ +
225 auto one_norm() const {
│ │ │ +
226 using namespace Dune::Hybrid;
│ │ │ +
227 return accumulate(*this, real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ +
228 return a + entry.one_norm();
│ │ │ +
229 });
│ │ │ +
230 }
│ │ │ +
│ │ │ +
231
│ │ │ +
│ │ │ +
234 auto one_norm_real() const {
│ │ │ +
235 using namespace Dune::Hybrid;
│ │ │ +
236 return accumulate(*this, real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ +
237 return a + entry.one_norm_real();
│ │ │ +
238 });
│ │ │ +
239 }
│ │ │ +
│ │ │ +
240
│ │ │ +
│ │ │ + │ │ │ +
244 using namespace Dune::Hybrid;
│ │ │ +
245 return accumulate(*this, real_type(0), [&](auto&& a, auto&& entry) {
│ │ │ +
246 return a + entry.two_norm2();
│ │ │ +
247 });
│ │ │ +
248 }
│ │ │ +
│ │ │ +
249
│ │ │ +
252 real_type two_norm() const {return sqrt(this->two_norm2());}
│ │ │ +
253
│ │ │ +
│ │ │ + │ │ │ +
257 {
│ │ │ +
258 using namespace Dune::Hybrid;
│ │ │ +
259 using std::max;
│ │ │ +
260
│ │ │ +
261 real_type result = 0.0;
│ │ │ +
262 // Compute max norm tracking appearing nan values
│ │ │ +
263 // if the field type supports nan.
│ │ │ +
264 if constexpr (HasNaN<field_type>()) {
│ │ │ +
265 // This variable will preserve any nan value
│ │ │ +
266 real_type nanTracker = 1.0;
│ │ │ +
267 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ +
268 forEach(*this, [&](auto&& entry) {
│ │ │ +
269 real_type entryNorm = entry.infinity_norm();
│ │ │ +
270 result = max(entryNorm, result);
│ │ │ +
271 nanTracker += entryNorm;
│ │ │ +
272 });
│ │ │ +
273 // Incorporate possible nan value into result
│ │ │ +
274 result *= (nanTracker / nanTracker);
│ │ │ +
275 } else {
│ │ │ +
276 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ +
277 forEach(*this, [&](auto&& entry) {
│ │ │ +
278 result = max(entry.infinity_norm(), result);
│ │ │ +
279 });
│ │ │ +
280 }
│ │ │ +
281 return result;
│ │ │ +
282 }
│ │ │ +
│ │ │ +
283
│ │ │ +
│ │ │ + │ │ │ +
287 {
│ │ │ +
288 using namespace Dune::Hybrid;
│ │ │ +
289 using std::max;
│ │ │ +
290
│ │ │ +
291 real_type result = 0.0;
│ │ │ +
292 // Compute max norm tracking appearing nan values
│ │ │ +
293 // if the field type supports nan.
│ │ │ +
294 if constexpr (HasNaN<field_type>()) {
│ │ │ +
295 // This variable will preserve any nan value
│ │ │ +
296 real_type nanTracker = 1.0;
│ │ │ +
297 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ +
298 forEach(*this, [&](auto&& entry) {
│ │ │ +
299 real_type entryNorm = entry.infinity_norm_real();
│ │ │ +
300 result = max(entryNorm, result);
│ │ │ +
301 nanTracker += entryNorm;
│ │ │ +
302 });
│ │ │ +
303 // Incorporate possible nan value into result
│ │ │ +
304 result *= (nanTracker / nanTracker);
│ │ │ +
305 } else {
│ │ │ +
306 using namespace Dune::Hybrid; // needed for icc, see issue #31
│ │ │ +
307 forEach(*this, [&](auto&& entry) {
│ │ │ +
308 result = max(entry.infinity_norm_real(), result);
│ │ │ +
309 });
│ │ │ +
310 }
│ │ │ +
311 return result;
│ │ │ +
312 }
│ │ │ +
│ │ │ +
313
│ │ │ +
318 template<typename Ta>
│ │ │ +
│ │ │ +
319 void axpy (const Ta& a, const type& y) {
│ │ │ +
320 using namespace Dune::Hybrid;
│ │ │ +
321 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) {
│ │ │ +
322 (*this)[i].axpy(a, y[i]);
│ │ │ +
323 });
│ │ │ +
324 }
│ │ │ +
│ │ │ +
325
│ │ │ +
326 };
│ │ │ +
│ │ │ +
327
│ │ │ +
328
│ │ │ +
329
│ │ │ +
332 template <typename... Args>
│ │ │ +
│ │ │ +
333 std::ostream& operator<< (std::ostream& s, const MultiTypeBlockVector<Args...>& v) {
│ │ │ +
334 using namespace Dune::Hybrid;
│ │ │ +
335 forEach(integralRange(Dune::Hybrid::size(v)), [&](auto&& i) {
│ │ │ +
336 s << "\t(" << i << "):\n" << v[i] << "\n";
│ │ │ +
337 });
│ │ │ +
338 return s;
│ │ │ +
339 }
│ │ │ +
│ │ │ +
340
│ │ │ +
341} // end namespace Dune
│ │ │ +
342
│ │ │ +
343namespace std
│ │ │ +
344{
│ │ │ +
349 template <size_t i, typename... Args>
│ │ │ +
│ │ │ +
350 struct tuple_element<i,Dune::MultiTypeBlockVector<Args...> >
│ │ │ +
351 {
│ │ │ +
352 using type = typename std::tuple_element<i, std::tuple<Args...> >::type;
│ │ │ +
353 };
│ │ │ +
│ │ │ +
354
│ │ │ +
359 template <typename... Args>
│ │ │ +
│ │ │ +
360 struct tuple_size<Dune::MultiTypeBlockVector<Args...> >
│ │ │ +
361 : std::integral_constant<std::size_t, sizeof...(Args)>
│ │ │ +
362 {};
│ │ │ +
│ │ │ +
363}
│ │ │ +
364
│ │ │ +
365#endif
│ │ │ + │ │ │ +
Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a generic way.
│ │ │ +
void operator=(const T &newval)
Assignment operator.
Definition multitypeblockvector.hh:165
│ │ │ +
std::size_t size_type
Type used for vector sizes.
Definition multitypeblockvector.hh:65
│ │ │ +
static constexpr size_type N()
Number of elements.
Definition multitypeblockvector.hh:110
│ │ │ +
Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > >::field_type... > field_type
The type used for scalars.
Definition multitypeblockvector.hh:82
│ │ │ +
static constexpr size_type size()
Return the number of non-zero vector entries.
Definition multitypeblockvector.hh:103
│ │ │ +
std::tuple_element< index, TupleType >::type & operator[](const std::integral_constant< size_type, index > indexVariable)
Random-access operator.
Definition multitypeblockvector.hh:145
│ │ │ +
typename MultiTypeBlockVector< Args... >::field_type field_type
Definition multitypeblockvector.hh:44
│ │ │ +
size_type dim() const
Number of scalar elements.
Definition multitypeblockvector.hh:116
│ │ │ +
Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > >::real_type... > real_type
The type used for real values.
Definition multitypeblockvector.hh:89
│ │ │ +
field_type dot(const type &newv) const
Definition multitypeblockvector.hh:216
│ │ │ +
void operator*=(const T &w)
Multiplication with a scalar.
Definition multitypeblockvector.hh:194
│ │ │ +
void axpy(const Ta &a, const type &y)
Axpy operation on this vector (*this += a * y)
Definition multitypeblockvector.hh:319
│ │ │ +
real_type two_norm() const
Compute the Euclidean norm.
Definition multitypeblockvector.hh:252
│ │ │ +
void operator/=(const T &w)
Division by a scalar.
Definition multitypeblockvector.hh:203
│ │ │ +
MultiTypeBlockVector< Args... > type
Definition multitypeblockvector.hh:75
│ │ │ +
auto one_norm() const
Compute the 1-norm.
Definition multitypeblockvector.hh:225
│ │ │ +
real_type two_norm2() const
Compute the squared Euclidean norm.
Definition multitypeblockvector.hh:243
│ │ │ +
real_type infinity_norm_real() const
Compute the simplified maximum norm (uses 1-norm for complex values)
Definition multitypeblockvector.hh:286
│ │ │ +
void operator-=(const type &newv)
Definition multitypeblockvector.hh:184
│ │ │ +
real_type infinity_norm() const
Compute the maximum norm.
Definition multitypeblockvector.hh:256
│ │ │ +
field_type operator*(const type &newv) const
Definition multitypeblockvector.hh:209
│ │ │ +
void operator+=(const type &newv)
Definition multitypeblockvector.hh:174
│ │ │ +
typename std::tuple_element< i, std::tuple< Args... > >::type type
Definition multitypeblockvector.hh:352
│ │ │ +
auto one_norm_real() const
Compute the simplified 1-norm (uses 1-norm also for complex values)
Definition multitypeblockvector.hh:234
│ │ │ +
typename MultiTypeBlockVector< Args... >::real_type real_type
Definition multitypeblockvector.hh:45
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
Class representing the properties of an edge in the matrix graph.
Definition dependency.hh:39
│ │ │ -
Class representing a node in the matrix graph.
Definition dependency.hh:126
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
A subgraph of a graph.
Definition graph.hh:443
│ │ │ -
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ -
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ -
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ -
Definition graphcreator.hh:22
│ │ │ -
Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph
Definition graphcreator.hh:26
│ │ │ -
Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph
Definition graphcreator.hh:32
│ │ │ -
M::matrix_type Matrix
Definition graphcreator.hh:23
│ │ │ -
static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of)
Definition graphcreator.hh:37
│ │ │ -
static void free(GraphTuple &graphs)
Definition graphcreator.hh:53
│ │ │ -
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:24
│ │ │ -
std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple
Definition graphcreator.hh:34
│ │ │ -
Dune::Amg::MatrixGraph< const Matrix > MatrixGraph
Definition graphcreator.hh:65
│ │ │ -
M::matrix_type Matrix
Definition graphcreator.hh:63
│ │ │ -
Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, IdentityMap, IdentityMap > PropertiesGraph
Definition graphcreator.hh:71
│ │ │ -
std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple
Definition graphcreator.hh:73
│ │ │ -
static GraphTuple create(const M &matrix, T &excluded, const SequentialInformation &pinfo, const OF &)
Definition graphcreator.hh:76
│ │ │ -
static void free(GraphTuple &graphs)
Definition graphcreator.hh:86
│ │ │ -
Definition pinfo.hh:28
│ │ │ +
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:583
│ │ │ +
A Vector class to support different block types.
Definition multitypeblockvector.hh:59
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,188 +1,392 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -graphcreator.hh │ │ │ │ +multitypeblockvector.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_GRAPHCREATOR_HH │ │ │ │ -6#define DUNE_AMG_GRAPHCREATOR_HH │ │ │ │ +5#ifndef DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH │ │ │ │ +6#define DUNE_ISTL_MULTITYPEBLOCKVECTOR_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9 │ │ │ │ -10#include "_g_r_a_p_h_._h_h" │ │ │ │ -11#include "_d_e_p_e_n_d_e_n_c_y_._h_h" │ │ │ │ -12#include "_p_i_n_f_o_._h_h" │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_o_p_e_r_a_t_o_r_s_._h_h> │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ -15 │ │ │ │ -16namespace _D_u_n_e │ │ │ │ -17{ │ │ │ │ -18 namespace Amg │ │ │ │ -19 { │ │ │ │ -20 template │ │ │ │ -_2_1 struct _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ -22 { │ │ │ │ -_2_3 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ -_2_4 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_a_t_r_i_x_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ -25 typedef _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ -_2_6 std::vector > _S_u_b_G_r_a_p_h; │ │ │ │ -27 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_S_u_b_G_r_a_p_h, │ │ │ │ -28 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -29 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -30 IdentityMap, │ │ │ │ -31 typename _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p> │ │ │ │ -_3_2 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ -33 │ │ │ │ -_3_4 typedef std::tuple _G_r_a_p_h_T_u_p_l_e; │ │ │ │ -35 │ │ │ │ -36 template │ │ │ │ -_3_7 static _G_r_a_p_h_T_u_p_l_e _c_r_e_a_t_e(const M& matrix, T& excluded, │ │ │ │ -38 PI& pinfo, const OF& of) │ │ │ │ -39 { │ │ │ │ -40 _M_a_t_r_i_x_G_r_a_p_h* mg = new _M_a_t_r_i_x_G_r_a_p_h(matrix.getmat()); │ │ │ │ -41 typedef typename PI::ParallelIndexSet ParallelIndexSet; │ │ │ │ -42 typedef typename ParallelIndexSet::const_iterator IndexIterator; │ │ │ │ -43 IndexIterator iend = pinfo.indexSet().end(); │ │ │ │ -44 │ │ │ │ -45 for(IndexIterator index = pinfo.indexSet().begin(); index != iend; ++index) │ │ │ │ -46 excluded[index->local()] = of.contains(index->local().attribute()); │ │ │ │ -47 │ │ │ │ -48 _S_u_b_G_r_a_p_h* sg= new _S_u_b_G_r_a_p_h(*mg, excluded); │ │ │ │ -49 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h* pg = new _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(*sg, IdentityMap(), sg- │ │ │ │ ->_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p()); │ │ │ │ -50 return _G_r_a_p_h_T_u_p_l_e(mg,pg,sg); │ │ │ │ -51 } │ │ │ │ -52 │ │ │ │ -_5_3 static void _f_r_e_e(_G_r_a_p_h_T_u_p_l_e& graphs) │ │ │ │ -54 { │ │ │ │ -55 delete std::get<2>(graphs); │ │ │ │ -56 delete std::get<1>(graphs); │ │ │ │ -57 } │ │ │ │ -58 }; │ │ │ │ -59 │ │ │ │ -60 template │ │ │ │ -_6_1 struct _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ -62 { │ │ │ │ -_6_3 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ -64 │ │ │ │ -_6_5 typedef _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_c_o_n_s_t_ _M_a_t_r_i_x_> _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11 │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ +17 │ │ │ │ +18#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ +19 │ │ │ │ +20// forward declaration │ │ │ │ +21namespace _D_u_n_e { │ │ │ │ +22 template < typename... Args > │ │ │ │ +23 class MultiTypeBlockVector; │ │ │ │ +24} │ │ │ │ +25 │ │ │ │ +26#include "_g_s_e_t_c_._h_h" │ │ │ │ +27 │ │ │ │ +28namespace _D_u_n_e { │ │ │ │ +29 │ │ │ │ +41 template │ │ │ │ +_4_2 struct FieldTraits< _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ +43 { │ │ │ │ +_4_4 using _f_i_e_l_d___t_y_p_e = typename _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r::field_type; │ │ │ │ +_4_5 using _r_e_a_l___t_y_p_e = typename _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r::real_type; │ │ │ │ +46 }; │ │ │ │ +56 template < typename... Args > │ │ │ │ +_5_7 class _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +58 : public std::tuple │ │ │ │ +59 { │ │ │ │ +61 typedef std::tuple TupleType; │ │ │ │ +62 public: │ │ │ │ +63 │ │ │ │ +_6_5 using _s_i_z_e___t_y_p_e = std::size_t; │ │ │ │ 66 │ │ │ │ -67 typedef _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h<_M_a_t_r_i_x_G_r_a_p_h, │ │ │ │ -68 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -69 _E_d_g_e_P_r_o_p_e_r_t_i_e_s, │ │ │ │ -70 IdentityMap, │ │ │ │ -_7_1 IdentityMap> _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h; │ │ │ │ -72 │ │ │ │ -_7_3 typedef std::tuple _G_r_a_p_h_T_u_p_l_e; │ │ │ │ -74 │ │ │ │ -75 template │ │ │ │ -_7_6 static _G_r_a_p_h_T_u_p_l_e _c_r_e_a_t_e([[maybe_unused]] const M& matrix, │ │ │ │ -77 [[maybe_unused]] T& excluded, │ │ │ │ -78 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -79 const OF&) │ │ │ │ -80 { │ │ │ │ -81 _M_a_t_r_i_x_G_r_a_p_h* mg = new _M_a_t_r_i_x_G_r_a_p_h(matrix.getmat()); │ │ │ │ -82 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h* pg = new _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(*mg, IdentityMap(), IdentityMap │ │ │ │ -()); │ │ │ │ -83 return _G_r_a_p_h_T_u_p_l_e(mg,pg); │ │ │ │ -84 } │ │ │ │ -85 │ │ │ │ -_8_6 static void _f_r_e_e(_G_r_a_p_h_T_u_p_l_e& graphs) │ │ │ │ -87 { │ │ │ │ -88 delete std::get<1>(graphs); │ │ │ │ -89 } │ │ │ │ +70 using TupleType::TupleType; │ │ │ │ +71 │ │ │ │ +_7_5 typedef _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r _t_y_p_e; │ │ │ │ +76 │ │ │ │ +_8_2 using _f_i_e_l_d___t_y_p_e = Std::detected_t >_:_:_f_i_e_l_d___t_y_p_e...>; │ │ │ │ +83 │ │ │ │ +_8_9 using _r_e_a_l___t_y_p_e = Std::detected_t >_:_:_r_e_a_l___t_y_p_e...>; │ │ │ │ 90 │ │ │ │ -91 }; │ │ │ │ -92 │ │ │ │ -93 } //namespace Amg │ │ │ │ -94} // namespace Dune │ │ │ │ -95#endif │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ -_g_r_a_p_h_._h_h │ │ │ │ -Provides classes for building the matrix graph. │ │ │ │ -_d_e_p_e_n_d_e_n_c_y_._h_h │ │ │ │ -Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ -_o_p_e_r_a_t_o_r_s_._h_h │ │ │ │ -Define general, extensible interface for operators. The available │ │ │ │ -implementation wraps a matrix. │ │ │ │ -_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ -Implementation of the BCRSMatrix class. │ │ │ │ +91 // make sure that we have an std::common_type: using an assertion produces a │ │ │ │ +more readable error message │ │ │ │ +92 // than a compiler template instantiation error │ │ │ │ +93 static_assert ( sizeof...(Args) == 0 or │ │ │ │ +94 not (std::is_same_v or std::is_same_v), │ │ │ │ +95 "No std::common_type implemented for the given field_type/real_type of the │ │ │ │ +Args. Please provide an implementation and check that a FieldTraits class is │ │ │ │ +present for your type."); │ │ │ │ +96 │ │ │ │ +97 │ │ │ │ +_1_0_3 static constexpr _s_i_z_e___t_y_p_e _s_i_z_e() │ │ │ │ +104 { │ │ │ │ +105 return sizeof...(Args); │ │ │ │ +106 } │ │ │ │ +107 │ │ │ │ +_1_1_0 static constexpr _s_i_z_e___t_y_p_e _N() │ │ │ │ +111 { │ │ │ │ +112 return sizeof...(Args); │ │ │ │ +113 } │ │ │ │ +114 │ │ │ │ +_1_1_6 _s_i_z_e___t_y_p_e _d_i_m() const │ │ │ │ +117 { │ │ │ │ +118 _s_i_z_e___t_y_p_e result = 0; │ │ │ │ +119 Hybrid::forEach(std::make_index_sequence<_N()>{}, │ │ │ │ +120 [&](auto i){result += std::get(*this).dim();}); │ │ │ │ +121 │ │ │ │ +122 return result; │ │ │ │ +123 } │ │ │ │ +124 │ │ │ │ +143 template< size_type index > │ │ │ │ +144 typename std::tuple_element::type& │ │ │ │ +_1_4_5 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ +> indexVariable) │ │ │ │ +146 { │ │ │ │ +147 return std::get(*this); │ │ │ │ +148 } │ │ │ │ +149 │ │ │ │ +155 template< size_type index > │ │ │ │ +156 const typename std::tuple_element::type& │ │ │ │ +_1_5_7 _o_p_e_r_a_t_o_r_[_]_ ([[maybe_unused]] const std::integral_constant< size_type, index │ │ │ │ +> indexVariable) const │ │ │ │ +158 { │ │ │ │ +159 return std::get(*this); │ │ │ │ +160 } │ │ │ │ +161 │ │ │ │ +164 template │ │ │ │ +_1_6_5 void _o_p_e_r_a_t_o_r_=_ (const T& newval) { │ │ │ │ +166 Dune::Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ +167 entry = newval; │ │ │ │ +168 }); │ │ │ │ +169 } │ │ │ │ +170 │ │ │ │ +_1_7_4 void _o_p_e_r_a_t_o_r_+_=_ (const _t_y_p_e& newv) { │ │ │ │ +175 using namespace Dune::Hybrid; │ │ │ │ +176 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ +177 (*this)[i] += newv[i]; │ │ │ │ +178 }); │ │ │ │ +179 } │ │ │ │ +180 │ │ │ │ +_1_8_4 void _o_p_e_r_a_t_o_r_-_=_ (const _t_y_p_e& newv) { │ │ │ │ +185 using namespace Dune::Hybrid; │ │ │ │ +186 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ +187 (*this)[i] -= newv[i]; │ │ │ │ +188 }); │ │ │ │ +189 } │ │ │ │ +190 │ │ │ │ +192 template::value, int> = 0> │ │ │ │ +_1_9_4 void _o_p_e_r_a_t_o_r_*_=_ (const T& w) { │ │ │ │ +195 Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ +196 entry *= w; │ │ │ │ +197 }); │ │ │ │ +198 } │ │ │ │ +199 │ │ │ │ +201 template::value, int> = 0> │ │ │ │ +_2_0_3 void _o_p_e_r_a_t_o_r_/_=_ (const T& w) { │ │ │ │ +204 Hybrid::forEach(*this, [&](auto&& entry) { │ │ │ │ +205 entry /= w; │ │ │ │ +206 }); │ │ │ │ +207 } │ │ │ │ +208 │ │ │ │ +_2_0_9 _f_i_e_l_d___t_y_p_e _o_p_e_r_a_t_o_r_*_ (const _t_y_p_e& newv) const { │ │ │ │ +210 using namespace Dune::Hybrid; │ │ │ │ +211 return accumulate(integralRange(Hybrid::size(*this)), _f_i_e_l_d___t_y_p_e(0), [&] │ │ │ │ +(auto&& a, auto&& i) { │ │ │ │ +212 return a + (*this)[i]*newv[i]; │ │ │ │ +213 }); │ │ │ │ +214 } │ │ │ │ +215 │ │ │ │ +_2_1_6 _f_i_e_l_d___t_y_p_e _d_o_t (const _t_y_p_e& newv) const { │ │ │ │ +217 using namespace Dune::Hybrid; │ │ │ │ +218 return accumulate(integralRange(Hybrid::size(*this)), _f_i_e_l_d___t_y_p_e(0), [&] │ │ │ │ +(auto&& a, auto&& i) { │ │ │ │ +219 return a + (*this)[i].dot(newv[i]); │ │ │ │ +220 }); │ │ │ │ +221 } │ │ │ │ +222 │ │ │ │ +_2_2_5 auto _o_n_e___n_o_r_m() const { │ │ │ │ +226 using namespace Dune::Hybrid; │ │ │ │ +227 return accumulate(*this, _r_e_a_l___t_y_p_e(0), [&](auto&& a, auto&& entry) { │ │ │ │ +228 return a + entry.one_norm(); │ │ │ │ +229 }); │ │ │ │ +230 } │ │ │ │ +231 │ │ │ │ +_2_3_4 auto _o_n_e___n_o_r_m___r_e_a_l() const { │ │ │ │ +235 using namespace Dune::Hybrid; │ │ │ │ +236 return accumulate(*this, _r_e_a_l___t_y_p_e(0), [&](auto&& a, auto&& entry) { │ │ │ │ +237 return a + entry.one_norm_real(); │ │ │ │ +238 }); │ │ │ │ +239 } │ │ │ │ +240 │ │ │ │ +_2_4_3 _r_e_a_l___t_y_p_e _t_w_o___n_o_r_m_2() const { │ │ │ │ +244 using namespace Dune::Hybrid; │ │ │ │ +245 return accumulate(*this, _r_e_a_l___t_y_p_e(0), [&](auto&& a, auto&& entry) { │ │ │ │ +246 return a + entry.two_norm2(); │ │ │ │ +247 }); │ │ │ │ +248 } │ │ │ │ +249 │ │ │ │ +_2_5_2 _r_e_a_l___t_y_p_e _t_w_o___n_o_r_m() const {return sqrt(this->_t_w_o___n_o_r_m_2());} │ │ │ │ +253 │ │ │ │ +_2_5_6 _r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m() const │ │ │ │ +257 { │ │ │ │ +258 using namespace Dune::Hybrid; │ │ │ │ +259 using std::max; │ │ │ │ +260 │ │ │ │ +261 _r_e_a_l___t_y_p_e result = 0.0; │ │ │ │ +262 // Compute max norm tracking appearing nan values │ │ │ │ +263 // if the field type supports nan. │ │ │ │ +264 if constexpr (HasNaN()) { │ │ │ │ +265 // This variable will preserve any nan value │ │ │ │ +266 _r_e_a_l___t_y_p_e nanTracker = 1.0; │ │ │ │ +267 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ +268 forEach(*this, [&](auto&& entry) { │ │ │ │ +269 _r_e_a_l___t_y_p_e entryNorm = entry.infinity_norm(); │ │ │ │ +270 result = max(entryNorm, result); │ │ │ │ +271 nanTracker += entryNorm; │ │ │ │ +272 }); │ │ │ │ +273 // Incorporate possible nan value into result │ │ │ │ +274 result *= (nanTracker / nanTracker); │ │ │ │ +275 } else { │ │ │ │ +276 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ +277 forEach(*this, [&](auto&& entry) { │ │ │ │ +278 result = max(entry.infinity_norm(), result); │ │ │ │ +279 }); │ │ │ │ +280 } │ │ │ │ +281 return result; │ │ │ │ +282 } │ │ │ │ +283 │ │ │ │ +_2_8_6 _r_e_a_l___t_y_p_e _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l() const │ │ │ │ +287 { │ │ │ │ +288 using namespace Dune::Hybrid; │ │ │ │ +289 using std::max; │ │ │ │ +290 │ │ │ │ +291 _r_e_a_l___t_y_p_e result = 0.0; │ │ │ │ +292 // Compute max norm tracking appearing nan values │ │ │ │ +293 // if the field type supports nan. │ │ │ │ +294 if constexpr (HasNaN()) { │ │ │ │ +295 // This variable will preserve any nan value │ │ │ │ +296 _r_e_a_l___t_y_p_e nanTracker = 1.0; │ │ │ │ +297 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ +298 forEach(*this, [&](auto&& entry) { │ │ │ │ +299 _r_e_a_l___t_y_p_e entryNorm = entry.infinity_norm_real(); │ │ │ │ +300 result = max(entryNorm, result); │ │ │ │ +301 nanTracker += entryNorm; │ │ │ │ +302 }); │ │ │ │ +303 // Incorporate possible nan value into result │ │ │ │ +304 result *= (nanTracker / nanTracker); │ │ │ │ +305 } else { │ │ │ │ +306 using namespace Dune::Hybrid; // needed for icc, see issue #31 │ │ │ │ +307 forEach(*this, [&](auto&& entry) { │ │ │ │ +308 result = max(entry.infinity_norm_real(), result); │ │ │ │ +309 }); │ │ │ │ +310 } │ │ │ │ +311 return result; │ │ │ │ +312 } │ │ │ │ +313 │ │ │ │ +318 template │ │ │ │ +_3_1_9 void _a_x_p_y (const Ta& a, const _t_y_p_e& y) { │ │ │ │ +320 using namespace Dune::Hybrid; │ │ │ │ +321 forEach(integralRange(Hybrid::size(*this)), [&](auto&& i) { │ │ │ │ +322 (*this)[i].axpy(a, y[i]); │ │ │ │ +323 }); │ │ │ │ +324 } │ │ │ │ +325 │ │ │ │ +326 }; │ │ │ │ +327 │ │ │ │ +328 │ │ │ │ +329 │ │ │ │ +332 template │ │ │ │ +_3_3_3 std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const │ │ │ │ +_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_A_r_g_s_._._._>& v) { │ │ │ │ +334 using namespace Dune::Hybrid; │ │ │ │ +335 forEach(integralRange(Dune::Hybrid::size(v)), [&](auto&& i) { │ │ │ │ +336 s << "\t(" << i << "):\n" << v[i] << "\n"; │ │ │ │ +337 }); │ │ │ │ +338 return s; │ │ │ │ +339 } │ │ │ │ +340 │ │ │ │ +341} // end namespace Dune │ │ │ │ +342 │ │ │ │ +343namespace _s_t_d │ │ │ │ +344{ │ │ │ │ +349 template │ │ │ │ +_3_5_0 struct tuple_element > │ │ │ │ +351 { │ │ │ │ +_3_5_2 using _t_y_p_e = typename std::tuple_element >::type; │ │ │ │ +353 }; │ │ │ │ +354 │ │ │ │ +359 template │ │ │ │ +_3_6_0 struct tuple_size<_D_u_n_e::MultiTypeBlockVector > │ │ │ │ +361 : std::integral_constant │ │ │ │ +362 {}; │ │ │ │ +363} │ │ │ │ +364 │ │ │ │ +365#endif │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ +_g_s_e_t_c_._h_h │ │ │ │ +Simple iterative methods like Jacobi, Gauss-Seidel, SOR, SSOR, etc. in a │ │ │ │ +generic way. │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ +void operator=(const T &newval) │ │ │ │ +Assignment operator. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:165 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ +std::size_t size_type │ │ │ │ +Type used for vector sizes. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:65 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_N │ │ │ │ +static constexpr size_type N() │ │ │ │ +Number of elements. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:110 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > │ │ │ │ +>::field_type... > field_type │ │ │ │ +The type used for scalars. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:82 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e │ │ │ │ +static constexpr size_type size() │ │ │ │ +Return the number of non-zero vector entries. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:103 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ +std::tuple_element< index, TupleType >::type & operator[](const std:: │ │ │ │ +integral_constant< size_type, index > indexVariable) │ │ │ │ +Random-access operator. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:145 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +typename MultiTypeBlockVector< Args... >::field_type field_type │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:44 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_d_i_m │ │ │ │ +size_type dim() const │ │ │ │ +Number of scalar elements. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:116 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_a_l___t_y_p_e │ │ │ │ +Std::detected_t< std::common_type_t, typename FieldTraits< std::decay_t< Args > │ │ │ │ +>::real_type... > real_type │ │ │ │ +The type used for real values. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:89 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_d_o_t │ │ │ │ +field_type dot(const type &newv) const │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:216 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_*_= │ │ │ │ +void operator*=(const T &w) │ │ │ │ +Multiplication with a scalar. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:194 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_a_x_p_y │ │ │ │ +void axpy(const Ta &a, const type &y) │ │ │ │ +Axpy operation on this vector (*this += a * y) │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:319 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_t_w_o___n_o_r_m │ │ │ │ +real_type two_norm() const │ │ │ │ +Compute the Euclidean norm. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:252 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_/_= │ │ │ │ +void operator/=(const T &w) │ │ │ │ +Division by a scalar. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:203 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_t_y_p_e │ │ │ │ +MultiTypeBlockVector< Args... > type │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:75 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_n_e___n_o_r_m │ │ │ │ +auto one_norm() const │ │ │ │ +Compute the 1-norm. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:225 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_t_w_o___n_o_r_m_2 │ │ │ │ +real_type two_norm2() const │ │ │ │ +Compute the squared Euclidean norm. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:243 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l │ │ │ │ +real_type infinity_norm_real() const │ │ │ │ +Compute the simplified maximum norm (uses 1-norm for complex values) │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:286 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_-_= │ │ │ │ +void operator-=(const type &newv) │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:184 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ +real_type infinity_norm() const │ │ │ │ +Compute the maximum norm. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:256 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ +field_type operator*(const type &newv) const │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:209 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_+_= │ │ │ │ +void operator+=(const type &newv) │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:174 │ │ │ │ +_s_t_d_:_:_t_u_p_l_e___e_l_e_m_e_n_t_<_ _i_,_ _D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _>_:_:_t_y_p_e │ │ │ │ +typename std::tuple_element< i, std::tuple< Args... > >::type type │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:352 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_:_:_o_n_e___n_o_r_m___r_e_a_l │ │ │ │ +auto one_norm_real() const │ │ │ │ +Compute the simplified 1-norm (uses 1-norm also for complex values) │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:234 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r_<_ _A_r_g_s_._._._ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ +typename MultiTypeBlockVector< Args... >::real_type real_type │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:45 │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -Class representing the properties of an edge in the matrix graph. │ │ │ │ -DDeeffiinniittiioonn dependency.hh:39 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -Class representing a node in the matrix graph. │ │ │ │ -DDeeffiinniittiioonn dependency.hh:126 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -The (undirected) graph of a matrix. │ │ │ │ -DDeeffiinniittiioonn graph.hh:51 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h │ │ │ │ -A subgraph of a graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:443 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -EdgeIndexMap getEdgeIndexMap() │ │ │ │ -Get an edge index map for the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -An index map for mapping the edges to indices. │ │ │ │ -DDeeffiinniittiioonn graph.hh:470 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -Attaches properties to the edges and vertices of a graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:978 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:22 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_S_u_b_G_r_a_p_h │ │ │ │ -Dune::Amg::SubGraph< MatrixGraph, std::vector< bool > > SubGraph │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:26 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -Dune::Amg::PropertiesGraph< SubGraph, VertexProperties, EdgeProperties, │ │ │ │ -IdentityMap, typename SubGraph::EdgeIndexMap > PropertiesGraph │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:32 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_M_a_t_r_i_x │ │ │ │ -M::matrix_type Matrix │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:23 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_c_r_e_a_t_e │ │ │ │ -static GraphTuple create(const M &matrix, T &excluded, PI &pinfo, const OF &of) │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:37 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_f_r_e_e │ │ │ │ -static void free(GraphTuple &graphs) │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:53 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -Dune::Amg::MatrixGraph< const Matrix > MatrixGraph │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:24 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_:_:_G_r_a_p_h_T_u_p_l_e │ │ │ │ -std::tuple< MatrixGraph *, PropertiesGraph *, SubGraph * > GraphTuple │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:34 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -Dune::Amg::MatrixGraph< const Matrix > MatrixGraph │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:65 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_M_a_t_r_i_x │ │ │ │ -M::matrix_type Matrix │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:63 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -Dune::Amg::PropertiesGraph< MatrixGraph, VertexProperties, EdgeProperties, │ │ │ │ -IdentityMap, IdentityMap > PropertiesGraph │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:71 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_G_r_a_p_h_T_u_p_l_e │ │ │ │ -std::tuple< MatrixGraph *, PropertiesGraph * > GraphTuple │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:73 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_c_r_e_a_t_e │ │ │ │ -static GraphTuple create(const M &matrix, T &excluded, const │ │ │ │ -SequentialInformation &pinfo, const OF &) │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:76 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_C_r_e_a_t_o_r_<_ _M_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_f_r_e_e │ │ │ │ -static void free(GraphTuple &graphs) │ │ │ │ -DDeeffiinniittiioonn graphcreator.hh:86 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ +std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v) │ │ │ │ +Send BlockVector to an output stream. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:583 │ │ │ │ +_D_u_n_e_:_:_M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +A Vector class to support different block types. │ │ │ │ +DDeeffiinniittiioonn multitypeblockvector.hh:59 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graph.hh File Reference │ │ │ +dune-istl: bvector.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,100 +65,71 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ Functions
│ │ │ - │ │ │ +
bvector.hh File Reference
│ │ │
│ │ │
│ │ │ │ │ │ -

Provides classes for building the matrix graph. │ │ │ +

This file implements a vector space as a tensor product of a given vector space. The number of components can be given at run-time. │ │ │ More...

│ │ │ -
#include <cstddef>
│ │ │ -#include <algorithm>
│ │ │ -#include <vector>
│ │ │ -#include <cassert>
│ │ │ +
#include <algorithm>
│ │ │ +#include <cmath>
│ │ │ +#include <complex>
│ │ │ +#include <initializer_list>
│ │ │ #include <limits>
│ │ │ +#include <memory>
│ │ │ +#include <utility>
│ │ │ +#include <vector>
│ │ │ +#include <dune/common/dotproduct.hh>
│ │ │ +#include <dune/common/ftraits.hh>
│ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ +#include <dune/common/fvector.hh>
│ │ │ +#include <dune/common/promotiontraits.hh>
│ │ │ #include <dune/common/typetraits.hh>
│ │ │ -#include <dune/common/iteratorfacades.hh>
│ │ │ -#include <dune/istl/istlexception.hh>
│ │ │ -#include <dune/common/propertymap.hh>
│ │ │ +#include <dune/common/scalarvectorview.hh>
│ │ │ +#include <dune/istl/blocklevel.hh>
│ │ │ +#include "basearray.hh"
│ │ │ +#include "istlexception.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::MatrixGraph< M >
 The (undirected) graph of a matrix. More...
 
class  Dune::Amg::MatrixGraph< M >::EdgeIteratorT< C >
 Iterator over all edges starting from a vertex. More...
 
class  Dune::Amg::MatrixGraph< M >::VertexIteratorT< C >
 The vertex iterator type of the graph. More...
 
class  Dune::Amg::SubGraph< G, T >
 A subgraph of a graph. More...
 
class  Dune::Amg::SubGraph< G, T >::EdgeIndexMap
 An index map for mapping the edges to indices. More...
 
class  Dune::Amg::SubGraph< G, T >::EdgeIterator
 The edge iterator of the graph. More...
 
class  Dune::Amg::SubGraph< G, T >::VertexIterator
 The vertex iterator of the graph. More...
class  Dune::BlockVector< B, A >
 A vector of blocks with memory management. More...
 
class  Dune::Amg::VertexPropertiesGraph< G, VP, VM >
 Attaches properties to the vertices of a graph. More...
 
class  Dune::Amg::VertexPropertiesGraph< G, VP, VM >::VertexIteratorT< C >
 
class  Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >
 Attaches properties to the edges and vertices of a graph. More...
 
class  Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::EdgeIteratorT< C >
 
class  Dune::Amg::PropertiesGraph< G, VP, EP, VM, EM >::VertexIteratorT< C >
 
class  Dune::Amg::GraphVertexPropertiesSelector< G >
 Wrapper to access the internal edge properties of a graph via operator[]() More...
 
class  Dune::Amg::GraphEdgePropertiesSelector< G >
 Wrapper to access the internal vertex properties of a graph via operator[]() More...
struct  Dune::FieldTraits< BlockVector< B, A > >
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ Functions

template<class G , class V >
int Dune::Amg::visitNeighbours (const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
 Visit all neighbour vertices of a vertex in a graph.
 
template<class K , class A >
std::ostream & Dune::operator<< (std::ostream &s, const BlockVector< K, A > &v)
 Send BlockVector to an output stream.
 
│ │ │

Detailed Description

│ │ │ -

Provides classes for building the matrix graph.

│ │ │ -
Author
Markus Blatt
│ │ │ -

During the coarsening process in AMG the matrix graph together with the dependencies, what connections in the graph are considered strong or weak, what vertices are isolated, etc., have to build. This information will be contained in the MatrixGraph class.

│ │ │ +

This file implements a vector space as a tensor product of a given vector space. The number of components can be given at run-time.

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,85 +1,49 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ _C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -graph.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides classes for building the matrix graph. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ +bvector.hh File Reference │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ +space. The number of components can be given at run-time. _M_o_r_e_._._. │ │ │ │ #include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ #include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ #include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ -#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ +#include "_b_a_s_e_a_r_r_a_y_._h_h" │ │ │ │ +#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_ _M_ _> │ │ │ │ -  The (undirected) graph of a matrix. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_ _M_ _>_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ -  Iterator over all edges starting from a vertex. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_<_ _M_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ -  The vertex iterator type of the graph. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _> │ │ │ │ -  A subgraph of a graph. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _>_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -  An index map for mapping the edges to indices. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _>_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -  The edge iterator of the graph. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_<_ _G_,_ _T_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -  The vertex iterator of the graph. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _> │ │ │ │ +  A vector of blocks with memory management. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _V_M_ _> │ │ │ │ -  Attaches properties to the vertices of a graph. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _V_M_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _E_P_,_ _V_M_,_ _E_M_ _> │ │ │ │ -  Attaches properties to the edges and vertices of a graph. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _E_P_,_ _V_M_,_ _E_M_ _>_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _V_P_,_ _E_P_,_ _V_M_,_ _E_M_ _>_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_ _C_ _> │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_<_ _G_ _> │ │ │ │ -  Wrapper to access the internal edge properties of a graph via _o_p_e_r_a_t_o_r │ │ │ │ - _[_]_(_) _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_<_ _G_ _> │ │ │ │ -  Wrapper to access the internal vertex properties of a graph via │ │ │ │ - _o_p_e_r_a_t_o_r_[_]_(_) _M_o_r_e_._._. │ │ │ │ +struct   _D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ -  │ │ │ │ FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ -int  _D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s (const G &graph, const typename G:: │ │ │ │ - VertexDescriptor &vertex, V &visitor) │ │ │ │ -  Visit all neighbour vertices of a vertex in a graph. │ │ │ │ +template │ │ │ │ +std::ostream &  _D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream &s, const _B_l_o_c_k_V_e_c_t_o_r< K, A > │ │ │ │ + &v) │ │ │ │ +  Send _B_l_o_c_k_V_e_c_t_o_r to an output stream. │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides classes for building the matrix graph. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ -During the coarsening process in AMG the matrix graph together with the │ │ │ │ -dependencies, what connections in the graph are considered strong or weak, what │ │ │ │ -vertices are isolated, etc., have to build. This information will be contained │ │ │ │ -in the MatrixGraph class. │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ +space. The number of components can be given at run-time. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: graph.hh Source File │ │ │ +dune-istl: bvector.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,1825 +70,949 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
graph.hh
│ │ │ +
bvector.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_GRAPH_HH
│ │ │ -
6#define DUNE_AMG_GRAPH_HH
│ │ │ -
7
│ │ │ -
8#include <cstddef>
│ │ │ +
5
│ │ │ +
6#ifndef DUNE_ISTL_BVECTOR_HH
│ │ │ +
7#define DUNE_ISTL_BVECTOR_HH
│ │ │ +
8
│ │ │
9#include <algorithm>
│ │ │ -
10#include <vector>
│ │ │ -
11#include <cassert>
│ │ │ -
12#include <limits>
│ │ │ -
13#include <dune/common/typetraits.hh>
│ │ │ -
14#include <dune/common/iteratorfacades.hh>
│ │ │ - │ │ │ -
16#include <dune/common/propertymap.hh>
│ │ │ +
10#include <cmath>
│ │ │ +
11#include <complex>
│ │ │ +
12#include <initializer_list>
│ │ │ +
13#include <limits>
│ │ │ +
14#include <memory>
│ │ │ +
15#include <utility>
│ │ │ +
16#include <vector>
│ │ │
17
│ │ │ -
18namespace Dune
│ │ │ -
19{
│ │ │ -
20 namespace Amg
│ │ │ -
21 {
│ │ │ -
49 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
51 {
│ │ │ -
52 public:
│ │ │ -
56 typedef M Matrix;
│ │ │ +
18#include <dune/common/dotproduct.hh>
│ │ │ +
19#include <dune/common/ftraits.hh>
│ │ │ +
20#include <dune/common/fmatrix.hh>
│ │ │ +
21#include <dune/common/fvector.hh>
│ │ │ +
22#include <dune/common/promotiontraits.hh>
│ │ │ +
23#include <dune/common/typetraits.hh>
│ │ │ +
24#include <dune/common/scalarvectorview.hh>
│ │ │ +
25
│ │ │ + │ │ │ +
27
│ │ │ +
28#include "basearray.hh"
│ │ │ +
29#include "istlexception.hh"
│ │ │ +
30
│ │ │ +
38namespace Dune {
│ │ │ +
39
│ │ │ +
41namespace Imp {
│ │ │ +
42
│ │ │ +
48 template <class B, bool isNumber>
│ │ │ +
49 class BlockTraitsImp;
│ │ │ +
50
│ │ │ +
51 template <class B>
│ │ │ +
52 class BlockTraitsImp<B,true>
│ │ │ +
53 {
│ │ │ +
54 public:
│ │ │ +
55 using field_type = B;
│ │ │ +
56 };
│ │ │
57
│ │ │ -
61 typedef typename std::remove_const<M>::type MutableMatrix;
│ │ │ -
62
│ │ │ -
66 typedef typename M::block_type Weight;
│ │ │ -
67
│ │ │ -
73 typedef typename M::size_type VertexDescriptor;
│ │ │ -
74
│ │ │ -
80 typedef std::ptrdiff_t EdgeDescriptor;
│ │ │ -
81
│ │ │ -
82 enum {
│ │ │ -
83 /*
│ │ │ -
84 * @brief Whether Matrix is mutable.
│ │ │ -
85 */
│ │ │ -
86 mutableMatrix = std::is_same<M, typename std::remove_const<M>::type>::value
│ │ │ -
87 };
│ │ │ -
88
│ │ │ -
89
│ │ │ -
93 template<class C>
│ │ │ -
│ │ │ - │ │ │ -
95 {
│ │ │ +
58 template <class B>
│ │ │ +
59 class BlockTraitsImp<B,false>
│ │ │ +
60 {
│ │ │ +
61 public:
│ │ │ +
62 using field_type = typename B::field_type;
│ │ │ +
63 };
│ │ │ +
64
│ │ │ +
67 template <class B>
│ │ │ +
68 using BlockTraits = BlockTraitsImp<B,IsNumber<B>::value>;
│ │ │ +
69
│ │ │ +
83 template<class B, class ST=std::size_t >
│ │ │ +
84 class block_vector_unmanaged : public base_array_unmanaged<B,ST>
│ │ │ +
85 {
│ │ │ +
86 public:
│ │ │ +
87
│ │ │ +
88 //===== type definitions and constants
│ │ │ +
89 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ +
90
│ │ │ +
92 typedef B block_type;
│ │ │ +
93
│ │ │ +
95 typedef ST size_type;
│ │ │
96
│ │ │ -
97 public:
│ │ │ -
101 typedef typename std::remove_const<C>::type MutableContainer;
│ │ │ -
105 typedef const typename std::remove_const<C>::type ConstContainer;
│ │ │ -
106
│ │ │ -
107 friend class EdgeIteratorT<MutableContainer>;
│ │ │ -
108 friend class EdgeIteratorT<ConstContainer>;
│ │ │ -
109
│ │ │ -
110 enum {
│ │ │ -
112 isMutable = std::is_same<C, MutableContainer>::value
│ │ │ -
113 };
│ │ │ +
98 typedef typename base_array_unmanaged<B,ST>::iterator Iterator;
│ │ │ +
99
│ │ │ +
101 typedef typename base_array_unmanaged<B,ST>::const_iterator ConstIterator;
│ │ │ +
102
│ │ │ +
104 typedef B value_type;
│ │ │ +
105
│ │ │ +
107 typedef B& reference;
│ │ │ +
108
│ │ │ +
110 typedef const B& const_reference;
│ │ │ +
111
│ │ │ +
112 //===== assignment from scalar
│ │ │
114
│ │ │ -
118 typedef typename std::conditional<isMutable && C::mutableMatrix,typename Matrix::row_type::Iterator,
│ │ │ -
119 typename Matrix::row_type::ConstIterator>::type
│ │ │ - │ │ │ +
115 block_vector_unmanaged& operator= (const field_type& k)
│ │ │ +
116 {
│ │ │ +
117 for (size_type i=0; i<this->n; i++)
│ │ │ +
118 (*this)[i] = k;
│ │ │ +
119 return *this;
│ │ │ +
120 }
│ │ │
121
│ │ │ -
125 typedef typename std::conditional<isMutable && C::mutableMatrix,typename M::block_type,
│ │ │ -
126 const typename M::block_type>::type
│ │ │ - │ │ │ -
128
│ │ │ - │ │ │ -
137 const ColIterator& end, const EdgeDescriptor& edge);
│ │ │ -
138
│ │ │ - │ │ │ -
146
│ │ │ -
151 template<class C1>
│ │ │ - │ │ │ -
153
│ │ │ -
154 typedef typename std::conditional<std::is_same<C, typename std::remove_const<C>::type>::value && C::mutableMatrix,
│ │ │ -
155 typename M::block_type, const typename M::block_type>::type
│ │ │ - │ │ │ -
157
│ │ │ - │ │ │ -
162
│ │ │ - │ │ │ +
122 //===== vector space arithmetic
│ │ │ +
124 block_vector_unmanaged& operator+= (const block_vector_unmanaged& y)
│ │ │ +
125 {
│ │ │ +
126#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
127 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
128#endif
│ │ │ +
129 for (size_type i=0; i<this->n; ++i) (*this)[i] += y[i];
│ │ │ +
130 return *this;
│ │ │ +
131 }
│ │ │ +
132
│ │ │ +
134 block_vector_unmanaged& operator-= (const block_vector_unmanaged& y)
│ │ │ +
135 {
│ │ │ +
136#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
137 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
138#endif
│ │ │ +
139 for (size_type i=0; i<this->n; ++i) (*this)[i] -= y[i];
│ │ │ +
140 return *this;
│ │ │ +
141 }
│ │ │ +
142
│ │ │ +
144 block_vector_unmanaged& operator*= (const field_type& k)
│ │ │ +
145 {
│ │ │ +
146 for (size_type i=0; i<this->n; ++i) (*this)[i] *= k;
│ │ │ +
147 return *this;
│ │ │ +
148 }
│ │ │ +
149
│ │ │ +
151 block_vector_unmanaged& operator/= (const field_type& k)
│ │ │ +
152 {
│ │ │ +
153 for (size_type i=0; i<this->n; ++i) (*this)[i] /= k;
│ │ │ +
154 return *this;
│ │ │ +
155 }
│ │ │ +
156
│ │ │ +
158 block_vector_unmanaged& axpy (const field_type& a, const block_vector_unmanaged& y)
│ │ │ +
159 {
│ │ │ +
160#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
161 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
162#endif
│ │ │ +
163 for (size_type i=0; i<this->n; ++i)
│ │ │ +
164 Impl::asVector((*this)[i]).axpy(a,Impl::asVector(y[i]));
│ │ │
165
│ │ │ -
167 bool operator!=(const EdgeIteratorT<typename std::remove_const<C>::type>& other) const;
│ │ │ +
166 return *this;
│ │ │ +
167 }
│ │ │
168
│ │ │ -
170 bool operator!=(const EdgeIteratorT<const typename std::remove_const<C>::type>& other) const;
│ │ │ -
171
│ │ │ -
173 bool operator==(const EdgeIteratorT<typename std::remove_const<C>::type>& other) const;
│ │ │ -
174
│ │ │ -
176 bool operator==(const EdgeIteratorT<const typename std::remove_const<C>::type>& other) const;
│ │ │ -
177
│ │ │ - │ │ │ -
180
│ │ │ - │ │ │ -
183
│ │ │ -
185 const EdgeDescriptor& operator*() const;
│ │ │ -
186
│ │ │ - │ │ │ -
189
│ │ │ -
190 private:
│ │ │ -
192 VertexDescriptor source_;
│ │ │ -
194 ColIterator block_;
│ │ │ -
195 /***
│ │ │ -
196 * @brief The column iterator positioned at the end of the row
│ │ │ -
197 * of vertex source_
│ │ │ -
198 */
│ │ │ -
199 ColIterator blockEnd_;
│ │ │ -
201 EdgeDescriptor edge_;
│ │ │ -
202 };
│ │ │ -
│ │ │ -
203
│ │ │ -
207 template<class C>
│ │ │ -
│ │ │ - │ │ │ -
209 {
│ │ │ -
210 public:
│ │ │ -
214 typedef typename std::remove_const<C>::type MutableContainer;
│ │ │ -
218 typedef const typename std::remove_const<C>::type ConstContainer;
│ │ │ -
219
│ │ │ -
220 friend class VertexIteratorT<MutableContainer>;
│ │ │ -
221 friend class VertexIteratorT<ConstContainer>;
│ │ │ -
222
│ │ │ -
223 enum {
│ │ │ -
225 isMutable = std::is_same<C, MutableContainer>::value
│ │ │ -
226 };
│ │ │ -
227
│ │ │ -
233 explicit VertexIteratorT(C* graph, const VertexDescriptor& current);
│ │ │ -
234
│ │ │ -
242 explicit VertexIteratorT(const VertexDescriptor& current);
│ │ │ -
243
│ │ │ - │ │ │ -
245
│ │ │ - │ │ │ -
251
│ │ │ - │ │ │ -
254
│ │ │ - │ │ │ -
257
│ │ │ - │ │ │ -
260
│ │ │ - │ │ │ +
169
│ │ │ +
177 template<class OtherB, class OtherST>
│ │ │ +
178 auto operator* (const block_vector_unmanaged<OtherB,OtherST>& y) const
│ │ │ +
179 {
│ │ │ +
180 typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
│ │ │ +
181 PromotedType sum(0);
│ │ │ +
182#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
183 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
184#endif
│ │ │ +
185 for (size_type i=0; i<this->n; ++i) {
│ │ │ +
186 sum += PromotedType(((*this)[i])*y[i]);
│ │ │ +
187 }
│ │ │ +
188 return sum;
│ │ │ +
189 }
│ │ │ +
190
│ │ │ +
198 template<class OtherB, class OtherST>
│ │ │ +
199 auto dot(const block_vector_unmanaged<OtherB,OtherST>& y) const
│ │ │ +
200 {
│ │ │ +
201 typedef typename PromotionTraits<field_type,typename BlockTraits<OtherB>::field_type>::PromotedType PromotedType;
│ │ │ +
202 PromotedType sum(0);
│ │ │ +
203#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
204 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
205#endif
│ │ │ +
206
│ │ │ +
207 for (size_type i=0; i<this->n; ++i)
│ │ │ +
208 sum += Impl::asVector((*this)[i]).dot(Impl::asVector(y[i]));
│ │ │ +
209
│ │ │ +
210 return sum;
│ │ │ +
211 }
│ │ │ +
212
│ │ │ +
213 //===== norms
│ │ │ +
214
│ │ │ +
216 typename FieldTraits<field_type>::real_type one_norm () const
│ │ │ +
217 {
│ │ │ +
218 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
219 for (size_type i=0; i<this->n; ++i)
│ │ │ +
220 sum += Impl::asVector((*this)[i]).one_norm();
│ │ │ +
221 return sum;
│ │ │ +
222 }
│ │ │ +
223
│ │ │ +
225 typename FieldTraits<field_type>::real_type one_norm_real () const
│ │ │ +
226 {
│ │ │ +
227 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
228 for (size_type i=0; i<this->n; ++i)
│ │ │ +
229 sum += Impl::asVector((*this)[i]).one_norm_real();
│ │ │ +
230 return sum;
│ │ │ +
231 }
│ │ │ +
232
│ │ │ +
234 typename FieldTraits<field_type>::real_type two_norm () const
│ │ │ +
235 {
│ │ │ +
236 using std::sqrt;
│ │ │ +
237 return sqrt(two_norm2());
│ │ │ +
238 }
│ │ │ +
239
│ │ │ +
241 typename FieldTraits<field_type>::real_type two_norm2 () const
│ │ │ +
242 {
│ │ │ +
243 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
244 for (size_type i=0; i<this->n; ++i)
│ │ │ +
245 sum += Impl::asVector((*this)[i]).two_norm2();
│ │ │ +
246 return sum;
│ │ │ +
247 }
│ │ │ +
248
│ │ │ +
250 template <typename ft = field_type,
│ │ │ +
251 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ +
252 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ +
253 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
254 using std::max;
│ │ │ +
255
│ │ │ +
256 real_type norm = 0;
│ │ │ +
257 for (auto const &xi : *this) {
│ │ │ +
258 real_type const a = Impl::asVector(xi).infinity_norm();
│ │ │ +
259 norm = max(a, norm);
│ │ │ +
260 }
│ │ │ +
261 return norm;
│ │ │ +
262 }
│ │ │
263
│ │ │ -
264 typedef typename std::conditional<std::is_same<C, typename std::remove_const<C>::type>::value && C::mutableMatrix,
│ │ │ -
265 typename M::block_type, const typename M::block_type>::type
│ │ │ - │ │ │ - │ │ │ -
269
│ │ │ - │ │ │ -
275
│ │ │ - │ │ │ -
282
│ │ │ - │ │ │ +
265 template <typename ft = field_type,
│ │ │ +
266 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ +
267 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ +
268 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
269 using std::max;
│ │ │ +
270
│ │ │ +
271 real_type norm = 0;
│ │ │ +
272 for (auto const &xi : *this) {
│ │ │ +
273 real_type const a = Impl::asVector(xi).infinity_norm_real();
│ │ │ +
274 norm = max(a, norm);
│ │ │ +
275 }
│ │ │ +
276 return norm;
│ │ │ +
277 }
│ │ │ +
278
│ │ │ +
280 template <typename ft = field_type,
│ │ │ +
281 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ +
282 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ +
283 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
284 using std::max;
│ │ │ +
285 using std::abs;
│ │ │ +
286
│ │ │ +
287 real_type norm = 0;
│ │ │ +
288 real_type isNaN = 1;
│ │ │
289
│ │ │ -
290 private:
│ │ │ -
291 C* graph_;
│ │ │ -
292 VertexDescriptor current_;
│ │ │ -
293 };
│ │ │ -
│ │ │ -
294
│ │ │ - │ │ │ -
299
│ │ │ - │ │ │ +
290 for (auto const &xi : *this) {
│ │ │ +
291 real_type const a = Impl::asVector(xi).infinity_norm();
│ │ │ +
292 norm = max(a, norm);
│ │ │ +
293 isNaN += a;
│ │ │ +
294 }
│ │ │ +
295 return norm * (isNaN / isNaN);
│ │ │ +
296 }
│ │ │ +
297
│ │ │ +
299 template <typename ft = field_type,
│ │ │ +
300 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ +
301 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ +
302 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
303 using std::max;
│ │ │
304
│ │ │ - │ │ │ -
309
│ │ │ - │ │ │ -
314
│ │ │ - │ │ │ -
320
│ │ │ - │ │ │ -
325
│ │ │ - │ │ │ -
331
│ │ │ - │ │ │ -
337
│ │ │ - │ │ │ +
305 real_type norm = 0;
│ │ │ +
306 real_type isNaN = 1;
│ │ │ +
307
│ │ │ +
308 for (auto const &xi : *this) {
│ │ │ +
309 real_type const a = Impl::asVector(xi).infinity_norm_real();
│ │ │ +
310 norm = max(a, norm);
│ │ │ +
311 isNaN += a;
│ │ │ +
312 }
│ │ │ +
313
│ │ │ +
314 return norm * (isNaN / isNaN);
│ │ │ +
315 }
│ │ │ +
316
│ │ │ +
317 //===== sizes
│ │ │ +
318
│ │ │ +
320 size_type N () const
│ │ │ +
321 {
│ │ │ +
322 return this->n;
│ │ │ +
323 }
│ │ │ +
324
│ │ │ +
326 size_type dim () const
│ │ │ +
327 {
│ │ │ +
328 size_type d=0;
│ │ │ +
329
│ │ │ +
330 for (size_type i=0; i<this->n; i++)
│ │ │ +
331 d += Impl::asVector((*this)[i]).dim();
│ │ │ +
332
│ │ │ +
333 return d;
│ │ │ +
334 }
│ │ │ +
335
│ │ │ +
336 protected:
│ │ │ +
338 block_vector_unmanaged () : base_array_unmanaged<B,ST>()
│ │ │ +
339 { }
│ │ │ +
340 };
│ │ │ +
341
│ │ │
343
│ │ │ - │ │ │ -
349
│ │ │ - │ │ │ -
357
│ │ │ - │ │ │ -
365
│ │ │ -
366
│ │ │ - │ │ │ +
348 template<class F>
│ │ │ +
349 class ScopeGuard {
│ │ │ +
350 F cleanupFunc_;
│ │ │ +
351 public:
│ │ │ +
352 ScopeGuard(F cleanupFunc) : cleanupFunc_(std::move(cleanupFunc)) {}
│ │ │ +
353 ScopeGuard(const ScopeGuard &) = delete;
│ │ │ +
354 ScopeGuard(ScopeGuard &&) = delete;
│ │ │ +
355 ScopeGuard &operator=(ScopeGuard) = delete;
│ │ │ +
356 ~ScopeGuard() { cleanupFunc_(); }
│ │ │ +
357 };
│ │ │ +
358
│ │ │ +
360
│ │ │ +
369 template<class F>
│ │ │ +
370 ScopeGuard<F> makeScopeGuard(F cleanupFunc)
│ │ │ +
371 {
│ │ │ +
372 return { std::move(cleanupFunc) };
│ │ │ +
373 }
│ │ │
374
│ │ │ - │ │ │ -
382
│ │ │ - │ │ │ -
388
│ │ │ -
393 const Matrix& matrix() const;
│ │ │ +
375} // end namespace Imp
│ │ │ +
390 template<class B, class A=std::allocator<B> >
│ │ │ +
│ │ │ +
391 class BlockVector : public Imp::block_vector_unmanaged<B,typename A::size_type>
│ │ │ +
392 {
│ │ │ +
393 public:
│ │ │
394
│ │ │ -
398 std::size_t noVertices() const;
│ │ │ +
395 //===== type definitions and constants
│ │ │ +
396
│ │ │ +
398 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │
399
│ │ │ - │ │ │ -
407
│ │ │ -
411 std::size_t noEdges() const;
│ │ │ -
412
│ │ │ - │ │ │ -
420 const VertexDescriptor& target) const;
│ │ │ -
421
│ │ │ -
422 private:
│ │ │ -
424 Matrix& matrix_;
│ │ │ -
426 EdgeDescriptor* start_;
│ │ │ -
428 MatrixGraph(const MatrixGraph&);
│ │ │ -
429
│ │ │ -
430 };
│ │ │ -
│ │ │ -
431
│ │ │ -
441 template<class G, class T>
│ │ │ -
│ │ │ - │ │ │ -
443 {
│ │ │ -
444 public:
│ │ │ -
448 typedef G Graph;
│ │ │ -
449
│ │ │ -
454 typedef T Excluded;
│ │ │ -
455
│ │ │ -
459 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ -
460
│ │ │ - │ │ │ -
462
│ │ │ -
│ │ │ - │ │ │ -
470 {
│ │ │ -
471 public:
│ │ │ -
472 typedef ReadablePropertyMapTag Category;
│ │ │ -
473
│ │ │ -
│ │ │ -
474 EdgeIndexMap(const EdgeDescriptor& firstEdge)
│ │ │ -
475 : firstEdge_(firstEdge)
│ │ │ -
476 {}
│ │ │ -
│ │ │ -
477
│ │ │ -
│ │ │ - │ │ │ -
480 : firstEdge_(emap.firstEdge_)
│ │ │ -
481 {}
│ │ │ -
│ │ │ -
482
│ │ │ -
│ │ │ -
483 std::size_t operator[](const EdgeDescriptor& edge) const
│ │ │ -
484 {
│ │ │ -
485 return edge-firstEdge_;
│ │ │ -
486 }
│ │ │ -
│ │ │ -
487 private:
│ │ │ -
489 EdgeDescriptor firstEdge_;
│ │ │ - │ │ │ -
492 {}
│ │ │ -
493 };
│ │ │ -
│ │ │ -
494
│ │ │ - │ │ │ -
500
│ │ │ -
│ │ │ -
504 class EdgeIterator : public RandomAccessIteratorFacade<EdgeIterator,const EdgeDescriptor>
│ │ │ -
505 {
│ │ │ -
506 public:
│ │ │ -
512 explicit EdgeIterator(const VertexDescriptor& source, const EdgeDescriptor& edge);
│ │ │ -
513
│ │ │ -
521 explicit EdgeIterator(const EdgeDescriptor& edge);
│ │ │ -
522
│ │ │ -
524 bool equals(const EdgeIterator& other) const;
│ │ │ -
525
│ │ │ - │ │ │ -
528
│ │ │ - │ │ │ -
531
│ │ │ -
532 EdgeIterator& advance(std::ptrdiff_t n);
│ │ │ -
533
│ │ │ - │ │ │ -
536
│ │ │ -
538 const VertexDescriptor& target() const;
│ │ │ -
539
│ │ │ -
541 const VertexDescriptor& source() const;
│ │ │ -
542
│ │ │ -
543 std::ptrdiff_t distanceTo(const EdgeIterator& other) const;
│ │ │ -
544
│ │ │ -
545 private:
│ │ │ -
547 VertexDescriptor source_;
│ │ │ -
552 EdgeDescriptor edge_;
│ │ │ -
553 };
│ │ │ -
│ │ │ -
554
│ │ │ -
│ │ │ - │ │ │ -
559 : public ForwardIteratorFacade<VertexIterator,const VertexDescriptor>
│ │ │ -
560 {
│ │ │ -
561 public:
│ │ │ -
568 explicit VertexIterator(const SubGraph<G,T>* graph, const VertexDescriptor& current,
│ │ │ -
569 const VertexDescriptor& end);
│ │ │ -
570
│ │ │ -
571
│ │ │ -
578 explicit VertexIterator(const VertexDescriptor& current);
│ │ │ -
579
│ │ │ - │ │ │ -
582
│ │ │ -
584 bool equals(const VertexIterator& other) const;
│ │ │ -
585
│ │ │ - │ │ │ -
591
│ │ │ - │ │ │ -
598
│ │ │ - │ │ │ -
605
│ │ │ -
606 private:
│ │ │ -
608 const SubGraph<Graph,T>* graph_;
│ │ │ -
610 VertexDescriptor current_;
│ │ │ -
612 VertexDescriptor end_;
│ │ │ -
613 };
│ │ │ -
│ │ │ -
614
│ │ │ - │ │ │ -
619
│ │ │ - │ │ │ +
401 typedef B block_type;
│ │ │ +
402
│ │ │ +
404 typedef A allocator_type;
│ │ │ +
405
│ │ │ +
407 typedef typename A::size_type size_type;
│ │ │ +
408
│ │ │ +
410 typedef typename Imp::block_vector_unmanaged<B,size_type>::Iterator Iterator;
│ │ │ +
411
│ │ │ +
413 typedef typename Imp::block_vector_unmanaged<B,size_type>::ConstIterator ConstIterator;
│ │ │ +
414
│ │ │ +
415 //===== constructors and such
│ │ │ +
416
│ │ │ +
│ │ │ + │ │ │ +
419 {
│ │ │ +
420 syncBaseArray();
│ │ │ +
421 }
│ │ │ +
│ │ │ +
422
│ │ │ +
│ │ │ +
424 explicit BlockVector (size_type _n) : storage_(_n)
│ │ │ +
425 {
│ │ │ +
426 syncBaseArray();
│ │ │ +
427 }
│ │ │ +
│ │ │ +
428
│ │ │ +
│ │ │ +
430 BlockVector (std::initializer_list<B> const &l) : storage_(l)
│ │ │ +
431 {
│ │ │ +
432 syncBaseArray();
│ │ │ +
433 }
│ │ │ +
│ │ │ +
434
│ │ │ +
435
│ │ │ +
447 template<typename S>
│ │ │ +
│ │ │ +
448 BlockVector (size_type _n, S _capacity)
│ │ │ +
449 {
│ │ │ +
450 static_assert(std::numeric_limits<S>::is_integer,
│ │ │ +
451 "capacity must be an unsigned integral type (be aware, that this constructor does not set the default value!)" );
│ │ │ +
452 if((size_type)_capacity > _n)
│ │ │ +
453 storage_.reserve(_capacity);
│ │ │ +
454 storage_.resize(_n);
│ │ │ +
455 syncBaseArray();
│ │ │ +
456 }
│ │ │ +
│ │ │ +
457
│ │ │ +
458
│ │ │ +
│ │ │ + │ │ │ +
469 {
│ │ │ +
470 [[maybe_unused]] const auto &guard =
│ │ │ +
471 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ +
472 storage_.reserve(capacity);
│ │ │ +
473 }
│ │ │ +
│ │ │ +
474
│ │ │ +
│ │ │ + │ │ │ +
482 {
│ │ │ +
483 return storage_.capacity();
│ │ │ +
484 }
│ │ │ +
│ │ │ +
485
│ │ │ +
│ │ │ +
496 void resize(size_type size)
│ │ │ +
497 {
│ │ │ +
498 [[maybe_unused]] const auto &guard =
│ │ │ +
499 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ +
500 storage_.resize(size);
│ │ │ +
501 }
│ │ │ +
│ │ │ +
502
│ │ │ +
│ │ │ + │ │ │ +
505 noexcept(noexcept(std::declval<BlockVector>().storage_ = a.storage_))
│ │ │ +
506 {
│ │ │ +
507 storage_ = a.storage_;
│ │ │ +
508 syncBaseArray();
│ │ │ +
509 }
│ │ │ +
│ │ │ +
510
│ │ │ +
│ │ │ + │ │ │ +
513 noexcept(noexcept(std::declval<BlockVector>().swap(a)))
│ │ │ +
514 {
│ │ │ +
515 swap(a);
│ │ │ +
516 }
│ │ │ +
│ │ │ +
517
│ │ │ +
│ │ │ + │ │ │ +
520 noexcept(noexcept(std::declval<BlockVector>().storage_ = a.storage_))
│ │ │ +
521 {
│ │ │ +
522 [[maybe_unused]] const auto &guard =
│ │ │ +
523 Imp::makeScopeGuard([this]{ syncBaseArray(); });
│ │ │ +
524 storage_ = a.storage_;
│ │ │ +
525 return *this;
│ │ │ +
526 }
│ │ │ +
│ │ │ +
527
│ │ │ +
│ │ │ + │ │ │ +
530 noexcept(noexcept(std::declval<BlockVector>().swap(a)))
│ │ │ +
531 {
│ │ │ +
532 swap(a);
│ │ │ +
533 return *this;
│ │ │ +
534 }
│ │ │ +
│ │ │ +
535
│ │ │ +
│ │ │ +
537 void swap(BlockVector &other)
│ │ │ +
538 noexcept(noexcept(
│ │ │ +
539 std::declval<BlockVector&>().storage_.swap(other.storage_)))
│ │ │ +
540 {
│ │ │ +
541 [[maybe_unused]] const auto &guard = Imp::makeScopeGuard([&]{
│ │ │ +
542 syncBaseArray();
│ │ │ +
543 other.syncBaseArray();
│ │ │ +
544 });
│ │ │ +
545 storage_.swap(other.storage_);
│ │ │ +
546 }
│ │ │ +
│ │ │ +
547
│ │ │ +
│ │ │ + │ │ │ +
550 {
│ │ │ +
551 // forward to operator= in base class
│ │ │ +
552 (static_cast<Imp::block_vector_unmanaged<B,size_type>&>(*this)) = k;
│ │ │ +
553 return *this;
│ │ │ +
554 }
│ │ │ +
│ │ │ +
555
│ │ │ +
556 private:
│ │ │ +
557 void syncBaseArray() noexcept
│ │ │ +
558 {
│ │ │ +
559 this->p = storage_.data();
│ │ │ +
560 this->n = storage_.size();
│ │ │ +
561 }
│ │ │ +
562
│ │ │ +
563 std::vector<B, A> storage_;
│ │ │ +
564 };
│ │ │ +
│ │ │ +
565
│ │ │ +
571 template<class B, class A>
│ │ │ +
│ │ │ +
572 struct FieldTraits< BlockVector<B, A> >
│ │ │ +
573 {
│ │ │ +
574 typedef typename FieldTraits<B>::field_type field_type;
│ │ │ +
575 typedef typename FieldTraits<B>::real_type real_type;
│ │ │ +
576 };
│ │ │ +
│ │ │ +
582 template<class K, class A>
│ │ │ +
│ │ │ +
583 std::ostream& operator<< (std::ostream& s, const BlockVector<K, A>& v)
│ │ │ +
584 {
│ │ │ +
585 typedef typename BlockVector<K, A>::size_type size_type;
│ │ │ +
586
│ │ │ +
587 for (size_type i=0; i<v.size(); i++)
│ │ │ +
588 s << v[i] << std::endl;
│ │ │ +
589
│ │ │ +
590 return s;
│ │ │ +
591 }
│ │ │ +
│ │ │ +
592
│ │ │ +
594namespace Imp {
│ │ │ +
595
│ │ │ +
614#ifndef DOXYGEN
│ │ │ +
615 template<class B, class A>
│ │ │ +
616#else
│ │ │ +
617 template<class B, class A=std::allocator<B> >
│ │ │ +
618#endif
│ │ │ +
619 class BlockVectorWindow : public Imp::block_vector_unmanaged<B,typename A::size_type>
│ │ │ +
620 {
│ │ │ +
621 public:
│ │ │ +
622
│ │ │ +
623 //===== type definitions and constants
│ │ │
624
│ │ │ - │ │ │ +
626 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ +
627
│ │ │ +
629 typedef B block_type;
│ │ │
630
│ │ │ - │ │ │ +
632 typedef A allocator_type;
│ │ │ +
633
│ │ │ +
635 typedef typename A::size_type size_type;
│ │ │
636
│ │ │ - │ │ │ -
644
│ │ │ - │ │ │ -
652
│ │ │ -
656 std::size_t noVertices() const;
│ │ │ -
657
│ │ │ - │ │ │ -
665
│ │ │ -
669 std::size_t noEdges() const;
│ │ │ - │ │ │ -
677 const VertexDescriptor& target) const;
│ │ │ -
685 SubGraph(const Graph& graph, const T& excluded);
│ │ │ -
686
│ │ │ - │ │ │ +
638 typedef typename Imp::block_vector_unmanaged<B,size_type>::Iterator Iterator;
│ │ │ +
639
│ │ │ +
641 typedef typename Imp::block_vector_unmanaged<B,size_type>::ConstIterator ConstIterator;
│ │ │ +
642
│ │ │ +
643
│ │ │ +
644 //===== constructors and such
│ │ │ +
646 BlockVectorWindow () : Imp::block_vector_unmanaged<B,size_type>()
│ │ │ +
647 { }
│ │ │ +
648
│ │ │ +
650 BlockVectorWindow (B* _p, size_type _n)
│ │ │ +
651 {
│ │ │ +
652 this->n = _n;
│ │ │ +
653 this->p = _p;
│ │ │ +
654 }
│ │ │ +
655
│ │ │ +
657 BlockVectorWindow (const BlockVectorWindow& a)
│ │ │ +
658 {
│ │ │ +
659 this->n = a.n;
│ │ │ +
660 this->p = a.p;
│ │ │ +
661 }
│ │ │ +
662
│ │ │ +
664 BlockVectorWindow& operator= (const BlockVectorWindow& a)
│ │ │ +
665 {
│ │ │ +
666 // check correct size
│ │ │ +
667#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
668 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
669#endif
│ │ │ +
670
│ │ │ +
671 if (&a!=this) // check if this and a are different objects
│ │ │ +
672 {
│ │ │ +
673 // copy data
│ │ │ +
674 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ +
675 }
│ │ │ +
676 return *this;
│ │ │ +
677 }
│ │ │ +
678
│ │ │ +
680 BlockVectorWindow& operator= (const field_type& k)
│ │ │ +
681 {
│ │ │ +
682 (static_cast<Imp::block_vector_unmanaged<B,size_type>&>(*this)) = k;
│ │ │ +
683 return *this;
│ │ │ +
684 }
│ │ │ +
685
│ │ │ +
687 operator BlockVector<B, A>() const {
│ │ │ +
688 auto bv = BlockVector<B, A>(this->n);
│ │ │ +
689
│ │ │ +
690 std::copy(this->begin(), this->end(), bv.begin());
│ │ │
691
│ │ │ -
692 private:
│ │ │ -
694 const T& excluded_;
│ │ │ -
696 std::size_t noVertices_;
│ │ │ -
698 VertexDescriptor endVertex_;
│ │ │ -
700 int noEdges_;
│ │ │ -
705 VertexDescriptor maxVertex_;
│ │ │ -
707 VertexDescriptor* edges_;
│ │ │ -
709 std::ptrdiff_t* start_;
│ │ │ -
711 std::ptrdiff_t* end_;
│ │ │ -
713 SubGraph(const SubGraph&)
│ │ │ -
714 {}
│ │ │ -
715 };
│ │ │ -
│ │ │ -
716
│ │ │ -
717
│ │ │ -
721 template<class G, class VP, class VM=IdentityMap>
│ │ │ -
│ │ │ - │ │ │ -
723 {
│ │ │ -
724 public:
│ │ │ -
728 typedef G Graph;
│ │ │ +
692 return bv;
│ │ │ +
693 }
│ │ │ +
694
│ │ │ +
695 //===== window manipulation methods
│ │ │ +
696
│ │ │ +
698 void set (size_type _n, B* _p)
│ │ │ +
699 {
│ │ │ +
700 this->n = _n;
│ │ │ +
701 this->p = _p;
│ │ │ +
702 }
│ │ │ +
703
│ │ │ +
705 void setsize (size_type _n)
│ │ │ +
706 {
│ │ │ +
707 this->n = _n;
│ │ │ +
708 }
│ │ │ +
709
│ │ │ +
711 void setptr (B* _p)
│ │ │ +
712 {
│ │ │ +
713 this->p = _p;
│ │ │ +
714 }
│ │ │ +
715
│ │ │ +
717 B* getptr ()
│ │ │ +
718 {
│ │ │ +
719 return this->p;
│ │ │ +
720 }
│ │ │ +
721
│ │ │ +
723 size_type getsize () const
│ │ │ +
724 {
│ │ │ +
725 return this->n;
│ │ │ +
726 }
│ │ │ +
727 };
│ │ │ +
728
│ │ │
729
│ │ │ -
733 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ -
734
│ │ │ -
738 typedef typename Graph::EdgeDescriptor EdgeDescriptor;
│ │ │ -
739
│ │ │ - │ │ │ -
744
│ │ │ -
756 typedef VM VertexMap;
│ │ │ -
757
│ │ │ -
761 typedef typename Graph::EdgeIterator EdgeIterator;
│ │ │ +
730
│ │ │ +
741 template<class B, class ST=std::size_t >
│ │ │ +
742 class compressed_block_vector_unmanaged : public compressed_base_array_unmanaged<B,ST>
│ │ │ +
743 {
│ │ │ +
744 public:
│ │ │ +
745
│ │ │ +
746 //===== type definitions and constants
│ │ │ +
747
│ │ │ +
749 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ +
750
│ │ │ +
752 typedef B block_type;
│ │ │ +
753
│ │ │ +
755 typedef typename compressed_base_array_unmanaged<B,ST>::iterator Iterator;
│ │ │ +
756
│ │ │ +
758 typedef typename compressed_base_array_unmanaged<B,ST>::const_iterator ConstIterator;
│ │ │ +
759
│ │ │ +
761 typedef ST size_type;
│ │ │
762
│ │ │ -
766 typedef typename Graph::ConstEdgeIterator ConstEdgeIterator;
│ │ │ -
767
│ │ │ - │ │ │ +
763 //===== assignment from scalar
│ │ │ +
764
│ │ │ +
765 compressed_block_vector_unmanaged& operator= (const field_type& k)
│ │ │ +
766 {
│ │ │ +
767 for (size_type i=0; i<this->n; i++)
│ │ │ +
768 (this->p)[i] = k;
│ │ │ +
769 return *this;
│ │ │ +
770 }
│ │ │ +
771
│ │ │ +
772
│ │ │ +
773 //===== vector space arithmetic
│ │ │
774
│ │ │ - │ │ │ -
781
│ │ │ - │ │ │ -
788
│ │ │ - │ │ │ -
795
│ │ │ +
776 template<class V>
│ │ │ +
777 compressed_block_vector_unmanaged& operator+= (const V& y)
│ │ │ +
778 {
│ │ │ +
779#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
780 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ +
781#endif
│ │ │ +
782 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) += y.p[i];
│ │ │ +
783 return *this;
│ │ │ +
784 }
│ │ │ +
785
│ │ │ +
787 template<class V>
│ │ │ +
788 compressed_block_vector_unmanaged& operator-= (const V& y)
│ │ │ +
789 {
│ │ │ +
790#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
791 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ +
792#endif
│ │ │ +
793 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) -= y.p[i];
│ │ │ +
794 return *this;
│ │ │ +
795 }
│ │ │
796
│ │ │ -
797 template<class C>
│ │ │ -
│ │ │ - │ │ │ -
799 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
800 C>::value,
│ │ │ -
801 typename Graph::VertexIterator,
│ │ │ -
802 typename Graph::ConstVertexIterator>::type
│ │ │ -
803 {
│ │ │ -
804 friend class VertexIteratorT<const typename std::remove_const<C>::type>;
│ │ │ -
805 friend class VertexIteratorT<typename std::remove_const<C>::type>;
│ │ │ -
806 public:
│ │ │ -
810 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
811 C>::value,
│ │ │ -
812 typename Graph::VertexIterator,
│ │ │ -
813 typename Graph::ConstVertexIterator>::type
│ │ │ - │ │ │ +
798 template<class V>
│ │ │ +
799 compressed_block_vector_unmanaged& axpy (const field_type& a, const V& y)
│ │ │ +
800 {
│ │ │ +
801#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
802 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ +
803#endif
│ │ │ +
804 for (size_type i=0; i<y.n; ++i)
│ │ │ +
805 Impl::asVector((*this)[y.j[i]]).axpy(a,Impl::asVector(y.p[i]));
│ │ │ +
806 return *this;
│ │ │ +
807 }
│ │ │ +
808
│ │ │ +
810 compressed_block_vector_unmanaged& operator*= (const field_type& k)
│ │ │ +
811 {
│ │ │ +
812 for (size_type i=0; i<this->n; ++i) (this->p)[i] *= k;
│ │ │ +
813 return *this;
│ │ │ +
814 }
│ │ │
815
│ │ │ -
819 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
820 C>::value,
│ │ │ -
821 typename Graph::EdgeIterator,
│ │ │ -
822 typename Graph::ConstEdgeIterator>::type
│ │ │ - │ │ │ -
824
│ │ │ -
830 explicit VertexIteratorT(const Father& iter,
│ │ │ -
831 C* graph);
│ │ │ -
832
│ │ │ -
833
│ │ │ -
841 explicit VertexIteratorT(const Father& iter);
│ │ │ -
842
│ │ │ -
847 template<class C1>
│ │ │ -
848 VertexIteratorT(const VertexIteratorT<C1>& other);
│ │ │ +
817 compressed_block_vector_unmanaged& operator/= (const field_type& k)
│ │ │ +
818 {
│ │ │ +
819 for (size_type i=0; i<this->n; ++i) (this->p)[i] /= k;
│ │ │ +
820 return *this;
│ │ │ +
821 }
│ │ │ +
822
│ │ │ +
823
│ │ │ +
824 //===== Euclidean scalar product
│ │ │ +
825
│ │ │ +
827 field_type operator* (const compressed_block_vector_unmanaged& y) const
│ │ │ +
828 {
│ │ │ +
829#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
830 if (!includesindexset(y) || !y.includesindexset(*this) )
│ │ │ +
831 DUNE_THROW(ISTLError,"index set mismatch");
│ │ │ +
832#endif
│ │ │ +
833 field_type sum=0;
│ │ │ +
834 for (size_type i=0; i<this->n; ++i)
│ │ │ +
835 sum += (this->p)[i] * y[(this->j)[i]];
│ │ │ +
836 return sum;
│ │ │ +
837 }
│ │ │ +
838
│ │ │ +
839
│ │ │ +
840 //===== norms
│ │ │ +
841
│ │ │ +
843 typename FieldTraits<field_type>::real_type one_norm () const
│ │ │ +
844 {
│ │ │ +
845 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
846 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm();
│ │ │ +
847 return sum;
│ │ │ +
848 }
│ │ │
849
│ │ │ -
853 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ -
854 VertexProperties&,
│ │ │ -
855 const VertexProperties&>::type
│ │ │ -
856 properties() const;
│ │ │ +
851 typename FieldTraits<field_type>::real_type one_norm_real () const
│ │ │ +
852 {
│ │ │ +
853 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
854 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm_real();
│ │ │ +
855 return sum;
│ │ │ +
856 }
│ │ │
857
│ │ │ - │ │ │ -
864
│ │ │ - │ │ │ -
871
│ │ │ -
872 private:
│ │ │ -
876 C* graph_;
│ │ │ -
877 };
│ │ │ -
│ │ │ -
878
│ │ │ -
882 typedef VertexIteratorT<VertexPropertiesGraph<Graph,
│ │ │ -
883 VertexProperties,VM> > VertexIterator;
│ │ │ -
884
│ │ │ -
888 typedef VertexIteratorT<const VertexPropertiesGraph<Graph,
│ │ │ -
889 VertexProperties,VM> > ConstVertexIterator;
│ │ │ -
890
│ │ │ - │ │ │ +
859 typename FieldTraits<field_type>::real_type two_norm () const
│ │ │ +
860 {
│ │ │ +
861 using std::sqrt;
│ │ │ +
862 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
863 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
│ │ │ +
864 return sqrt(sum);
│ │ │ +
865 }
│ │ │ +
866
│ │ │ +
868 typename FieldTraits<field_type>::real_type two_norm2 () const
│ │ │ +
869 {
│ │ │ +
870 typename FieldTraits<field_type>::real_type sum=0;
│ │ │ +
871 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
│ │ │ +
872 return sum;
│ │ │ +
873 }
│ │ │ +
874
│ │ │ +
876 template <typename ft = field_type,
│ │ │ +
877 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ +
878 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ +
879 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
880 using std::max;
│ │ │ +
881
│ │ │ +
882 real_type norm = 0;
│ │ │ +
883 for (auto const &x : *this) {
│ │ │ +
884 real_type const a = x.infinity_norm();
│ │ │ +
885 norm = max(a, norm);
│ │ │ +
886 }
│ │ │ +
887 return norm;
│ │ │ +
888 }
│ │ │ +
889
│ │ │ +
891 template <typename ft = field_type,
│ │ │ +
892 typename std::enable_if<!HasNaN<ft>::value, int>::type = 0>
│ │ │ +
893 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ +
894 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
895 using std::max;
│ │ │
896
│ │ │ - │ │ │ -
902
│ │ │ - │ │ │ -
908
│ │ │ - │ │ │ -
914
│ │ │ -
920 VertexProperties& getVertexProperties(const VertexDescriptor& vertex);
│ │ │ +
897 real_type norm = 0;
│ │ │ +
898 for (auto const &x : *this) {
│ │ │ +
899 real_type const a = x.infinity_norm_real();
│ │ │ +
900 norm = max(a, norm);
│ │ │ +
901 }
│ │ │ +
902 return norm;
│ │ │ +
903 }
│ │ │ +
904
│ │ │ +
906 template <typename ft = field_type,
│ │ │ +
907 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ +
908 typename FieldTraits<ft>::real_type infinity_norm() const {
│ │ │ +
909 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
910 using std::max;
│ │ │ +
911
│ │ │ +
912 real_type norm = 0;
│ │ │ +
913 real_type isNaN = 1;
│ │ │ +
914 for (auto const &x : *this) {
│ │ │ +
915 real_type const a = x.infinity_norm();
│ │ │ +
916 norm = max(a, norm);
│ │ │ +
917 isNaN += a;
│ │ │ +
918 }
│ │ │ +
919 return norm * (isNaN / isNaN);
│ │ │ +
920 }
│ │ │
921
│ │ │ -
927 const VertexProperties& getVertexProperties(const VertexDescriptor& vertex) const;
│ │ │ +
923 template <typename ft = field_type,
│ │ │ +
924 typename std::enable_if<HasNaN<ft>::value, int>::type = 0>
│ │ │ +
925 typename FieldTraits<ft>::real_type infinity_norm_real() const {
│ │ │ +
926 using real_type = typename FieldTraits<ft>::real_type;
│ │ │ +
927 using std::max;
│ │ │
928
│ │ │ -
933 const Graph& graph() const;
│ │ │ -
934
│ │ │ -
938 std::size_t noVertices() const;
│ │ │ -
939
│ │ │ -
943 std::size_t noEdges() const;
│ │ │ -
944
│ │ │ - │ │ │ -
952
│ │ │ -
958 VertexPropertiesGraph(Graph& graph, const VertexMap vmap=VertexMap());
│ │ │ -
959
│ │ │ -
960 private:
│ │ │ -
961 VertexPropertiesGraph(const VertexPropertiesGraph&)
│ │ │ -
962 {}
│ │ │ -
963
│ │ │ -
965 Graph& graph_;
│ │ │ -
967 VertexMap vmap_;
│ │ │ -
969 std::vector<VertexProperties> vertexProperties_;
│ │ │ -
970
│ │ │ -
971 };
│ │ │ -
│ │ │ +
929 real_type norm = 0;
│ │ │ +
930 real_type isNaN = 1;
│ │ │ +
931 for (auto const &x : *this) {
│ │ │ +
932 real_type const a = x.infinity_norm_real();
│ │ │ +
933 norm = max(a, norm);
│ │ │ +
934 isNaN += a;
│ │ │ +
935 }
│ │ │ +
936 return norm * (isNaN / isNaN);
│ │ │ +
937 }
│ │ │ +
938
│ │ │ +
939 //===== sizes
│ │ │ +
940
│ │ │ +
942 size_type N () const
│ │ │ +
943 {
│ │ │ +
944 return this->n;
│ │ │ +
945 }
│ │ │ +
946
│ │ │ +
948 size_type dim () const
│ │ │ +
949 {
│ │ │ +
950 size_type d=0;
│ │ │ +
951 for (size_type i=0; i<this->n; i++)
│ │ │ +
952 d += (this->p)[i].dim();
│ │ │ +
953 return d;
│ │ │ +
954 }
│ │ │ +
955
│ │ │ +
956 protected:
│ │ │ +
958 compressed_block_vector_unmanaged () : compressed_base_array_unmanaged<B,ST>()
│ │ │ +
959 { }
│ │ │ +
960
│ │ │ +
962 template<class V>
│ │ │ +
963 bool includesindexset (const V& y)
│ │ │ +
964 {
│ │ │ +
965 typename V::ConstIterator e=this->end();
│ │ │ +
966 for (size_type i=0; i<y.n; i++)
│ │ │ +
967 if (this->find(y.j[i])==e)
│ │ │ +
968 return false;
│ │ │ +
969 return true;
│ │ │ +
970 }
│ │ │ +
971 };
│ │ │
972
│ │ │ -
976 template<class G, class VP, class EP, class VM=IdentityMap, class EM=IdentityMap>
│ │ │ -
│ │ │ - │ │ │ -
978 {
│ │ │ -
979 public:
│ │ │ -
983 typedef G Graph;
│ │ │ -
984
│ │ │ -
988 typedef typename Graph::VertexDescriptor VertexDescriptor;
│ │ │ -
989
│ │ │ -
993 typedef typename Graph::EdgeDescriptor EdgeDescriptor;
│ │ │ -
994
│ │ │ - │ │ │ -
999
│ │ │ -
1011 typedef VM VertexMap;
│ │ │ -
1012
│ │ │ -
1016 typedef EP EdgeProperties;
│ │ │ -
1017
│ │ │ -
1018
│ │ │ -
1030 typedef EM EdgeMap;
│ │ │ -
1031
│ │ │ -
1032 template<class C>
│ │ │ -
│ │ │ - │ │ │ -
1034 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
1035 C>::value,
│ │ │ -
1036 typename Graph::EdgeIterator,
│ │ │ -
1037 typename Graph::ConstEdgeIterator>::type
│ │ │ -
1038 {
│ │ │ -
1039
│ │ │ -
1040 friend class EdgeIteratorT<const typename std::remove_const<C>::type>;
│ │ │ -
1041 friend class EdgeIteratorT<typename std::remove_const<C>::type>;
│ │ │ -
1042 public:
│ │ │ -
1046 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
1047 C>::value,
│ │ │ -
1048 typename Graph::EdgeIterator,
│ │ │ -
1049 typename Graph::ConstEdgeIterator>::type
│ │ │ - │ │ │ -
1051
│ │ │ -
1057 explicit EdgeIteratorT(const Father& iter,
│ │ │ -
1058 C* graph);
│ │ │ +
973
│ │ │ +
992 template<class B, class ST=std::size_t >
│ │ │ +
993 class CompressedBlockVectorWindow : public compressed_block_vector_unmanaged<B,ST>
│ │ │ +
994 {
│ │ │ +
995 public:
│ │ │ +
996
│ │ │ +
997 //===== type definitions and constants
│ │ │ +
998
│ │ │ +
1000 using field_type = typename Imp::BlockTraits<B>::field_type;
│ │ │ +
1001
│ │ │ +
1003 typedef B block_type;
│ │ │ +
1004
│ │ │ +
1006 typedef ST size_type;
│ │ │ +
1007
│ │ │ +
1009 typedef typename compressed_block_vector_unmanaged<B,ST>::Iterator Iterator;
│ │ │ +
1010
│ │ │ +
1012 typedef typename compressed_block_vector_unmanaged<B,ST>::ConstIterator ConstIterator;
│ │ │ +
1013
│ │ │ +
1014
│ │ │ +
1015 //===== constructors and such
│ │ │ +
1017 CompressedBlockVectorWindow () : compressed_block_vector_unmanaged<B,ST>()
│ │ │ +
1018 { }
│ │ │ +
1019
│ │ │ +
1021 CompressedBlockVectorWindow (B* _p, size_type* _j, size_type _n)
│ │ │ +
1022 {
│ │ │ +
1023 this->n = _n;
│ │ │ +
1024 this->p = _p;
│ │ │ +
1025 this->j = _j;
│ │ │ +
1026 }
│ │ │ +
1027
│ │ │ +
1029 CompressedBlockVectorWindow (const CompressedBlockVectorWindow& a)
│ │ │ +
1030 {
│ │ │ +
1031 this->n = a.n;
│ │ │ +
1032 this->p = a.p;
│ │ │ +
1033 this->j = a.j;
│ │ │ +
1034 }
│ │ │ +
1035
│ │ │ +
1037 CompressedBlockVectorWindow& operator= (const CompressedBlockVectorWindow& a)
│ │ │ +
1038 {
│ │ │ +
1039 // check correct size
│ │ │ +
1040#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ +
1041 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
│ │ │ +
1042#endif
│ │ │ +
1043
│ │ │ +
1044 if (&a!=this) // check if this and a are different objects
│ │ │ +
1045 {
│ │ │ +
1046 // copy data
│ │ │ +
1047 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
│ │ │ +
1048 for (size_type i=0; i<this->n; i++) this->j[i]=a.j[i];
│ │ │ +
1049 }
│ │ │ +
1050 return *this;
│ │ │ +
1051 }
│ │ │ +
1052
│ │ │ +
1054 CompressedBlockVectorWindow& operator= (const field_type& k)
│ │ │ +
1055 {
│ │ │ +
1056 (static_cast<compressed_block_vector_unmanaged<B,ST>&>(*this)) = k;
│ │ │ +
1057 return *this;
│ │ │ +
1058 }
│ │ │
1059
│ │ │ -
1067 explicit EdgeIteratorT(const Father& iter);
│ │ │ -
1068
│ │ │ -
1073 template<class C1>
│ │ │ -
1074 EdgeIteratorT(const EdgeIteratorT<C1>& other);
│ │ │ -
1075
│ │ │ -
1079 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ -
1080 EdgeProperties&,
│ │ │ -
1081 const EdgeProperties&>::type
│ │ │ -
1082 properties() const;
│ │ │ -
1083
│ │ │ -
1084 private:
│ │ │ -
1088 C* graph_;
│ │ │ -
1089 };
│ │ │ -
│ │ │ -
1090
│ │ │ -
1094 typedef EdgeIteratorT<PropertiesGraph<Graph,
│ │ │ -
1095 VertexProperties,
│ │ │ -
1096 EdgeProperties,VM,EM> > EdgeIterator;
│ │ │ -
1097
│ │ │ -
1101 typedef EdgeIteratorT<const PropertiesGraph<Graph,
│ │ │ -
1102 VertexProperties,
│ │ │ -
1103 EdgeProperties,VM,EM> > ConstEdgeIterator;
│ │ │ -
1104
│ │ │ -
1110 EdgeIterator beginEdges(const VertexDescriptor& source);
│ │ │ -
1111
│ │ │ -
1117 EdgeIterator endEdges(const VertexDescriptor& source);
│ │ │ +
1060
│ │ │ +
1061 //===== window manipulation methods
│ │ │ +
1062
│ │ │ +
1064 void set (size_type _n, B* _p, size_type* _j)
│ │ │ +
1065 {
│ │ │ +
1066 this->n = _n;
│ │ │ +
1067 this->p = _p;
│ │ │ +
1068 this->j = _j;
│ │ │ +
1069 }
│ │ │ +
1070
│ │ │ +
1072 void setsize (size_type _n)
│ │ │ +
1073 {
│ │ │ +
1074 this->n = _n;
│ │ │ +
1075 }
│ │ │ +
1076
│ │ │ +
1078 void setptr (B* _p)
│ │ │ +
1079 {
│ │ │ +
1080 this->p = _p;
│ │ │ +
1081 }
│ │ │ +
1082
│ │ │ +
1084 void setindexptr (size_type* _j)
│ │ │ +
1085 {
│ │ │ +
1086 this->j = _j;
│ │ │ +
1087 }
│ │ │ +
1088
│ │ │ +
1090 B* getptr ()
│ │ │ +
1091 {
│ │ │ +
1092 return this->p;
│ │ │ +
1093 }
│ │ │ +
1094
│ │ │ +
1096 size_type* getindexptr ()
│ │ │ +
1097 {
│ │ │ +
1098 return this->j;
│ │ │ +
1099 }
│ │ │ +
1100
│ │ │ +
1102 const B* getptr () const
│ │ │ +
1103 {
│ │ │ +
1104 return this->p;
│ │ │ +
1105 }
│ │ │ +
1106
│ │ │ +
1108 const size_type* getindexptr () const
│ │ │ +
1109 {
│ │ │ +
1110 return this->j;
│ │ │ +
1111 }
│ │ │ +
1113 size_type getsize () const
│ │ │ +
1114 {
│ │ │ +
1115 return this->n;
│ │ │ +
1116 }
│ │ │ +
1117 };
│ │ │
1118
│ │ │ -
1124 ConstEdgeIterator beginEdges(const VertexDescriptor& source) const;
│ │ │ -
1125
│ │ │ -
1131 ConstEdgeIterator endEdges(const VertexDescriptor& source) const;
│ │ │ -
1132
│ │ │ -
1133
│ │ │ -
1134 template<class C>
│ │ │ -
│ │ │ - │ │ │ -
1136 : public std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
1137 C>::value,
│ │ │ -
1138 typename Graph::VertexIterator,
│ │ │ -
1139 typename Graph::ConstVertexIterator>::type
│ │ │ -
1140 {
│ │ │ -
1141 friend class VertexIteratorT<const typename std::remove_const<C>::type>;
│ │ │ -
1142 friend class VertexIteratorT<typename std::remove_const<C>::type>;
│ │ │ -
1143 public:
│ │ │ -
1147 typedef typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
1148 C>::value,
│ │ │ -
1149 typename Graph::VertexIterator,
│ │ │ -
1150 typename Graph::ConstVertexIterator>::type
│ │ │ - │ │ │ -
1152
│ │ │ -
1158 explicit VertexIteratorT(const Father& iter,
│ │ │ -
1159 C* graph);
│ │ │ -
1160
│ │ │ -
1161
│ │ │ -
1169 explicit VertexIteratorT(const Father& iter);
│ │ │ -
1170
│ │ │ -
1175 template<class C1>
│ │ │ -
1176 VertexIteratorT(const VertexIteratorT<C1>& other);
│ │ │ -
1177
│ │ │ -
1181 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ -
1182 VertexProperties&,
│ │ │ -
1183 const VertexProperties&>::type
│ │ │ -
1184 properties() const;
│ │ │ -
1185
│ │ │ -
1191 EdgeIteratorT<C> begin() const;
│ │ │ -
1192
│ │ │ -
1198 EdgeIteratorT<C> end() const;
│ │ │ -
1199
│ │ │ -
1200 private:
│ │ │ -
1204 C* graph_;
│ │ │ -
1205 };
│ │ │ -
│ │ │ -
1206
│ │ │ -
1210 typedef VertexIteratorT<PropertiesGraph<Graph,
│ │ │ -
1211 VertexProperties,
│ │ │ -
1212 EdgeProperties,VM,EM> > VertexIterator;
│ │ │ -
1213
│ │ │ -
1217 typedef VertexIteratorT<const PropertiesGraph<Graph,
│ │ │ -
1218 VertexProperties,
│ │ │ -
1219 EdgeProperties,VM,EM> > ConstVertexIterator;
│ │ │ -
1220
│ │ │ - │ │ │ -
1226
│ │ │ - │ │ │ -
1232
│ │ │ -
1237 ConstVertexIterator begin() const;
│ │ │ -
1238
│ │ │ - │ │ │ -
1244
│ │ │ -
1250 VertexProperties& getVertexProperties(const VertexDescriptor& vertex);
│ │ │ -
1251
│ │ │ -
1257 const VertexProperties& getVertexProperties(const VertexDescriptor& vertex) const;
│ │ │ -
1258
│ │ │ -
│ │ │ -
1265 EdgeDescriptor findEdge(const VertexDescriptor& source,
│ │ │ -
1266 const VertexDescriptor& target)
│ │ │ -
1267 {
│ │ │ -
1268 return graph_.findEdge(source,target);
│ │ │ -
1269 }
│ │ │ -
│ │ │ -
1270
│ │ │ - │ │ │ -
1277
│ │ │ -
1278
│ │ │ - │ │ │ -
1285
│ │ │ - │ │ │ -
1293 const VertexDescriptor& target);
│ │ │ -
1294
│ │ │ - │ │ │ -
1302 const VertexDescriptor& target) const;
│ │ │ -
1303
│ │ │ -
1308 const Graph& graph() const;
│ │ │ -
1309
│ │ │ -
1313 std::size_t noVertices() const;
│ │ │ -
1314
│ │ │ -
1318 std::size_t noEdges() const;
│ │ │ -
1319
│ │ │ - │ │ │ -
1327
│ │ │ - │ │ │ -
1335 const EdgeMap& emap=EdgeMap());
│ │ │ -
1336
│ │ │ -
1337 private:
│ │ │ - │ │ │ -
1339 {}
│ │ │ -
1340
│ │ │ -
1342 Graph& graph_;
│ │ │ -
1345 VertexMap vmap_;
│ │ │ -
1346 std::vector<VertexProperties> vertexProperties_;
│ │ │ -
1348 EdgeMap emap_;
│ │ │ -
1350 std::vector<EdgeProperties> edgeProperties_;
│ │ │ -
1351
│ │ │ -
1352 };
│ │ │ -
│ │ │ -
1353
│ │ │ -
1354
│ │ │ -
1359 template<typename G>
│ │ │ -
│ │ │ - │ │ │ -
1361 {
│ │ │ -
1362 public:
│ │ │ -
1366 typedef G Graph;
│ │ │ -
1370 typedef typename G::VertexProperties VertexProperties;
│ │ │ -
1374 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
1375
│ │ │ -
│ │ │ - │ │ │ -
1381 : graph_(g)
│ │ │ -
1382 {}
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
1387 : graph_(0)
│ │ │ -
1388 {}
│ │ │ -
│ │ │ -
1389
│ │ │ -
1390
│ │ │ -
│ │ │ -
1395 VertexProperties& operator[](const Vertex& vertex) const
│ │ │ -
1396 {
│ │ │ -
1397 return graph_->getVertexProperties(vertex);
│ │ │ -
1398 }
│ │ │ -
│ │ │ -
1399 private:
│ │ │ -
1400 Graph* graph_;
│ │ │ -
1401 };
│ │ │ -
│ │ │ -
1402
│ │ │ -
1407 template<typename G>
│ │ │ -
│ │ │ - │ │ │ -
1409 {
│ │ │ -
1410 public:
│ │ │ -
1414 typedef G Graph;
│ │ │ -
1418 typedef typename G::EdgeProperties EdgeProperties;
│ │ │ -
1422 typedef typename G::EdgeDescriptor Edge;
│ │ │ -
1423
│ │ │ -
│ │ │ - │ │ │ -
1429 : graph_(g)
│ │ │ -
1430 {}
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -
1435 : graph_(0)
│ │ │ -
1436 {}
│ │ │ -
│ │ │ -
1437
│ │ │ -
│ │ │ -
1442 EdgeProperties& operator[](const Edge& edge) const
│ │ │ -
1443 {
│ │ │ -
1444 return graph_->getEdgeProperties(edge);
│ │ │ -
1445 }
│ │ │ -
│ │ │ -
1446 private:
│ │ │ -
1447 Graph* graph_;
│ │ │ -
1448 };
│ │ │ -
│ │ │ -
1449
│ │ │ -
1450
│ │ │ -
1461 template<class G, class V>
│ │ │ -
1462 int visitNeighbours(const G& graph, const typename G::VertexDescriptor& vertex,
│ │ │ -
1463 V& visitor);
│ │ │ -
1464
│ │ │ -
1465#ifndef DOXYGEN
│ │ │ -
1466
│ │ │ -
1467 template<class M>
│ │ │ - │ │ │ -
1469 : matrix_(matrix)
│ │ │ -
1470 {
│ │ │ -
1471 if(matrix_.N()!=matrix_.M())
│ │ │ -
1472 DUNE_THROW(ISTLError, "Matrix has to have as many columns as rows!");
│ │ │ -
1473
│ │ │ -
1474 start_ = new EdgeDescriptor[matrix_.N()+1];
│ │ │ -
1475
│ │ │ -
1476 typedef typename M::ConstIterator Iterator;
│ │ │ -
1477 start_[matrix_.begin().index()] = 0;
│ │ │ -
1478
│ │ │ -
1479 for(Iterator row=matrix_.begin(); row != matrix_.end(); ++row)
│ │ │ -
1480 start_[row.index()+1] = start_[row.index()] + row->size();
│ │ │ -
1481 }
│ │ │ -
1482
│ │ │ -
1483 template<class M>
│ │ │ -
1484 MatrixGraph<M>::~MatrixGraph()
│ │ │ -
1485 {
│ │ │ -
1486 delete[] start_;
│ │ │ -
1487 }
│ │ │ -
1488
│ │ │ -
1489 template<class M>
│ │ │ -
1490 inline std::size_t MatrixGraph<M>::noEdges() const
│ │ │ -
1491 {
│ │ │ -
1492 return start_[matrix_.N()];
│ │ │ -
1493 }
│ │ │ -
1494
│ │ │ -
1495 template<class M>
│ │ │ -
1496 inline std::size_t MatrixGraph<M>::noVertices() const
│ │ │ -
1497 {
│ │ │ -
1498 return matrix_.N();
│ │ │ -
1499 }
│ │ │ -
1500
│ │ │ -
1501 template<class M>
│ │ │ -
1502 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::maxVertex() const
│ │ │ -
1503 {
│ │ │ -
1504 return matrix_.N()-1;
│ │ │ -
1505 }
│ │ │ -
1506
│ │ │ -
1507 template<class M>
│ │ │ -
1508 typename MatrixGraph<M>::EdgeDescriptor
│ │ │ -
1509 MatrixGraph<M>::findEdge(const VertexDescriptor& source,
│ │ │ -
1510 const VertexDescriptor& target) const
│ │ │ -
1511 {
│ │ │ -
1512 typename M::ConstColIterator found =matrix_[source].find(target);
│ │ │ -
1513 if(found == matrix_[source].end())
│ │ │ -
1514 return std::numeric_limits<EdgeDescriptor>::max();
│ │ │ -
1515 std::size_t offset = found.offset();
│ │ │ -
1516 if(target>source)
│ │ │ -
1517 offset--;
│ │ │ -
1518
│ │ │ -
1519 assert(offset<noEdges());
│ │ │ -
1520
│ │ │ -
1521 return start_[source]+offset;
│ │ │ -
1522 }
│ │ │ -
1523
│ │ │ -
1524
│ │ │ -
1525 template<class M>
│ │ │ -
1526 inline M& MatrixGraph<M>::matrix()
│ │ │ -
1527 {
│ │ │ -
1528 return matrix_;
│ │ │ -
1529 }
│ │ │ -
1530
│ │ │ -
1531 template<class M>
│ │ │ -
1532 inline const M& MatrixGraph<M>::matrix() const
│ │ │ -
1533 {
│ │ │ -
1534 return matrix_;
│ │ │ -
1535 }
│ │ │ -
1536
│ │ │ -
1537 template<class M>
│ │ │ -
1538 template<class C>
│ │ │ -
1539 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const VertexDescriptor& source, const ColIterator& block,
│ │ │ -
1540 const ColIterator& end, const EdgeDescriptor& edge)
│ │ │ -
1541 : source_(source), block_(block), blockEnd_(end), edge_(edge)
│ │ │ -
1542 {
│ │ │ -
1543 if(block_!=blockEnd_ && block_.index() == source_) {
│ │ │ -
1544 // This is the edge from the diagonal to the diagonal. Skip it.
│ │ │ -
1545 ++block_;
│ │ │ -
1546 }
│ │ │ -
1547 }
│ │ │ -
1548
│ │ │ -
1549 template<class M>
│ │ │ -
1550 template<class C>
│ │ │ -
1551 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const ColIterator& block)
│ │ │ -
1552 : block_(block)
│ │ │ -
1553 {}
│ │ │ -
1554
│ │ │ -
1555 template<class M>
│ │ │ -
1556 template<class C>
│ │ │ -
1557 template<class C1>
│ │ │ -
1558 MatrixGraph<M>::EdgeIteratorT<C>::EdgeIteratorT(const EdgeIteratorT<C1>& other)
│ │ │ -
1559 : source_(other.source_), block_(other.block_), blockEnd_(other.blockEnd_), edge_(other.edge_)
│ │ │ -
1560 {}
│ │ │ -
1561
│ │ │ -
1562
│ │ │ -
1563 template<class M>
│ │ │ -
1564 template<class C>
│ │ │ -
1565 inline typename MatrixGraph<M>::template EdgeIteratorT<C>::WeightType&
│ │ │ -
1566 MatrixGraph<M>::EdgeIteratorT<C>::weight() const
│ │ │ -
1567 {
│ │ │ -
1568 return *block_;
│ │ │ -
1569 }
│ │ │ -
1570
│ │ │ -
1571 template<class M>
│ │ │ -
1572 template<class C>
│ │ │ -
1573 inline typename MatrixGraph<M>::template EdgeIteratorT<C>& MatrixGraph<M>::EdgeIteratorT<C>::operator++()
│ │ │ -
1574 {
│ │ │ -
1575 ++block_;
│ │ │ -
1576 ++edge_;
│ │ │ -
1577
│ │ │ -
1578 if(block_!=blockEnd_ && block_.index() == source_) {
│ │ │ -
1579 // This is the edge from the diagonal to the diagonal. Skip it.
│ │ │ -
1580 ++block_;
│ │ │ -
1581 }
│ │ │ -
1582
│ │ │ -
1583 return *this;
│ │ │ -
1584 }
│ │ │ -
1585
│ │ │ -
1586 template<class M>
│ │ │ -
1587 template<class C>
│ │ │ -
1588 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator!=(const typename MatrixGraph<M>::template EdgeIteratorT<typename std::remove_const<C>::type>& other) const
│ │ │ -
1589 {
│ │ │ -
1590 return block_!=other.block_;
│ │ │ -
1591 }
│ │ │ -
1592
│ │ │ -
1593 template<class M>
│ │ │ -
1594 template<class C>
│ │ │ -
1595 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator!=(const typename MatrixGraph<M>::template EdgeIteratorT<const typename std::remove_const<C>::type>& other) const
│ │ │ -
1596 {
│ │ │ -
1597 return block_!=other.block_;
│ │ │ -
1598 }
│ │ │ -
1599
│ │ │ -
1600 template<class M>
│ │ │ -
1601 template<class C>
│ │ │ -
1602 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator==(const typename MatrixGraph<M>::template EdgeIteratorT<typename std::remove_const<C>::type>& other) const
│ │ │ -
1603 {
│ │ │ -
1604 return block_==other.block_;
│ │ │ -
1605 }
│ │ │ -
1606
│ │ │ -
1607 template<class M>
│ │ │ -
1608 template<class C>
│ │ │ -
1609 inline bool MatrixGraph<M>::EdgeIteratorT<C>::operator==(const typename MatrixGraph<M>::template EdgeIteratorT<const typename std::remove_const<C>::type>& other) const
│ │ │ -
1610 {
│ │ │ -
1611 return block_==other.block_;
│ │ │ -
1612 }
│ │ │ -
1613
│ │ │ -
1614 template<class M>
│ │ │ -
1615 template<class C>
│ │ │ -
1616 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::EdgeIteratorT<C>::target() const
│ │ │ -
1617 {
│ │ │ -
1618 return block_.index();
│ │ │ -
1619 }
│ │ │ -
1620
│ │ │ -
1621 template<class M>
│ │ │ -
1622 template<class C>
│ │ │ -
1623 inline typename MatrixGraph<M>::VertexDescriptor MatrixGraph<M>::EdgeIteratorT<C>::source() const
│ │ │ -
1624 {
│ │ │ -
1625 return source_;
│ │ │ -
1626 }
│ │ │ -
1627
│ │ │ -
1628 template<class M>
│ │ │ -
1629 template<class C>
│ │ │ -
1630 inline const typename MatrixGraph<M>::EdgeDescriptor& MatrixGraph<M>::EdgeIteratorT<C>::operator*() const
│ │ │ -
1631 {
│ │ │ -
1632 return edge_;
│ │ │ -
1633 }
│ │ │ -
1634
│ │ │ -
1635 template<class M>
│ │ │ -
1636 template<class C>
│ │ │ -
1637 inline const typename MatrixGraph<M>::EdgeDescriptor* MatrixGraph<M>::EdgeIteratorT<C>::operator->() const
│ │ │ -
1638 {
│ │ │ -
1639 return &edge_;
│ │ │ -
1640 }
│ │ │ -
1641
│ │ │ -
1642 template<class M>
│ │ │ -
1643 template<class C>
│ │ │ -
1644 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(C* graph,
│ │ │ -
1645 const VertexDescriptor& current)
│ │ │ -
1646 : graph_(graph), current_(current)
│ │ │ -
1647 {}
│ │ │ -
1648
│ │ │ -
1649
│ │ │ -
1650 template<class M>
│ │ │ -
1651 template<class C>
│ │ │ -
1652 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(const VertexDescriptor& current)
│ │ │ -
1653 : current_(current)
│ │ │ -
1654 {}
│ │ │ -
1655
│ │ │ -
1656 template<class M>
│ │ │ -
1657 template<class C>
│ │ │ -
1658 MatrixGraph<M>::VertexIteratorT<C>::VertexIteratorT(const VertexIteratorT<MutableContainer>& other)
│ │ │ -
1659 : graph_(other.graph_), current_(other.current_)
│ │ │ -
1660 {}
│ │ │ -
1661
│ │ │ -
1662 template<class M>
│ │ │ -
1663 template<class C>
│ │ │ -
1664 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator!=(const VertexIteratorT<MutableContainer>& other) const
│ │ │ -
1665 {
│ │ │ -
1666 return current_ != other.current_;
│ │ │ -
1667 }
│ │ │ -
1668
│ │ │ -
1669 template<class M>
│ │ │ -
1670 template<class C>
│ │ │ -
1671 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator!=(const VertexIteratorT<ConstContainer>& other) const
│ │ │ -
1672 {
│ │ │ -
1673 return current_ != other.current_;
│ │ │ -
1674 }
│ │ │ -
1675
│ │ │ -
1676
│ │ │ -
1677 template<class M>
│ │ │ -
1678 template<class C>
│ │ │ -
1679 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator==(const VertexIteratorT<MutableContainer>& other) const
│ │ │ -
1680 {
│ │ │ -
1681 return current_ == other.current_;
│ │ │ -
1682 }
│ │ │ -
1683
│ │ │ -
1684 template<class M>
│ │ │ -
1685 template<class C>
│ │ │ -
1686 inline bool MatrixGraph<M>::VertexIteratorT<C>::operator==(const VertexIteratorT<ConstContainer>& other) const
│ │ │ -
1687 {
│ │ │ -
1688 return current_ == other.current_;
│ │ │ -
1689 }
│ │ │ -
1690
│ │ │ -
1691 template<class M>
│ │ │ -
1692 template<class C>
│ │ │ -
1693 inline typename MatrixGraph<M>::template VertexIteratorT<C>& MatrixGraph<M>::VertexIteratorT<C>::operator++()
│ │ │ -
1694 {
│ │ │ -
1695 ++current_;
│ │ │ -
1696 return *this;
│ │ │ -
1697 }
│ │ │ -
1698
│ │ │ -
1699 template<class M>
│ │ │ -
1700 template<class C>
│ │ │ -
1701 inline typename MatrixGraph<M>::template VertexIteratorT<C>::WeightType&
│ │ │ -
1702 MatrixGraph<M>::VertexIteratorT<C>::weight() const
│ │ │ -
1703 {
│ │ │ -
1704 return graph_->matrix()[current_][current_];
│ │ │ -
1705 }
│ │ │ -
1706
│ │ │ -
1707 template<class M>
│ │ │ -
1708 template<class C>
│ │ │ -
1709 inline const typename MatrixGraph<M>::VertexDescriptor&
│ │ │ -
1710 MatrixGraph<M>::VertexIteratorT<C>::operator*() const
│ │ │ -
1711 {
│ │ │ -
1712 return current_;
│ │ │ -
1713 }
│ │ │ -
1714
│ │ │ -
1715 template<class M>
│ │ │ -
1716 template<class C>
│ │ │ -
1717 inline typename MatrixGraph<M>::template EdgeIteratorT<C>
│ │ │ -
1718 MatrixGraph<M>::VertexIteratorT<C>::begin() const
│ │ │ -
1719 {
│ │ │ -
1720 return graph_->beginEdges(current_);
│ │ │ -
1721 }
│ │ │ -
1722
│ │ │ -
1723 template<class M>
│ │ │ -
1724 template<class C>
│ │ │ -
1725 inline typename MatrixGraph<M>::template EdgeIteratorT<C>
│ │ │ -
1726 MatrixGraph<M>::VertexIteratorT<C>::end() const
│ │ │ -
1727 {
│ │ │ -
1728 return graph_->endEdges(current_);
│ │ │ -
1729 }
│ │ │ -
1730
│ │ │ -
1731 template<class M>
│ │ │ -
1732 inline typename MatrixGraph<M>::template VertexIteratorT<MatrixGraph<M> >
│ │ │ -
1733 MatrixGraph<M>::begin()
│ │ │ -
1734 {
│ │ │ -
1735 return VertexIterator(this,0);
│ │ │ -
1736 }
│ │ │ -
1737
│ │ │ -
1738 template<class M>
│ │ │ -
1739 inline typename MatrixGraph<M>::template VertexIteratorT<MatrixGraph<M> >
│ │ │ -
1740 MatrixGraph<M>::end()
│ │ │ -
1741 {
│ │ │ -
1742 return VertexIterator(matrix_.N());
│ │ │ -
1743 }
│ │ │ -
1744
│ │ │ -
1745
│ │ │ -
1746 template<class M>
│ │ │ -
1747 inline typename MatrixGraph<M>::template VertexIteratorT<const MatrixGraph<M> >
│ │ │ -
1748 MatrixGraph<M>::begin() const
│ │ │ -
1749 {
│ │ │ -
1750 return ConstVertexIterator(this, 0);
│ │ │ -
1751 }
│ │ │ -
1752
│ │ │ -
1753 template<class M>
│ │ │ -
1754 inline typename MatrixGraph<M>::template VertexIteratorT<const MatrixGraph<M> >
│ │ │ -
1755 MatrixGraph<M>::end() const
│ │ │ -
1756 {
│ │ │ -
1757 return ConstVertexIterator(matrix_.N());
│ │ │ -
1758 }
│ │ │ -
1759
│ │ │ -
1760 template<class M>
│ │ │ -
1761 inline typename MatrixGraph<M>::template EdgeIteratorT<MatrixGraph<M> >
│ │ │ -
1762 MatrixGraph<M>::beginEdges(const VertexDescriptor& source)
│ │ │ -
1763 {
│ │ │ -
1764 return EdgeIterator(source, matrix_.operator[](source).begin(),
│ │ │ -
1765 matrix_.operator[](source).end(), start_[source]);
│ │ │ -
1766 }
│ │ │ -
1767
│ │ │ -
1768 template<class M>
│ │ │ -
1769 inline typename MatrixGraph<M>::template EdgeIteratorT<MatrixGraph<M> >
│ │ │ -
1770 MatrixGraph<M>::endEdges(const VertexDescriptor& source)
│ │ │ -
1771 {
│ │ │ -
1772 return EdgeIterator(matrix_.operator[](source).end());
│ │ │ -
1773 }
│ │ │ -
1774
│ │ │ -
1775
│ │ │ -
1776 template<class M>
│ │ │ -
1777 inline typename MatrixGraph<M>::template EdgeIteratorT<const MatrixGraph<M> >
│ │ │ -
1778 MatrixGraph<M>::beginEdges(const VertexDescriptor& source) const
│ │ │ -
1779 {
│ │ │ -
1780 return ConstEdgeIterator(source, matrix_.operator[](source).begin(),
│ │ │ -
1781 matrix_.operator[](source).end(), start_[source]);
│ │ │ -
1782 }
│ │ │ -
1783
│ │ │ -
1784 template<class M>
│ │ │ -
1785 inline typename MatrixGraph<M>::template EdgeIteratorT<const MatrixGraph<M> >
│ │ │ -
1786 MatrixGraph<M>::endEdges(const VertexDescriptor& source) const
│ │ │ -
1787 {
│ │ │ -
1788 return ConstEdgeIterator(matrix_.operator[](source).end());
│ │ │ -
1789 }
│ │ │ -
1790
│ │ │ -
1791
│ │ │ -
1792 template<class G, class T>
│ │ │ -
1793 SubGraph<G,T>::EdgeIterator::EdgeIterator(const VertexDescriptor& source,
│ │ │ -
1794 const EdgeDescriptor& edge)
│ │ │ -
1795 : source_(source), edge_(edge)
│ │ │ -
1796 {}
│ │ │ -
1797
│ │ │ -
1798
│ │ │ -
1799 template<class G, class T>
│ │ │ -
1800 SubGraph<G,T>::EdgeIterator::EdgeIterator(const EdgeDescriptor& edge)
│ │ │ -
1801 : edge_(edge)
│ │ │ -
1802 {}
│ │ │ -
1803
│ │ │ -
1804 template<class G, class T>
│ │ │ -
1805 typename SubGraph<G,T>::EdgeIndexMap SubGraph<G,T>::getEdgeIndexMap()
│ │ │ -
1806 {
│ │ │ -
1807 return EdgeIndexMap(edges_);
│ │ │ -
1808 }
│ │ │ -
1809
│ │ │ -
1810 template<class G, class T>
│ │ │ -
1811 inline bool SubGraph<G,T>::EdgeIterator::equals(const EdgeIterator & other) const
│ │ │ -
1812 {
│ │ │ -
1813 return other.edge_==edge_;
│ │ │ -
1814 }
│ │ │ -
1815
│ │ │ -
1816 template<class G, class T>
│ │ │ -
1817 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::increment()
│ │ │ -
1818 {
│ │ │ -
1819 ++edge_;
│ │ │ -
1820 return *this;
│ │ │ -
1821 }
│ │ │ -
1822
│ │ │ -
1823 template<class G, class T>
│ │ │ -
1824 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::decrement()
│ │ │ -
1825 {
│ │ │ -
1826 --edge_;
│ │ │ -
1827 return *this;
│ │ │ -
1828 }
│ │ │ -
1829
│ │ │ -
1830 template<class G, class T>
│ │ │ -
1831 inline typename SubGraph<G,T>::EdgeIterator& SubGraph<G,T>::EdgeIterator::advance(std::ptrdiff_t n)
│ │ │ -
1832 {
│ │ │ -
1833 edge_+=n;
│ │ │ -
1834 return *this;
│ │ │ -
1835 }
│ │ │ -
1836 template<class G, class T>
│ │ │ -
1837 inline const typename G::VertexDescriptor& SubGraph<G,T>::EdgeIterator::source() const
│ │ │ -
1838 {
│ │ │ -
1839 return source_;
│ │ │ -
1840 }
│ │ │ -
1841
│ │ │ -
1842 template<class G, class T>
│ │ │ -
1843 inline const typename G::VertexDescriptor& SubGraph<G,T>::EdgeIterator::target() const
│ │ │ -
1844 {
│ │ │ -
1845 return *edge_;
│ │ │ -
1846 }
│ │ │ -
1847
│ │ │ -
1848
│ │ │ -
1849 template<class G, class T>
│ │ │ -
1850 inline const typename SubGraph<G,T>::EdgeDescriptor& SubGraph<G,T>::EdgeIterator::dereference() const
│ │ │ -
1851 {
│ │ │ -
1852 return edge_;
│ │ │ -
1853 }
│ │ │ -
1854
│ │ │ -
1855 template<class G, class T>
│ │ │ -
1856 inline std::ptrdiff_t SubGraph<G,T>::EdgeIterator::distanceTo(const EdgeIterator & other) const
│ │ │ -
1857 {
│ │ │ -
1858 return other.edge_-edge_;
│ │ │ -
1859 }
│ │ │ -
1860
│ │ │ -
1861 template<class G, class T>
│ │ │ -
1862 SubGraph<G,T>::VertexIterator::VertexIterator(const SubGraph<G,T>* graph,
│ │ │ -
1863 const VertexDescriptor& current,
│ │ │ -
1864 const VertexDescriptor& end)
│ │ │ -
1865 : graph_(graph), current_(current), end_(end)
│ │ │ -
1866 {
│ │ │ -
1867 // Skip excluded vertices
│ │ │ -
1868 typedef typename T::const_iterator Iterator;
│ │ │ -
1869
│ │ │ -
1870 for(Iterator vertex = graph_->excluded_.begin();
│ │ │ -
1871 current_ != end_ && *vertex;
│ │ │ -
1872 ++vertex)
│ │ │ -
1873 ++current_;
│ │ │ -
1874 assert(current_ == end_ || !graph_->excluded_[current_]);
│ │ │ -
1875 }
│ │ │ -
1876
│ │ │ -
1877 template<class G, class T>
│ │ │ -
1878 SubGraph<G,T>::VertexIterator::VertexIterator(const VertexDescriptor& current)
│ │ │ -
1879 : current_(current)
│ │ │ -
1880 {}
│ │ │ -
1881
│ │ │ -
1882 template<class G, class T>
│ │ │ -
1883 inline typename SubGraph<G,T>::VertexIterator& SubGraph<G,T>::VertexIterator::increment()
│ │ │ -
1884 {
│ │ │ -
1885 ++current_;
│ │ │ -
1886 //Skip excluded vertices
│ │ │ -
1887 while(current_ != end_ && graph_->excluded_[current_])
│ │ │ -
1888 ++current_;
│ │ │ -
1889
│ │ │ -
1890 assert(current_ == end_ || !graph_->excluded_[current_]);
│ │ │ -
1891 return *this;
│ │ │ -
1892 }
│ │ │ -
1893
│ │ │ -
1894 template<class G, class T>
│ │ │ -
1895 inline bool SubGraph<G,T>::VertexIterator::equals(const VertexIterator & other) const
│ │ │ -
1896 {
│ │ │ -
1897 return current_==other.current_;
│ │ │ -
1898 }
│ │ │ -
1899
│ │ │ -
1900 template<class G, class T>
│ │ │ -
1901 inline const typename G::VertexDescriptor& SubGraph<G,T>::VertexIterator::dereference() const
│ │ │ -
1902 {
│ │ │ -
1903 return current_;
│ │ │ -
1904 }
│ │ │ -
1905
│ │ │ -
1906 template<class G, class T>
│ │ │ -
1907 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::VertexIterator::begin() const
│ │ │ -
1908 {
│ │ │ -
1909 return graph_->beginEdges(current_);
│ │ │ -
1910 }
│ │ │ -
1911
│ │ │ -
1912 template<class G, class T>
│ │ │ -
1913 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::VertexIterator::end() const
│ │ │ -
1914 {
│ │ │ -
1915 return graph_->endEdges(current_);
│ │ │ -
1916 }
│ │ │ -
1917
│ │ │ -
1918 template<class G, class T>
│ │ │ -
1919 inline typename SubGraph<G,T>::VertexIterator SubGraph<G,T>::begin() const
│ │ │ -
1920 {
│ │ │ -
1921 return VertexIterator(this, 0, endVertex_);
│ │ │ -
1922 }
│ │ │ -
1923
│ │ │ -
1924
│ │ │ -
1925 template<class G, class T>
│ │ │ -
1926 inline typename SubGraph<G,T>::VertexIterator SubGraph<G,T>::end() const
│ │ │ -
1927 {
│ │ │ -
1928 return VertexIterator(endVertex_);
│ │ │ -
1929 }
│ │ │ -
1930
│ │ │ -
1931
│ │ │ -
1932 template<class G, class T>
│ │ │ -
1933 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::beginEdges(const VertexDescriptor& source) const
│ │ │ -
1934 {
│ │ │ -
1935 return EdgeIterator(source, edges_+start_[source]);
│ │ │ -
1936 }
│ │ │ -
1937
│ │ │ -
1938 template<class G, class T>
│ │ │ -
1939 inline typename SubGraph<G,T>::EdgeIterator SubGraph<G,T>::endEdges(const VertexDescriptor& source) const
│ │ │ -
1940 {
│ │ │ -
1941 return EdgeIterator(edges_+end_[source]);
│ │ │ -
1942 }
│ │ │ -
1943
│ │ │ -
1944 template<class G, class T>
│ │ │ -
1945 std::size_t SubGraph<G,T>::noVertices() const
│ │ │ -
1946 {
│ │ │ -
1947 return noVertices_;
│ │ │ -
1948 }
│ │ │ -
1949
│ │ │ -
1950 template<class G, class T>
│ │ │ -
1951 inline typename SubGraph<G,T>::VertexDescriptor SubGraph<G,T>::maxVertex() const
│ │ │ -
1952 {
│ │ │ -
1953 return maxVertex_;
│ │ │ -
1954 }
│ │ │ -
1955
│ │ │ -
1956 template<class G, class T>
│ │ │ -
1957 inline std::size_t SubGraph<G,T>::noEdges() const
│ │ │ -
1958 {
│ │ │ -
1959 return noEdges_;
│ │ │ -
1960 }
│ │ │ -
1961
│ │ │ -
1962 template<class G, class T>
│ │ │ -
1963 inline typename SubGraph<G,T>::EdgeDescriptor SubGraph<G,T>::findEdge(const VertexDescriptor& source,
│ │ │ -
1964 const VertexDescriptor& target) const
│ │ │ -
1965 {
│ │ │ -
1966 const EdgeDescriptor edge = std::lower_bound(edges_+start_[source], edges_+end_[source], target);
│ │ │ -
1967 if(edge==edges_+end_[source] || *edge!=target)
│ │ │ -
1968 return std::numeric_limits<EdgeDescriptor>::max();
│ │ │ -
1969
│ │ │ -
1970 return edge;
│ │ │ -
1971 }
│ │ │ -
1972
│ │ │ -
1973 template<class G, class T>
│ │ │ -
1974 SubGraph<G,T>::~SubGraph()
│ │ │ -
1975 {
│ │ │ -
1976 delete[] edges_;
│ │ │ -
1977 delete[] end_;
│ │ │ -
1978 delete[] start_;
│ │ │ -
1979 }
│ │ │ -
1980
│ │ │ -
1981 template<class G, class T>
│ │ │ -
1982 SubGraph<G,T>::SubGraph(const G& graph, const T& excluded)
│ │ │ -
1983 : excluded_(excluded), noVertices_(0), endVertex_(0), maxVertex_(graph.maxVertex())
│ │ │ -
1984 {
│ │ │ -
1985 start_ = new std::ptrdiff_t[graph.noVertices()];
│ │ │ -
1986 end_ = new std::ptrdiff_t[graph.noVertices()];
│ │ │ -
1987 edges_ = new VertexDescriptor[graph.noEdges()];
│ │ │ -
1988
│ │ │ -
1989 VertexDescriptor* edge=edges_;
│ │ │ -
1990
│ │ │ -
1991 // Cater for the case that there are no vertices.
│ │ │ -
1992 // Otherwise endVertex_ will get 1 below.
│ │ │ -
1993 if ( graph.noVertices() == 0)
│ │ │ -
1994 return;
│ │ │ -
1995
│ │ │ -
1996 typedef typename Graph::ConstVertexIterator Iterator;
│ │ │ -
1997 Iterator endVertex=graph.end();
│ │ │ -
1998
│ │ │ -
1999 for(Iterator vertex = graph.begin(); vertex != endVertex; ++vertex)
│ │ │ -
2000 if(excluded_[*vertex])
│ │ │ -
2001 start_[*vertex]=end_[*vertex]=-1;
│ │ │ -
2002 else{
│ │ │ -
2003 ++noVertices_;
│ │ │ -
2004 endVertex_ = std::max(*vertex, endVertex_);
│ │ │ -
2005
│ │ │ -
2006 start_[*vertex] = edge-edges_;
│ │ │ -
2007
│ │ │ -
2008 auto endEdge = vertex.end();
│ │ │ -
2009
│ │ │ -
2010 for(auto iter=vertex.begin(); iter!= endEdge; ++iter)
│ │ │ -
2011 if(!excluded[iter.target()]) {
│ │ │ -
2012 *edge = iter.target();
│ │ │ -
2013 ++edge;
│ │ │ -
2014 }
│ │ │ -
2015
│ │ │ -
2016 end_[*vertex] = edge - edges_;
│ │ │ -
2017
│ │ │ -
2018 // Sort the edges
│ │ │ -
2019 std::sort(edges_+start_[*vertex], edge);
│ │ │ -
2020 }
│ │ │ -
2021 noEdges_ = edge-edges_;
│ │ │ -
2022 ++endVertex_;
│ │ │ -
2023 }
│ │ │ -
2024
│ │ │ -
2025 template<class G, class V, class VM>
│ │ │ -
2026 inline std::size_t VertexPropertiesGraph<G,V,VM>::noEdges() const
│ │ │ -
2027 {
│ │ │ -
2028 return graph_.noEdges();
│ │ │ -
2029 }
│ │ │ -
2030
│ │ │ -
2031 template<class G, class V, class VM>
│ │ │ -
2032 inline typename VertexPropertiesGraph<G,V,VM>::EdgeIterator
│ │ │ -
2033 VertexPropertiesGraph<G,V,VM>::beginEdges(const VertexDescriptor& source)
│ │ │ -
2034 {
│ │ │ -
2035 return graph_.beginEdges(source);
│ │ │ -
2036 }
│ │ │ -
2037
│ │ │ -
2038 template<class G, class V, class VM>
│ │ │ -
2039 inline typename VertexPropertiesGraph<G,V,VM>::EdgeIterator
│ │ │ -
2040 VertexPropertiesGraph<G,V,VM>::endEdges(const VertexDescriptor& source)
│ │ │ -
2041 {
│ │ │ -
2042 return graph_.endEdges(source);
│ │ │ -
2043 }
│ │ │ -
2044
│ │ │ -
2045 template<class G, class V, class VM>
│ │ │ -
2046 typename VertexPropertiesGraph<G,V,VM>::ConstEdgeIterator
│ │ │ -
2047 inline VertexPropertiesGraph<G,V,VM>::beginEdges(const VertexDescriptor& source) const
│ │ │ -
2048 {
│ │ │ -
2049 return graph_.beginEdges(source);
│ │ │ -
2050 }
│ │ │ -
2051
│ │ │ -
2052 template<class G, class V, class VM>
│ │ │ -
2053 typename VertexPropertiesGraph<G,V,VM>::ConstEdgeIterator
│ │ │ -
2054 VertexPropertiesGraph<G,V,VM>::endEdges(const VertexDescriptor& source) const
│ │ │ -
2055 {
│ │ │ -
2056 return graph_.endEdges(source);
│ │ │ -
2057 }
│ │ │ -
2058
│ │ │ -
2059 template<class G, class V, class VM>
│ │ │ -
2060 template<class C>
│ │ │ -
2061 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ -
2062 ::VertexIteratorT(const Father& iter,
│ │ │ -
2063 C* graph)
│ │ │ -
2064 : Father(iter), graph_(graph)
│ │ │ -
2065 {}
│ │ │ -
2066
│ │ │ -
2067 template<class G, class V, class VM>
│ │ │ -
2068 template<class C>
│ │ │ -
2069 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ -
2070 ::VertexIteratorT(const Father& iter)
│ │ │ -
2071 : Father(iter)
│ │ │ -
2072 {}
│ │ │ -
2073
│ │ │ -
2074 template<class G, class V, class VM>
│ │ │ -
2075 template<class C>
│ │ │ -
2076 template<class C1>
│ │ │ -
2077 VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>
│ │ │ -
2078 ::VertexIteratorT(const VertexIteratorT<C1>& other)
│ │ │ -
2079 : Father(other), graph_(other.graph_)
│ │ │ -
2080 {}
│ │ │ -
2081
│ │ │ -
2082 template<class G, class V, class VM>
│ │ │ -
2083 template<class C>
│ │ │ -
2084 typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ -
2085 V&, const V&>::type
│ │ │ -
2086 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::properties() const
│ │ │ -
2087 {
│ │ │ -
2088 return graph_->getVertexProperties(Father::operator*());
│ │ │ -
2089 }
│ │ │ -
2090
│ │ │ -
2091 template<class G, class V, class VM>
│ │ │ -
2092 template<class C>
│ │ │ -
2093 typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
2094 C>::value,
│ │ │ -
2095 typename G::EdgeIterator,
│ │ │ -
2096 typename G::ConstEdgeIterator>::type
│ │ │ -
2097 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::begin() const
│ │ │ -
2098 {
│ │ │ -
2099 return graph_->beginEdges(Father::operator*());
│ │ │ -
2100 }
│ │ │ -
2101
│ │ │ -
2102 template<class G, class V, class VM>
│ │ │ -
2103 template<class C>
│ │ │ -
2104 typename std::conditional<std::is_same<typename std::remove_const<C>::type,
│ │ │ -
2105 C>::value,
│ │ │ -
2106 typename G::EdgeIterator,
│ │ │ -
2107 typename G::ConstEdgeIterator>::type
│ │ │ -
2108 inline VertexPropertiesGraph<G,V,VM>::VertexIteratorT<C>::end() const
│ │ │ -
2109 {
│ │ │ -
2110 return graph_->endEdges(Father::operator*());
│ │ │ -
2111 }
│ │ │ -
2112
│ │ │ -
2113 template<class G, class V, class VM>
│ │ │ -
2114 inline typename VertexPropertiesGraph<G,V,VM>::VertexIterator VertexPropertiesGraph<G,V,VM>::begin()
│ │ │ -
2115 {
│ │ │ -
2116 return VertexIterator(graph_.begin(), this);
│ │ │ -
2117 }
│ │ │ -
2118
│ │ │ -
2119 template<class G, class V, class VM>
│ │ │ -
2120 inline typename VertexPropertiesGraph<G,V,VM>::VertexIterator VertexPropertiesGraph<G,V,VM>::end()
│ │ │ -
2121 {
│ │ │ -
2122 return VertexIterator(graph_.end());
│ │ │ -
2123 }
│ │ │ -
2124
│ │ │ -
2125
│ │ │ -
2126 template<class G, class V, class VM>
│ │ │ -
2127 inline typename VertexPropertiesGraph<G,V,VM>::ConstVertexIterator VertexPropertiesGraph<G,V,VM>::begin() const
│ │ │ -
2128 {
│ │ │ -
2129 return ConstVertexIterator(graph_.begin(), this);
│ │ │ -
2130 }
│ │ │ -
2131
│ │ │ -
2132 template<class G, class V, class VM>
│ │ │ -
2133 inline typename VertexPropertiesGraph<G,V,VM>::ConstVertexIterator VertexPropertiesGraph<G,V,VM>::end() const
│ │ │ -
2134 {
│ │ │ -
2135 return ConstVertexIterator(graph_.end());
│ │ │ -
2136 }
│ │ │ -
2137
│ │ │ -
2138 template<class G, class V, class VM>
│ │ │ -
2139 inline V& VertexPropertiesGraph<G,V,VM>::getVertexProperties(const VertexDescriptor& vertex)
│ │ │ -
2140 {
│ │ │ -
2141 return vertexProperties_[vmap_[vertex]];
│ │ │ -
2142 }
│ │ │ -
2143
│ │ │ -
2144 template<class G, class V, class VM>
│ │ │ -
2145 inline const V& VertexPropertiesGraph<G,V,VM>::getVertexProperties(const VertexDescriptor& vertex) const
│ │ │ -
2146 {
│ │ │ -
2147 return vertexProperties_[vmap_[vertex]];
│ │ │ -
2148 }
│ │ │ -
2149
│ │ │ -
2150 template<class G, class V, class VM>
│ │ │ -
2151 inline const G& VertexPropertiesGraph<G,V,VM>::graph() const
│ │ │ -
2152 {
│ │ │ -
2153 return graph_;
│ │ │ -
2154 }
│ │ │ -
2155
│ │ │ -
2156 template<class G, class V, class VM>
│ │ │ -
2157 inline std::size_t VertexPropertiesGraph<G,V,VM>::noVertices() const
│ │ │ -
2158 {
│ │ │ -
2159 return graph_.noVertices();
│ │ │ -
2160 }
│ │ │ -
2161
│ │ │ -
2162
│ │ │ -
2163 template<class G, class V, class VM>
│ │ │ -
2164 inline typename VertexPropertiesGraph<G,V,VM>::VertexDescriptor VertexPropertiesGraph<G,V,VM>::maxVertex() const
│ │ │ -
2165 {
│ │ │ -
2166 return graph_.maxVertex();
│ │ │ -
2167 }
│ │ │ -
2168
│ │ │ -
2169 template<class G, class V, class VM>
│ │ │ -
2170 VertexPropertiesGraph<G,V,VM>::VertexPropertiesGraph(Graph& graph, const VM vmap)
│ │ │ -
2171 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex()+1], V())
│ │ │ -
2172 {}
│ │ │ -
2173
│ │ │ -
2174 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2175 template<class C>
│ │ │ -
2176 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const Father& iter,
│ │ │ -
2177 C* graph)
│ │ │ -
2178 : Father(iter), graph_(graph)
│ │ │ -
2179 {}
│ │ │ -
2180
│ │ │ -
2181 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2182 template<class C>
│ │ │ -
2183 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const Father& iter)
│ │ │ -
2184 : Father(iter)
│ │ │ -
2185 {}
│ │ │ -
2186
│ │ │ -
2187 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2188 template<class C>
│ │ │ -
2189 template<class C1>
│ │ │ -
2190 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::EdgeIteratorT(const EdgeIteratorT<C1>& other)
│ │ │ -
2191 : Father(other), graph_(other.graph_)
│ │ │ -
2192 {}
│ │ │ -
2193
│ │ │ -
2194
│ │ │ -
2195 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2196 inline std::size_t PropertiesGraph<G,V,E,VM,EM>::noEdges() const
│ │ │ -
2197 {
│ │ │ -
2198 return graph_.noEdges();
│ │ │ -
2199 }
│ │ │ -
2200
│ │ │ -
2201 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2202 template<class C>
│ │ │ -
2203 inline typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,E&,const E&>::type
│ │ │ -
2204 PropertiesGraph<G,V,E,VM,EM>::EdgeIteratorT<C>::properties() const
│ │ │ -
2205 {
│ │ │ -
2206 return graph_->getEdgeProperties(Father::operator*());
│ │ │ -
2207 }
│ │ │ -
2208
│ │ │ -
2209 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2210 inline typename PropertiesGraph<G,V,E,VM,EM>::EdgeIterator
│ │ │ -
2211 PropertiesGraph<G,V,E,VM,EM>::beginEdges(const VertexDescriptor& source)
│ │ │ -
2212 {
│ │ │ -
2213 return EdgeIterator(graph_.beginEdges(source), this);
│ │ │ -
2214 }
│ │ │ -
2215
│ │ │ -
2216 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2217 inline typename PropertiesGraph<G,V,E,VM,EM>::EdgeIterator
│ │ │ -
2218 PropertiesGraph<G,V,E,VM,EM>::endEdges(const VertexDescriptor& source)
│ │ │ -
2219 {
│ │ │ -
2220 return EdgeIterator(graph_.endEdges(source));
│ │ │ -
2221 }
│ │ │ -
2222
│ │ │ -
2223 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2224 typename PropertiesGraph<G,V,E,VM,EM>::ConstEdgeIterator
│ │ │ -
2225 inline PropertiesGraph<G,V,E,VM,EM>::beginEdges(const VertexDescriptor& source) const
│ │ │ -
2226 {
│ │ │ -
2227 return ConstEdgeIterator(graph_.beginEdges(source), this);
│ │ │ -
2228 }
│ │ │ -
2229
│ │ │ -
2230 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2231 typename PropertiesGraph<G,V,E,VM,EM>::ConstEdgeIterator
│ │ │ -
2232 PropertiesGraph<G,V,E,VM,EM>::endEdges(const VertexDescriptor& source) const
│ │ │ -
2233 {
│ │ │ -
2234 return ConstEdgeIterator(graph_.endEdges(source));
│ │ │ -
2235 }
│ │ │ -
2236
│ │ │ -
2237 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2238 template<class C>
│ │ │ -
2239 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ -
2240 ::VertexIteratorT(const Father& iter,
│ │ │ -
2241 C* graph)
│ │ │ -
2242 : Father(iter), graph_(graph)
│ │ │ -
2243 {}
│ │ │ -
2244
│ │ │ -
2245 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2246 template<class C>
│ │ │ -
2247 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ -
2248 ::VertexIteratorT(const Father& iter)
│ │ │ -
2249 : Father(iter)
│ │ │ -
2250 {}
│ │ │ -
2251
│ │ │ -
2252 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2253 template<class C>
│ │ │ -
2254 template<class C1>
│ │ │ -
2255 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>
│ │ │ -
2256 ::VertexIteratorT(const VertexIteratorT<C1>& other)
│ │ │ -
2257 : Father(other), graph_(other.graph_)
│ │ │ -
2258 {}
│ │ │ -
2259
│ │ │ -
2260 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2261 template<class C>
│ │ │ -
2262 inline typename std::conditional<std::is_same<C,typename std::remove_const<C>::type>::value,
│ │ │ -
2263 V&, const V&>::type
│ │ │ -
2264 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::properties() const
│ │ │ -
2265 {
│ │ │ -
2266 return graph_->getVertexProperties(Father::operator*());
│ │ │ -
2267 }
│ │ │ -
2268
│ │ │ -
2269 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2270 template<class C>
│ │ │ -
2271 inline typename PropertiesGraph<G,V,E,VM,EM>::template EdgeIteratorT<C>
│ │ │ -
2272 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::begin() const
│ │ │ -
2273 {
│ │ │ -
2274 return graph_->beginEdges(Father::operator*());
│ │ │ -
2275 }
│ │ │ -
2276
│ │ │ -
2277 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2278 template<class C>
│ │ │ -
2279 inline typename PropertiesGraph<G,V,E,VM,EM>::template EdgeIteratorT<C>
│ │ │ -
2280 PropertiesGraph<G,V,E,VM,EM>::VertexIteratorT<C>::end() const
│ │ │ -
2281 {
│ │ │ -
2282 return graph_->endEdges(Father::operator*());
│ │ │ -
2283 }
│ │ │ -
2284
│ │ │ -
2285 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2286 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexIterator PropertiesGraph<G,V,E,VM,EM>::begin()
│ │ │ -
2287 {
│ │ │ -
2288 return VertexIterator(graph_.begin(), this);
│ │ │ -
2289 }
│ │ │ -
2290
│ │ │ -
2291 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2292 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexIterator PropertiesGraph<G,V,E,VM,EM>::end()
│ │ │ -
2293 {
│ │ │ -
2294 return VertexIterator(graph_.end());
│ │ │ -
2295 }
│ │ │ -
2296
│ │ │ -
2297
│ │ │ -
2298 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2299 inline typename PropertiesGraph<G,V,E,VM,EM>::ConstVertexIterator PropertiesGraph<G,V,E,VM,EM>::begin() const
│ │ │ -
2300 {
│ │ │ -
2301 return ConstVertexIterator(graph_.begin(), this);
│ │ │ -
2302 }
│ │ │ -
2303
│ │ │ -
2304 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2305 inline typename PropertiesGraph<G,V,E,VM,EM>::ConstVertexIterator PropertiesGraph<G,V,E,VM,EM>::end() const
│ │ │ -
2306 {
│ │ │ -
2307 return ConstVertexIterator(graph_.end());
│ │ │ -
2308 }
│ │ │ -
2309
│ │ │ -
2310 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2311 inline V& PropertiesGraph<G,V,E,VM,EM>::getVertexProperties(const VertexDescriptor& vertex)
│ │ │ -
2312 {
│ │ │ -
2313 return vertexProperties_[vmap_[vertex]];
│ │ │ -
2314 }
│ │ │ -
2315
│ │ │ -
2316 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2317 inline const V& PropertiesGraph<G,V,E,VM,EM>::getVertexProperties(const VertexDescriptor& vertex) const
│ │ │ -
2318 {
│ │ │ -
2319 return vertexProperties_[vmap_[vertex]];
│ │ │ -
2320 }
│ │ │ -
2321
│ │ │ -
2322 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2323 inline E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const EdgeDescriptor& edge)
│ │ │ -
2324 {
│ │ │ -
2325 return edgeProperties_[emap_[edge]];
│ │ │ -
2326 }
│ │ │ -
2327
│ │ │ -
2328 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2329 inline const E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const EdgeDescriptor& edge) const
│ │ │ -
2330 {
│ │ │ -
2331 return edgeProperties_[emap_[edge]];
│ │ │ -
2332 }
│ │ │ -
2333
│ │ │ -
2334 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2335 inline E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const VertexDescriptor& source,
│ │ │ -
2336 const VertexDescriptor& target)
│ │ │ -
2337 {
│ │ │ -
2338 return getEdgeProperties(graph_.findEdge(source,target));
│ │ │ -
2339 }
│ │ │ -
2340
│ │ │ -
2341 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2342 inline const E& PropertiesGraph<G,V,E,VM,EM>::getEdgeProperties(const VertexDescriptor& source,
│ │ │ -
2343 const VertexDescriptor& target) const
│ │ │ -
2344 {
│ │ │ -
2345 return getEdgeProperties(graph_.findEdge(source,target));
│ │ │ -
2346 }
│ │ │ -
2347
│ │ │ -
2348 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2349 inline const G& PropertiesGraph<G,V,E,VM,EM>::graph() const
│ │ │ -
2350 {
│ │ │ -
2351 return graph_;
│ │ │ -
2352 }
│ │ │ -
2353
│ │ │ -
2354 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2355 inline std::size_t PropertiesGraph<G,V,E,VM,EM>::noVertices() const
│ │ │ -
2356 {
│ │ │ -
2357 return graph_.noVertices();
│ │ │ -
2358 }
│ │ │ -
2359
│ │ │ -
2360
│ │ │ -
2361 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2362 inline typename PropertiesGraph<G,V,E,VM,EM>::VertexDescriptor PropertiesGraph<G,V,E,VM,EM>::maxVertex() const
│ │ │ -
2363 {
│ │ │ -
2364 return graph_.maxVertex();
│ │ │ -
2365 }
│ │ │ -
2366
│ │ │ -
2367 template<class G, class V, class E, class VM, class EM>
│ │ │ -
2368 PropertiesGraph<G,V,E,VM,EM>::PropertiesGraph(Graph& graph, const VM& vmap, const EM& emap)
│ │ │ -
2369 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex()+1], V()),
│ │ │ -
2370 emap_(emap), edgeProperties_(graph_.noEdges(), E())
│ │ │ -
2371 {}
│ │ │ -
2372
│ │ │ -
2373 template<class G, class V>
│ │ │ -
2374 inline int visitNeighbours(const G& graph, const typename G::VertexDescriptor& vertex,
│ │ │ -
2375 V& visitor)
│ │ │ -
2376 {
│ │ │ -
2377 typedef typename G::ConstEdgeIterator iterator;
│ │ │ -
2378 const iterator end = graph.endEdges(vertex);
│ │ │ -
2379 int noNeighbours=0;
│ │ │ -
2380 for(iterator edge = graph.beginEdges(vertex); edge != end; ++edge, ++noNeighbours)
│ │ │ -
2381 visitor(edge);
│ │ │ -
2382 return noNeighbours;
│ │ │ -
2383 }
│ │ │ -
2384
│ │ │ -
2385#endif // DOXYGEN
│ │ │ -
2386
│ │ │ -
2388 }
│ │ │ -
2389}
│ │ │ -
2390#endif
│ │ │ - │ │ │ -
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ +
1119} // end namespace 'Imp'
│ │ │ +
1120
│ │ │ +
1121
│ │ │ +
1123 template<typename B, typename A>
│ │ │ +
1124 struct AutonomousValueType<Imp::BlockVectorWindow<B,A>>
│ │ │ +
1125 {
│ │ │ +
1126 using type = BlockVector<B, A>;
│ │ │ +
1127 };
│ │ │ +
1128
│ │ │ +
1129
│ │ │ +
1130} // end namespace 'Dune'
│ │ │ +
1131
│ │ │ +
1132#endif
│ │ │ + │ │ │ +
Implements several basic array containers.
│ │ │ +
Helper functions for determining the vector/matrix block level.
│ │ │
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
MatrixGraph(Matrix &matrix)
Constructor.
│ │ │ -
VertexIterator end()
Get an iterator over the vertices.
│ │ │ -
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ -
M Matrix
The type of the matrix we are a graph for.
Definition graph.hh:56
│ │ │ -
ConstVertexIterator begin() const
Get an iterator over the vertices.
│ │ │ -
VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:308
│ │ │ -
~MatrixGraph()
Destructor.
│ │ │ -
std::ptrdiff_t EdgeDescriptor
The edge descriptor.
Definition graph.hh:80
│ │ │ -
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ -
M::size_type VertexDescriptor
The vertex descriptor.
Definition graph.hh:73
│ │ │ -
const Matrix & matrix() const
Get the underlying matrix.
│ │ │ -
@ mutableMatrix
Definition graph.hh:86
│ │ │ -
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ -
ConstVertexIterator end() const
Get an iterator over the vertices.
│ │ │ -
EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:298
│ │ │ -
EdgeIterator beginEdges(const VertexDescriptor &source)
Get an iterator over the edges starting at a vertex.
│ │ │ -
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ -
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target) const
Find the descriptor of an edge.
│ │ │ -
M::block_type Weight
The type of the weights.
Definition graph.hh:66
│ │ │ -
std::remove_const< M >::type MutableMatrix
The mutable type of the matrix we are a graph for.
Definition graph.hh:61
│ │ │ -
EdgeIteratorT< MatrixGraph< Matrix > > EdgeIterator
The mutable edge iterator type.
Definition graph.hh:303
│ │ │ -
VertexIteratorT< MatrixGraph< Matrix > > VertexIterator
The mutable vertex iterator type.
Definition graph.hh:313
│ │ │ -
EdgeIterator endEdges(const VertexDescriptor &source)
Get an iterator over the edges starting at a vertex.
│ │ │ -
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ -
Matrix & matrix()
Get the underlying matrix.
│ │ │ -
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ -
Iterator over all edges starting from a vertex.
Definition graph.hh:95
│ │ │ -
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type WeightType
Definition graph.hh:156
│ │ │ -
EdgeIteratorT(const VertexDescriptor &source, const ColIterator &block, const ColIterator &end, const EdgeDescriptor &edge)
Constructor.
│ │ │ -
@ isMutable
whether C is mutable.
Definition graph.hh:112
│ │ │ -
VertexDescriptor target() const
The index of the target vertex of the current edge.
│ │ │ -
EdgeIteratorT< C > & operator++()
preincrement operator.
│ │ │ -
bool operator!=(const EdgeIteratorT< const typename std::remove_const< C >::type > &other) const
Inequality operator.
│ │ │ -
bool operator==(const EdgeIteratorT< const typename std::remove_const< C >::type > &other) const
Equality operator.
│ │ │ -
EdgeIteratorT(const EdgeIteratorT< C1 > &other)
Copy Constructor.
│ │ │ -
bool operator!=(const EdgeIteratorT< typename std::remove_const< C >::type > &other) const
Inequality operator.
│ │ │ -
WeightType & weight() const
Access the edge weight.
│ │ │ -
VertexDescriptor source() const
The index of the source vertex of the current edge.
│ │ │ -
std::conditional< isMutable &&C::mutableMatrix, typenameMatrix::row_type::Iterator, typenameMatrix::row_type::ConstIterator >::type ColIterator
The column iterator of the matrix we use.
Definition graph.hh:120
│ │ │ -
const std::remove_const< C >::type ConstContainer
The constant type of the container type.
Definition graph.hh:105
│ │ │ -
bool operator==(const EdgeIteratorT< typename std::remove_const< C >::type > &other) const
Equality operator.
│ │ │ -
EdgeIteratorT(const ColIterator &block)
Constructor for the end iterator.
│ │ │ -
std::conditional< isMutable &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type Weight
The matrix block type we use as weights.
Definition graph.hh:127
│ │ │ -
const EdgeDescriptor & operator*() const
Get the edge descriptor.
│ │ │ -
const EdgeDescriptor * operator->() const
Get the edge descriptor.
│ │ │ -
std::remove_const< C >::type MutableContainer
The mutable type of the container type.
Definition graph.hh:101
│ │ │ -
The vertex iterator type of the graph.
Definition graph.hh:209
│ │ │ -
EdgeIteratorT< C > begin() const
Get an iterator over all edges starting at the current vertex.
│ │ │ -
const VertexDescriptor & operator*() const
Get the descriptor of the current vertex.
│ │ │ -
WeightType & weight() const
Access the weight of the vertex.
│ │ │ -
VertexIteratorT(C *graph, const VertexDescriptor &current)
Constructor.
│ │ │ -
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >::type WeightType
Definition graph.hh:266
│ │ │ -
VertexIteratorT(const VertexIteratorT< MutableContainer > &other)
│ │ │ -
std::remove_const< C >::type MutableContainer
The mutable type of the container type.
Definition graph.hh:214
│ │ │ -
bool operator!=(const VertexIteratorT< MutableContainer > &other) const
Inequality operator.
│ │ │ -
@ isMutable
whether C is mutable.
Definition graph.hh:225
│ │ │ -
bool operator==(const VertexIteratorT< MutableContainer > &other) const
Equality operator.
│ │ │ -
const std::remove_const< C >::type ConstContainer
The constant type of the container type.
Definition graph.hh:218
│ │ │ -
VertexIteratorT< C > & operator++()
Move to the next vertex.
│ │ │ -
EdgeIteratorT< C > end() const
Get an iterator over all edges starting at the current vertex.
│ │ │ -
bool operator==(const VertexIteratorT< ConstContainer > &other) const
Equality operator.
│ │ │ -
bool operator!=(const VertexIteratorT< ConstContainer > &other) const
Inequality operator.
│ │ │ -
VertexIteratorT(const VertexDescriptor &current)
Constructor for the end iterator.
│ │ │ -
A subgraph of a graph.
Definition graph.hh:443
│ │ │ -
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target) const
Find the descriptor of an edge.
│ │ │ -
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ -
EdgeIndexMap getEdgeIndexMap()
Get an edge index map for the graph.
│ │ │ -
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ -
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ -
ConstVertexIterator end() const
Get an iterator over the vertices.
│ │ │ -
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get an iterator over the edges starting at a vertex.
│ │ │ -
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ -
T Excluded
Random access container providing information about which vertices are excluded.
Definition graph.hh:454
│ │ │ -
~SubGraph()
Destructor.
│ │ │ -
EdgeIterator ConstEdgeIterator
The constant edge iterator type.
Definition graph.hh:618
│ │ │ -
G Graph
The type of the graph we are a sub graph for.
Definition graph.hh:448
│ │ │ -
VertexIterator ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:623
│ │ │ -
SubGraph(const Graph &graph, const T &excluded)
Constructor.
│ │ │ -
ConstVertexIterator begin() const
Get an iterator over the vertices.
│ │ │ -
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:459
│ │ │ -
VertexDescriptor * EdgeDescriptor
Definition graph.hh:461
│ │ │ -
An index map for mapping the edges to indices.
Definition graph.hh:470
│ │ │ -
EdgeIndexMap(const EdgeIndexMap &emap)
Protect copy construction.
Definition graph.hh:479
│ │ │ -
ReadablePropertyMapTag Category
Definition graph.hh:472
│ │ │ -
EdgeIndexMap(const EdgeDescriptor &firstEdge)
Definition graph.hh:474
│ │ │ -
std::size_t operator[](const EdgeDescriptor &edge) const
Definition graph.hh:483
│ │ │ -
The edge iterator of the graph.
Definition graph.hh:505
│ │ │ -
const EdgeDescriptor & dereference() const
The descriptor of the current edge.
│ │ │ -
EdgeIterator(const EdgeDescriptor &edge)
Constructor for the end iterator.
│ │ │ -
bool equals(const EdgeIterator &other) const
Equality operator.
│ │ │ -
EdgeIterator & advance(std::ptrdiff_t n)
│ │ │ -
EdgeIterator & increment()
Preincrement operator.
│ │ │ -
const VertexDescriptor & target() const
The index of the target vertex of the current edge.
│ │ │ -
const VertexDescriptor & source() const
The index of the source vertex of the current edge.
│ │ │ -
EdgeIterator & decrement()
Preincrement operator.
│ │ │ -
std::ptrdiff_t distanceTo(const EdgeIterator &other) const
│ │ │ -
EdgeIterator(const VertexDescriptor &source, const EdgeDescriptor &edge)
Constructor.
│ │ │ -
The vertex iterator of the graph.
Definition graph.hh:560
│ │ │ -
VertexIterator(const VertexDescriptor &current)
Constructor for end iterator.
│ │ │ -
VertexIterator & increment()
Preincrement operator.
│ │ │ -
EdgeIterator begin() const
Get an iterator over all edges starting at the current vertex.
│ │ │ -
bool equals(const VertexIterator &other) const
Equality iterator.
│ │ │ -
VertexIterator(const SubGraph< G, T > *graph, const VertexDescriptor &current, const VertexDescriptor &end)
Constructor.
│ │ │ -
EdgeIterator end() const
Get an iterator over all edges starting at the current vertex.
│ │ │ -
const VertexDescriptor & dereference() const
Get the descriptor of the current vertex.
│ │ │ -
Attaches properties to the vertices of a graph.
Definition graph.hh:723
│ │ │ -
const Graph & graph() const
Get the graph the properties are attached to.
│ │ │ -
Graph::ConstEdgeIterator ConstEdgeIterator
The type of the constant edge iterator.
Definition graph.hh:766
│ │ │ -
VertexProperties & getVertexProperties(const VertexDescriptor &vertex)
Get the properties associated with a vertex.
│ │ │ -
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ -
Graph::EdgeDescriptor EdgeDescriptor
The edge descritor.
Definition graph.hh:738
│ │ │ -
ConstEdgeIterator endEdges(const VertexDescriptor &source) const
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ -
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:733
│ │ │ -
G Graph
The graph we attach properties to.
Definition graph.hh:728
│ │ │ -
VM VertexMap
The type of the map for converting the VertexDescriptor to std::size_t.
Definition graph.hh:756
│ │ │ -
EdgeIterator endEdges(const VertexDescriptor &source)
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ -
EdgeIterator beginEdges(const VertexDescriptor &source)
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ -
VP VertexProperties
The type of the properties of the vertices.
Definition graph.hh:743
│ │ │ -
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ -
ConstEdgeIterator beginEdges(const VertexDescriptor &source) const
Get the mutable edge iterator over edges starting at a vertex.
│ │ │ -
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ -
Graph::EdgeIterator EdgeIterator
The type of the mutable edge iterator.
Definition graph.hh:761
│ │ │ - │ │ │ -
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type EdgeIterator
The class of the edge iterator.
Definition graph.hh:823
│ │ │ -
std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
Get the properties of the current Vertex.
│ │ │ -
EdgeIterator end() const
Get an iterator over the edges starting from the current vertex.
│ │ │ -
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >::type Father
The father class.
Definition graph.hh:814
│ │ │ -
EdgeIterator begin() const
Get an iterator over the edges starting from the current vertex.
│ │ │ -
Attaches properties to the edges and vertices of a graph.
Definition graph.hh:978
│ │ │ -
std::size_t noVertices() const
Get the number of vertices in the graph.
│ │ │ -
Graph::EdgeDescriptor EdgeDescriptor
The edge descritor.
Definition graph.hh:993
│ │ │ -
const EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const VertexDescriptor &target) const
Get the properties associated with a edge.
│ │ │ -
const EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) const
Get the properties associated with a edge.
│ │ │ -
const Graph & graph() const
Get the graph the properties are attached to.
│ │ │ -
VertexDescriptor maxVertex() const
Get the maximal vertex descriptor.
│ │ │ -
G Graph
The graph we attach properties to.
Definition graph.hh:983
│ │ │ -
EM EdgeMap
The type of the map for converting the EdgeDescriptor to std::size_t.
Definition graph.hh:1030
│ │ │ -
VM VertexMap
The type of the map for converting the VertexDescriptor to std::size_t.
Definition graph.hh:1011
│ │ │ -
VP VertexProperties
The type of the properties of the vertices.
Definition graph.hh:998
│ │ │ -
std::size_t noEdges() const
Get the number of edges in the graph.
│ │ │ -
EP EdgeProperties
The type of the properties of the edges;.
Definition graph.hh:1016
│ │ │ -
EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const VertexDescriptor &target)
Get the properties associated with a edge.
│ │ │ -
EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge)
Get the properties associated with a edge.
│ │ │ -
Graph::VertexDescriptor VertexDescriptor
The vertex descriptor.
Definition graph.hh:988
│ │ │ -
PropertiesGraph(Graph &graph, const VertexMap &vmap=VertexMap(), const EdgeMap &emap=EdgeMap())
Constructor.
│ │ │ - │ │ │ -
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type Father
The father class.
Definition graph.hh:1050
│ │ │ - │ │ │ -
std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >::value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >::type Father
The father class.
Definition graph.hh:1151
│ │ │ -
Wrapper to access the internal edge properties of a graph via operator[]()
Definition graph.hh:1361
│ │ │ -
GraphVertexPropertiesSelector(G &g)
Constructor.
Definition graph.hh:1380
│ │ │ -
VertexProperties & operator[](const Vertex &vertex) const
Get the properties associated to a vertex.
Definition graph.hh:1395
│ │ │ -
G Graph
The type of the graph with internal properties.
Definition graph.hh:1366
│ │ │ -
G::VertexProperties VertexProperties
The type of the vertex properties.
Definition graph.hh:1370
│ │ │ -
GraphVertexPropertiesSelector()
Default constructor.
Definition graph.hh:1386
│ │ │ -
G::VertexDescriptor Vertex
The vertex descriptor.
Definition graph.hh:1374
│ │ │ -
Wrapper to access the internal vertex properties of a graph via operator[]()
Definition graph.hh:1409
│ │ │ -
EdgeProperties & operator[](const Edge &edge) const
Get the properties associated to a vertex.
Definition graph.hh:1442
│ │ │ -
G::EdgeProperties EdgeProperties
The type of the vertex properties.
Definition graph.hh:1418
│ │ │ -
G::EdgeDescriptor Edge
The edge descriptor.
Definition graph.hh:1422
│ │ │ -
GraphEdgePropertiesSelector()
Default constructor.
Definition graph.hh:1434
│ │ │ -
G Graph
The type of the graph with internal properties.
Definition graph.hh:1414
│ │ │ -
GraphEdgePropertiesSelector(G &g)
Constructor.
Definition graph.hh:1428
│ │ │ +
std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v)
Send BlockVector to an output stream.
Definition bvector.hh:583
│ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ +
BlockVector()
makes empty vector
Definition bvector.hh:418
│ │ │ +
Imp::block_vector_unmanaged< B, size_type >::ConstIterator ConstIterator
make iterators available as types
Definition bvector.hh:413
│ │ │ +
void reserve(size_type capacity)
Reserve space.
Definition bvector.hh:468
│ │ │ +
BlockVector(BlockVector &&a) noexcept(noexcept(std::declval< BlockVector >().swap(a)))
move constructor
Definition bvector.hh:512
│ │ │ +
BlockVector(size_type _n)
make vector with _n components
Definition bvector.hh:424
│ │ │ +
void resize(size_type size)
Resize the vector.
Definition bvector.hh:496
│ │ │ +
Imp::block_vector_unmanaged< B, size_type >::Iterator Iterator
make iterators available as types
Definition bvector.hh:410
│ │ │ +
BlockVector(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector >().storage_=a.storage_))
copy constructor
Definition bvector.hh:504
│ │ │ +
A allocator_type
export the allocator type
Definition bvector.hh:404
│ │ │ +
BlockVector & operator=(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector >().storage_=a.storage_))
assignment
Definition bvector.hh:519
│ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:398
│ │ │ +
A::size_type size_type
The type for the index access.
Definition bvector.hh:407
│ │ │ +
BlockVector(std::initializer_list< B > const &l)
Construct from a std::initializer_list.
Definition bvector.hh:430
│ │ │ +
size_type capacity() const
Get the capacity of the vector.
Definition bvector.hh:481
│ │ │ +
BlockVector(size_type _n, S _capacity)
Make vector with _n components but preallocating capacity components.
Definition bvector.hh:448
│ │ │ +
B block_type
export the type representing the components
Definition bvector.hh:401
│ │ │ +
void swap(BlockVector &other) noexcept(noexcept(std::declval< BlockVector & >().storage_.swap(other.storage_)))
swap operation
Definition bvector.hh:537
│ │ │ +
FieldTraits< B >::real_type real_type
Definition bvector.hh:575
│ │ │ +
FieldTraits< B >::field_type field_type
Definition bvector.hh:574
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,2286 +1,992 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -graph.hh │ │ │ │ +bvector.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_AMG_GRAPH_HH │ │ │ │ -6#define DUNE_AMG_GRAPH_HH │ │ │ │ -7 │ │ │ │ -8#include │ │ │ │ +5 │ │ │ │ +6#ifndef DUNE_ISTL_BVECTOR_HH │ │ │ │ +7#define DUNE_ISTL_BVECTOR_HH │ │ │ │ +8 │ │ │ │ 9#include │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15#include <_d_u_n_e_/_i_s_t_l_/_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h> │ │ │ │ -16#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ 17 │ │ │ │ -18namespace _D_u_n_e │ │ │ │ -19{ │ │ │ │ -20 namespace Amg │ │ │ │ -21 { │ │ │ │ -49 template │ │ │ │ -_5_0 class _M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -51 { │ │ │ │ -52 public: │ │ │ │ -_5_6 typedef M _M_a_t_r_i_x; │ │ │ │ +18#include │ │ │ │ +19#include │ │ │ │ +20#include │ │ │ │ +21#include │ │ │ │ +22#include │ │ │ │ +23#include │ │ │ │ +24#include │ │ │ │ +25 │ │ │ │ +26#include <_d_u_n_e_/_i_s_t_l_/_b_l_o_c_k_l_e_v_e_l_._h_h> │ │ │ │ +27 │ │ │ │ +28#include "_b_a_s_e_a_r_r_a_y_._h_h" │ │ │ │ +29#include "_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h" │ │ │ │ +30 │ │ │ │ +38namespace _D_u_n_e { │ │ │ │ +39 │ │ │ │ +41namespace Imp { │ │ │ │ +42 │ │ │ │ +48 template │ │ │ │ +49 class BlockTraitsImp; │ │ │ │ +50 │ │ │ │ +51 template │ │ │ │ +52 class BlockTraitsImp │ │ │ │ +53 { │ │ │ │ +54 public: │ │ │ │ +55 using field_type = B; │ │ │ │ +56 }; │ │ │ │ 57 │ │ │ │ -_6_1 typedef typename std::remove_const::type _M_u_t_a_b_l_e_M_a_t_r_i_x; │ │ │ │ -62 │ │ │ │ -_6_6 typedef typename M::block_type _W_e_i_g_h_t; │ │ │ │ -67 │ │ │ │ -_7_3 typedef typename M::size_type _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -74 │ │ │ │ -_8_0 typedef std::ptrdiff_t _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -81 │ │ │ │ -82 enum { │ │ │ │ -83 /* │ │ │ │ -84 * @brief Whether Matrix is mutable. │ │ │ │ -85 */ │ │ │ │ -86 _m_u_t_a_b_l_e_M_a_t_r_i_x = std::is_same::type>::value │ │ │ │ -_8_7 }; │ │ │ │ -88 │ │ │ │ -89 │ │ │ │ -93 template │ │ │ │ -_9_4 class _E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -95 { │ │ │ │ +58 template │ │ │ │ +59 class BlockTraitsImp │ │ │ │ +60 { │ │ │ │ +61 public: │ │ │ │ +62 using field_type = typename B::field_type; │ │ │ │ +63 }; │ │ │ │ +64 │ │ │ │ +67 template │ │ │ │ +68 using BlockTraits = BlockTraitsImp::value>; │ │ │ │ +69 │ │ │ │ +83 template │ │ │ │ +84 class block_vector_unmanaged : public base_array_unmanaged │ │ │ │ +85 { │ │ │ │ +86 public: │ │ │ │ +87 │ │ │ │ +88 //===== type definitions and constants │ │ │ │ +89 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ +90 │ │ │ │ +92 typedef B block_type; │ │ │ │ +93 │ │ │ │ +95 typedef ST size_type; │ │ │ │ 96 │ │ │ │ -97 public: │ │ │ │ -_1_0_1 typedef typename std::remove_const::type _M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r; │ │ │ │ -_1_0_5 typedef const typename std::remove_const::type _C_o_n_s_t_C_o_n_t_a_i_n_e_r; │ │ │ │ -106 │ │ │ │ -107 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r>; │ │ │ │ -108 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T<_C_o_n_s_t_C_o_n_t_a_i_n_e_r>; │ │ │ │ -109 │ │ │ │ -110 enum { │ │ │ │ -112 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ -_1_1_3 }; │ │ │ │ +98 typedef typename base_array_unmanaged::iterator Iterator; │ │ │ │ +99 │ │ │ │ +101 typedef typename base_array_unmanaged::const_iterator ConstIterator; │ │ │ │ +102 │ │ │ │ +104 typedef B value_type; │ │ │ │ +105 │ │ │ │ +107 typedef B& reference; │ │ │ │ +108 │ │ │ │ +110 typedef const B& const_reference; │ │ │ │ +111 │ │ │ │ +112 //===== assignment from scalar │ │ │ │ 114 │ │ │ │ -118 typedef typename std::conditional<_i_s_M_u_t_a_b_l_e && C::mutableMatrix,typename │ │ │ │ -Matrix::row_type::Iterator, │ │ │ │ -119 typename Matrix::row_type::ConstIterator>::type │ │ │ │ -_1_2_0 _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ +115 block_vector_unmanaged& operator= (const field_type& k) │ │ │ │ +116 { │ │ │ │ +117 for (size_type i=0; in; i++) │ │ │ │ +118 (*this)[i] = k; │ │ │ │ +119 return *this; │ │ │ │ +120 } │ │ │ │ 121 │ │ │ │ -125 typedef typename std::conditional<_i_s_M_u_t_a_b_l_e && C::mutableMatrix,typename │ │ │ │ -M::block_type, │ │ │ │ -126 const typename M::block_type>::type │ │ │ │ -_1_2_7 _W_e_i_g_h_t; │ │ │ │ -128 │ │ │ │ -_1_3_6 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e, const _C_o_l_I_t_e_r_a_t_o_r& block, │ │ │ │ -137 const _C_o_l_I_t_e_r_a_t_o_r& _e_n_d, const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ -138 │ │ │ │ -_1_4_5 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _C_o_l_I_t_e_r_a_t_o_r& block); │ │ │ │ -146 │ │ │ │ -151 template │ │ │ │ -_1_5_2 _E_d_g_e_I_t_e_r_a_t_o_r_T(const _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_1_>& other); │ │ │ │ -153 │ │ │ │ -154 typedef typename std::conditional::type>::value && C::mutableMatrix, │ │ │ │ -155 typename M::block_type, const typename M::block_type>::type │ │ │ │ -_1_5_6 _W_e_i_g_h_t_T_y_p_e; │ │ │ │ -157 │ │ │ │ -_1_6_1 _W_e_i_g_h_t_T_y_p_e& _w_e_i_g_h_t() const; │ │ │ │ -162 │ │ │ │ -_1_6_4 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_>& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ +122 //===== vector space arithmetic │ │ │ │ +124 block_vector_unmanaged& operator+= (const block_vector_unmanaged& y) │ │ │ │ +125 { │ │ │ │ +126#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +127 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +128#endif │ │ │ │ +129 for (size_type i=0; in; ++i) (*this)[i] += y[i]; │ │ │ │ +130 return *this; │ │ │ │ +131 } │ │ │ │ +132 │ │ │ │ +134 block_vector_unmanaged& operator-= (const block_vector_unmanaged& y) │ │ │ │ +135 { │ │ │ │ +136#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +137 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +138#endif │ │ │ │ +139 for (size_type i=0; in; ++i) (*this)[i] -= y[i]; │ │ │ │ +140 return *this; │ │ │ │ +141 } │ │ │ │ +142 │ │ │ │ +144 block_vector_unmanaged& operator*= (const field_type& k) │ │ │ │ +145 { │ │ │ │ +146 for (size_type i=0; in; ++i) (*this)[i] *= k; │ │ │ │ +147 return *this; │ │ │ │ +148 } │ │ │ │ +149 │ │ │ │ +151 block_vector_unmanaged& operator/= (const field_type& k) │ │ │ │ +152 { │ │ │ │ +153 for (size_type i=0; in; ++i) (*this)[i] /= k; │ │ │ │ +154 return *this; │ │ │ │ +155 } │ │ │ │ +156 │ │ │ │ +158 block_vector_unmanaged& axpy (const field_type& a, const │ │ │ │ +block_vector_unmanaged& y) │ │ │ │ +159 { │ │ │ │ +160#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +161 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +162#endif │ │ │ │ +163 for (size_type i=0; in; ++i) │ │ │ │ +164 Impl::asVector((*this)[i]).axpy(a,Impl::asVector(y[i])); │ │ │ │ 165 │ │ │ │ -_1_6_7 bool _o_p_e_r_a_t_o_r_!_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T::type>& │ │ │ │ -other) const; │ │ │ │ +166 return *this; │ │ │ │ +167 } │ │ │ │ 168 │ │ │ │ -_1_7_0 bool _o_p_e_r_a_t_o_r_!_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T:: │ │ │ │ -type>& other) const; │ │ │ │ -171 │ │ │ │ -_1_7_3 bool _o_p_e_r_a_t_o_r_=_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T::type>& │ │ │ │ -other) const; │ │ │ │ -174 │ │ │ │ -_1_7_6 bool _o_p_e_r_a_t_o_r_=_=(const _E_d_g_e_I_t_e_r_a_t_o_r_T:: │ │ │ │ -type>& other) const; │ │ │ │ -177 │ │ │ │ -_1_7_9 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _t_a_r_g_e_t() const; │ │ │ │ -180 │ │ │ │ -_1_8_2 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _s_o_u_r_c_e() const; │ │ │ │ -183 │ │ │ │ -_1_8_5 const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_*() const; │ │ │ │ -186 │ │ │ │ -_1_8_8 const _E_d_g_e_D_e_s_c_r_i_p_t_o_r* _o_p_e_r_a_t_o_r_-_>() const; │ │ │ │ -189 │ │ │ │ -190 private: │ │ │ │ -192 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r source_; │ │ │ │ -194 _C_o_l_I_t_e_r_a_t_o_r block_; │ │ │ │ -195 /*** │ │ │ │ -196 * @brief The column iterator positioned at the end of the row │ │ │ │ -197 * of vertex source_ │ │ │ │ -198 */ │ │ │ │ -199 _C_o_l_I_t_e_r_a_t_o_r blockEnd_; │ │ │ │ -201 _E_d_g_e_D_e_s_c_r_i_p_t_o_r edge_; │ │ │ │ -202 }; │ │ │ │ -203 │ │ │ │ -207 template │ │ │ │ -_2_0_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -209 { │ │ │ │ -210 public: │ │ │ │ -_2_1_4 typedef typename std::remove_const::type _M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r; │ │ │ │ -_2_1_8 typedef const typename std::remove_const::type _C_o_n_s_t_C_o_n_t_a_i_n_e_r; │ │ │ │ -219 │ │ │ │ -220 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r>; │ │ │ │ -221 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T<_C_o_n_s_t_C_o_n_t_a_i_n_e_r>; │ │ │ │ -222 │ │ │ │ -223 enum { │ │ │ │ -225 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ -_2_2_6 }; │ │ │ │ -227 │ │ │ │ -_2_3_3 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(C* graph, const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ -234 │ │ │ │ -_2_4_2 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ -243 │ │ │ │ -_2_4_4 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other); │ │ │ │ -245 │ │ │ │ -_2_5_0 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_>& _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ -251 │ │ │ │ -_2_5_3 bool _o_p_e_r_a_t_o_r_!_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_o_n_s_t_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ -254 │ │ │ │ -_2_5_6 bool _o_p_e_r_a_t_o_r_=_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_C_o_n_s_t_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ -257 │ │ │ │ -_2_5_9 bool _o_p_e_r_a_t_o_r_!_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ -260 │ │ │ │ -_2_6_2 bool _o_p_e_r_a_t_o_r_=_=(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r_>& other) const; │ │ │ │ +169 │ │ │ │ +177 template │ │ │ │ +178 auto operator* (const block_vector_unmanaged& y) const │ │ │ │ +179 { │ │ │ │ +180 typedef typename PromotionTraits:: │ │ │ │ +field_type>::PromotedType PromotedType; │ │ │ │ +181 PromotedType sum(0); │ │ │ │ +182#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +183 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +184#endif │ │ │ │ +185 for (size_type i=0; in; ++i) { │ │ │ │ +186 sum += PromotedType(((*this)[i])*y[i]); │ │ │ │ +187 } │ │ │ │ +188 return sum; │ │ │ │ +189 } │ │ │ │ +190 │ │ │ │ +198 template │ │ │ │ +199 auto dot(const block_vector_unmanaged& y) const │ │ │ │ +200 { │ │ │ │ +201 typedef typename PromotionTraits:: │ │ │ │ +field_type>::PromotedType PromotedType; │ │ │ │ +202 PromotedType sum(0); │ │ │ │ +203#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +204 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +205#endif │ │ │ │ +206 │ │ │ │ +207 for (size_type i=0; in; ++i) │ │ │ │ +208 sum += Impl::asVector((*this)[i]).dot(Impl::asVector(y[i])); │ │ │ │ +209 │ │ │ │ +210 return sum; │ │ │ │ +211 } │ │ │ │ +212 │ │ │ │ +213 //===== norms │ │ │ │ +214 │ │ │ │ +216 typename FieldTraits::real_type one_norm () const │ │ │ │ +217 { │ │ │ │ +218 typename FieldTraits::real_type sum=0; │ │ │ │ +219 for (size_type i=0; in; ++i) │ │ │ │ +220 sum += Impl::asVector((*this)[i]).one_norm(); │ │ │ │ +221 return sum; │ │ │ │ +222 } │ │ │ │ +223 │ │ │ │ +225 typename FieldTraits::real_type one_norm_real () const │ │ │ │ +226 { │ │ │ │ +227 typename FieldTraits::real_type sum=0; │ │ │ │ +228 for (size_type i=0; in; ++i) │ │ │ │ +229 sum += Impl::asVector((*this)[i]).one_norm_real(); │ │ │ │ +230 return sum; │ │ │ │ +231 } │ │ │ │ +232 │ │ │ │ +234 typename FieldTraits::real_type two_norm () const │ │ │ │ +235 { │ │ │ │ +236 using std::sqrt; │ │ │ │ +237 return sqrt(two_norm2()); │ │ │ │ +238 } │ │ │ │ +239 │ │ │ │ +241 typename FieldTraits::real_type two_norm2 () const │ │ │ │ +242 { │ │ │ │ +243 typename FieldTraits::real_type sum=0; │ │ │ │ +244 for (size_type i=0; in; ++i) │ │ │ │ +245 sum += Impl::asVector((*this)[i]).two_norm2(); │ │ │ │ +246 return sum; │ │ │ │ +247 } │ │ │ │ +248 │ │ │ │ +250 template ::value, int>::type = 0> │ │ │ │ +252 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ +253 using real_type = typename FieldTraits::real_type; │ │ │ │ +254 using std::max; │ │ │ │ +255 │ │ │ │ +256 real_type norm = 0; │ │ │ │ +257 for (auto const &xi : *this) { │ │ │ │ +258 real_type const a = Impl::asVector(xi).infinity_norm(); │ │ │ │ +259 norm = max(a, norm); │ │ │ │ +260 } │ │ │ │ +261 return norm; │ │ │ │ +262 } │ │ │ │ 263 │ │ │ │ -264 typedef typename std::conditional::type>::value && C::mutableMatrix, │ │ │ │ -265 typename M::block_type, const typename M::block_type>::type │ │ │ │ -_2_6_6 _W_e_i_g_h_t_T_y_p_e; │ │ │ │ -_2_6_8 _W_e_i_g_h_t_T_y_p_e& _w_e_i_g_h_t() const; │ │ │ │ -269 │ │ │ │ -_2_7_4 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _o_p_e_r_a_t_o_r_*() const; │ │ │ │ -275 │ │ │ │ -_2_8_1 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_> _b_e_g_i_n() const; │ │ │ │ -282 │ │ │ │ -_2_8_8 _E_d_g_e_I_t_e_r_a_t_o_r_T_<_C_> _e_n_d() const; │ │ │ │ +265 template ::value, int>::type = 0> │ │ │ │ +267 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ +268 using real_type = typename FieldTraits::real_type; │ │ │ │ +269 using std::max; │ │ │ │ +270 │ │ │ │ +271 real_type norm = 0; │ │ │ │ +272 for (auto const &xi : *this) { │ │ │ │ +273 real_type const a = Impl::asVector(xi).infinity_norm_real(); │ │ │ │ +274 norm = max(a, norm); │ │ │ │ +275 } │ │ │ │ +276 return norm; │ │ │ │ +277 } │ │ │ │ +278 │ │ │ │ +280 template ::value, int>::type = 0> │ │ │ │ +282 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ +283 using real_type = typename FieldTraits::real_type; │ │ │ │ +284 using std::max; │ │ │ │ +285 using std::abs; │ │ │ │ +286 │ │ │ │ +287 real_type norm = 0; │ │ │ │ +288 real_type isNaN = 1; │ │ │ │ 289 │ │ │ │ -290 private: │ │ │ │ -291 C* graph_; │ │ │ │ -292 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r current_; │ │ │ │ -293 }; │ │ │ │ -294 │ │ │ │ -_2_9_8 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T_<_c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -299 │ │ │ │ -_3_0_3 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T_<_M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +290 for (auto const &xi : *this) { │ │ │ │ +291 real_type const a = Impl::asVector(xi).infinity_norm(); │ │ │ │ +292 norm = max(a, norm); │ │ │ │ +293 isNaN += a; │ │ │ │ +294 } │ │ │ │ +295 return norm * (isNaN / isNaN); │ │ │ │ +296 } │ │ │ │ +297 │ │ │ │ +299 template ::value, int>::type = 0> │ │ │ │ +301 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ +302 using real_type = typename FieldTraits::real_type; │ │ │ │ +303 using std::max; │ │ │ │ 304 │ │ │ │ -_3_0_8 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ -309 │ │ │ │ -_3_1_3 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_<_M_a_t_r_i_x_G_r_a_p_h_<_M_a_t_r_i_x_> > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ -314 │ │ │ │ -_3_1_9 _M_a_t_r_i_x_G_r_a_p_h(_M_a_t_r_i_x& _m_a_t_r_i_x); │ │ │ │ -320 │ │ │ │ -_3_2_4 _~_M_a_t_r_i_x_G_r_a_p_h(); │ │ │ │ -325 │ │ │ │ -_3_3_0 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ -331 │ │ │ │ -_3_3_6 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ -337 │ │ │ │ -_3_4_2 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +305 real_type norm = 0; │ │ │ │ +306 real_type isNaN = 1; │ │ │ │ +307 │ │ │ │ +308 for (auto const &xi : *this) { │ │ │ │ +309 real_type const a = Impl::asVector(xi).infinity_norm_real(); │ │ │ │ +310 norm = max(a, norm); │ │ │ │ +311 isNaN += a; │ │ │ │ +312 } │ │ │ │ +313 │ │ │ │ +314 return norm * (isNaN / isNaN); │ │ │ │ +315 } │ │ │ │ +316 │ │ │ │ +317 //===== sizes │ │ │ │ +318 │ │ │ │ +320 size_type N () const │ │ │ │ +321 { │ │ │ │ +322 return this->n; │ │ │ │ +323 } │ │ │ │ +324 │ │ │ │ +326 size_type dim () const │ │ │ │ +327 { │ │ │ │ +328 size_type d=0; │ │ │ │ +329 │ │ │ │ +330 for (size_type i=0; in; i++) │ │ │ │ +331 d += Impl::asVector((*this)[i]).dim(); │ │ │ │ +332 │ │ │ │ +333 return d; │ │ │ │ +334 } │ │ │ │ +335 │ │ │ │ +336 protected: │ │ │ │ +338 block_vector_unmanaged () : base_array_unmanaged() │ │ │ │ +339 { } │ │ │ │ +340 }; │ │ │ │ +341 │ │ │ │ 343 │ │ │ │ -_3_4_8 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ -349 │ │ │ │ -_3_5_6 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ -357 │ │ │ │ -_3_6_4 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ -365 │ │ │ │ -366 │ │ │ │ -_3_7_3 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ +348 template │ │ │ │ +349 class ScopeGuard { │ │ │ │ +350 F cleanupFunc_; │ │ │ │ +351 public: │ │ │ │ +352 ScopeGuard(F cleanupFunc) : cleanupFunc_(_s_t_d::move(cleanupFunc)) {} │ │ │ │ +353 ScopeGuard(const ScopeGuard &) = delete; │ │ │ │ +354 ScopeGuard(ScopeGuard &&) = delete; │ │ │ │ +355 ScopeGuard &operator=(ScopeGuard) = delete; │ │ │ │ +356 ~ScopeGuard() { cleanupFunc_(); } │ │ │ │ +357 }; │ │ │ │ +358 │ │ │ │ +360 │ │ │ │ +369 template │ │ │ │ +370 ScopeGuard makeScopeGuard(F cleanupFunc) │ │ │ │ +371 { │ │ │ │ +372 return { std::move(cleanupFunc) }; │ │ │ │ +373 } │ │ │ │ 374 │ │ │ │ -_3_8_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ -382 │ │ │ │ -_3_8_7 _M_a_t_r_i_x& _m_a_t_r_i_x(); │ │ │ │ -388 │ │ │ │ -_3_9_3 const _M_a_t_r_i_x& _m_a_t_r_i_x() const; │ │ │ │ +375} // end namespace Imp │ │ │ │ +390 template > │ │ │ │ +_3_9_1 class _B_l_o_c_k_V_e_c_t_o_r : public Imp::block_vector_unmanaged │ │ │ │ +392 { │ │ │ │ +393 public: │ │ │ │ 394 │ │ │ │ -_3_9_8 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +395 //===== type definitions and constants │ │ │ │ +396 │ │ │ │ +_3_9_8 using _f_i_e_l_d___t_y_p_e = typename Imp::BlockTraits::field_type; │ │ │ │ 399 │ │ │ │ -_4_0_6 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ -407 │ │ │ │ -_4_1_1 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ -412 │ │ │ │ -_4_1_9 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ -420 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ -421 │ │ │ │ -422 private: │ │ │ │ -424 _M_a_t_r_i_x& matrix_; │ │ │ │ -426 _E_d_g_e_D_e_s_c_r_i_p_t_o_r* start_; │ │ │ │ -428 _M_a_t_r_i_x_G_r_a_p_h(const _M_a_t_r_i_x_G_r_a_p_h&); │ │ │ │ -429 │ │ │ │ -430 }; │ │ │ │ -431 │ │ │ │ -441 template │ │ │ │ -_4_4_2 class _S_u_b_G_r_a_p_h │ │ │ │ -443 { │ │ │ │ -444 public: │ │ │ │ -_4_4_8 typedef G _G_r_a_p_h; │ │ │ │ -449 │ │ │ │ -_4_5_4 typedef T _E_x_c_l_u_d_e_d; │ │ │ │ -455 │ │ │ │ -_4_5_9 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -460 │ │ │ │ -_4_6_1 typedef _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -462 │ │ │ │ -_4_6_9 class _E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -470 { │ │ │ │ -471 public: │ │ │ │ -_4_7_2 typedef ReadablePropertyMapTag _C_a_t_e_g_o_r_y; │ │ │ │ -473 │ │ │ │ -_4_7_4 _E_d_g_e_I_n_d_e_x_M_a_p(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& firstEdge) │ │ │ │ -475 : firstEdge_(firstEdge) │ │ │ │ -476 {} │ │ │ │ -477 │ │ │ │ -_4_7_9 _E_d_g_e_I_n_d_e_x_M_a_p(const _E_d_g_e_I_n_d_e_x_M_a_p& emap) │ │ │ │ -480 : firstEdge_(emap.firstEdge_) │ │ │ │ -481 {} │ │ │ │ -482 │ │ │ │ -_4_8_3 std::size_t _o_p_e_r_a_t_o_r_[_](const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge) const │ │ │ │ -484 { │ │ │ │ -485 return edge-firstEdge_; │ │ │ │ -486 } │ │ │ │ -487 private: │ │ │ │ -489 _E_d_g_e_D_e_s_c_r_i_p_t_o_r firstEdge_; │ │ │ │ -491 _E_d_g_e_I_n_d_e_x_M_a_p() │ │ │ │ -492 {} │ │ │ │ -493 }; │ │ │ │ -494 │ │ │ │ -_4_9_9 _E_d_g_e_I_n_d_e_x_M_a_p _g_e_t_E_d_g_e_I_n_d_e_x_M_a_p(); │ │ │ │ -500 │ │ │ │ -_5_0_4 class _E_d_g_e_I_t_e_r_a_t_o_r : public RandomAccessIteratorFacade │ │ │ │ -505 { │ │ │ │ -506 public: │ │ │ │ -_5_1_2 explicit _E_d_g_e_I_t_e_r_a_t_o_r(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e, const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& │ │ │ │ -edge); │ │ │ │ -513 │ │ │ │ -_5_2_1 explicit _E_d_g_e_I_t_e_r_a_t_o_r(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ -522 │ │ │ │ -_5_2_4 bool _e_q_u_a_l_s(const _E_d_g_e_I_t_e_r_a_t_o_r& other) const; │ │ │ │ -525 │ │ │ │ -_5_2_7 _E_d_g_e_I_t_e_r_a_t_o_r& _i_n_c_r_e_m_e_n_t(); │ │ │ │ -528 │ │ │ │ -_5_3_0 _E_d_g_e_I_t_e_r_a_t_o_r& _d_e_c_r_e_m_e_n_t(); │ │ │ │ -531 │ │ │ │ -_5_3_2 _E_d_g_e_I_t_e_r_a_t_o_r& _a_d_v_a_n_c_e(std::ptrdiff_t n); │ │ │ │ -533 │ │ │ │ -_5_3_5 const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ -536 │ │ │ │ -_5_3_8 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _t_a_r_g_e_t() const; │ │ │ │ -539 │ │ │ │ -_5_4_1 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _s_o_u_r_c_e() const; │ │ │ │ -542 │ │ │ │ -_5_4_3 std::ptrdiff_t _d_i_s_t_a_n_c_e_T_o(const _E_d_g_e_I_t_e_r_a_t_o_r& other) const; │ │ │ │ -544 │ │ │ │ -545 private: │ │ │ │ -547 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r source_; │ │ │ │ -552 _E_d_g_e_D_e_s_c_r_i_p_t_o_r edge_; │ │ │ │ -553 }; │ │ │ │ -554 │ │ │ │ -_5_5_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -559 : public ForwardIteratorFacade │ │ │ │ -560 { │ │ │ │ -561 public: │ │ │ │ -_5_6_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r(const _S_u_b_G_r_a_p_h_<_G_,_T_>* graph, const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& │ │ │ │ -current, │ │ │ │ -569 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _e_n_d); │ │ │ │ -570 │ │ │ │ -571 │ │ │ │ -_5_7_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& current); │ │ │ │ -579 │ │ │ │ -_5_8_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r& _i_n_c_r_e_m_e_n_t(); │ │ │ │ -582 │ │ │ │ -_5_8_4 bool _e_q_u_a_l_s(const _V_e_r_t_e_x_I_t_e_r_a_t_o_r& other) const; │ │ │ │ -585 │ │ │ │ -_5_9_0 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& _d_e_r_e_f_e_r_e_n_c_e() const; │ │ │ │ -591 │ │ │ │ -_5_9_7 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ -598 │ │ │ │ -_6_0_4 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ -605 │ │ │ │ -606 private: │ │ │ │ -608 const _S_u_b_G_r_a_p_h_<_G_r_a_p_h_,_T_>* graph_; │ │ │ │ -610 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r current_; │ │ │ │ -612 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r end_; │ │ │ │ -613 }; │ │ │ │ -614 │ │ │ │ -_6_1_8 typedef _E_d_g_e_I_t_e_r_a_t_o_r _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -619 │ │ │ │ -_6_2_3 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ +_4_0_1 typedef B _b_l_o_c_k___t_y_p_e; │ │ │ │ +402 │ │ │ │ +_4_0_4 typedef A _a_l_l_o_c_a_t_o_r___t_y_p_e; │ │ │ │ +405 │ │ │ │ +_4_0_7 typedef typename A::size_type _s_i_z_e___t_y_p_e; │ │ │ │ +408 │ │ │ │ +_4_1_0 typedef typename Imp::block_vector_unmanaged::Iterator │ │ │ │ +_I_t_e_r_a_t_o_r; │ │ │ │ +411 │ │ │ │ +_4_1_3 typedef typename Imp::block_vector_unmanaged::ConstIterator │ │ │ │ +_C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ +414 │ │ │ │ +415 //===== constructors and such │ │ │ │ +416 │ │ │ │ +_4_1_8 _B_l_o_c_k_V_e_c_t_o_r () │ │ │ │ +419 { │ │ │ │ +420 syncBaseArray(); │ │ │ │ +421 } │ │ │ │ +422 │ │ │ │ +_4_2_4 explicit _B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e _n) : storage_(_n) │ │ │ │ +425 { │ │ │ │ +426 syncBaseArray(); │ │ │ │ +427 } │ │ │ │ +428 │ │ │ │ +_4_3_0 _B_l_o_c_k_V_e_c_t_o_r (std::initializer_list const &l) : storage_(l) │ │ │ │ +431 { │ │ │ │ +432 syncBaseArray(); │ │ │ │ +433 } │ │ │ │ +434 │ │ │ │ +435 │ │ │ │ +447 template │ │ │ │ +_4_4_8 _B_l_o_c_k_V_e_c_t_o_r (_s_i_z_e___t_y_p_e _n, S _capacity) │ │ │ │ +449 { │ │ │ │ +450 static_assert(std::numeric_limits::is_integer, │ │ │ │ +451 "capacity must be an unsigned integral type (be aware, that this │ │ │ │ +constructor does not set the default value!)" ); │ │ │ │ +452 if((_s_i_z_e___t_y_p_e)_capacity > _n) │ │ │ │ +453 storage_.reserve(_capacity); │ │ │ │ +454 storage_.resize(_n); │ │ │ │ +455 syncBaseArray(); │ │ │ │ +456 } │ │ │ │ +457 │ │ │ │ +458 │ │ │ │ +_4_6_8 void _r_e_s_e_r_v_e(_s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y) │ │ │ │ +469 { │ │ │ │ +470 [[maybe_unused]] const auto &guard = │ │ │ │ +471 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ +472 storage_.reserve(_c_a_p_a_c_i_t_y); │ │ │ │ +473 } │ │ │ │ +474 │ │ │ │ +_4_8_1 _s_i_z_e___t_y_p_e _c_a_p_a_c_i_t_y() const │ │ │ │ +482 { │ │ │ │ +483 return storage_.capacity(); │ │ │ │ +484 } │ │ │ │ +485 │ │ │ │ +_4_9_6 void _r_e_s_i_z_e(_s_i_z_e___t_y_p_e size) │ │ │ │ +497 { │ │ │ │ +498 [[maybe_unused]] const auto &guard = │ │ │ │ +499 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ +500 storage_.resize(size); │ │ │ │ +501 } │ │ │ │ +502 │ │ │ │ +_5_0_4 _B_l_o_c_k_V_e_c_t_o_r(const _B_l_o_c_k_V_e_c_t_o_r &a) │ │ │ │ +505 noexcept(noexcept(std::declval().storage_ = a.storage_)) │ │ │ │ +506 { │ │ │ │ +507 storage_ = a.storage_; │ │ │ │ +508 syncBaseArray(); │ │ │ │ +509 } │ │ │ │ +510 │ │ │ │ +_5_1_2 _B_l_o_c_k_V_e_c_t_o_r(_B_l_o_c_k_V_e_c_t_o_r &&a) │ │ │ │ +513 noexcept(noexcept(std::declval().swap(a))) │ │ │ │ +514 { │ │ │ │ +515 _s_w_a_p(a); │ │ │ │ +516 } │ │ │ │ +517 │ │ │ │ +_5_1_9 _B_l_o_c_k_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=_ (const _B_l_o_c_k_V_e_c_t_o_r& a) │ │ │ │ +520 noexcept(noexcept(std::declval().storage_ = a.storage_)) │ │ │ │ +521 { │ │ │ │ +522 [[maybe_unused]] const auto &guard = │ │ │ │ +523 Imp::makeScopeGuard([this]{ syncBaseArray(); }); │ │ │ │ +524 storage_ = a.storage_; │ │ │ │ +525 return *this; │ │ │ │ +526 } │ │ │ │ +527 │ │ │ │ +_5_2_9 _B_l_o_c_k_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=_ (_B_l_o_c_k_V_e_c_t_o_r&& a) │ │ │ │ +530 noexcept(noexcept(std::declval().swap(a))) │ │ │ │ +531 { │ │ │ │ +532 _s_w_a_p(a); │ │ │ │ +533 return *this; │ │ │ │ +534 } │ │ │ │ +535 │ │ │ │ +_5_3_7 void _s_w_a_p(_B_l_o_c_k_V_e_c_t_o_r &other) │ │ │ │ +538 noexcept(noexcept( │ │ │ │ +539 std::declval().storage_.swap(other.storage_))) │ │ │ │ +540 { │ │ │ │ +541 [[maybe_unused]] const auto &guard = Imp::makeScopeGuard([&]{ │ │ │ │ +542 syncBaseArray(); │ │ │ │ +543 other.syncBaseArray(); │ │ │ │ +544 }); │ │ │ │ +545 storage_.swap(other.storage_); │ │ │ │ +546 } │ │ │ │ +547 │ │ │ │ +_5_4_9 _B_l_o_c_k_V_e_c_t_o_r& _o_p_e_r_a_t_o_r_=_ (const _f_i_e_l_d___t_y_p_e& k) │ │ │ │ +550 { │ │ │ │ +551 // forward to operator= in base class │ │ │ │ +552 (static_cast&>(*this)) = k; │ │ │ │ +553 return *this; │ │ │ │ +554 } │ │ │ │ +555 │ │ │ │ +556 private: │ │ │ │ +557 void syncBaseArray() noexcept │ │ │ │ +558 { │ │ │ │ +559 this->p = storage_.data(); │ │ │ │ +560 this->n = storage_.size(); │ │ │ │ +561 } │ │ │ │ +562 │ │ │ │ +563 std::vector storage_; │ │ │ │ +564 }; │ │ │ │ +565 │ │ │ │ +571 template │ │ │ │ +_5_7_2 struct FieldTraits< _B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ +573 { │ │ │ │ +_5_7_4 typedef typename FieldTraits::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ +_5_7_5 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +576 }; │ │ │ │ +582 template │ │ │ │ +_5_8_3 std::ostream& _o_p_e_r_a_t_o_r_<_<_ (std::ostream& s, const _B_l_o_c_k_V_e_c_t_o_r_<_K_,_ _A_>& v) │ │ │ │ +584 { │ │ │ │ +585 typedef typename _B_l_o_c_k_V_e_c_t_o_r_<_K_,_ _A_>_:_:_s_i_z_e___t_y_p_e size_type; │ │ │ │ +586 │ │ │ │ +587 for (size_type i=0; i │ │ │ │ +616#else │ │ │ │ +617 template > │ │ │ │ +618#endif │ │ │ │ +619 class BlockVectorWindow : public Imp::block_vector_unmanaged │ │ │ │ +620 { │ │ │ │ +621 public: │ │ │ │ +622 │ │ │ │ +623 //===== type definitions and constants │ │ │ │ 624 │ │ │ │ -_6_2_9 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +626 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ +627 │ │ │ │ +629 typedef B block_type; │ │ │ │ 630 │ │ │ │ -_6_3_5 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +632 typedef A allocator_type; │ │ │ │ +633 │ │ │ │ +635 typedef typename A::size_type size_type; │ │ │ │ 636 │ │ │ │ -_6_4_3 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ -644 │ │ │ │ -_6_5_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ -652 │ │ │ │ -_6_5_6 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ -657 │ │ │ │ -_6_6_4 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ -665 │ │ │ │ -_6_6_9 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ -_6_7_6 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ -677 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ -_6_8_5 _S_u_b_G_r_a_p_h(const _G_r_a_p_h& graph, const T& excluded); │ │ │ │ -686 │ │ │ │ -_6_9_0 _~_S_u_b_G_r_a_p_h(); │ │ │ │ +638 typedef typename Imp::block_vector_unmanaged::Iterator │ │ │ │ +Iterator; │ │ │ │ +639 │ │ │ │ +641 typedef typename Imp::block_vector_unmanaged::ConstIterator │ │ │ │ +ConstIterator; │ │ │ │ +642 │ │ │ │ +643 │ │ │ │ +644 //===== constructors and such │ │ │ │ +646 BlockVectorWindow () : Imp::block_vector_unmanaged() │ │ │ │ +647 { } │ │ │ │ +648 │ │ │ │ +650 BlockVectorWindow (B* _p, size_type _n) │ │ │ │ +651 { │ │ │ │ +652 this->n = _n; │ │ │ │ +653 this->p = _p; │ │ │ │ +654 } │ │ │ │ +655 │ │ │ │ +657 BlockVectorWindow (const BlockVectorWindow& a) │ │ │ │ +658 { │ │ │ │ +659 this->n = a.n; │ │ │ │ +660 this->p = a.p; │ │ │ │ +661 } │ │ │ │ +662 │ │ │ │ +664 BlockVectorWindow& operator= (const BlockVectorWindow& a) │ │ │ │ +665 { │ │ │ │ +666 // check correct size │ │ │ │ +667#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +668 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +669#endif │ │ │ │ +670 │ │ │ │ +671 if (&a!=this) // check if this and a are different objects │ │ │ │ +672 { │ │ │ │ +673 // copy data │ │ │ │ +674 for (size_type i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ +675 } │ │ │ │ +676 return *this; │ │ │ │ +677 } │ │ │ │ +678 │ │ │ │ +680 BlockVectorWindow& operator= (const field_type& k) │ │ │ │ +681 { │ │ │ │ +682 (static_cast&>(*this)) = k; │ │ │ │ +683 return *this; │ │ │ │ +684 } │ │ │ │ +685 │ │ │ │ +687 operator BlockVector() const { │ │ │ │ +688 auto bv = BlockVector(this->n); │ │ │ │ +689 │ │ │ │ +690 std::copy(this->begin(), this->end(), bv.begin()); │ │ │ │ 691 │ │ │ │ -692 private: │ │ │ │ -694 const T& excluded_; │ │ │ │ -696 std::size_t noVertices_; │ │ │ │ -698 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r endVertex_; │ │ │ │ -700 int noEdges_; │ │ │ │ -705 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r maxVertex_; │ │ │ │ -707 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* edges_; │ │ │ │ -709 std::ptrdiff_t* start_; │ │ │ │ -711 std::ptrdiff_t* end_; │ │ │ │ -713 _S_u_b_G_r_a_p_h(const _S_u_b_G_r_a_p_h&) │ │ │ │ -714 {} │ │ │ │ -715 }; │ │ │ │ -716 │ │ │ │ -717 │ │ │ │ -721 template │ │ │ │ -_7_2_2 class _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -723 { │ │ │ │ -724 public: │ │ │ │ -_7_2_8 typedef G _G_r_a_p_h; │ │ │ │ +692 return bv; │ │ │ │ +693 } │ │ │ │ +694 │ │ │ │ +695 //===== window manipulation methods │ │ │ │ +696 │ │ │ │ +698 void set (size_type _n, B* _p) │ │ │ │ +699 { │ │ │ │ +700 this->n = _n; │ │ │ │ +701 this->p = _p; │ │ │ │ +702 } │ │ │ │ +703 │ │ │ │ +705 void setsize (size_type _n) │ │ │ │ +706 { │ │ │ │ +707 this->n = _n; │ │ │ │ +708 } │ │ │ │ +709 │ │ │ │ +711 void setptr (B* _p) │ │ │ │ +712 { │ │ │ │ +713 this->p = _p; │ │ │ │ +714 } │ │ │ │ +715 │ │ │ │ +717 B* getptr () │ │ │ │ +718 { │ │ │ │ +719 return this->p; │ │ │ │ +720 } │ │ │ │ +721 │ │ │ │ +723 size_type getsize () const │ │ │ │ +724 { │ │ │ │ +725 return this->n; │ │ │ │ +726 } │ │ │ │ +727 }; │ │ │ │ +728 │ │ │ │ 729 │ │ │ │ -_7_3_3 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -734 │ │ │ │ -_7_3_8 typedef typename Graph::EdgeDescriptor _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -739 │ │ │ │ -_7_4_3 typedef VP _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ -744 │ │ │ │ -_7_5_6 typedef VM _V_e_r_t_e_x_M_a_p; │ │ │ │ -757 │ │ │ │ -_7_6_1 typedef typename Graph::EdgeIterator _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ +730 │ │ │ │ +741 template │ │ │ │ +742 class compressed_block_vector_unmanaged : public │ │ │ │ +compressed_base_array_unmanaged │ │ │ │ +743 { │ │ │ │ +744 public: │ │ │ │ +745 │ │ │ │ +746 //===== type definitions and constants │ │ │ │ +747 │ │ │ │ +749 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ +750 │ │ │ │ +752 typedef B block_type; │ │ │ │ +753 │ │ │ │ +755 typedef typename compressed_base_array_unmanaged::iterator Iterator; │ │ │ │ +756 │ │ │ │ +758 typedef typename compressed_base_array_unmanaged::const_iterator │ │ │ │ +ConstIterator; │ │ │ │ +759 │ │ │ │ +761 typedef ST size_type; │ │ │ │ 762 │ │ │ │ -_7_6_6 typedef typename Graph::ConstEdgeIterator _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -767 │ │ │ │ -_7_7_3 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ +763 //===== assignment from scalar │ │ │ │ +764 │ │ │ │ +765 compressed_block_vector_unmanaged& operator= (const field_type& k) │ │ │ │ +766 { │ │ │ │ +767 for (size_type i=0; in; i++) │ │ │ │ +768 (this->p)[i] = k; │ │ │ │ +769 return *this; │ │ │ │ +770 } │ │ │ │ +771 │ │ │ │ +772 │ │ │ │ +773 //===== vector space arithmetic │ │ │ │ 774 │ │ │ │ -_7_8_0 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source); │ │ │ │ -781 │ │ │ │ -_7_8_7 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ -788 │ │ │ │ -_7_9_4 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source) const; │ │ │ │ -795 │ │ │ │ +776 template │ │ │ │ +777 compressed_block_vector_unmanaged& operator+= (const V& y) │ │ │ │ +778 { │ │ │ │ +779#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +780 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ +781#endif │ │ │ │ +782 for (size_type i=0; ioperator[](y.j[i]) += y.p[i]; │ │ │ │ +783 return *this; │ │ │ │ +784 } │ │ │ │ +785 │ │ │ │ +787 template │ │ │ │ +788 compressed_block_vector_unmanaged& operator-= (const V& y) │ │ │ │ +789 { │ │ │ │ +790#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +791 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ +792#endif │ │ │ │ +793 for (size_type i=0; ioperator[](y.j[i]) -= y.p[i]; │ │ │ │ +794 return *this; │ │ │ │ +795 } │ │ │ │ 796 │ │ │ │ -797 template │ │ │ │ -_7_9_8 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -799 : public std::conditional::type, │ │ │ │ -800 C>::value, │ │ │ │ -801 typename Graph::VertexIterator, │ │ │ │ -802 typename Graph::ConstVertexIterator>::type │ │ │ │ -803 { │ │ │ │ -804 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ -805 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ -806 public: │ │ │ │ -810 typedef typename std::conditional::type, │ │ │ │ -811 C>::value, │ │ │ │ -812 typename Graph::VertexIterator, │ │ │ │ -813 typename Graph::ConstVertexIterator>::type │ │ │ │ -_8_1_4 _F_a_t_h_e_r; │ │ │ │ +798 template │ │ │ │ +799 compressed_block_vector_unmanaged& axpy (const field_type& a, const V& y) │ │ │ │ +800 { │ │ │ │ +801#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +802 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ +803#endif │ │ │ │ +804 for (size_type i=0; in; ++i) (this->p)[i] *= k; │ │ │ │ +813 return *this; │ │ │ │ +814 } │ │ │ │ 815 │ │ │ │ -819 typedef typename std::conditional::type, │ │ │ │ -820 C>::value, │ │ │ │ -821 typename Graph::EdgeIterator, │ │ │ │ -822 typename Graph::ConstEdgeIterator>::type │ │ │ │ -_8_2_3 _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -824 │ │ │ │ -_8_3_0 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ -831 C* graph); │ │ │ │ -832 │ │ │ │ -833 │ │ │ │ -_8_4_1 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ -842 │ │ │ │ -847 template │ │ │ │ -_8_4_8 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const VertexIteratorT& other); │ │ │ │ +817 compressed_block_vector_unmanaged& operator/= (const field_type& k) │ │ │ │ +818 { │ │ │ │ +819 for (size_type i=0; in; ++i) (this->p)[i] /= k; │ │ │ │ +820 return *this; │ │ │ │ +821 } │ │ │ │ +822 │ │ │ │ +823 │ │ │ │ +824 //===== Euclidean scalar product │ │ │ │ +825 │ │ │ │ +827 field_type operator* (const compressed_block_vector_unmanaged& y) const │ │ │ │ +828 { │ │ │ │ +829#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +830 if (!includesindexset(y) || !y.includesindexset(*this) ) │ │ │ │ +831 DUNE_THROW(ISTLError,"index set mismatch"); │ │ │ │ +832#endif │ │ │ │ +833 field_type sum=0; │ │ │ │ +834 for (size_type i=0; in; ++i) │ │ │ │ +835 sum += (this->p)[i] * y[(this->j)[i]]; │ │ │ │ +836 return sum; │ │ │ │ +837 } │ │ │ │ +838 │ │ │ │ +839 │ │ │ │ +840 //===== norms │ │ │ │ +841 │ │ │ │ +843 typename FieldTraits::real_type one_norm () const │ │ │ │ +844 { │ │ │ │ +845 typename FieldTraits::real_type sum=0; │ │ │ │ +846 for (size_type i=0; in; ++i) sum += (this->p)[i].one_norm(); │ │ │ │ +847 return sum; │ │ │ │ +848 } │ │ │ │ 849 │ │ │ │ -853 typename std::conditional:: │ │ │ │ -type>::value, │ │ │ │ -854 VertexProperties&, │ │ │ │ -855 const VertexProperties&>::type │ │ │ │ -_8_5_6 _p_r_o_p_e_r_t_i_e_s() const; │ │ │ │ +851 typename FieldTraits::real_type one_norm_real () const │ │ │ │ +852 { │ │ │ │ +853 typename FieldTraits::real_type sum=0; │ │ │ │ +854 for (size_type i=0; in; ++i) sum += (this->p)[i].one_norm_real(); │ │ │ │ +855 return sum; │ │ │ │ +856 } │ │ │ │ 857 │ │ │ │ -_8_6_3 _E_d_g_e_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ -864 │ │ │ │ -_8_7_0 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ -871 │ │ │ │ -872 private: │ │ │ │ -876 C* graph_; │ │ │ │ -877 }; │ │ │ │ -878 │ │ │ │ -882 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ -884 │ │ │ │ -888 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ -890 │ │ │ │ -_8_9_5 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n(); │ │ │ │ +859 typename FieldTraits::real_type two_norm () const │ │ │ │ +860 { │ │ │ │ +861 using std::sqrt; │ │ │ │ +862 typename FieldTraits::real_type sum=0; │ │ │ │ +863 for (size_type i=0; in; ++i) sum += (this->p)[i].two_norm2(); │ │ │ │ +864 return sqrt(sum); │ │ │ │ +865 } │ │ │ │ +866 │ │ │ │ +868 typename FieldTraits::real_type two_norm2 () const │ │ │ │ +869 { │ │ │ │ +870 typename FieldTraits::real_type sum=0; │ │ │ │ +871 for (size_type i=0; in; ++i) sum += (this->p)[i].two_norm2(); │ │ │ │ +872 return sum; │ │ │ │ +873 } │ │ │ │ +874 │ │ │ │ +876 template ::value, int>::type = 0> │ │ │ │ +878 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ +879 using real_type = typename FieldTraits::real_type; │ │ │ │ +880 using std::max; │ │ │ │ +881 │ │ │ │ +882 real_type norm = 0; │ │ │ │ +883 for (auto const &x : *this) { │ │ │ │ +884 real_type const a = x.infinity_norm(); │ │ │ │ +885 norm = max(a, norm); │ │ │ │ +886 } │ │ │ │ +887 return norm; │ │ │ │ +888 } │ │ │ │ +889 │ │ │ │ +891 template ::value, int>::type = 0> │ │ │ │ +893 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ +894 using real_type = typename FieldTraits::real_type; │ │ │ │ +895 using std::max; │ │ │ │ 896 │ │ │ │ -_9_0_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ -902 │ │ │ │ -_9_0_7 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ -908 │ │ │ │ -_9_1_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ -914 │ │ │ │ -_9_2_0 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s(const VertexDescriptor& vertex); │ │ │ │ +897 real_type norm = 0; │ │ │ │ +898 for (auto const &x : *this) { │ │ │ │ +899 real_type const a = x.infinity_norm_real(); │ │ │ │ +900 norm = max(a, norm); │ │ │ │ +901 } │ │ │ │ +902 return norm; │ │ │ │ +903 } │ │ │ │ +904 │ │ │ │ +906 template ::value, int>::type = 0> │ │ │ │ +908 typename FieldTraits::real_type infinity_norm() const { │ │ │ │ +909 using real_type = typename FieldTraits::real_type; │ │ │ │ +910 using std::max; │ │ │ │ +911 │ │ │ │ +912 real_type norm = 0; │ │ │ │ +913 real_type isNaN = 1; │ │ │ │ +914 for (auto const &x : *this) { │ │ │ │ +915 real_type const a = x.infinity_norm(); │ │ │ │ +916 norm = max(a, norm); │ │ │ │ +917 isNaN += a; │ │ │ │ +918 } │ │ │ │ +919 return norm * (isNaN / isNaN); │ │ │ │ +920 } │ │ │ │ 921 │ │ │ │ -_9_2_7 const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s(const VertexDescriptor& vertex) │ │ │ │ -const; │ │ │ │ +923 template ::value, int>::type = 0> │ │ │ │ +925 typename FieldTraits::real_type infinity_norm_real() const { │ │ │ │ +926 using real_type = typename FieldTraits::real_type; │ │ │ │ +927 using std::max; │ │ │ │ 928 │ │ │ │ -_9_3_3 const _G_r_a_p_h& _g_r_a_p_h() const; │ │ │ │ -934 │ │ │ │ -_9_3_8 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ -939 │ │ │ │ -_9_4_3 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ -944 │ │ │ │ -_9_5_1 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ -952 │ │ │ │ -_9_5_8 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(Graph& graph, const VertexMap vmap=VertexMap()); │ │ │ │ -959 │ │ │ │ -960 private: │ │ │ │ -961 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(const VertexPropertiesGraph&) │ │ │ │ -962 {} │ │ │ │ -963 │ │ │ │ -965 _G_r_a_p_h& graph_; │ │ │ │ -967 _V_e_r_t_e_x_M_a_p vmap_; │ │ │ │ -_9_6_9 std::vector vertexProperties_; │ │ │ │ -970 │ │ │ │ +929 real_type norm = 0; │ │ │ │ +930 real_type isNaN = 1; │ │ │ │ +931 for (auto const &x : *this) { │ │ │ │ +932 real_type const a = x.infinity_norm_real(); │ │ │ │ +933 norm = max(a, norm); │ │ │ │ +934 isNaN += a; │ │ │ │ +935 } │ │ │ │ +936 return norm * (isNaN / isNaN); │ │ │ │ +937 } │ │ │ │ +938 │ │ │ │ +939 //===== sizes │ │ │ │ +940 │ │ │ │ +942 size_type N () const │ │ │ │ +943 { │ │ │ │ +944 return this->n; │ │ │ │ +945 } │ │ │ │ +946 │ │ │ │ +948 size_type dim () const │ │ │ │ +949 { │ │ │ │ +950 size_type d=0; │ │ │ │ +951 for (size_type i=0; in; i++) │ │ │ │ +952 d += (this->p)[i].dim(); │ │ │ │ +953 return d; │ │ │ │ +954 } │ │ │ │ +955 │ │ │ │ +956 protected: │ │ │ │ +958 compressed_block_vector_unmanaged () : │ │ │ │ +compressed_base_array_unmanaged() │ │ │ │ +959 { } │ │ │ │ +960 │ │ │ │ +962 template │ │ │ │ +963 bool includesindexset (const V& y) │ │ │ │ +964 { │ │ │ │ +965 typename V::ConstIterator e=this->end(); │ │ │ │ +966 for (size_type i=0; ifind(y.j[i])==e) │ │ │ │ +968 return false; │ │ │ │ +969 return true; │ │ │ │ +970 } │ │ │ │ 971 }; │ │ │ │ 972 │ │ │ │ -976 template │ │ │ │ -_9_7_7 class _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -978 { │ │ │ │ -979 public: │ │ │ │ -_9_8_3 typedef G _G_r_a_p_h; │ │ │ │ -984 │ │ │ │ -_9_8_8 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -989 │ │ │ │ -_9_9_3 typedef typename Graph::EdgeDescriptor _E_d_g_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ -994 │ │ │ │ -_9_9_8 typedef VP _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ -999 │ │ │ │ -_1_0_1_1 typedef VM _V_e_r_t_e_x_M_a_p; │ │ │ │ -1012 │ │ │ │ -_1_0_1_6 typedef EP _E_d_g_e_P_r_o_p_e_r_t_i_e_s; │ │ │ │ -1017 │ │ │ │ -1018 │ │ │ │ -_1_0_3_0 typedef EM _E_d_g_e_M_a_p; │ │ │ │ -1031 │ │ │ │ -1032 template │ │ │ │ -_1_0_3_3 class _E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -1034 : public std::conditional:: │ │ │ │ -type, │ │ │ │ -1035 C>::value, │ │ │ │ -1036 typename Graph::EdgeIterator, │ │ │ │ -1037 typename Graph::ConstEdgeIterator>::type │ │ │ │ +973 │ │ │ │ +992 template │ │ │ │ +993 class CompressedBlockVectorWindow : public │ │ │ │ +compressed_block_vector_unmanaged │ │ │ │ +994 { │ │ │ │ +995 public: │ │ │ │ +996 │ │ │ │ +997 //===== type definitions and constants │ │ │ │ +998 │ │ │ │ +1000 using field_type = typename Imp::BlockTraits::field_type; │ │ │ │ +1001 │ │ │ │ +1003 typedef B block_type; │ │ │ │ +1004 │ │ │ │ +1006 typedef ST size_type; │ │ │ │ +1007 │ │ │ │ +1009 typedef typename compressed_block_vector_unmanaged::Iterator │ │ │ │ +Iterator; │ │ │ │ +1010 │ │ │ │ +1012 typedef typename compressed_block_vector_unmanaged::ConstIterator │ │ │ │ +ConstIterator; │ │ │ │ +1013 │ │ │ │ +1014 │ │ │ │ +1015 //===== constructors and such │ │ │ │ +1017 CompressedBlockVectorWindow () : compressed_block_vector_unmanaged() │ │ │ │ +1018 { } │ │ │ │ +1019 │ │ │ │ +1021 CompressedBlockVectorWindow (B* _p, size_type* _j, size_type _n) │ │ │ │ +1022 { │ │ │ │ +1023 this->n = _n; │ │ │ │ +1024 this->p = _p; │ │ │ │ +1025 this->j = _j; │ │ │ │ +1026 } │ │ │ │ +1027 │ │ │ │ +1029 CompressedBlockVectorWindow (const CompressedBlockVectorWindow& a) │ │ │ │ +1030 { │ │ │ │ +1031 this->n = a.n; │ │ │ │ +1032 this->p = a.p; │ │ │ │ +1033 this->j = a.j; │ │ │ │ +1034 } │ │ │ │ +1035 │ │ │ │ +1037 CompressedBlockVectorWindow& operator= (const CompressedBlockVectorWindow& │ │ │ │ +a) │ │ │ │ 1038 { │ │ │ │ -1039 │ │ │ │ -1040 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ -1041 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ -1042 public: │ │ │ │ -1046 typedef typename std::conditional::type, │ │ │ │ -1047 C>::value, │ │ │ │ -1048 typename Graph::EdgeIterator, │ │ │ │ -1049 typename Graph::ConstEdgeIterator>::type │ │ │ │ -_1_0_5_0 _F_a_t_h_e_r; │ │ │ │ -1051 │ │ │ │ -_1_0_5_7 explicit _E_d_g_e_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ -1058 C* graph); │ │ │ │ +1039 // check correct size │ │ │ │ +1040#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +1041 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch"); │ │ │ │ +1042#endif │ │ │ │ +1043 │ │ │ │ +1044 if (&a!=this) // check if this and a are different objects │ │ │ │ +1045 { │ │ │ │ +1046 // copy data │ │ │ │ +1047 for (size_type i=0; in; i++) this->p[i]=a.p[i]; │ │ │ │ +1048 for (size_type i=0; in; i++) this->j[i]=a.j[i]; │ │ │ │ +1049 } │ │ │ │ +1050 return *this; │ │ │ │ +1051 } │ │ │ │ +1052 │ │ │ │ +1054 CompressedBlockVectorWindow& operator= (const field_type& k) │ │ │ │ +1055 { │ │ │ │ +1056 (static_cast&>(*this)) = k; │ │ │ │ +1057 return *this; │ │ │ │ +1058 } │ │ │ │ 1059 │ │ │ │ -_1_0_6_7 explicit _E_d_g_e_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ -1068 │ │ │ │ -1073 template │ │ │ │ -_1_0_7_4 _E_d_g_e_I_t_e_r_a_t_o_r_T(const EdgeIteratorT& other); │ │ │ │ -1075 │ │ │ │ -1079 typename std::conditional:: │ │ │ │ -type>::value, │ │ │ │ -1080 EdgeProperties&, │ │ │ │ -1081 const EdgeProperties&>::type │ │ │ │ -_1_0_8_2 properties() const; │ │ │ │ -1083 │ │ │ │ -1084 private: │ │ │ │ -_1_0_8_8 C* graph_; │ │ │ │ -1089 }; │ │ │ │ -1090 │ │ │ │ -1094 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T > _E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -1097 │ │ │ │ -1101 typedef _E_d_g_e_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -1104 │ │ │ │ -_1_1_1_0 _E_d_g_e_I_t_e_r_a_t_o_r beginEdges(const VertexDescriptor& source); │ │ │ │ -1111 │ │ │ │ -_1_1_1_7 _E_d_g_e_I_t_e_r_a_t_o_r endEdges(const VertexDescriptor& source); │ │ │ │ +1060 │ │ │ │ +1061 //===== window manipulation methods │ │ │ │ +1062 │ │ │ │ +1064 void set (size_type _n, B* _p, size_type* _j) │ │ │ │ +1065 { │ │ │ │ +1066 this->n = _n; │ │ │ │ +1067 this->p = _p; │ │ │ │ +1068 this->j = _j; │ │ │ │ +1069 } │ │ │ │ +1070 │ │ │ │ +1072 void setsize (size_type _n) │ │ │ │ +1073 { │ │ │ │ +1074 this->n = _n; │ │ │ │ +1075 } │ │ │ │ +1076 │ │ │ │ +1078 void setptr (B* _p) │ │ │ │ +1079 { │ │ │ │ +1080 this->p = _p; │ │ │ │ +1081 } │ │ │ │ +1082 │ │ │ │ +1084 void setindexptr (size_type* _j) │ │ │ │ +1085 { │ │ │ │ +1086 this->j = _j; │ │ │ │ +1087 } │ │ │ │ +1088 │ │ │ │ +1090 B* getptr () │ │ │ │ +1091 { │ │ │ │ +1092 return this->p; │ │ │ │ +1093 } │ │ │ │ +1094 │ │ │ │ +1096 size_type* getindexptr () │ │ │ │ +1097 { │ │ │ │ +1098 return this->j; │ │ │ │ +1099 } │ │ │ │ +1100 │ │ │ │ +1102 const B* getptr () const │ │ │ │ +1103 { │ │ │ │ +1104 return this->p; │ │ │ │ +1105 } │ │ │ │ +1106 │ │ │ │ +1108 const size_type* getindexptr () const │ │ │ │ +1109 { │ │ │ │ +1110 return this->j; │ │ │ │ +1111 } │ │ │ │ +1113 size_type getsize () const │ │ │ │ +1114 { │ │ │ │ +1115 return this->n; │ │ │ │ +1116 } │ │ │ │ +1117 }; │ │ │ │ 1118 │ │ │ │ -_1_1_2_4 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r beginEdges(const VertexDescriptor& source) const; │ │ │ │ -1125 │ │ │ │ -_1_1_3_1 _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r endEdges(const VertexDescriptor& source) const; │ │ │ │ -1132 │ │ │ │ -1133 │ │ │ │ -1134 template │ │ │ │ -_1_1_3_5 class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -1136 : public std::conditional:: │ │ │ │ -type, │ │ │ │ -1137 C>::value, │ │ │ │ -1138 typename Graph::VertexIterator, │ │ │ │ -1139 typename Graph::ConstVertexIterator>::type │ │ │ │ -1140 { │ │ │ │ -1141 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ -1142 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T::type>; │ │ │ │ -1143 public: │ │ │ │ -1147 typedef typename std::conditional::type, │ │ │ │ -1148 C>::value, │ │ │ │ -1149 typename Graph::VertexIterator, │ │ │ │ -1150 typename Graph::ConstVertexIterator>::type │ │ │ │ -_1_1_5_1 _F_a_t_h_e_r; │ │ │ │ -1152 │ │ │ │ -_1_1_5_8 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter, │ │ │ │ -1159 C* graph); │ │ │ │ -1160 │ │ │ │ -1161 │ │ │ │ -_1_1_6_9 explicit _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const Father& iter); │ │ │ │ -1170 │ │ │ │ -1175 template │ │ │ │ -_1_1_7_6 _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T(const VertexIteratorT& other); │ │ │ │ -1177 │ │ │ │ -1181 typename std::conditional:: │ │ │ │ -type>::value, │ │ │ │ -1182 VertexProperties&, │ │ │ │ -1183 const VertexProperties&>::type │ │ │ │ -_1_1_8_4 properties() const; │ │ │ │ -1185 │ │ │ │ -_1_1_9_1 _E_d_g_e_I_t_e_r_a_t_o_r_T begin() const; │ │ │ │ -1192 │ │ │ │ -_1_1_9_8 _E_d_g_e_I_t_e_r_a_t_o_r_T end() const; │ │ │ │ -1199 │ │ │ │ -1200 private: │ │ │ │ -1204 C* graph_; │ │ │ │ -1205 }; │ │ │ │ -1206 │ │ │ │ -1210 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ -1213 │ │ │ │ -1217 typedef _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T > _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r; │ │ │ │ -1220 │ │ │ │ -_1_2_2_5 _V_e_r_t_e_x_I_t_e_r_a_t_o_r begin(); │ │ │ │ -1226 │ │ │ │ -_1_2_3_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r end(); │ │ │ │ -1232 │ │ │ │ -_1_2_3_7 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r begin() const; │ │ │ │ -1238 │ │ │ │ -_1_2_4_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r end() const; │ │ │ │ -1244 │ │ │ │ -_1_2_5_0 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& getVertexProperties(const VertexDescriptor& vertex); │ │ │ │ -1251 │ │ │ │ -_1_2_5_7 const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& getVertexProperties(const VertexDescriptor& │ │ │ │ -vertex) const; │ │ │ │ -1258 │ │ │ │ -_1_2_6_5 _E_d_g_e_D_e_s_c_r_i_p_t_o_r findEdge(const VertexDescriptor& source, │ │ │ │ -1266 const VertexDescriptor& target) │ │ │ │ -1267 { │ │ │ │ -1268 return graph_.findEdge(source,target); │ │ │ │ -1269 } │ │ │ │ -1270 │ │ │ │ -_1_2_7_6 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge); │ │ │ │ -1277 │ │ │ │ -1278 │ │ │ │ -_1_2_8_4 const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _E_d_g_e_D_e_s_c_r_i_p_t_o_r& edge) const; │ │ │ │ -1285 │ │ │ │ -_1_2_9_2 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ -1293 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target); │ │ │ │ -1294 │ │ │ │ -_1_3_0_1 const _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s(const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& source, │ │ │ │ -1302 const _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r& target) const; │ │ │ │ -1303 │ │ │ │ -_1_3_0_8 const _G_r_a_p_h& _g_r_a_p_h() const; │ │ │ │ -1309 │ │ │ │ -_1_3_1_3 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ -1314 │ │ │ │ -_1_3_1_8 std::size_t _n_o_E_d_g_e_s() const; │ │ │ │ -1319 │ │ │ │ -_1_3_2_6 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r _m_a_x_V_e_r_t_e_x() const; │ │ │ │ -1327 │ │ │ │ -_1_3_3_4 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(_G_r_a_p_h& graph, const _V_e_r_t_e_x_M_a_p& vmap=_V_e_r_t_e_x_M_a_p(), │ │ │ │ -1335 const _E_d_g_e_M_a_p& emap=_E_d_g_e_M_a_p()); │ │ │ │ -1336 │ │ │ │ -1337 private: │ │ │ │ -1338 _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h(const _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h&) │ │ │ │ -1339 {} │ │ │ │ -1340 │ │ │ │ -1342 Graph& graph_; │ │ │ │ -1345 VertexMap vmap_; │ │ │ │ -1346 std::vector vertexProperties_; │ │ │ │ -1348 EdgeMap emap_; │ │ │ │ -_1_3_5_0 std::vector edgeProperties_; │ │ │ │ -1351 │ │ │ │ -1352 }; │ │ │ │ -1353 │ │ │ │ -1354 │ │ │ │ -1359 template │ │ │ │ -_1_3_6_0 class _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -1361 { │ │ │ │ -1362 public: │ │ │ │ -_1_3_6_6 typedef G _G_r_a_p_h; │ │ │ │ -_1_3_7_0 typedef typename G::VertexProperties _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s; │ │ │ │ -_1_3_7_4 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ -1375 │ │ │ │ -_1_3_8_0 _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r(G& g) │ │ │ │ -1381 : graph_(g) │ │ │ │ -1382 {} │ │ │ │ -_1_3_8_6 _G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r() │ │ │ │ -1387 : graph_(0) │ │ │ │ -1388 {} │ │ │ │ -1389 │ │ │ │ -1390 │ │ │ │ -_1_3_9_5 _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s& _o_p_e_r_a_t_o_r_[_](const _V_e_r_t_e_x& vertex) const │ │ │ │ -1396 { │ │ │ │ -1397 return graph_->getVertexProperties(vertex); │ │ │ │ -1398 } │ │ │ │ -1399 private: │ │ │ │ -1400 Graph* graph_; │ │ │ │ -1401 }; │ │ │ │ -1402 │ │ │ │ -1407 template │ │ │ │ -_1_4_0_8 class _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -1409 { │ │ │ │ -1410 public: │ │ │ │ -_1_4_1_4 typedef G _G_r_a_p_h; │ │ │ │ -_1_4_1_8 typedef typename G::EdgeProperties _E_d_g_e_P_r_o_p_e_r_t_i_e_s; │ │ │ │ -_1_4_2_2 typedef typename G::EdgeDescriptor _E_d_g_e; │ │ │ │ -1423 │ │ │ │ -_1_4_2_8 _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r(G& g) │ │ │ │ -1429 : graph_(g) │ │ │ │ -1430 {} │ │ │ │ -_1_4_3_4 _G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r() │ │ │ │ -1435 : graph_(0) │ │ │ │ -1436 {} │ │ │ │ -1437 │ │ │ │ -_1_4_4_2 _E_d_g_e_P_r_o_p_e_r_t_i_e_s& _o_p_e_r_a_t_o_r_[_](const _E_d_g_e& edge) const │ │ │ │ -1443 { │ │ │ │ -1444 return graph_->getEdgeProperties(edge); │ │ │ │ -1445 } │ │ │ │ -1446 private: │ │ │ │ -1447 Graph* graph_; │ │ │ │ -1448 }; │ │ │ │ -1449 │ │ │ │ -1450 │ │ │ │ -1461 template │ │ │ │ -_1_4_6_2 int _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(const G& graph, const typename G::VertexDescriptor& │ │ │ │ -vertex, │ │ │ │ -1463 V& visitor); │ │ │ │ -1464 │ │ │ │ -1465#ifndef DOXYGEN │ │ │ │ -1466 │ │ │ │ -1467 template │ │ │ │ -1468 _M_a_t_r_i_x_G_r_a_p_h_<_M_>_:_:_M_a_t_r_i_x_G_r_a_p_h(M& matrix) │ │ │ │ -1469 : matrix_(matrix) │ │ │ │ -1470 { │ │ │ │ -1471 if(matrix_.N()!=matrix_.M()) │ │ │ │ -1472 DUNE_THROW(_I_S_T_L_E_r_r_o_r, "Matrix has to have as many columns as rows!"); │ │ │ │ -1473 │ │ │ │ -1474 start_ = new EdgeDescriptor[matrix_.N()+1]; │ │ │ │ -1475 │ │ │ │ -1476 typedef typename M::ConstIterator Iterator; │ │ │ │ -1477 start_[matrix_.begin().index()] = 0; │ │ │ │ -1478 │ │ │ │ -1479 for(Iterator row=matrix_.begin(); row != matrix_.end(); ++row) │ │ │ │ -1480 start_[row.index()+1] = start_[row.index()] + row->size(); │ │ │ │ -1481 } │ │ │ │ -1482 │ │ │ │ -1483 template │ │ │ │ -1484 MatrixGraph::~MatrixGraph() │ │ │ │ -1485 { │ │ │ │ -1486 delete[] start_; │ │ │ │ -1487 } │ │ │ │ -1488 │ │ │ │ -1489 template │ │ │ │ -1490 inline std::size_t MatrixGraph::noEdges() const │ │ │ │ -1491 { │ │ │ │ -1492 return start_[matrix_.N()]; │ │ │ │ -1493 } │ │ │ │ -1494 │ │ │ │ -1495 template │ │ │ │ -1496 inline std::size_t MatrixGraph::noVertices() const │ │ │ │ -1497 { │ │ │ │ -1498 return matrix_.N(); │ │ │ │ -1499 } │ │ │ │ -1500 │ │ │ │ -1501 template │ │ │ │ -1502 inline typename MatrixGraph::VertexDescriptor MatrixGraph::maxVertex │ │ │ │ -() const │ │ │ │ -1503 { │ │ │ │ -1504 return matrix_.N()-1; │ │ │ │ -1505 } │ │ │ │ -1506 │ │ │ │ -1507 template │ │ │ │ -1508 typename MatrixGraph::EdgeDescriptor │ │ │ │ -1509 MatrixGraph::findEdge(const VertexDescriptor& source, │ │ │ │ -1510 const VertexDescriptor& target) const │ │ │ │ -1511 { │ │ │ │ -1512 typename M::ConstColIterator found =matrix_[source].find(target); │ │ │ │ -1513 if(found == matrix_[source].end()) │ │ │ │ -1514 return std::numeric_limits::max(); │ │ │ │ -1515 std::size_t offset = found.offset(); │ │ │ │ -1516 if(target>source) │ │ │ │ -1517 offset--; │ │ │ │ -1518 │ │ │ │ -1519 assert(offset │ │ │ │ -1526 inline M& MatrixGraph::matrix() │ │ │ │ -1527 { │ │ │ │ -1528 return matrix_; │ │ │ │ -1529 } │ │ │ │ -1530 │ │ │ │ -1531 template │ │ │ │ -1532 inline const M& MatrixGraph::matrix() const │ │ │ │ -1533 { │ │ │ │ -1534 return matrix_; │ │ │ │ -1535 } │ │ │ │ -1536 │ │ │ │ -1537 template │ │ │ │ -1538 template │ │ │ │ -1539 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const VertexDescriptor& │ │ │ │ -source, const ColIterator& block, │ │ │ │ -1540 const ColIterator& end, const EdgeDescriptor& edge) │ │ │ │ -1541 : source_(source), block_(block), blockEnd_(end), edge_(edge) │ │ │ │ -1542 { │ │ │ │ -1543 if(block_!=blockEnd_ && block_.index() == source_) { │ │ │ │ -1544 // This is the edge from the diagonal to the diagonal. Skip it. │ │ │ │ -1545 ++block_; │ │ │ │ -1546 } │ │ │ │ -1547 } │ │ │ │ -1548 │ │ │ │ -1549 template │ │ │ │ -1550 template │ │ │ │ -1551 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const ColIterator& block) │ │ │ │ -1552 : block_(block) │ │ │ │ -1553 {} │ │ │ │ -1554 │ │ │ │ -1555 template │ │ │ │ -1556 template │ │ │ │ -1557 template │ │ │ │ -1558 MatrixGraph::EdgeIteratorT::EdgeIteratorT(const EdgeIteratorT& │ │ │ │ -other) │ │ │ │ -1559 : source_(other.source_), block_(other.block_), blockEnd_ │ │ │ │ -(other.blockEnd_), edge_(other.edge_) │ │ │ │ -1560 {} │ │ │ │ -1561 │ │ │ │ -1562 │ │ │ │ -1563 template │ │ │ │ -1564 template │ │ │ │ -1565 inline typename MatrixGraph::template EdgeIteratorT::WeightType& │ │ │ │ -1566 MatrixGraph::EdgeIteratorT::weight() const │ │ │ │ -1567 { │ │ │ │ -1568 return *block_; │ │ │ │ -1569 } │ │ │ │ -1570 │ │ │ │ -1571 template │ │ │ │ -1572 template │ │ │ │ -1573 inline typename MatrixGraph::template EdgeIteratorT& │ │ │ │ -MatrixGraph::EdgeIteratorT::operator++() │ │ │ │ -1574 { │ │ │ │ -1575 ++block_; │ │ │ │ -1576 ++edge_; │ │ │ │ -1577 │ │ │ │ -1578 if(block_!=blockEnd_ && block_.index() == source_) { │ │ │ │ -1579 // This is the edge from the diagonal to the diagonal. Skip it. │ │ │ │ -1580 ++block_; │ │ │ │ -1581 } │ │ │ │ -1582 │ │ │ │ -1583 return *this; │ │ │ │ -1584 } │ │ │ │ -1585 │ │ │ │ -1586 template │ │ │ │ -1587 template │ │ │ │ -1588 inline bool MatrixGraph::EdgeIteratorT::operator!=(const typename │ │ │ │ -MatrixGraph::template EdgeIteratorT::type>& │ │ │ │ -other) const │ │ │ │ -1589 { │ │ │ │ -1590 return block_!=other.block_; │ │ │ │ -1591 } │ │ │ │ -1592 │ │ │ │ -1593 template │ │ │ │ -1594 template │ │ │ │ -1595 inline bool MatrixGraph::EdgeIteratorT::operator!=(const typename │ │ │ │ -MatrixGraph::template EdgeIteratorT:: │ │ │ │ -type>& other) const │ │ │ │ -1596 { │ │ │ │ -1597 return block_!=other.block_; │ │ │ │ -1598 } │ │ │ │ -1599 │ │ │ │ -1600 template │ │ │ │ -1601 template │ │ │ │ -1602 inline bool MatrixGraph::EdgeIteratorT::operator==(const typename │ │ │ │ -MatrixGraph::template EdgeIteratorT::type>& │ │ │ │ -other) const │ │ │ │ -1603 { │ │ │ │ -1604 return block_==other.block_; │ │ │ │ -1605 } │ │ │ │ -1606 │ │ │ │ -1607 template │ │ │ │ -1608 template │ │ │ │ -1609 inline bool MatrixGraph::EdgeIteratorT::operator==(const typename │ │ │ │ -MatrixGraph::template EdgeIteratorT:: │ │ │ │ -type>& other) const │ │ │ │ -1610 { │ │ │ │ -1611 return block_==other.block_; │ │ │ │ -1612 } │ │ │ │ -1613 │ │ │ │ -1614 template │ │ │ │ -1615 template │ │ │ │ -1616 inline typename MatrixGraph::VertexDescriptor MatrixGraph:: │ │ │ │ -EdgeIteratorT::target() const │ │ │ │ -1617 { │ │ │ │ -1618 return block_.index(); │ │ │ │ -1619 } │ │ │ │ -1620 │ │ │ │ -1621 template │ │ │ │ -1622 template │ │ │ │ -1623 inline typename MatrixGraph::VertexDescriptor MatrixGraph:: │ │ │ │ -EdgeIteratorT::source() const │ │ │ │ -1624 { │ │ │ │ -1625 return source_; │ │ │ │ -1626 } │ │ │ │ -1627 │ │ │ │ -1628 template │ │ │ │ -1629 template │ │ │ │ -1630 inline const typename MatrixGraph::EdgeDescriptor& MatrixGraph:: │ │ │ │ -EdgeIteratorT::operator*() const │ │ │ │ -1631 { │ │ │ │ -1632 return edge_; │ │ │ │ -1633 } │ │ │ │ -1634 │ │ │ │ -1635 template │ │ │ │ -1636 template │ │ │ │ -1637 inline const typename MatrixGraph::EdgeDescriptor* MatrixGraph:: │ │ │ │ -EdgeIteratorT::operator->() const │ │ │ │ -1638 { │ │ │ │ -1639 return &edge_; │ │ │ │ -1640 } │ │ │ │ -1641 │ │ │ │ -1642 template │ │ │ │ -1643 template │ │ │ │ -1644 MatrixGraph::VertexIteratorT::VertexIteratorT(C* graph, │ │ │ │ -1645 const VertexDescriptor& current) │ │ │ │ -1646 : graph_(graph), current_(current) │ │ │ │ -1647 {} │ │ │ │ -1648 │ │ │ │ -1649 │ │ │ │ -1650 template │ │ │ │ -1651 template │ │ │ │ -1652 MatrixGraph::VertexIteratorT::VertexIteratorT(const │ │ │ │ -VertexDescriptor& current) │ │ │ │ -1653 : current_(current) │ │ │ │ -1654 {} │ │ │ │ -1655 │ │ │ │ -1656 template │ │ │ │ -1657 template │ │ │ │ -1658 MatrixGraph::VertexIteratorT::VertexIteratorT(const │ │ │ │ -VertexIteratorT& other) │ │ │ │ -1659 : graph_(other.graph_), current_(other.current_) │ │ │ │ -1660 {} │ │ │ │ -1661 │ │ │ │ -1662 template │ │ │ │ -1663 template │ │ │ │ -1664 inline bool MatrixGraph::VertexIteratorT::operator!=(const │ │ │ │ -VertexIteratorT& other) const │ │ │ │ -1665 { │ │ │ │ -1666 return current_ != other.current_; │ │ │ │ -1667 } │ │ │ │ -1668 │ │ │ │ -1669 template │ │ │ │ -1670 template │ │ │ │ -1671 inline bool MatrixGraph::VertexIteratorT::operator!=(const │ │ │ │ -VertexIteratorT& other) const │ │ │ │ -1672 { │ │ │ │ -1673 return current_ != other.current_; │ │ │ │ -1674 } │ │ │ │ -1675 │ │ │ │ -1676 │ │ │ │ -1677 template │ │ │ │ -1678 template │ │ │ │ -1679 inline bool MatrixGraph::VertexIteratorT::operator==(const │ │ │ │ -VertexIteratorT& other) const │ │ │ │ -1680 { │ │ │ │ -1681 return current_ == other.current_; │ │ │ │ -1682 } │ │ │ │ -1683 │ │ │ │ -1684 template │ │ │ │ -1685 template │ │ │ │ -1686 inline bool MatrixGraph::VertexIteratorT::operator==(const │ │ │ │ -VertexIteratorT& other) const │ │ │ │ -1687 { │ │ │ │ -1688 return current_ == other.current_; │ │ │ │ -1689 } │ │ │ │ -1690 │ │ │ │ -1691 template │ │ │ │ -1692 template │ │ │ │ -1693 inline typename MatrixGraph::template VertexIteratorT& │ │ │ │ -MatrixGraph::VertexIteratorT::operator++() │ │ │ │ -1694 { │ │ │ │ -1695 ++current_; │ │ │ │ -1696 return *this; │ │ │ │ -1697 } │ │ │ │ -1698 │ │ │ │ -1699 template │ │ │ │ -1700 template │ │ │ │ -1701 inline typename MatrixGraph::template VertexIteratorT::WeightType& │ │ │ │ -1702 MatrixGraph::VertexIteratorT::weight() const │ │ │ │ -1703 { │ │ │ │ -1704 return graph_->matrix()[current_][current_]; │ │ │ │ -1705 } │ │ │ │ -1706 │ │ │ │ -1707 template │ │ │ │ -1708 template │ │ │ │ -1709 inline const typename MatrixGraph::VertexDescriptor& │ │ │ │ -1710 MatrixGraph::VertexIteratorT::operator*() const │ │ │ │ -1711 { │ │ │ │ -1712 return current_; │ │ │ │ -1713 } │ │ │ │ -1714 │ │ │ │ -1715 template │ │ │ │ -1716 template │ │ │ │ -1717 inline typename MatrixGraph::template EdgeIteratorT │ │ │ │ -1718 MatrixGraph::VertexIteratorT::begin() const │ │ │ │ -1719 { │ │ │ │ -1720 return graph_->beginEdges(current_); │ │ │ │ -1721 } │ │ │ │ -1722 │ │ │ │ -1723 template │ │ │ │ -1724 template │ │ │ │ -1725 inline typename MatrixGraph::template EdgeIteratorT │ │ │ │ -1726 MatrixGraph::VertexIteratorT::end() const │ │ │ │ -1727 { │ │ │ │ -1728 return graph_->endEdges(current_); │ │ │ │ -1729 } │ │ │ │ -1730 │ │ │ │ -1731 template │ │ │ │ -1732 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ -1733 MatrixGraph::begin() │ │ │ │ -1734 { │ │ │ │ -1735 return VertexIterator(this,0); │ │ │ │ -1736 } │ │ │ │ -1737 │ │ │ │ -1738 template │ │ │ │ -1739 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ -1740 MatrixGraph::end() │ │ │ │ -1741 { │ │ │ │ -1742 return VertexIterator(matrix_.N()); │ │ │ │ -1743 } │ │ │ │ -1744 │ │ │ │ -1745 │ │ │ │ -1746 template │ │ │ │ -1747 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ -1748 MatrixGraph::begin() const │ │ │ │ -1749 { │ │ │ │ -1750 return ConstVertexIterator(this, 0); │ │ │ │ -1751 } │ │ │ │ -1752 │ │ │ │ -1753 template │ │ │ │ -1754 inline typename MatrixGraph::template VertexIteratorT > │ │ │ │ -1755 MatrixGraph::end() const │ │ │ │ -1756 { │ │ │ │ -1757 return ConstVertexIterator(matrix_.N()); │ │ │ │ -1758 } │ │ │ │ -1759 │ │ │ │ -1760 template │ │ │ │ -1761 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ -1762 MatrixGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ -1763 { │ │ │ │ -1764 return EdgeIterator(source, matrix_.operator[](source).begin(), │ │ │ │ -1765 matrix_.operator[](source).end(), start_[source]); │ │ │ │ -1766 } │ │ │ │ -1767 │ │ │ │ -1768 template │ │ │ │ -1769 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ -1770 MatrixGraph::endEdges(const VertexDescriptor& source) │ │ │ │ -1771 { │ │ │ │ -1772 return EdgeIterator(matrix_.operator[](source).end()); │ │ │ │ -1773 } │ │ │ │ -1774 │ │ │ │ -1775 │ │ │ │ -1776 template │ │ │ │ -1777 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ -1778 MatrixGraph::beginEdges(const VertexDescriptor& source) const │ │ │ │ -1779 { │ │ │ │ -1780 return ConstEdgeIterator(source, matrix_.operator[](source).begin(), │ │ │ │ -1781 matrix_.operator[](source).end(), start_[source]); │ │ │ │ -1782 } │ │ │ │ -1783 │ │ │ │ -1784 template │ │ │ │ -1785 inline typename MatrixGraph::template EdgeIteratorT > │ │ │ │ -1786 MatrixGraph::endEdges(const VertexDescriptor& source) const │ │ │ │ -1787 { │ │ │ │ -1788 return ConstEdgeIterator(matrix_.operator[](source).end()); │ │ │ │ -1789 } │ │ │ │ -1790 │ │ │ │ -1791 │ │ │ │ -1792 template │ │ │ │ -1793 SubGraph::EdgeIterator::EdgeIterator(const VertexDescriptor& source, │ │ │ │ -1794 const EdgeDescriptor& edge) │ │ │ │ -1795 : source_(source), edge_(edge) │ │ │ │ -1796 {} │ │ │ │ -1797 │ │ │ │ -1798 │ │ │ │ -1799 template │ │ │ │ -1800 SubGraph::EdgeIterator::EdgeIterator(const EdgeDescriptor& edge) │ │ │ │ -1801 : edge_(edge) │ │ │ │ -1802 {} │ │ │ │ -1803 │ │ │ │ -1804 template │ │ │ │ -1805 typename SubGraph::EdgeIndexMap SubGraph::getEdgeIndexMap() │ │ │ │ -1806 { │ │ │ │ -1807 return EdgeIndexMap(edges_); │ │ │ │ -1808 } │ │ │ │ -1809 │ │ │ │ -1810 template │ │ │ │ -1811 inline bool SubGraph::EdgeIterator::equals(const EdgeIterator & │ │ │ │ -other) const │ │ │ │ -1812 { │ │ │ │ -1813 return other.edge_==edge_; │ │ │ │ -1814 } │ │ │ │ -1815 │ │ │ │ -1816 template │ │ │ │ -1817 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ -increment() │ │ │ │ -1818 { │ │ │ │ -1819 ++edge_; │ │ │ │ -1820 return *this; │ │ │ │ -1821 } │ │ │ │ -1822 │ │ │ │ -1823 template │ │ │ │ -1824 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ -decrement() │ │ │ │ -1825 { │ │ │ │ -1826 --edge_; │ │ │ │ -1827 return *this; │ │ │ │ -1828 } │ │ │ │ -1829 │ │ │ │ -1830 template │ │ │ │ -1831 inline typename SubGraph::EdgeIterator& SubGraph::EdgeIterator:: │ │ │ │ -advance(std::ptrdiff_t n) │ │ │ │ -1832 { │ │ │ │ -1833 edge_+=n; │ │ │ │ -1834 return *this; │ │ │ │ -1835 } │ │ │ │ -1836 template │ │ │ │ -1837 inline const typename G::VertexDescriptor& SubGraph::EdgeIterator:: │ │ │ │ -source() const │ │ │ │ -1838 { │ │ │ │ -1839 return source_; │ │ │ │ -1840 } │ │ │ │ -1841 │ │ │ │ -1842 template │ │ │ │ -1843 inline const typename G::VertexDescriptor& SubGraph::EdgeIterator:: │ │ │ │ -target() const │ │ │ │ -1844 { │ │ │ │ -1845 return *edge_; │ │ │ │ -1846 } │ │ │ │ -1847 │ │ │ │ -1848 │ │ │ │ -1849 template │ │ │ │ -1850 inline const typename SubGraph::EdgeDescriptor& SubGraph:: │ │ │ │ -EdgeIterator::dereference() const │ │ │ │ -1851 { │ │ │ │ -1852 return edge_; │ │ │ │ -1853 } │ │ │ │ -1854 │ │ │ │ -1855 template │ │ │ │ -1856 inline std::ptrdiff_t SubGraph::EdgeIterator::distanceTo(const │ │ │ │ -EdgeIterator & other) const │ │ │ │ -1857 { │ │ │ │ -1858 return other.edge_-edge_; │ │ │ │ -1859 } │ │ │ │ -1860 │ │ │ │ -1861 template │ │ │ │ -1862 SubGraph::VertexIterator::VertexIterator(const SubGraph* graph, │ │ │ │ -1863 const VertexDescriptor& current, │ │ │ │ -1864 const VertexDescriptor& end) │ │ │ │ -1865 : graph_(graph), current_(current), end_(end) │ │ │ │ -1866 { │ │ │ │ -1867 // Skip excluded vertices │ │ │ │ -1868 typedef typename T::const_iterator Iterator; │ │ │ │ -1869 │ │ │ │ -1870 for(Iterator vertex = graph_->excluded_.begin(); │ │ │ │ -1871 current_ != end_ && *vertex; │ │ │ │ -1872 ++vertex) │ │ │ │ -1873 ++current_; │ │ │ │ -1874 assert(current_ == end_ || !graph_->excluded_[current_]); │ │ │ │ -1875 } │ │ │ │ -1876 │ │ │ │ -1877 template │ │ │ │ -1878 SubGraph::VertexIterator::VertexIterator(const VertexDescriptor& │ │ │ │ -current) │ │ │ │ -1879 : current_(current) │ │ │ │ -1880 {} │ │ │ │ -1881 │ │ │ │ -1882 template │ │ │ │ -1883 inline typename SubGraph::VertexIterator& SubGraph:: │ │ │ │ -VertexIterator::increment() │ │ │ │ -1884 { │ │ │ │ -1885 ++current_; │ │ │ │ -1886 //Skip excluded vertices │ │ │ │ -1887 while(current_ != end_ && graph_->excluded_[current_]) │ │ │ │ -1888 ++current_; │ │ │ │ -1889 │ │ │ │ -1890 assert(current_ == end_ || !graph_->excluded_[current_]); │ │ │ │ -1891 return *this; │ │ │ │ -1892 } │ │ │ │ -1893 │ │ │ │ -1894 template │ │ │ │ -1895 inline bool SubGraph::VertexIterator::equals(const VertexIterator & │ │ │ │ -other) const │ │ │ │ -1896 { │ │ │ │ -1897 return current_==other.current_; │ │ │ │ -1898 } │ │ │ │ -1899 │ │ │ │ -1900 template │ │ │ │ -1901 inline const typename G::VertexDescriptor& SubGraph::VertexIterator:: │ │ │ │ -dereference() const │ │ │ │ -1902 { │ │ │ │ -1903 return current_; │ │ │ │ -1904 } │ │ │ │ -1905 │ │ │ │ -1906 template │ │ │ │ -1907 inline typename SubGraph::EdgeIterator SubGraph:: │ │ │ │ -VertexIterator::begin() const │ │ │ │ -1908 { │ │ │ │ -1909 return graph_->beginEdges(current_); │ │ │ │ -1910 } │ │ │ │ -1911 │ │ │ │ -1912 template │ │ │ │ -1913 inline typename SubGraph::EdgeIterator SubGraph:: │ │ │ │ -VertexIterator::end() const │ │ │ │ -1914 { │ │ │ │ -1915 return graph_->endEdges(current_); │ │ │ │ -1916 } │ │ │ │ -1917 │ │ │ │ -1918 template │ │ │ │ -1919 inline typename SubGraph::VertexIterator SubGraph::begin() const │ │ │ │ -1920 { │ │ │ │ -1921 return VertexIterator(this, 0, endVertex_); │ │ │ │ -1922 } │ │ │ │ -1923 │ │ │ │ -1924 │ │ │ │ -1925 template │ │ │ │ -1926 inline typename SubGraph::VertexIterator SubGraph::end() const │ │ │ │ -1927 { │ │ │ │ -1928 return VertexIterator(endVertex_); │ │ │ │ -1929 } │ │ │ │ -1930 │ │ │ │ -1931 │ │ │ │ -1932 template │ │ │ │ -1933 inline typename SubGraph::EdgeIterator SubGraph::beginEdges │ │ │ │ -(const VertexDescriptor& source) const │ │ │ │ -1934 { │ │ │ │ -1935 return EdgeIterator(source, edges_+start_[source]); │ │ │ │ -1936 } │ │ │ │ -1937 │ │ │ │ -1938 template │ │ │ │ -1939 inline typename SubGraph::EdgeIterator SubGraph::endEdges(const │ │ │ │ -VertexDescriptor& source) const │ │ │ │ -1940 { │ │ │ │ -1941 return EdgeIterator(edges_+end_[source]); │ │ │ │ -1942 } │ │ │ │ -1943 │ │ │ │ -1944 template │ │ │ │ -1945 std::size_t SubGraph::noVertices() const │ │ │ │ -1946 { │ │ │ │ -1947 return noVertices_; │ │ │ │ -1948 } │ │ │ │ -1949 │ │ │ │ -1950 template │ │ │ │ -1951 inline typename SubGraph::VertexDescriptor SubGraph::maxVertex() │ │ │ │ -const │ │ │ │ -1952 { │ │ │ │ -1953 return maxVertex_; │ │ │ │ -1954 } │ │ │ │ -1955 │ │ │ │ -1956 template │ │ │ │ -1957 inline std::size_t SubGraph::noEdges() const │ │ │ │ -1958 { │ │ │ │ -1959 return noEdges_; │ │ │ │ -1960 } │ │ │ │ -1961 │ │ │ │ -1962 template │ │ │ │ -1963 inline typename SubGraph::EdgeDescriptor SubGraph::findEdge │ │ │ │ -(const VertexDescriptor& source, │ │ │ │ -1964 const VertexDescriptor& target) const │ │ │ │ -1965 { │ │ │ │ -1966 const EdgeDescriptor edge = std::lower_bound(edges_+start_[source], │ │ │ │ -edges_+end_[source], target); │ │ │ │ -1967 if(edge==edges_+end_[source] || *edge!=target) │ │ │ │ -1968 return std::numeric_limits::max(); │ │ │ │ -1969 │ │ │ │ -1970 return edge; │ │ │ │ -1971 } │ │ │ │ -1972 │ │ │ │ -1973 template │ │ │ │ -1974 SubGraph::~SubGraph() │ │ │ │ -1975 { │ │ │ │ -1976 delete[] edges_; │ │ │ │ -1977 delete[] end_; │ │ │ │ -1978 delete[] start_; │ │ │ │ -1979 } │ │ │ │ -1980 │ │ │ │ -1981 template │ │ │ │ -1982 SubGraph::SubGraph(const G& graph, const T& excluded) │ │ │ │ -1983 : excluded_(excluded), noVertices_(0), endVertex_(0), maxVertex_ │ │ │ │ -(graph.maxVertex()) │ │ │ │ -1984 { │ │ │ │ -1985 start_ = new std::ptrdiff_t[graph.noVertices()]; │ │ │ │ -1986 end_ = new std::ptrdiff_t[graph.noVertices()]; │ │ │ │ -1987 edges_ = new VertexDescriptor[graph.noEdges()]; │ │ │ │ -1988 │ │ │ │ -1989 VertexDescriptor* edge=edges_; │ │ │ │ -1990 │ │ │ │ -1991 // Cater for the case that there are no vertices. │ │ │ │ -1992 // Otherwise endVertex_ will get 1 below. │ │ │ │ -1993 if ( graph.noVertices() == 0) │ │ │ │ -1994 return; │ │ │ │ -1995 │ │ │ │ -1996 typedef typename Graph::ConstVertexIterator Iterator; │ │ │ │ -1997 Iterator endVertex=graph.end(); │ │ │ │ -1998 │ │ │ │ -1999 for(Iterator vertex = graph.begin(); vertex != endVertex; ++vertex) │ │ │ │ -2000 if(excluded_[*vertex]) │ │ │ │ -2001 start_[*vertex]=end_[*vertex]=-1; │ │ │ │ -2002 else{ │ │ │ │ -2003 ++noVertices_; │ │ │ │ -2004 endVertex_ = std::max(*vertex, endVertex_); │ │ │ │ -2005 │ │ │ │ -2006 start_[*vertex] = edge-edges_; │ │ │ │ -2007 │ │ │ │ -2008 auto endEdge = vertex.end(); │ │ │ │ -2009 │ │ │ │ -2010 for(auto iter=vertex.begin(); iter!= endEdge; ++iter) │ │ │ │ -2011 if(!excluded[iter.target()]) { │ │ │ │ -2012 *edge = iter.target(); │ │ │ │ -2013 ++edge; │ │ │ │ -2014 } │ │ │ │ -2015 │ │ │ │ -2016 end_[*vertex] = edge - edges_; │ │ │ │ -2017 │ │ │ │ -2018 // Sort the edges │ │ │ │ -2019 std::sort(edges_+start_[*vertex], edge); │ │ │ │ -2020 } │ │ │ │ -2021 noEdges_ = edge-edges_; │ │ │ │ -2022 ++endVertex_; │ │ │ │ -2023 } │ │ │ │ -2024 │ │ │ │ -2025 template │ │ │ │ -2026 inline std::size_t VertexPropertiesGraph::noEdges() const │ │ │ │ -2027 { │ │ │ │ -2028 return graph_.noEdges(); │ │ │ │ -2029 } │ │ │ │ -2030 │ │ │ │ -2031 template │ │ │ │ -2032 inline typename VertexPropertiesGraph::EdgeIterator │ │ │ │ -2033 VertexPropertiesGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ -2034 { │ │ │ │ -2035 return graph_.beginEdges(source); │ │ │ │ -2036 } │ │ │ │ -2037 │ │ │ │ -2038 template │ │ │ │ -2039 inline typename VertexPropertiesGraph::EdgeIterator │ │ │ │ -2040 VertexPropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ -2041 { │ │ │ │ -2042 return graph_.endEdges(source); │ │ │ │ -2043 } │ │ │ │ -2044 │ │ │ │ -2045 template │ │ │ │ -2046 typename VertexPropertiesGraph::ConstEdgeIterator │ │ │ │ -2047 inline VertexPropertiesGraph::beginEdges(const VertexDescriptor& │ │ │ │ -source) const │ │ │ │ -2048 { │ │ │ │ -2049 return graph_.beginEdges(source); │ │ │ │ -2050 } │ │ │ │ -2051 │ │ │ │ -2052 template │ │ │ │ -2053 typename VertexPropertiesGraph::ConstEdgeIterator │ │ │ │ -2054 VertexPropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ -const │ │ │ │ -2055 { │ │ │ │ -2056 return graph_.endEdges(source); │ │ │ │ -2057 } │ │ │ │ -2058 │ │ │ │ -2059 template │ │ │ │ -2060 template │ │ │ │ -2061 VertexPropertiesGraph::VertexIteratorT │ │ │ │ -2062 ::VertexIteratorT(const Father& iter, │ │ │ │ -2063 C* graph) │ │ │ │ -2064 : Father(iter), graph_(graph) │ │ │ │ -2065 {} │ │ │ │ -2066 │ │ │ │ -2067 template │ │ │ │ -2068 template │ │ │ │ -2069 VertexPropertiesGraph::VertexIteratorT │ │ │ │ -2070 ::VertexIteratorT(const Father& iter) │ │ │ │ -2071 : Father(iter) │ │ │ │ -2072 {} │ │ │ │ -2073 │ │ │ │ -2074 template │ │ │ │ -2075 template │ │ │ │ -2076 template │ │ │ │ -2077 VertexPropertiesGraph::VertexIteratorT │ │ │ │ -2078 ::VertexIteratorT(const VertexIteratorT& other) │ │ │ │ -2079 : Father(other), graph_(other.graph_) │ │ │ │ -2080 {} │ │ │ │ -2081 │ │ │ │ -2082 template │ │ │ │ -2083 template │ │ │ │ -2084 typename std::conditional:: │ │ │ │ -type>::value, │ │ │ │ -2085 V&, const V&>::type │ │ │ │ -2086 inline VertexPropertiesGraph::VertexIteratorT::properties() │ │ │ │ -const │ │ │ │ -2087 { │ │ │ │ -2088 return graph_->getVertexProperties(Father::operator*()); │ │ │ │ -2089 } │ │ │ │ -2090 │ │ │ │ -2091 template │ │ │ │ -2092 template │ │ │ │ -2093 typename std::conditional:: │ │ │ │ -type, │ │ │ │ -2094 C>::value, │ │ │ │ -2095 typename G::EdgeIterator, │ │ │ │ -2096 typename G::ConstEdgeIterator>::type │ │ │ │ -2097 inline VertexPropertiesGraph::VertexIteratorT::begin() const │ │ │ │ -2098 { │ │ │ │ -2099 return graph_->beginEdges(Father::operator*()); │ │ │ │ -2100 } │ │ │ │ -2101 │ │ │ │ -2102 template │ │ │ │ -2103 template │ │ │ │ -2104 typename std::conditional:: │ │ │ │ -type, │ │ │ │ -2105 C>::value, │ │ │ │ -2106 typename G::EdgeIterator, │ │ │ │ -2107 typename G::ConstEdgeIterator>::type │ │ │ │ -2108 inline VertexPropertiesGraph::VertexIteratorT::end() const │ │ │ │ -2109 { │ │ │ │ -2110 return graph_->endEdges(Father::operator*()); │ │ │ │ -2111 } │ │ │ │ -2112 │ │ │ │ -2113 template │ │ │ │ -2114 inline typename VertexPropertiesGraph::VertexIterator │ │ │ │ -VertexPropertiesGraph::begin() │ │ │ │ -2115 { │ │ │ │ -2116 return VertexIterator(graph_.begin(), this); │ │ │ │ -2117 } │ │ │ │ -2118 │ │ │ │ -2119 template │ │ │ │ -2120 inline typename VertexPropertiesGraph::VertexIterator │ │ │ │ -VertexPropertiesGraph::end() │ │ │ │ -2121 { │ │ │ │ -2122 return VertexIterator(graph_.end()); │ │ │ │ -2123 } │ │ │ │ -2124 │ │ │ │ -2125 │ │ │ │ -2126 template │ │ │ │ -2127 inline typename VertexPropertiesGraph::ConstVertexIterator │ │ │ │ -VertexPropertiesGraph::begin() const │ │ │ │ -2128 { │ │ │ │ -2129 return ConstVertexIterator(graph_.begin(), this); │ │ │ │ -2130 } │ │ │ │ -2131 │ │ │ │ -2132 template │ │ │ │ -2133 inline typename VertexPropertiesGraph::ConstVertexIterator │ │ │ │ -VertexPropertiesGraph::end() const │ │ │ │ -2134 { │ │ │ │ -2135 return ConstVertexIterator(graph_.end()); │ │ │ │ -2136 } │ │ │ │ -2137 │ │ │ │ -2138 template │ │ │ │ -2139 inline V& VertexPropertiesGraph::getVertexProperties(const │ │ │ │ -VertexDescriptor& vertex) │ │ │ │ -2140 { │ │ │ │ -2141 return vertexProperties_[vmap_[vertex]]; │ │ │ │ -2142 } │ │ │ │ -2143 │ │ │ │ -2144 template │ │ │ │ -2145 inline const V& VertexPropertiesGraph::getVertexProperties(const │ │ │ │ -VertexDescriptor& vertex) const │ │ │ │ -2146 { │ │ │ │ -2147 return vertexProperties_[vmap_[vertex]]; │ │ │ │ -2148 } │ │ │ │ -2149 │ │ │ │ -2150 template │ │ │ │ -2151 inline const G& VertexPropertiesGraph::graph() const │ │ │ │ -2152 { │ │ │ │ -2153 return graph_; │ │ │ │ -2154 } │ │ │ │ -2155 │ │ │ │ -2156 template │ │ │ │ -2157 inline std::size_t VertexPropertiesGraph::noVertices() const │ │ │ │ -2158 { │ │ │ │ -2159 return graph_.noVertices(); │ │ │ │ -2160 } │ │ │ │ -2161 │ │ │ │ -2162 │ │ │ │ -2163 template │ │ │ │ -2164 inline typename VertexPropertiesGraph::VertexDescriptor │ │ │ │ -VertexPropertiesGraph::maxVertex() const │ │ │ │ -2165 { │ │ │ │ -2166 return graph_.maxVertex(); │ │ │ │ -2167 } │ │ │ │ -2168 │ │ │ │ -2169 template │ │ │ │ -2170 VertexPropertiesGraph::VertexPropertiesGraph(Graph& graph, const │ │ │ │ -VM vmap) │ │ │ │ -2171 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex │ │ │ │ -()+1], V()) │ │ │ │ -2172 {} │ │ │ │ -2173 │ │ │ │ -2174 template │ │ │ │ -2175 template │ │ │ │ -2176 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ -Father& iter, │ │ │ │ -2177 C* graph) │ │ │ │ -2178 : Father(iter), graph_(graph) │ │ │ │ -2179 {} │ │ │ │ -2180 │ │ │ │ -2181 template │ │ │ │ -2182 template │ │ │ │ -2183 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ -Father& iter) │ │ │ │ -2184 : Father(iter) │ │ │ │ -2185 {} │ │ │ │ -2186 │ │ │ │ -2187 template │ │ │ │ -2188 template │ │ │ │ -2189 template │ │ │ │ -2190 PropertiesGraph::EdgeIteratorT::EdgeIteratorT(const │ │ │ │ -EdgeIteratorT& other) │ │ │ │ -2191 : Father(other), graph_(other.graph_) │ │ │ │ -2192 {} │ │ │ │ -2193 │ │ │ │ -2194 │ │ │ │ -2195 template │ │ │ │ -2196 inline std::size_t PropertiesGraph::noEdges() const │ │ │ │ -2197 { │ │ │ │ -2198 return graph_.noEdges(); │ │ │ │ -2199 } │ │ │ │ -2200 │ │ │ │ -2201 template │ │ │ │ -2202 template │ │ │ │ -2203 inline typename std::conditional::type>::value,E&,const E&>::type │ │ │ │ -2204 PropertiesGraph::EdgeIteratorT::properties() const │ │ │ │ -2205 { │ │ │ │ -2206 return graph_->getEdgeProperties(Father::operator*()); │ │ │ │ -2207 } │ │ │ │ -2208 │ │ │ │ -2209 template │ │ │ │ -2210 inline typename PropertiesGraph::EdgeIterator │ │ │ │ -2211 PropertiesGraph::beginEdges(const VertexDescriptor& source) │ │ │ │ -2212 { │ │ │ │ -2213 return EdgeIterator(graph_.beginEdges(source), this); │ │ │ │ -2214 } │ │ │ │ -2215 │ │ │ │ -2216 template │ │ │ │ -2217 inline typename PropertiesGraph::EdgeIterator │ │ │ │ -2218 PropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ -2219 { │ │ │ │ -2220 return EdgeIterator(graph_.endEdges(source)); │ │ │ │ -2221 } │ │ │ │ -2222 │ │ │ │ -2223 template │ │ │ │ -2224 typename PropertiesGraph::ConstEdgeIterator │ │ │ │ -2225 inline PropertiesGraph::beginEdges(const VertexDescriptor& │ │ │ │ -source) const │ │ │ │ -2226 { │ │ │ │ -2227 return ConstEdgeIterator(graph_.beginEdges(source), this); │ │ │ │ -2228 } │ │ │ │ -2229 │ │ │ │ -2230 template │ │ │ │ -2231 typename PropertiesGraph::ConstEdgeIterator │ │ │ │ -2232 PropertiesGraph::endEdges(const VertexDescriptor& source) │ │ │ │ -const │ │ │ │ -2233 { │ │ │ │ -2234 return ConstEdgeIterator(graph_.endEdges(source)); │ │ │ │ -2235 } │ │ │ │ -2236 │ │ │ │ -2237 template │ │ │ │ -2238 template │ │ │ │ -2239 PropertiesGraph::VertexIteratorT │ │ │ │ -2240 ::VertexIteratorT(const Father& iter, │ │ │ │ -2241 C* graph) │ │ │ │ -2242 : Father(iter), graph_(graph) │ │ │ │ -2243 {} │ │ │ │ -2244 │ │ │ │ -2245 template │ │ │ │ -2246 template │ │ │ │ -2247 PropertiesGraph::VertexIteratorT │ │ │ │ -2248 ::VertexIteratorT(const Father& iter) │ │ │ │ -2249 : Father(iter) │ │ │ │ -2250 {} │ │ │ │ -2251 │ │ │ │ -2252 template │ │ │ │ -2253 template │ │ │ │ -2254 template │ │ │ │ -2255 PropertiesGraph::VertexIteratorT │ │ │ │ -2256 ::VertexIteratorT(const VertexIteratorT& other) │ │ │ │ -2257 : Father(other), graph_(other.graph_) │ │ │ │ -2258 {} │ │ │ │ -2259 │ │ │ │ -2260 template │ │ │ │ -2261 template │ │ │ │ -2262 inline typename std::conditional::type>::value, │ │ │ │ -2263 V&, const V&>::type │ │ │ │ -2264 PropertiesGraph::VertexIteratorT::properties() const │ │ │ │ -2265 { │ │ │ │ -2266 return graph_->getVertexProperties(Father::operator*()); │ │ │ │ -2267 } │ │ │ │ -2268 │ │ │ │ -2269 template │ │ │ │ -2270 template │ │ │ │ -2271 inline typename PropertiesGraph::template EdgeIteratorT │ │ │ │ -2272 PropertiesGraph::VertexIteratorT::begin() const │ │ │ │ -2273 { │ │ │ │ -2274 return graph_->beginEdges(Father::operator*()); │ │ │ │ -2275 } │ │ │ │ -2276 │ │ │ │ -2277 template │ │ │ │ -2278 template │ │ │ │ -2279 inline typename PropertiesGraph::template EdgeIteratorT │ │ │ │ -2280 PropertiesGraph::VertexIteratorT::end() const │ │ │ │ -2281 { │ │ │ │ -2282 return graph_->endEdges(Father::operator*()); │ │ │ │ -2283 } │ │ │ │ -2284 │ │ │ │ -2285 template │ │ │ │ -2286 inline typename PropertiesGraph::VertexIterator │ │ │ │ -PropertiesGraph::begin() │ │ │ │ -2287 { │ │ │ │ -2288 return VertexIterator(graph_.begin(), this); │ │ │ │ -2289 } │ │ │ │ -2290 │ │ │ │ -2291 template │ │ │ │ -2292 inline typename PropertiesGraph::VertexIterator │ │ │ │ -PropertiesGraph::end() │ │ │ │ -2293 { │ │ │ │ -2294 return VertexIterator(graph_.end()); │ │ │ │ -2295 } │ │ │ │ -2296 │ │ │ │ -2297 │ │ │ │ -2298 template │ │ │ │ -2299 inline typename PropertiesGraph::ConstVertexIterator │ │ │ │ -PropertiesGraph::begin() const │ │ │ │ -2300 { │ │ │ │ -2301 return ConstVertexIterator(graph_.begin(), this); │ │ │ │ -2302 } │ │ │ │ -2303 │ │ │ │ -2304 template │ │ │ │ -2305 inline typename PropertiesGraph::ConstVertexIterator │ │ │ │ -PropertiesGraph::end() const │ │ │ │ -2306 { │ │ │ │ -2307 return ConstVertexIterator(graph_.end()); │ │ │ │ -2308 } │ │ │ │ -2309 │ │ │ │ -2310 template │ │ │ │ -2311 inline V& PropertiesGraph::getVertexProperties(const │ │ │ │ -VertexDescriptor& vertex) │ │ │ │ -2312 { │ │ │ │ -2313 return vertexProperties_[vmap_[vertex]]; │ │ │ │ -2314 } │ │ │ │ -2315 │ │ │ │ -2316 template │ │ │ │ -2317 inline const V& PropertiesGraph::getVertexProperties(const │ │ │ │ -VertexDescriptor& vertex) const │ │ │ │ -2318 { │ │ │ │ -2319 return vertexProperties_[vmap_[vertex]]; │ │ │ │ -2320 } │ │ │ │ -2321 │ │ │ │ -2322 template │ │ │ │ -2323 inline E& PropertiesGraph::getEdgeProperties(const │ │ │ │ -EdgeDescriptor& edge) │ │ │ │ -2324 { │ │ │ │ -2325 return edgeProperties_[emap_[edge]]; │ │ │ │ -2326 } │ │ │ │ -2327 │ │ │ │ -2328 template │ │ │ │ -2329 inline const E& PropertiesGraph::getEdgeProperties(const │ │ │ │ -EdgeDescriptor& edge) const │ │ │ │ -2330 { │ │ │ │ -2331 return edgeProperties_[emap_[edge]]; │ │ │ │ -2332 } │ │ │ │ -2333 │ │ │ │ -2334 template │ │ │ │ -2335 inline E& PropertiesGraph::getEdgeProperties(const │ │ │ │ -VertexDescriptor& source, │ │ │ │ -2336 const VertexDescriptor& target) │ │ │ │ -2337 { │ │ │ │ -2338 return getEdgeProperties(graph_.findEdge(source,target)); │ │ │ │ -2339 } │ │ │ │ -2340 │ │ │ │ -2341 template │ │ │ │ -2342 inline const E& PropertiesGraph::getEdgeProperties(const │ │ │ │ -VertexDescriptor& source, │ │ │ │ -2343 const VertexDescriptor& target) const │ │ │ │ -2344 { │ │ │ │ -2345 return getEdgeProperties(graph_.findEdge(source,target)); │ │ │ │ -2346 } │ │ │ │ -2347 │ │ │ │ -2348 template │ │ │ │ -2349 inline const G& PropertiesGraph::graph() const │ │ │ │ -2350 { │ │ │ │ -2351 return graph_; │ │ │ │ -2352 } │ │ │ │ -2353 │ │ │ │ -2354 template │ │ │ │ -2355 inline std::size_t PropertiesGraph::noVertices() const │ │ │ │ -2356 { │ │ │ │ -2357 return graph_.noVertices(); │ │ │ │ -2358 } │ │ │ │ -2359 │ │ │ │ -2360 │ │ │ │ -2361 template │ │ │ │ -2362 inline typename PropertiesGraph::VertexDescriptor │ │ │ │ -PropertiesGraph::maxVertex() const │ │ │ │ -2363 { │ │ │ │ -2364 return graph_.maxVertex(); │ │ │ │ -2365 } │ │ │ │ -2366 │ │ │ │ -2367 template │ │ │ │ -2368 PropertiesGraph::PropertiesGraph(Graph& graph, const VM& │ │ │ │ -vmap, const EM& emap) │ │ │ │ -2369 : graph_(graph), vmap_(vmap), vertexProperties_(vmap_[graph_.maxVertex │ │ │ │ -()+1], V()), │ │ │ │ -2370 emap_(emap), edgeProperties_(graph_.noEdges(), E()) │ │ │ │ -2371 {} │ │ │ │ -2372 │ │ │ │ -2373 template │ │ │ │ -2374 inline int _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(const G& graph, const typename G:: │ │ │ │ -VertexDescriptor& vertex, │ │ │ │ -2375 V& visitor) │ │ │ │ -2376 { │ │ │ │ -2377 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ -2378 const iterator end = graph.endEdges(vertex); │ │ │ │ -2379 int noNeighbours=0; │ │ │ │ -2380 for(iterator edge = graph.beginEdges(vertex); edge != end; ++edge, │ │ │ │ -++noNeighbours) │ │ │ │ -2381 visitor(edge); │ │ │ │ -2382 return noNeighbours; │ │ │ │ -2383 } │ │ │ │ -2384 │ │ │ │ -2385#endif // DOXYGEN │ │ │ │ -2386 │ │ │ │ -2388 } │ │ │ │ -2389} │ │ │ │ -2390#endif │ │ │ │ +1119} // end namespace 'Imp' │ │ │ │ +1120 │ │ │ │ +1121 │ │ │ │ +1123 template │ │ │ │ +1124 struct AutonomousValueType> │ │ │ │ +1125 { │ │ │ │ +1126 using type = BlockVector; │ │ │ │ +1127 }; │ │ │ │ +1128 │ │ │ │ +1129 │ │ │ │ +1130} // end namespace 'Dune' │ │ │ │ +1131 │ │ │ │ +1132#endif │ │ │ │ _i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s │ │ │ │ -int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, │ │ │ │ -V &visitor) │ │ │ │ -Visit all neighbour vertices of a vertex in a graph. │ │ │ │ +_b_a_s_e_a_r_r_a_y_._h_h │ │ │ │ +Implements several basic array containers. │ │ │ │ +_b_l_o_c_k_l_e_v_e_l_._h_h │ │ │ │ +Helper functions for determining the vector/matrix block level. │ │ │ │ _s_t_d │ │ │ │ STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ -derive error class from the base class in common │ │ │ │ -DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -The (undirected) graph of a matrix. │ │ │ │ -DDeeffiinniittiioonn graph.hh:51 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -MatrixGraph(Matrix &matrix) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d │ │ │ │ -VertexIterator end() │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ -VertexDescriptor maxVertex() const │ │ │ │ -Get the maximal vertex descriptor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_a_t_r_i_x │ │ │ │ -M Matrix │ │ │ │ -The type of the matrix we are a graph for. │ │ │ │ -DDeeffiinniittiioonn graph.hh:56 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ -ConstVertexIterator begin() const │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator │ │ │ │ -The constant vertex iterator type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:308 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_~_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ -~MatrixGraph() │ │ │ │ -Destructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ -std::ptrdiff_t EdgeDescriptor │ │ │ │ -The edge descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:80 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ -ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ -Get an iterator over the edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ -M::size_type VertexDescriptor │ │ │ │ -The vertex descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:73 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_t_r_i_x │ │ │ │ -const Matrix & matrix() const │ │ │ │ -Get the underlying matrix. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_u_t_a_b_l_e_M_a_t_r_i_x │ │ │ │ -@ mutableMatrix │ │ │ │ -DDeeffiinniittiioonn graph.hh:86 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ -ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ -Get an iterator over the edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d │ │ │ │ -ConstVertexIterator end() const │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -EdgeIteratorT< const MatrixGraph< Matrix > > ConstEdgeIterator │ │ │ │ -The constant edge iterator type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:298 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ -EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ -Get an iterator over the edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ -std::size_t noVertices() const │ │ │ │ -Get the number of vertices in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_f_i_n_d_E_d_g_e │ │ │ │ -EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ -&target) const │ │ │ │ -Find the descriptor of an edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_W_e_i_g_h_t │ │ │ │ -M::block_type Weight │ │ │ │ -The type of the weights. │ │ │ │ -DDeeffiinniittiioonn graph.hh:66 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_M_u_t_a_b_l_e_M_a_t_r_i_x │ │ │ │ -std::remove_const< M >::type MutableMatrix │ │ │ │ -The mutable type of the matrix we are a graph for. │ │ │ │ -DDeeffiinniittiioonn graph.hh:61 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -EdgeIteratorT< MatrixGraph< Matrix > > EdgeIterator │ │ │ │ -The mutable edge iterator type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:303 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIteratorT< MatrixGraph< Matrix > > VertexIterator │ │ │ │ -The mutable vertex iterator type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:313 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ -EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ -Get an iterator over the edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ -std::size_t noEdges() const │ │ │ │ -Get the number of edges in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_m_a_t_r_i_x │ │ │ │ -Matrix & matrix() │ │ │ │ -Get the underlying matrix. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ -VertexIterator begin() │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -Iterator over all edges starting from a vertex. │ │ │ │ -DDeeffiinniittiioonn graph.hh:95 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t_T_y_p_e │ │ │ │ -std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ -value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >:: │ │ │ │ -type WeightType │ │ │ │ -DDeeffiinniittiioonn graph.hh:156 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -EdgeIteratorT(const VertexDescriptor &source, const ColIterator &block, const │ │ │ │ -ColIterator &end, const EdgeDescriptor &edge) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ -@ isMutable │ │ │ │ -whether C is mutable. │ │ │ │ -DDeeffiinniittiioonn graph.hh:112 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_t_a_r_g_e_t │ │ │ │ -VertexDescriptor target() const │ │ │ │ -The index of the target vertex of the current edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ -EdgeIteratorT< C > & operator++() │ │ │ │ -preincrement operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ -bool operator!=(const EdgeIteratorT< const typename std::remove_const< C >:: │ │ │ │ -type > &other) const │ │ │ │ -Inequality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ -bool operator==(const EdgeIteratorT< const typename std::remove_const< C >:: │ │ │ │ -type > &other) const │ │ │ │ -Equality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -EdgeIteratorT(const EdgeIteratorT< C1 > &other) │ │ │ │ -Copy Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ -bool operator!=(const EdgeIteratorT< typename std::remove_const< C >::type > │ │ │ │ -&other) const │ │ │ │ -Inequality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_w_e_i_g_h_t │ │ │ │ -WeightType & weight() const │ │ │ │ -Access the edge weight. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_s_o_u_r_c_e │ │ │ │ -VertexDescriptor source() const │ │ │ │ -The index of the source vertex of the current edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ -std::conditional< isMutable &&C::mutableMatrix, typenameMatrix::row_type:: │ │ │ │ -Iterator, typenameMatrix::row_type::ConstIterator >::type ColIterator │ │ │ │ -The column iterator of the matrix we use. │ │ │ │ -DDeeffiinniittiioonn graph.hh:120 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_C_o_n_s_t_C_o_n_t_a_i_n_e_r │ │ │ │ -const std::remove_const< C >::type ConstContainer │ │ │ │ -The constant type of the container type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:105 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ -bool operator==(const EdgeIteratorT< typename std::remove_const< C >::type > │ │ │ │ -&other) const │ │ │ │ -Equality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -EdgeIteratorT(const ColIterator &block) │ │ │ │ -Constructor for the end iterator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t │ │ │ │ -std::conditional< isMutable &&C::mutableMatrix, typenameM::block_type, │ │ │ │ -consttypenameM::block_type >::type Weight │ │ │ │ -The matrix block type we use as weights. │ │ │ │ -DDeeffiinniittiioonn graph.hh:127 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ -const EdgeDescriptor & operator*() const │ │ │ │ -Get the edge descriptor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_-_> │ │ │ │ -const EdgeDescriptor * operator->() const │ │ │ │ -Get the edge descriptor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r │ │ │ │ -std::remove_const< C >::type MutableContainer │ │ │ │ -The mutable type of the container type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:101 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -The vertex iterator type of the graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:209 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_b_e_g_i_n │ │ │ │ -EdgeIteratorT< C > begin() const │ │ │ │ -Get an iterator over all edges starting at the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ -const VertexDescriptor & operator*() const │ │ │ │ -Get the descriptor of the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_w_e_i_g_h_t │ │ │ │ -WeightType & weight() const │ │ │ │ -Access the weight of the vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -VertexIteratorT(C *graph, const VertexDescriptor ¤t) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_W_e_i_g_h_t_T_y_p_e │ │ │ │ -std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ -value &&C::mutableMatrix, typenameM::block_type, consttypenameM::block_type >:: │ │ │ │ -type WeightType │ │ │ │ -DDeeffiinniittiioonn graph.hh:266 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -VertexIteratorT(const VertexIteratorT< MutableContainer > &other) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_M_u_t_a_b_l_e_C_o_n_t_a_i_n_e_r │ │ │ │ -std::remove_const< C >::type MutableContainer │ │ │ │ -The mutable type of the container type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:214 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ -bool operator!=(const VertexIteratorT< MutableContainer > &other) const │ │ │ │ -Inequality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ -@ isMutable │ │ │ │ -whether C is mutable. │ │ │ │ -DDeeffiinniittiioonn graph.hh:225 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ -bool operator==(const VertexIteratorT< MutableContainer > &other) const │ │ │ │ -Equality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_C_o_n_s_t_C_o_n_t_a_i_n_e_r │ │ │ │ -const std::remove_const< C >::type ConstContainer │ │ │ │ -The constant type of the container type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:218 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_+_+ │ │ │ │ -VertexIteratorT< C > & operator++() │ │ │ │ -Move to the next vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_e_n_d │ │ │ │ -EdgeIteratorT< C > end() const │ │ │ │ -Get an iterator over all edges starting at the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_=_= │ │ │ │ -bool operator==(const VertexIteratorT< ConstContainer > &other) const │ │ │ │ -Equality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_o_p_e_r_a_t_o_r_!_= │ │ │ │ -bool operator!=(const VertexIteratorT< ConstContainer > &other) const │ │ │ │ -Inequality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -VertexIteratorT(const VertexDescriptor ¤t) │ │ │ │ -Constructor for the end iterator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h │ │ │ │ -A subgraph of a graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:443 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_f_i_n_d_E_d_g_e │ │ │ │ -EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ -&target) const │ │ │ │ -Find the descriptor of an edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ -VertexDescriptor maxVertex() const │ │ │ │ -Get the maximal vertex descriptor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_g_e_t_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -EdgeIndexMap getEdgeIndexMap() │ │ │ │ -Get an edge index map for the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ -std::size_t noEdges() const │ │ │ │ -Get the number of edges in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ -ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ -Get an iterator over the edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_e_n_d │ │ │ │ -ConstVertexIterator end() const │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ -ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ -Get an iterator over the edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ -std::size_t noVertices() const │ │ │ │ -Get the number of vertices in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_x_c_l_u_d_e_d │ │ │ │ -T Excluded │ │ │ │ -Random access container providing information about which vertices are │ │ │ │ -excluded. │ │ │ │ -DDeeffiinniittiioonn graph.hh:454 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_~_S_u_b_G_r_a_p_h │ │ │ │ -~SubGraph() │ │ │ │ -Destructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -EdgeIterator ConstEdgeIterator │ │ │ │ -The constant edge iterator type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:618 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ -G Graph │ │ │ │ -The type of the graph we are a sub graph for. │ │ │ │ -DDeeffiinniittiioonn graph.hh:448 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIterator ConstVertexIterator │ │ │ │ -The constant vertex iterator type. │ │ │ │ -DDeeffiinniittiioonn graph.hh:623 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_S_u_b_G_r_a_p_h │ │ │ │ -SubGraph(const Graph &graph, const T &excluded) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_b_e_g_i_n │ │ │ │ -ConstVertexIterator begin() const │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ -Graph::VertexDescriptor VertexDescriptor │ │ │ │ -The vertex descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:459 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ -VertexDescriptor * EdgeDescriptor │ │ │ │ -DDeeffiinniittiioonn graph.hh:461 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -An index map for mapping the edges to indices. │ │ │ │ -DDeeffiinniittiioonn graph.hh:470 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -EdgeIndexMap(const EdgeIndexMap &emap) │ │ │ │ -Protect copy construction. │ │ │ │ -DDeeffiinniittiioonn graph.hh:479 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_C_a_t_e_g_o_r_y │ │ │ │ -ReadablePropertyMapTag Category │ │ │ │ -DDeeffiinniittiioonn graph.hh:472 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_E_d_g_e_I_n_d_e_x_M_a_p │ │ │ │ -EdgeIndexMap(const EdgeDescriptor &firstEdge) │ │ │ │ -DDeeffiinniittiioonn graph.hh:474 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -std::size_t operator[](const EdgeDescriptor &edge) const │ │ │ │ -DDeeffiinniittiioonn graph.hh:483 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -The edge iterator of the graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:505 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ -const EdgeDescriptor & dereference() const │ │ │ │ -The descriptor of the current edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -EdgeIterator(const EdgeDescriptor &edge) │ │ │ │ -Constructor for the end iterator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ -bool equals(const EdgeIterator &other) const │ │ │ │ -Equality operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_a_d_v_a_n_c_e │ │ │ │ -EdgeIterator & advance(std::ptrdiff_t n) │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ -EdgeIterator & increment() │ │ │ │ -Preincrement operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_t_a_r_g_e_t │ │ │ │ -const VertexDescriptor & target() const │ │ │ │ -The index of the target vertex of the current edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_s_o_u_r_c_e │ │ │ │ -const VertexDescriptor & source() const │ │ │ │ -The index of the source vertex of the current edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_e_c_r_e_m_e_n_t │ │ │ │ -EdgeIterator & decrement() │ │ │ │ -Preincrement operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_d_i_s_t_a_n_c_e_T_o │ │ │ │ -std::ptrdiff_t distanceTo(const EdgeIterator &other) const │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -EdgeIterator(const VertexDescriptor &source, const EdgeDescriptor &edge) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -The vertex iterator of the graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:560 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIterator(const VertexDescriptor ¤t) │ │ │ │ -Constructor for end iterator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_i_n_c_r_e_m_e_n_t │ │ │ │ -VertexIterator & increment() │ │ │ │ -Preincrement operator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_b_e_g_i_n │ │ │ │ -EdgeIterator begin() const │ │ │ │ -Get an iterator over all edges starting at the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_e_q_u_a_l_s │ │ │ │ -bool equals(const VertexIterator &other) const │ │ │ │ -Equality iterator. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIterator(const SubGraph< G, T > *graph, const VertexDescriptor ¤t, │ │ │ │ -const VertexDescriptor &end) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_e_n_d │ │ │ │ -EdgeIterator end() const │ │ │ │ -Get an iterator over all edges starting at the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_u_b_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_:_:_d_e_r_e_f_e_r_e_n_c_e │ │ │ │ -const VertexDescriptor & dereference() const │ │ │ │ -Get the descriptor of the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -Attaches properties to the vertices of a graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:723 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_r_a_p_h │ │ │ │ -const Graph & graph() const │ │ │ │ -Get the graph the properties are attached to. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -Graph::ConstEdgeIterator ConstEdgeIterator │ │ │ │ -The type of the constant edge iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:766 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -VertexProperties & getVertexProperties(const VertexDescriptor &vertex) │ │ │ │ -Get the properties associated with a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ -std::size_t noEdges() const │ │ │ │ -Get the number of edges in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ -Graph::EdgeDescriptor EdgeDescriptor │ │ │ │ -The edge descritor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:738 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ -ConstEdgeIterator endEdges(const VertexDescriptor &source) const │ │ │ │ -Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ -Graph::VertexDescriptor VertexDescriptor │ │ │ │ -The vertex descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:733 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ -G Graph │ │ │ │ -The graph we attach properties to. │ │ │ │ -DDeeffiinniittiioonn graph.hh:728 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_M_a_p │ │ │ │ -VM VertexMap │ │ │ │ -The type of the map for converting the VertexDescriptor to std::size_t. │ │ │ │ -DDeeffiinniittiioonn graph.hh:756 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_e_n_d_E_d_g_e_s │ │ │ │ -EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ -Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ -EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ -Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -VP VertexProperties │ │ │ │ -The type of the properties of the vertices. │ │ │ │ -DDeeffiinniittiioonn graph.hh:743 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ -std::size_t noVertices() const │ │ │ │ -Get the number of vertices in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ -ConstEdgeIterator beginEdges(const VertexDescriptor &source) const │ │ │ │ -Get the mutable edge iterator over edges starting at a vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ -VertexDescriptor maxVertex() const │ │ │ │ -Get the maximal vertex descriptor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -Graph::EdgeIterator EdgeIterator │ │ │ │ -The type of the mutable edge iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:761 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -DDeeffiinniittiioonn graph.hh:803 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ -value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type │ │ │ │ -EdgeIterator │ │ │ │ -The class of the edge iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:823 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ -std::conditional< std::is_same< C, typenamestd::remove_const< C >::type >:: │ │ │ │ -value, VertexProperties &, constVertexProperties & >::type properties() const │ │ │ │ -Get the properties of the current Vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_e_n_d │ │ │ │ -EdgeIterator end() const │ │ │ │ -Get an iterator over the edges starting from the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ -std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ -value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >:: │ │ │ │ -type Father │ │ │ │ -The father class. │ │ │ │ -DDeeffiinniittiioonn graph.hh:814 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_b_e_g_i_n │ │ │ │ -EdgeIterator begin() const │ │ │ │ -Get an iterator over the edges starting from the current vertex. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -Attaches properties to the edges and vertices of a graph. │ │ │ │ -DDeeffiinniittiioonn graph.hh:978 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ -std::size_t noVertices() const │ │ │ │ -Get the number of vertices in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_D_e_s_c_r_i_p_t_o_r │ │ │ │ -Graph::EdgeDescriptor EdgeDescriptor │ │ │ │ -The edge descritor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:993 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -const EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const │ │ │ │ -VertexDescriptor &target) const │ │ │ │ -Get the properties associated with a edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -const EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) const │ │ │ │ -Get the properties associated with a edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_r_a_p_h │ │ │ │ -const Graph & graph() const │ │ │ │ -Get the graph the properties are attached to. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_m_a_x_V_e_r_t_e_x │ │ │ │ -VertexDescriptor maxVertex() const │ │ │ │ -Get the maximal vertex descriptor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_G_r_a_p_h │ │ │ │ -G Graph │ │ │ │ -The graph we attach properties to. │ │ │ │ -DDeeffiinniittiioonn graph.hh:983 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_M_a_p │ │ │ │ -EM EdgeMap │ │ │ │ -The type of the map for converting the EdgeDescriptor to std::size_t. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1030 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_M_a_p │ │ │ │ -VM VertexMap │ │ │ │ -The type of the map for converting the VertexDescriptor to std::size_t. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1011 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -VP VertexProperties │ │ │ │ -The type of the properties of the vertices. │ │ │ │ -DDeeffiinniittiioonn graph.hh:998 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_n_o_E_d_g_e_s │ │ │ │ -std::size_t noEdges() const │ │ │ │ -Get the number of edges in the graph. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -EP EdgeProperties │ │ │ │ -The type of the properties of the edges;. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1016 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -EdgeProperties & getEdgeProperties(const VertexDescriptor &source, const │ │ │ │ -VertexDescriptor &target) │ │ │ │ -Get the properties associated with a edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_g_e_t_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -EdgeProperties & getEdgeProperties(const EdgeDescriptor &edge) │ │ │ │ -Get the properties associated with a edge. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ -Graph::VertexDescriptor VertexDescriptor │ │ │ │ -The vertex descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:988 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h │ │ │ │ -PropertiesGraph(Graph &graph, const VertexMap &vmap=VertexMap(), const EdgeMap │ │ │ │ -&emap=EdgeMap()) │ │ │ │ -Constructor. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -DDeeffiinniittiioonn graph.hh:1038 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ -std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ -value, typenameGraph::EdgeIterator, typenameGraph::ConstEdgeIterator >::type │ │ │ │ -Father │ │ │ │ -The father class. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1050 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -DDeeffiinniittiioonn graph.hh:1140 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_F_a_t_h_e_r │ │ │ │ -std::conditional< std::is_same< typenamestd::remove_const< C >::type, C >:: │ │ │ │ -value, typenameGraph::VertexIterator, typenameGraph::ConstVertexIterator >:: │ │ │ │ -type Father │ │ │ │ -The father class. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1151 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -Wrapper to access the internal edge properties of a graph via operator[]() │ │ │ │ -DDeeffiinniittiioonn graph.hh:1361 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -GraphVertexPropertiesSelector(G &g) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1380 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -VertexProperties & operator[](const Vertex &vertex) const │ │ │ │ -Get the properties associated to a vertex. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1395 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h │ │ │ │ -G Graph │ │ │ │ -The type of the graph with internal properties. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1366 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -G::VertexProperties VertexProperties │ │ │ │ -The type of the vertex properties. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1370 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -GraphVertexPropertiesSelector() │ │ │ │ -Default constructor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1386 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_V_e_r_t_e_x │ │ │ │ -G::VertexDescriptor Vertex │ │ │ │ -The vertex descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1374 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -Wrapper to access the internal vertex properties of a graph via operator[]() │ │ │ │ -DDeeffiinniittiioonn graph.hh:1409 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -EdgeProperties & operator[](const Edge &edge) const │ │ │ │ -Get the properties associated to a vertex. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1442 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -G::EdgeProperties EdgeProperties │ │ │ │ -The type of the vertex properties. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1418 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_E_d_g_e │ │ │ │ -G::EdgeDescriptor Edge │ │ │ │ -The edge descriptor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1422 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -GraphEdgePropertiesSelector() │ │ │ │ -Default constructor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1434 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h │ │ │ │ -G Graph │ │ │ │ -The type of the graph with internal properties. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1414 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r_:_:_G_r_a_p_h_E_d_g_e_P_r_o_p_e_r_t_i_e_s_S_e_l_e_c_t_o_r │ │ │ │ -GraphEdgePropertiesSelector(G &g) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1428 │ │ │ │ +_D_u_n_e_:_:_o_p_e_r_a_t_o_r_<_< │ │ │ │ +std::ostream & operator<<(std::ostream &s, const BlockVector< K, A > &v) │ │ │ │ +Send BlockVector to an output stream. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:583 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +A vector of blocks with memory management. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +BlockVector() │ │ │ │ +makes empty vector │ │ │ │ +DDeeffiinniittiioonn bvector.hh:418 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ +Imp::block_vector_unmanaged< B, size_type >::ConstIterator ConstIterator │ │ │ │ +make iterators available as types │ │ │ │ +DDeeffiinniittiioonn bvector.hh:413 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_s_e_r_v_e │ │ │ │ +void reserve(size_type capacity) │ │ │ │ +Reserve space. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:468 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +BlockVector(BlockVector &&a) noexcept(noexcept(std::declval< BlockVector > │ │ │ │ +().swap(a))) │ │ │ │ +move constructor │ │ │ │ +DDeeffiinniittiioonn bvector.hh:512 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +BlockVector(size_type _n) │ │ │ │ +make vector with _n components │ │ │ │ +DDeeffiinniittiioonn bvector.hh:424 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ +void resize(size_type size) │ │ │ │ +Resize the vector. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:496 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_I_t_e_r_a_t_o_r │ │ │ │ +Imp::block_vector_unmanaged< B, size_type >::Iterator Iterator │ │ │ │ +make iterators available as types │ │ │ │ +DDeeffiinniittiioonn bvector.hh:410 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +BlockVector(const BlockVector &a) noexcept(noexcept(std::declval< BlockVector > │ │ │ │ +().storage_=a.storage_)) │ │ │ │ +copy constructor │ │ │ │ +DDeeffiinniittiioonn bvector.hh:504 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_a_l_l_o_c_a_t_o_r___t_y_p_e │ │ │ │ +A allocator_type │ │ │ │ +export the allocator type │ │ │ │ +DDeeffiinniittiioonn bvector.hh:404 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ +BlockVector & operator=(const BlockVector &a) noexcept(noexcept(std::declval< │ │ │ │ +BlockVector >().storage_=a.storage_)) │ │ │ │ +assignment │ │ │ │ +DDeeffiinniittiioonn bvector.hh:519 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ +export the type representing the field │ │ │ │ +DDeeffiinniittiioonn bvector.hh:398 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_s_i_z_e___t_y_p_e │ │ │ │ +A::size_type size_type │ │ │ │ +The type for the index access. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:407 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +BlockVector(std::initializer_list< B > const &l) │ │ │ │ +Construct from a std::initializer_list. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:430 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_c_a_p_a_c_i_t_y │ │ │ │ +size_type capacity() const │ │ │ │ +Get the capacity of the vector. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:481 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +BlockVector(size_type _n, S _capacity) │ │ │ │ +Make vector with _n components but preallocating capacity components. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:448 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ +B block_type │ │ │ │ +export the type representing the components │ │ │ │ +DDeeffiinniittiioonn bvector.hh:401 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_s_w_a_p │ │ │ │ +void swap(BlockVector &other) noexcept(noexcept(std::declval< BlockVector & > │ │ │ │ +().storage_.swap(other.storage_))) │ │ │ │ +swap operation │ │ │ │ +DDeeffiinniittiioonn bvector.hh:537 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ +FieldTraits< B >::real_type real_type │ │ │ │ +DDeeffiinniittiioonn bvector.hh:575 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_T_r_a_i_t_s_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +FieldTraits< B >::field_type field_type │ │ │ │ +DDeeffiinniittiioonn bvector.hh:574 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: globalaggregates.hh File Reference │ │ │ +dune-istl: foreach.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,61 +65,63 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Functions
│ │ │ +
foreach.hh File Reference
│ │ │ │ │ │
│ │ │ - │ │ │ -

Provdes class for identifying aggregates globally. │ │ │ -More...

│ │ │ -
#include "aggregates.hh"
│ │ │ -#include "pinfo.hh"
│ │ │ -#include <dune/common/parallel/indexset.hh>
│ │ │ +
#include <type_traits>
│ │ │ +#include <utility>
│ │ │ +#include <cassert>
│ │ │ +#include <dune/common/std/type_traits.hh>
│ │ │ +#include <dune/common/diagonalmatrix.hh>
│ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ +#include <dune/common/indices.hh>
│ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ +#include <dune/istl/scaledidmatrix.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Classes

struct  Dune::Amg::GlobalAggregatesMap< T, TI >
 
class  Dune::Amg::GlobalAggregatesMap< T, TI >::Proxy
 
struct  Dune::Amg::AggregatesGatherScatter< T, TI >
 
struct  Dune::Amg::AggregatesPublisher< T, O, I >
 
struct  Dune::Amg::AggregatesPublisher< T, O, OwnerOverlapCopyCommunication< T1, T2 > >
 Utility class for publishing the aggregate number of the DOFs in the overlap to other processors and convert them to local indices. More...
 
struct  Dune::Amg::AggregatesPublisher< T, O, SequentialInformation >
 
struct  Dune::CommPolicy< Amg::GlobalAggregatesMap< T, TI > >
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
namespace  Dune::ForEach
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

template<class Matrix >
auto Dune::ForEach::rows (Matrix const &matrix)
 
template<class Matrix >
auto Dune::ForEach::cols (Matrix const &matrix)
 
template<class Vector >
auto Dune::ForEach::size (Vector const &vector)
 
template<class Vector , class F >
std::size_t Dune::flatVectorForEach (Vector &&vector, F &&f, std::size_t offset=0)
 Traverse a blocked vector and call a functor at each scalar entry.
 
template<class Matrix , class F >
std::pair< std::size_t, std::size_t > Dune::flatMatrixForEach (Matrix &&matrix, F &&f, std::size_t rowOffset=0, std::size_t colOffset=0)
 Traverse a blocked matrix and call a functor at each scalar entry.
 
│ │ │ -

Detailed Description

│ │ │ -

Provdes class for identifying aggregates globally.

│ │ │ -
Author
Markus Blatt
│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,45 +1,51 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -globalaggregates.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provdes class for identifying aggregates globally. _M_o_r_e_._._. │ │ │ │ -#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ -#include "_p_i_n_f_o_._h_h" │ │ │ │ -#include │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +foreach.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_e_d_i_d_m_a_t_r_i_x_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ -CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _> │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_:_:_P_r_o_x_y │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_<_ _T_,_ _T_I_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _I_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_< │ │ │ │ - _T_1_,_ _T_2_ _>_ _> │ │ │ │ -  Utility class for publishing the aggregate number of the DOFs in the │ │ │ │ - overlap to other processors and convert them to local indices. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _> │ │ │ │ -  │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +namespace   _D_u_n_e_:_:_F_o_r_E_a_c_h │ │ │ │ +  │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ + auto  _D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_r_o_w_s (_M_a_t_r_i_x const │ │ │ │ + &matrix) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + auto  _D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_c_o_l_s (_M_a_t_r_i_x const │ │ │ │ + &matrix) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + auto  _D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_s_i_z_e (Vector const │ │ │ │ + &vector) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::size_t  _D_u_n_e_:_:_f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h (Vector │ │ │ │ + &&vector, F &&f, std::size_t offset=0) │ │ │ │ +  Traverse a blocked vector and call a │ │ │ │ + functor at each scalar entry. │ │ │ │ +  │ │ │ │ +template │ │ │ │ +std::pair< std::size_t, std::size_t >  _D_u_n_e_:_:_f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h (_M_a_t_r_i_x │ │ │ │ + &&matrix, F &&f, std::size_t │ │ │ │ + rowOffset=0, std::size_t colOffset=0) │ │ │ │ +  Traverse a blocked matrix and call a │ │ │ │ + functor at each scalar entry. │ │ │ │   │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provdes class for identifying aggregates globally. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: globalaggregates.hh Source File │ │ │ +dune-istl: foreach.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,342 +70,209 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
globalaggregates.hh
│ │ │ +
foreach.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ -
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ -
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_GLOBALAGGREGATES_HH
│ │ │ -
6#define DUNE_GLOBALAGGREGATES_HH
│ │ │ -
7
│ │ │ -
18#include "aggregates.hh"
│ │ │ -
19#include "pinfo.hh"
│ │ │ -
20#include <dune/common/parallel/indexset.hh>
│ │ │ -
21
│ │ │ -
22namespace Dune
│ │ │ -
23{
│ │ │ -
24 namespace Amg
│ │ │ -
25 {
│ │ │ -
26
│ │ │ -
27 template<typename T, typename TI>
│ │ │ -
│ │ │ - │ │ │ -
29 {
│ │ │ -
30 public:
│ │ │ -
31 typedef TI ParallelIndexSet;
│ │ │ -
32
│ │ │ -
33 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ -
34
│ │ │ -
35 typedef typename ParallelIndexSet::GlobalIndex IndexedType;
│ │ │ -
36
│ │ │ -
37 typedef typename ParallelIndexSet::LocalIndex LocalIndex;
│ │ │ -
38
│ │ │ -
39 typedef T Vertex;
│ │ │ +
3#pragma once
│ │ │ +
4
│ │ │ +
5#include<type_traits>
│ │ │ +
6#include<utility>
│ │ │ +
7#include<cassert>
│ │ │ +
8
│ │ │ +
9#include<dune/common/std/type_traits.hh>
│ │ │ +
10#include<dune/common/diagonalmatrix.hh>
│ │ │ +
11#include<dune/common/hybridutilities.hh>
│ │ │ +
12#include<dune/common/indices.hh>
│ │ │ +
13
│ │ │ + │ │ │ + │ │ │ +
16
│ │ │ +
17namespace Dune{
│ │ │ +
18
│ │ │ +
19 namespace Impl {
│ │ │ +
20
│ │ │ +
21 // stolen from dune-functions: we call a type "scalar" if it does not support index accessing
│ │ │ +
22 template<class C>
│ │ │ +
23 using StaticIndexAccessConcept = decltype(std::declval<C>()[Dune::Indices::_0]);
│ │ │ +
24
│ │ │ +
25 template<class C>
│ │ │ +
26 using IsScalar = std::negation<Dune::Std::is_detected<StaticIndexAccessConcept, std::remove_reference_t<C>>>;
│ │ │ +
27
│ │ │ +
28 // Type trait for matrix types that supports
│ │ │ +
29 // - iteration done row-wise
│ │ │ +
30 // - sparse iteration over nonzero entries
│ │ │ +
31 template <class T>
│ │ │ +
32 struct IsRowMajorSparse : std::false_type {};
│ │ │ +
33
│ │ │ +
34 // This is supported by the following matrix types:
│ │ │ +
35 template <class B, class A>
│ │ │ +
36 struct IsRowMajorSparse<BCRSMatrix<B,A>> : std::true_type {};
│ │ │ +
37
│ │ │ +
38 template <class K, int n>
│ │ │ +
39 struct IsRowMajorSparse<DiagonalMatrix<K,n>> : std::true_type {};
│ │ │
40
│ │ │ -
│ │ │ - │ │ │ -
42 const GlobalLookupIndexSet<ParallelIndexSet>& indexset)
│ │ │ -
43 : aggregates_(aggregates), indexset_(indexset)
│ │ │ -
44 {}
│ │ │ -
│ │ │ -
45
│ │ │ -
│ │ │ -
46 inline const GlobalIndex& operator[](std::size_t index) const
│ │ │ -
47 {
│ │ │ -
48 const Vertex& aggregate = aggregates_[index];
│ │ │ -
49 if(aggregate >= AggregatesMap<Vertex>::ISOLATED) {
│ │ │ -
50 assert(aggregate != AggregatesMap<Vertex>::UNAGGREGATED);
│ │ │ -
51 return isolatedMarker;
│ │ │ -
52 }else{
│ │ │ -
53 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
│ │ │ -
54 assert(pair!=0);
│ │ │ -
55 return pair->global();
│ │ │ -
56 }
│ │ │ -
57 }
│ │ │ -
│ │ │ -
58
│ │ │ +
41 template <class K, int n>
│ │ │ +
42 struct IsRowMajorSparse<ScaledIdentityMatrix<K,n>> : std::true_type {};
│ │ │ +
43
│ │ │ +
44
│ │ │ +
45 template <class Matrix>
│ │ │ +
46 auto rows(Matrix const& /*matrix*/, PriorityTag<2>) -> std::integral_constant<std::size_t, Matrix::N()> { return {}; }
│ │ │ +
47
│ │ │ +
48 template <class Matrix>
│ │ │ +
49 auto cols(Matrix const& /*matrix*/, PriorityTag<2>) -> std::integral_constant<std::size_t, Matrix::M()> { return {}; }
│ │ │ +
50
│ │ │ +
51 template <class Matrix>
│ │ │ +
52 auto rows(Matrix const& matrix, PriorityTag<1>) -> decltype(matrix.N()) { return matrix.N(); }
│ │ │ +
53
│ │ │ +
54 template <class Matrix>
│ │ │ +
55 auto cols(Matrix const& matrix, PriorityTag<1>) -> decltype(matrix.M()) { return matrix.M(); }
│ │ │ +
56
│ │ │ +
57 template <class Vector>
│ │ │ +
58 auto size(Vector const& /*vector*/, PriorityTag<2>) -> std::integral_constant<std::size_t, Vector::size()> { return {}; }
│ │ │
59
│ │ │ -
│ │ │ -
60 inline GlobalIndex& get(std::size_t index)
│ │ │ -
61 {
│ │ │ -
62 const Vertex& aggregate = aggregates_[index];
│ │ │ -
63 assert(aggregate < AggregatesMap<Vertex>::ISOLATED);
│ │ │ -
64 const Dune::IndexPair<GlobalIndex,LocalIndex >* pair = indexset_.pair(aggregate);
│ │ │ -
65 assert(pair!=0);
│ │ │ -
66 return const_cast<GlobalIndex&>(pair->global());
│ │ │ -
67 }
│ │ │ -
│ │ │ -
68
│ │ │ -
│ │ │ -
69 class Proxy
│ │ │ -
70 {
│ │ │ -
71 public:
│ │ │ -
│ │ │ -
72 Proxy(const GlobalLookupIndexSet<ParallelIndexSet>& indexset, Vertex& aggregate)
│ │ │ -
73 : indexset_(&indexset), aggregate_(&aggregate)
│ │ │ -
74 {}
│ │ │ -
│ │ │ -
75
│ │ │ -
│ │ │ -
76 Proxy& operator=(const GlobalIndex& global)
│ │ │ -
77 {
│ │ │ -
78 if(global==isolatedMarker)
│ │ │ - │ │ │ -
80 else{
│ │ │ -
81 //assert(global < AggregatesMap<Vertex>::ISOLATED);
│ │ │ -
82 *aggregate_ = indexset_->operator[](global).local();
│ │ │ -
83 }
│ │ │ -
84 return *this;
│ │ │ -
85 }
│ │ │ -
│ │ │ -
86 private:
│ │ │ -
87 const GlobalLookupIndexSet<ParallelIndexSet>* indexset_;
│ │ │ -
88 Vertex* aggregate_;
│ │ │ -
89 };
│ │ │ -
│ │ │ -
90
│ │ │ -
│ │ │ -
91 inline Proxy operator[](std::size_t index)
│ │ │ -
92 {
│ │ │ -
93 return Proxy(indexset_, aggregates_[index]);
│ │ │ -
94 }
│ │ │ -
│ │ │ -
95
│ │ │ -
│ │ │ -
96 inline void put(const GlobalIndex& global, size_t i)
│ │ │ -
97 {
│ │ │ -
98 aggregates_[i]=indexset_[global].local();
│ │ │ -
99
│ │ │ -
100 }
│ │ │ -
│ │ │ -
101
│ │ │ -
102 private:
│ │ │ -
103 AggregatesMap<Vertex>& aggregates_;
│ │ │ -
104 const GlobalLookupIndexSet<ParallelIndexSet>& indexset_;
│ │ │ -
105 static const GlobalIndex isolatedMarker;
│ │ │ -
106 };
│ │ │ -
│ │ │ -
107
│ │ │ -
108 template<typename T, typename TI>
│ │ │ -
109 const typename TI::GlobalIndex GlobalAggregatesMap<T,TI>::isolatedMarker =
│ │ │ -
110 std::numeric_limits<typename TI::GlobalIndex>::max();
│ │ │ -
111
│ │ │ -
112 template<typename T, typename TI>
│ │ │ -
│ │ │ - │ │ │ -
114 {
│ │ │ - │ │ │ -
116 typedef typename ParallelIndexSet::GlobalIndex GlobalIndex;
│ │ │ -
117
│ │ │ -
│ │ │ -
118 static const GlobalIndex& gather(const GlobalAggregatesMap<T,TI>& ga, size_t i)
│ │ │ -
119 {
│ │ │ -
120 return ga[i];
│ │ │ -
121 }
│ │ │ -
│ │ │ -
122
│ │ │ -
│ │ │ -
123 static void scatter(GlobalAggregatesMap<T,TI>& ga, GlobalIndex global, size_t i)
│ │ │ -
124 {
│ │ │ -
125 ga[i]=global;
│ │ │ -
126 }
│ │ │ -
│ │ │ -
127 };
│ │ │ -
│ │ │ -
128
│ │ │ -
129 template<typename T, typename O, typename I>
│ │ │ -
│ │ │ - │ │ │ -
131 {};
│ │ │ -
│ │ │ -
132
│ │ │ -
133#if HAVE_MPI
│ │ │ -
134
│ │ │ -
135#endif
│ │ │ -
136
│ │ │ -
137 } // namespace Amg
│ │ │ -
138
│ │ │ -
139#if HAVE_MPI
│ │ │ -
140 // forward declaration
│ │ │ -
141 template<class T1, class T2>
│ │ │ - │ │ │ -
143#endif
│ │ │ -
144
│ │ │ -
145 namespace Amg
│ │ │ -
146 {
│ │ │ +
60 template <class Vector>
│ │ │ +
61 auto size(Vector const& vector, PriorityTag<1>) -> decltype(vector.size()) { return vector.size(); }
│ │ │ +
62
│ │ │ +
63
│ │ │ +
64 } // end namespace Impl
│ │ │ +
65
│ │ │ +
│ │ │ +
66namespace ForEach{
│ │ │ +
67
│ │ │ +
68 template <class Matrix>
│ │ │ +
69 auto rows(Matrix const& matrix) { return Impl::rows(matrix, PriorityTag<5>{}); }
│ │ │ +
70
│ │ │ +
71 template <class Matrix>
│ │ │ +
72 auto cols(Matrix const& matrix) { return Impl::cols(matrix, PriorityTag<5>{}); }
│ │ │ +
73
│ │ │ +
74 template <class Vector>
│ │ │ +
75 auto size(Vector const& vector) { return Impl::size(vector, PriorityTag<5>{}); }
│ │ │ +
76
│ │ │ +
77} // namespace ForEach
│ │ │ +
│ │ │ +
78
│ │ │ +
79
│ │ │ +
80
│ │ │ +
81
│ │ │ +
94template <class Vector, class F>
│ │ │ +
│ │ │ +
95std::size_t flatVectorForEach(Vector&& vector, F&& f, std::size_t offset = 0)
│ │ │ +
96{
│ │ │ +
97 using V = std::decay_t<Vector>;
│ │ │ +
98 if constexpr( Impl::IsScalar<V>::value )
│ │ │ +
99 {
│ │ │ +
100 f(vector, offset);
│ │ │ +
101 return 1;
│ │ │ +
102 }
│ │ │ +
103 else
│ │ │ +
104 {
│ │ │ +
105 std::size_t idx = 0;
│ │ │ +
106 Hybrid::forEach(Dune::range(ForEach::size(vector)), [&](auto i) {
│ │ │ +
107 idx += flatVectorForEach(vector[i], f, offset + idx);
│ │ │ +
108 });
│ │ │ +
109 return idx;
│ │ │ +
110 }
│ │ │ +
111}
│ │ │ +
│ │ │ +
112
│ │ │ +
113
│ │ │ +
131template <class Matrix, class F>
│ │ │ +
│ │ │ +
132std::pair<std::size_t,std::size_t> flatMatrixForEach(Matrix&& matrix, F&& f, std::size_t rowOffset = 0, std::size_t colOffset = 0)
│ │ │ +
133{
│ │ │ +
134 using M = std::decay_t<Matrix>;
│ │ │ +
135 if constexpr ( Impl::IsScalar<M>::value )
│ │ │ +
136 {
│ │ │ +
137 f(matrix,rowOffset,colOffset);
│ │ │ +
138 return {1,1};
│ │ │ +
139 }
│ │ │ +
140 else
│ │ │ +
141 {
│ │ │ +
142 // if M supports the IsRowMajorSparse type trait: iterate just over the nonzero entries and
│ │ │ +
143 // and compute the flat row/col size directly
│ │ │ +
144 if constexpr ( Impl::IsRowMajorSparse<M>::value )
│ │ │ +
145 {
│ │ │ +
146 using Block = std::decay_t<decltype(matrix[0][0])>;
│ │ │
147
│ │ │ -
148#if HAVE_MPI
│ │ │ -
158 template<typename T, typename O, typename T1, typename T2>
│ │ │ -
│ │ │ - │ │ │ -
160 {
│ │ │ -
161 typedef T Vertex;
│ │ │ -
162 typedef O OverlapFlags;
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
166
│ │ │ -
│ │ │ -
167 static void publish(AggregatesMap<Vertex>& aggregates,
│ │ │ -
168 ParallelInformation& pinfo,
│ │ │ -
169 const GlobalLookupIndexSet& globalLookup)
│ │ │ -
170 {
│ │ │ - │ │ │ -
172 GlobalMap gmap(aggregates, globalLookup);
│ │ │ -
173 pinfo.copyOwnerToAll(gmap,gmap);
│ │ │ -
174 // communication only needed for ALU
│ │ │ -
175 // (ghosts with same global id as owners on the same process)
│ │ │ -
176 if (SolverCategory::category(pinfo) == static_cast<int>(SolverCategory::nonoverlapping))
│ │ │ -
177 pinfo.copyCopyToAll(gmap,gmap);
│ │ │ +
148 // find an existing block or at least try to create one
│ │ │ +
149 auto block = [&]{
│ │ │ +
150 for (auto const& row : matrix)
│ │ │ +
151 for (auto const& entry : row)
│ │ │ +
152 return entry;
│ │ │ +
153 return Block{};
│ │ │ +
154 }();
│ │ │ +
155
│ │ │ +
156 // compute the scalar size of the block
│ │ │ +
157 auto [blockRows, blockCols] = flatMatrixForEach(block, [](...){});
│ │ │ +
158
│ │ │ +
159 // check whether we have valid sized blocks
│ │ │ +
160 assert( ( blockRows!=0 or blockCols!=0 ) and "the block size can't be zero");
│ │ │ +
161
│ │ │ +
162 for (auto rowIt = matrix.begin(); rowIt != matrix.end(); ++rowIt)
│ │ │ +
163 {
│ │ │ +
164 auto&& row = *rowIt;
│ │ │ +
165 auto rowIdx = rowIt.index();
│ │ │ +
166 for (auto colIt = row.begin(); colIt != row.end(); colIt++)
│ │ │ +
167 {
│ │ │ +
168 auto&& entry = *colIt;
│ │ │ +
169 auto colIdx = colIt.index();
│ │ │ +
170#ifndef NDEBUG
│ │ │ +
171 // only instantiate return value in debug mode (for the assert)
│ │ │ +
172 auto [ numRows, numCols ] =
│ │ │ +
173#endif
│ │ │ +
174 flatMatrixForEach(entry, f, rowOffset + rowIdx*blockRows, colOffset + colIdx*blockCols);
│ │ │ +
175 assert( numRows == blockRows and numCols == blockCols and "we need the same size of each block in this matrix type");
│ │ │ +
176 }
│ │ │ +
177 }
│ │ │
178
│ │ │ -
179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists;
│ │ │ -
180 Lists lists = pinfo.remoteIndices().find(pinfo.communicator().rank());
│ │ │ -
181 if(lists!=pinfo.remoteIndices().end()) {
│ │ │ -
182
│ │ │ -
183 // For periodic boundary conditions we must renumber
│ │ │ -
184 // the aggregates of vertices in the overlap whose owners are
│ │ │ -
185 // on the same process
│ │ │ -
186 Vertex maxAggregate =0;
│ │ │ -
187 typedef typename AggregatesMap<Vertex>::const_iterator Iter;
│ │ │ -
188 for(Iter i=aggregates.begin(), end=aggregates.end(); i!=end; ++i)
│ │ │ -
189 maxAggregate = std::max(maxAggregate, *i);
│ │ │ -
190
│ │ │ -
191 // Compute new mapping of aggregates in the overlap that we also own
│ │ │ -
192 std::map<Vertex,Vertex> newMapping;
│ │ │ -
193
│ │ │ -
194 // insert all elements into map
│ │ │ -
195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList
│ │ │ -
196 ::const_iterator RIter;
│ │ │ -
197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
│ │ │ -
198 ri!=rend; ++ri)
│ │ │ -
199 if(O::contains(ri->localIndexPair().local().attribute()))
│ │ │ -
200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()],
│ │ │ -
201 maxAggregate));
│ │ │ -
202 // renumber
│ │ │ -
203 typedef typename std::map<Vertex,Vertex>::iterator MIter;
│ │ │ -
204 for(MIter mi=newMapping.begin(), mend=newMapping.end();
│ │ │ -
205 mi != mend; ++mi)
│ │ │ -
206 mi->second=++maxAggregate;
│ │ │ -
207
│ │ │ -
208
│ │ │ -
209 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end();
│ │ │ -
210 ri!=rend; ++ri)
│ │ │ -
211 if(O::contains(ri->localIndexPair().local().attribute()))
│ │ │ -
212 aggregates[ri->localIndexPair().local()] =
│ │ │ -
213 newMapping[aggregates[ri->localIndexPair().local()]];
│ │ │ -
214 }
│ │ │ -
215 }
│ │ │ -
│ │ │ -
216 };
│ │ │ -
│ │ │ -
217#endif
│ │ │ -
218
│ │ │ -
219 template<typename T, typename O>
│ │ │ -
│ │ │ - │ │ │ -
221 {
│ │ │ -
222 typedef T Vertex;
│ │ │ - │ │ │ - │ │ │ -
225
│ │ │ -
│ │ │ -
226 static void publish([[maybe_unused]] AggregatesMap<Vertex>& aggregates,
│ │ │ -
227 [[maybe_unused]] ParallelInformation& pinfo,
│ │ │ -
228 [[maybe_unused]] const GlobalLookupIndexSet& globalLookup)
│ │ │ -
229 {}
│ │ │ -
│ │ │ -
230 };
│ │ │ -
│ │ │ -
231
│ │ │ -
232 } // end Amg namespace
│ │ │ -
233
│ │ │ -
234
│ │ │ -
235#if HAVE_MPI
│ │ │ -
236 template<typename T, typename TI>
│ │ │ -
│ │ │ -
237 struct CommPolicy<Amg::GlobalAggregatesMap<T,TI> >
│ │ │ -
238 {
│ │ │ - │ │ │ - │ │ │ -
241 typedef SizeOne IndexedTypeFlag;
│ │ │ -
│ │ │ -
242 static int getSize(const Type&, int)
│ │ │ -
243 {
│ │ │ -
244 return 1;
│ │ │ -
245 }
│ │ │ -
│ │ │ -
246 };
│ │ │ -
│ │ │ -
247#endif
│ │ │ -
248
│ │ │ -
249} // end Dune namespace
│ │ │ -
251#endif
│ │ │ - │ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ -
const_iterator begin() const
Definition aggregates.hh:725
│ │ │ -
const_iterator end() const
Definition aggregates.hh:730
│ │ │ -
const AggregateDescriptor * const_iterator
Definition aggregates.hh:723
│ │ │ +
179 return { matrix.N()*blockRows, matrix.M()*blockCols };
│ │ │ +
180 }
│ │ │ +
181 // all other matrix types are accessed index-wise with dynamic flat row/col counting
│ │ │ +
182 else
│ │ │ +
183 {
│ │ │ +
184 std::size_t r = 0, c = 0;
│ │ │ +
185 std::size_t nRows, nCols;
│ │ │ +
186
│ │ │ +
187 Hybrid::forEach(Dune::range(ForEach::rows(matrix)), [&](auto i) {
│ │ │ +
188 c = 0;
│ │ │ +
189 Hybrid::forEach(Dune::range(ForEach::cols(matrix)), [&](auto j) {
│ │ │ +
190 std::tie(nRows,nCols) = flatMatrixForEach(matrix[i][j], f, rowOffset + r, colOffset + c);
│ │ │ +
191 c += nCols;
│ │ │ +
192 });
│ │ │ +
193 r += nRows;
│ │ │ +
194 });
│ │ │ +
195 return {r,c};
│ │ │ +
196 }
│ │ │ +
197 }
│ │ │ +
198}
│ │ │ +
│ │ │ +
199
│ │ │ +
200} // namespace Dune
│ │ │ +
Implementation of the BCRSMatrix class.
│ │ │ +
This file implements a quadratic matrix of fixed size which is a multiple of the identity.
│ │ │
Definition allocator.hh:11
│ │ │ -
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ -
void copyCopyToAll(const T &source, T &dest) const
Communicate values from copy data points to all other data points.
Definition owneroverlapcopy.hh:328
│ │ │ -
Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet
The type of the reverse lookup of indices.
Definition owneroverlapcopy.hh:456
│ │ │ -
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ -
void copyOwnerToAll(const T &source, T &dest) const
Communicate values from owner data points to all other data points.
Definition owneroverlapcopy.hh:311
│ │ │ -
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ -
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
Definition globalaggregates.hh:29
│ │ │ -
const GlobalIndex & operator[](std::size_t index) const
Definition globalaggregates.hh:46
│ │ │ -
GlobalIndex & get(std::size_t index)
Definition globalaggregates.hh:60
│ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:33
│ │ │ -
void put(const GlobalIndex &global, size_t i)
Definition globalaggregates.hh:96
│ │ │ -
T Vertex
Definition globalaggregates.hh:39
│ │ │ -
GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const GlobalLookupIndexSet< ParallelIndexSet > &indexset)
Definition globalaggregates.hh:41
│ │ │ -
TI ParallelIndexSet
Definition globalaggregates.hh:31
│ │ │ -
ParallelIndexSet::LocalIndex LocalIndex
Definition globalaggregates.hh:37
│ │ │ -
ParallelIndexSet::GlobalIndex IndexedType
Definition globalaggregates.hh:35
│ │ │ -
Proxy operator[](std::size_t index)
Definition globalaggregates.hh:91
│ │ │ -
Definition globalaggregates.hh:70
│ │ │ -
Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex &aggregate)
Definition globalaggregates.hh:72
│ │ │ -
Proxy & operator=(const GlobalIndex &global)
Definition globalaggregates.hh:76
│ │ │ -
Definition globalaggregates.hh:114
│ │ │ -
static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, size_t i)
Definition globalaggregates.hh:123
│ │ │ -
ParallelIndexSet::GlobalIndex GlobalIndex
Definition globalaggregates.hh:116
│ │ │ -
TI ParallelIndexSet
Definition globalaggregates.hh:115
│ │ │ -
static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, size_t i)
Definition globalaggregates.hh:118
│ │ │ -
Definition globalaggregates.hh:131
│ │ │ -
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:164
│ │ │ - │ │ │ - │ │ │ -
ParallelInformation::ParallelIndexSet IndexSet
Definition globalaggregates.hh:165
│ │ │ -
OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation
Definition globalaggregates.hh:163
│ │ │ -
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:167
│ │ │ -
static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation &pinfo, const GlobalLookupIndexSet &globalLookup)
Definition globalaggregates.hh:226
│ │ │ -
SequentialInformation ParallelInformation
Definition globalaggregates.hh:223
│ │ │ - │ │ │ -
ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet
Definition globalaggregates.hh:224
│ │ │ -
static int getSize(const Type &, int)
Definition globalaggregates.hh:242
│ │ │ -
Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType
Definition globalaggregates.hh:240
│ │ │ -
Amg::AggregatesMap< T > Type
Definition globalaggregates.hh:239
│ │ │ -
SizeOne IndexedTypeFlag
Definition globalaggregates.hh:241
│ │ │ -
Definition pinfo.hh:28
│ │ │ -
int GlobalLookupIndexSet
Definition pinfo.hh:54
│ │ │ -
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │ -
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ +
std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, std::size_t rowOffset=0, std::size_t colOffset=0)
Traverse a blocked matrix and call a functor at each scalar entry.
Definition foreach.hh:132
│ │ │ +
std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0)
Traverse a blocked vector and call a functor at each scalar entry.
Definition foreach.hh:95
│ │ │ +
auto rows(Matrix const &matrix)
Definition foreach.hh:69
│ │ │ +
auto cols(Matrix const &matrix)
Definition foreach.hh:72
│ │ │ +
auto size(Vector const &vector)
Definition foreach.hh:75
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
size_type M() const
Return the number of columns.
Definition matrix.hh:696
│ │ │ +
size_type N() const
Return the number of rows.
Definition matrix.hh:691
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,423 +1,237 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -globalaggregates.hh │ │ │ │ +foreach.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ -3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ -4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_GLOBALAGGREGATES_HH │ │ │ │ -6#define DUNE_GLOBALAGGREGATES_HH │ │ │ │ -7 │ │ │ │ -18#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ -19#include "_p_i_n_f_o_._h_h" │ │ │ │ -20#include │ │ │ │ -21 │ │ │ │ -22namespace _D_u_n_e │ │ │ │ -23{ │ │ │ │ -24 namespace Amg │ │ │ │ -25 { │ │ │ │ -26 │ │ │ │ -27 template │ │ │ │ -_2_8 struct _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -29 { │ │ │ │ -30 public: │ │ │ │ -_3_1 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ -32 │ │ │ │ -_3_3 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ -34 │ │ │ │ -_3_5 typedef typename ParallelIndexSet::GlobalIndex _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ -36 │ │ │ │ -_3_7 typedef typename ParallelIndexSet::LocalIndex _L_o_c_a_l_I_n_d_e_x; │ │ │ │ -38 │ │ │ │ -_3_9 typedef T _V_e_r_t_e_x; │ │ │ │ +3#pragma once │ │ │ │ +4 │ │ │ │ +5#include │ │ │ │ +6#include │ │ │ │ +7#include │ │ │ │ +8 │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13 │ │ │ │ +14#include<_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +15#include<_d_u_n_e_/_i_s_t_l_/_s_c_a_l_e_d_i_d_m_a_t_r_i_x_._h_h> │ │ │ │ +16 │ │ │ │ +17namespace _D_u_n_e{ │ │ │ │ +18 │ │ │ │ +19 namespace Impl { │ │ │ │ +20 │ │ │ │ +21 // stolen from dune-functions: we call a type "scalar" if it does not │ │ │ │ +support index accessing │ │ │ │ +22 template │ │ │ │ +23 using StaticIndexAccessConcept = decltype(std::declval()[Dune::Indices:: │ │ │ │ +_0]); │ │ │ │ +24 │ │ │ │ +25 template │ │ │ │ +26 using IsScalar = std::negation>>; │ │ │ │ +27 │ │ │ │ +28 // Type trait for matrix types that supports │ │ │ │ +29 // - iteration done row-wise │ │ │ │ +30 // - sparse iteration over nonzero entries │ │ │ │ +31 template │ │ │ │ +32 struct IsRowMajorSparse : std::false_type {}; │ │ │ │ +33 │ │ │ │ +34 // This is supported by the following matrix types: │ │ │ │ +35 template │ │ │ │ +36 struct IsRowMajorSparse> : std::true_type {}; │ │ │ │ +37 │ │ │ │ +38 template │ │ │ │ +39 struct IsRowMajorSparse> : std::true_type {}; │ │ │ │ 40 │ │ │ │ -_4_1 _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -42 const GlobalLookupIndexSet& indexset) │ │ │ │ -43 : aggregates_(aggregates), indexset_(indexset) │ │ │ │ -44 {} │ │ │ │ -45 │ │ │ │ -_4_6 inline const _G_l_o_b_a_l_I_n_d_e_x& _o_p_e_r_a_t_o_r_[_](std::size_t index) const │ │ │ │ -47 { │ │ │ │ -48 const _V_e_r_t_e_x& aggregate = aggregates_[index]; │ │ │ │ -49 if(aggregate >= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ -50 assert(aggregate != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ -51 return isolatedMarker; │ │ │ │ -52 }else{ │ │ │ │ -53 const Dune::IndexPair* pair = indexset_.pair │ │ │ │ -(aggregate); │ │ │ │ -54 assert(pair!=0); │ │ │ │ -55 return pair->global(); │ │ │ │ -56 } │ │ │ │ -57 } │ │ │ │ -58 │ │ │ │ +41 template │ │ │ │ +42 struct IsRowMajorSparse> : std::true_type {}; │ │ │ │ +43 │ │ │ │ +44 │ │ │ │ +45 template │ │ │ │ +46 auto rows(Matrix const& /*matrix*/, PriorityTag<2>) -> std:: │ │ │ │ +integral_constant { return {}; } │ │ │ │ +47 │ │ │ │ +48 template │ │ │ │ +49 auto cols(Matrix const& /*matrix*/, PriorityTag<2>) -> std:: │ │ │ │ +integral_constant { return {}; } │ │ │ │ +50 │ │ │ │ +51 template │ │ │ │ +52 auto rows(Matrix const& matrix, PriorityTag<1>) -> decltype(matrix.N()) │ │ │ │ +{ return matrix.N(); } │ │ │ │ +53 │ │ │ │ +54 template │ │ │ │ +55 auto cols(Matrix const& matrix, PriorityTag<1>) -> decltype(matrix.M()) │ │ │ │ +{ return matrix.M(); } │ │ │ │ +56 │ │ │ │ +57 template │ │ │ │ +58 auto size(Vector const& /*vector*/, PriorityTag<2>) -> std:: │ │ │ │ +integral_constant { return {}; } │ │ │ │ 59 │ │ │ │ -_6_0 inline _G_l_o_b_a_l_I_n_d_e_x& _g_e_t(std::size_t index) │ │ │ │ -61 { │ │ │ │ -62 const _V_e_r_t_e_x& aggregate = aggregates_[index]; │ │ │ │ -63 assert(aggregate < _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D); │ │ │ │ -64 const Dune::IndexPair* pair = indexset_.pair │ │ │ │ -(aggregate); │ │ │ │ -65 assert(pair!=0); │ │ │ │ -66 return const_cast<_G_l_o_b_a_l_I_n_d_e_x&>(pair->global()); │ │ │ │ -67 } │ │ │ │ -68 │ │ │ │ -_6_9 class _P_r_o_x_y │ │ │ │ -70 { │ │ │ │ -71 public: │ │ │ │ -_7_2 _P_r_o_x_y(const GlobalLookupIndexSet& indexset, _V_e_r_t_e_x& │ │ │ │ -aggregate) │ │ │ │ -73 : indexset_(&indexset), aggregate_(&aggregate) │ │ │ │ -74 {} │ │ │ │ -75 │ │ │ │ -_7_6 _P_r_o_x_y& _o_p_e_r_a_t_o_r_=(const _G_l_o_b_a_l_I_n_d_e_x& global) │ │ │ │ -77 { │ │ │ │ -78 if(global==isolatedMarker) │ │ │ │ -79 *aggregate_ = _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D; │ │ │ │ -80 else{ │ │ │ │ -81 //assert(global < AggregatesMap::ISOLATED); │ │ │ │ -82 *aggregate_ = indexset_->operator[](global).local(); │ │ │ │ -83 } │ │ │ │ -84 return *this; │ │ │ │ -85 } │ │ │ │ -86 private: │ │ │ │ -87 const GlobalLookupIndexSet* indexset_; │ │ │ │ -88 _V_e_r_t_e_x* aggregate_; │ │ │ │ -89 }; │ │ │ │ -90 │ │ │ │ -_9_1 inline _P_r_o_x_y _o_p_e_r_a_t_o_r_[_](std::size_t index) │ │ │ │ -92 { │ │ │ │ -93 return _P_r_o_x_y(indexset_, aggregates_[index]); │ │ │ │ -94 } │ │ │ │ -95 │ │ │ │ -_9_6 inline void _p_u_t(const _G_l_o_b_a_l_I_n_d_e_x& global, size_t i) │ │ │ │ -97 { │ │ │ │ -98 aggregates_[i]=indexset_[global].local(); │ │ │ │ -99 │ │ │ │ -100 } │ │ │ │ -101 │ │ │ │ -102 private: │ │ │ │ -103 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ -104 const GlobalLookupIndexSet& indexset_; │ │ │ │ -105 static const _G_l_o_b_a_l_I_n_d_e_x isolatedMarker; │ │ │ │ -106 }; │ │ │ │ -107 │ │ │ │ -108 template │ │ │ │ -109 const typename TI::GlobalIndex GlobalAggregatesMap::isolatedMarker = │ │ │ │ -110 std::numeric_limits::max(); │ │ │ │ -111 │ │ │ │ -112 template │ │ │ │ -_1_1_3 struct _A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ -114 { │ │ │ │ -_1_1_5 typedef TI _P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t; │ │ │ │ -_1_1_6 typedef typename ParallelIndexSet::GlobalIndex _G_l_o_b_a_l_I_n_d_e_x; │ │ │ │ -117 │ │ │ │ -_1_1_8 static const _G_l_o_b_a_l_I_n_d_e_x& _g_a_t_h_e_r(const _G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, │ │ │ │ -size_t i) │ │ │ │ -119 { │ │ │ │ -120 return ga[i]; │ │ │ │ -121 } │ │ │ │ -122 │ │ │ │ -_1_2_3 static void _s_c_a_t_t_e_r(_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>& ga, _G_l_o_b_a_l_I_n_d_e_x global, │ │ │ │ -size_t i) │ │ │ │ -124 { │ │ │ │ -125 ga[i]=global; │ │ │ │ -126 } │ │ │ │ -127 }; │ │ │ │ -128 │ │ │ │ -129 template │ │ │ │ -_1_3_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ -131 {}; │ │ │ │ -132 │ │ │ │ -133#if HAVE_MPI │ │ │ │ -134 │ │ │ │ -135#endif │ │ │ │ -136 │ │ │ │ -137 } // namespace Amg │ │ │ │ -138 │ │ │ │ -139#if HAVE_MPI │ │ │ │ -140 // forward declaration │ │ │ │ -141 template │ │ │ │ -142 class _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n; │ │ │ │ -143#endif │ │ │ │ -144 │ │ │ │ -145 namespace Amg │ │ │ │ -146 { │ │ │ │ +60 template │ │ │ │ +61 auto size(Vector const& vector, PriorityTag<1>) -> decltype(vector.size()) │ │ │ │ +{ return vector.size(); } │ │ │ │ +62 │ │ │ │ +63 │ │ │ │ +64 } // end namespace Impl │ │ │ │ +65 │ │ │ │ +_6_6namespace ForEach{ │ │ │ │ +67 │ │ │ │ +68 template │ │ │ │ +_6_9 auto _r_o_w_s(_M_a_t_r_i_x const& matrix) { return Impl::rows(matrix, PriorityTag<5> │ │ │ │ +{}); } │ │ │ │ +70 │ │ │ │ +71 template │ │ │ │ +_7_2 auto _c_o_l_s(_M_a_t_r_i_x const& matrix) { return Impl::cols(matrix, PriorityTag<5> │ │ │ │ +{}); } │ │ │ │ +73 │ │ │ │ +74 template │ │ │ │ +_7_5 auto _s_i_z_e(Vector const& vector) { return Impl::size(vector, PriorityTag<5> │ │ │ │ +{}); } │ │ │ │ +76 │ │ │ │ +77} // namespace ForEach │ │ │ │ +78 │ │ │ │ +79 │ │ │ │ +80 │ │ │ │ +81 │ │ │ │ +94template │ │ │ │ +_9_5std::size_t _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(Vector&& vector, F&& f, std::size_t offset = 0) │ │ │ │ +96{ │ │ │ │ +97 using V = std::decay_t; │ │ │ │ +98 if constexpr( Impl::IsScalar::value ) │ │ │ │ +99 { │ │ │ │ +100 f(vector, offset); │ │ │ │ +101 return 1; │ │ │ │ +102 } │ │ │ │ +103 else │ │ │ │ +104 { │ │ │ │ +105 std::size_t idx = 0; │ │ │ │ +106 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_s_i_z_e(vector)), [&](auto i) { │ │ │ │ +107 idx += _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(vector[i], f, offset + idx); │ │ │ │ +108 }); │ │ │ │ +109 return idx; │ │ │ │ +110 } │ │ │ │ +111} │ │ │ │ +112 │ │ │ │ +113 │ │ │ │ +131template │ │ │ │ +_1_3_2std::pair _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(_M_a_t_r_i_x&& matrix, F&& f, │ │ │ │ +std::size_t rowOffset = 0, std::size_t colOffset = 0) │ │ │ │ +133{ │ │ │ │ +134 using M = std::decay_t; │ │ │ │ +135 if constexpr ( Impl::IsScalar::value ) │ │ │ │ +136 { │ │ │ │ +137 f(matrix,rowOffset,colOffset); │ │ │ │ +138 return {1,1}; │ │ │ │ +139 } │ │ │ │ +140 else │ │ │ │ +141 { │ │ │ │ +142 // if M supports the IsRowMajorSparse type trait: iterate just over the │ │ │ │ +nonzero entries and │ │ │ │ +143 // and compute the flat row/col size directly │ │ │ │ +144 if constexpr ( Impl::IsRowMajorSparse::value ) │ │ │ │ +145 { │ │ │ │ +146 using Block = std::decay_t; │ │ │ │ 147 │ │ │ │ -148#if HAVE_MPI │ │ │ │ -158 template │ │ │ │ -_1_5_9 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r > │ │ │ │ -160 { │ │ │ │ -_1_6_1 typedef T _V_e_r_t_e_x; │ │ │ │ -_1_6_2 typedef O _O_v_e_r_l_a_p_F_l_a_g_s; │ │ │ │ -_1_6_3 typedef _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_T_1_,_T_2_> _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -_1_6_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ -_1_6_5 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t _I_n_d_e_x_S_e_t; │ │ │ │ -166 │ │ │ │ -_1_6_7 static void _p_u_b_l_i_s_h(_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -168 _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -169 const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ -170 { │ │ │ │ -171 typedef _D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_,_I_n_d_e_x_S_e_t_> GlobalMap; │ │ │ │ -172 GlobalMap gmap(aggregates, globalLookup); │ │ │ │ -173 pinfo._c_o_p_y_O_w_n_e_r_T_o_A_l_l(gmap,gmap); │ │ │ │ -174 // communication only needed for ALU │ │ │ │ -175 // (ghosts with same global id as owners on the same process) │ │ │ │ -176 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo) == static_cast(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ -_n_o_n_o_v_e_r_l_a_p_p_i_n_g)) │ │ │ │ -177 pinfo._c_o_p_y_C_o_p_y_T_o_A_l_l(gmap,gmap); │ │ │ │ +148 // find an existing block or at least try to create one │ │ │ │ +149 auto block = [&]{ │ │ │ │ +150 for (auto const& row : matrix) │ │ │ │ +151 for (auto const& entry : row) │ │ │ │ +152 return entry; │ │ │ │ +153 return Block{}; │ │ │ │ +154 }(); │ │ │ │ +155 │ │ │ │ +156 // compute the scalar size of the block │ │ │ │ +157 auto [blockRows, blockCols] = _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(block, [](...){}); │ │ │ │ +158 │ │ │ │ +159 // check whether we have valid sized blocks │ │ │ │ +160 assert( ( blockRows!=0 or blockCols!=0 ) and "the block size can't be │ │ │ │ +zero"); │ │ │ │ +161 │ │ │ │ +162 for (auto rowIt = matrix.begin(); rowIt != matrix.end(); ++rowIt) │ │ │ │ +163 { │ │ │ │ +164 auto&& row = *rowIt; │ │ │ │ +165 auto rowIdx = rowIt.index(); │ │ │ │ +166 for (auto colIt = row.begin(); colIt != row.end(); colIt++) │ │ │ │ +167 { │ │ │ │ +168 auto&& entry = *colIt; │ │ │ │ +169 auto colIdx = colIt.index(); │ │ │ │ +170#ifndef NDEBUG │ │ │ │ +171 // only instantiate return value in debug mode (for the assert) │ │ │ │ +172 auto [ numRows, numCols ] = │ │ │ │ +173#endif │ │ │ │ +174 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(entry, f, rowOffset + rowIdx*blockRows, colOffset + │ │ │ │ +colIdx*blockCols); │ │ │ │ +175 assert( numRows == blockRows and numCols == blockCols and "we need the same │ │ │ │ +size of each block in this matrix type"); │ │ │ │ +176 } │ │ │ │ +177 } │ │ │ │ 178 │ │ │ │ -179 typedef typename ParallelInformation::RemoteIndices::const_iterator Lists; │ │ │ │ -180 Lists lists = pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().find(pinfo._c_o_m_m_u_n_i_c_a_t_o_r().rank()); │ │ │ │ -181 if(lists!=pinfo._r_e_m_o_t_e_I_n_d_i_c_e_s().end()) { │ │ │ │ -182 │ │ │ │ -183 // For periodic boundary conditions we must renumber │ │ │ │ -184 // the aggregates of vertices in the overlap whose owners are │ │ │ │ -185 // on the same process │ │ │ │ -186 _V_e_r_t_e_x maxAggregate =0; │ │ │ │ -187 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r Iter; │ │ │ │ -188 for(Iter i=aggregates._b_e_g_i_n(), end=aggregates._e_n_d(); i!=end; ++i) │ │ │ │ -189 maxAggregate = std::max(maxAggregate, *i); │ │ │ │ -190 │ │ │ │ -191 // Compute new mapping of aggregates in the overlap that we also own │ │ │ │ -192 std::map newMapping; │ │ │ │ -193 │ │ │ │ -194 // insert all elements into map │ │ │ │ -195 typedef typename ParallelInformation::RemoteIndices::RemoteIndexList │ │ │ │ -196 ::const_iterator RIter; │ │ │ │ -197 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ -(); │ │ │ │ -198 ri!=rend; ++ri) │ │ │ │ -199 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ -200 newMapping.insert(std::make_pair(aggregates[ri->localIndexPair().local()], │ │ │ │ -201 maxAggregate)); │ │ │ │ -202 // renumber │ │ │ │ -203 typedef typename std::map::iterator MIter; │ │ │ │ -204 for(MIter mi=newMapping.begin(), mend=newMapping.end(); │ │ │ │ -205 mi != mend; ++mi) │ │ │ │ -206 mi->second=++maxAggregate; │ │ │ │ -207 │ │ │ │ -208 │ │ │ │ -209 for(RIter ri=lists->second.first->begin(), rend = lists->second.first->end │ │ │ │ -(); │ │ │ │ -210 ri!=rend; ++ri) │ │ │ │ -211 if(O::contains(ri->localIndexPair().local().attribute())) │ │ │ │ -212 aggregates[ri->localIndexPair().local()] = │ │ │ │ -213 newMapping[aggregates[ri->localIndexPair().local()]]; │ │ │ │ -214 } │ │ │ │ -215 } │ │ │ │ -216 }; │ │ │ │ -217#endif │ │ │ │ -218 │ │ │ │ -219 template │ │ │ │ -_2_2_0 struct _A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ -221 { │ │ │ │ -_2_2_2 typedef T _V_e_r_t_e_x; │ │ │ │ -_2_2_3 typedef _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -_2_2_4 typedef typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t; │ │ │ │ -225 │ │ │ │ -_2_2_6 static void _p_u_b_l_i_s_h([[maybe_unused]] _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -227 [[maybe_unused]] _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -228 [[maybe_unused]] const _G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t& globalLookup) │ │ │ │ -229 {} │ │ │ │ -230 }; │ │ │ │ -231 │ │ │ │ -232 } // end Amg namespace │ │ │ │ -233 │ │ │ │ -234 │ │ │ │ -235#if HAVE_MPI │ │ │ │ -236 template │ │ │ │ -_2_3_7 struct CommPolicy > │ │ │ │ -238 { │ │ │ │ -_2_3_9 typedef _A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_> _T_y_p_e; │ │ │ │ -_2_4_0 typedef typename _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_T_,_T_I_>_:_:_I_n_d_e_x_e_d_T_y_p_e _I_n_d_e_x_e_d_T_y_p_e; │ │ │ │ -_2_4_1 typedef SizeOne _I_n_d_e_x_e_d_T_y_p_e_F_l_a_g; │ │ │ │ -_2_4_2 static int _g_e_t_S_i_z_e(const _T_y_p_e&, int) │ │ │ │ -243 { │ │ │ │ -244 return 1; │ │ │ │ -245 } │ │ │ │ -246 }; │ │ │ │ -247#endif │ │ │ │ -248 │ │ │ │ -249} // end Dune namespace │ │ │ │ -251#endif │ │ │ │ -_p_i_n_f_o_._h_h │ │ │ │ -_a_g_g_r_e_g_a_t_e_s_._h_h │ │ │ │ -Provides classes for the Coloring process of AMG. │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_b_e_g_i_n │ │ │ │ -const_iterator begin() const │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:725 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_e_n_d │ │ │ │ -const_iterator end() const │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:730 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_c_o_n_s_t___i_t_e_r_a_t_o_r │ │ │ │ -const AggregateDescriptor * const_iterator │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:723 │ │ │ │ +179 return { matrix.N()*blockRows, matrix.M()*blockCols }; │ │ │ │ +180 } │ │ │ │ +181 // all other matrix types are accessed index-wise with dynamic flat row/col │ │ │ │ +counting │ │ │ │ +182 else │ │ │ │ +183 { │ │ │ │ +184 std::size_t r = 0, c = 0; │ │ │ │ +185 std::size_t nRows, nCols; │ │ │ │ +186 │ │ │ │ +187 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_r_o_w_s(matrix)), [&](auto i) { │ │ │ │ +188 c = 0; │ │ │ │ +189 Hybrid::forEach(Dune::range(_F_o_r_E_a_c_h_:_:_c_o_l_s(matrix)), [&](auto j) { │ │ │ │ +190 std::tie(nRows,nCols) = _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix[i][j], f, rowOffset + r, │ │ │ │ +colOffset + c); │ │ │ │ +191 c += nCols; │ │ │ │ +192 }); │ │ │ │ +193 r += nRows; │ │ │ │ +194 }); │ │ │ │ +195 return {r,c}; │ │ │ │ +196 } │ │ │ │ +197 } │ │ │ │ +198} │ │ │ │ +199 │ │ │ │ +200} // namespace Dune │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ +_s_c_a_l_e_d_i_d_m_a_t_r_i_x_._h_h │ │ │ │ +This file implements a quadratic matrix of fixed size which is a multiple of │ │ │ │ +the identity. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ -A class setting up standard communication for a two-valued attribute set with │ │ │ │ -owner/overlap/copy sema... │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_C_o_p_y_T_o_A_l_l │ │ │ │ -void copyCopyToAll(const T &source, T &dest) const │ │ │ │ -Communicate values from copy data points to all other data points. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:328 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ -The type of the reverse lookup of indices. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:456 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ -const Communication< MPI_Comm > & communicator() const │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_p_y_O_w_n_e_r_T_o_A_l_l │ │ │ │ -void copyOwnerToAll(const T &source, T &dest) const │ │ │ │ -Communicate values from owner data points to all other data points. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:311 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ -const RemoteIndices & remoteIndices() const │ │ │ │ -Get the underlying remote indices. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ -_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ -Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ -The type of the parallel index set. │ │ │ │ -DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:29 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -const GlobalIndex & operator[](std::size_t index) const │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:46 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_g_e_t │ │ │ │ -GlobalIndex & get(std::size_t index) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:60 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ -ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:33 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_p_u_t │ │ │ │ -void put(const GlobalIndex &global, size_t i) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:96 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_V_e_r_t_e_x │ │ │ │ -T Vertex │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:39 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -GlobalAggregatesMap(AggregatesMap< Vertex > &aggregates, const │ │ │ │ -GlobalLookupIndexSet< ParallelIndexSet > &indexset) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:41 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ -TI ParallelIndexSet │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:31 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_L_o_c_a_l_I_n_d_e_x │ │ │ │ -ParallelIndexSet::LocalIndex LocalIndex │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:37 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ -ParallelIndexSet::GlobalIndex IndexedType │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:35 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_o_p_e_r_a_t_o_r_[_] │ │ │ │ -Proxy operator[](std::size_t index) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:91 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:70 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y_:_:_P_r_o_x_y │ │ │ │ -Proxy(const GlobalLookupIndexSet< ParallelIndexSet > &indexset, Vertex │ │ │ │ -&aggregate) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:72 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_P_r_o_x_y_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ -Proxy & operator=(const GlobalIndex &global) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:76 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:114 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_s_c_a_t_t_e_r │ │ │ │ -static void scatter(GlobalAggregatesMap< T, TI > &ga, GlobalIndex global, │ │ │ │ -size_t i) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:123 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_G_l_o_b_a_l_I_n_d_e_x │ │ │ │ -ParallelIndexSet::GlobalIndex GlobalIndex │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:116 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ -TI ParallelIndexSet │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:115 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_G_a_t_h_e_r_S_c_a_t_t_e_r_:_:_g_a_t_h_e_r │ │ │ │ -static const GlobalIndex & gather(const GlobalAggregatesMap< T, TI > &ga, │ │ │ │ -size_t i) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:118 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:131 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ -_>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:164 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ -_>_:_:_O_v_e_r_l_a_p_F_l_a_g_s │ │ │ │ -O OverlapFlags │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:162 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ -_>_:_:_V_e_r_t_e_x │ │ │ │ -T Vertex │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:161 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ -_>_:_:_I_n_d_e_x_S_e_t │ │ │ │ -ParallelInformation::ParallelIndexSet IndexSet │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:165 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ -_>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > ParallelInformation │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:163 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_ _T_1_,_ _T_2_ _> │ │ │ │ -_>_:_:_p_u_b_l_i_s_h │ │ │ │ -static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation │ │ │ │ -&pinfo, const GlobalLookupIndexSet &globalLookup) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:167 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_p_u_b_l_i_s_h │ │ │ │ -static void publish(AggregatesMap< Vertex > &aggregates, ParallelInformation │ │ │ │ -&pinfo, const GlobalLookupIndexSet &globalLookup) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:226 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_: │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -SequentialInformation ParallelInformation │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:223 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_:_V_e_r_t_e_x │ │ │ │ -T Vertex │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:222 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_P_u_b_l_i_s_h_e_r_<_ _T_,_ _O_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _>_:_: │ │ │ │ -_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -ParallelInformation::GlobalLookupIndexSet GlobalLookupIndexSet │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:224 │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_g_e_t_S_i_z_e │ │ │ │ -static int getSize(const Type &, int) │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:242 │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e │ │ │ │ -Amg::GlobalAggregatesMap< T, TI >::IndexedType IndexedType │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:240 │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_T_y_p_e │ │ │ │ -Amg::AggregatesMap< T > Type │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:239 │ │ │ │ -_D_u_n_e_:_:_C_o_m_m_P_o_l_i_c_y_<_ _A_m_g_:_:_G_l_o_b_a_l_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_,_ _T_I_ _>_ _>_:_:_I_n_d_e_x_e_d_T_y_p_e_F_l_a_g │ │ │ │ -SizeOne IndexedTypeFlag │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:241 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -int GlobalLookupIndexSet │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:54 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_n_o_n_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ -@ nonoverlapping │ │ │ │ -Category for non-overlapping solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:27 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ -static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ -Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ -newly introduced virtu... │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ +_D_u_n_e_:_:_f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h │ │ │ │ +std::pair< std::size_t, std::size_t > flatMatrixForEach(Matrix &&matrix, F &&f, │ │ │ │ +std::size_t rowOffset=0, std::size_t colOffset=0) │ │ │ │ +Traverse a blocked matrix and call a functor at each scalar entry. │ │ │ │ +DDeeffiinniittiioonn foreach.hh:132 │ │ │ │ +_D_u_n_e_:_:_f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h │ │ │ │ +std::size_t flatVectorForEach(Vector &&vector, F &&f, std::size_t offset=0) │ │ │ │ +Traverse a blocked vector and call a functor at each scalar entry. │ │ │ │ +DDeeffiinniittiioonn foreach.hh:95 │ │ │ │ +_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_r_o_w_s │ │ │ │ +auto rows(Matrix const &matrix) │ │ │ │ +DDeeffiinniittiioonn foreach.hh:69 │ │ │ │ +_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_c_o_l_s │ │ │ │ +auto cols(Matrix const &matrix) │ │ │ │ +DDeeffiinniittiioonn foreach.hh:72 │ │ │ │ +_D_u_n_e_:_:_F_o_r_E_a_c_h_:_:_s_i_z_e │ │ │ │ +auto size(Vector const &vector) │ │ │ │ +DDeeffiinniittiioonn foreach.hh:75 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_M │ │ │ │ +size_type M() const │ │ │ │ +Return the number of columns. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:696 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_N │ │ │ │ +size_type N() const │ │ │ │ +Return the number of rows. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:691 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: galerkin.hh File Reference │ │ │ +dune-istl: ldl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,74 +65,71 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ - │ │ │ +Namespaces | │ │ │ +Functions
│ │ │ + │ │ │ │ │ │
│ │ │ │ │ │ -

Provides a class for building the galerkin product based on a aggregation scheme. │ │ │ +

Class for using LDL with ISTL matrices. │ │ │ More...

│ │ │ -
#include "aggregates.hh"
│ │ │ -#include "pinfo.hh"
│ │ │ -#include <dune/common/poolallocator.hh>
│ │ │ -#include <dune/common/enumset.hh>
│ │ │ -#include <set>
│ │ │ -#include <limits>
│ │ │ -#include <algorithm>
│ │ │ +
#include <iostream>
│ │ │ +#include <memory>
│ │ │ +#include <type_traits>
│ │ │ +#include <dune/common/exceptions.hh>
│ │ │ +#include <dune/istl/bccsmatrixinitializer.hh>
│ │ │ +#include <dune/istl/solvers.hh>
│ │ │ +#include <dune/istl/solvertype.hh>
│ │ │ +#include <dune/istl/solverfactory.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::Amg::OverlapVertex< T >
class  Dune::LDL< Matrix >
 Use the LDL package to directly solve linear systems – empty default class. More...
 
class  Dune::Amg::SparsityBuilder< M >
 Functor for building the sparsity pattern of the matrix using examineConnectivity. More...
class  Dune::LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > >
 The LDL direct sparse solver for matrices of type BCRSMatrix. More...
 
class  Dune::Amg::BaseGalerkinProduct
struct  Dune::IsDirectSolver< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > >
 
class  Dune::Amg::GalerkinProduct< T >
struct  Dune::StoresColumnCompressed< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > >
 
class  Dune::Amg::GalerkinProduct< SequentialInformation >
struct  Dune::LDLCreator
 
struct  Dune::Amg::BaseConnectivityConstructor
struct  Dune::LDLCreator::isValidBlock< F >
 
class  Dune::Amg::BaseConnectivityConstructor::ConnectedBuilder< G, S, V >
 Visitor for identifying connected aggregates during a breadthFirstSearch. More...
 
struct  Dune::Amg::ConnectivityConstructor< G, T >
 
struct  Dune::Amg::ConnectivityConstructor< G, SequentialInformation >
 
struct  Dune::Amg::DirichletBoundarySetter< T >
 
struct  Dune::Amg::DirichletBoundarySetter< SequentialInformation >
struct  Dune::LDLCreator::isValidBlock< FieldVector< double, k > >
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Functions

 Dune::DUNE_REGISTER_DIRECT_SOLVER ("ldl", Dune::LDLCreator())
 
│ │ │

Detailed Description

│ │ │ -

Provides a class for building the galerkin product based on a aggregation scheme.

│ │ │ -
Author
Markus Blatt
│ │ │ +

Class for using LDL with ISTL matrices.

│ │ │ +
Author
Marco Agnese, Andrea Sacconi
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,60 +1,50 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -galerkin.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides a class for building the galerkin product based on a aggregation │ │ │ │ -scheme. _M_o_r_e_._._. │ │ │ │ -#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ -#include "_p_i_n_f_o_._h_h" │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +ldl.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) │ │ │ │ +Class for using LDL with ISTL matrices. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x_<_ _T_ _> │ │ │ │ + class   _D_u_n_e_:_:_L_D_L_<_ _M_a_t_r_i_x_ _> │ │ │ │ +  Use the LDL package to directly solve linear systems – empty default │ │ │ │ + class. _M_o_r_e_._._. │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_ _M_ _> │ │ │ │ -  Functor for building the sparsity pattern of the matrix using │ │ │ │ - examineConnectivity. _M_o_r_e_._._. │ │ │ │ + class   _D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _> │ │ │ │ +  The LDL direct sparse solver for matrices of type _B_C_R_S_M_a_t_r_i_x. _M_o_r_e_._._. │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ +struct   _D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_ _> │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_ _T_ _> │ │ │ │ +struct   _D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_<_ _L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_, │ │ │ │ + _A_ _>_ _>_ _> │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +struct   _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ +struct   _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_ _> │ │ │ │   │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_ _G_,_ _S_,_ _V_ _> │ │ │ │ -  Visitor for identifying connected aggregates during a │ │ │ │ - breadthFirstSearch. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_ _G_,_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_ _G_,_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r_<_ _T_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r_<_ _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_ _> │ │ │ │ +struct   _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _d_o_u_b_l_e_,_ _k_ _>_ _> │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R ("ldl", _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r()) │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides a class for building the galerkin product based on a aggregation │ │ │ │ -scheme. │ │ │ │ +Class for using LDL with ISTL matrices. │ │ │ │ Author │ │ │ │ - Markus Blatt │ │ │ │ + Marco Agnese, Andrea Sacconi │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: galerkin.hh Source File │ │ │ +dune-istl: ldl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,742 +70,435 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
galerkin.hh
│ │ │ +
ldl.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_GALERKIN_HH
│ │ │ -
6#define DUNE_GALERKIN_HH
│ │ │ +
5#ifndef DUNE_ISTL_LDL_HH
│ │ │ +
6#define DUNE_ISTL_LDL_HH
│ │ │
7
│ │ │ -
8#include "aggregates.hh"
│ │ │ -
9#include "pinfo.hh"
│ │ │ -
10#include <dune/common/poolallocator.hh>
│ │ │ -
11#include <dune/common/enumset.hh>
│ │ │ -
12#include <set>
│ │ │ -
13#include <limits>
│ │ │ -
14#include <algorithm>
│ │ │ -
15
│ │ │ -
16namespace Dune
│ │ │ -
17{
│ │ │ -
18 namespace Amg
│ │ │ -
19 {
│ │ │ -
31 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
33 {
│ │ │ -
37 typedef T Aggregate;
│ │ │ -
38
│ │ │ -
42 typedef T Vertex;
│ │ │ -
43
│ │ │ - │ │ │ -
48
│ │ │ - │ │ │ -
53 };
│ │ │ -
│ │ │ -
54
│ │ │ -
55
│ │ │ -
56
│ │ │ -
61 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
63 {
│ │ │ -
64 public:
│ │ │ -
70 SparsityBuilder(M& matrix);
│ │ │ -
71
│ │ │ -
72 void insert(const typename M::size_type& index);
│ │ │ -
73
│ │ │ -
74 void operator++();
│ │ │ -
75
│ │ │ -
76 std::size_t minRowSize();
│ │ │ -
77
│ │ │ -
78 std::size_t maxRowSize();
│ │ │ -
79
│ │ │ -
80 std::size_t sumRowSize();
│ │ │ -
│ │ │ -
81 std::size_t index()
│ │ │ -
82 {
│ │ │ -
83 return row_.index();
│ │ │ -
84 }
│ │ │ -
│ │ │ -
85 private:
│ │ │ -
87 typename M::CreateIterator row_;
│ │ │ -
89 std::size_t minRowSize_;
│ │ │ -
91 std::size_t maxRowSize_;
│ │ │ -
92 std::size_t sumRowSize_;
│ │ │ -
93#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
94 bool diagonalInserted;
│ │ │ -
95#endif
│ │ │ -
96 };
│ │ │ -
│ │ │ -
97
│ │ │ -
│ │ │ - │ │ │ -
99 {
│ │ │ -
100 public:
│ │ │ -
109 template<class M, class V, class I, class O>
│ │ │ -
110 void calculate(const M& fine, const AggregatesMap<V>& aggregates, M& coarse,
│ │ │ -
111 const I& pinfo, const O& copy);
│ │ │ -
112
│ │ │ -
113 };
│ │ │ -
│ │ │ -
114
│ │ │ -
115 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
117 : public BaseGalerkinProduct
│ │ │ -
118 {
│ │ │ -
119 public:
│ │ │ - │ │ │ -
121
│ │ │ -
131 template<class G, class V, class Set>
│ │ │ -
132 typename G::MutableMatrix* build(G& fineGraph, V& visitedMap,
│ │ │ -
133 const ParallelInformation& pinfo,
│ │ │ - │ │ │ -
135 const typename G::Matrix::size_type& size,
│ │ │ -
136 const Set& copy);
│ │ │ -
137 private:
│ │ │ -
138
│ │ │ -
145 template<class G, class I, class Set>
│ │ │ - │ │ │ -
147 buildOverlapVertices(const G& graph, const I& pinfo,
│ │ │ - │ │ │ -
149 const Set& overlap,
│ │ │ -
150 std::size_t& overlapCount);
│ │ │ -
151
│ │ │ -
152 template<class A>
│ │ │ -
153 struct OVLess
│ │ │ -
154 {
│ │ │ -
│ │ │ - │ │ │ -
156 {
│ │ │ -
157 return *o1.aggregate < *o2.aggregate;
│ │ │ -
158 }
│ │ │ -
│ │ │ -
159 };
│ │ │ -
160 };
│ │ │ -
│ │ │ -
161
│ │ │ -
162 template<>
│ │ │ -
│ │ │ - │ │ │ -
164 : public BaseGalerkinProduct
│ │ │ -
165 {
│ │ │ -
166 public:
│ │ │ -
176 template<class G, class V, class Set>
│ │ │ -
177 typename G::MutableMatrix* build(G& fineGraph, V& visitedMap,
│ │ │ -
178 const SequentialInformation& pinfo,
│ │ │ - │ │ │ -
180 const typename G::Matrix::size_type& size,
│ │ │ -
181 const Set& copy);
│ │ │ -
182 };
│ │ │ -
│ │ │ -
183
│ │ │ -
│ │ │ - │ │ │ -
185 {
│ │ │ -
186 template<class R, class G, class V>
│ │ │ -
187 static void constructOverlapConnectivity(R& row, G& graph, V& visitedMap,
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
191
│ │ │ -
195 template<class R, class G, class V>
│ │ │ -
196 static void constructNonOverlapConnectivity(R& row, G& graph, V& visitedMap,
│ │ │ - │ │ │ -
198 const typename G::VertexDescriptor& seed);
│ │ │ -
199
│ │ │ +
8#if HAVE_SUITESPARSE_LDL || defined DOXYGEN
│ │ │ +
9
│ │ │ +
10#include <iostream>
│ │ │ +
11#include <memory>
│ │ │ +
12#include <type_traits>
│ │ │ +
13
│ │ │ +
14#ifdef __cplusplus
│ │ │ +
15extern "C"
│ │ │ +
16{
│ │ │ +
17#include <ldl.h>
│ │ │ +
18#include <amd.h>
│ │ │ +
19}
│ │ │ +
20#endif
│ │ │ +
21
│ │ │ +
22#include <dune/common/exceptions.hh>
│ │ │ +
23
│ │ │ + │ │ │ +
25#include <dune/istl/solvers.hh>
│ │ │ + │ │ │ + │ │ │ +
28
│ │ │ +
29namespace Dune {
│ │ │ +
41 // forward declarations
│ │ │ +
42 template<class M, class T, class TM, class TD, class TA>
│ │ │ +
43 class SeqOverlappingSchwarz;
│ │ │ +
44
│ │ │ +
45 template<class T, bool tag>
│ │ │ +
46 struct SeqOverlappingSchwarzAssemblerHelper;
│ │ │ +
47
│ │ │ +
54 template<class Matrix>
│ │ │ +
│ │ │ +
55 class LDL
│ │ │ +
56 {};
│ │ │ +
│ │ │ +
57
│ │ │ +
71 template<typename T, typename A, int n, int m>
│ │ │ +
│ │ │ +
72 class LDL<BCRSMatrix<FieldMatrix<T,n,m>,A > >
│ │ │ +
73 : public InverseOperator<BlockVector<FieldVector<T,m>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > >,
│ │ │ +
74 BlockVector<FieldVector<T,n>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > > >
│ │ │ +
75 {
│ │ │ +
76 public:
│ │ │ + │ │ │ + │ │ │ +
81 typedef Dune::ISTL::Impl::BCCSMatrix<T,int> LDLMatrix;
│ │ │ +
83 typedef ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<FieldMatrix<T,n,m>,A>, int> MatrixInitializer;
│ │ │ +
85 typedef Dune::BlockVector<FieldVector<T,m>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,m> > > domain_type;
│ │ │ +
87 typedef Dune::BlockVector<FieldVector<T,n>, typename std::allocator_traits<A>::template rebind_alloc<FieldVector<T,n> > > range_type;
│ │ │ +
88
│ │ │ +
│ │ │ + │ │ │ +
91 {
│ │ │ + │ │ │ +
93 }
│ │ │ +
│ │ │ +
94
│ │ │ +
│ │ │ +
104 LDL(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false), verbose_(verbose)
│ │ │ +
105 {
│ │ │ +
106 //check whether T is a supported type
│ │ │ +
107 static_assert(std::is_same<T,double>::value,"Unsupported Type in LDL (only double supported)");
│ │ │ +
108 setMatrix(matrix);
│ │ │ +
109 }
│ │ │ +
│ │ │ +
110
│ │ │ +
│ │ │ +
120 LDL(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false), verbose_(verbose)
│ │ │ +
121 {
│ │ │ +
122 //check whether T is a supported type
│ │ │ +
123 static_assert(std::is_same<T,double>::value,"Unsupported Type in LDL (only double supported)");
│ │ │ +
124 setMatrix(matrix);
│ │ │ +
125 }
│ │ │ +
│ │ │ +
126
│ │ │ +
│ │ │ +
136 LDL(const Matrix& matrix, const ParameterTree& config)
│ │ │ +
137 : LDL(matrix, config.get<int>("verbose", 0))
│ │ │ +
138 {}
│ │ │ +
│ │ │ +
139
│ │ │ +
│ │ │ +
141 LDL() : matrixIsLoaded_(false), verbose_(0)
│ │ │ +
142 {}
│ │ │ +
│ │ │ +
143
│ │ │ +
│ │ │ +
145 virtual ~LDL()
│ │ │ +
146 {
│ │ │ +
147 if ((ldlMatrix_.N() + ldlMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ +
148 free();
│ │ │ +
149 }
│ │ │ +
│ │ │ +
150
│ │ │ +
│ │ │ + │ │ │ +
153 {
│ │ │ +
154 const int dimMat(ldlMatrix_.N());
│ │ │ +
155 ldl_perm(dimMat, Y_, reinterpret_cast<double*>(&b[0]), P_);
│ │ │ +
156 ldl_lsolve(dimMat, Y_, Lp_, Li_, Lx_);
│ │ │ +
157 ldl_dsolve(dimMat, Y_, D_);
│ │ │ +
158 ldl_ltsolve(dimMat, Y_, Lp_, Li_, Lx_);
│ │ │ +
159 ldl_permt(dimMat, reinterpret_cast<double*>(&x[0]), Y_, P_);
│ │ │ +
160 // this is a direct solver
│ │ │ +
161 res.iterations = 1;
│ │ │ +
162 res.converged = true;
│ │ │ +
163 }
│ │ │ +
│ │ │ +
164
│ │ │ +
│ │ │ +
166 virtual void apply(domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res)
│ │ │ +
167 {
│ │ │ +
168 apply(x,b,res);
│ │ │ +
169 }
│ │ │ +
│ │ │ +
170
│ │ │ +
│ │ │ +
176 void apply(T* x, T* b)
│ │ │ +
177 {
│ │ │ +
178 const int dimMat(ldlMatrix_.N());
│ │ │ +
179 ldl_perm(dimMat, Y_, b, P_);
│ │ │ +
180 ldl_lsolve(dimMat, Y_, Lp_, Li_, Lx_);
│ │ │ +
181 ldl_dsolve(dimMat, Y_, D_);
│ │ │ +
182 ldl_ltsolve(dimMat, Y_, Lp_, Li_, Lx_);
│ │ │ +
183 ldl_permt(dimMat, x, Y_, P_);
│ │ │ +
184 }
│ │ │ +
│ │ │ +
185
│ │ │ +
│ │ │ +
186 void setOption([[maybe_unused]] unsigned int option, [[maybe_unused]] double value)
│ │ │ +
187 {}
│ │ │ +
│ │ │ +
188
│ │ │ +
│ │ │ +
190 void setMatrix(const Matrix& matrix)
│ │ │ +
191 {
│ │ │ +
192 if ((ldlMatrix_.N() + ldlMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ +
193 free();
│ │ │ +
194
│ │ │ +
195 if (ldlMatrix_.N() + ldlMatrix_.M() + ldlMatrix_.nonzeroes() != 0)
│ │ │ +
196 ldlMatrix_.free();
│ │ │ +
197 ldlMatrix_.setSize(MatrixDimension<Matrix>::rowdim(matrix),
│ │ │ + │ │ │ +
199 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(ldlMatrix_);
│ │ │
200
│ │ │ -
204 template<class G, class S, class V>
│ │ │ -
│ │ │ - │ │ │ -
206 {
│ │ │ -
207 public:
│ │ │ -
211 typedef G Graph;
│ │ │ -
215 typedef typename Graph::ConstEdgeIterator ConstEdgeIterator;
│ │ │ -
216
│ │ │ -
220 typedef S Set;
│ │ │ -
221
│ │ │ -
225 typedef V VisitedMap;
│ │ │ -
226
│ │ │ -
230 typedef typename Graph::VertexDescriptor Vertex;
│ │ │ -
231
│ │ │ -
239 ConnectedBuilder(const AggregatesMap<Vertex>& aggregates, Graph& graph,
│ │ │ -
240 VisitedMap& visitedMap, Set& connected);
│ │ │ +
201 copyToBCCSMatrix(initializer, matrix);
│ │ │ +
202
│ │ │ +
203 decompose();
│ │ │ +
204 }
│ │ │ +
│ │ │ +
205
│ │ │ +
206 template<class S>
│ │ │ +
│ │ │ +
207 void setSubMatrix(const Matrix& matrix, const S& rowIndexSet)
│ │ │ +
208 {
│ │ │ +
209 if ((ldlMatrix_.N() + ldlMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ +
210 free();
│ │ │ +
211
│ │ │ +
212 if (ldlMatrix_.N() + ldlMatrix_.M() + ldlMatrix_.nonzeroes() != 0)
│ │ │ +
213 ldlMatrix_.free();
│ │ │ +
214
│ │ │ +
215 ldlMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(matrix) / matrix.N(),
│ │ │ +
216 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(matrix) / matrix.M());
│ │ │ +
217 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(ldlMatrix_);
│ │ │ +
218
│ │ │ +
219 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<std::size_t> >(matrix,rowIndexSet));
│ │ │ +
220
│ │ │ +
221 decompose();
│ │ │ +
222 }
│ │ │ +
│ │ │ +
223
│ │ │ +
│ │ │ +
228 inline void setVerbosity(int v)
│ │ │ +
229 {
│ │ │ +
230 verbose_=v;
│ │ │ +
231 }
│ │ │ +
│ │ │ +
232
│ │ │ +
│ │ │ + │ │ │ +
238 {
│ │ │ +
239 return ldlMatrix_;
│ │ │ +
240 }
│ │ │ +
│ │ │
241
│ │ │ -
246 void operator()(const ConstEdgeIterator& edge);
│ │ │ -
247
│ │ │ -
248 private:
│ │ │ -
252 const AggregatesMap<Vertex>& aggregates_;
│ │ │ -
253
│ │ │ -
254 Graph& graph_;
│ │ │ -
255
│ │ │ -
259 VisitedMap& visitedMap_;
│ │ │ -
260
│ │ │ -
264 Set& connected_;
│ │ │ -
265 };
│ │ │ -
│ │ │ -
266
│ │ │ -
267 };
│ │ │ -
│ │ │ -
268
│ │ │ -
269 template<class G, class T>
│ │ │ -
│ │ │ - │ │ │ -
271 {
│ │ │ -
272 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
273
│ │ │ -
274 template<class V, class O, class R>
│ │ │ -
275 static void examine(G& graph,
│ │ │ -
276 V& visitedMap,
│ │ │ -
277 const T& pinfo,
│ │ │ -
278 const AggregatesMap<Vertex>& aggregates,
│ │ │ -
279 const O& overlap,
│ │ │ -
280 const OverlapVertex<Vertex>* overlapVertices,
│ │ │ -
281 const OverlapVertex<Vertex>* overlapEnd,
│ │ │ -
282 R& row);
│ │ │ -
283 };
│ │ │ -
│ │ │ -
284
│ │ │ -
285 template<class G>
│ │ │ -
│ │ │ - │ │ │ -
287 {
│ │ │ -
288 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
289
│ │ │ -
290 template<class V, class R>
│ │ │ -
291 static void examine(G& graph,
│ │ │ -
292 V& visitedMap,
│ │ │ -
293 const SequentialInformation& pinfo,
│ │ │ -
294 const AggregatesMap<Vertex>& aggregates,
│ │ │ -
295 R& row);
│ │ │ -
296 };
│ │ │ -
│ │ │ -
297
│ │ │ -
298 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
300 {
│ │ │ -
301 template<class M, class O>
│ │ │ -
302 static void set(M& coarse, const T& pinfo, const O& copy);
│ │ │ -
303 };
│ │ │ +
│ │ │ +
246 void free()
│ │ │ +
247 {
│ │ │ +
248 delete [] D_;
│ │ │ +
249 delete [] Y_;
│ │ │ +
250 delete [] Lp_;
│ │ │ +
251 delete [] Lx_;
│ │ │ +
252 delete [] Li_;
│ │ │ +
253 delete [] P_;
│ │ │ +
254 delete [] Pinv_;
│ │ │ +
255 ldlMatrix_.free();
│ │ │ +
256 matrixIsLoaded_ = false;
│ │ │ +
257 }
│ │ │ +
│ │ │ +
258
│ │ │ +
│ │ │ +
260 inline const char* name()
│ │ │ +
261 {
│ │ │ +
262 return "LDL";
│ │ │ +
263 }
│ │ │ +
│ │ │ +
264
│ │ │ +
│ │ │ +
269 inline double* getD()
│ │ │ +
270 {
│ │ │ +
271 return D_;
│ │ │ +
272 }
│ │ │
│ │ │ +
273
│ │ │ +
│ │ │ +
278 inline int* getLp()
│ │ │ +
279 {
│ │ │ +
280 return Lp_;
│ │ │ +
281 }
│ │ │ +
│ │ │ +
282
│ │ │ +
│ │ │ +
287 inline int* getLi()
│ │ │ +
288 {
│ │ │ +
289 return Li_;
│ │ │ +
290 }
│ │ │ +
│ │ │ +
291
│ │ │ +
│ │ │ +
296 inline double* getLx()
│ │ │ +
297 {
│ │ │ +
298 return Lx_;
│ │ │ +
299 }
│ │ │ +
│ │ │ +
300
│ │ │ +
301 private:
│ │ │ +
302 template<class M,class X, class TM, class TD, class T1>
│ │ │ + │ │ │
304
│ │ │ -
305 template<>
│ │ │ -
│ │ │ - │ │ │ -
307 {
│ │ │ -
308 template<class M, class O>
│ │ │ -
309 static void set(M& coarse, const SequentialInformation& pinfo, const O& copy);
│ │ │ -
310 };
│ │ │ -
│ │ │ -
311
│ │ │ -
312 template<class R, class G, class V>
│ │ │ -
│ │ │ - │ │ │ - │ │ │ -
315 const typename G::VertexDescriptor& seed)
│ │ │ -
316 {
│ │ │ -
317 assert(row.index()==aggregates[seed]);
│ │ │ -
318 row.insert(aggregates[seed]);
│ │ │ -
319 ConnectedBuilder<G,R,V> conBuilder(aggregates, graph, visitedMap, row);
│ │ │ -
320 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
321 typedef std::allocator<Vertex> Allocator;
│ │ │ -
322 typedef SLList<Vertex,Allocator> VertexList;
│ │ │ -
323 typedef typename AggregatesMap<Vertex>::DummyEdgeVisitor DummyVisitor;
│ │ │ -
324 VertexList vlist;
│ │ │ -
325 DummyVisitor dummy;
│ │ │ -
326 aggregates.template breadthFirstSearch<true,false>(seed,aggregates[seed], graph, vlist, dummy,
│ │ │ -
327 conBuilder, visitedMap);
│ │ │ -
328 }
│ │ │ -
│ │ │ -
329
│ │ │ -
330 template<class R, class G, class V>
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
335 {
│ │ │ -
336 ConnectedBuilder<G,R,V> conBuilder(aggregates, graph, visitedMap, row);
│ │ │ -
337 const typename G::VertexDescriptor aggregate=*seed->aggregate;
│ │ │ -
338
│ │ │ -
339 if (row.index()==*seed->aggregate) {
│ │ │ -
340 while(seed != overlapEnd && aggregate == *seed->aggregate) {
│ │ │ -
341 row.insert(*seed->aggregate);
│ │ │ -
342 // Walk over all neighbours and add them to the connected array.
│ │ │ -
343 visitNeighbours(graph, seed->vertex, conBuilder);
│ │ │ -
344 // Mark vertex as visited
│ │ │ -
345 put(visitedMap, seed->vertex, true);
│ │ │ -
346 ++seed;
│ │ │ -
347 }
│ │ │ -
348 }
│ │ │ -
349 }
│ │ │ -
│ │ │ -
350
│ │ │ -
351 template<class G, class S, class V>
│ │ │ -
│ │ │ - │ │ │ -
353 Graph& graph, VisitedMap& visitedMap,
│ │ │ -
354 Set& connected)
│ │ │ -
355 : aggregates_(aggregates), graph_(graph), visitedMap_(visitedMap), connected_(connected)
│ │ │ -
356 {}
│ │ │ -
│ │ │ -
357
│ │ │ -
358 template<class G, class S, class V>
│ │ │ -
│ │ │ - │ │ │ -
360 {
│ │ │ -
361 const Vertex& vertex = aggregates_[edge.target()];
│ │ │ - │ │ │ - │ │ │ -
364 connected_.insert(vertex);
│ │ │ -
365 }
│ │ │ + │ │ │ +
306
│ │ │ +
308 void decompose()
│ │ │ +
309 {
│ │ │ +
310 // allocate vectors
│ │ │ +
311 const int dimMat(ldlMatrix_.N());
│ │ │ +
312 D_ = new double [dimMat];
│ │ │ +
313 Y_ = new double [dimMat];
│ │ │ +
314 Lp_ = new int [dimMat + 1];
│ │ │ +
315 Parent_ = new int [dimMat];
│ │ │ +
316 Lnz_ = new int [dimMat];
│ │ │ +
317 Flag_ = new int [dimMat];
│ │ │ +
318 Pattern_ = new int [dimMat];
│ │ │ +
319 P_ = new int [dimMat];
│ │ │ +
320 Pinv_ = new int [dimMat];
│ │ │ +
321
│ │ │ +
322 double Info [AMD_INFO];
│ │ │ +
323 if(amd_order (dimMat, ldlMatrix_.getColStart(), ldlMatrix_.getRowIndex(), P_, (double *) NULL, Info) < AMD_OK)
│ │ │ +
324 DUNE_THROW(InvalidStateException,"Error: AMD failed!");
│ │ │ +
325 if(verbose_ > 0)
│ │ │ +
326 amd_info (Info);
│ │ │ +
327 // compute the symbolic factorisation
│ │ │ +
328 ldl_symbolic(dimMat, ldlMatrix_.getColStart(), ldlMatrix_.getRowIndex(), Lp_, Parent_, Lnz_, Flag_, P_, Pinv_);
│ │ │ +
329 // initialise those entries of additionalVectors_ whose dimension is known only now
│ │ │ +
330 Lx_ = new double [Lp_[dimMat]];
│ │ │ +
331 Li_ = new int [Lp_[dimMat]];
│ │ │ +
332 // compute the numeric factorisation
│ │ │ +
333 const int rank(ldl_numeric(dimMat, ldlMatrix_.getColStart(), ldlMatrix_.getRowIndex(), ldlMatrix_.getValues(),
│ │ │ +
334 Lp_, Parent_, Lnz_, Li_, Lx_, D_, Y_, Pattern_, Flag_, P_, Pinv_));
│ │ │ +
335 // free temporary vectors
│ │ │ +
336 delete [] Flag_;
│ │ │ +
337 delete [] Pattern_;
│ │ │ +
338 delete [] Parent_;
│ │ │ +
339 delete [] Lnz_;
│ │ │ +
340
│ │ │ +
341 if(rank!=dimMat)
│ │ │ +
342 DUNE_THROW(InvalidStateException,"Error: LDL factorisation failed!");
│ │ │ +
343 }
│ │ │ +
344
│ │ │ +
345 LDLMatrix ldlMatrix_;
│ │ │ +
346 bool matrixIsLoaded_;
│ │ │ +
347 int verbose_;
│ │ │ +
348 int* Lp_;
│ │ │ +
349 int* Parent_;
│ │ │ +
350 int* Lnz_;
│ │ │ +
351 int* Flag_;
│ │ │ +
352 int* Pattern_;
│ │ │ +
353 int* P_;
│ │ │ +
354 int* Pinv_;
│ │ │ +
355 double* D_;
│ │ │ +
356 double* Y_;
│ │ │ +
357 double* Lx_;
│ │ │ +
358 int* Li_;
│ │ │ +
359 };
│ │ │ +
│ │ │ +
360
│ │ │ +
361 template<typename T, typename A, int n, int m>
│ │ │ +
│ │ │ + │ │ │ +
363 {
│ │ │ +
364 enum {value = true};
│ │ │ +
365 };
│ │ │
│ │ │
366
│ │ │ -
367 template<class T>
│ │ │ -
368 template<class G, class I, class Set>
│ │ │ - │ │ │ -
370 GalerkinProduct<T>::buildOverlapVertices(const G& graph, const I& pinfo,
│ │ │ - │ │ │ -
372 const Set& overlap,
│ │ │ -
373 std::size_t& overlapCount)
│ │ │ -
374 {
│ │ │ -
375 // count the overlap vertices.
│ │ │ -
376 typedef typename G::ConstVertexIterator ConstIterator;
│ │ │ -
377 typedef typename I::GlobalLookupIndexSet GlobalLookup;
│ │ │ -
378 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ -
379
│ │ │ -
380 const ConstIterator end = graph.end();
│ │ │ -
381 overlapCount = 0;
│ │ │ -
382
│ │ │ -
383 const GlobalLookup& lookup=pinfo.globalLookup();
│ │ │ -
384
│ │ │ -
385 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) {
│ │ │ -
386 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ +
367 template<typename T, typename A, int n, int m>
│ │ │ +
│ │ │ + │ │ │ +
369 {
│ │ │ +
370 enum {value = true};
│ │ │ +
371 };
│ │ │ +
│ │ │ +
372
│ │ │ +
│ │ │ +
373 struct LDLCreator {
│ │ │ +
374 template<class F> struct isValidBlock : std::false_type{};
│ │ │ +
375 template<int k> struct isValidBlock<FieldVector<double,k>> : std::true_type{};
│ │ │ +
376
│ │ │ +
377 template<typename TL, typename M>
│ │ │ +
378 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ +
379 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ +
│ │ │ +
380 operator() (TL /*tl*/, const M& mat, const Dune::ParameterTree& config,
│ │ │ +
381 std::enable_if_t<
│ │ │ +
382 isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ +
383 {
│ │ │ +
384 int verbose = config.get("verbose", 0);
│ │ │ +
385 return std::make_shared<Dune::LDL<M>>(mat,verbose);
│ │ │ +
386 }
│ │ │ +
│ │ │
387
│ │ │ -
388 if(pair!=0 && overlap.contains(pair->local().attribute()))
│ │ │ -
389 ++overlapCount;
│ │ │ -
390 }
│ │ │ -
391 // Allocate space
│ │ │ -
392 typedef typename G::VertexDescriptor Vertex;
│ │ │ -
393
│ │ │ -
394 OverlapVertex<Vertex>* overlapVertices = new OverlapVertex<Vertex>[overlapCount=0 ? 1 : overlapCount];
│ │ │ -
395 if(overlapCount==0)
│ │ │ -
396 return overlapVertices;
│ │ │ -
397
│ │ │ -
398 // Initialize them
│ │ │ -
399 overlapCount=0;
│ │ │ -
400 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) {
│ │ │ -
401 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ -
402
│ │ │ -
403 if(pair!=0 && overlap.contains(pair->local().attribute())) {
│ │ │ -
404 overlapVertices[overlapCount].aggregate = &aggregates[pair->local()];
│ │ │ -
405 overlapVertices[overlapCount].vertex = pair->local();
│ │ │ -
406 ++overlapCount;
│ │ │ -
407 }
│ │ │ -
408 }
│ │ │ -
409
│ │ │ -
410 dverb << overlapCount<<" overlap vertices"<<std::endl;
│ │ │ -
411
│ │ │ -
412 std::sort(overlapVertices, overlapVertices+overlapCount, OVLess<Vertex>());
│ │ │ -
413 // due to the sorting the isolated aggregates (to be skipped) are at the end.
│ │ │ -
414
│ │ │ -
415 return overlapVertices;
│ │ │ -
416 }
│ │ │ -
417
│ │ │ -
418 template<class G, class T>
│ │ │ -
419 template<class V, class O, class R>
│ │ │ -
│ │ │ - │ │ │ -
421 V& visitedMap,
│ │ │ -
422 const T& pinfo,
│ │ │ -
423 const AggregatesMap<Vertex>& aggregates,
│ │ │ -
424 const O& overlap,
│ │ │ -
425 const OverlapVertex<Vertex>* overlapVertices,
│ │ │ -
426 const OverlapVertex<Vertex>* overlapEnd,
│ │ │ -
427 R& row)
│ │ │ -
428 {
│ │ │ -
429 typedef typename T::GlobalLookupIndexSet GlobalLookup;
│ │ │ -
430 const GlobalLookup& lookup = pinfo.globalLookup();
│ │ │ -
431
│ │ │ -
432 typedef typename G::VertexIterator VertexIterator;
│ │ │ -
433
│ │ │ -
434 VertexIterator vend=graph.end();
│ │ │ -
435
│ │ │ -
436#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
437 std::set<Vertex> examined;
│ │ │ -
438#endif
│ │ │ -
439
│ │ │ -
440 // The aggregates owned by the process have lower local indices
│ │ │ -
441 // then those not owned. We process them in the first pass.
│ │ │ -
442 // They represent the rows 0, 1, ..., n of the coarse matrix
│ │ │ -
443 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex)
│ │ │ -
444 if(!get(visitedMap, *vertex)) {
│ │ │ -
445 // In the first pass we only process owner nodes
│ │ │ -
446 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ -
447 const IndexPair* pair = lookup.pair(*vertex);
│ │ │ -
448 if(pair==0 || !overlap.contains(pair->local().attribute())) {
│ │ │ -
449#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
450 assert(examined.find(aggregates[*vertex])==examined.end());
│ │ │ -
451 examined.insert(aggregates[*vertex]);
│ │ │ -
452#endif
│ │ │ -
453 constructNonOverlapConnectivity(row, graph, visitedMap, aggregates, *vertex);
│ │ │ -
454
│ │ │ -
455 // only needed for ALU
│ │ │ -
456 // (ghosts with same global id as owners on the same process)
│ │ │ -
457 if (SolverCategory::category(pinfo) == static_cast<int>(SolverCategory::nonoverlapping)) {
│ │ │ -
458 if(overlapVertices != overlapEnd) {
│ │ │ -
459 if(*overlapVertices->aggregate!=AggregatesMap<Vertex>::ISOLATED) {
│ │ │ -
460 constructOverlapConnectivity(row, graph, visitedMap, aggregates, overlapVertices, overlapEnd);
│ │ │ -
461 }
│ │ │ -
462 else{
│ │ │ -
463 ++overlapVertices;
│ │ │ -
464 }
│ │ │ -
465 }
│ │ │ -
466 }
│ │ │ -
467 ++row;
│ │ │ -
468 }
│ │ │ -
469 }
│ │ │ -
470
│ │ │ -
471 dvverb<<"constructed "<<row.index()<<" non-overlapping rows"<<std::endl;
│ │ │ -
472
│ │ │ -
473 // Now come the aggregates not owned by use.
│ │ │ -
474 // They represent the rows n+1, ..., N
│ │ │ -
475 while(overlapVertices != overlapEnd)
│ │ │ -
476 if(*overlapVertices->aggregate!=AggregatesMap<Vertex>::ISOLATED) {
│ │ │ -
477
│ │ │ -
478#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
479 typedef typename GlobalLookup::IndexPair IndexPair;
│ │ │ -
480 const IndexPair* pair = lookup.pair(overlapVertices->vertex);
│ │ │ -
481 assert(pair!=0 && overlap.contains(pair->local().attribute()));
│ │ │ -
482 assert(examined.find(aggregates[overlapVertices->vertex])==examined.end());
│ │ │ -
483 examined.insert(aggregates[overlapVertices->vertex]);
│ │ │ -
484#endif
│ │ │ -
485 constructOverlapConnectivity(row, graph, visitedMap, aggregates, overlapVertices, overlapEnd);
│ │ │ -
486 ++row;
│ │ │ -
487 }else{
│ │ │ -
488 ++overlapVertices;
│ │ │ -
489 }
│ │ │ -
490 }
│ │ │ -
│ │ │ -
491
│ │ │ -
492 template<class G>
│ │ │ -
493 template<class V, class R>
│ │ │ -
│ │ │ - │ │ │ -
495 V& visitedMap,
│ │ │ -
496 [[maybe_unused]] const SequentialInformation& pinfo,
│ │ │ -
497 const AggregatesMap<Vertex>& aggregates,
│ │ │ -
498 R& row)
│ │ │ -
499 {
│ │ │ -
500 typedef typename G::VertexIterator VertexIterator;
│ │ │ -
501
│ │ │ -
502 VertexIterator vend=graph.end();
│ │ │ -
503 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) {
│ │ │ -
504 if(!get(visitedMap, *vertex)) {
│ │ │ -
505 constructNonOverlapConnectivity(row, graph, visitedMap, aggregates, *vertex);
│ │ │ -
506 ++row;
│ │ │ -
507 }
│ │ │ -
508 }
│ │ │ -
509
│ │ │ -
510 }
│ │ │ -
│ │ │ -
511
│ │ │ -
512 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
514 : row_(matrix.createbegin()),
│ │ │ -
515 minRowSize_(std::numeric_limits<std::size_t>::max()),
│ │ │ -
516 maxRowSize_(0), sumRowSize_(0)
│ │ │ -
517 {
│ │ │ -
518#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
519 diagonalInserted = false;
│ │ │ -
520#endif
│ │ │ -
521 }
│ │ │ -
│ │ │ -
522 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
524 {
│ │ │ -
525 return maxRowSize_;
│ │ │ -
526 }
│ │ │ -
│ │ │ -
527 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
529 {
│ │ │ -
530 return minRowSize_;
│ │ │ -
531 }
│ │ │ -
│ │ │ -
532
│ │ │ -
533 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
535 {
│ │ │ -
536 return sumRowSize_;
│ │ │ -
537 }
│ │ │ -
│ │ │ -
538 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
540 {
│ │ │ -
541 sumRowSize_ += row_.size();
│ │ │ -
542 minRowSize_=std::min(minRowSize_, row_.size());
│ │ │ -
543 maxRowSize_=std::max(maxRowSize_, row_.size());
│ │ │ -
544 ++row_;
│ │ │ -
545#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
546 assert(diagonalInserted);
│ │ │ -
547 diagonalInserted = false;
│ │ │ -
548#endif
│ │ │ -
549 }
│ │ │ -
│ │ │ -
550
│ │ │ -
551 template<class M>
│ │ │ -
│ │ │ -
552 void SparsityBuilder<M>::insert(const typename M::size_type& index)
│ │ │ -
553 {
│ │ │ -
554 row_.insert(index);
│ │ │ -
555#ifdef DUNE_ISTL_WITH_CHECKING
│ │ │ -
556 diagonalInserted = diagonalInserted || row_.index()==index;
│ │ │ -
557#endif
│ │ │ -
558 }
│ │ │ -
│ │ │ -
559
│ │ │ -
560 template<class T>
│ │ │ -
561 template<class G, class V, class Set>
│ │ │ -
562 typename G::MutableMatrix*
│ │ │ -
│ │ │ -
563 GalerkinProduct<T>::build(G& fineGraph, V& visitedMap,
│ │ │ -
564 const ParallelInformation& pinfo,
│ │ │ - │ │ │ -
566 const typename G::Matrix::size_type& size,
│ │ │ -
567 const Set& overlap)
│ │ │ -
568 {
│ │ │ - │ │ │ -
570
│ │ │ -
571 std::size_t count;
│ │ │ -
572
│ │ │ -
573 const OverlapVertex* overlapVertices = buildOverlapVertices(fineGraph,
│ │ │ -
574 pinfo,
│ │ │ -
575 aggregates,
│ │ │ -
576 overlap,
│ │ │ -
577 count);
│ │ │ -
578 typedef typename G::MutableMatrix M;
│ │ │ -
579 M* coarseMatrix = new M(size, size, M::row_wise);
│ │ │ -
580
│ │ │ -
581 // Reset the visited flags of all vertices.
│ │ │ -
582 // As the isolated nodes will be skipped we simply mark them as visited
│ │ │ -
583
│ │ │ -
584 typedef typename G::VertexIterator Vertex;
│ │ │ -
585 Vertex vend = fineGraph.end();
│ │ │ -
586 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) {
│ │ │ - │ │ │ -
588 put(visitedMap, *vertex, aggregates[*vertex]==AggregatesMap<typename G::VertexDescriptor>::ISOLATED);
│ │ │ -
589 }
│ │ │ -
590
│ │ │ -
591 typedef typename G::MutableMatrix M;
│ │ │ -
592 SparsityBuilder<M> sparsityBuilder(*coarseMatrix);
│ │ │ -
593
│ │ │ -
594 ConnectivityConstructor<G,T>::examine(fineGraph, visitedMap, pinfo,
│ │ │ -
595 aggregates, overlap,
│ │ │ -
596 overlapVertices,
│ │ │ -
597 overlapVertices+count,
│ │ │ -
598 sparsityBuilder);
│ │ │ -
599
│ │ │ -
600 dinfo<<pinfo.communicator().rank()<<": Matrix ("<<coarseMatrix->N()<<"x"<<coarseMatrix->M()<<" row: min="<<sparsityBuilder.minRowSize()<<" max="
│ │ │ -
601 <<sparsityBuilder.maxRowSize()<<" avg="
│ │ │ -
602 <<static_cast<double>(sparsityBuilder.sumRowSize())/coarseMatrix->N()
│ │ │ -
603 <<std::endl;
│ │ │ -
604
│ │ │ -
605 delete[] overlapVertices;
│ │ │ -
606
│ │ │ -
607 return coarseMatrix;
│ │ │ -
608 }
│ │ │ -
│ │ │ -
609
│ │ │ -
610 template<class G, class V, class Set>
│ │ │ -
611 typename G::MutableMatrix*
│ │ │ -
│ │ │ - │ │ │ -
613 const SequentialInformation& pinfo,
│ │ │ - │ │ │ -
615 const typename G::Matrix::size_type& size,
│ │ │ -
616 [[maybe_unused]] const Set& overlap)
│ │ │ -
617 {
│ │ │ -
618 typedef typename G::MutableMatrix M;
│ │ │ -
619 M* coarseMatrix = new M(size, size, M::row_wise);
│ │ │ -
620
│ │ │ -
621 // Reset the visited flags of all vertices.
│ │ │ -
622 // As the isolated nodes will be skipped we simply mark them as visited
│ │ │ -
623
│ │ │ -
624 typedef typename G::VertexIterator Vertex;
│ │ │ -
625 Vertex vend = fineGraph.end();
│ │ │ -
626 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) {
│ │ │ - │ │ │ -
628 put(visitedMap, *vertex, aggregates[*vertex]==AggregatesMap<typename G::VertexDescriptor>::ISOLATED);
│ │ │ -
629 }
│ │ │ -
630
│ │ │ -
631 SparsityBuilder<M> sparsityBuilder(*coarseMatrix);
│ │ │ -
632
│ │ │ - │ │ │ -
634 aggregates, sparsityBuilder);
│ │ │ -
635 dinfo<<"Matrix row: min="<<sparsityBuilder.minRowSize()<<" max="
│ │ │ -
636 <<sparsityBuilder.maxRowSize()<<" average="
│ │ │ -
637 <<static_cast<double>(sparsityBuilder.sumRowSize())/coarseMatrix->N()<<std::endl;
│ │ │ -
638 return coarseMatrix;
│ │ │ -
639 }
│ │ │ -
│ │ │ -
640
│ │ │ -
641 template<class M, class V, class P, class O>
│ │ │ -
│ │ │ -
642 void BaseGalerkinProduct::calculate(const M& fine, const AggregatesMap<V>& aggregates, M& coarse,
│ │ │ -
643 const P& pinfo, [[maybe_unused]] const O& copy)
│ │ │ -
644 {
│ │ │ -
645 coarse = static_cast<typename M::field_type>(0);
│ │ │ -
646
│ │ │ -
647 typedef typename M::ConstIterator RowIterator;
│ │ │ -
648 RowIterator endRow = fine.end();
│ │ │ -
649
│ │ │ -
650 for(RowIterator row = fine.begin(); row != endRow; ++row)
│ │ │ -
651 if(aggregates[row.index()] != AggregatesMap<V>::ISOLATED) {
│ │ │ -
652 assert(aggregates[row.index()]!=AggregatesMap<V>::UNAGGREGATED);
│ │ │ -
653 typedef typename M::ConstColIterator ColIterator;
│ │ │ -
654 ColIterator endCol = row->end();
│ │ │ -
655
│ │ │ -
656 for(ColIterator col = row->begin(); col != endCol; ++col)
│ │ │ -
657 if(aggregates[col.index()] != AggregatesMap<V>::ISOLATED) {
│ │ │ -
658 assert(aggregates[row.index()]!=AggregatesMap<V>::UNAGGREGATED);
│ │ │ -
659 coarse[aggregates[row.index()]][aggregates[col.index()]]+=*col;
│ │ │ -
660 }
│ │ │ -
661 }
│ │ │ -
662
│ │ │ -
663 // get the right diagonal matrix values on copy lines from owner processes
│ │ │ -
664 typedef typename M::block_type BlockType;
│ │ │ -
665 std::vector<BlockType> rowsize(coarse.N(),BlockType(0));
│ │ │ -
666 for (RowIterator row = coarse.begin(); row != coarse.end(); ++row)
│ │ │ -
667 rowsize[row.index()]=coarse[row.index()][row.index()];
│ │ │ -
668 pinfo.copyOwnerToAll(rowsize,rowsize);
│ │ │ -
669 for (RowIterator row = coarse.begin(); row != coarse.end(); ++row)
│ │ │ -
670 coarse[row.index()][row.index()] = rowsize[row.index()];
│ │ │ -
671
│ │ │ -
672 // don't set dirichlet boundaries for copy lines to make novlp case work,
│ │ │ -
673 // the preconditioner yields slightly different results now.
│ │ │ -
674
│ │ │ -
675 // Set the dirichlet border
│ │ │ -
676 //DirichletBoundarySetter<P>::template set<M>(coarse, pinfo, copy);
│ │ │ -
677
│ │ │ -
678 }
│ │ │ -
│ │ │ -
679
│ │ │ -
680 template<class T>
│ │ │ -
681 template<class M, class O>
│ │ │ -
│ │ │ -
682 void DirichletBoundarySetter<T>::set(M& coarse, const T& pinfo, const O& copy)
│ │ │ -
683 {
│ │ │ -
684 typedef typename T::ParallelIndexSet::const_iterator ConstIterator;
│ │ │ -
685 ConstIterator end = pinfo.indexSet().end();
│ │ │ -
686 typedef typename M::block_type Block;
│ │ │ -
687 Block identity=Block(0.0);
│ │ │ -
688 for(typename Block::RowIterator b=identity.begin(); b != identity.end(); ++b)
│ │ │ -
689 b->operator[](b.index())=1.0;
│ │ │ -
690
│ │ │ -
691 for(ConstIterator index = pinfo.indexSet().begin();
│ │ │ -
692 index != end; ++index) {
│ │ │ -
693 if(copy.contains(index->local().attribute())) {
│ │ │ -
694 typedef typename M::ColIterator ColIterator;
│ │ │ -
695 typedef typename M::row_type Row;
│ │ │ -
696 Row row = coarse[index->local()];
│ │ │ -
697 ColIterator cend = row.find(index->local());
│ │ │ -
698 ColIterator col = row.begin();
│ │ │ -
699 for(; col != cend; ++col)
│ │ │ -
700 *col = 0;
│ │ │ -
701
│ │ │ -
702 cend = row.end();
│ │ │ -
703
│ │ │ -
704 assert(col != cend); // There should be a diagonal entry
│ │ │ -
705 *col = identity;
│ │ │ -
706
│ │ │ -
707 for(++col; col != cend; ++col)
│ │ │ -
708 *col = 0;
│ │ │ -
709 }
│ │ │ -
710 }
│ │ │ -
711 }
│ │ │ -
│ │ │ -
712
│ │ │ -
713 template<class M, class O>
│ │ │ -
│ │ │ - │ │ │ -
715 const SequentialInformation& pinfo,
│ │ │ -
716 const O& overlap)
│ │ │ -
717 {}
│ │ │ -
│ │ │ -
718
│ │ │ -
719 } // namespace Amg
│ │ │ -
720} // namespace Dune
│ │ │ -
721#endif
│ │ │ - │ │ │ -
Provides classes for the Coloring process of AMG.
│ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ -
bool operator()(const OverlapVertex< A > &o1, const OverlapVertex< A > &o2)
Definition galerkin.hh:155
│ │ │ -
static void constructNonOverlapConnectivity(R &row, G &graph, V &visitedMap, const AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::VertexDescriptor &seed)
Construct the connectivity of an aggregate in the overlap.
Definition galerkin.hh:313
│ │ │ -
G Graph
The type of the graph.
Definition galerkin.hh:211
│ │ │ -
void operator++()
Definition galerkin.hh:539
│ │ │ -
void operator()(const ConstEdgeIterator &edge)
Process an edge pointing to another aggregate.
Definition galerkin.hh:359
│ │ │ -
void insert(const typename M::size_type &index)
Definition galerkin.hh:552
│ │ │ -
static void constructOverlapConnectivity(R &row, G &graph, V &visitedMap, const AggregatesMap< typename G::VertexDescriptor > &aggregates, const OverlapVertex< typename G::VertexDescriptor > *&seed, const OverlapVertex< typename G::VertexDescriptor > *overlapEnd)
Definition galerkin.hh:331
│ │ │ -
G::MutableMatrix * build(G &fineGraph, V &visitedMap, const ParallelInformation &pinfo, AggregatesMap< typename G::VertexDescriptor > &aggregates, const typename G::Matrix::size_type &size, const Set &copy)
Calculates the coarse matrix via a Galerkin product.
Definition galerkin.hh:563
│ │ │ -
std::size_t index()
Definition galerkin.hh:81
│ │ │ -
T ParallelInformation
Definition galerkin.hh:120
│ │ │ -
G::VertexDescriptor Vertex
Definition galerkin.hh:272
│ │ │ -
T Aggregate
The aggregate descriptor.
Definition galerkin.hh:37
│ │ │ -
SparsityBuilder(M &matrix)
Constructor.
Definition galerkin.hh:513
│ │ │ -
ConnectedBuilder(const AggregatesMap< Vertex > &aggregates, Graph &graph, VisitedMap &visitedMap, Set &connected)
Constructor.
Definition galerkin.hh:352
│ │ │ -
Graph::ConstEdgeIterator ConstEdgeIterator
The constant edge iterator.
Definition galerkin.hh:215
│ │ │ -
T Vertex
The vertex descriptor.
Definition galerkin.hh:42
│ │ │ -
G::VertexDescriptor Vertex
Definition galerkin.hh:288
│ │ │ -
static void examine(G &graph, V &visitedMap, const T &pinfo, const AggregatesMap< Vertex > &aggregates, const O &overlap, const OverlapVertex< Vertex > *overlapVertices, const OverlapVertex< Vertex > *overlapEnd, R &row)
Definition galerkin.hh:420
│ │ │ -
V VisitedMap
The type of the map for marking vertices as visited.
Definition galerkin.hh:225
│ │ │ -
int visitNeighbours(const G &graph, const typename G::VertexDescriptor &vertex, V &visitor)
Visit all neighbour vertices of a vertex in a graph.
│ │ │ -
S Set
The type of the connected set.
Definition galerkin.hh:220
│ │ │ -
Aggregate * aggregate
The aggregate the vertex belongs to.
Definition galerkin.hh:47
│ │ │ -
std::size_t sumRowSize()
Definition galerkin.hh:534
│ │ │ -
Vertex vertex
The vertex descriptor.
Definition galerkin.hh:52
│ │ │ -
std::size_t minRowSize()
Definition galerkin.hh:528
│ │ │ -
static void set(M &coarse, const T &pinfo, const O &copy)
Definition galerkin.hh:682
│ │ │ -
Graph::VertexDescriptor Vertex
The vertex descriptor of the graph.
Definition galerkin.hh:230
│ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ -
std::size_t maxRowSize()
Definition galerkin.hh:523
│ │ │ -
STL namespace.
│ │ │ +
388 // second version with SFINAE to validate the template parameters of LDL
│ │ │ +
389 template<typename TL, typename M>
│ │ │ +
390 std::shared_ptr<Dune::InverseOperator<typename Dune::TypeListElement<1, TL>::type,
│ │ │ +
391 typename Dune::TypeListElement<2, TL>::type>>
│ │ │ +
│ │ │ +
392 operator() (TL /*tl*/, const M& /*mat*/, const Dune::ParameterTree& /*config*/,
│ │ │ +
393 std::enable_if_t<
│ │ │ +
394 !isValidBlock<typename Dune::TypeListElement<1, TL>::type::block_type>::value,int> = 0) const
│ │ │ +
395 {
│ │ │ +
396 DUNE_THROW(UnsupportedType,
│ │ │ +
397 "Unsupported Type in LDL (only double and std::complex<double> supported)");
│ │ │ +
398 }
│ │ │ +
│ │ │ +
399 };
│ │ │ +
│ │ │ + │ │ │ +
401
│ │ │ +
402} // end namespace Dune
│ │ │ +
403
│ │ │ +
404
│ │ │ +
405#endif //HAVE_SUITESPARSE_LDL
│ │ │ +
406#endif //DUNE_ISTL_LDL_HH
│ │ │ + │ │ │ + │ │ │ +
Templates characterizing the type of a solver.
│ │ │ +
#define DUNE_REGISTER_DIRECT_SOLVER(name,...)
Definition solverregistry.hh:13
│ │ │ +
Implementations of the inverse operator interface.
│ │ │ +
Dune::BlockVector< FieldVector< T, m >, typename std::allocator_traits< A >::template rebind_alloc< FieldVector< T, m > > > domain_type
The type of the domain of the solver.
Definition ldl.hh:85
│ │ │ +
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix
The matrix type.
Definition ldl.hh:78
│ │ │ +
int * getLp()
Get factorization Lp.
Definition ldl.hh:278
│ │ │ +
LDLMatrix & getInternalMatrix()
Return the column compress matrix.
Definition ldl.hh:237
│ │ │ +
Dune::ISTL::Impl::BCCSMatrix< T, int > LDLMatrix
The corresponding SuperLU Matrix type.
Definition ldl.hh:81
│ │ │ +
double * getLx()
Get factorization Lx.
Definition ldl.hh:296
│ │ │ +
void setVerbosity(int v)
Sets the verbosity level for the solver.
Definition ldl.hh:228
│ │ │ +
void apply(T *x, T *b)
Additional apply method with c-arrays in analogy to superlu.
Definition ldl.hh:176
│ │ │ +
virtual void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res)
apply inverse operator, with given convergence criteria.
Definition ldl.hh:166
│ │ │ +
Dune::BlockVector< FieldVector< T, n >, typename std::allocator_traits< A >::template rebind_alloc< FieldVector< T, n > > > range_type
The type of the range of the solver.
Definition ldl.hh:87
│ │ │ +
virtual ~LDL()
Default constructor.
Definition ldl.hh:145
│ │ │ +
void free()
Free allocated space.
Definition ldl.hh:246
│ │ │ +
virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res)
Apply inverse operator,.
Definition ldl.hh:152
│ │ │ +
int * getLi()
Get factorization Li.
Definition ldl.hh:287
│ │ │ +
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > matrix_type
Definition ldl.hh:79
│ │ │ +
void setMatrix(const Matrix &matrix)
Initialize data from given matrix.
Definition ldl.hh:190
│ │ │ +
void setOption(unsigned int option, double value)
Definition ldl.hh:186
│ │ │ +
LDL(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition ldl.hh:120
│ │ │ +
double * getD()
Get factorization diagonal matrix D.
Definition ldl.hh:269
│ │ │ +
LDL(const Matrix &matrix, const ParameterTree &config)
Constructs the LDL solver.
Definition ldl.hh:136
│ │ │ +
virtual SolverCategory::Category category() const
Category of the solver (see SolverCategory::Category)
Definition ldl.hh:90
│ │ │ +
ISTL::Impl::BCCSMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A >, int > MatrixInitializer
Type of an associated initializer class.
Definition ldl.hh:83
│ │ │ +
std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL >::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) const
Definition ldl.hh:380
│ │ │ +
const char * name()
Get method name.
Definition ldl.hh:260
│ │ │ +
void setSubMatrix(const Matrix &matrix, const S &rowIndexSet)
Definition ldl.hh:207
│ │ │ +
LDL()
Default constructor.
Definition ldl.hh:141
│ │ │ +
LDL(const Matrix &matrix, int verbose=0)
Construct a solver object from a BCRSMatrix.
Definition ldl.hh:104
│ │ │ +
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │
Definition allocator.hh:11
│ │ │
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
Definition dependency.hh:293
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:560
│ │ │ -
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:598
│ │ │ -
Definition galerkin.hh:33
│ │ │ -
Functor for building the sparsity pattern of the matrix using examineConnectivity.
Definition galerkin.hh:63
│ │ │ -
Definition galerkin.hh:99
│ │ │ -
Definition galerkin.hh:118
│ │ │ -
Definition galerkin.hh:185
│ │ │ -
Visitor for identifying connected aggregates during a breadthFirstSearch.
Definition galerkin.hh:206
│ │ │ -
Definition galerkin.hh:271
│ │ │ -
Definition galerkin.hh:300
│ │ │ -
Definition pinfo.hh:28
│ │ │ -
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │ -
static Category category(const OP &op, decltype(op.category()) *=nullptr)
Helperfunction to extract the solver category either from an enum, or from the newly introduced virtu...
Definition solvercategory.hh:34
│ │ │ +
Definition matrixutils.hh:211
│ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ +
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:2007
│ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2001
│ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ +
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ +
Definition overlappingschwarz.hh:694
│ │ │ +
Use the LDL package to directly solve linear systems – empty default class.
Definition ldl.hh:56
│ │ │ +
Definition ldl.hh:373
│ │ │ +
Definition ldl.hh:374
│ │ │ +
Definition matrixutils.hh:27
│ │ │ +
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ +
int iterations
Number of iterations.
Definition solver.hh:69
│ │ │ +
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │ +
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
Definition solverregistry.hh:77
│ │ │ +
Definition solvertype.hh:16
│ │ │ +
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ +
Definition solvertype.hh:30
│ │ │ +
@ value
whether the solver internally uses column compressed storage
Definition solvertype.hh:36
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,816 +1,535 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -galerkin.hh │ │ │ │ +ldl.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_GALERKIN_HH │ │ │ │ -6#define DUNE_GALERKIN_HH │ │ │ │ +5#ifndef DUNE_ISTL_LDL_HH │ │ │ │ +6#define DUNE_ISTL_LDL_HH │ │ │ │ 7 │ │ │ │ -8#include "_a_g_g_r_e_g_a_t_e_s_._h_h" │ │ │ │ -9#include "_p_i_n_f_o_._h_h" │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12#include │ │ │ │ -13#include │ │ │ │ -14#include │ │ │ │ -15 │ │ │ │ -16namespace _D_u_n_e │ │ │ │ -17{ │ │ │ │ -18 namespace Amg │ │ │ │ -19 { │ │ │ │ -31 template │ │ │ │ -_3_2 struct _O_v_e_r_l_a_p_V_e_r_t_e_x │ │ │ │ -33 { │ │ │ │ -_3_7 typedef T _A_g_g_r_e_g_a_t_e; │ │ │ │ -38 │ │ │ │ -_4_2 typedef T _V_e_r_t_e_x; │ │ │ │ -43 │ │ │ │ -_4_7 _A_g_g_r_e_g_a_t_e* _a_g_g_r_e_g_a_t_e; │ │ │ │ -48 │ │ │ │ -_5_2 _V_e_r_t_e_x _v_e_r_t_e_x; │ │ │ │ -53 }; │ │ │ │ -54 │ │ │ │ -55 │ │ │ │ -56 │ │ │ │ -61 template │ │ │ │ -_6_2 class _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r │ │ │ │ -63 { │ │ │ │ -64 public: │ │ │ │ -70 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r(M& matrix); │ │ │ │ -71 │ │ │ │ -72 void _i_n_s_e_r_t(const typename M::size_type& _i_n_d_e_x); │ │ │ │ -73 │ │ │ │ -74 void _o_p_e_r_a_t_o_r_+_+(); │ │ │ │ -75 │ │ │ │ -76 std::size_t _m_i_n_R_o_w_S_i_z_e(); │ │ │ │ -77 │ │ │ │ -78 std::size_t _m_a_x_R_o_w_S_i_z_e(); │ │ │ │ -79 │ │ │ │ -80 std::size_t _s_u_m_R_o_w_S_i_z_e(); │ │ │ │ -_8_1 std::size_t _i_n_d_e_x() │ │ │ │ -82 { │ │ │ │ -83 return row_.index(); │ │ │ │ -84 } │ │ │ │ -85 private: │ │ │ │ -87 typename M::CreateIterator row_; │ │ │ │ -89 std::size_t minRowSize_; │ │ │ │ -91 std::size_t maxRowSize_; │ │ │ │ -92 std::size_t sumRowSize_; │ │ │ │ -93#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -94 bool diagonalInserted; │ │ │ │ -95#endif │ │ │ │ -96 }; │ │ │ │ -97 │ │ │ │ -_9_8 class _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -99 { │ │ │ │ -100 public: │ │ │ │ -109 template │ │ │ │ -_1_1_0 void _c_a_l_c_u_l_a_t_e(const M& fine, const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>& aggregates, M& │ │ │ │ -coarse, │ │ │ │ -111 const I& pinfo, const O& copy); │ │ │ │ -112 │ │ │ │ -113 }; │ │ │ │ -114 │ │ │ │ -115 template │ │ │ │ -_1_1_6 class _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -117 : public _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -118 { │ │ │ │ -119 public: │ │ │ │ -_1_2_0 typedef T _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -121 │ │ │ │ -131 template │ │ │ │ -132 typename G::MutableMatrix* _b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ -133 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -134 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -135 const typename G::Matrix::size_type& size, │ │ │ │ -136 const Set& copy); │ │ │ │ -137 private: │ │ │ │ -138 │ │ │ │ -145 template │ │ │ │ -146 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* │ │ │ │ -147 buildOverlapVertices(const G& graph, const I& pinfo, │ │ │ │ -148 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -149 const Set& overlap, │ │ │ │ -150 std::size_t& overlapCount); │ │ │ │ -151 │ │ │ │ -152 template │ │ │ │ -153 struct OVLess │ │ │ │ -154 { │ │ │ │ -_1_5_5 bool _o_p_e_r_a_t_o_r_(_)(const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_A_>& o1, const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_A_>& o2) │ │ │ │ -156 { │ │ │ │ -157 return *o1._a_g_g_r_e_g_a_t_e < *o2._a_g_g_r_e_g_a_t_e; │ │ │ │ -158 } │ │ │ │ -159 }; │ │ │ │ -160 }; │ │ │ │ -161 │ │ │ │ -162 template<> │ │ │ │ -_1_6_3 class _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ -164 : public _B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -165 { │ │ │ │ -166 public: │ │ │ │ -176 template │ │ │ │ -177 typename G::MutableMatrix* _b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ -178 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -179 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -180 const typename G::Matrix::size_type& size, │ │ │ │ -181 const Set& copy); │ │ │ │ -182 }; │ │ │ │ -183 │ │ │ │ -_1_8_4 struct _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ -185 { │ │ │ │ -186 template │ │ │ │ -187 static void _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& graph, V& visitedMap, │ │ │ │ -188 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -189 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>*& seed, │ │ │ │ -190 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* overlapEnd); │ │ │ │ -191 │ │ │ │ -195 template │ │ │ │ -196 static void _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& graph, V& │ │ │ │ -visitedMap, │ │ │ │ -197 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -198 const typename G::VertexDescriptor& seed); │ │ │ │ -199 │ │ │ │ +8#if HAVE_SUITESPARSE_LDL || defined DOXYGEN │ │ │ │ +9 │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13 │ │ │ │ +14#ifdef __cplusplus │ │ │ │ +15extern "C" │ │ │ │ +16{ │ │ │ │ +17#include │ │ │ │ +18#include │ │ │ │ +19} │ │ │ │ +20#endif │ │ │ │ +21 │ │ │ │ +22#include │ │ │ │ +23 │ │ │ │ +24#include <_d_u_n_e_/_i_s_t_l_/_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h> │ │ │ │ +25#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ +26#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ +27#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ +28 │ │ │ │ +29namespace _D_u_n_e { │ │ │ │ +41 // forward declarations │ │ │ │ +42 template │ │ │ │ +43 class SeqOverlappingSchwarz; │ │ │ │ +44 │ │ │ │ +45 template │ │ │ │ +46 struct SeqOverlappingSchwarzAssemblerHelper; │ │ │ │ +47 │ │ │ │ +54 template │ │ │ │ +_5_5 class _L_D_L │ │ │ │ +56 {}; │ │ │ │ +57 │ │ │ │ +71 template │ │ │ │ +_7_2 class _L_D_L<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A > > │ │ │ │ +73 : public _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r, typename std:: │ │ │ │ +allocator_traits::template rebind_alloc > >, │ │ │ │ +74 BlockVector, typename std::allocator_traits::template │ │ │ │ +rebind_alloc > > > │ │ │ │ +75 { │ │ │ │ +76 public: │ │ │ │ +_7_8 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_>,A> _M_a_t_r_i_x; │ │ │ │ +_7_9 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_n_,_m_>,A> _m_a_t_r_i_x___t_y_p_e; │ │ │ │ +_8_1 typedef Dune::ISTL::Impl::BCCSMatrix _L_D_L_M_a_t_r_i_x; │ │ │ │ +_8_3 typedef ISTL::Impl::BCCSMatrixInitializer,A>, │ │ │ │ +int> _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r; │ │ │ │ +_8_5 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_T_,_m_>, typename std:: │ │ │ │ +allocator_traits::template rebind_alloc > > _d_o_m_a_i_n___t_y_p_e; │ │ │ │ +_8_7 typedef _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_T_,_n_>, typename std:: │ │ │ │ +allocator_traits::template rebind_alloc > > _r_a_n_g_e___t_y_p_e; │ │ │ │ +88 │ │ │ │ +_9_0 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ +91 { │ │ │ │ +92 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ +93 } │ │ │ │ +94 │ │ │ │ +_1_0_4 _L_D_L(const _M_a_t_r_i_x& matrix, int verbose=0) : matrixIsLoaded_(false), verbose_ │ │ │ │ +(verbose) │ │ │ │ +105 { │ │ │ │ +106 //check whether T is a supported type │ │ │ │ +107 static_assert(std::is_same::value,"Unsupported Type in LDL (only │ │ │ │ +double supported)"); │ │ │ │ +108 setMatrix(matrix); │ │ │ │ +109 } │ │ │ │ +110 │ │ │ │ +_1_2_0 _L_D_L(const _M_a_t_r_i_x& matrix, int verbose, bool) : matrixIsLoaded_(false), │ │ │ │ +verbose_(verbose) │ │ │ │ +121 { │ │ │ │ +122 //check whether T is a supported type │ │ │ │ +123 static_assert(std::is_same::value,"Unsupported Type in LDL (only │ │ │ │ +double supported)"); │ │ │ │ +124 setMatrix(matrix); │ │ │ │ +125 } │ │ │ │ +126 │ │ │ │ +_1_3_6 _L_D_L(const _M_a_t_r_i_x& matrix, const ParameterTree& config) │ │ │ │ +137 : _L_D_L(matrix, config._g_e_t("verbose", 0)) │ │ │ │ +138 {} │ │ │ │ +139 │ │ │ │ +_1_4_1 _L_D_L() : matrixIsLoaded_(false), verbose_(0) │ │ │ │ +142 {} │ │ │ │ +143 │ │ │ │ +_1_4_5 virtual _~_L_D_L() │ │ │ │ +146 { │ │ │ │ +147 if ((ldlMatrix_.N() + ldlMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ +148 free(); │ │ │ │ +149 } │ │ │ │ +150 │ │ │ │ +_1_5_2 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& │ │ │ │ +res) │ │ │ │ +153 { │ │ │ │ +154 const int dimMat(ldlMatrix_.N()); │ │ │ │ +155 ldl_perm(dimMat, Y_, reinterpret_cast(&b[0]), P_); │ │ │ │ +156 ldl_lsolve(dimMat, Y_, Lp_, Li_, Lx_); │ │ │ │ +157 ldl_dsolve(dimMat, Y_, D_); │ │ │ │ +158 ldl_ltsolve(dimMat, Y_, Lp_, Li_, Lx_); │ │ │ │ +159 ldl_permt(dimMat, reinterpret_cast(&x[0]), Y_, P_); │ │ │ │ +160 // this is a direct solver │ │ │ │ +161 res._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ +162 res._c_o_n_v_e_r_g_e_d = true; │ │ │ │ +163 } │ │ │ │ +164 │ │ │ │ +_1_6_6 virtual void _a_p_p_l_y(_d_o_m_a_i_n___t_y_p_e& x, _r_a_n_g_e___t_y_p_e& b, [[maybe_unused]] double │ │ │ │ +reduction, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ +167 { │ │ │ │ +168 apply(x,b,res); │ │ │ │ +169 } │ │ │ │ +170 │ │ │ │ +_1_7_6 void _a_p_p_l_y(T* x, T* b) │ │ │ │ +177 { │ │ │ │ +178 const int dimMat(ldlMatrix_.N()); │ │ │ │ +179 ldl_perm(dimMat, Y_, b, P_); │ │ │ │ +180 ldl_lsolve(dimMat, Y_, Lp_, Li_, Lx_); │ │ │ │ +181 ldl_dsolve(dimMat, Y_, D_); │ │ │ │ +182 ldl_ltsolve(dimMat, Y_, Lp_, Li_, Lx_); │ │ │ │ +183 ldl_permt(dimMat, x, Y_, P_); │ │ │ │ +184 } │ │ │ │ +185 │ │ │ │ +_1_8_6 void _s_e_t_O_p_t_i_o_n([[maybe_unused]] unsigned int option, [[maybe_unused]] │ │ │ │ +double value) │ │ │ │ +187 {} │ │ │ │ +188 │ │ │ │ +_1_9_0 void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix) │ │ │ │ +191 { │ │ │ │ +192 if ((ldlMatrix_.N() + ldlMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ +193 free(); │ │ │ │ +194 │ │ │ │ +195 if (ldlMatrix_.N() + ldlMatrix_.M() + ldlMatrix_.nonzeroes() != 0) │ │ │ │ +196 ldlMatrix_.free(); │ │ │ │ +197 ldlMatrix_.setSize(_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m(matrix), │ │ │ │ +198 _M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(matrix)); │ │ │ │ +199 ISTL::Impl::BCCSMatrixInitializer initializer(ldlMatrix_); │ │ │ │ 200 │ │ │ │ -204 template │ │ │ │ -_2_0_5 class _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ -206 { │ │ │ │ -207 public: │ │ │ │ -_2_1_1 typedef G _G_r_a_p_h; │ │ │ │ -_2_1_5 typedef typename Graph::ConstEdgeIterator _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r; │ │ │ │ -216 │ │ │ │ -_2_2_0 typedef S _S_e_t; │ │ │ │ -221 │ │ │ │ -_2_2_5 typedef V _V_i_s_i_t_e_d_M_a_p; │ │ │ │ -226 │ │ │ │ -_2_3_0 typedef typename Graph::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ -231 │ │ │ │ -239 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, _G_r_a_p_h& graph, │ │ │ │ -240 _V_i_s_i_t_e_d_M_a_p& visitedMap, _S_e_t& connected); │ │ │ │ +201 copyToBCCSMatrix(initializer, matrix); │ │ │ │ +202 │ │ │ │ +203 decompose(); │ │ │ │ +204 } │ │ │ │ +205 │ │ │ │ +206 template │ │ │ │ +_2_0_7 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix, const S& rowIndexSet) │ │ │ │ +208 { │ │ │ │ +209 if ((ldlMatrix_.N() + ldlMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ +210 free(); │ │ │ │ +211 │ │ │ │ +212 if (ldlMatrix_.N() + ldlMatrix_.M() + ldlMatrix_.nonzeroes() != 0) │ │ │ │ +213 ldlMatrix_.free(); │ │ │ │ +214 │ │ │ │ +215 ldlMatrix_.setSize(rowIndexSet.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_r_o_w_d_i_m │ │ │ │ +(matrix) / matrix._N(), │ │ │ │ +216 rowIndexSet.size()*_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n_<_M_a_t_r_i_x_>_:_:_c_o_l_d_i_m(matrix) / matrix._M()); │ │ │ │ +217 ISTL::Impl::BCCSMatrixInitializer initializer(ldlMatrix_); │ │ │ │ +218 │ │ │ │ +219 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ +set >(matrix,rowIndexSet)); │ │ │ │ +220 │ │ │ │ +221 decompose(); │ │ │ │ +222 } │ │ │ │ +223 │ │ │ │ +_2_2_8 inline void _s_e_t_V_e_r_b_o_s_i_t_y(int v) │ │ │ │ +229 { │ │ │ │ +230 verbose_=v; │ │ │ │ +231 } │ │ │ │ +232 │ │ │ │ +_2_3_7 inline _L_D_L_M_a_t_r_i_x& _g_e_t_I_n_t_e_r_n_a_l_M_a_t_r_i_x() │ │ │ │ +238 { │ │ │ │ +239 return ldlMatrix_; │ │ │ │ +240 } │ │ │ │ 241 │ │ │ │ -246 void _o_p_e_r_a_t_o_r_(_)(const _C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge); │ │ │ │ -247 │ │ │ │ -248 private: │ │ │ │ -252 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ -253 │ │ │ │ -254 _G_r_a_p_h& graph_; │ │ │ │ -255 │ │ │ │ -259 _V_i_s_i_t_e_d_M_a_p& visitedMap_; │ │ │ │ -260 │ │ │ │ -264 _S_e_t& connected_; │ │ │ │ -265 }; │ │ │ │ -266 │ │ │ │ -267 }; │ │ │ │ -268 │ │ │ │ -269 template │ │ │ │ -_2_7_0 struct _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r : public _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ -271 { │ │ │ │ -_2_7_2 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ +_2_4_6 void _f_r_e_e() │ │ │ │ +247 { │ │ │ │ +248 delete [] D_; │ │ │ │ +249 delete [] Y_; │ │ │ │ +250 delete [] Lp_; │ │ │ │ +251 delete [] Lx_; │ │ │ │ +252 delete [] Li_; │ │ │ │ +253 delete [] P_; │ │ │ │ +254 delete [] Pinv_; │ │ │ │ +255 ldlMatrix_.free(); │ │ │ │ +256 matrixIsLoaded_ = false; │ │ │ │ +257 } │ │ │ │ +258 │ │ │ │ +_2_6_0 inline const char* _n_a_m_e() │ │ │ │ +261 { │ │ │ │ +262 return "LDL"; │ │ │ │ +263 } │ │ │ │ +264 │ │ │ │ +_2_6_9 inline double* _g_e_t_D() │ │ │ │ +270 { │ │ │ │ +271 return D_; │ │ │ │ +272 } │ │ │ │ 273 │ │ │ │ -274 template │ │ │ │ -275 static void _e_x_a_m_i_n_e(G& graph, │ │ │ │ -276 V& visitedMap, │ │ │ │ -277 const T& pinfo, │ │ │ │ -278 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -279 const O& overlap, │ │ │ │ -280 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapVertices, │ │ │ │ -281 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapEnd, │ │ │ │ -282 R& row); │ │ │ │ -283 }; │ │ │ │ -284 │ │ │ │ -285 template │ │ │ │ -_2_8_6 struct _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r : public │ │ │ │ -_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ -287 { │ │ │ │ -_2_8_8 typedef typename G::VertexDescriptor _V_e_r_t_e_x; │ │ │ │ -289 │ │ │ │ -290 template │ │ │ │ -291 static void _e_x_a_m_i_n_e(G& graph, │ │ │ │ -292 V& visitedMap, │ │ │ │ -293 const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -294 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -295 R& row); │ │ │ │ -296 }; │ │ │ │ -297 │ │ │ │ -298 template │ │ │ │ -_2_9_9 struct _D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r │ │ │ │ -300 { │ │ │ │ -301 template │ │ │ │ -302 static void _s_e_t(M& coarse, const T& pinfo, const O& copy); │ │ │ │ -303 }; │ │ │ │ +_2_7_8 inline int* _g_e_t_L_p() │ │ │ │ +279 { │ │ │ │ +280 return Lp_; │ │ │ │ +281 } │ │ │ │ +282 │ │ │ │ +_2_8_7 inline int* _g_e_t_L_i() │ │ │ │ +288 { │ │ │ │ +289 return Li_; │ │ │ │ +290 } │ │ │ │ +291 │ │ │ │ +_2_9_6 inline double* _g_e_t_L_x() │ │ │ │ +297 { │ │ │ │ +298 return Lx_; │ │ │ │ +299 } │ │ │ │ +300 │ │ │ │ +301 private: │ │ │ │ +302 template │ │ │ │ +_3_0_3 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ 304 │ │ │ │ -305 template<> │ │ │ │ -_3_0_6 struct _D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r<_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n> │ │ │ │ -307 { │ │ │ │ -308 template │ │ │ │ -309 static void _s_e_t(M& coarse, const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, const O& │ │ │ │ -copy); │ │ │ │ -310 }; │ │ │ │ -311 │ │ │ │ -312 template │ │ │ │ -_3_1_3 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, │ │ │ │ -G& graph, V& visitedMap, │ │ │ │ -314 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -315 const typename G::VertexDescriptor& seed) │ │ │ │ -316 { │ │ │ │ -317 assert(row.index()==aggregates[seed]); │ │ │ │ -318 row.insert(aggregates[seed]); │ │ │ │ -319 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_R_,_V_> conBuilder(aggregates, graph, visitedMap, row); │ │ │ │ -320 typedef typename G::VertexDescriptor Vertex; │ │ │ │ -321 typedef std::allocator Allocator; │ │ │ │ -322 typedef SLList VertexList; │ │ │ │ -323 typedef typename _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r DummyVisitor; │ │ │ │ -324 VertexList vlist; │ │ │ │ -325 DummyVisitor dummy; │ │ │ │ -326 aggregates.template breadthFirstSearch(seed,aggregates[seed], │ │ │ │ -graph, vlist, dummy, │ │ │ │ -327 conBuilder, visitedMap); │ │ │ │ -328 } │ │ │ │ -329 │ │ │ │ -330 template │ │ │ │ -_3_3_1 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(R& row, G& │ │ │ │ -graph, V& visitedMap, │ │ │ │ -332 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -333 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>*& seed, │ │ │ │ -334 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* overlapEnd) │ │ │ │ -335 { │ │ │ │ -336 _C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_R_,_V_> conBuilder(aggregates, graph, visitedMap, row); │ │ │ │ -337 const typename G::VertexDescriptor aggregate=*seed->_a_g_g_r_e_g_a_t_e; │ │ │ │ -338 │ │ │ │ -339 if (row.index()==*seed->_a_g_g_r_e_g_a_t_e) { │ │ │ │ -340 while(seed != overlapEnd && aggregate == *seed->_a_g_g_r_e_g_a_t_e) { │ │ │ │ -341 row.insert(*seed->_a_g_g_r_e_g_a_t_e); │ │ │ │ -342 // Walk over all neighbours and add them to the connected array. │ │ │ │ -343 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(graph, seed->_v_e_r_t_e_x, conBuilder); │ │ │ │ -344 // Mark vertex as visited │ │ │ │ -345 put(visitedMap, seed->_v_e_r_t_e_x, true); │ │ │ │ -346 ++seed; │ │ │ │ -347 } │ │ │ │ -348 } │ │ │ │ -349 } │ │ │ │ -350 │ │ │ │ -351 template │ │ │ │ -_3_5_2 _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_S_,_V_>_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ -(const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -353 _G_r_a_p_h& graph, _V_i_s_i_t_e_d_M_a_p& visitedMap, │ │ │ │ -354 _S_e_t& connected) │ │ │ │ -355 : aggregates_(aggregates), graph_(graph), visitedMap_(visitedMap), │ │ │ │ -connected_(connected) │ │ │ │ -356 {} │ │ │ │ -357 │ │ │ │ -358 template │ │ │ │ -_3_5_9 void _B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r_<_G_,_S_,_V_>_:_:_o_p_e_r_a_t_o_r_(_)(const │ │ │ │ -_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r& edge) │ │ │ │ -360 { │ │ │ │ -361 const _V_e_r_t_e_x& vertex = aggregates_[edge.target()]; │ │ │ │ -362 assert(vertex!= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ -363 if(vertex!= _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) │ │ │ │ -364 connected_.insert(vertex); │ │ │ │ -365 } │ │ │ │ +305 friend struct _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r<_L_D_L<_M_a_t_r_i_x>,true>; │ │ │ │ +306 │ │ │ │ +308 void decompose() │ │ │ │ +309 { │ │ │ │ +310 // allocate vectors │ │ │ │ +311 const int dimMat(ldlMatrix_.N()); │ │ │ │ +312 D_ = new double [dimMat]; │ │ │ │ +313 Y_ = new double [dimMat]; │ │ │ │ +314 Lp_ = new int [dimMat + 1]; │ │ │ │ +315 Parent_ = new int [dimMat]; │ │ │ │ +316 Lnz_ = new int [dimMat]; │ │ │ │ +317 Flag_ = new int [dimMat]; │ │ │ │ +318 Pattern_ = new int [dimMat]; │ │ │ │ +319 P_ = new int [dimMat]; │ │ │ │ +320 Pinv_ = new int [dimMat]; │ │ │ │ +321 │ │ │ │ +322 double Info [AMD_INFO]; │ │ │ │ +323 if(amd_order (dimMat, ldlMatrix_.getColStart(), ldlMatrix_.getRowIndex(), │ │ │ │ +P_, (double *) NULL, Info) < AMD_OK) │ │ │ │ +324 DUNE_THROW(InvalidStateException,"Error: AMD failed!"); │ │ │ │ +325 if(verbose_ > 0) │ │ │ │ +326 amd_info (Info); │ │ │ │ +327 // compute the symbolic factorisation │ │ │ │ +328 ldl_symbolic(dimMat, ldlMatrix_.getColStart(), ldlMatrix_.getRowIndex(), │ │ │ │ +Lp_, Parent_, Lnz_, Flag_, P_, Pinv_); │ │ │ │ +329 // initialise those entries of additionalVectors_ whose dimension is known │ │ │ │ +only now │ │ │ │ +330 Lx_ = new double [Lp_[dimMat]]; │ │ │ │ +331 Li_ = new int [Lp_[dimMat]]; │ │ │ │ +332 // compute the numeric factorisation │ │ │ │ +333 const int rank(ldl_numeric(dimMat, ldlMatrix_.getColStart(), │ │ │ │ +ldlMatrix_.getRowIndex(), ldlMatrix_.getValues(), │ │ │ │ +334 Lp_, Parent_, Lnz_, Li_, Lx_, D_, Y_, Pattern_, Flag_, P_, Pinv_)); │ │ │ │ +335 // free temporary vectors │ │ │ │ +336 delete [] Flag_; │ │ │ │ +337 delete [] Pattern_; │ │ │ │ +338 delete [] Parent_; │ │ │ │ +339 delete [] Lnz_; │ │ │ │ +340 │ │ │ │ +341 if(rank!=dimMat) │ │ │ │ +342 DUNE_THROW(InvalidStateException,"Error: LDL factorisation failed!"); │ │ │ │ +343 } │ │ │ │ +344 │ │ │ │ +345 LDLMatrix ldlMatrix_; │ │ │ │ +346 bool matrixIsLoaded_; │ │ │ │ +347 int verbose_; │ │ │ │ +348 int* Lp_; │ │ │ │ +349 int* Parent_; │ │ │ │ +350 int* Lnz_; │ │ │ │ +351 int* Flag_; │ │ │ │ +352 int* Pattern_; │ │ │ │ +353 int* P_; │ │ │ │ +354 int* Pinv_; │ │ │ │ +355 double* D_; │ │ │ │ +356 double* Y_; │ │ │ │ +357 double* Lx_; │ │ │ │ +358 int* Li_; │ │ │ │ +359 }; │ │ │ │ +360 │ │ │ │ +361 template │ │ │ │ +_3_6_2 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_L_D_L<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > > │ │ │ │ +363 { │ │ │ │ +_3_6_4 enum {_v_a_l_u_e = true}; │ │ │ │ +365 }; │ │ │ │ 366 │ │ │ │ -367 template │ │ │ │ -368 template │ │ │ │ -369 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>* │ │ │ │ -370 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_T_>_:_:_b_u_i_l_d_O_v_e_r_l_a_p_V_e_r_t_i_c_e_s(const G& graph, const I& pinfo, │ │ │ │ -371 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -372 const Set& overlap, │ │ │ │ -373 std::size_t& overlapCount) │ │ │ │ -374 { │ │ │ │ -375 // count the overlap vertices. │ │ │ │ -376 typedef typename G::ConstVertexIterator ConstIterator; │ │ │ │ -377 typedef typename I::GlobalLookupIndexSet GlobalLookup; │ │ │ │ -378 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ -379 │ │ │ │ -380 const ConstIterator end = graph.end(); │ │ │ │ -381 overlapCount = 0; │ │ │ │ -382 │ │ │ │ -383 const GlobalLookup& lookup=pinfo.globalLookup(); │ │ │ │ -384 │ │ │ │ -385 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) { │ │ │ │ -386 const IndexPair* pair = lookup.pair(*vertex); │ │ │ │ +367 template │ │ │ │ +_3_6_8 struct _S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d<_L_D_L<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > > │ │ │ │ +369 { │ │ │ │ +_3_7_0 enum {_v_a_l_u_e = true}; │ │ │ │ +371 }; │ │ │ │ +372 │ │ │ │ +_3_7_3 struct _L_D_L_C_r_e_a_t_o_r { │ │ │ │ +_3_7_4 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std::false_type{}; │ │ │ │ +_3_7_5 template struct _i_s_V_a_l_i_d_B_l_o_c_k> : std::true_type │ │ │ │ +{}; │ │ │ │ +376 │ │ │ │ +377 template │ │ │ │ +378 std::shared_ptr::type, │ │ │ │ +379 typename Dune::TypeListElement<2, TL>::type>> │ │ │ │ +_3_8_0 _o_p_e_r_a_t_o_r_(_)_ (TL /*tl*/, const M& _m_a_t, const Dune::ParameterTree& config, │ │ │ │ +381 std::enable_if_t< │ │ │ │ +382 _i_s_V_a_l_i_d_B_l_o_c_k::type::block_type>:: │ │ │ │ +value,int> = 0) const │ │ │ │ +383 { │ │ │ │ +384 int verbose = config.get("verbose", 0); │ │ │ │ +385 return std::make_shared>(_m_a_t,verbose); │ │ │ │ +386 } │ │ │ │ 387 │ │ │ │ -388 if(pair!=0 && overlap.contains(pair->local().attribute())) │ │ │ │ -389 ++overlapCount; │ │ │ │ -390 } │ │ │ │ -391 // Allocate space │ │ │ │ -392 typedef typename G::VertexDescriptor Vertex; │ │ │ │ -393 │ │ │ │ -394 _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapVertices = new _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_> │ │ │ │ -[overlapCount=0 ? 1 : overlapCount]; │ │ │ │ -395 if(overlapCount==0) │ │ │ │ -396 return overlapVertices; │ │ │ │ -397 │ │ │ │ -398 // Initialize them │ │ │ │ -399 overlapCount=0; │ │ │ │ -400 for(ConstIterator vertex=graph.begin(); vertex != end; ++vertex) { │ │ │ │ -401 const IndexPair* pair = lookup.pair(*vertex); │ │ │ │ -402 │ │ │ │ -403 if(pair!=0 && overlap.contains(pair->local().attribute())) { │ │ │ │ -404 overlapVertices[overlapCount]._a_g_g_r_e_g_a_t_e = &aggregates[pair->local()]; │ │ │ │ -405 overlapVertices[overlapCount]._v_e_r_t_e_x = pair->local(); │ │ │ │ -406 ++overlapCount; │ │ │ │ -407 } │ │ │ │ -408 } │ │ │ │ -409 │ │ │ │ -410 dverb << overlapCount<<" overlap vertices"<()); │ │ │ │ -413 // due to the sorting the isolated aggregates (to be skipped) are at the │ │ │ │ -end. │ │ │ │ -414 │ │ │ │ -415 return overlapVertices; │ │ │ │ -416 } │ │ │ │ -417 │ │ │ │ -418 template │ │ │ │ -419 template │ │ │ │ -_4_2_0 void _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_G_,_T_>_:_:_e_x_a_m_i_n_e(G& graph, │ │ │ │ -421 V& visitedMap, │ │ │ │ -422 const T& pinfo, │ │ │ │ -423 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -424 const O& overlap, │ │ │ │ -425 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapVertices, │ │ │ │ -426 const _O_v_e_r_l_a_p_V_e_r_t_e_x_<_V_e_r_t_e_x_>* overlapEnd, │ │ │ │ -427 R& row) │ │ │ │ -428 { │ │ │ │ -429 typedef typename T::GlobalLookupIndexSet GlobalLookup; │ │ │ │ -430 const GlobalLookup& lookup = pinfo.globalLookup(); │ │ │ │ -431 │ │ │ │ -432 typedef typename G::VertexIterator VertexIterator; │ │ │ │ -433 │ │ │ │ -434 VertexIterator vend=graph.end(); │ │ │ │ -435 │ │ │ │ -436#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -437 std::set examined; │ │ │ │ -438#endif │ │ │ │ -439 │ │ │ │ -440 // The aggregates owned by the process have lower local indices │ │ │ │ -441 // then those not owned. We process them in the first pass. │ │ │ │ -442 // They represent the rows 0, 1, ..., n of the coarse matrix │ │ │ │ -443 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) │ │ │ │ -444 if(!_g_e_t(visitedMap, *vertex)) { │ │ │ │ -445 // In the first pass we only process owner nodes │ │ │ │ -446 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ -447 const IndexPair* pair = lookup.pair(*vertex); │ │ │ │ -448 if(pair==0 || !overlap.contains(pair->local().attribute())) { │ │ │ │ -449#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -450 assert(examined.find(aggregates[*vertex])==examined.end()); │ │ │ │ -451 examined.insert(aggregates[*vertex]); │ │ │ │ -452#endif │ │ │ │ -453 _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ -*vertex); │ │ │ │ -454 │ │ │ │ -455 // only needed for ALU │ │ │ │ -456 // (ghosts with same global id as owners on the same process) │ │ │ │ -457 if (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(pinfo) == static_cast(_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_: │ │ │ │ -_n_o_n_o_v_e_r_l_a_p_p_i_n_g)) { │ │ │ │ -458 if(overlapVertices != overlapEnd) { │ │ │ │ -459 if(*overlapVertices->_a_g_g_r_e_g_a_t_e!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ -460 _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ -overlapVertices, overlapEnd); │ │ │ │ -461 } │ │ │ │ -462 else{ │ │ │ │ -463 ++overlapVertices; │ │ │ │ -464 } │ │ │ │ -465 } │ │ │ │ -466 } │ │ │ │ -467 ++row; │ │ │ │ -468 } │ │ │ │ -469 } │ │ │ │ -470 │ │ │ │ -471 dvverb<<"constructed "<_a_g_g_r_e_g_a_t_e!=_A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ -477 │ │ │ │ -478#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -479 typedef typename GlobalLookup::IndexPair IndexPair; │ │ │ │ -480 const IndexPair* pair = lookup.pair(overlapVertices->_v_e_r_t_e_x); │ │ │ │ -481 assert(pair!=0 && overlap.contains(pair->local().attribute())); │ │ │ │ -482 assert(examined.find(aggregates[overlapVertices->_v_e_r_t_e_x])==examined.end()); │ │ │ │ -483 examined.insert(aggregates[overlapVertices->_v_e_r_t_e_x]); │ │ │ │ -484#endif │ │ │ │ -485 _c_o_n_s_t_r_u_c_t_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ -overlapVertices, overlapEnd); │ │ │ │ -486 ++row; │ │ │ │ -487 }else{ │ │ │ │ -488 ++overlapVertices; │ │ │ │ -489 } │ │ │ │ -490 } │ │ │ │ -491 │ │ │ │ -492 template │ │ │ │ -493 template │ │ │ │ -_4_9_4 void _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_G_,_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n_>_:_:_e_x_a_m_i_n_e(G& graph, │ │ │ │ -495 V& visitedMap, │ │ │ │ -496 [[maybe_unused]] const _S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -497 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ -498 R& row) │ │ │ │ -499 { │ │ │ │ -500 typedef typename G::VertexIterator VertexIterator; │ │ │ │ -501 │ │ │ │ -502 VertexIterator vend=graph.end(); │ │ │ │ -503 for(VertexIterator vertex = graph.begin(); vertex != vend; ++vertex) { │ │ │ │ -504 if(!_g_e_t(visitedMap, *vertex)) { │ │ │ │ -505 _c_o_n_s_t_r_u_c_t_N_o_n_O_v_e_r_l_a_p_C_o_n_n_e_c_t_i_v_i_t_y(row, graph, visitedMap, aggregates, │ │ │ │ -*vertex); │ │ │ │ -506 ++row; │ │ │ │ -507 } │ │ │ │ -508 } │ │ │ │ -509 │ │ │ │ -510 } │ │ │ │ -511 │ │ │ │ -512 template │ │ │ │ -_5_1_3 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r(M& matrix) │ │ │ │ -514 : row_(matrix.createbegin()), │ │ │ │ -515 minRowSize_(_s_t_d::numeric_limits<_s_t_d::size_t>::max()), │ │ │ │ -516 maxRowSize_(0), sumRowSize_(0) │ │ │ │ -517 { │ │ │ │ -518#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -519 diagonalInserted = false; │ │ │ │ -520#endif │ │ │ │ -521 } │ │ │ │ -522 template │ │ │ │ -_5_2_3 std::size_t _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_m_a_x_R_o_w_S_i_z_e() │ │ │ │ -524 { │ │ │ │ -525 return maxRowSize_; │ │ │ │ -526 } │ │ │ │ -527 template │ │ │ │ -_5_2_8 std::size_t _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_m_i_n_R_o_w_S_i_z_e() │ │ │ │ -529 { │ │ │ │ -530 return minRowSize_; │ │ │ │ -531 } │ │ │ │ -532 │ │ │ │ -533 template │ │ │ │ -_5_3_4 std::size_t _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_s_u_m_R_o_w_S_i_z_e() │ │ │ │ -535 { │ │ │ │ -536 return sumRowSize_; │ │ │ │ -537 } │ │ │ │ -538 template │ │ │ │ -_5_3_9 void _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_o_p_e_r_a_t_o_r_+_+() │ │ │ │ -540 { │ │ │ │ -541 sumRowSize_ += row_.size(); │ │ │ │ -542 minRowSize_=std::min(minRowSize_, row_.size()); │ │ │ │ -543 maxRowSize_=std::max(maxRowSize_, row_.size()); │ │ │ │ -544 ++row_; │ │ │ │ -545#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -546 assert(diagonalInserted); │ │ │ │ -547 diagonalInserted = false; │ │ │ │ -548#endif │ │ │ │ -549 } │ │ │ │ -550 │ │ │ │ -551 template │ │ │ │ -_5_5_2 void _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_>_:_:_i_n_s_e_r_t(const typename M::size_type& index) │ │ │ │ -553 { │ │ │ │ -554 row_.insert(index); │ │ │ │ -555#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -556 diagonalInserted = diagonalInserted || row_.index()==index; │ │ │ │ -557#endif │ │ │ │ -558 } │ │ │ │ -559 │ │ │ │ -560 template │ │ │ │ -561 template │ │ │ │ -562 typename G::MutableMatrix* │ │ │ │ -_5_6_3 _G_a_l_e_r_k_i_n_P_r_o_d_u_c_t_<_T_>_:_:_b_u_i_l_d(G& fineGraph, V& visitedMap, │ │ │ │ -564 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo, │ │ │ │ -565 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>& aggregates, │ │ │ │ -566 const typename G::Matrix::size_type& size, │ │ │ │ -567 const Set& overlap) │ │ │ │ -568 { │ │ │ │ -569 typedef _O_v_e_r_l_a_p_V_e_r_t_e_x_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_> _O_v_e_r_l_a_p_V_e_r_t_e_x; │ │ │ │ -570 │ │ │ │ -571 std::size_t count; │ │ │ │ -572 │ │ │ │ -573 const _O_v_e_r_l_a_p_V_e_r_t_e_x* overlapVertices = buildOverlapVertices(fineGraph, │ │ │ │ -574 pinfo, │ │ │ │ -575 aggregates, │ │ │ │ -576 overlap, │ │ │ │ -577 count); │ │ │ │ -578 typedef typename G::MutableMatrix M; │ │ │ │ -579 M* coarseMatrix = new M(size, size, M::row_wise); │ │ │ │ -580 │ │ │ │ -581 // Reset the visited flags of all vertices. │ │ │ │ -582 // As the isolated nodes will be skipped we simply mark them as visited │ │ │ │ -583 │ │ │ │ -584 typedef typename G::VertexIterator Vertex; │ │ │ │ -585 Vertex vend = fineGraph.end(); │ │ │ │ -586 for(Vertex vertex = fineGraph.begin(); vertex != vend; ++vertex) { │ │ │ │ -587 assert(aggregates[*vertex] != _A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_: │ │ │ │ -_U_N_A_G_G_R_E_G_A_T_E_D); │ │ │ │ -588 put(visitedMap, *vertex, aggregates[*vertex]==_A_g_g_r_e_g_a_t_e_s_M_a_p_<_t_y_p_e_n_a_m_e_ _G_:_: │ │ │ │ -_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r_>_:_:_I_S_O_L_A_T_E_D); │ │ │ │ -589 } │ │ │ │ -590 │ │ │ │ -591 typedef typename G::MutableMatrix M; │ │ │ │ -592 _S_p_a_r_s_i_t_y_B_u_i_l_d_e_r_<_M_> sparsityBuilder(*coarseMatrix); │ │ │ │ -593 │ │ │ │ -594 _C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_<_G_,_T_>_:_:_e_x_a_m_i_n_e(fineGraph, visitedMap, pinfo, │ │ │ │ -595 aggregates, overlap, │ │ │ │ -596 overlapVertices, │ │ │ │ -597 overlapVertices+count, │ │ │ │ -598 sparsityBuilder); │ │ │ │ -599 │ │ │ │ -600 dinfo<N │ │ │ │ -()<<"x"<M()<<" row: min="< │ │ │ │ +supported)"); │ │ │ │ +398 } │ │ │ │ +399 }; │ │ │ │ +_4_0_0 _D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R("ldl", _D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r()); │ │ │ │ +401 │ │ │ │ +402} // end namespace Dune │ │ │ │ +403 │ │ │ │ +404 │ │ │ │ +405#endif //HAVE_SUITESPARSE_LDL │ │ │ │ +406#endif //DUNE_ISTL_LDL_HH │ │ │ │ +_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h │ │ │ │ +_b_c_c_s_m_a_t_r_i_x_i_n_i_t_i_a_l_i_z_e_r_._h_h │ │ │ │ +_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ +Templates characterizing the type of a solver. │ │ │ │ +_D_U_N_E___R_E_G_I_S_T_E_R___D_I_R_E_C_T___S_O_L_V_E_R │ │ │ │ +#define DUNE_REGISTER_DIRECT_SOLVER(name,...) │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:13 │ │ │ │ +_s_o_l_v_e_r_s_._h_h │ │ │ │ +Implementations of the inverse operator interface. │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ +Dune::BlockVector< FieldVector< T, m >, typename std::allocator_traits< A >:: │ │ │ │ +template rebind_alloc< FieldVector< T, m > > > domain_type │ │ │ │ +The type of the domain of the solver. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:85 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_M_a_t_r_i_x │ │ │ │ +Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > Matrix │ │ │ │ +The matrix type. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:78 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_L_p │ │ │ │ +int * getLp() │ │ │ │ +Get factorization Lp. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:278 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_I_n_t_e_r_n_a_l_M_a_t_r_i_x │ │ │ │ +LDLMatrix & getInternalMatrix() │ │ │ │ +Return the column compress matrix. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:237 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_L_D_L_M_a_t_r_i_x │ │ │ │ +Dune::ISTL::Impl::BCCSMatrix< T, int > LDLMatrix │ │ │ │ +The corresponding SuperLU Matrix type. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:81 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_L_x │ │ │ │ +double * getLx() │ │ │ │ +Get factorization Lx. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:296 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_V_e_r_b_o_s_i_t_y │ │ │ │ +void setVerbosity(int v) │ │ │ │ +Sets the verbosity level for the solver. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:228 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ +void apply(T *x, T *b) │ │ │ │ +Additional apply method with c-arrays in analogy to superlu. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:176 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ +virtual void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ +InverseOperatorResult &res) │ │ │ │ +apply inverse operator, with given convergence criteria. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:166 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ +Dune::BlockVector< FieldVector< T, n >, typename std::allocator_traits< A >:: │ │ │ │ +template rebind_alloc< FieldVector< T, n > > > range_type │ │ │ │ +The type of the range of the solver. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:87 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_~_L_D_L │ │ │ │ +virtual ~LDL() │ │ │ │ +Default constructor. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:145 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_f_r_e_e │ │ │ │ +void free() │ │ │ │ +Free allocated space. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:246 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ +virtual void apply(domain_type &x, range_type &b, InverseOperatorResult &res) │ │ │ │ +Apply inverse operator,. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:152 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_L_i │ │ │ │ +int * getLi() │ │ │ │ +Get factorization Li. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:287 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ +Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > matrix_type │ │ │ │ +DDeeffiinniittiioonn ldl.hh:79 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_M_a_t_r_i_x │ │ │ │ +void setMatrix(const Matrix &matrix) │ │ │ │ +Initialize data from given matrix. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:190 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_O_p_t_i_o_n │ │ │ │ +void setOption(unsigned int option, double value) │ │ │ │ +DDeeffiinniittiioonn ldl.hh:186 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_L_D_L │ │ │ │ +LDL(const Matrix &matrix, int verbose, bool) │ │ │ │ +Constructor for compatibility with SuperLU standard constructor. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:120 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_g_e_t_D │ │ │ │ +double * getD() │ │ │ │ +Get factorization diagonal matrix D. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:269 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_L_D_L │ │ │ │ +LDL(const Matrix &matrix, const ParameterTree &config) │ │ │ │ +Constructs the LDL solver. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:136 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_c_a_t_e_g_o_r_y │ │ │ │ +virtual SolverCategory::Category category() const │ │ │ │ +Category of the solver (see SolverCategory::Category) │ │ │ │ +DDeeffiinniittiioonn ldl.hh:90 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r │ │ │ │ +ISTL::Impl::BCCSMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A >, int │ │ │ │ +> MatrixInitializer │ │ │ │ +Type of an associated initializer class. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:83 │ │ │ │ +_D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +std::shared_ptr< Dune::InverseOperator< typename Dune::TypeListElement< 1, TL │ │ │ │ +>::type, typename Dune::TypeListElement< 2, TL >::type > > operator()(TL, const │ │ │ │ +M &mat, const Dune::ParameterTree &config, std::enable_if_t< isValidBlock< │ │ │ │ +typename Dune::TypeListElement< 1, TL >::type::block_type >::value, int >=0) │ │ │ │ +const │ │ │ │ +DDeeffiinniittiioonn ldl.hh:380 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_n_a_m_e │ │ │ │ +const char * name() │ │ │ │ +Get method name. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:260 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ +void setSubMatrix(const Matrix &matrix, const S &rowIndexSet) │ │ │ │ +DDeeffiinniittiioonn ldl.hh:207 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_L_D_L │ │ │ │ +LDL() │ │ │ │ +Default constructor. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:141 │ │ │ │ +_D_u_n_e_:_:_L_D_L_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _n_,_ _m_ _>_,_ _A_ _>_ _>_:_:_L_D_L │ │ │ │ +LDL(const Matrix &matrix, int verbose=0) │ │ │ │ +Construct a solver object from a BCRSMatrix. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:104 │ │ │ │ +_m_a_t │ │ │ │ +Matrix & mat │ │ │ │ +DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ _D_u_n_e_:_:_g_e_t │ │ │ │ PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg:: │ │ │ │ VertexProperties, EP, VM, EM > >::Type get(const Amg::VertexVisitedTag &tag, │ │ │ │ Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph) │ │ │ │ DDeeffiinniittiioonn dependency.hh:293 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -Class providing information about the mapping of the vertices onto aggregates. │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:560 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ -A Dummy visitor that does nothing for each visited edge. │ │ │ │ -DDeeffiinniittiioonn aggregates.hh:598 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_O_v_e_r_l_a_p_V_e_r_t_e_x │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:33 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_p_a_r_s_i_t_y_B_u_i_l_d_e_r │ │ │ │ -Functor for building the sparsity pattern of the matrix using │ │ │ │ -examineConnectivity. │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:63 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:99 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_l_e_r_k_i_n_P_r_o_d_u_c_t │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:118 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:185 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_B_a_s_e_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r_:_:_C_o_n_n_e_c_t_e_d_B_u_i_l_d_e_r │ │ │ │ -Visitor for identifying connected aggregates during a breadthFirstSearch. │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:206 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_n_e_c_t_i_v_i_t_y_C_o_n_s_t_r_u_c_t_o_r │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:271 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_i_r_i_c_h_l_e_t_B_o_u_n_d_a_r_y_S_e_t_t_e_r │ │ │ │ -DDeeffiinniittiioonn galerkin.hh:300 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_S_e_q_u_e_n_t_i_a_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -DDeeffiinniittiioonn pinfo.hh:28 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_n_o_n_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ -@ nonoverlapping │ │ │ │ -Category for non-overlapping solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:27 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ -static Category category(const OP &op, decltype(op.category()) *=nullptr) │ │ │ │ -Helperfunction to extract the solver category either from an enum, or from the │ │ │ │ -newly introduced virtu... │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:34 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_D_i_m_e_n_s_i_o_n │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:211 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_M │ │ │ │ +size_type M() const │ │ │ │ +number of columns (counted in blocks) │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2007 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_N │ │ │ │ +size_type N() const │ │ │ │ +number of rows (counted in blocks) │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2001 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +A vector of blocks with memory management. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ +_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ +Sequential overlapping Schwarz preconditioner. │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:755 │ │ │ │ +_D_u_n_e_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_A_s_s_e_m_b_l_e_r_H_e_l_p_e_r │ │ │ │ +DDeeffiinniittiioonn overlappingschwarz.hh:694 │ │ │ │ +_D_u_n_e_:_:_L_D_L │ │ │ │ +Use the LDL package to directly solve linear systems – empty default class. │ │ │ │ +DDeeffiinniittiioonn ldl.hh:56 │ │ │ │ +_D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r │ │ │ │ +DDeeffiinniittiioonn ldl.hh:373 │ │ │ │ +_D_u_n_e_:_:_L_D_L_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ +DDeeffiinniittiioonn ldl.hh:374 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ +Statistics about the application of an inverse operator. │ │ │ │ +DDeeffiinniittiioonn solver.hh:50 │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ +int iterations │ │ │ │ +Number of iterations. │ │ │ │ +DDeeffiinniittiioonn solver.hh:69 │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ +bool converged │ │ │ │ +True if convergence criterion has been met. │ │ │ │ +DDeeffiinniittiioonn solver.hh:75 │ │ │ │ +_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ +Abstract base class for all solvers. │ │ │ │ +DDeeffiinniittiioonn solver.hh:101 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ +Category │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ +_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ +@ sequential │ │ │ │ +Category for sequential solvers. │ │ │ │ +DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ +_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ +DDeeffiinniittiioonn solverregistry.hh:77 │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ +_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r_:_:_v_a_l_u_e │ │ │ │ +@ value │ │ │ │ +Whether this is a direct solver. │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ +_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:30 │ │ │ │ +_D_u_n_e_:_:_S_t_o_r_e_s_C_o_l_u_m_n_C_o_m_p_r_e_s_s_e_d_:_:_v_a_l_u_e │ │ │ │ +@ value │ │ │ │ +whether the solver internally uses column compressed storage │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:36 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamgsmoother.hh File Reference │ │ │ +dune-istl: matrixmarket.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,42 +65,271 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ -
fastamgsmoother.hh File Reference
│ │ │ +Namespaces | │ │ │ +Enumerations | │ │ │ +Functions | │ │ │ +Variables
│ │ │ + │ │ │ │ │ │
│ │ │ -
#include <cstddef>
│ │ │ + │ │ │ +

Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices. │ │ │ +More...

│ │ │ +
#include <algorithm>
│ │ │ +#include <complex>
│ │ │ +#include <cstddef>
│ │ │ +#include <fstream>
│ │ │ +#include <ios>
│ │ │ +#include <iostream>
│ │ │ +#include <istream>
│ │ │ +#include <limits>
│ │ │ +#include <ostream>
│ │ │ +#include <set>
│ │ │ +#include <sstream>
│ │ │ +#include <string>
│ │ │ +#include <tuple>
│ │ │ +#include <type_traits>
│ │ │ +#include <vector>
│ │ │ +#include <dune/common/exceptions.hh>
│ │ │ +#include <dune/common/fmatrix.hh>
│ │ │ +#include <dune/common/fvector.hh>
│ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ +#include <dune/common/stdstreams.hh>
│ │ │ +#include <dune/common/simd/simd.hh>
│ │ │ +#include <dune/istl/bcrsmatrix.hh>
│ │ │ +#include <dune/istl/bvector.hh>
│ │ │ +#include <dune/istl/matrixutils.hh>
│ │ │ +#include <dune/istl/owneroverlapcopy.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

struct  Dune::Amg::GaussSeidelPresmoothDefect< level >
struct  Dune::MatrixMarketImpl::mm_numeric_type< T >
 Helper metaprogram to get the matrix market string representation of the numeric type. More...
 
struct  Dune::MatrixMarketImpl::mm_numeric_type< int >
 
struct  Dune::MatrixMarketImpl::mm_numeric_type< double >
 
struct  Dune::MatrixMarketImpl::mm_numeric_type< float >
 
struct  Dune::MatrixMarketImpl::mm_numeric_type< std::complex< double > >
 
struct  Dune::MatrixMarketImpl::mm_numeric_type< std::complex< float > >
 
struct  Dune::MatrixMarketImpl::mm_header_printer< BCRSMatrix< T, A > >
 
struct  Dune::MatrixMarketImpl::mm_header_printer< BlockVector< B, A > >
 
struct  Dune::MatrixMarketImpl::mm_header_printer< FieldVector< T, j > >
 
struct  Dune::MatrixMarketImpl::mm_header_printer< FieldMatrix< T, i, j > >
 
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BlockVector< T, A > >
 
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BlockVector< FieldVector< T, i >, A > >
 
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BCRSMatrix< T, A > >
 
struct  Dune::MatrixMarketImpl::mm_block_structure_header< BCRSMatrix< FieldMatrix< T, i, j >, A > >
 
struct  Dune::MatrixMarketImpl::mm_block_structure_header< FieldMatrix< T, i, j > >
 
struct  Dune::MatrixMarketImpl::mm_block_structure_header< FieldVector< T, i > >
 
struct  Dune::Amg::GaussSeidelPostsmoothDefect< level >
struct  Dune::MatrixMarketImpl::MMHeader
 
struct  Dune::MatrixMarketImpl::IndexData< T >
 
struct  Dune::MatrixMarketImpl::NumericWrapper< T >
 a wrapper class of numeric values. More...
 
struct  Dune::MatrixMarketImpl::PatternDummy
 Utility class for marking the pattern type of the MatrixMarket matrices. More...
 
struct  Dune::MatrixMarketImpl::NumericWrapper< PatternDummy >
 
struct  Dune::MatrixMarketImpl::MatrixValuesSetter< D, brows, bcols >
 Functor to the data values of the matrix. More...
 
struct  Dune::MatrixMarketImpl::MatrixValuesSetter< PatternDummy, brows, bcols >
 
struct  Dune::MatrixMarketImpl::is_complex< T >
 
struct  Dune::MatrixMarketImpl::is_complex< std::complex< T > >
 
struct  Dune::MatrixMarketImpl::mm_multipliers< M >
 
struct  Dune::MatrixMarketImpl::mm_multipliers< BCRSMatrix< B, A > >
 
struct  Dune::MatrixMarketImpl::mm_multipliers< BCRSMatrix< FieldMatrix< B, i, j >, A > >
 
class  Dune::MatrixMarketFormatError
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ + │ │ │ │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
namespace  Dune::MatrixMarketImpl
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +

│ │ │ +Enumerations

enum  Dune::MatrixMarketImpl::LineType { Dune::MatrixMarketImpl::MM_HEADER │ │ │ +, Dune::MatrixMarketImpl::MM_ISTLSTRUCT │ │ │ +, Dune::MatrixMarketImpl::DATA │ │ │ + }
 
enum  { Dune::MatrixMarketImpl::MM_MAX_LINE_LENGTH =1025 │ │ │ + }
 
enum  Dune::MatrixMarketImpl::MM_TYPE { Dune::MatrixMarketImpl::coordinate_type │ │ │ +, Dune::MatrixMarketImpl::array_type │ │ │ +, Dune::MatrixMarketImpl::unknown_type │ │ │ + }
 
enum  Dune::MatrixMarketImpl::MM_CTYPE {
│ │ │ +  Dune::MatrixMarketImpl::integer_type │ │ │ +, Dune::MatrixMarketImpl::double_type │ │ │ +, Dune::MatrixMarketImpl::complex_type │ │ │ +, Dune::MatrixMarketImpl::pattern │ │ │ +,
│ │ │ +  Dune::MatrixMarketImpl::unknown_ctype │ │ │ +
│ │ │ + }
 
enum  Dune::MatrixMarketImpl::MM_STRUCTURE {
│ │ │ +  Dune::MatrixMarketImpl::general │ │ │ +, Dune::MatrixMarketImpl::symmetric │ │ │ +, Dune::MatrixMarketImpl::skew_symmetric │ │ │ +, Dune::MatrixMarketImpl::hermitian │ │ │ +,
│ │ │ +  Dune::MatrixMarketImpl::unknown_structure │ │ │ +
│ │ │ + }
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +

│ │ │ +Functions

bool Dune::MatrixMarketImpl::lineFeed (std::istream &file)
 
void Dune::MatrixMarketImpl::skipComments (std::istream &file)
 
bool Dune::MatrixMarketImpl::readMatrixMarketBanner (std::istream &file, MMHeader &mmHeader)
 
template<std::size_t brows, std::size_t bcols>
std::tuple< std::size_t, std::size_t, std::size_t > Dune::MatrixMarketImpl::calculateNNZ (std::size_t rows, std::size_t cols, std::size_t entries, const MMHeader &header)
 
template<typename T >
std::istream & Dune::MatrixMarketImpl::operator>> (std::istream &is, NumericWrapper< T > &num)
 
std::istream & Dune::MatrixMarketImpl::operator>> (std::istream &is, NumericWrapper< PatternDummy > &num)
 
template<typename T >
bool Dune::MatrixMarketImpl::operator< (const IndexData< T > &i1, const IndexData< T > &i2)
 LessThan operator.
 
template<typename T >
std::istream & Dune::MatrixMarketImpl::operator>> (std::istream &is, IndexData< T > &data)
 Read IndexData from a stream.
 
template<typename T >
std::istream & Dune::MatrixMarketImpl::operator>> (std::istream &is, IndexData< NumericWrapper< std::complex< T > > > &data)
 Read IndexData from a stream. Specialization for std::complex.
 
template<class T >
std::enable_if_t<!is_complex< T >::value, T > Dune::MatrixMarketImpl::conj (const T &r)
 
template<class T >
std::enable_if_t< is_complex< T >::value, T > Dune::MatrixMarketImpl::conj (const T &r)
 
template<typename T , typename A , typename D >
void Dune::MatrixMarketImpl::readSparseEntries (Dune::BCRSMatrix< T, A > &matrix, std::istream &file, std::size_t entries, const MMHeader &mmHeader, const D &)
 
std::tuple< std::string, std::string > Dune::MatrixMarketImpl::splitFilename (const std::string &filename)
 
void Dune::mm_read_header (std::size_t &rows, std::size_t &cols, MatrixMarketImpl::MMHeader &header, std::istream &istr, bool isVector)
 
template<typename T , typename A >
void Dune::mm_read_vector_entries (Dune::BlockVector< T, A > &vector, std::size_t size, std::istream &istr, size_t lane)
 
template<typename T , typename A , int entries>
void Dune::mm_read_vector_entries (Dune::BlockVector< Dune::FieldVector< T, entries >, A > &vector, std::size_t size, std::istream &istr, size_t lane)
 
template<typename T , typename A >
void Dune::readMatrixMarket (Dune::BlockVector< T, A > &vector, std::istream &istr)
 Reads a BlockVector from a matrix market file.
 
template<typename T , typename A >
void Dune::readMatrixMarket (Dune::BCRSMatrix< T, A > &matrix, std::istream &istr)
 Reads a sparse matrix from a matrix market file.
 
template<typename B >
void Dune::mm_print_entry (const B &entry, std::size_t rowidx, std::size_t colidx, std::ostream &ostr)
 
template<typename V >
void Dune::mm_print_vector_entry (const V &entry, std::ostream &ostr, const std::integral_constant< int, 1 > &, size_t lane)
 
template<typename V >
void Dune::mm_print_vector_entry (const V &vector, std::ostream &ostr, const std::integral_constant< int, 0 > &, size_t lane)
 
template<typename T , typename A >
std::size_t Dune::countEntries (const BlockVector< T, A > &vector)
 
template<typename T , typename A , int i>
std::size_t Dune::countEntries (const BlockVector< FieldVector< T, i >, A > &vector)
 
template<typename V >
void Dune::writeMatrixMarket (const V &vector, std::ostream &ostr, const std::integral_constant< int, 0 > &)
 
template<typename M >
void Dune::writeMatrixMarket (const M &matrix, std::ostream &ostr, const std::integral_constant< int, 1 > &)
 
template<typename M >
void Dune::writeMatrixMarket (const M &matrix, std::ostream &ostr)
 writes a ISTL matrix or vector to a stream in matrix market format.
 
template<typename M >
void Dune::storeMatrixMarket (const M &matrix, std::string filename, int prec=default_precision)
 Stores a parallel matrix/vector in matrix market format in a file.
 
template<typename M , typename G , typename L >
void Dune::storeMatrixMarket (const M &matrix, std::string filename, const OwnerOverlapCopyCommunication< G, L > &comm, bool storeIndices=true, int prec=default_precision)
 Stores a parallel matrix/vector in matrix market format in a file.
 
template<typename M , typename G , typename L >
void Dune::loadMatrixMarket (M &matrix, const std::string &filename, OwnerOverlapCopyCommunication< G, L > &comm, bool readIndices=true)
 Load a parallel matrix/vector stored in matrix market format.
 
template<typename M >
void Dune::loadMatrixMarket (M &matrix, const std::string &filename)
 Load a matrix/vector stored in matrix market format.
 
│ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Variables

static const int Dune::default_precision = -1
 
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Provides classes for reading and writing MatrixMarket Files with an extension for parallel matrices.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,23 +1,316 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ -fastamgsmoother.hh File Reference │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _E_n_u_m_e_r_a_t_i_o_n_s | _F_u_n_c_t_i_o_n_s | _V_a_r_i_a_b_l_e_s │ │ │ │ +matrixmarket.hh File Reference │ │ │ │ +_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _S_p_a_r_s_e_ _M_a_t_r_i_x_ _a_n_d_ _V_e_c_t_o_r_ _c_l_a_s_s_e_s » │ │ │ │ +_I_O_ _f_o_r_ _m_a_t_r_i_c_e_s_ _a_n_d_ _v_e_c_t_o_r_s_. │ │ │ │ +Provides classes for reading and writing MatrixMarket Files with an extension │ │ │ │ +for parallel matrices. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ #include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_<_ _l_e_v_e_l_ _> │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _T_ _> │ │ │ │ +  Helper metaprogram to get the matrix market string representation of │ │ │ │ + the numeric type. _M_o_r_e_._._. │ │ │ │   │ │ │ │ -struct   _D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t_<_ _l_e_v_e_l_ _> │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _i_n_t_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _d_o_u_b_l_e_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _f_l_o_a_t_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _f_l_o_a_t_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _j_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _i_,_ _j_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _> │ │ │ │ + _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_< │ │ │ │ + _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _i_ _>_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _> │ │ │ │ + _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_C_R_S_M_a_t_r_i_x_< │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _i_,_ _j_ _>_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _i_, │ │ │ │ + _j_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _i_ _> │ │ │ │ + _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_I_n_d_e_x_D_a_t_a_<_ _T_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_N_u_m_e_r_i_c_W_r_a_p_p_e_r_<_ _T_ _> │ │ │ │ +  a wrapper class of numeric values. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_P_a_t_t_e_r_n_D_u_m_m_y │ │ │ │ +  Utility class for marking the pattern type of the MatrixMarket │ │ │ │ + matrices. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_N_u_m_e_r_i_c_W_r_a_p_p_e_r_<_ _P_a_t_t_e_r_n_D_u_m_m_y_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r_<_ _D_,_ _b_r_o_w_s_,_ _b_c_o_l_s_ _> │ │ │ │ +  Functor to the data values of the matrix. _M_o_r_e_._._. │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r_<_ _P_a_t_t_e_r_n_D_u_m_m_y_,_ _b_r_o_w_s_,_ _b_c_o_l_s │ │ │ │ + _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_i_s___c_o_m_p_l_e_x_<_ _T_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_i_s___c_o_m_p_l_e_x_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _T_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___m_u_l_t_i_p_l_i_e_r_s_<_ _M_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___m_u_l_t_i_p_l_i_e_r_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ +struct   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___m_u_l_t_i_p_l_i_e_r_s_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _B_,_ _i_, │ │ │ │ + _j_ _>_,_ _A_ _>_ _> │ │ │ │ +  │ │ │ │ + class   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +namespace   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l │ │ │ │ +  │ │ │ │ +EEnnuummeerraattiioonnss │ │ │ │ +enum   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_L_i_n_e_T_y_p_e { _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___H_E_A_D_E_R , │ │ │ │ + _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___I_S_T_L_S_T_R_U_C_T , _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_D_A_T_A } │ │ │ │ +  │ │ │ │ +enum   { _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___M_A_X___L_I_N_E___L_E_N_G_T_H =1025 } │ │ │ │ +  │ │ │ │ +enum   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___T_Y_P_E { _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_: │ │ │ │ + _c_o_o_r_d_i_n_a_t_e___t_y_p_e , _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_a_r_r_a_y___t_y_p_e , _D_u_n_e_:_: │ │ │ │ + _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_u_n_k_n_o_w_n___t_y_p_e } │ │ │ │ +  │ │ │ │ +enum   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___C_T_Y_P_E { │ │ │ │ +   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_i_n_t_e_g_e_r___t_y_p_e , _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_: │ │ │ │ + _d_o_u_b_l_e___t_y_p_e , _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_o_m_p_l_e_x___t_y_p_e , _D_u_n_e_:_: │ │ │ │ + _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_p_a_t_t_e_r_n , │ │ │ │ +   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_u_n_k_n_o_w_n___c_t_y_p_e │ │ │ │ + } │ │ │ │ +  │ │ │ │ +enum   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___S_T_R_U_C_T_U_R_E { │ │ │ │ +   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_g_e_n_e_r_a_l , _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_y_m_m_e_t_r_i_c , │ │ │ │ + _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_k_e_w___s_y_m_m_e_t_r_i_c , _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_: │ │ │ │ + _h_e_r_m_i_t_i_a_n , │ │ │ │ +   _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_u_n_k_n_o_w_n___s_t_r_u_c_t_u_r_e │ │ │ │ + } │ │ │ │ +  │ │ │ │ +FFuunnccttiioonnss │ │ │ │ + bool  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_l_i_n_e_F_e_e_d (std:: │ │ │ │ + istream &file) │ │ │ │ +  │ │ │ │ + void  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_k_i_p_C_o_m_m_e_n_t_s │ │ │ │ + (std::istream &file) │ │ │ │ +  │ │ │ │ + bool  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_: │ │ │ │ + _r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t_B_a_n_n_e_r (std::istream │ │ │ │ + &file, _M_M_H_e_a_d_e_r &mmHeader) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::tuple< std::size_t, std::size_t, _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_a_l_c_u_l_a_t_e_N_N_Z │ │ │ │ + std::size_t >  (std::size_t rows, std::size_t cols, │ │ │ │ + std::size_t entries, const _M_M_H_e_a_d_e_r │ │ │ │ + &header) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::istream &  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ + (std::istream &is, _N_u_m_e_r_i_c_W_r_a_p_p_e_r< T > │ │ │ │ + &num) │ │ │ │ +  │ │ │ │ + std::istream &  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ + (std::istream &is, _N_u_m_e_r_i_c_W_r_a_p_p_e_r< │ │ │ │ + _P_a_t_t_e_r_n_D_u_m_m_y > &num) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + bool  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ + (const _I_n_d_e_x_D_a_t_a< T > &i1, const │ │ │ │ + _I_n_d_e_x_D_a_t_a< T > &i2) │ │ │ │ +  LessThan operator. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::istream &  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ + (std::istream &is, _I_n_d_e_x_D_a_t_a< T > │ │ │ │ + &data) │ │ │ │ +  Read _I_n_d_e_x_D_a_t_a from a stream. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::istream &  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ + (std::istream &is, _I_n_d_e_x_D_a_t_a< │ │ │ │ + _N_u_m_e_r_i_c_W_r_a_p_p_e_r< std::complex< T > > > │ │ │ │ + &data) │ │ │ │ +  Read _I_n_d_e_x_D_a_t_a from a stream. │ │ │ │ + Specialization for std::complex. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::enable_if_t:: _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_o_n_j (const T │ │ │ │ + value, T >  &r) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::enable_if_t< _i_s___c_o_m_p_l_e_x< T >:: _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_o_n_j (const T │ │ │ │ + value, T >  &r) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_: │ │ │ │ + _r_e_a_d_S_p_a_r_s_e_E_n_t_r_i_e_s (_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x< T, │ │ │ │ + A > &matrix, std::istream &file, std:: │ │ │ │ + size_t entries, const _M_M_H_e_a_d_e_r │ │ │ │ + &mmHeader, const D &) │ │ │ │ +  │ │ │ │ +std::tuple< std::string, std::string >  _D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_p_l_i_t_F_i_l_e_n_a_m_e │ │ │ │ + (const std::string &filename) │ │ │ │ +  │ │ │ │ + void  _D_u_n_e_:_:_m_m___r_e_a_d___h_e_a_d_e_r (std::size_t │ │ │ │ + &rows, std::size_t &cols, │ │ │ │ + _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r &header, │ │ │ │ + std::istream &istr, bool isVector) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s (_D_u_n_e_:_: │ │ │ │ + _B_l_o_c_k_V_e_c_t_o_r< T, A > &vector, std:: │ │ │ │ + size_t size, std::istream &istr, size_t │ │ │ │ + lane) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s (_D_u_n_e_:_: │ │ │ │ + _B_l_o_c_k_V_e_c_t_o_r< Dune::FieldVector< T, │ │ │ │ + entries >, A > &vector, std::size_t │ │ │ │ + size, std::istream &istr, size_t lane) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t (_D_u_n_e_:_: │ │ │ │ + _B_l_o_c_k_V_e_c_t_o_r< T, A > &vector, std:: │ │ │ │ + istream &istr) │ │ │ │ +  Reads a _B_l_o_c_k_V_e_c_t_o_r from a matrix │ │ │ │ + market file. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t (_D_u_n_e_:_: │ │ │ │ + _B_C_R_S_M_a_t_r_i_x< T, A > &matrix, std:: │ │ │ │ + istream &istr) │ │ │ │ +  Reads a sparse matrix from a matrix │ │ │ │ + market file. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_m_m___p_r_i_n_t___e_n_t_r_y (const B &entry, │ │ │ │ + std::size_t rowidx, std::size_t colidx, │ │ │ │ + std::ostream &ostr) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y (const V │ │ │ │ + &entry, std::ostream &ostr, const std:: │ │ │ │ + integral_constant< int, 1 > &, size_t │ │ │ │ + lane) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y (const V │ │ │ │ + &vector, std::ostream &ostr, const │ │ │ │ + std::integral_constant< int, 0 > &, │ │ │ │ + size_t lane) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::size_t  _D_u_n_e_:_:_c_o_u_n_t_E_n_t_r_i_e_s (const _B_l_o_c_k_V_e_c_t_o_r< │ │ │ │ + T, A > &vector) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::size_t  _D_u_n_e_:_:_c_o_u_n_t_E_n_t_r_i_e_s (const _B_l_o_c_k_V_e_c_t_o_r< │ │ │ │ + FieldVector< T, i >, A > &vector) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t (const V │ │ │ │ + &vector, std::ostream &ostr, const │ │ │ │ + std::integral_constant< int, 0 > &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t (const M │ │ │ │ + &matrix, std::ostream &ostr, const │ │ │ │ + std::integral_constant< int, 1 > &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t (const M │ │ │ │ + &matrix, std::ostream &ostr) │ │ │ │ +  writes a _I_S_T_L matrix or vector to a │ │ │ │ + stream in matrix market format. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t (const M │ │ │ │ + &matrix, std::string filename, int │ │ │ │ + prec=_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n) │ │ │ │ +  Stores a parallel matrix/vector in │ │ │ │ + matrix market format in a file. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t (const M │ │ │ │ + &matrix, std::string filename, const │ │ │ │ + _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< G, L > │ │ │ │ + &comm, bool storeIndices=true, int │ │ │ │ + prec=_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n) │ │ │ │ +  Stores a parallel matrix/vector in │ │ │ │ + matrix market format in a file. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t (M &matrix, │ │ │ │ + const std::string &filename, │ │ │ │ + _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n< G, L > │ │ │ │ + &comm, bool readIndices=true) │ │ │ │ +  Load a parallel matrix/vector stored in │ │ │ │ + matrix market format. │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t (M &matrix, │ │ │ │ + const std::string &filename) │ │ │ │ +  Load a matrix/vector stored in matrix │ │ │ │ + market format. │ │ │ │ +  │ │ │ │ +VVaarriiaabblleess │ │ │ │ +static const int  _D_u_n_e_:_:_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n = -1 │ │ │ │   │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Provides classes for reading and writing MatrixMarket Files with an extension │ │ │ │ +for parallel matrices. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamgsmoother.hh Source File │ │ │ +dune-istl: matrixmarket.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,131 +70,1503 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
fastamgsmoother.hh
│ │ │ +
matrixmarket.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH
│ │ │ -
6#define DUNE_ISTL_FASTAMGSMOOTHER_HH
│ │ │ +
5#ifndef DUNE_ISTL_MATRIXMARKET_HH
│ │ │ +
6#define DUNE_ISTL_MATRIXMARKET_HH
│ │ │
7
│ │ │ -
8#include <cstddef>
│ │ │ -
9
│ │ │ -
10namespace Dune
│ │ │ -
11{
│ │ │ -
12 namespace Amg
│ │ │ -
13 {
│ │ │ -
14
│ │ │ -
15 template<std::size_t level>
│ │ │ -
│ │ │ - │ │ │ -
17
│ │ │ -
18 template<typename M, typename X, typename Y>
│ │ │ -
│ │ │ -
19 static void apply(const M& A, X& x, Y& d,
│ │ │ -
20 const Y& b)
│ │ │ -
21 {
│ │ │ -
22 typedef typename M::ConstRowIterator RowIterator;
│ │ │ -
23 typedef typename M::ConstColIterator ColIterator;
│ │ │ -
24
│ │ │ -
25 typename Y::iterator dIter=d.begin();
│ │ │ -
26 typename Y::const_iterator bIter=b.begin();
│ │ │ -
27 typename X::iterator xIter=x.begin();
│ │ │ -
28
│ │ │ -
29 for(RowIterator row=A.begin(), end=A.end(); row != end;
│ │ │ -
30 ++row, ++dIter, ++xIter, ++bIter)
│ │ │ -
31 {
│ │ │ -
32 ColIterator col=(*row).begin();
│ │ │ -
33 *dIter = *bIter;
│ │ │ -
34
│ │ │ -
35 for (; col.index()<row.index(); ++col)
│ │ │ -
36 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ -
37 assert(row.index()==col.index());
│ │ │ -
38 ColIterator diag=col; // upper diagonal matrix not needed as x was 0 before.
│ │ │ -
39
│ │ │ -
40 // Not recursive yet. Just solve with the diagonal
│ │ │ -
41 diag->solve(*xIter,*dIter);
│ │ │ -
42 *dIter=0; //as r=v
│ │ │ -
43
│ │ │ -
44 // Update residual for the symmetric case
│ │ │ -
45 for(col=(*row).begin(); col.index()<row.index(); ++col)
│ │ │ -
46 col->mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ -
47 }
│ │ │ -
48 }
│ │ │ -
│ │ │ -
49 };
│ │ │ -
│ │ │ -
50
│ │ │ -
51 template<std::size_t level>
│ │ │ -
│ │ │ - │ │ │ -
53
│ │ │ -
54 template<typename M, typename X, typename Y>
│ │ │ -
│ │ │ -
55 static void apply(const M& A, X& x, Y& d,
│ │ │ -
56 const Y& b)
│ │ │ -
57 {
│ │ │ -
58 typedef typename M::ConstRowIterator RowIterator;
│ │ │ -
59 typedef typename M::ConstColIterator ColIterator;
│ │ │ -
60 typedef typename Y::block_type YBlock;
│ │ │ -
61
│ │ │ -
62 typename Y::iterator dIter=d.beforeEnd();
│ │ │ -
63 typename X::iterator xIter=x.beforeEnd();
│ │ │ -
64 typename Y::const_iterator bIter=b.beforeEnd();
│ │ │ -
65
│ │ │ -
66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
│ │ │ -
67 --row, --dIter, --xIter, --bIter)
│ │ │ -
68 {
│ │ │ -
69 ColIterator endCol=(*row).beforeBegin();
│ │ │ -
70 ColIterator col=(*row).beforeEnd();
│ │ │ -
71 *dIter = *bIter;
│ │ │ -
72
│ │ │ -
73 for (; col.index()>row.index(); --col)
│ │ │ -
74 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j
│ │ │ -
75 assert(row.index()==col.index());
│ │ │ -
76 ColIterator diag=col;
│ │ │ -
77 YBlock v=*dIter;
│ │ │ -
78 // upper diagonal matrix
│ │ │ -
79 for (--col; col!=endCol; --col)
│ │ │ -
80 (*col).mmv(x[col.index()],v); // v -= sum_{j<i} a_ij * xold_j
│ │ │ -
81
│ │ │ -
82 // Not recursive yet. Just solve with the diagonal
│ │ │ -
83 diag->solve(*xIter,v);
│ │ │ +
8#include <algorithm>
│ │ │ +
9#include <complex>
│ │ │ +
10#include <cstddef>
│ │ │ +
11#include <fstream>
│ │ │ +
12#include <ios>
│ │ │ +
13#include <iostream>
│ │ │ +
14#include <istream>
│ │ │ +
15#include <limits>
│ │ │ +
16#include <ostream>
│ │ │ +
17#include <set>
│ │ │ +
18#include <sstream>
│ │ │ +
19#include <string>
│ │ │ +
20#include <tuple>
│ │ │ +
21#include <type_traits>
│ │ │ +
22#include <vector>
│ │ │ +
23
│ │ │ +
24#include <dune/common/exceptions.hh>
│ │ │ +
25#include <dune/common/fmatrix.hh>
│ │ │ +
26#include <dune/common/fvector.hh>
│ │ │ +
27#include <dune/common/hybridutilities.hh>
│ │ │ +
28#include <dune/common/stdstreams.hh>
│ │ │ +
29#include <dune/common/simd/simd.hh>
│ │ │ +
30
│ │ │ + │ │ │ +
32#include <dune/istl/bvector.hh>
│ │ │ +
33#include <dune/istl/matrixutils.hh> // countNonZeros()
│ │ │ + │ │ │ +
35
│ │ │ +
36namespace Dune
│ │ │ +
37{
│ │ │ +
38
│ │ │ +
│ │ │ +
64 namespace MatrixMarketImpl
│ │ │ +
65 {
│ │ │ +
75 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
77 enum {
│ │ │ +
81 is_numeric=false
│ │ │ +
82 };
│ │ │ +
83 };
│ │ │ +
│ │ │
84
│ │ │ -
85 *dIter-=v;
│ │ │ -
86
│ │ │ -
87 // Update residual for the symmetric case
│ │ │ -
88 // Skip residual computation as it is not needed.
│ │ │ -
89 //for(col=(*row).begin();col.index()<row.index(); ++col)
│ │ │ -
90 //col.mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ -
91 }
│ │ │ -
92 }
│ │ │ -
│ │ │ -
93 };
│ │ │ -
│ │ │ -
94 } // end namespace Amg
│ │ │ -
95} // end namespace Dune
│ │ │ -
96#endif
│ │ │ +
85 template<>
│ │ │ +
│ │ │ +
86 struct mm_numeric_type<int>
│ │ │ +
87 {
│ │ │ +
88 enum {
│ │ │ +
92 is_numeric=true
│ │ │ +
93 };
│ │ │ +
94
│ │ │ +
│ │ │ +
95 static std::string str()
│ │ │ +
96 {
│ │ │ +
97 return "integer";
│ │ │ +
98 }
│ │ │ +
│ │ │ +
99 };
│ │ │ +
│ │ │ +
100
│ │ │ +
101 template<>
│ │ │ +
│ │ │ +
102 struct mm_numeric_type<double>
│ │ │ +
103 {
│ │ │ +
104 enum {
│ │ │ +
108 is_numeric=true
│ │ │ +
109 };
│ │ │ +
110
│ │ │ +
│ │ │ +
111 static std::string str()
│ │ │ +
112 {
│ │ │ +
113 return "real";
│ │ │ +
114 }
│ │ │ +
│ │ │ +
115 };
│ │ │ +
│ │ │ +
116
│ │ │ +
117 template<>
│ │ │ +
│ │ │ +
118 struct mm_numeric_type<float>
│ │ │ +
119 {
│ │ │ +
120 enum {
│ │ │ +
124 is_numeric=true
│ │ │ +
125 };
│ │ │ +
126
│ │ │ +
│ │ │ +
127 static std::string str()
│ │ │ +
128 {
│ │ │ +
129 return "real";
│ │ │ +
130 }
│ │ │ +
│ │ │ +
131 };
│ │ │ +
│ │ │ +
132
│ │ │ +
133 template<>
│ │ │ +
│ │ │ +
134 struct mm_numeric_type<std::complex<double> >
│ │ │ +
135 {
│ │ │ +
136 enum {
│ │ │ +
140 is_numeric=true
│ │ │ +
141 };
│ │ │ +
142
│ │ │ +
│ │ │ +
143 static std::string str()
│ │ │ +
144 {
│ │ │ +
145 return "complex";
│ │ │ +
146 }
│ │ │ +
│ │ │ +
147 };
│ │ │ +
│ │ │ +
148
│ │ │ +
149 template<>
│ │ │ +
│ │ │ +
150 struct mm_numeric_type<std::complex<float> >
│ │ │ +
151 {
│ │ │ +
152 enum {
│ │ │ +
156 is_numeric=true
│ │ │ +
157 };
│ │ │ +
158
│ │ │ +
│ │ │ +
159 static std::string str()
│ │ │ +
160 {
│ │ │ +
161 return "complex";
│ │ │ +
162 }
│ │ │ +
│ │ │ +
163 };
│ │ │ +
│ │ │ +
164
│ │ │ +
173 template<class M>
│ │ │ + │ │ │ +
175
│ │ │ +
176 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
178 {
│ │ │ +
│ │ │ +
179 static void print(std::ostream& os)
│ │ │ +
180 {
│ │ │ +
181 os<<"%%MatrixMarket matrix coordinate ";
│ │ │ +
182 os<<mm_numeric_type<Simd::Scalar<typename Imp::BlockTraits<T>::field_type>>::str()<<" general"<<std::endl;
│ │ │ +
183 }
│ │ │ +
│ │ │ +
184 };
│ │ │ +
│ │ │ +
185
│ │ │ +
186 template<typename B, typename A>
│ │ │ +
│ │ │ + │ │ │ +
188 {
│ │ │ +
│ │ │ +
189 static void print(std::ostream& os)
│ │ │ +
190 {
│ │ │ +
191 os<<"%%MatrixMarket matrix array ";
│ │ │ +
192 os<<mm_numeric_type<Simd::Scalar<typename Imp::BlockTraits<B>::field_type>>::str()<<" general"<<std::endl;
│ │ │ +
193 }
│ │ │ +
│ │ │ +
194 };
│ │ │ +
│ │ │ +
195
│ │ │ +
196 template<typename T, int j>
│ │ │ +
│ │ │ +
197 struct mm_header_printer<FieldVector<T,j> >
│ │ │ +
198 {
│ │ │ +
│ │ │ +
199 static void print(std::ostream& os)
│ │ │ +
200 {
│ │ │ +
201 os<<"%%MatrixMarket matrix array ";
│ │ │ +
202 os<<mm_numeric_type<T>::str()<<" general"<<std::endl;
│ │ │ +
203 }
│ │ │ +
│ │ │ +
204 };
│ │ │ +
│ │ │ +
205
│ │ │ +
206 template<typename T, int i, int j>
│ │ │ +
│ │ │ + │ │ │ +
208 {
│ │ │ +
│ │ │ +
209 static void print(std::ostream& os)
│ │ │ +
210 {
│ │ │ +
211 os<<"%%MatrixMarket matrix array ";
│ │ │ +
212 os<<mm_numeric_type<T>::str()<<" general"<<std::endl;
│ │ │ +
213 }
│ │ │ +
│ │ │ +
214 };
│ │ │ +
│ │ │ +
215
│ │ │ +
224 template<class M>
│ │ │ + │ │ │ +
226
│ │ │ +
227 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
229 {
│ │ │ + │ │ │ +
231 static_assert(IsNumber<T>::value, "Only scalar entries are expected here!");
│ │ │ +
232
│ │ │ +
│ │ │ +
233 static void print(std::ostream& os, const M&)
│ │ │ +
234 {
│ │ │ +
235 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
236 os<<"1 1"<<std::endl;
│ │ │ +
237 }
│ │ │ +
│ │ │ +
238 };
│ │ │ +
│ │ │ +
239
│ │ │ +
240 template<typename T, typename A, int i>
│ │ │ +
│ │ │ +
241 struct mm_block_structure_header<BlockVector<FieldVector<T,i>,A> >
│ │ │ +
242 {
│ │ │ + │ │ │ +
244
│ │ │ +
│ │ │ +
245 static void print(std::ostream& os, const M&)
│ │ │ +
246 {
│ │ │ +
247 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
248 os<<i<<" "<<1<<std::endl;
│ │ │ +
249 }
│ │ │ +
│ │ │ +
250 };
│ │ │ +
│ │ │ +
251
│ │ │ +
252 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
254 {
│ │ │ + │ │ │ +
256 static_assert(IsNumber<T>::value, "Only scalar entries are expected here!");
│ │ │ +
257
│ │ │ +
│ │ │ +
258 static void print(std::ostream& os, const M&)
│ │ │ +
259 {
│ │ │ +
260 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
261 os<<"1 1"<<std::endl;
│ │ │ +
262 }
│ │ │ +
│ │ │ +
263 };
│ │ │ +
│ │ │ +
264
│ │ │ +
265 template<typename T, typename A, int i, int j>
│ │ │ +
│ │ │ + │ │ │ +
267 {
│ │ │ + │ │ │ +
269
│ │ │ +
│ │ │ +
270 static void print(std::ostream& os, const M&)
│ │ │ +
271 {
│ │ │ +
272 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
273 os<<i<<" "<<j<<std::endl;
│ │ │ +
274 }
│ │ │ +
│ │ │ +
275 };
│ │ │ +
│ │ │ +
276
│ │ │ +
277
│ │ │ +
278 template<typename T, int i, int j>
│ │ │ +
│ │ │ + │ │ │ +
280 {
│ │ │ + │ │ │ +
282
│ │ │ +
│ │ │ +
283 static void print(std::ostream& os, const M& m)
│ │ │ +
284 {}
│ │ │ +
│ │ │ +
285 };
│ │ │ +
│ │ │ +
286
│ │ │ +
287 template<typename T, int i>
│ │ │ +
│ │ │ +
288 struct mm_block_structure_header<FieldVector<T,i> >
│ │ │ +
289 {
│ │ │ +
290 typedef FieldVector<T,i> M;
│ │ │ +
291
│ │ │ +
│ │ │ +
292 static void print(std::ostream& os, const M& m)
│ │ │ +
293 {}
│ │ │ +
│ │ │ +
294 };
│ │ │ +
│ │ │ +
295
│ │ │ + │ │ │ +
297 enum { MM_MAX_LINE_LENGTH=1025 };
│ │ │ +
298
│ │ │ + │ │ │ +
300
│ │ │ + │ │ │ +
302
│ │ │ + │ │ │ +
304
│ │ │ +
│ │ │ +
305 struct MMHeader
│ │ │ +
306 {
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
309 {}
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
313 };
│ │ │ +
│ │ │ +
314
│ │ │ +
│ │ │ +
315 inline bool lineFeed(std::istream& file)
│ │ │ +
316 {
│ │ │ +
317 char c;
│ │ │ +
318 if(!file.eof())
│ │ │ +
319 c=file.peek();
│ │ │ +
320 else
│ │ │ +
321 return false;
│ │ │ +
322 // ignore whitespace
│ │ │ +
323 while(c==' ')
│ │ │ +
324 {
│ │ │ +
325 file.get();
│ │ │ +
326 if(file.eof())
│ │ │ +
327 return false;
│ │ │ +
328 c=file.peek();
│ │ │ +
329 }
│ │ │ +
330
│ │ │ +
331 if(c=='\n') {
│ │ │ +
332 /* eat the line feed */
│ │ │ +
333 file.get();
│ │ │ +
334 return true;
│ │ │ +
335 }
│ │ │ +
336 return false;
│ │ │ +
337 }
│ │ │ +
│ │ │ +
338
│ │ │ +
│ │ │ +
339 inline void skipComments(std::istream& file)
│ │ │ +
340 {
│ │ │ +
341 lineFeed(file);
│ │ │ +
342 char c=file.peek();
│ │ │ +
343 // ignore comment lines
│ │ │ +
344 while(c=='%')
│ │ │ +
345 {
│ │ │ +
346 /* discard the rest of the line */
│ │ │ +
347 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
348 c=file.peek();
│ │ │ +
349 }
│ │ │ +
350 }
│ │ │ +
│ │ │ +
351
│ │ │ +
352
│ │ │ +
│ │ │ +
353 inline bool readMatrixMarketBanner(std::istream& file, MMHeader& mmHeader)
│ │ │ +
354 {
│ │ │ +
355 std::string buffer;
│ │ │ +
356 char c;
│ │ │ +
357 file >> buffer;
│ │ │ +
358 c=buffer[0];
│ │ │ +
359 mmHeader=MMHeader();
│ │ │ +
360 if(c!='%')
│ │ │ +
361 return false;
│ │ │ +
362 dverb<<buffer<<std::endl;
│ │ │ +
363 /* read the banner */
│ │ │ +
364 if(buffer!="%%MatrixMarket") {
│ │ │ +
365 /* discard the rest of the line */
│ │ │ +
366 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
367 return false;
│ │ │ +
368 }
│ │ │ +
369
│ │ │ +
370 if(lineFeed(file))
│ │ │ +
371 /* premature end of line */
│ │ │ +
372 return false;
│ │ │ +
373
│ │ │ +
374 /* read the matrix_type */
│ │ │ +
375 file >> buffer;
│ │ │ +
376
│ │ │ +
377 if(buffer != "matrix")
│ │ │ +
378 {
│ │ │ +
379 /* discard the rest of the line */
│ │ │ +
380 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
381 return false;
│ │ │ +
382 }
│ │ │ +
383
│ │ │ +
384 if(lineFeed(file))
│ │ │ +
385 /* premature end of line */
│ │ │ +
386 return false;
│ │ │ +
387
│ │ │ +
388 /* The type of the matrix */
│ │ │ +
389 file >> buffer;
│ │ │ +
390
│ │ │ +
391 if(buffer.empty())
│ │ │ +
392 return false;
│ │ │ +
393
│ │ │ +
394 std::transform(buffer.begin(), buffer.end(), buffer.begin(),
│ │ │ +
395 ::tolower);
│ │ │ +
396
│ │ │ +
397 switch(buffer[0])
│ │ │ +
398 {
│ │ │ +
399 case 'a' :
│ │ │ +
400 /* sanity check */
│ │ │ +
401 if(buffer != "array")
│ │ │ +
402 {
│ │ │ +
403 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
404 return false;
│ │ │ +
405 }
│ │ │ +
406 mmHeader.type=array_type;
│ │ │ +
407 break;
│ │ │ +
408 case 'c' :
│ │ │ +
409 /* sanity check */
│ │ │ +
410 if(buffer != "coordinate")
│ │ │ +
411 {
│ │ │ +
412 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
413 return false;
│ │ │ +
414 }
│ │ │ +
415 mmHeader.type=coordinate_type;
│ │ │ +
416 break;
│ │ │ +
417 default :
│ │ │ +
418 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
419 return false;
│ │ │ +
420 }
│ │ │ +
421
│ │ │ +
422 if(lineFeed(file))
│ │ │ +
423 /* premature end of line */
│ │ │ +
424 return false;
│ │ │ +
425
│ │ │ +
426 /* The numeric type used. */
│ │ │ +
427 file >> buffer;
│ │ │ +
428
│ │ │ +
429 if(buffer.empty())
│ │ │ +
430 return false;
│ │ │ +
431
│ │ │ +
432 std::transform(buffer.begin(), buffer.end(), buffer.begin(),
│ │ │ +
433 ::tolower);
│ │ │ +
434 switch(buffer[0])
│ │ │ +
435 {
│ │ │ +
436 case 'i' :
│ │ │ +
437 /* sanity check */
│ │ │ +
438 if(buffer != "integer")
│ │ │ +
439 {
│ │ │ +
440 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
441 return false;
│ │ │ +
442 }
│ │ │ +
443 mmHeader.ctype=integer_type;
│ │ │ +
444 break;
│ │ │ +
445 case 'r' :
│ │ │ +
446 /* sanity check */
│ │ │ +
447 if(buffer != "real")
│ │ │ +
448 {
│ │ │ +
449 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
450 return false;
│ │ │ +
451 }
│ │ │ +
452 mmHeader.ctype=double_type;
│ │ │ +
453 break;
│ │ │ +
454 case 'c' :
│ │ │ +
455 /* sanity check */
│ │ │ +
456 if(buffer != "complex")
│ │ │ +
457 {
│ │ │ +
458 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
459 return false;
│ │ │ +
460 }
│ │ │ +
461 mmHeader.ctype=complex_type;
│ │ │ +
462 break;
│ │ │ +
463 case 'p' :
│ │ │ +
464 /* sanity check */
│ │ │ +
465 if(buffer != "pattern")
│ │ │ +
466 {
│ │ │ +
467 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
468 return false;
│ │ │ +
469 }
│ │ │ +
470 mmHeader.ctype=pattern;
│ │ │ +
471 break;
│ │ │ +
472 default :
│ │ │ +
473 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
474 return false;
│ │ │ +
475 }
│ │ │ +
476
│ │ │ +
477 if(lineFeed(file))
│ │ │ +
478 return false;
│ │ │ +
479
│ │ │ +
480 file >> buffer;
│ │ │ +
481
│ │ │ +
482 std::transform(buffer.begin(), buffer.end(), buffer.begin(),
│ │ │ +
483 ::tolower);
│ │ │ +
484 switch(buffer[0])
│ │ │ +
485 {
│ │ │ +
486 case 'g' :
│ │ │ +
487 /* sanity check */
│ │ │ +
488 if(buffer != "general")
│ │ │ +
489 {
│ │ │ +
490 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
491 return false;
│ │ │ +
492 }
│ │ │ +
493 mmHeader.structure=general;
│ │ │ +
494 break;
│ │ │ +
495 case 'h' :
│ │ │ +
496 /* sanity check */
│ │ │ +
497 if(buffer != "hermitian")
│ │ │ +
498 {
│ │ │ +
499 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
500 return false;
│ │ │ +
501 }
│ │ │ +
502 mmHeader.structure=hermitian;
│ │ │ +
503 break;
│ │ │ +
504 case 's' :
│ │ │ +
505 if(buffer.size()==1) {
│ │ │ +
506 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
507 return false;
│ │ │ +
508 }
│ │ │ +
509
│ │ │ +
510 switch(buffer[1])
│ │ │ +
511 {
│ │ │ +
512 case 'y' :
│ │ │ +
513 /* sanity check */
│ │ │ +
514 if(buffer != "symmetric")
│ │ │ +
515 {
│ │ │ +
516 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
517 return false;
│ │ │ +
518 }
│ │ │ +
519 mmHeader.structure=symmetric;
│ │ │ +
520 break;
│ │ │ +
521 case 'k' :
│ │ │ +
522 /* sanity check */
│ │ │ +
523 if(buffer != "skew-symmetric")
│ │ │ +
524 {
│ │ │ +
525 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
526 return false;
│ │ │ +
527 }
│ │ │ +
528 mmHeader.structure=skew_symmetric;
│ │ │ +
529 break;
│ │ │ +
530 default :
│ │ │ +
531 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
532 return false;
│ │ │ +
533 }
│ │ │ +
534 break;
│ │ │ +
535 default :
│ │ │ +
536 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
537 return false;
│ │ │ +
538 }
│ │ │ +
539 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
540 c=file.peek();
│ │ │ +
541 return true;
│ │ │ +
542
│ │ │ +
543 }
│ │ │ +
│ │ │ +
544
│ │ │ +
545 template<std::size_t brows, std::size_t bcols>
│ │ │ +
546 std::tuple<std::size_t, std::size_t, std::size_t>
│ │ │ +
│ │ │ +
547 calculateNNZ(std::size_t rows, std::size_t cols, std::size_t entries, const MMHeader& header)
│ │ │ +
548 {
│ │ │ +
549 std::size_t blockrows=rows/brows;
│ │ │ +
550 std::size_t blockcols=cols/bcols;
│ │ │ +
551 std::size_t blocksize=brows*bcols;
│ │ │ +
552 std::size_t blockentries=0;
│ │ │ +
553
│ │ │ +
554 switch(header.structure)
│ │ │ +
555 {
│ │ │ +
556 case general :
│ │ │ +
557 blockentries = entries/blocksize; break;
│ │ │ +
558 case skew_symmetric :
│ │ │ +
559 blockentries = 2*entries/blocksize; break;
│ │ │ +
560 case symmetric :
│ │ │ +
561 blockentries = (2*entries-rows)/blocksize; break;
│ │ │ +
562 case hermitian :
│ │ │ +
563 blockentries = (2*entries-rows)/blocksize; break;
│ │ │ +
564 default :
│ │ │ +
565 throw Dune::NotImplemented();
│ │ │ +
566 }
│ │ │ +
567 return std::make_tuple(blockrows, blockcols, blockentries);
│ │ │ +
568 }
│ │ │ +
│ │ │ +
569
│ │ │ +
570 /*
│ │ │ +
571 * @brief Storage class for the column index and the numeric value.
│ │ │ +
572 *
│ │ │ +
573 * \tparam T Either a NumericWrapper of the numeric type or PatternDummy
│ │ │ +
574 * for MatrixMarket pattern case.
│ │ │ +
575 */
│ │ │ +
576 template<typename T>
│ │ │ +
│ │ │ +
577 struct IndexData : public T
│ │ │ +
578 {
│ │ │ +
579 std::size_t index = {};
│ │ │ +
580 };
│ │ │ +
│ │ │ +
581
│ │ │ +
582
│ │ │ +
593 template<typename T>
│ │ │ +
│ │ │ + │ │ │ +
595 {
│ │ │ +
596 T number = {};
│ │ │ +
│ │ │ +
597 operator T&()
│ │ │ +
598 {
│ │ │ +
599 return number;
│ │ │ +
600 }
│ │ │ +
│ │ │ +
601 };
│ │ │ +
│ │ │ +
602
│ │ │ +
│ │ │ + │ │ │ +
607 {};
│ │ │ +
│ │ │ +
608
│ │ │ +
609 template<>
│ │ │ +
│ │ │ + │ │ │ +
611 {};
│ │ │ +
│ │ │ +
612
│ │ │ +
613 template<typename T>
│ │ │ +
│ │ │ +
614 std::istream& operator>>(std::istream& is, NumericWrapper<T>& num)
│ │ │ +
615 {
│ │ │ +
616 return is>>num.number;
│ │ │ +
617 }
│ │ │ +
│ │ │ +
618
│ │ │ +
│ │ │ +
619 inline std::istream& operator>>(std::istream& is, [[maybe_unused]] NumericWrapper<PatternDummy>& num)
│ │ │ +
620 {
│ │ │ +
621 return is;
│ │ │ +
622 }
│ │ │ +
│ │ │ +
623
│ │ │ +
629 template<typename T>
│ │ │ +
│ │ │ +
630 bool operator<(const IndexData<T>& i1, const IndexData<T>& i2)
│ │ │ +
631 {
│ │ │ +
632 return i1.index<i2.index;
│ │ │ +
633 }
│ │ │ +
│ │ │ +
634
│ │ │ +
640 template<typename T>
│ │ │ +
│ │ │ +
641 std::istream& operator>>(std::istream& is, IndexData<T>& data)
│ │ │ +
642 {
│ │ │ +
643 is>>data.index;
│ │ │ +
644 /* MatrixMarket indices are one based. Decrement for C++ */
│ │ │ +
645 --data.index;
│ │ │ +
646 return is>>data.number;
│ │ │ +
647 }
│ │ │ +
│ │ │ +
648
│ │ │ +
654 template<typename T>
│ │ │ +
│ │ │ +
655 std::istream& operator>>(std::istream& is, IndexData<NumericWrapper<std::complex<T>>>& data)
│ │ │ +
656 {
│ │ │ +
657 is>>data.index;
│ │ │ +
658 /* MatrixMarket indices are one based. Decrement for C++ */
│ │ │ +
659 --data.index;
│ │ │ +
660 // real and imaginary part needs to be read separately as
│ │ │ +
661 // complex numbers are not provided in pair form. (x,y)
│ │ │ +
662 NumericWrapper<T> real, imag;
│ │ │ +
663 is>>real;
│ │ │ +
664 is>>imag;
│ │ │ +
665 data.number = {real.number, imag.number};
│ │ │ +
666 return is;
│ │ │ +
667 }
│ │ │ +
│ │ │ +
668
│ │ │ +
675 template<typename D, int brows, int bcols>
│ │ │ +
│ │ │ + │ │ │ +
677 {
│ │ │ +
683 template<typename T>
│ │ │ +
│ │ │ +
684 void operator()(const std::vector<std::set<IndexData<D> > >& rows,
│ │ │ +
685 BCRSMatrix<T>& matrix)
│ │ │ +
686 {
│ │ │ +
687 static_assert(IsNumber<T>::value && brows==1 && bcols==1, "Only scalar entries are expected here!");
│ │ │ +
688 for (auto iter=matrix.begin(); iter!= matrix.end(); ++iter)
│ │ │ +
689 {
│ │ │ +
690 auto brow=iter.index();
│ │ │ +
691 for (auto siter=rows[brow].begin(); siter != rows[brow].end(); ++siter)
│ │ │ +
692 (*iter)[siter->index] = siter->number;
│ │ │ +
693 }
│ │ │ +
694 }
│ │ │ +
│ │ │ +
695
│ │ │ +
701 template<typename T>
│ │ │ +
│ │ │ +
702 void operator()(const std::vector<std::set<IndexData<D> > >& rows,
│ │ │ + │ │ │ +
704 {
│ │ │ +
705 for (auto iter=matrix.begin(); iter!= matrix.end(); ++iter)
│ │ │ +
706 {
│ │ │ +
707 for (auto brow=iter.index()*brows,
│ │ │ +
708 browend=iter.index()*brows+brows;
│ │ │ +
709 brow<browend; ++brow)
│ │ │ +
710 {
│ │ │ +
711 for (auto siter=rows[brow].begin(), send=rows[brow].end();
│ │ │ +
712 siter != send; ++siter)
│ │ │ +
713 (*iter)[siter->index/bcols][brow%brows][siter->index%bcols]=siter->number;
│ │ │ +
714 }
│ │ │ +
715 }
│ │ │ +
716 }
│ │ │ +
│ │ │ +
717 };
│ │ │ +
│ │ │ +
718
│ │ │ +
719 template<int brows, int bcols>
│ │ │ +
│ │ │ + │ │ │ +
721 {
│ │ │ +
722 template<typename M>
│ │ │ +
│ │ │ +
723 void operator()(const std::vector<std::set<IndexData<PatternDummy> > >& rows,
│ │ │ +
724 M& matrix)
│ │ │ +
725 {}
│ │ │ +
│ │ │ +
726 };
│ │ │ +
│ │ │ +
727
│ │ │ +
728 template<class T> struct is_complex : std::false_type {};
│ │ │ +
729 template<class T> struct is_complex<std::complex<T>> : std::true_type {};
│ │ │ +
730
│ │ │ +
731 // wrapper for std::conj. Returns T if T is not complex.
│ │ │ +
732 template<class T>
│ │ │ +
│ │ │ +
733 std::enable_if_t<!is_complex<T>::value, T> conj(const T& r){
│ │ │ +
734 return r;
│ │ │ +
735 }
│ │ │ +
│ │ │ +
736
│ │ │ +
737 template<class T>
│ │ │ +
│ │ │ +
738 std::enable_if_t<is_complex<T>::value, T> conj(const T& r){
│ │ │ +
739 return std::conj(r);
│ │ │ +
740 }
│ │ │ +
│ │ │ +
741
│ │ │ +
742 template<typename M>
│ │ │ +
│ │ │ + │ │ │ +
744 {};
│ │ │ +
│ │ │ +
745
│ │ │ +
746 template<typename B, typename A>
│ │ │ +
│ │ │ + │ │ │ +
748 {
│ │ │ +
749 enum {
│ │ │ +
750 rows = 1,
│ │ │ +
751 cols = 1
│ │ │ +
752 };
│ │ │ +
753 };
│ │ │ +
│ │ │ +
754
│ │ │ +
755 template<typename B, int i, int j, typename A>
│ │ │ +
│ │ │ + │ │ │ +
757 {
│ │ │ +
758 enum {
│ │ │ +
759 rows = i,
│ │ │ +
760 cols = j
│ │ │ +
761 };
│ │ │ +
762 };
│ │ │ +
│ │ │ +
763
│ │ │ +
764 template<typename T, typename A, typename D>
│ │ │ +
│ │ │ + │ │ │ +
766 std::istream& file, std::size_t entries,
│ │ │ +
767 const MMHeader& mmHeader, const D&)
│ │ │ +
768 {
│ │ │ + │ │ │ +
770
│ │ │ +
771 // Number of rows and columns of T, if it is a matrix (1x1 otherwise)
│ │ │ +
772 constexpr int brows = mm_multipliers<Matrix>::rows;
│ │ │ +
773 constexpr int bcols = mm_multipliers<Matrix>::cols;
│ │ │ +
774
│ │ │ +
775 // First path
│ │ │ +
776 // store entries together with column index in a separate
│ │ │ +
777 // data structure
│ │ │ +
778 std::vector<std::set<IndexData<D> > > rows(matrix.N()*brows);
│ │ │ +
779
│ │ │ +
780 auto readloop = [&] (auto symmetryFixup) {
│ │ │ +
781 for(std::size_t i = 0; i < entries; ++i) {
│ │ │ +
782 std::size_t row;
│ │ │ +
783 IndexData<D> data;
│ │ │ +
784 skipComments(file);
│ │ │ +
785 file>>row;
│ │ │ +
786 --row; // Index was 1 based.
│ │ │ +
787 assert(row/bcols<matrix.N());
│ │ │ +
788 file>>data;
│ │ │ +
789 assert(data.index/bcols<matrix.M());
│ │ │ +
790 rows[row].insert(data);
│ │ │ +
791 if(row!=data.index)
│ │ │ +
792 symmetryFixup(row, data);
│ │ │ +
793 }
│ │ │ +
794 };
│ │ │ +
795
│ │ │ +
796 switch(mmHeader.structure)
│ │ │ +
797 {
│ │ │ +
798 case general:
│ │ │ +
799 readloop([](auto...){});
│ │ │ +
800 break;
│ │ │ +
801 case symmetric :
│ │ │ +
802 readloop([&](auto row, auto data) {
│ │ │ +
803 IndexData<D> data_sym(data);
│ │ │ +
804 data_sym.index = row;
│ │ │ +
805 rows[data.index].insert(data_sym);
│ │ │ +
806 });
│ │ │ +
807 break;
│ │ │ +
808 case skew_symmetric :
│ │ │ +
809 readloop([&](auto row, auto data) {
│ │ │ +
810 IndexData<D> data_sym;
│ │ │ +
811 data_sym.number = -data.number;
│ │ │ +
812 data_sym.index = row;
│ │ │ +
813 rows[data.index].insert(data_sym);
│ │ │ +
814 });
│ │ │ +
815 break;
│ │ │ +
816 case hermitian :
│ │ │ +
817 readloop([&](auto row, auto data) {
│ │ │ +
818 IndexData<D> data_sym;
│ │ │ +
819 data_sym.number = conj(data.number);
│ │ │ +
820 data_sym.index = row;
│ │ │ +
821 rows[data.index].insert(data_sym);
│ │ │ +
822 });
│ │ │ +
823 break;
│ │ │ +
824 default:
│ │ │ +
825 DUNE_THROW(Dune::NotImplemented,
│ │ │ +
826 "Only general, symmetric, skew-symmetric and hermitian is supported right now!");
│ │ │ +
827 }
│ │ │ +
828
│ │ │ +
829 // Setup the matrix sparsity pattern
│ │ │ +
830 int nnz=0;
│ │ │ +
831 for(typename Matrix::CreateIterator iter=matrix.createbegin();
│ │ │ +
832 iter!= matrix.createend(); ++iter)
│ │ │ +
833 {
│ │ │ +
834 for(std::size_t brow=iter.index()*brows, browend=iter.index()*brows+brows;
│ │ │ +
835 brow<browend; ++brow)
│ │ │ +
836 {
│ │ │ +
837 typedef typename std::set<IndexData<D> >::const_iterator Siter;
│ │ │ +
838 for(Siter siter=rows[brow].begin(), send=rows[brow].end();
│ │ │ +
839 siter != send; ++siter, ++nnz)
│ │ │ +
840 iter.insert(siter->index/bcols);
│ │ │ +
841 }
│ │ │ +
842 }
│ │ │ +
843
│ │ │ +
844 //Set the matrix values
│ │ │ +
845 matrix=0;
│ │ │ +
846
│ │ │ + │ │ │ +
848
│ │ │ +
849 Setter(rows, matrix);
│ │ │ +
850 }
│ │ │ +
│ │ │ +
851
│ │ │ +
│ │ │ +
852 inline std::tuple<std::string, std::string> splitFilename(const std::string& filename) {
│ │ │ +
853 std::size_t lastdot = filename.find_last_of(".");
│ │ │ +
854 if(lastdot == std::string::npos)
│ │ │ +
855 return std::make_tuple(filename, "");
│ │ │ +
856 else {
│ │ │ +
857 std::string potentialFileExtension = filename.substr(lastdot);
│ │ │ +
858 if (potentialFileExtension == ".mm" || potentialFileExtension == ".mtx")
│ │ │ +
859 return std::make_tuple(filename.substr(0, lastdot), potentialFileExtension);
│ │ │ +
860 else
│ │ │ +
861 return std::make_tuple(filename, "");
│ │ │ +
862 }
│ │ │ +
863 }
│ │ │ +
│ │ │ +
864
│ │ │ +
865 } // end namespace MatrixMarketImpl
│ │ │ +
│ │ │ +
866
│ │ │ +
│ │ │ +
867 class MatrixMarketFormatError : public Dune::Exception
│ │ │ +
868 {};
│ │ │ +
│ │ │ +
869
│ │ │ +
870
│ │ │ +
│ │ │ +
871 inline void mm_read_header(std::size_t& rows, std::size_t& cols,
│ │ │ +
872 MatrixMarketImpl::MMHeader& header, std::istream& istr,
│ │ │ +
873 bool isVector)
│ │ │ +
874 {
│ │ │ +
875 using namespace MatrixMarketImpl;
│ │ │ +
876
│ │ │ +
877 if(!readMatrixMarketBanner(istr, header)) {
│ │ │ +
878 std::cerr << "First line was not a correct Matrix Market banner. Using default:\n"
│ │ │ +
879 << "%%MatrixMarket matrix coordinate real general"<<std::endl;
│ │ │ +
880 // Go to the beginning of the file
│ │ │ +
881 istr.clear() ;
│ │ │ +
882 istr.seekg(0, std::ios::beg);
│ │ │ +
883 if(isVector)
│ │ │ +
884 header.type=array_type;
│ │ │ +
885 }
│ │ │ +
886
│ │ │ +
887 skipComments(istr);
│ │ │ +
888
│ │ │ +
889 if(lineFeed(istr))
│ │ │ + │ │ │ +
891
│ │ │ +
892 istr >> rows;
│ │ │ +
893
│ │ │ +
894 if(lineFeed(istr))
│ │ │ + │ │ │ +
896 istr >> cols;
│ │ │ +
897 }
│ │ │ +
│ │ │ +
898
│ │ │ +
899 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
901 std::size_t size,
│ │ │ +
902 std::istream& istr,
│ │ │ +
903 size_t lane)
│ │ │ +
904 {
│ │ │ +
905 for (int i=0; size>0; ++i, --size)
│ │ │ +
906 istr>>Simd::lane(lane,vector[i]);
│ │ │ +
907 }
│ │ │ +
│ │ │ +
908
│ │ │ +
909 template<typename T, typename A, int entries>
│ │ │ +
│ │ │ +
910 void mm_read_vector_entries(Dune::BlockVector<Dune::FieldVector<T,entries>,A>& vector,
│ │ │ +
911 std::size_t size,
│ │ │ +
912 std::istream& istr,
│ │ │ +
913 size_t lane)
│ │ │ +
914 {
│ │ │ +
915 for(int i=0; size>0; ++i, --size) {
│ │ │ +
916 Simd::Scalar<T> val;
│ │ │ +
917 istr>>val;
│ │ │ +
918 Simd::lane(lane, vector[i/entries][i%entries])=val;
│ │ │ +
919 }
│ │ │ +
920 }
│ │ │ +
│ │ │ +
921
│ │ │ +
922
│ │ │ +
929 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
931 std::istream& istr)
│ │ │ +
932 {
│ │ │ +
933 typedef typename Dune::BlockVector<T,A>::field_type field_type;
│ │ │ +
934 using namespace MatrixMarketImpl;
│ │ │ +
935
│ │ │ +
936 MMHeader header;
│ │ │ +
937 std::size_t rows, cols;
│ │ │ +
938 mm_read_header(rows,cols,header,istr, true);
│ │ │ +
939 if(cols!=Simd::lanes<field_type>()) {
│ │ │ +
940 if(Simd::lanes<field_type>() == 1)
│ │ │ +
941 DUNE_THROW(MatrixMarketFormatError, "cols!=1, therefore this is no vector!");
│ │ │ +
942 else
│ │ │ +
943 DUNE_THROW(MatrixMarketFormatError, "cols does not match the number of lanes in the field_type!");
│ │ │ +
944 }
│ │ │ +
945
│ │ │ +
946 if(header.type!=array_type)
│ │ │ +
947 DUNE_THROW(MatrixMarketFormatError, "Vectors have to be stored in array format!");
│ │ │ +
948
│ │ │ +
949
│ │ │ +
950 if constexpr (Dune::IsNumber<T>())
│ │ │ +
951 vector.resize(rows);
│ │ │ +
952 else
│ │ │ +
953 {
│ │ │ +
954 T dummy;
│ │ │ +
955 auto blocksize = dummy.size();
│ │ │ +
956 std::size_t size=rows/blocksize;
│ │ │ +
957 if(size*blocksize!=rows)
│ │ │ +
958 DUNE_THROW(MatrixMarketFormatError, "Block size of vector is not correct!");
│ │ │ +
959
│ │ │ +
960 vector.resize(size);
│ │ │ +
961 }
│ │ │ +
962
│ │ │ +
963 istr.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
964 for(size_t l=0;l<Simd::lanes<field_type>();++l){
│ │ │ +
965 mm_read_vector_entries(vector, rows, istr, l);
│ │ │ +
966 }
│ │ │ +
967 }
│ │ │ +
│ │ │ +
968
│ │ │ +
975 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
977 std::istream& istr)
│ │ │ +
978 {
│ │ │ +
979 using namespace MatrixMarketImpl;
│ │ │ + │ │ │ +
981
│ │ │ +
982 MMHeader header;
│ │ │ +
983 if(!readMatrixMarketBanner(istr, header)) {
│ │ │ +
984 std::cerr << "First line was not a correct Matrix Market banner. Using default:\n"
│ │ │ +
985 << "%%MatrixMarket matrix coordinate real general"<<std::endl;
│ │ │ +
986 // Go to the beginning of the file
│ │ │ +
987 istr.clear() ;
│ │ │ +
988 istr.seekg(0, std::ios::beg);
│ │ │ +
989 }
│ │ │ +
990 skipComments(istr);
│ │ │ +
991
│ │ │ +
992 std::size_t rows, cols, entries;
│ │ │ +
993
│ │ │ +
994 if(lineFeed(istr))
│ │ │ + │ │ │ +
996
│ │ │ +
997 istr >> rows;
│ │ │ +
998
│ │ │ +
999 if(lineFeed(istr))
│ │ │ + │ │ │ +
1001 istr >> cols;
│ │ │ +
1002
│ │ │ +
1003 if(lineFeed(istr))
│ │ │ + │ │ │ +
1005
│ │ │ +
1006 istr >>entries;
│ │ │ +
1007
│ │ │ +
1008 std::size_t nnz, blockrows, blockcols;
│ │ │ +
1009
│ │ │ +
1010 // Number of rows and columns of T, if it is a matrix (1x1 otherwise)
│ │ │ +
1011 constexpr int brows = mm_multipliers<Matrix>::rows;
│ │ │ +
1012 constexpr int bcols = mm_multipliers<Matrix>::cols;
│ │ │ +
1013
│ │ │ +
1014 std::tie(blockrows, blockcols, nnz) = calculateNNZ<brows, bcols>(rows, cols, entries, header);
│ │ │ +
1015
│ │ │ +
1016 istr.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
1017
│ │ │ +
1018
│ │ │ +
1019 matrix.setSize(blockrows, blockcols, nnz);
│ │ │ + │ │ │ +
1021
│ │ │ +
1022 if(header.type==array_type)
│ │ │ +
1023 DUNE_THROW(Dune::NotImplemented, "Array format currently not supported for matrices!");
│ │ │ +
1024
│ │ │ +
1025 readSparseEntries(matrix, istr, entries, header, NumericWrapper<typename Matrix::field_type>());
│ │ │ +
1026 }
│ │ │ +
│ │ │ +
1027
│ │ │ +
1028 // Print a scalar entry
│ │ │ +
1029 template<typename B>
│ │ │ +
│ │ │ +
1030 void mm_print_entry(const B& entry,
│ │ │ +
1031 std::size_t rowidx,
│ │ │ +
1032 std::size_t colidx,
│ │ │ +
1033 std::ostream& ostr)
│ │ │ +
1034 {
│ │ │ +
1035 if constexpr (IsNumber<B>())
│ │ │ +
1036 ostr << rowidx << " " << colidx << " " << entry << std::endl;
│ │ │ +
1037 else
│ │ │ +
1038 {
│ │ │ +
1039 for (auto row=entry.begin(); row != entry.end(); ++row, ++rowidx) {
│ │ │ +
1040 int coli=colidx;
│ │ │ +
1041 for (auto col = row->begin(); col != row->end(); ++col, ++coli)
│ │ │ +
1042 ostr<< rowidx<<" "<<coli<<" "<<*col<<std::endl;
│ │ │ +
1043 }
│ │ │ +
1044 }
│ │ │ +
1045 }
│ │ │ +
│ │ │ +
1046
│ │ │ +
1047 // Write a vector entry
│ │ │ +
1048 template<typename V>
│ │ │ +
│ │ │ +
1049 void mm_print_vector_entry(const V& entry, std::ostream& ostr,
│ │ │ +
1050 const std::integral_constant<int,1>&,
│ │ │ +
1051 size_t lane)
│ │ │ +
1052 {
│ │ │ +
1053 ostr<<Simd::lane(lane,entry)<<std::endl;
│ │ │ +
1054 }
│ │ │ +
│ │ │ +
1055
│ │ │ +
1056 // Write a vector
│ │ │ +
1057 template<typename V>
│ │ │ +
│ │ │ +
1058 void mm_print_vector_entry(const V& vector, std::ostream& ostr,
│ │ │ +
1059 const std::integral_constant<int,0>&,
│ │ │ +
1060 size_t lane)
│ │ │ +
1061 {
│ │ │ +
1062 using namespace MatrixMarketImpl;
│ │ │ +
1063
│ │ │ +
1064 // Is the entry a supported numeric type?
│ │ │ +
1065 const int isnumeric = mm_numeric_type<Simd::Scalar<typename V::block_type>>::is_numeric;
│ │ │ +
1066 typedef typename V::const_iterator VIter;
│ │ │ +
1067
│ │ │ +
1068 for(VIter i=vector.begin(); i != vector.end(); ++i)
│ │ │ +
1069
│ │ │ +
1070 mm_print_vector_entry(*i, ostr,
│ │ │ +
1071 std::integral_constant<int,isnumeric>(),
│ │ │ +
1072 lane);
│ │ │ +
1073 }
│ │ │ +
│ │ │ +
1074
│ │ │ +
1075 template<typename T, typename A>
│ │ │ +
│ │ │ +
1076 std::size_t countEntries(const BlockVector<T,A>& vector)
│ │ │ +
1077 {
│ │ │ +
1078 return vector.size();
│ │ │ +
1079 }
│ │ │ +
│ │ │ +
1080
│ │ │ +
1081 template<typename T, typename A, int i>
│ │ │ +
│ │ │ +
1082 std::size_t countEntries(const BlockVector<FieldVector<T,i>,A>& vector)
│ │ │ +
1083 {
│ │ │ +
1084 return vector.size()*i;
│ │ │ +
1085 }
│ │ │ +
│ │ │ +
1086
│ │ │ +
1087 // Version for writing vectors.
│ │ │ +
1088 template<typename V>
│ │ │ +
│ │ │ +
1089 void writeMatrixMarket(const V& vector, std::ostream& ostr,
│ │ │ +
1090 const std::integral_constant<int,0>&)
│ │ │ +
1091 {
│ │ │ +
1092 using namespace MatrixMarketImpl;
│ │ │ +
1093 typedef typename V::field_type field_type;
│ │ │ +
1094
│ │ │ +
1095 ostr<<countEntries(vector)<<" "<<Simd::lanes<field_type>()<<std::endl;
│ │ │ +
1096 const int isnumeric = mm_numeric_type<Simd::Scalar<V>>::is_numeric;
│ │ │ +
1097 for(size_t l=0;l<Simd::lanes<field_type>(); ++l){
│ │ │ +
1098 mm_print_vector_entry(vector,ostr, std::integral_constant<int,isnumeric>(), l);
│ │ │ +
1099 }
│ │ │ +
1100 }
│ │ │ +
│ │ │ +
1101
│ │ │ +
1102 // Versions for writing matrices
│ │ │ +
1103 template<typename M>
│ │ │ +
│ │ │ +
1104 void writeMatrixMarket(const M& matrix,
│ │ │ +
1105 std::ostream& ostr,
│ │ │ +
1106 const std::integral_constant<int,1>&)
│ │ │ +
1107 {
│ │ │ +
1108 ostr<<matrix.N()*MatrixMarketImpl::mm_multipliers<M>::rows<<" "
│ │ │ + │ │ │ +
1110 <<countNonZeros(matrix)<<std::endl;
│ │ │ +
1111
│ │ │ +
1112 typedef typename M::const_iterator riterator;
│ │ │ +
1113 typedef typename M::ConstColIterator citerator;
│ │ │ +
1114 for(riterator row=matrix.begin(); row != matrix.end(); ++row)
│ │ │ +
1115 for(citerator col = row->begin(); col != row->end(); ++col)
│ │ │ +
1116 // Matrix Market indexing start with 1!
│ │ │ + │ │ │ + │ │ │ +
1119 }
│ │ │ +
│ │ │ +
1120
│ │ │ +
1121
│ │ │ +
1125 template<typename M>
│ │ │ +
│ │ │ +
1126 void writeMatrixMarket(const M& matrix,
│ │ │ +
1127 std::ostream& ostr)
│ │ │ +
1128 {
│ │ │ +
1129 using namespace MatrixMarketImpl;
│ │ │ +
1130
│ │ │ +
1131 // Write header information
│ │ │ +
1132 mm_header_printer<M>::print(ostr);
│ │ │ +
1133 mm_block_structure_header<M>::print(ostr,matrix);
│ │ │ +
1134 // Choose the correct function for matrix and vector
│ │ │ +
1135 writeMatrixMarket(matrix,ostr,std::integral_constant<int,IsMatrix<M>::value>());
│ │ │ +
1136 }
│ │ │ +
│ │ │ +
1137
│ │ │ +
1138 static const int default_precision = -1;
│ │ │ +
1150 template<typename M>
│ │ │ +
│ │ │ +
1151 void storeMatrixMarket(const M& matrix,
│ │ │ +
1152 std::string filename,
│ │ │ +
1153 int prec=default_precision)
│ │ │ +
1154 {
│ │ │ +
1155 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1156 std::string rfilename;
│ │ │ +
1157 std::ofstream file;
│ │ │ +
1158 if (extension != "") {
│ │ │ +
1159 rfilename = pureFilename + extension;
│ │ │ +
1160 file.open(rfilename.c_str());
│ │ │ +
1161 if(!file)
│ │ │ +
1162 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1163 }
│ │ │ +
1164 else {
│ │ │ +
1165 // only try .mm so we do not ignore potential errors
│ │ │ +
1166 rfilename = pureFilename + ".mm";
│ │ │ +
1167 file.open(rfilename.c_str());
│ │ │ +
1168 if(!file)
│ │ │ +
1169 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1170 }
│ │ │ +
1171
│ │ │ +
1172 file.setf(std::ios::scientific,std::ios::floatfield);
│ │ │ +
1173 if(prec>0)
│ │ │ +
1174 file.precision(prec);
│ │ │ +
1175 writeMatrixMarket(matrix, file);
│ │ │ +
1176 file.close();
│ │ │ +
1177 }
│ │ │ +
│ │ │ +
1178
│ │ │ +
1179#if HAVE_MPI
│ │ │ +
1194 template<typename M, typename G, typename L>
│ │ │ +
│ │ │ +
1195 void storeMatrixMarket(const M& matrix,
│ │ │ +
1196 std::string filename,
│ │ │ + │ │ │ +
1198 bool storeIndices=true,
│ │ │ +
1199 int prec=default_precision)
│ │ │ +
1200 {
│ │ │ +
1201 // Get our rank
│ │ │ +
1202 int rank = comm.communicator().rank();
│ │ │ +
1203 // Write the local matrix
│ │ │ +
1204 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1205 std::string rfilename;
│ │ │ +
1206 std::ofstream file;
│ │ │ +
1207 if (extension != "") {
│ │ │ +
1208 rfilename = pureFilename + "_" + std::to_string(rank) + extension;
│ │ │ +
1209 file.open(rfilename.c_str());
│ │ │ +
1210 dverb<< rfilename <<std::endl;
│ │ │ +
1211 if(!file)
│ │ │ +
1212 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1213 }
│ │ │ +
1214 else {
│ │ │ +
1215 // only try .mm so we do not ignore potential errors
│ │ │ +
1216 rfilename = pureFilename + "_" + std::to_string(rank) + ".mm";
│ │ │ +
1217 file.open(rfilename.c_str());
│ │ │ +
1218 dverb<< rfilename <<std::endl;
│ │ │ +
1219 if(!file)
│ │ │ +
1220 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1221 }
│ │ │ +
1222 file.setf(std::ios::scientific,std::ios::floatfield);
│ │ │ +
1223 if(prec>0)
│ │ │ +
1224 file.precision(prec);
│ │ │ +
1225 writeMatrixMarket(matrix, file);
│ │ │ +
1226 file.close();
│ │ │ +
1227
│ │ │ +
1228 if(!storeIndices)
│ │ │ +
1229 return;
│ │ │ +
1230
│ │ │ +
1231 // Write the global to local index mapping
│ │ │ +
1232 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx";
│ │ │ +
1233 file.open(rfilename.c_str());
│ │ │ +
1234 if(!file)
│ │ │ +
1235 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1236 file.setf(std::ios::scientific,std::ios::floatfield);
│ │ │ + │ │ │ +
1238 typedef typename IndexSet::const_iterator Iterator;
│ │ │ +
1239 for(Iterator iter = comm.indexSet().begin();
│ │ │ +
1240 iter != comm.indexSet().end(); ++iter) {
│ │ │ +
1241 file << iter->global()<<" "<<(std::size_t)iter->local()<<" "
│ │ │ +
1242 <<(int)iter->local().attribute()<<" "<<(int)iter->local().isPublic()<<std::endl;
│ │ │ +
1243 }
│ │ │ +
1244 // Store neighbour information for efficient remote indices setup.
│ │ │ +
1245 file<<"neighbours:";
│ │ │ +
1246 const std::set<int>& neighbours=comm.remoteIndices().getNeighbours();
│ │ │ +
1247 typedef std::set<int>::const_iterator SIter;
│ │ │ +
1248 for(SIter neighbour=neighbours.begin(); neighbour != neighbours.end(); ++neighbour) {
│ │ │ +
1249 file<<" "<< *neighbour;
│ │ │ +
1250 }
│ │ │ +
1251 file.close();
│ │ │ +
1252 }
│ │ │ +
│ │ │ +
1253
│ │ │ +
1268 template<typename M, typename G, typename L>
│ │ │ +
│ │ │ +
1269 void loadMatrixMarket(M& matrix,
│ │ │ +
1270 const std::string& filename,
│ │ │ + │ │ │ +
1272 bool readIndices=true)
│ │ │ +
1273 {
│ │ │ +
1274 using namespace MatrixMarketImpl;
│ │ │ +
1275
│ │ │ + │ │ │ +
1277 typedef typename LocalIndexT::Attribute Attribute;
│ │ │ +
1278 // Get our rank
│ │ │ +
1279 int rank = comm.communicator().rank();
│ │ │ +
1280 // load local matrix
│ │ │ +
1281 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1282 std::string rfilename;
│ │ │ +
1283 std::ifstream file;
│ │ │ +
1284 if (extension != "") {
│ │ │ +
1285 rfilename = pureFilename + "_" + std::to_string(rank) + extension;
│ │ │ +
1286 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1287 dverb<< rfilename <<std::endl;
│ │ │ +
1288 if(!file)
│ │ │ +
1289 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1290 }
│ │ │ +
1291 else {
│ │ │ +
1292 // try both .mm and .mtx
│ │ │ +
1293 rfilename = pureFilename + "_" + std::to_string(rank) + ".mm";
│ │ │ +
1294 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1295 if(!file) {
│ │ │ +
1296 rfilename = pureFilename + "_" + std::to_string(rank) + ".mtx";
│ │ │ +
1297 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1298 dverb<< rfilename <<std::endl;
│ │ │ +
1299 if(!file)
│ │ │ +
1300 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1301 }
│ │ │ +
1302 }
│ │ │ +
1303 readMatrixMarket(matrix,file);
│ │ │ +
1304 file.close();
│ │ │ +
1305
│ │ │ +
1306 if(!readIndices)
│ │ │ +
1307 return;
│ │ │ +
1308
│ │ │ +
1309 // read indices
│ │ │ + │ │ │ +
1311 IndexSet& pis=comm.pis;
│ │ │ +
1312 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx";
│ │ │ +
1313 file.open(rfilename.c_str());
│ │ │ +
1314 if(!file)
│ │ │ +
1315 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1316 if(pis.size()!=0)
│ │ │ +
1317 DUNE_THROW(InvalidIndexSetState, "Index set is not empty!");
│ │ │ +
1318
│ │ │ +
1319 pis.beginResize();
│ │ │ +
1320 while(!file.eof() && file.peek()!='n') {
│ │ │ +
1321 G g;
│ │ │ +
1322 file >>g;
│ │ │ +
1323 std::size_t l;
│ │ │ +
1324 file >>l;
│ │ │ +
1325 int c;
│ │ │ +
1326 file >>c;
│ │ │ +
1327 bool b;
│ │ │ +
1328 file >> b;
│ │ │ +
1329 pis.add(g,LocalIndexT(l,Attribute(c),b));
│ │ │ +
1330 lineFeed(file);
│ │ │ +
1331 }
│ │ │ +
1332 pis.endResize();
│ │ │ +
1333 if(!file.eof()) {
│ │ │ +
1334 // read neighbours
│ │ │ +
1335 std::string s;
│ │ │ +
1336 file>>s;
│ │ │ +
1337 if(s!="neighbours:")
│ │ │ +
1338 DUNE_THROW(MatrixMarketFormatError, "was expecting the string: \"neighbours:\"");
│ │ │ +
1339 std::set<int> nb;
│ │ │ +
1340 while(!file.eof()) {
│ │ │ +
1341 int i;
│ │ │ +
1342 file >> i;
│ │ │ +
1343 nb.insert(i);
│ │ │ +
1344 }
│ │ │ +
1345 file.close();
│ │ │ +
1346 comm.ri.setNeighbours(nb);
│ │ │ +
1347 }
│ │ │ +
1348 comm.ri.template rebuild<false>();
│ │ │ +
1349 }
│ │ │ +
│ │ │ +
1350
│ │ │ +
1351 #endif
│ │ │ +
1352
│ │ │ +
1363 template<typename M>
│ │ │ +
│ │ │ +
1364 void loadMatrixMarket(M& matrix,
│ │ │ +
1365 const std::string& filename)
│ │ │ +
1366 {
│ │ │ +
1367 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1368 std::string rfilename;
│ │ │ +
1369 std::ifstream file;
│ │ │ +
1370 if (extension != "") {
│ │ │ +
1371 rfilename = pureFilename + extension;
│ │ │ +
1372 file.open(rfilename.c_str());
│ │ │ +
1373 if(!file)
│ │ │ +
1374 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1375 }
│ │ │ +
1376 else {
│ │ │ +
1377 // try both .mm and .mtx
│ │ │ +
1378 rfilename = pureFilename + ".mm";
│ │ │ +
1379 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1380 if(!file) {
│ │ │ +
1381 rfilename = pureFilename + ".mtx";
│ │ │ +
1382 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1383 if(!file)
│ │ │ +
1384 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1385 }
│ │ │ +
1386 }
│ │ │ +
1387 readMatrixMarket(matrix,file);
│ │ │ +
1388 file.close();
│ │ │ +
1389 }
│ │ │ +
│ │ │ +
1390
│ │ │ +
1392}
│ │ │ +
1393#endif
│ │ │ +
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ +
This file implements a vector space as a tensor product of a given vector space. The number of compon...
│ │ │ +
Some handy generic functions for ISTL matrices.
│ │ │ +
Implementation of the BCRSMatrix class.
│ │ │
Col col
Definition matrixmatrix.hh:351
│ │ │ +
auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >::value > *sfinae=nullptr)
Get the number of nonzero fields in the matrix.
Definition matrixutils.hh:119
│ │ │ +
void readMatrixMarket(Dune::BlockVector< T, A > &vector, std::istream &istr)
Reads a BlockVector from a matrix market file.
Definition matrixmarket.hh:930
│ │ │ +
void storeMatrixMarket(const M &matrix, std::string filename, int prec=default_precision)
Stores a parallel matrix/vector in matrix market format in a file.
Definition matrixmarket.hh:1151
│ │ │ +
void loadMatrixMarket(M &matrix, const std::string &filename, OwnerOverlapCopyCommunication< G, L > &comm, bool readIndices=true)
Load a parallel matrix/vector stored in matrix market format.
Definition matrixmarket.hh:1269
│ │ │ +
std::size_t countEntries(const BlockVector< T, A > &vector)
Definition matrixmarket.hh:1076
│ │ │ +
void writeMatrixMarket(const V &vector, std::ostream &ostr, const std::integral_constant< int, 0 > &)
Definition matrixmarket.hh:1089
│ │ │ +
void mm_print_vector_entry(const V &entry, std::ostream &ostr, const std::integral_constant< int, 1 > &, size_t lane)
Definition matrixmarket.hh:1049
│ │ │ +
static const int default_precision
Definition matrixmarket.hh:1138
│ │ │ +
void mm_read_vector_entries(Dune::BlockVector< T, A > &vector, std::size_t size, std::istream &istr, size_t lane)
Definition matrixmarket.hh:900
│ │ │ +
void mm_read_header(std::size_t &rows, std::size_t &cols, MatrixMarketImpl::MMHeader &header, std::istream &istr, bool isVector)
Definition matrixmarket.hh:871
│ │ │ +
void mm_print_entry(const B &entry, std::size_t rowidx, std::size_t colidx, std::ostream &ostr)
Definition matrixmarket.hh:1030
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
Definition fastamgsmoother.hh:16
│ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ -
Definition fastamgsmoother.hh:52
│ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:55
│ │ │ +
std::tuple< std::size_t, std::size_t, std::size_t > calculateNNZ(std::size_t rows, std::size_t cols, std::size_t entries, const MMHeader &header)
Definition matrixmarket.hh:547
│ │ │ +
bool operator<(const IndexData< T > &i1, const IndexData< T > &i2)
LessThan operator.
Definition matrixmarket.hh:630
│ │ │ +
LineType
Definition matrixmarket.hh:296
│ │ │ +
@ DATA
Definition matrixmarket.hh:296
│ │ │ +
@ MM_HEADER
Definition matrixmarket.hh:296
│ │ │ +
@ MM_ISTLSTRUCT
Definition matrixmarket.hh:296
│ │ │ +
bool readMatrixMarketBanner(std::istream &file, MMHeader &mmHeader)
Definition matrixmarket.hh:353
│ │ │ +
void readSparseEntries(Dune::BCRSMatrix< T, A > &matrix, std::istream &file, std::size_t entries, const MMHeader &mmHeader, const D &)
Definition matrixmarket.hh:765
│ │ │ +
MM_TYPE
Definition matrixmarket.hh:299
│ │ │ +
@ array_type
Definition matrixmarket.hh:299
│ │ │ +
@ coordinate_type
Definition matrixmarket.hh:299
│ │ │ +
@ unknown_type
Definition matrixmarket.hh:299
│ │ │ +
std::istream & operator>>(std::istream &is, NumericWrapper< T > &num)
Definition matrixmarket.hh:614
│ │ │ +
void skipComments(std::istream &file)
Definition matrixmarket.hh:339
│ │ │ +
bool lineFeed(std::istream &file)
Definition matrixmarket.hh:315
│ │ │ +
@ MM_MAX_LINE_LENGTH
Definition matrixmarket.hh:297
│ │ │ +
MM_STRUCTURE
Definition matrixmarket.hh:303
│ │ │ +
@ skew_symmetric
Definition matrixmarket.hh:303
│ │ │ +
@ general
Definition matrixmarket.hh:303
│ │ │ +
@ hermitian
Definition matrixmarket.hh:303
│ │ │ +
@ unknown_structure
Definition matrixmarket.hh:303
│ │ │ +
@ symmetric
Definition matrixmarket.hh:303
│ │ │ +
MM_CTYPE
Definition matrixmarket.hh:301
│ │ │ +
@ unknown_ctype
Definition matrixmarket.hh:301
│ │ │ +
@ pattern
Definition matrixmarket.hh:301
│ │ │ +
@ complex_type
Definition matrixmarket.hh:301
│ │ │ +
@ double_type
Definition matrixmarket.hh:301
│ │ │ +
@ integer_type
Definition matrixmarket.hh:301
│ │ │ +
std::enable_if_t<!is_complex< T >::value, T > conj(const T &r)
Definition matrixmarket.hh:733
│ │ │ +
std::tuple< std::string, std::string > splitFilename(const std::string &filename)
Definition matrixmarket.hh:852
│ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:466
│ │ │ +
Iterator begin()
Get iterator to first row.
Definition bcrsmatrix.hh:671
│ │ │ +
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:677
│ │ │ +
CreateIterator createend()
get create iterator pointing to one after the last block
Definition bcrsmatrix.hh:1100
│ │ │ +
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:2007
│ │ │ +
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1094
│ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2001
│ │ │ +
void setBuildMode(BuildMode bm)
Sets the build mode of the matrix.
Definition bcrsmatrix.hh:830
│ │ │ +
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:858
│ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ +
void resize(size_type size)
Resize the vector.
Definition bvector.hh:496
│ │ │ +
typename Imp::BlockTraits< B >::field_type field_type
export the type representing the field
Definition bvector.hh:398
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
Helper metaprogram to get the matrix market string representation of the numeric type.
Definition matrixmarket.hh:76
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:81
│ │ │ +
static std::string str()
Definition matrixmarket.hh:95
│ │ │ +
static std::string str()
Definition matrixmarket.hh:111
│ │ │ +
static std::string str()
Definition matrixmarket.hh:127
│ │ │ +
static std::string str()
Definition matrixmarket.hh:143
│ │ │ +
static std::string str()
Definition matrixmarket.hh:159
│ │ │ +
Meta program to write the correct Matrix Market header.
Definition matrixmarket.hh:174
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:179
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:189
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:199
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:209
│ │ │ +
Metaprogram for writing the ISTL block structure header.
Definition matrixmarket.hh:225
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:233
│ │ │ +
BlockVector< T, A > M
Definition matrixmarket.hh:230
│ │ │ +
BlockVector< FieldVector< T, i >, A > M
Definition matrixmarket.hh:243
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:245
│ │ │ +
BCRSMatrix< T, A > M
Definition matrixmarket.hh:255
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:258
│ │ │ +
BCRSMatrix< FieldMatrix< T, i, j >, A > M
Definition matrixmarket.hh:268
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:270
│ │ │ +
static void print(std::ostream &os, const M &m)
Definition matrixmarket.hh:283
│ │ │ +
FieldMatrix< T, i, j > M
Definition matrixmarket.hh:281
│ │ │ +
static void print(std::ostream &os, const M &m)
Definition matrixmarket.hh:292
│ │ │ +
FieldVector< T, i > M
Definition matrixmarket.hh:290
│ │ │ +
Definition matrixmarket.hh:306
│ │ │ +
MM_STRUCTURE structure
Definition matrixmarket.hh:312
│ │ │ +
MM_TYPE type
Definition matrixmarket.hh:310
│ │ │ +
MMHeader()
Definition matrixmarket.hh:307
│ │ │ +
MM_CTYPE ctype
Definition matrixmarket.hh:311
│ │ │ +
Definition matrixmarket.hh:578
│ │ │ +
std::size_t index
Definition matrixmarket.hh:579
│ │ │ +
a wrapper class of numeric values.
Definition matrixmarket.hh:595
│ │ │ +
T number
Definition matrixmarket.hh:596
│ │ │ +
Utility class for marking the pattern type of the MatrixMarket matrices.
Definition matrixmarket.hh:607
│ │ │ +
Functor to the data values of the matrix.
Definition matrixmarket.hh:677
│ │ │ +
void operator()(const std::vector< std::set< IndexData< D > > > &rows, BCRSMatrix< T > &matrix)
Sets the matrix values.
Definition matrixmarket.hh:684
│ │ │ +
void operator()(const std::vector< std::set< IndexData< D > > > &rows, BCRSMatrix< FieldMatrix< T, brows, bcols > > &matrix)
Sets the matrix values.
Definition matrixmarket.hh:702
│ │ │ +
void operator()(const std::vector< std::set< IndexData< PatternDummy > > > &rows, M &matrix)
Definition matrixmarket.hh:723
│ │ │ +
Definition matrixmarket.hh:728
│ │ │ +
Definition matrixmarket.hh:744
│ │ │ +
Definition matrixmarket.hh:868
│ │ │ +
Definition matrixutils.hh:27
│ │ │ +
Test whether a type is an ISTL Matrix.
Definition matrixutils.hh:504
│ │ │ +
A class setting up standard communication for a two-valued attribute set with owner/overlap/copy sema...
Definition owneroverlapcopy.hh:174
│ │ │ +
const ParallelIndexSet & indexSet() const
Get the underlying parallel index set.
Definition owneroverlapcopy.hh:462
│ │ │ +
const Communication< MPI_Comm > & communicator() const
Definition owneroverlapcopy.hh:299
│ │ │ +
const RemoteIndices & remoteIndices() const
Get the underlying remote indices.
Definition owneroverlapcopy.hh:471
│ │ │ +
Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet
The type of the parallel index set.
Definition owneroverlapcopy.hh:449
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,123 +1,1632 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -fastamgsmoother.hh │ │ │ │ +matrixmarket.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ 3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ 4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH │ │ │ │ -6#define DUNE_ISTL_FASTAMGSMOOTHER_HH │ │ │ │ +5#ifndef DUNE_ISTL_MATRIXMARKET_HH │ │ │ │ +6#define DUNE_ISTL_MATRIXMARKET_HH │ │ │ │ 7 │ │ │ │ -8#include │ │ │ │ -9 │ │ │ │ -10namespace _D_u_n_e │ │ │ │ -11{ │ │ │ │ -12 namespace Amg │ │ │ │ -13 { │ │ │ │ -14 │ │ │ │ -15 template │ │ │ │ -_1_6 struct _G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ -17 │ │ │ │ -18 template │ │ │ │ -_1_9 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ -20 const Y& b) │ │ │ │ -21 { │ │ │ │ -22 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ -23 typedef typename M::ConstColIterator ColIterator; │ │ │ │ -24 │ │ │ │ -25 typename Y::iterator dIter=d.begin(); │ │ │ │ -26 typename Y::const_iterator bIter=b.begin(); │ │ │ │ -27 typename X::iterator xIter=x.begin(); │ │ │ │ -28 │ │ │ │ -29 for(RowIterator row=A.begin(), end=A.end(); row != end; │ │ │ │ -30 ++row, ++dIter, ++xIter, ++bIter) │ │ │ │ -31 { │ │ │ │ -32 ColIterator _c_o_l=(*row).begin(); │ │ │ │ -33 *dIter = *bIter; │ │ │ │ -34 │ │ │ │ -35 for (; _c_o_l.index()solve(*xIter,*dIter); │ │ │ │ -42 *dIter=0; //as r=v │ │ │ │ -43 │ │ │ │ -44 // Update residual for the symmetric case │ │ │ │ -45 for(_c_o_l=(*row).begin(); _c_o_l.index()mmv(*xIter, d[_c_o_l.index()]); //d_j-=A_ij x_i │ │ │ │ -47 } │ │ │ │ -48 } │ │ │ │ -49 }; │ │ │ │ -50 │ │ │ │ -51 template │ │ │ │ -_5_2 struct _G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t { │ │ │ │ -53 │ │ │ │ -54 template │ │ │ │ -_5_5 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ -56 const Y& b) │ │ │ │ -57 { │ │ │ │ -58 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ -59 typedef typename M::ConstColIterator ColIterator; │ │ │ │ -60 typedef typename Y::block_type YBlock; │ │ │ │ -61 │ │ │ │ -62 typename Y::iterator dIter=d.beforeEnd(); │ │ │ │ -63 typename X::iterator xIter=x.beforeEnd(); │ │ │ │ -64 typename Y::const_iterator bIter=b.beforeEnd(); │ │ │ │ -65 │ │ │ │ -66 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end; │ │ │ │ -67 --row, --dIter, --xIter, --bIter) │ │ │ │ -68 { │ │ │ │ -69 ColIterator endCol=(*row).beforeBegin(); │ │ │ │ -70 ColIterator _c_o_l=(*row).beforeEnd(); │ │ │ │ -71 *dIter = *bIter; │ │ │ │ -72 │ │ │ │ -73 for (; _c_o_l.index()>row.index(); --_c_o_l) │ │ │ │ -74 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{i>j} a_ij * xnew_j │ │ │ │ -75 assert(row.index()==_c_o_l.index()); │ │ │ │ -76 ColIterator diag=_c_o_l; │ │ │ │ -77 YBlock v=*dIter; │ │ │ │ -78 // upper diagonal matrix │ │ │ │ -79 for (--_c_o_l; _c_o_l!=endCol; --_c_o_l) │ │ │ │ -80 (*col).mmv(x[_c_o_l.index()],v); // v -= sum_{jsolve(*xIter,v); │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ +17#include │ │ │ │ +18#include │ │ │ │ +19#include │ │ │ │ +20#include │ │ │ │ +21#include │ │ │ │ +22#include │ │ │ │ +23 │ │ │ │ +24#include │ │ │ │ +25#include │ │ │ │ +26#include │ │ │ │ +27#include │ │ │ │ +28#include │ │ │ │ +29#include │ │ │ │ +30 │ │ │ │ +31#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +32#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +33#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> // countNonZeros() │ │ │ │ +34#include <_d_u_n_e_/_i_s_t_l_/_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h> │ │ │ │ +35 │ │ │ │ +36namespace _D_u_n_e │ │ │ │ +37{ │ │ │ │ +38 │ │ │ │ +_6_4 namespace MatrixMarketImpl │ │ │ │ +65 { │ │ │ │ +75 template │ │ │ │ +_7_6 struct _m_m___n_u_m_e_r_i_c___t_y_p_e { │ │ │ │ +77 enum { │ │ │ │ +81 _i_s___n_u_m_e_r_i_c=false │ │ │ │ +_8_2 }; │ │ │ │ +83 }; │ │ │ │ 84 │ │ │ │ -85 *dIter-=v; │ │ │ │ -86 │ │ │ │ -87 // Update residual for the symmetric case │ │ │ │ -88 // Skip residual computation as it is not needed. │ │ │ │ -89 //for(col=(*row).begin();col.index() │ │ │ │ +_8_6 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +87 { │ │ │ │ +88 enum { │ │ │ │ +92 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +_9_3 }; │ │ │ │ +94 │ │ │ │ +_9_5 static std::string _s_t_r() │ │ │ │ +96 { │ │ │ │ +97 return "integer"; │ │ │ │ +98 } │ │ │ │ +99 }; │ │ │ │ +100 │ │ │ │ +101 template<> │ │ │ │ +_1_0_2 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +103 { │ │ │ │ +104 enum { │ │ │ │ +108 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +_1_0_9 }; │ │ │ │ +110 │ │ │ │ +_1_1_1 static std::string _s_t_r() │ │ │ │ +112 { │ │ │ │ +113 return "real"; │ │ │ │ +114 } │ │ │ │ +115 }; │ │ │ │ +116 │ │ │ │ +117 template<> │ │ │ │ +_1_1_8 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +119 { │ │ │ │ +120 enum { │ │ │ │ +124 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +_1_2_5 }; │ │ │ │ +126 │ │ │ │ +_1_2_7 static std::string _s_t_r() │ │ │ │ +128 { │ │ │ │ +129 return "real"; │ │ │ │ +130 } │ │ │ │ +131 }; │ │ │ │ +132 │ │ │ │ +133 template<> │ │ │ │ +_1_3_4 struct _m_m___n_u_m_e_r_i_c___t_y_p_e<_s_t_d::complex > │ │ │ │ +135 { │ │ │ │ +136 enum { │ │ │ │ +140 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +_1_4_1 }; │ │ │ │ +142 │ │ │ │ +_1_4_3 static std::string _s_t_r() │ │ │ │ +144 { │ │ │ │ +145 return "complex"; │ │ │ │ +146 } │ │ │ │ +147 }; │ │ │ │ +148 │ │ │ │ +149 template<> │ │ │ │ +_1_5_0 struct _m_m___n_u_m_e_r_i_c___t_y_p_e<_s_t_d::complex > │ │ │ │ +151 { │ │ │ │ +152 enum { │ │ │ │ +156 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +_1_5_7 }; │ │ │ │ +158 │ │ │ │ +_1_5_9 static std::string _s_t_r() │ │ │ │ +160 { │ │ │ │ +161 return "complex"; │ │ │ │ +162 } │ │ │ │ +163 }; │ │ │ │ +164 │ │ │ │ +173 template │ │ │ │ +_1_7_4 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r; │ │ │ │ +175 │ │ │ │ +176 template │ │ │ │ +_1_7_7 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ +178 { │ │ │ │ +_1_7_9 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +180 { │ │ │ │ +181 os<<"%%MatrixMarket matrix coordinate "; │ │ │ │ +182 os<:: │ │ │ │ +field_type>>::str()<<" general"< │ │ │ │ +_1_8_7 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r<_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ +188 { │ │ │ │ +_1_8_9 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +190 { │ │ │ │ +191 os<<"%%MatrixMarket matrix array "; │ │ │ │ +192 os<:: │ │ │ │ +field_type>>::str()<<" general"< │ │ │ │ +_1_9_7 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r > │ │ │ │ +198 { │ │ │ │ +_1_9_9 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +200 { │ │ │ │ +201 os<<"%%MatrixMarket matrix array "; │ │ │ │ +202 os<::str()<<" general"< │ │ │ │ +_2_0_7 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r<_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ +208 { │ │ │ │ +_2_0_9 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +210 { │ │ │ │ +211 os<<"%%MatrixMarket matrix array "; │ │ │ │ +212 os<::str()<<" general"< │ │ │ │ +_2_2_5 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r; │ │ │ │ +226 │ │ │ │ +227 template │ │ │ │ +_2_2_8 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r<_B_l_o_c_k_V_e_c_t_o_r > │ │ │ │ +229 { │ │ │ │ +_2_3_0 typedef _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> _M; │ │ │ │ +231 static_assert(IsNumber::value, "Only scalar entries are expected │ │ │ │ +here!"); │ │ │ │ +232 │ │ │ │ +_2_3_3 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +234 { │ │ │ │ +235 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +236 os<<"1 1"< │ │ │ │ +_2_4_1 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r<_B_l_o_c_k_V_e_c_t_o_r,A> > │ │ │ │ +242 { │ │ │ │ +_2_4_3 typedef _B_l_o_c_k_V_e_c_t_o_r_<_F_i_e_l_d_V_e_c_t_o_r_<_T_,_i_>,A> _M; │ │ │ │ +244 │ │ │ │ +_2_4_5 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +246 { │ │ │ │ +247 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +248 os< │ │ │ │ +_2_5_3 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ +254 { │ │ │ │ +_2_5_5 typedef _B_C_R_S_M_a_t_r_i_x_<_T_,_A_> _M; │ │ │ │ +256 static_assert(IsNumber::value, "Only scalar entries are expected │ │ │ │ +here!"); │ │ │ │ +257 │ │ │ │ +_2_5_8 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +259 { │ │ │ │ +260 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +261 os<<"1 1"< │ │ │ │ +_2_6_6 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > │ │ │ │ +267 { │ │ │ │ +_2_6_8 typedef _B_C_R_S_M_a_t_r_i_x_<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_i_,_j_>,A> _M; │ │ │ │ +269 │ │ │ │ +_2_7_0 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +271 { │ │ │ │ +272 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +273 os< │ │ │ │ +_2_7_9 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r<_F_i_e_l_d_M_a_t_r_i_x > │ │ │ │ +280 { │ │ │ │ +_2_8_1 typedef _F_i_e_l_d_M_a_t_r_i_x_<_T_,_i_,_j_> _M; │ │ │ │ +282 │ │ │ │ +_2_8_3 static void _p_r_i_n_t(std::ostream& os, const _M& m) │ │ │ │ +284 {} │ │ │ │ +285 }; │ │ │ │ +286 │ │ │ │ +287 template │ │ │ │ +_2_8_8 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r > │ │ │ │ +289 { │ │ │ │ +_2_9_0 typedef FieldVector _M; │ │ │ │ +291 │ │ │ │ +_2_9_2 static void _p_r_i_n_t(std::ostream& os, const _M& m) │ │ │ │ +293 {} │ │ │ │ +294 }; │ │ │ │ +295 │ │ │ │ +_2_9_6 enum _L_i_n_e_T_y_p_e { _M_M___H_E_A_D_E_R, _M_M___I_S_T_L_S_T_R_U_C_T, _D_A_T_A }; │ │ │ │ +_2_9_7 enum { _M_M___M_A_X___L_I_N_E___L_E_N_G_T_H=1025 }; │ │ │ │ +298 │ │ │ │ +_2_9_9 enum _M_M___T_Y_P_E { _c_o_o_r_d_i_n_a_t_e___t_y_p_e, _a_r_r_a_y___t_y_p_e, _u_n_k_n_o_w_n___t_y_p_e }; │ │ │ │ +300 │ │ │ │ +_3_0_1 enum _M_M___C_T_Y_P_E { _i_n_t_e_g_e_r___t_y_p_e, _d_o_u_b_l_e___t_y_p_e, _c_o_m_p_l_e_x___t_y_p_e, _p_a_t_t_e_r_n, │ │ │ │ +_u_n_k_n_o_w_n___c_t_y_p_e }; │ │ │ │ +302 │ │ │ │ +_3_0_3 enum _M_M___S_T_R_U_C_T_U_R_E { _g_e_n_e_r_a_l, _s_y_m_m_e_t_r_i_c, _s_k_e_w___s_y_m_m_e_t_r_i_c, _h_e_r_m_i_t_i_a_n, │ │ │ │ +_u_n_k_n_o_w_n___s_t_r_u_c_t_u_r_e }; │ │ │ │ +304 │ │ │ │ +_3_0_5 struct _M_M_H_e_a_d_e_r │ │ │ │ +306 { │ │ │ │ +_3_0_7 _M_M_H_e_a_d_e_r() │ │ │ │ +308 : _t_y_p_e(_c_o_o_r_d_i_n_a_t_e___t_y_p_e), _c_t_y_p_e(_d_o_u_b_l_e___t_y_p_e), _s_t_r_u_c_t_u_r_e(_g_e_n_e_r_a_l) │ │ │ │ +309 {} │ │ │ │ +_3_1_0 _M_M___T_Y_P_E _t_y_p_e; │ │ │ │ +_3_1_1 _M_M___C_T_Y_P_E _c_t_y_p_e; │ │ │ │ +_3_1_2 _M_M___S_T_R_U_C_T_U_R_E _s_t_r_u_c_t_u_r_e; │ │ │ │ +313 }; │ │ │ │ +314 │ │ │ │ +_3_1_5 inline bool _l_i_n_e_F_e_e_d(std::istream& file) │ │ │ │ +316 { │ │ │ │ +317 char c; │ │ │ │ +318 if(!file.eof()) │ │ │ │ +319 c=file.peek(); │ │ │ │ +320 else │ │ │ │ +321 return false; │ │ │ │ +322 // ignore whitespace │ │ │ │ +323 while(c==' ') │ │ │ │ +324 { │ │ │ │ +325 file.get(); │ │ │ │ +326 if(file.eof()) │ │ │ │ +327 return false; │ │ │ │ +328 c=file.peek(); │ │ │ │ +329 } │ │ │ │ +330 │ │ │ │ +331 if(c=='\n') { │ │ │ │ +332 /* eat the line feed */ │ │ │ │ +333 file.get(); │ │ │ │ +334 return true; │ │ │ │ +335 } │ │ │ │ +336 return false; │ │ │ │ +337 } │ │ │ │ +338 │ │ │ │ +_3_3_9 inline void _s_k_i_p_C_o_m_m_e_n_t_s(std::istream& file) │ │ │ │ +340 { │ │ │ │ +341 _l_i_n_e_F_e_e_d(file); │ │ │ │ +342 char c=file.peek(); │ │ │ │ +343 // ignore comment lines │ │ │ │ +344 while(c=='%') │ │ │ │ +345 { │ │ │ │ +346 /* discard the rest of the line */ │ │ │ │ +347 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +348 c=file.peek(); │ │ │ │ +349 } │ │ │ │ +350 } │ │ │ │ +351 │ │ │ │ +352 │ │ │ │ +_3_5_3 inline bool _r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t_B_a_n_n_e_r(std::istream& file, _M_M_H_e_a_d_e_r& mmHeader) │ │ │ │ +354 { │ │ │ │ +355 std::string buffer; │ │ │ │ +356 char c; │ │ │ │ +357 file >> buffer; │ │ │ │ +358 c=buffer[0]; │ │ │ │ +359 mmHeader=_M_M_H_e_a_d_e_r(); │ │ │ │ +360 if(c!='%') │ │ │ │ +361 return false; │ │ │ │ +362 dverb<::max(),'\n'); │ │ │ │ +367 return false; │ │ │ │ +368 } │ │ │ │ +369 │ │ │ │ +370 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +371 /* premature end of line */ │ │ │ │ +372 return false; │ │ │ │ +373 │ │ │ │ +374 /* read the matrix_type */ │ │ │ │ +375 file >> buffer; │ │ │ │ +376 │ │ │ │ +377 if(buffer != "matrix") │ │ │ │ +378 { │ │ │ │ +379 /* discard the rest of the line */ │ │ │ │ +380 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +381 return false; │ │ │ │ +382 } │ │ │ │ +383 │ │ │ │ +384 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +385 /* premature end of line */ │ │ │ │ +386 return false; │ │ │ │ +387 │ │ │ │ +388 /* The type of the matrix */ │ │ │ │ +389 file >> buffer; │ │ │ │ +390 │ │ │ │ +391 if(buffer.empty()) │ │ │ │ +392 return false; │ │ │ │ +393 │ │ │ │ +394 std::transform(buffer.begin(), buffer.end(), buffer.begin(), │ │ │ │ +395 ::tolower); │ │ │ │ +396 │ │ │ │ +397 switch(buffer[0]) │ │ │ │ +398 { │ │ │ │ +399 case 'a' : │ │ │ │ +400 /* sanity check */ │ │ │ │ +401 if(buffer != "array") │ │ │ │ +402 { │ │ │ │ +403 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +404 return false; │ │ │ │ +405 } │ │ │ │ +406 mmHeader._t_y_p_e=_a_r_r_a_y___t_y_p_e; │ │ │ │ +407 break; │ │ │ │ +408 case 'c' : │ │ │ │ +409 /* sanity check */ │ │ │ │ +410 if(buffer != "coordinate") │ │ │ │ +411 { │ │ │ │ +412 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +413 return false; │ │ │ │ +414 } │ │ │ │ +415 mmHeader._t_y_p_e=_c_o_o_r_d_i_n_a_t_e___t_y_p_e; │ │ │ │ +416 break; │ │ │ │ +417 default : │ │ │ │ +418 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +419 return false; │ │ │ │ +420 } │ │ │ │ +421 │ │ │ │ +422 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +423 /* premature end of line */ │ │ │ │ +424 return false; │ │ │ │ +425 │ │ │ │ +426 /* The numeric type used. */ │ │ │ │ +427 file >> buffer; │ │ │ │ +428 │ │ │ │ +429 if(buffer.empty()) │ │ │ │ +430 return false; │ │ │ │ +431 │ │ │ │ +432 std::transform(buffer.begin(), buffer.end(), buffer.begin(), │ │ │ │ +433 ::tolower); │ │ │ │ +434 switch(buffer[0]) │ │ │ │ +435 { │ │ │ │ +436 case 'i' : │ │ │ │ +437 /* sanity check */ │ │ │ │ +438 if(buffer != "integer") │ │ │ │ +439 { │ │ │ │ +440 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +441 return false; │ │ │ │ +442 } │ │ │ │ +443 mmHeader._c_t_y_p_e=_i_n_t_e_g_e_r___t_y_p_e; │ │ │ │ +444 break; │ │ │ │ +445 case 'r' : │ │ │ │ +446 /* sanity check */ │ │ │ │ +447 if(buffer != "real") │ │ │ │ +448 { │ │ │ │ +449 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +450 return false; │ │ │ │ +451 } │ │ │ │ +452 mmHeader._c_t_y_p_e=_d_o_u_b_l_e___t_y_p_e; │ │ │ │ +453 break; │ │ │ │ +454 case 'c' : │ │ │ │ +455 /* sanity check */ │ │ │ │ +456 if(buffer != "complex") │ │ │ │ +457 { │ │ │ │ +458 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +459 return false; │ │ │ │ +460 } │ │ │ │ +461 mmHeader._c_t_y_p_e=_c_o_m_p_l_e_x___t_y_p_e; │ │ │ │ +462 break; │ │ │ │ +463 case 'p' : │ │ │ │ +464 /* sanity check */ │ │ │ │ +465 if(buffer != "pattern") │ │ │ │ +466 { │ │ │ │ +467 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +468 return false; │ │ │ │ +469 } │ │ │ │ +470 mmHeader._c_t_y_p_e=_p_a_t_t_e_r_n; │ │ │ │ +471 break; │ │ │ │ +472 default : │ │ │ │ +473 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +474 return false; │ │ │ │ +475 } │ │ │ │ +476 │ │ │ │ +477 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +478 return false; │ │ │ │ +479 │ │ │ │ +480 file >> buffer; │ │ │ │ +481 │ │ │ │ +482 std::transform(buffer.begin(), buffer.end(), buffer.begin(), │ │ │ │ +483 ::tolower); │ │ │ │ +484 switch(buffer[0]) │ │ │ │ +485 { │ │ │ │ +486 case 'g' : │ │ │ │ +487 /* sanity check */ │ │ │ │ +488 if(buffer != "general") │ │ │ │ +489 { │ │ │ │ +490 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +491 return false; │ │ │ │ +492 } │ │ │ │ +493 mmHeader._s_t_r_u_c_t_u_r_e=_g_e_n_e_r_a_l; │ │ │ │ +494 break; │ │ │ │ +495 case 'h' : │ │ │ │ +496 /* sanity check */ │ │ │ │ +497 if(buffer != "hermitian") │ │ │ │ +498 { │ │ │ │ +499 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +500 return false; │ │ │ │ +501 } │ │ │ │ +502 mmHeader._s_t_r_u_c_t_u_r_e=_h_e_r_m_i_t_i_a_n; │ │ │ │ +503 break; │ │ │ │ +504 case 's' : │ │ │ │ +505 if(buffer.size()==1) { │ │ │ │ +506 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +507 return false; │ │ │ │ +508 } │ │ │ │ +509 │ │ │ │ +510 switch(buffer[1]) │ │ │ │ +511 { │ │ │ │ +512 case 'y' : │ │ │ │ +513 /* sanity check */ │ │ │ │ +514 if(buffer != "symmetric") │ │ │ │ +515 { │ │ │ │ +516 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +517 return false; │ │ │ │ +518 } │ │ │ │ +519 mmHeader._s_t_r_u_c_t_u_r_e=_s_y_m_m_e_t_r_i_c; │ │ │ │ +520 break; │ │ │ │ +521 case 'k' : │ │ │ │ +522 /* sanity check */ │ │ │ │ +523 if(buffer != "skew-symmetric") │ │ │ │ +524 { │ │ │ │ +525 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +526 return false; │ │ │ │ +527 } │ │ │ │ +528 mmHeader._s_t_r_u_c_t_u_r_e=_s_k_e_w___s_y_m_m_e_t_r_i_c; │ │ │ │ +529 break; │ │ │ │ +530 default : │ │ │ │ +531 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +532 return false; │ │ │ │ +533 } │ │ │ │ +534 break; │ │ │ │ +535 default : │ │ │ │ +536 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +537 return false; │ │ │ │ +538 } │ │ │ │ +539 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +540 c=file.peek(); │ │ │ │ +541 return true; │ │ │ │ +542 │ │ │ │ +543 } │ │ │ │ +544 │ │ │ │ +545 template │ │ │ │ +546 std::tuple │ │ │ │ +_5_4_7 _c_a_l_c_u_l_a_t_e_N_N_Z(std::size_t rows, std::size_t cols, std::size_t entries, const │ │ │ │ +_M_M_H_e_a_d_e_r& header) │ │ │ │ +548 { │ │ │ │ +549 std::size_t blockrows=rows/brows; │ │ │ │ +550 std::size_t blockcols=cols/bcols; │ │ │ │ +551 std::size_t blocksize=brows*bcols; │ │ │ │ +552 std::size_t blockentries=0; │ │ │ │ +553 │ │ │ │ +554 switch(header._s_t_r_u_c_t_u_r_e) │ │ │ │ +555 { │ │ │ │ +556 case _g_e_n_e_r_a_l : │ │ │ │ +557 blockentries = entries/blocksize; break; │ │ │ │ +558 case _s_k_e_w___s_y_m_m_e_t_r_i_c : │ │ │ │ +559 blockentries = 2*entries/blocksize; break; │ │ │ │ +560 case _s_y_m_m_e_t_r_i_c : │ │ │ │ +561 blockentries = (2*entries-rows)/blocksize; break; │ │ │ │ +562 case _h_e_r_m_i_t_i_a_n : │ │ │ │ +563 blockentries = (2*entries-rows)/blocksize; break; │ │ │ │ +564 default : │ │ │ │ +565 throw Dune::NotImplemented(); │ │ │ │ +566 } │ │ │ │ +567 return std::make_tuple(blockrows, blockcols, blockentries); │ │ │ │ +568 } │ │ │ │ +569 │ │ │ │ +570 /* │ │ │ │ +571 * @brief Storage class for the column index and the numeric value. │ │ │ │ +572 * │ │ │ │ +573 * \tparam T Either a NumericWrapper of the numeric type or PatternDummy │ │ │ │ +574 * for MatrixMarket pattern case. │ │ │ │ +575 */ │ │ │ │ +576 template │ │ │ │ +_5_7_7 struct _I_n_d_e_x_D_a_t_a : public T │ │ │ │ +578 { │ │ │ │ +_5_7_9 std::size_t _i_n_d_e_x = {}; │ │ │ │ +580 }; │ │ │ │ +581 │ │ │ │ +582 │ │ │ │ +593 template │ │ │ │ +_5_9_4 struct _N_u_m_e_r_i_c_W_r_a_p_p_e_r │ │ │ │ +595 { │ │ │ │ +_5_9_6 T _n_u_m_b_e_r = {}; │ │ │ │ +_5_9_7 operator T&() │ │ │ │ +598 { │ │ │ │ +599 return _n_u_m_b_e_r; │ │ │ │ +600 } │ │ │ │ +601 }; │ │ │ │ +602 │ │ │ │ +_6_0_6 struct _P_a_t_t_e_r_n_D_u_m_m_y │ │ │ │ +607 {}; │ │ │ │ +608 │ │ │ │ +609 template<> │ │ │ │ +_6_1_0 struct _N_u_m_e_r_i_c_W_r_a_p_p_e_r<_P_a_t_t_e_r_n_D_u_m_m_y> │ │ │ │ +611 {}; │ │ │ │ +612 │ │ │ │ +613 template │ │ │ │ +_6_1_4 std::istream& _o_p_e_r_a_t_o_r_>_>(std::istream& is, _N_u_m_e_r_i_c_W_r_a_p_p_e_r_<_T_>& num) │ │ │ │ +615 { │ │ │ │ +616 return is>>num._n_u_m_b_e_r; │ │ │ │ +617 } │ │ │ │ +618 │ │ │ │ +_6_1_9 inline std::istream& _o_p_e_r_a_t_o_r_>_>(std::istream& is, [[maybe_unused]] │ │ │ │ +_N_u_m_e_r_i_c_W_r_a_p_p_e_r_<_P_a_t_t_e_r_n_D_u_m_m_y_>& num) │ │ │ │ +620 { │ │ │ │ +621 return is; │ │ │ │ +622 } │ │ │ │ +623 │ │ │ │ +629 template │ │ │ │ +_6_3_0 bool _o_p_e_r_a_t_o_r_<(const _I_n_d_e_x_D_a_t_a_<_T_>& i1, const _I_n_d_e_x_D_a_t_a_<_T_>& i2) │ │ │ │ +631 { │ │ │ │ +632 return i1._i_n_d_e_x │ │ │ │ +_6_4_1 std::istream& _o_p_e_r_a_t_o_r_>_>(std::istream& is, _I_n_d_e_x_D_a_t_a_<_T_>& data) │ │ │ │ +642 { │ │ │ │ +643 is>>data._i_n_d_e_x; │ │ │ │ +644 /* MatrixMarket indices are one based. Decrement for C++ */ │ │ │ │ +645 --data._i_n_d_e_x; │ │ │ │ +646 return is>>data.number; │ │ │ │ +647 } │ │ │ │ +648 │ │ │ │ +654 template │ │ │ │ +_6_5_5 std::istream& _o_p_e_r_a_t_o_r_>_>(std::istream& is, _I_n_d_e_x_D_a_t_a<_N_u_m_e_r_i_c_W_r_a_p_p_e_r>>& data) │ │ │ │ +656 { │ │ │ │ +657 is>>data._i_n_d_e_x; │ │ │ │ +658 /* MatrixMarket indices are one based. Decrement for C++ */ │ │ │ │ +659 --data.index; │ │ │ │ +660 // real and imaginary part needs to be read separately as │ │ │ │ +661 // complex numbers are not provided in pair form. (x,y) │ │ │ │ +662 _N_u_m_e_r_i_c_W_r_a_p_p_e_r_<_T_> real, imag; │ │ │ │ +663 is>>real; │ │ │ │ +664 is>>imag; │ │ │ │ +665 data._n_u_m_b_e_r = {real._n_u_m_b_e_r, imag._n_u_m_b_e_r}; │ │ │ │ +666 return is; │ │ │ │ +667 } │ │ │ │ +668 │ │ │ │ +675 template │ │ │ │ +_6_7_6 struct _M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r │ │ │ │ +677 { │ │ │ │ +683 template │ │ │ │ +_6_8_4 void _o_p_e_r_a_t_o_r_(_)(const std::vector > >& rows, │ │ │ │ +685 _B_C_R_S_M_a_t_r_i_x_<_T_>& matrix) │ │ │ │ +686 { │ │ │ │ +687 static_assert(IsNumber::value && brows==1 && bcols==1, "Only scalar │ │ │ │ +entries are expected here!"); │ │ │ │ +688 for (auto iter=matrix._b_e_g_i_n(); iter!= matrix._e_n_d(); ++iter) │ │ │ │ +689 { │ │ │ │ +690 auto brow=iter.index(); │ │ │ │ +691 for (auto siter=rows[brow].begin(); siter != rows[brow].end(); ++siter) │ │ │ │ +692 (*iter)[siter->index] = siter->number; │ │ │ │ +693 } │ │ │ │ +694 } │ │ │ │ +695 │ │ │ │ +701 template │ │ │ │ +_7_0_2 void _o_p_e_r_a_t_o_r_(_)(const std::vector > >& rows, │ │ │ │ +703 _B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x_<_T_,_b_r_o_w_s_,_b_c_o_l_s_> >& matrix) │ │ │ │ +704 { │ │ │ │ +705 for (auto iter=matrix.begin(); iter!= matrix.end(); ++iter) │ │ │ │ +706 { │ │ │ │ +707 for (auto brow=iter.index()*brows, │ │ │ │ +708 browend=iter.index()*brows+brows; │ │ │ │ +709 browindex/bcols][brow%brows][siter->index%bcols]=siter->number; │ │ │ │ +714 } │ │ │ │ +715 } │ │ │ │ +716 } │ │ │ │ +717 }; │ │ │ │ +718 │ │ │ │ +719 template │ │ │ │ +_7_2_0 struct _M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r<_P_a_t_t_e_r_n_D_u_m_m_y,brows,bcols> │ │ │ │ +721 { │ │ │ │ +722 template │ │ │ │ +_7_2_3 void _o_p_e_r_a_t_o_r_(_)(const std::vector > >& │ │ │ │ +rows, │ │ │ │ +724 M& matrix) │ │ │ │ +725 {} │ │ │ │ +726 }; │ │ │ │ +727 │ │ │ │ +_7_2_8 template struct _i_s___c_o_m_p_l_e_x : std::false_type {}; │ │ │ │ +_7_2_9 template struct _i_s___c_o_m_p_l_e_x<_s_t_d::complex> : std::true_type {}; │ │ │ │ +730 │ │ │ │ +731 // wrapper for std::conj. Returns T if T is not complex. │ │ │ │ +732 template │ │ │ │ +_7_3_3 std::enable_if_t::value, T> _c_o_n_j(const T& r){ │ │ │ │ +734 return r; │ │ │ │ +735 } │ │ │ │ +736 │ │ │ │ +737 template │ │ │ │ +_7_3_8 std::enable_if_t::value, T> _c_o_n_j(const T& r){ │ │ │ │ +739 return std::conj(r); │ │ │ │ +740 } │ │ │ │ +741 │ │ │ │ +742 template │ │ │ │ +_7_4_3 struct _m_m___m_u_l_t_i_p_l_i_e_r_s │ │ │ │ +744 {}; │ │ │ │ +745 │ │ │ │ +746 template │ │ │ │ +_7_4_7 struct _m_m___m_u_l_t_i_p_l_i_e_r_s<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ +748 { │ │ │ │ +749 enum { │ │ │ │ +_7_5_0 rows = 1, │ │ │ │ +751 cols = 1 │ │ │ │ +_7_5_2 }; │ │ │ │ +753 }; │ │ │ │ +754 │ │ │ │ +755 template │ │ │ │ +_7_5_6 struct _m_m___m_u_l_t_i_p_l_i_e_r_s<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x,A> > │ │ │ │ +757 { │ │ │ │ +758 enum { │ │ │ │ +_7_5_9 rows = i, │ │ │ │ +760 cols = j │ │ │ │ +_7_6_1 }; │ │ │ │ +762 }; │ │ │ │ +763 │ │ │ │ +764 template │ │ │ │ +_7_6_5 void _r_e_a_d_S_p_a_r_s_e_E_n_t_r_i_e_s(_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>& matrix, │ │ │ │ +766 std::istream& file, std::size_t entries, │ │ │ │ +767 const _M_M_H_e_a_d_e_r& mmHeader, const D&) │ │ │ │ +768 { │ │ │ │ +769 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_> _M_a_t_r_i_x; │ │ │ │ +770 │ │ │ │ +771 // Number of rows and columns of T, if it is a matrix (1x1 otherwise) │ │ │ │ +772 constexpr int brows = _m_m___m_u_l_t_i_p_l_i_e_r_s_<_M_a_t_r_i_x_>_:_:_r_o_w_s; │ │ │ │ +773 constexpr int bcols = _m_m___m_u_l_t_i_p_l_i_e_r_s_<_M_a_t_r_i_x_>_:_:_c_o_l_s; │ │ │ │ +774 │ │ │ │ +775 // First path │ │ │ │ +776 // store entries together with column index in a separate │ │ │ │ +777 // data structure │ │ │ │ +778 std::vector > > rows(matrix._N()*brows); │ │ │ │ +779 │ │ │ │ +780 auto readloop = [&] (auto symmetryFixup) { │ │ │ │ +781 for(std::size_t i = 0; i < entries; ++i) { │ │ │ │ +782 std::size_t row; │ │ │ │ +783 _I_n_d_e_x_D_a_t_a_<_D_> data; │ │ │ │ +784 _s_k_i_p_C_o_m_m_e_n_t_s(file); │ │ │ │ +785 file>>row; │ │ │ │ +786 --row; // Index was 1 based. │ │ │ │ +787 assert(row/bcols>data; │ │ │ │ +789 assert(data._i_n_d_e_x/bcols data_sym(data); │ │ │ │ +804 data_sym._i_n_d_e_x = row; │ │ │ │ +805 rows[data.index].insert(data_sym); │ │ │ │ +806 }); │ │ │ │ +807 break; │ │ │ │ +808 case _s_k_e_w___s_y_m_m_e_t_r_i_c : │ │ │ │ +809 readloop([&](auto row, auto data) { │ │ │ │ +810 _I_n_d_e_x_D_a_t_a_<_D_> data_sym; │ │ │ │ +811 data_sym.number = -data.number; │ │ │ │ +812 data_sym._i_n_d_e_x = row; │ │ │ │ +813 rows[data.index].insert(data_sym); │ │ │ │ +814 }); │ │ │ │ +815 break; │ │ │ │ +816 case _h_e_r_m_i_t_i_a_n : │ │ │ │ +817 readloop([&](auto row, auto data) { │ │ │ │ +818 _I_n_d_e_x_D_a_t_a_<_D_> data_sym; │ │ │ │ +819 data_sym.number = _c_o_n_j(data.number); │ │ │ │ +820 data_sym._i_n_d_e_x = row; │ │ │ │ +821 rows[data.index].insert(data_sym); │ │ │ │ +822 }); │ │ │ │ +823 break; │ │ │ │ +824 default: │ │ │ │ +825 DUNE_THROW(Dune::NotImplemented, │ │ │ │ +826 "Only general, symmetric, skew-symmetric and hermitian is supported right │ │ │ │ +now!"); │ │ │ │ +827 } │ │ │ │ +828 │ │ │ │ +829 // Setup the matrix sparsity pattern │ │ │ │ +830 int nnz=0; │ │ │ │ +831 for(typename Matrix::CreateIterator iter=matrix._c_r_e_a_t_e_b_e_g_i_n(); │ │ │ │ +832 iter!= matrix._c_r_e_a_t_e_e_n_d(); ++iter) │ │ │ │ +833 { │ │ │ │ +834 for(std::size_t brow=iter.index()*brows, browend=iter.index()*brows+brows; │ │ │ │ +835 brow >::const_iterator Siter; │ │ │ │ +838 for(Siter siter=rows[brow].begin(), send=rows[brow].end(); │ │ │ │ +839 siter != send; ++siter, ++nnz) │ │ │ │ +840 iter.insert(siter->index/bcols); │ │ │ │ +841 } │ │ │ │ +842 } │ │ │ │ +843 │ │ │ │ +844 //Set the matrix values │ │ │ │ +845 matrix=0; │ │ │ │ +846 │ │ │ │ +847 _M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r_<_D_,_b_r_o_w_s_,_b_c_o_l_s_> Setter; │ │ │ │ +848 │ │ │ │ +849 Setter(rows, matrix); │ │ │ │ +850 } │ │ │ │ +851 │ │ │ │ +_8_5_2 inline std::tuple _s_p_l_i_t_F_i_l_e_n_a_m_e(const std:: │ │ │ │ +string& filename) { │ │ │ │ +853 std::size_t lastdot = filename.find_last_of("."); │ │ │ │ +854 if(lastdot == std::string::npos) │ │ │ │ +855 return std::make_tuple(filename, ""); │ │ │ │ +856 else { │ │ │ │ +857 std::string potentialFileExtension = filename.substr(lastdot); │ │ │ │ +858 if (potentialFileExtension == ".mm" || potentialFileExtension == ".mtx") │ │ │ │ +859 return std::make_tuple(filename.substr(0, lastdot), │ │ │ │ +potentialFileExtension); │ │ │ │ +860 else │ │ │ │ +861 return std::make_tuple(filename, ""); │ │ │ │ +862 } │ │ │ │ +863 } │ │ │ │ +864 │ │ │ │ +865 } // end namespace MatrixMarketImpl │ │ │ │ +866 │ │ │ │ +_8_6_7 class _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r : public Dune::Exception │ │ │ │ +868 {}; │ │ │ │ +869 │ │ │ │ +870 │ │ │ │ +_8_7_1 inline void _m_m___r_e_a_d___h_e_a_d_e_r(std::size_t& rows, std::size_t& cols, │ │ │ │ +872 _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r& header, std::istream& istr, │ │ │ │ +873 bool isVector) │ │ │ │ +874 { │ │ │ │ +875 using namespace MatrixMarketImpl; │ │ │ │ +876 │ │ │ │ +877 if(!readMatrixMarketBanner(istr, header)) { │ │ │ │ +878 std::cerr << "First line was not a correct Matrix Market banner. Using │ │ │ │ +default:\n" │ │ │ │ +879 << "%%MatrixMarket matrix coordinate real general"<> rows; │ │ │ │ +893 │ │ │ │ +894 if(lineFeed(istr)) │ │ │ │ +895 throw _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r(); │ │ │ │ +896 istr >> cols; │ │ │ │ +897 } │ │ │ │ +898 │ │ │ │ +899 template │ │ │ │ +_9_0_0 void _m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s(_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& vector, │ │ │ │ +901 std::size_t size, │ │ │ │ +902 std::istream& istr, │ │ │ │ +903 size_t lane) │ │ │ │ +904 { │ │ │ │ +905 for (int i=0; size>0; ++i, --size) │ │ │ │ +906 istr>>Simd::lane(lane,vector[i]); │ │ │ │ +907 } │ │ │ │ +908 │ │ │ │ +909 template │ │ │ │ +_9_1_0 void _m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s(_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r,A>& vector, │ │ │ │ +911 std::size_t size, │ │ │ │ +912 std::istream& istr, │ │ │ │ +913 size_t lane) │ │ │ │ +914 { │ │ │ │ +915 for(int i=0; size>0; ++i, --size) { │ │ │ │ +916 Simd::Scalar val; │ │ │ │ +917 istr>>val; │ │ │ │ +918 Simd::lane(lane, vector[i/entries][i%entries])=val; │ │ │ │ +919 } │ │ │ │ +920 } │ │ │ │ +921 │ │ │ │ +922 │ │ │ │ +929 template │ │ │ │ +_9_3_0 void _r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t(_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& vector, │ │ │ │ +931 std::istream& istr) │ │ │ │ +932 { │ │ │ │ +933 typedef typename _D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>_:_:_f_i_e_l_d___t_y_p_e field_type; │ │ │ │ +934 using namespace MatrixMarketImpl; │ │ │ │ +935 │ │ │ │ +936 MMHeader header; │ │ │ │ +937 std::size_t rows, cols; │ │ │ │ +938 _m_m___r_e_a_d___h_e_a_d_e_r(rows,cols,header,istr, true); │ │ │ │ +939 if(cols!=Simd::lanes()) { │ │ │ │ +940 if(Simd::lanes() == 1) │ │ │ │ +941 DUNE_THROW(_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r, "cols!=1, therefore this is no │ │ │ │ +vector!"); │ │ │ │ +942 else │ │ │ │ +943 DUNE_THROW(_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r, "cols does not match the number of │ │ │ │ +lanes in the field_type!"); │ │ │ │ +944 } │ │ │ │ +945 │ │ │ │ +946 if(header.type!=array_type) │ │ │ │ +947 DUNE_THROW(_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r, "Vectors have to be stored in array │ │ │ │ +format!"); │ │ │ │ +948 │ │ │ │ +949 │ │ │ │ +950 if constexpr (Dune::IsNumber()) │ │ │ │ +951 vector._r_e_s_i_z_e(rows); │ │ │ │ +952 else │ │ │ │ +953 { │ │ │ │ +954 T dummy; │ │ │ │ +955 auto blocksize = dummy.size(); │ │ │ │ +956 std::size_t size=rows/blocksize; │ │ │ │ +957 if(size*blocksize!=rows) │ │ │ │ +958 DUNE_THROW(_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r, "Block size of vector is not │ │ │ │ +correct!"); │ │ │ │ +959 │ │ │ │ +960 vector._r_e_s_i_z_e(size); │ │ │ │ +961 } │ │ │ │ +962 │ │ │ │ +963 istr.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +964 for(size_t l=0;l();++l){ │ │ │ │ +965 _m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s(vector, rows, istr, l); │ │ │ │ +966 } │ │ │ │ +967 } │ │ │ │ +968 │ │ │ │ +975 template │ │ │ │ +_9_7_6 void _r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t(_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>& matrix, │ │ │ │ +977 std::istream& istr) │ │ │ │ +978 { │ │ │ │ +979 using namespace MatrixMarketImpl; │ │ │ │ +980 using _M_a_t_r_i_x = _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>; │ │ │ │ +981 │ │ │ │ +982 MMHeader header; │ │ │ │ +983 if(!readMatrixMarketBanner(istr, header)) { │ │ │ │ +984 std::cerr << "First line was not a correct Matrix Market banner. Using │ │ │ │ +default:\n" │ │ │ │ +985 << "%%MatrixMarket matrix coordinate real general"<> rows; │ │ │ │ +998 │ │ │ │ +999 if(lineFeed(istr)) │ │ │ │ +1000 throw _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r(); │ │ │ │ +1001 istr >> cols; │ │ │ │ +1002 │ │ │ │ +1003 if(lineFeed(istr)) │ │ │ │ +1004 throw _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r(); │ │ │ │ +1005 │ │ │ │ +1006 istr >>entries; │ │ │ │ +1007 │ │ │ │ +1008 std::size_t nnz, blockrows, blockcols; │ │ │ │ +1009 │ │ │ │ +1010 // Number of rows and columns of T, if it is a matrix (1x1 otherwise) │ │ │ │ +1011 constexpr int brows = mm_multipliers::rows; │ │ │ │ +1012 constexpr int bcols = mm_multipliers::cols; │ │ │ │ +1013 │ │ │ │ +1014 std::tie(blockrows, blockcols, nnz) = calculateNNZ(rows, │ │ │ │ +cols, entries, header); │ │ │ │ +1015 │ │ │ │ +1016 istr.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +1017 │ │ │ │ +1018 │ │ │ │ +1019 matrix._s_e_t_S_i_z_e(blockrows, blockcols, nnz); │ │ │ │ +1020 matrix._s_e_t_B_u_i_l_d_M_o_d_e(_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>_:_:_r_o_w___w_i_s_e); │ │ │ │ +1021 │ │ │ │ +1022 if(header.type==array_type) │ │ │ │ +1023 DUNE_THROW(Dune::NotImplemented, "Array format currently not supported for │ │ │ │ +matrices!"); │ │ │ │ +1024 │ │ │ │ +1025 readSparseEntries(matrix, istr, entries, header, NumericWrapper()); │ │ │ │ +1026 } │ │ │ │ +1027 │ │ │ │ +1028 // Print a scalar entry │ │ │ │ +1029 template │ │ │ │ +_1_0_3_0 void _m_m___p_r_i_n_t___e_n_t_r_y(const B& entry, │ │ │ │ +1031 std::size_t rowidx, │ │ │ │ +1032 std::size_t colidx, │ │ │ │ +1033 std::ostream& ostr) │ │ │ │ +1034 { │ │ │ │ +1035 if constexpr (IsNumber()) │ │ │ │ +1036 ostr << rowidx << " " << colidx << " " << entry << std::endl; │ │ │ │ +1037 else │ │ │ │ +1038 { │ │ │ │ +1039 for (auto row=entry.begin(); row != entry.end(); ++row, ++rowidx) { │ │ │ │ +1040 int coli=colidx; │ │ │ │ +1041 for (auto _c_o_l = row->begin(); _c_o_l != row->end(); ++_c_o_l, ++coli) │ │ │ │ +1042 ostr<< rowidx<<" "< │ │ │ │ +_1_0_4_9 void _m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y(const V& entry, std::ostream& ostr, │ │ │ │ +1050 const std::integral_constant&, │ │ │ │ +1051 size_t lane) │ │ │ │ +1052 { │ │ │ │ +1053 ostr< │ │ │ │ +_1_0_5_8 void _m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y(const V& vector, std::ostream& ostr, │ │ │ │ +1059 const std::integral_constant&, │ │ │ │ +1060 size_t lane) │ │ │ │ +1061 { │ │ │ │ +1062 using namespace MatrixMarketImpl; │ │ │ │ +1063 │ │ │ │ +1064 // Is the entry a supported numeric type? │ │ │ │ +1065 const int isnumeric = mm_numeric_type>::is_numeric; │ │ │ │ +1066 typedef typename V::const_iterator VIter; │ │ │ │ +1067 │ │ │ │ +1068 for(VIter i=vector.begin(); i != vector.end(); ++i) │ │ │ │ +1069 │ │ │ │ +1070 _m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y(*i, ostr, │ │ │ │ +1071 std::integral_constant(), │ │ │ │ +1072 lane); │ │ │ │ +1073 } │ │ │ │ +1074 │ │ │ │ +1075 template │ │ │ │ +_1_0_7_6 std::size_t _c_o_u_n_t_E_n_t_r_i_e_s(const _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_>& vector) │ │ │ │ +1077 { │ │ │ │ +1078 return vector.size(); │ │ │ │ +1079 } │ │ │ │ +1080 │ │ │ │ +1081 template │ │ │ │ +_1_0_8_2 std::size_t _c_o_u_n_t_E_n_t_r_i_e_s(const _B_l_o_c_k_V_e_c_t_o_r,A>& vector) │ │ │ │ +1083 { │ │ │ │ +1084 return vector.size()*i; │ │ │ │ +1085 } │ │ │ │ +1086 │ │ │ │ +1087 // Version for writing vectors. │ │ │ │ +1088 template │ │ │ │ +_1_0_8_9 void _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(const V& vector, std::ostream& ostr, │ │ │ │ +1090 const std::integral_constant&) │ │ │ │ +1091 { │ │ │ │ +1092 using namespace MatrixMarketImpl; │ │ │ │ +1093 typedef typename V::field_type field_type; │ │ │ │ +1094 │ │ │ │ +1095 ostr<<_c_o_u_n_t_E_n_t_r_i_e_s(vector)<<" "<()<>::is_numeric; │ │ │ │ +1097 for(size_t l=0;l(); ++l){ │ │ │ │ +1098 _m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y(vector,ostr, std::integral_constant │ │ │ │ +(), l); │ │ │ │ +1099 } │ │ │ │ +1100 } │ │ │ │ +1101 │ │ │ │ +1102 // Versions for writing matrices │ │ │ │ +1103 template │ │ │ │ +_1_1_0_4 void _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1105 std::ostream& ostr, │ │ │ │ +1106 const std::integral_constant&) │ │ │ │ +1107 { │ │ │ │ +1108 ostr<_:_:_r_o_w_s<<" " │ │ │ │ +1109 <_:_:_c_o_l_s<<" " │ │ │ │ +1110 <<_c_o_u_n_t_N_o_n_Z_e_r_o_s(matrix)<begin(); _c_o_l != row->end(); ++_c_o_l) │ │ │ │ +1116 // Matrix Market indexing start with 1! │ │ │ │ +1117 _m_m___p_r_i_n_t___e_n_t_r_y(*_c_o_l, row.index()*_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___m_u_l_t_i_p_l_i_e_r_s_<_M_>_:_: │ │ │ │ +_r_o_w_s+1, │ │ │ │ +1118 _c_o_l.index()*_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___m_u_l_t_i_p_l_i_e_r_s_<_M_>_:_:_c_o_l_s+1, ostr); │ │ │ │ +1119 } │ │ │ │ +1120 │ │ │ │ +1121 │ │ │ │ +1125 template │ │ │ │ +_1_1_2_6 void _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1127 std::ostream& ostr) │ │ │ │ +1128 { │ │ │ │ +1129 using namespace MatrixMarketImpl; │ │ │ │ +1130 │ │ │ │ +1131 // Write header information │ │ │ │ +1132 mm_header_printer::print(ostr); │ │ │ │ +1133 mm_block_structure_header::print(ostr,matrix); │ │ │ │ +1134 // Choose the correct function for matrix and vector │ │ │ │ +1135 _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(matrix,ostr,std::integral_constant_:_: │ │ │ │ +_v_a_l_u_e>()); │ │ │ │ +1136 } │ │ │ │ +1137 │ │ │ │ +_1_1_3_8 static const int _d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n = -1; │ │ │ │ +1150 template │ │ │ │ +_1_1_5_1 void _s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1152 std::string filename, │ │ │ │ +1153 int prec=_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n) │ │ │ │ +1154 { │ │ │ │ +1155 auto [pureFilename, extension] = _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_p_l_i_t_F_i_l_e_n_a_m_e │ │ │ │ +(filename); │ │ │ │ +1156 std::string rfilename; │ │ │ │ +1157 std::ofstream file; │ │ │ │ +1158 if (extension != "") { │ │ │ │ +1159 rfilename = pureFilename + extension; │ │ │ │ +1160 file.open(rfilename.c_str()); │ │ │ │ +1161 if(!file) │ │ │ │ +1162 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str │ │ │ │ +()); │ │ │ │ +1163 } │ │ │ │ +1164 else { │ │ │ │ +1165 // only try .mm so we do not ignore potential errors │ │ │ │ +1166 rfilename = pureFilename + ".mm"; │ │ │ │ +1167 file.open(rfilename.c_str()); │ │ │ │ +1168 if(!file) │ │ │ │ +1169 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str │ │ │ │ +()); │ │ │ │ +1170 } │ │ │ │ +1171 │ │ │ │ +1172 file.setf(std::ios::scientific,std::ios::floatfield); │ │ │ │ +1173 if(prec>0) │ │ │ │ +1174 file.precision(prec); │ │ │ │ +1175 _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(matrix, file); │ │ │ │ +1176 file.close(); │ │ │ │ +1177 } │ │ │ │ +1178 │ │ │ │ +1179#if HAVE_MPI │ │ │ │ +1194 template │ │ │ │ +_1_1_9_5 void _s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1196 std::string filename, │ │ │ │ +1197 const _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>& comm, │ │ │ │ +1198 bool storeIndices=true, │ │ │ │ +1199 int prec=_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n) │ │ │ │ +1200 { │ │ │ │ +1201 // Get our rank │ │ │ │ +1202 int rank = comm._c_o_m_m_u_n_i_c_a_t_o_r().rank(); │ │ │ │ +1203 // Write the local matrix │ │ │ │ +1204 auto [pureFilename, extension] = _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_p_l_i_t_F_i_l_e_n_a_m_e │ │ │ │ +(filename); │ │ │ │ +1205 std::string rfilename; │ │ │ │ +1206 std::ofstream file; │ │ │ │ +1207 if (extension != "") { │ │ │ │ +1208 rfilename = pureFilename + "_" + std::to_string(rank) + extension; │ │ │ │ +1209 file.open(rfilename.c_str()); │ │ │ │ +1210 dverb<< rfilename <0) │ │ │ │ +1224 file.precision(prec); │ │ │ │ +1225 _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(matrix, file); │ │ │ │ +1226 file.close(); │ │ │ │ +1227 │ │ │ │ +1228 if(!storeIndices) │ │ │ │ +1229 return; │ │ │ │ +1230 │ │ │ │ +1231 // Write the global to local index mapping │ │ │ │ +1232 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx"; │ │ │ │ +1233 file.open(rfilename.c_str()); │ │ │ │ +1234 if(!file) │ │ │ │ +1235 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str │ │ │ │ +()); │ │ │ │ +1236 file.setf(std::ios::scientific,std::ios::floatfield); │ │ │ │ +1237 typedef typename _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +IndexSet; │ │ │ │ +1238 typedef typename IndexSet::const_iterator Iterator; │ │ │ │ +1239 for(Iterator iter = comm._i_n_d_e_x_S_e_t().begin(); │ │ │ │ +1240 iter != comm._i_n_d_e_x_S_e_t().end(); ++iter) { │ │ │ │ +1241 file << iter->global()<<" "<<(std::size_t)iter->local()<<" " │ │ │ │ +1242 <<(int)iter->local().attribute()<<" "<<(int)iter->local().isPublic │ │ │ │ +()<& neighbours=comm._r_e_m_o_t_e_I_n_d_i_c_e_s().getNeighbours(); │ │ │ │ +1247 typedef std::set::const_iterator SIter; │ │ │ │ +1248 for(SIter neighbour=neighbours.begin(); neighbour != neighbours.end(); │ │ │ │ +++neighbour) { │ │ │ │ +1249 file<<" "<< *neighbour; │ │ │ │ +1250 } │ │ │ │ +1251 file.close(); │ │ │ │ +1252 } │ │ │ │ +1253 │ │ │ │ +1268 template │ │ │ │ +_1_2_6_9 void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M& matrix, │ │ │ │ +1270 const std::string& filename, │ │ │ │ +1271 _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>& comm, │ │ │ │ +1272 bool readIndices=true) │ │ │ │ +1273 { │ │ │ │ +1274 using namespace MatrixMarketImpl; │ │ │ │ +1275 │ │ │ │ +1276 using LocalIndexT = typename _O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_<_G_,_L_>_:_: │ │ │ │ +_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t_:_:_L_o_c_a_l_I_n_d_e_x; │ │ │ │ +1277 typedef typename LocalIndexT::Attribute Attribute; │ │ │ │ +1278 // Get our rank │ │ │ │ +1279 int rank = comm._c_o_m_m_u_n_i_c_a_t_o_r().rank(); │ │ │ │ +1280 // load local matrix │ │ │ │ +1281 auto [pureFilename, extension] = _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_p_l_i_t_F_i_l_e_n_a_m_e │ │ │ │ +(filename); │ │ │ │ +1282 std::string rfilename; │ │ │ │ +1283 std::ifstream file; │ │ │ │ +1284 if (extension != "") { │ │ │ │ +1285 rfilename = pureFilename + "_" + std::to_string(rank) + extension; │ │ │ │ +1286 file.open(rfilename.c_str(), std::ios::in); │ │ │ │ +1287 dverb<< rfilename <_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +IndexSet; │ │ │ │ +1311 IndexSet& pis=comm.pis; │ │ │ │ +1312 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx"; │ │ │ │ +1313 file.open(rfilename.c_str()); │ │ │ │ +1314 if(!file) │ │ │ │ +1315 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str()); │ │ │ │ +1316 if(pis.size()!=0) │ │ │ │ +1317 DUNE_THROW(InvalidIndexSetState, "Index set is not empty!"); │ │ │ │ +1318 │ │ │ │ +1319 pis.beginResize(); │ │ │ │ +1320 while(!file.eof() && file.peek()!='n') { │ │ │ │ +1321 G g; │ │ │ │ +1322 file >>g; │ │ │ │ +1323 std::size_t l; │ │ │ │ +1324 file >>l; │ │ │ │ +1325 int c; │ │ │ │ +1326 file >>c; │ │ │ │ +1327 bool b; │ │ │ │ +1328 file >> b; │ │ │ │ +1329 pis.add(g,LocalIndexT(l,Attribute(c),b)); │ │ │ │ +1330 lineFeed(file); │ │ │ │ +1331 } │ │ │ │ +1332 pis.endResize(); │ │ │ │ +1333 if(!file.eof()) { │ │ │ │ +1334 // read neighbours │ │ │ │ +1335 std::string s; │ │ │ │ +1336 file>>s; │ │ │ │ +1337 if(s!="neighbours:") │ │ │ │ +1338 DUNE_THROW(_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r, "was expecting the string: │ │ │ │ +\"neighbours:\""); │ │ │ │ +1339 std::set nb; │ │ │ │ +1340 while(!file.eof()) { │ │ │ │ +1341 int i; │ │ │ │ +1342 file >> i; │ │ │ │ +1343 nb.insert(i); │ │ │ │ +1344 } │ │ │ │ +1345 file.close(); │ │ │ │ +1346 comm.ri.setNeighbours(nb); │ │ │ │ +1347 } │ │ │ │ +1348 comm.ri.template rebuild(); │ │ │ │ +1349 } │ │ │ │ +1350 │ │ │ │ +1351 #endif │ │ │ │ +1352 │ │ │ │ +1363 template │ │ │ │ +_1_3_6_4 void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M& matrix, │ │ │ │ +1365 const std::string& filename) │ │ │ │ +1366 { │ │ │ │ +1367 auto [pureFilename, extension] = _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_p_l_i_t_F_i_l_e_n_a_m_e │ │ │ │ +(filename); │ │ │ │ +1368 std::string rfilename; │ │ │ │ +1369 std::ifstream file; │ │ │ │ +1370 if (extension != "") { │ │ │ │ +1371 rfilename = pureFilename + extension; │ │ │ │ +1372 file.open(rfilename.c_str()); │ │ │ │ +1373 if(!file) │ │ │ │ +1374 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str()); │ │ │ │ +1375 } │ │ │ │ +1376 else { │ │ │ │ +1377 // try both .mm and .mtx │ │ │ │ +1378 rfilename = pureFilename + ".mm"; │ │ │ │ +1379 file.open(rfilename.c_str(), std::ios::in); │ │ │ │ +1380 if(!file) { │ │ │ │ +1381 rfilename = pureFilename + ".mtx"; │ │ │ │ +1382 file.open(rfilename.c_str(), std::ios::in); │ │ │ │ +1383 if(!file) │ │ │ │ +1384 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str()); │ │ │ │ +1385 } │ │ │ │ +1386 } │ │ │ │ +1387 _r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t(matrix,file); │ │ │ │ +1388 file.close(); │ │ │ │ +1389 } │ │ │ │ +1390 │ │ │ │ +1392} │ │ │ │ +1393#endif │ │ │ │ +_o_w_n_e_r_o_v_e_r_l_a_p_c_o_p_y_._h_h │ │ │ │ +Classes providing communication interfaces for overlapping Schwarz methods. │ │ │ │ +_b_v_e_c_t_o_r_._h_h │ │ │ │ +This file implements a vector space as a tensor product of a given vector │ │ │ │ +space. The number of compon... │ │ │ │ +_m_a_t_r_i_x_u_t_i_l_s_._h_h │ │ │ │ +Some handy generic functions for ISTL matrices. │ │ │ │ +_b_c_r_s_m_a_t_r_i_x_._h_h │ │ │ │ +Implementation of the BCRSMatrix class. │ │ │ │ _c_o_l │ │ │ │ Col col │ │ │ │ DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ +_D_u_n_e_:_:_c_o_u_n_t_N_o_n_Z_e_r_o_s │ │ │ │ +auto countNonZeros(const M &, typename std::enable_if_t< Dune::IsNumber< M >:: │ │ │ │ +value > *sfinae=nullptr) │ │ │ │ +Get the number of nonzero fields in the matrix. │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:119 │ │ │ │ +_D_u_n_e_:_:_r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ +void readMatrixMarket(Dune::BlockVector< T, A > &vector, std::istream &istr) │ │ │ │ +Reads a BlockVector from a matrix market file. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:930 │ │ │ │ +_D_u_n_e_:_:_s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ +void storeMatrixMarket(const M &matrix, std::string filename, int │ │ │ │ +prec=default_precision) │ │ │ │ +Stores a parallel matrix/vector in matrix market format in a file. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1151 │ │ │ │ +_D_u_n_e_:_:_l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ +void loadMatrixMarket(M &matrix, const std::string &filename, │ │ │ │ +OwnerOverlapCopyCommunication< G, L > &comm, bool readIndices=true) │ │ │ │ +Load a parallel matrix/vector stored in matrix market format. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1269 │ │ │ │ +_D_u_n_e_:_:_c_o_u_n_t_E_n_t_r_i_e_s │ │ │ │ +std::size_t countEntries(const BlockVector< T, A > &vector) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1076 │ │ │ │ +_D_u_n_e_:_:_w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t │ │ │ │ +void writeMatrixMarket(const V &vector, std::ostream &ostr, const std:: │ │ │ │ +integral_constant< int, 0 > &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1089 │ │ │ │ +_D_u_n_e_:_:_m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y │ │ │ │ +void mm_print_vector_entry(const V &entry, std::ostream &ostr, const std:: │ │ │ │ +integral_constant< int, 1 > &, size_t lane) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1049 │ │ │ │ +_D_u_n_e_:_:_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n │ │ │ │ +static const int default_precision │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1138 │ │ │ │ +_D_u_n_e_:_:_m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s │ │ │ │ +void mm_read_vector_entries(Dune::BlockVector< T, A > &vector, std::size_t │ │ │ │ +size, std::istream &istr, size_t lane) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:900 │ │ │ │ +_D_u_n_e_:_:_m_m___r_e_a_d___h_e_a_d_e_r │ │ │ │ +void mm_read_header(std::size_t &rows, std::size_t &cols, MatrixMarketImpl:: │ │ │ │ +MMHeader &header, std::istream &istr, bool isVector) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:871 │ │ │ │ +_D_u_n_e_:_:_m_m___p_r_i_n_t___e_n_t_r_y │ │ │ │ +void mm_print_entry(const B &entry, std::size_t rowidx, std::size_t colidx, │ │ │ │ +std::ostream &ostr) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:1030 │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:16 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ -static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:19 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:52 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_o_s_t_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ -static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:55 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_a_l_c_u_l_a_t_e_N_N_Z │ │ │ │ +std::tuple< std::size_t, std::size_t, std::size_t > calculateNNZ(std::size_t │ │ │ │ +rows, std::size_t cols, std::size_t entries, const MMHeader &header) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:547 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_< │ │ │ │ +bool operator<(const IndexData< T > &i1, const IndexData< T > &i2) │ │ │ │ +LessThan operator. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:630 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_L_i_n_e_T_y_p_e │ │ │ │ +LineType │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:296 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_D_A_T_A │ │ │ │ +@ DATA │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:296 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___H_E_A_D_E_R │ │ │ │ +@ MM_HEADER │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:296 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___I_S_T_L_S_T_R_U_C_T │ │ │ │ +@ MM_ISTLSTRUCT │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:296 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t_B_a_n_n_e_r │ │ │ │ +bool readMatrixMarketBanner(std::istream &file, MMHeader &mmHeader) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:353 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_r_e_a_d_S_p_a_r_s_e_E_n_t_r_i_e_s │ │ │ │ +void readSparseEntries(Dune::BCRSMatrix< T, A > &matrix, std::istream &file, │ │ │ │ +std::size_t entries, const MMHeader &mmHeader, const D &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:765 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___T_Y_P_E │ │ │ │ +MM_TYPE │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:299 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_a_r_r_a_y___t_y_p_e │ │ │ │ +@ array_type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:299 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_o_o_r_d_i_n_a_t_e___t_y_p_e │ │ │ │ +@ coordinate_type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:299 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_u_n_k_n_o_w_n___t_y_p_e │ │ │ │ +@ unknown_type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:299 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_o_p_e_r_a_t_o_r_>_> │ │ │ │ +std::istream & operator>>(std::istream &is, NumericWrapper< T > &num) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:614 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_k_i_p_C_o_m_m_e_n_t_s │ │ │ │ +void skipComments(std::istream &file) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:339 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_l_i_n_e_F_e_e_d │ │ │ │ +bool lineFeed(std::istream &file) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:315 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___M_A_X___L_I_N_E___L_E_N_G_T_H │ │ │ │ +@ MM_MAX_LINE_LENGTH │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:297 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___S_T_R_U_C_T_U_R_E │ │ │ │ +MM_STRUCTURE │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:303 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_k_e_w___s_y_m_m_e_t_r_i_c │ │ │ │ +@ skew_symmetric │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:303 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_g_e_n_e_r_a_l │ │ │ │ +@ general │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:303 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_h_e_r_m_i_t_i_a_n │ │ │ │ +@ hermitian │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:303 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_u_n_k_n_o_w_n___s_t_r_u_c_t_u_r_e │ │ │ │ +@ unknown_structure │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:303 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_y_m_m_e_t_r_i_c │ │ │ │ +@ symmetric │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:303 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M___C_T_Y_P_E │ │ │ │ +MM_CTYPE │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:301 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_u_n_k_n_o_w_n___c_t_y_p_e │ │ │ │ +@ unknown_ctype │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:301 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_p_a_t_t_e_r_n │ │ │ │ +@ pattern │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:301 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_o_m_p_l_e_x___t_y_p_e │ │ │ │ +@ complex_type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:301 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_d_o_u_b_l_e___t_y_p_e │ │ │ │ +@ double_type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:301 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_i_n_t_e_g_e_r___t_y_p_e │ │ │ │ +@ integer_type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:301 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_c_o_n_j │ │ │ │ +std::enable_if_t::value, T > conj(const T &r) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:733 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_s_p_l_i_t_F_i_l_e_n_a_m_e │ │ │ │ +std::tuple< std::string, std::string > splitFilename(const std::string │ │ │ │ +&filename) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:852 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x │ │ │ │ +A sparse block matrix with compressed row storage. │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:466 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ +Iterator begin() │ │ │ │ +Get iterator to first row. │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:671 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ +Iterator end() │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:677 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_r_e_a_t_e_e_n_d │ │ │ │ +CreateIterator createend() │ │ │ │ +get create iterator pointing to one after the last block │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1100 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_M │ │ │ │ +size_type M() const │ │ │ │ +number of columns (counted in blocks) │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2007 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_c_r_e_a_t_e_b_e_g_i_n │ │ │ │ +CreateIterator createbegin() │ │ │ │ +get initial create iterator │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:1094 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_N │ │ │ │ +size_type N() const │ │ │ │ +number of rows (counted in blocks) │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:2001 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_B_u_i_l_d_M_o_d_e │ │ │ │ +void setBuildMode(BuildMode bm) │ │ │ │ +Sets the build mode of the matrix. │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:830 │ │ │ │ +_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_:_:_s_e_t_S_i_z_e │ │ │ │ +void setSize(size_type rows, size_type columns, size_type nnz=0) │ │ │ │ +Set the size of the matrix. │ │ │ │ +DDeeffiinniittiioonn bcrsmatrix.hh:858 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r │ │ │ │ +A vector of blocks with memory management. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:392 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_r_e_s_i_z_e │ │ │ │ +void resize(size_type size) │ │ │ │ +Resize the vector. │ │ │ │ +DDeeffiinniittiioonn bvector.hh:496 │ │ │ │ +_D_u_n_e_:_:_B_l_o_c_k_V_e_c_t_o_r_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ +typename Imp::BlockTraits< B >::field_type field_type │ │ │ │ +export the type representing the field │ │ │ │ +DDeeffiinniittiioonn bvector.hh:398 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ +A generic dynamic dense matrix. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +Helper metaprogram to get the matrix market string representation of the │ │ │ │ +numeric type. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:76 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_:_:_i_s___n_u_m_e_r_i_c │ │ │ │ +@ is_numeric │ │ │ │ +Whether T is a supported numeric type. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:81 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _i_n_t_ _>_:_:_s_t_r │ │ │ │ +static std::string str() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:95 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _d_o_u_b_l_e_ _>_:_:_s_t_r │ │ │ │ +static std::string str() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:111 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _f_l_o_a_t_ _>_:_:_s_t_r │ │ │ │ +static std::string str() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:127 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _d_o_u_b_l_e_ _>_ _>_:_:_s_t_r │ │ │ │ +static std::string str() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:143 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___n_u_m_e_r_i_c___t_y_p_e_<_ _s_t_d_:_:_c_o_m_p_l_e_x_<_ _f_l_o_a_t_ _>_ _>_:_:_s_t_r │ │ │ │ +static std::string str() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:159 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r │ │ │ │ +Meta program to write the correct Matrix Market header. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:174 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:179 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _B_,_ _A_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:189 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _j_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:199 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___h_e_a_d_e_r___p_r_i_n_t_e_r_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _i_,_ _j_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:209 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r │ │ │ │ +Metaprogram for writing the ISTL block structure header. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:225 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os, const M &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:233 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _T_,_ _A_ _>_ _>_:_:_M │ │ │ │ +BlockVector< T, A > M │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:230 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_, │ │ │ │ +_i_ _>_,_ _A_ _>_ _>_:_:_M │ │ │ │ +BlockVector< FieldVector< T, i >, A > M │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:243 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_l_o_c_k_V_e_c_t_o_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_, │ │ │ │ +_i_ _>_,_ _A_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os, const M &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:245 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_M │ │ │ │ +BCRSMatrix< T, A > M │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:255 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _T_,_ _A_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os, const M &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:258 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_, │ │ │ │ +_i_,_ _j_ _>_,_ _A_ _>_ _>_:_:_M │ │ │ │ +BCRSMatrix< FieldMatrix< T, i, j >, A > M │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:268 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _B_C_R_S_M_a_t_r_i_x_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_, │ │ │ │ +_i_,_ _j_ _>_,_ _A_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os, const M &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:270 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _i_,_ _j_ _>_ _>_:_: │ │ │ │ +_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os, const M &m) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:283 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _F_i_e_l_d_M_a_t_r_i_x_<_ _T_,_ _i_,_ _j_ _>_ _>_:_:_M │ │ │ │ +FieldMatrix< T, i, j > M │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:281 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _i_ _>_ _>_:_:_p_r_i_n_t │ │ │ │ +static void print(std::ostream &os, const M &m) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:292 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r_<_ _F_i_e_l_d_V_e_c_t_o_r_<_ _T_,_ _i_ _>_ _>_:_:_M │ │ │ │ +FieldVector< T, i > M │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:290 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:306 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r_:_:_s_t_r_u_c_t_u_r_e │ │ │ │ +MM_STRUCTURE structure │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:312 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r_:_:_t_y_p_e │ │ │ │ +MM_TYPE type │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:310 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r_:_:_M_M_H_e_a_d_e_r │ │ │ │ +MMHeader() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:307 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_M_H_e_a_d_e_r_:_:_c_t_y_p_e │ │ │ │ +MM_CTYPE ctype │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:311 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_I_n_d_e_x_D_a_t_a │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:578 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_I_n_d_e_x_D_a_t_a_:_:_i_n_d_e_x │ │ │ │ +std::size_t index │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:579 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_N_u_m_e_r_i_c_W_r_a_p_p_e_r │ │ │ │ +a wrapper class of numeric values. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:595 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_N_u_m_e_r_i_c_W_r_a_p_p_e_r_:_:_n_u_m_b_e_r │ │ │ │ +T number │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:596 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_P_a_t_t_e_r_n_D_u_m_m_y │ │ │ │ +Utility class for marking the pattern type of the MatrixMarket matrices. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:607 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r │ │ │ │ +Functor to the data values of the matrix. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:677 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const std::vector< std::set< IndexData< D > > > &rows, │ │ │ │ +BCRSMatrix< T > &matrix) │ │ │ │ +Sets the matrix values. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:684 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const std::vector< std::set< IndexData< D > > > &rows, │ │ │ │ +BCRSMatrix< FieldMatrix< T, brows, bcols > > &matrix) │ │ │ │ +Sets the matrix values. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:702 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r_<_ _P_a_t_t_e_r_n_D_u_m_m_y_,_ _b_r_o_w_s_,_ _b_c_o_l_s_ _>_:_: │ │ │ │ +_o_p_e_r_a_t_o_r_(_) │ │ │ │ +void operator()(const std::vector< std::set< IndexData< PatternDummy > > > │ │ │ │ +&rows, M &matrix) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:723 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_i_s___c_o_m_p_l_e_x │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:728 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l_:_:_m_m___m_u_l_t_i_p_l_i_e_r_s │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:744 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:868 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ +_D_u_n_e_:_:_I_s_M_a_t_r_i_x │ │ │ │ +Test whether a type is an ISTL Matrix. │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:504 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n │ │ │ │ +A class setting up standard communication for a two-valued attribute set with │ │ │ │ +owner/overlap/copy sema... │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:174 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_i_n_d_e_x_S_e_t │ │ │ │ +const ParallelIndexSet & indexSet() const │ │ │ │ +Get the underlying parallel index set. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:462 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_c_o_m_m_u_n_i_c_a_t_o_r │ │ │ │ +const Communication< MPI_Comm > & communicator() const │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:299 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_r_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +const RemoteIndices & remoteIndices() const │ │ │ │ +Get the underlying remote indices. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:471 │ │ │ │ +_D_u_n_e_:_:_O_w_n_e_r_O_v_e_r_l_a_p_C_o_p_y_C_o_m_m_u_n_i_c_a_t_i_o_n_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +Dune::ParallelIndexSet< GlobalIdType, LI, 512 > ParallelIndexSet │ │ │ │ +The type of the parallel index set. │ │ │ │ +DDeeffiinniittiioonn owneroverlapcopy.hh:449 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamg.hh File Reference │ │ │ +dune-istl: ildl.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,81 +65,60 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -Classes | │ │ │ Namespaces | │ │ │ -Macros
│ │ │ -
fastamg.hh File Reference
│ │ │ +Functions
│ │ │ +
ildl.hh File Reference
│ │ │ │ │ │
│ │ │ │ │ │ -

A fast AMG method, that currently only allows only Gauss-Seidel smoothing and is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep with the defect calculation to reduce memory transfers. │ │ │ +

Incomplete LDL decomposition. │ │ │ More...

│ │ │ -
#include <memory>
│ │ │ -#include <dune/common/exceptions.hh>
│ │ │ -#include <dune/common/typetraits.hh>
│ │ │ -#include <dune/istl/paamg/smoother.hh>
│ │ │ -#include <dune/istl/paamg/transfer.hh>
│ │ │ -#include <dune/istl/paamg/matrixhierarchy.hh>
│ │ │ -#include <dune/istl/solvers.hh>
│ │ │ -#include <dune/istl/scalarproducts.hh>
│ │ │ -#include <dune/istl/superlu.hh>
│ │ │ -#include <dune/istl/umfpack.hh>
│ │ │ -#include <dune/istl/solvertype.hh>
│ │ │ -#include <dune/istl/io.hh>
│ │ │ -#include <dune/istl/preconditioners.hh>
│ │ │ -#include "fastamgsmoother.hh"
│ │ │ +
#include <dune/common/scalarvectorview.hh>
│ │ │ +#include <dune/common/scalarmatrixview.hh>
│ │ │ +#include "ilu.hh"
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -

│ │ │ -Classes

class  Dune::Amg::FastAMG< M, X, PI, A >
 A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ -Macros

#define DIRECTSOLVER   SuperLU
 

│ │ │ +Functions

template<class K , int m, int n>
static void Dune::bildl_subtractBCT (const FieldMatrix< K, m, n > &B, const FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A)
 
template<class K >
static void Dune::bildl_subtractBCT (const K &B, const K &CT, K &A, typename std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr)
 
template<class Matrix >
static void Dune::bildl_subtractBCT (const Matrix &B, const Matrix &CT, Matrix &A, typename std::enable_if_t<!Dune::IsNumber< Matrix >::value > *sfinae=nullptr)
 
template<class Matrix >
void Dune::bildl_decompose (Matrix &A)
 compute ILDL decomposition of a symmetric matrix A
 
template<class Matrix , class X , class Y >
void Dune::bildl_backsolve (const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
 
│ │ │

Detailed Description

│ │ │ -

A fast AMG method, that currently only allows only Gauss-Seidel smoothing and is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep with the defect calculation to reduce memory transfers.

│ │ │ -
Author
Markus Blatt
│ │ │ -

Macro Definition Documentation

│ │ │ - │ │ │ -

◆ DIRECTSOLVER

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define DIRECTSOLVER   SuperLU
│ │ │ -
│ │ │ - │ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +

Incomplete LDL decomposition.

│ │ │ +
Author
Martin Nolte
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,51 +1,44 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _M_a_c_r_o_s │ │ │ │ -fastamg.hh File Reference │ │ │ │ -A fast AMG method, that currently only allows only Gauss-Seidel smoothing and │ │ │ │ -is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep │ │ │ │ -with the defect calculation to reduce memory transfers. _M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ -#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ -#include "_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h" │ │ │ │ +_N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +ildl.hh File Reference │ │ │ │ +Incomplete LDL decomposition. _M_o_r_e_._._. │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_i_l_u_._h_h" │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ -CCllaasssseess │ │ │ │ -class   _D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_<_ _M_,_ _X_,_ _P_I_,_ _A_ _> │ │ │ │ -  A fast (sequential) algebraic multigrid based on agglomeration that │ │ │ │ - saves memory bandwidth. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +FFuunnccttiioonnss │ │ │ │ +template │ │ │ │ +static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &B, const │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &CT, _F_i_e_l_d_M_a_t_r_i_x< K, m, n > &A) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const K &B, const K &CT, K &A, typename │ │ │ │ + std::enable_if_t< Dune::IsNumber< K >::value > *sfinae=nullptr) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +static void  _D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T (const _M_a_t_r_i_x &B, const _M_a_t_r_i_x &CT, _M_a_t_r_i_x │ │ │ │ + &A, typename std::enable_if_t::value > │ │ │ │ + *sfinae=nullptr) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e (_M_a_t_r_i_x &A) │ │ │ │ +  compute ILDL decomposition of a symmetric matrix A │ │ │ │   │ │ │ │ -MMaaccrrooss │ │ │ │ -#define  _D_I_R_E_C_T_S_O_L_V_E_R   SuperLU │ │ │ │ +template │ │ │ │ + void  _D_u_n_e_:_:_b_i_l_d_l___b_a_c_k_s_o_l_v_e (const _M_a_t_r_i_x &A, X &v, const Y &d, bool │ │ │ │ + isLowerTriangular=false) │ │ │ │   │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -A fast AMG method, that currently only allows only Gauss-Seidel smoothing and │ │ │ │ -is currently purely sequential. It combines one Gauss-Seidel presmoothing sweep │ │ │ │ -with the defect calculation to reduce memory transfers. │ │ │ │ +Incomplete LDL decomposition. │ │ │ │ Author │ │ │ │ - Markus Blatt │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? DDIIRREECCTTSSOOLLVVEERR ********** │ │ │ │ -#define DIRECTSOLVER   SuperLU │ │ │ │ + Martin Nolte │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: fastamg.hh Source File │ │ │ +dune-istl: ildl.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,679 +70,250 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
fastamg.hh
│ │ │ +
ildl.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │ -
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │ -
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_ISTL_FASTAMG_HH
│ │ │ -
6#define DUNE_ISTL_FASTAMG_HH
│ │ │ -
7
│ │ │ -
8#include <memory>
│ │ │ -
9#include <dune/common/exceptions.hh>
│ │ │ -
10#include <dune/common/typetraits.hh>
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
14#include <dune/istl/solvers.hh>
│ │ │ - │ │ │ -
16#include <dune/istl/superlu.hh>
│ │ │ -
17#include <dune/istl/umfpack.hh>
│ │ │ - │ │ │ -
19#include <dune/istl/io.hh>
│ │ │ - │ │ │ -
21
│ │ │ -
22#include "fastamgsmoother.hh"
│ │ │ -
23
│ │ │ -
32namespace Dune
│ │ │ -
33{
│ │ │ -
34 namespace Amg
│ │ │ -
35 {
│ │ │ -
58 template<class M, class X, class PI=SequentialInformation, class A=std::allocator<X> >
│ │ │ -
│ │ │ -
59 class FastAMG : public Preconditioner<X,X>
│ │ │ -
60 {
│ │ │ -
61 public:
│ │ │ -
63 typedef M Operator;
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
75
│ │ │ -
77 typedef X Domain;
│ │ │ -
79 typedef X Range;
│ │ │ - │ │ │ -
82
│ │ │ -
90 FastAMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ -
91 const Parameters& parms,
│ │ │ -
92 bool symmetric=true);
│ │ │ +
3#ifndef DUNE_ISTL_ILDL_HH
│ │ │ +
4#define DUNE_ISTL_ILDL_HH
│ │ │ +
5
│ │ │ +
6#include <dune/common/scalarvectorview.hh>
│ │ │ +
7#include <dune/common/scalarmatrixview.hh>
│ │ │ +
8#include "ilu.hh"
│ │ │ +
9
│ │ │ +
17namespace Dune
│ │ │ +
18{
│ │ │ +
19
│ │ │ +
20 // bildl_subtractBCT
│ │ │ +
21 // -----------------
│ │ │ +
22
│ │ │ +
23 template< class K, int m, int n >
│ │ │ +
│ │ │ + │ │ │ +
25 {
│ │ │ +
26 for( int i = 0; i < m; ++i )
│ │ │ +
27 {
│ │ │ +
28 for( int j = 0; j < n; ++j )
│ │ │ +
29 {
│ │ │ +
30 for( int k = 0; k < n; ++k )
│ │ │ +
31 A[ i ][ j ] -= B[ i ][ k ] * CT[ j ][ k ];
│ │ │ +
32 }
│ │ │ +
33 }
│ │ │ +
34 }
│ │ │ +
│ │ │ +
35
│ │ │ +
36 template< class K >
│ │ │ +
│ │ │ +
37 inline static void bildl_subtractBCT ( const K &B, const K &CT, K &A,
│ │ │ +
38 typename std::enable_if_t<Dune::IsNumber<K>::value>* sfinae = nullptr )
│ │ │ +
39 {
│ │ │ +
40 A -= B * CT;
│ │ │ +
41 }
│ │ │ +
│ │ │ +
42
│ │ │ +
43 template< class Matrix >
│ │ │ +
│ │ │ +
44 inline static void bildl_subtractBCT ( const Matrix &B, const Matrix &CT, Matrix &A,
│ │ │ +
45 typename std::enable_if_t<!Dune::IsNumber<Matrix>::value>* sfinae = nullptr )
│ │ │ +
46 {
│ │ │ +
47 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ +
48 {
│ │ │ +
49 auto &&A_i = *i;
│ │ │ +
50 auto &&B_i = B[ i.index() ];
│ │ │ +
51 const auto ikend = B_i.end();
│ │ │ +
52 for( auto j = A_i.begin(), jend = A_i.end(); j != jend; ++j )
│ │ │ +
53 {
│ │ │ +
54 auto &&A_ij = *j;
│ │ │ +
55 auto &&CT_j = CT[ j.index() ];
│ │ │ +
56 const auto jkend = CT_j.end();
│ │ │ +
57 for( auto ik = B_i.begin(), jk = CT_j.begin(); (ik != ikend) && (jk != jkend); )
│ │ │ +
58 {
│ │ │ +
59 if( ik.index() == jk.index() )
│ │ │ +
60 {
│ │ │ +
61 bildl_subtractBCT( *ik, *jk, A_ij );
│ │ │ +
62 ++ik; ++jk;
│ │ │ +
63 }
│ │ │ +
64 else if( ik.index() < jk.index() )
│ │ │ +
65 ++ik;
│ │ │ +
66 else
│ │ │ +
67 ++jk;
│ │ │ +
68 }
│ │ │ +
69 }
│ │ │ +
70 }
│ │ │ +
71 }
│ │ │ +
│ │ │ +
72
│ │ │ +
73
│ │ │ +
74
│ │ │ +
75 // bildl_decompose
│ │ │ +
76 // ---------------
│ │ │ +
77
│ │ │ +
87 template< class Matrix >
│ │ │ +
│ │ │ +
88 inline void bildl_decompose ( Matrix &A )
│ │ │ +
89 {
│ │ │ +
90 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ +
91 {
│ │ │ +
92 auto &&A_i = *i;
│ │ │
93
│ │ │ -
105 template<class C>
│ │ │ -
106 FastAMG(std::shared_ptr<const Operator> fineOperator,
│ │ │ -
107 const C& criterion,
│ │ │ -
108 const Parameters& parms=Parameters(),
│ │ │ -
109 bool symmetric=true,
│ │ │ - │ │ │ -
111
│ │ │ -
124 template<class C>
│ │ │ -
│ │ │ -
125 FastAMG(const Operator& fineOperator,
│ │ │ -
126 const C& criterion,
│ │ │ -
127 const Parameters& parms=Parameters(),
│ │ │ -
128 bool symmetric=true,
│ │ │ - │ │ │ -
130 : FastAMG(stackobject_to_shared_ptr(fineOperator),
│ │ │ -
131 criterion, parms, symmetric, pinfo)
│ │ │ -
132 {}
│ │ │ -
│ │ │ -
133
│ │ │ -
137 FastAMG(const FastAMG& amg);
│ │ │ -
138
│ │ │ -
140 void pre(Domain& x, Range& b);
│ │ │ -
141
│ │ │ -
143 void apply(Domain& v, const Range& d);
│ │ │ +
94 auto ij = A_i.begin();
│ │ │ +
95 for( ; ij.index() < i.index(); ++ij )
│ │ │ +
96 {
│ │ │ +
97 auto &&A_ij = *ij;
│ │ │ +
98 auto &&A_j = A[ ij.index() ];
│ │ │ +
99
│ │ │ +
100 // store L_ij Dj in A_ij (note: for k < i: A_kj = L_kj)
│ │ │ +
101 // L_ij Dj = A_ij - \sum_{k < j} (L_ik D_k) L_jk^T
│ │ │ +
102 auto ik = A_i.begin();
│ │ │ +
103 auto jk = A_j.begin();
│ │ │ +
104 while( (ik != ij) && (jk.index() < ij.index()) )
│ │ │ +
105 {
│ │ │ +
106 if( ik.index() == jk.index() )
│ │ │ +
107 {
│ │ │ +
108 bildl_subtractBCT(*ik, *jk, A_ij);
│ │ │ +
109 ++ik; ++jk;
│ │ │ +
110 }
│ │ │ +
111 else if( ik.index() < jk.index() )
│ │ │ +
112 ++ik;
│ │ │ +
113 else
│ │ │ +
114 ++jk;
│ │ │ +
115 }
│ │ │ +
116 }
│ │ │ +
117
│ │ │ +
118 if( ij.index() != i.index() )
│ │ │ +
119 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ +
120
│ │ │ +
121 // update diagonal and multiply A_ij by D_j^{-1}
│ │ │ +
122 auto &&A_ii = *ij;
│ │ │ +
123 for( auto ik = A_i.begin(); ik != ij; ++ik )
│ │ │ +
124 {
│ │ │ +
125 auto &&A_ik = *ik;
│ │ │ +
126 const auto &A_k = A[ ik.index() ];
│ │ │ +
127
│ │ │ +
128 auto B = A_ik;
│ │ │ +
129 Impl::asMatrix(A_ik).rightmultiply( Impl::asMatrix(*A_k.find( ik.index() )) );
│ │ │ +
130 bildl_subtractBCT( B, A_ik, A_ii );
│ │ │ +
131 }
│ │ │ +
132 try
│ │ │ +
133 {
│ │ │ +
134 Impl::asMatrix(A_ii).invert();
│ │ │ +
135 }
│ │ │ +
136 catch( const Dune::FMatrixError &e )
│ │ │ +
137 {
│ │ │ +
138 DUNE_THROW( MatrixBlockError, "ILDL failed to invert matrix block A[" << i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); th__ex.c = ij.index() );
│ │ │ +
139 }
│ │ │ +
140 }
│ │ │ +
141 }
│ │ │ +
│ │ │ +
142
│ │ │ +
143
│ │ │
144
│ │ │ -
│ │ │ - │ │ │ -
147 {
│ │ │ - │ │ │ -
149 }
│ │ │ -
│ │ │ -
150
│ │ │ -
152 void post(Domain& x);
│ │ │ -
153
│ │ │ -
158 template<class A1>
│ │ │ -
159 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ -
160
│ │ │ -
161 std::size_t levels();
│ │ │ +
145 // bildl_backsolve
│ │ │ +
146 // ---------------
│ │ │ +
147
│ │ │ +
148 template< class Matrix, class X, class Y >
│ │ │ +
│ │ │ +
149 inline void bildl_backsolve ( const Matrix &A, X &v, const Y &d, bool isLowerTriangular = false )
│ │ │ +
150 {
│ │ │ +
151 // solve L v = d, note: Lii = I
│ │ │ +
152 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ +
153 {
│ │ │ +
154 const auto &A_i = *i;
│ │ │ +
155 v[ i.index() ] = d[ i.index() ];
│ │ │ +
156 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij )
│ │ │ +
157 {
│ │ │ +
158 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ +
159 Impl::asMatrix(*ij).mmv(Impl::asVector( v[ ij.index() ] ), vi);
│ │ │ +
160 }
│ │ │ +
161 }
│ │ │
162
│ │ │ -
163 std::size_t maxlevels();
│ │ │ -
164
│ │ │ -
│ │ │ - │ │ │ -
174 {
│ │ │ -
175 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ -
176 }
│ │ │ -
│ │ │ -
177
│ │ │ -
182 bool usesDirectCoarseLevelSolver() const;
│ │ │ -
183
│ │ │ -
184 private:
│ │ │ -
191 template<class C>
│ │ │ -
192 void createHierarchies(C& criterion,
│ │ │ -
193 std::shared_ptr<const Operator> fineOperator,
│ │ │ -
194 const PI& pinfo);
│ │ │ -
195
│ │ │ -
202 struct LevelContext
│ │ │ -
203 {
│ │ │ -
207 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ - │ │ │ -
215 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ -
219 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
235 std::size_t level;
│ │ │ -
236 };
│ │ │ -
237
│ │ │ -
239 void mgc(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ -
240
│ │ │ -
247 void presmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ -
248
│ │ │ -
255 void postsmooth(LevelContext& levelContext, Domain& x, const Range& b);
│ │ │ -
256
│ │ │ -
263 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel,
│ │ │ -
264 Domain& fineX);
│ │ │ -
265
│ │ │ -
270 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ -
271
│ │ │ -
276 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ -
277
│ │ │ -
279 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ -
281 std::shared_ptr<CoarseSolver> solver_;
│ │ │ -
283 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ -
285 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ -
287 std::shared_ptr<Hierarchy<Domain,A>> residual_;
│ │ │ -
288
│ │ │ - │ │ │ -
292 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ -
294 std::size_t gamma_;
│ │ │ -
296 std::size_t preSteps_;
│ │ │ -
298 std::size_t postSteps_;
│ │ │ -
299 std::size_t level;
│ │ │ -
300 bool buildHierarchy_;
│ │ │ -
301 bool symmetric;
│ │ │ -
302 bool coarsesolverconverged;
│ │ │ - │ │ │ -
304 typedef std::shared_ptr<Smoother> SmootherPointer;
│ │ │ -
305 SmootherPointer coarseSmoother_;
│ │ │ -
307 std::size_t verbosity_;
│ │ │ -
308 };
│ │ │ -
│ │ │ -
309
│ │ │ -
310 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
312 : matrices_(amg.matrices_), solver_(amg.solver_),
│ │ │ -
313 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_),
│ │ │ -
314 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ -
315 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ -
316 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_)
│ │ │ -
317 {}
│ │ │ -
│ │ │ -
318
│ │ │ -
319 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
321 const Parameters& parms, bool symmetric_)
│ │ │ -
322 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver),
│ │ │ -
323 rhs_(), lhs_(), residual_(), scalarProduct_(),
│ │ │ -
324 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ -
325 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ -
326 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ -
327 coarseSmoother_(), verbosity_(parms.debugLevel())
│ │ │ -
328 {
│ │ │ -
329 if(preSteps_>1||postSteps_>1)
│ │ │ -
330 {
│ │ │ -
331 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ -
332 preSteps_=postSteps_=0;
│ │ │ -
333 }
│ │ │ -
334 assert(matrices_->isBuilt());
│ │ │ -
335 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ -
336 "Currently only sequential runs are supported");
│ │ │ -
337 }
│ │ │ -
│ │ │ -
338 template<class M, class X, class PI, class A>
│ │ │ -
339 template<class C>
│ │ │ -
│ │ │ -
340 FastAMG<M,X,PI,A>::FastAMG(std::shared_ptr<const Operator> fineOperator,
│ │ │ -
341 const C& criterion,
│ │ │ -
342 const Parameters& parms,
│ │ │ -
343 bool symmetric_,
│ │ │ -
344 const PI& pinfo)
│ │ │ -
345 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_(parms.getGamma()),
│ │ │ -
346 preSteps_(parms.getNoPreSmoothSteps()), postSteps_(parms.getNoPostSmoothSteps()),
│ │ │ -
347 buildHierarchy_(true),
│ │ │ -
348 symmetric(symmetric_), coarsesolverconverged(true),
│ │ │ -
349 coarseSmoother_(), verbosity_(criterion.debugLevel())
│ │ │ -
350 {
│ │ │ -
351 if(preSteps_>1||postSteps_>1)
│ │ │ -
352 {
│ │ │ -
353 std::cerr<<"WARNING only one step of smoothing is supported!"<<std::endl;
│ │ │ -
354 preSteps_=postSteps_=1;
│ │ │ -
355 }
│ │ │ -
356 static_assert(std::is_same<PI,SequentialInformation>::value,
│ │ │ -
357 "Currently only sequential runs are supported");
│ │ │ -
358 // TODO: reestablish compile time checks.
│ │ │ -
359 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ -
360 // "Matrix and Solver must match in terms of category!");
│ │ │ -
361 createHierarchies(criterion, std::move(fineOperator), pinfo);
│ │ │ -
362 }
│ │ │ -
│ │ │ -
363
│ │ │ -
364 template<class M, class X, class PI, class A>
│ │ │ -
365 template<class C>
│ │ │ -
366 void FastAMG<M,X,PI,A>::createHierarchies(C& criterion,
│ │ │ -
367 std::shared_ptr<const Operator> fineOperator,
│ │ │ -
368 const PI& pinfo)
│ │ │ -
369 {
│ │ │ -
370 Timer watch;
│ │ │ -
371 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ -
372 std::const_pointer_cast<Operator>(std::move(fineOperator)),
│ │ │ -
373 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ -
374
│ │ │ -
375 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ -
376
│ │ │ -
377 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ -
378 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ -
379
│ │ │ -
380 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()) {
│ │ │ -
381 // We have the carsest level. Create the coarse Solver
│ │ │ -
382 typedef typename SmootherTraits<Smoother>::Arguments SmootherArgs;
│ │ │ -
383 SmootherArgs sargs;
│ │ │ -
384 sargs.iterations = 1;
│ │ │ -
385
│ │ │ - │ │ │ -
387 cargs.setArgs(sargs);
│ │ │ -
388 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ -
389 // Solve on the redistributed partitioning
│ │ │ -
390 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ -
391 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ -
392 }else{
│ │ │ -
393 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ -
394 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ -
395 }
│ │ │ -
396
│ │ │ -
397 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ -
398 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ -
399
│ │ │ -
400#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ -
401#if HAVE_SUITESPARSE_UMFPACK
│ │ │ -
402#define DIRECTSOLVER UMFPack
│ │ │ -
403#else
│ │ │ -
404#define DIRECTSOLVER SuperLU
│ │ │ -
405#endif
│ │ │ -
406 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ -
407 if(std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ -
408 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ -
409 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ -
410 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ -
411 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0)) { // redistribute and 1 proc
│ │ │ -
412 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ -
413 std::cout<<"Using superlu"<<std::endl;
│ │ │ -
414 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ -
415 {
│ │ │ -
416 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ -
417 // We are still participating on this level
│ │ │ -
418 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ -
419 else
│ │ │ -
420 solver_.reset();
│ │ │ -
421 }else
│ │ │ -
422 solver_.reset(new DIRECTSOLVER<typename M::matrix_type>(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ -
423 }else
│ │ │ -
424#undef DIRECTSOLVER
│ │ │ -
425#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK
│ │ │ -
426 {
│ │ │ -
427 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ -
428 {
│ │ │ -
429 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ -
430 // We are still participating on this level
│ │ │ -
431 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ -
432 *scalarProduct_,
│ │ │ -
433 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ -
434 else
│ │ │ -
435 solver_.reset();
│ │ │ -
436 }else
│ │ │ -
437 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ -
438 *scalarProduct_,
│ │ │ -
439 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ -
440 }
│ │ │ -
441 }
│ │ │ -
442
│ │ │ -
443 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ -
444 std::cout<<"Building Hierarchy of "<<matrices_->maxlevels()<<" levels took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ -
445 }
│ │ │ -
446
│ │ │ -
447
│ │ │ -
448 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
450 {
│ │ │ -
451 Timer watch, watch1;
│ │ │ -
452 // Detect Matrix rows where all offdiagonal entries are
│ │ │ -
453 // zero and set x such that A_dd*x_d=b_d
│ │ │ -
454 // Thus users can be more careless when setting up their linear
│ │ │ -
455 // systems.
│ │ │ -
456 typedef typename M::matrix_type Matrix;
│ │ │ -
457 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ -
458 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ -
459 typedef typename Matrix::block_type Block;
│ │ │ -
460 Block zero;
│ │ │ -
461 zero=typename Matrix::field_type();
│ │ │ -
462
│ │ │ -
463 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ -
464 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ -
465 bool isDirichlet = true;
│ │ │ -
466 bool hasDiagonal = false;
│ │ │ -
467 ColIter diag;
│ │ │ -
468 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ -
469 if(row.index()==col.index()) {
│ │ │ -
470 diag = col;
│ │ │ -
471 hasDiagonal = (*col != zero);
│ │ │ -
472 }else{
│ │ │ -
473 if(*col!=zero)
│ │ │ -
474 isDirichlet = false;
│ │ │ -
475 }
│ │ │ -
476 }
│ │ │ -
477 if(isDirichlet && hasDiagonal)
│ │ │ -
478 diag->solve(x[row.index()], b[row.index()]);
│ │ │ -
479 }
│ │ │ -
480 if (verbosity_>0)
│ │ │ -
481 std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
│ │ │ -
482 watch1.reset();
│ │ │ -
483 // No smoother to make x consistent! Do it by hand
│ │ │ -
484 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ -
485 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ -
486 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ -
487 residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ -
488 matrices_->coarsenVector(*rhs_);
│ │ │ -
489 matrices_->coarsenVector(*lhs_);
│ │ │ -
490 matrices_->coarsenVector(*residual_);
│ │ │ -
491
│ │ │ -
492 // The preconditioner might change x and b. So we have to
│ │ │ -
493 // copy the changes to the original vectors.
│ │ │ -
494 x = *lhs_->finest();
│ │ │ -
495 b = *rhs_->finest();
│ │ │ -
496 }
│ │ │ -
│ │ │ -
497 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
499 {
│ │ │ -
500 return matrices_->levels();
│ │ │ -
501 }
│ │ │ -
│ │ │ -
502 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
504 {
│ │ │ -
505 return matrices_->maxlevels();
│ │ │ -
506 }
│ │ │ -
│ │ │ -
507
│ │ │ -
509 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
511 {
│ │ │ -
512 LevelContext levelContext;
│ │ │ -
513 // Init all iterators for the current level
│ │ │ -
514 initIteratorsWithFineLevel(levelContext);
│ │ │ -
515
│ │ │ -
516 assert(v.two_norm()==0);
│ │ │ -
517
│ │ │ -
518 level=0;
│ │ │ -
519 if(matrices_->maxlevels()==1){
│ │ │ -
520 // The coarse solver might modify the d!
│ │ │ -
521 Range b(d);
│ │ │ -
522 mgc(levelContext, v, b);
│ │ │ -
523 }else
│ │ │ -
524 mgc(levelContext, v, d);
│ │ │ -
525 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ -
526 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ -
527 }
│ │ │ -
│ │ │ -
528
│ │ │ -
529 template<class M, class X, class PI, class A>
│ │ │ -
530 void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ -
531 {
│ │ │ -
532 levelContext.matrix = matrices_->matrices().finest();
│ │ │ -
533 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ -
534 levelContext.redist =
│ │ │ -
535 matrices_->redistributeInformation().begin();
│ │ │ -
536 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ -
537 levelContext.lhs = lhs_->finest();
│ │ │ -
538 levelContext.residual = residual_->finest();
│ │ │ -
539 levelContext.rhs = rhs_->finest();
│ │ │ -
540 levelContext.level=0;
│ │ │ -
541 }
│ │ │ -
542
│ │ │ -
543 template<class M, class X, class PI, class A>
│ │ │ -
544 bool FastAMG<M,X,PI,A>
│ │ │ -
545 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ -
546 {
│ │ │ -
547 bool processNextLevel=true;
│ │ │ -
548
│ │ │ -
549 if(levelContext.redist->isSetup()) {
│ │ │ -
550 throw "bla";
│ │ │ -
551 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
│ │ │ -
552 levelContext.residual.getRedistributed());
│ │ │ -
553 processNextLevel = levelContext.residual.getRedistributed().size()>0;
│ │ │ -
554 if(processNextLevel) {
│ │ │ -
555 //restrict defect to coarse level right hand side.
│ │ │ -
556 ++levelContext.pinfo;
│ │ │ -
557 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ -
558 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ -
559 static_cast<const Range&>(levelContext.residual.getRedistributed()),
│ │ │ -
560 *levelContext.pinfo);
│ │ │ -
561 }
│ │ │ -
562 }else{
│ │ │ -
563 //restrict defect to coarse level right hand side.
│ │ │ -
564 ++levelContext.rhs;
│ │ │ -
565 ++levelContext.pinfo;
│ │ │ -
566 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ -
567 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ -
568 static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
│ │ │ -
569 }
│ │ │ -
570
│ │ │ -
571 if(processNextLevel) {
│ │ │ -
572 // prepare coarse system
│ │ │ -
573 ++levelContext.residual;
│ │ │ -
574 ++levelContext.lhs;
│ │ │ -
575 ++levelContext.matrix;
│ │ │ -
576 ++levelContext.level;
│ │ │ -
577 ++levelContext.redist;
│ │ │ -
578
│ │ │ -
579 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ -
580 // next level is not the globally coarsest one
│ │ │ -
581 ++levelContext.aggregates;
│ │ │ -
582 }
│ │ │ -
583 // prepare the lhs on the next level
│ │ │ -
584 *levelContext.lhs=0;
│ │ │ -
585 *levelContext.residual=0;
│ │ │ -
586 }
│ │ │ -
587 return processNextLevel;
│ │ │ -
588 }
│ │ │ -
589
│ │ │ -
590 template<class M, class X, class PI, class A>
│ │ │ -
591 void FastAMG<M,X,PI,A>
│ │ │ -
592 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
│ │ │ -
593 {
│ │ │ -
594 if(processNextLevel) {
│ │ │ -
595 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ -
596 // previous level is not the globally coarsest one
│ │ │ -
597 --levelContext.aggregates;
│ │ │ -
598 }
│ │ │ -
599 --levelContext.redist;
│ │ │ -
600 --levelContext.level;
│ │ │ -
601 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ -
602 --levelContext.matrix;
│ │ │ -
603 --levelContext.residual;
│ │ │ -
604
│ │ │ -
605 }
│ │ │ -
606
│ │ │ -
607 typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
│ │ │ -
608 if(levelContext.redist->isSetup()) {
│ │ │ -
609
│ │ │ -
610 // Need to redistribute during prolongate
│ │ │ -
611 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ -
612 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ -
613 levelContext.lhs.getRedistributed(),
│ │ │ -
614 matrices_->getProlongationDampingFactor(),
│ │ │ -
615 *levelContext.pinfo, *levelContext.redist);
│ │ │ -
616 }else{
│ │ │ -
617 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ -
618 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ -
619 matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
│ │ │ -
620
│ │ │ -
621 // printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
│ │ │ -
622 }
│ │ │ -
623
│ │ │ -
624
│ │ │ -
625 if(processNextLevel) {
│ │ │ -
626 --levelContext.rhs;
│ │ │ -
627 }
│ │ │ -
628
│ │ │ -
629 }
│ │ │ -
630
│ │ │ -
631
│ │ │ -
632 template<class M, class X, class PI, class A>
│ │ │ -
633 void FastAMG<M,X,PI,A>
│ │ │ -
634 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ -
635 {
│ │ │ -
636 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ -
637 GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
│ │ │ -
638 x,
│ │ │ -
639 *levelContext.residual,
│ │ │ -
640 b);
│ │ │ -
641 }
│ │ │ -
642
│ │ │ -
643 template<class M, class X, class PI, class A>
│ │ │ -
644 void FastAMG<M,X,PI,A>
│ │ │ -
645 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ -
646 {
│ │ │ -
647 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ -
648 GaussSeidelPostsmoothDefect<bl>
│ │ │ -
649 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
│ │ │ -
650 }
│ │ │ -
651
│ │ │ -
652
│ │ │ -
653 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
655 {
│ │ │ - │ │ │ -
657 }
│ │ │ -
│ │ │ -
658
│ │ │ -
659 template<class M, class X, class PI, class A>
│ │ │ -
660 void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
│ │ │ -
661
│ │ │ -
662 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ -
663 // Solve directly
│ │ │ - │ │ │ -
665 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ -
666 if(levelContext.redist->isSetup()) {
│ │ │ -
667 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
│ │ │ -
668 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ -
669 // We are still participating in the computation
│ │ │ -
670 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ -
671 levelContext.rhs.getRedistributed());
│ │ │ -
672 solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
│ │ │ -
673 }
│ │ │ -
674 levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
│ │ │ -
675 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ -
676 }else{
│ │ │ -
677 levelContext.pinfo->copyOwnerToAll(b, b);
│ │ │ -
678 solver_->apply(v, const_cast<Range&>(b), res);
│ │ │ -
679 }
│ │ │ -
680
│ │ │ -
681 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
│ │ │ -
682 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
│ │ │ -
683 if (!res.converged)
│ │ │ -
684 coarsesolverconverged = false;
│ │ │ -
685 }else{
│ │ │ -
686 // presmoothing
│ │ │ -
687 presmooth(levelContext, v, b);
│ │ │ -
688 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
│ │ │ -
689 // printvector(std::cout, *residual, "post presmooth residual", "r", 10);
│ │ │ -
690#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ -
691 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ -
692
│ │ │ -
693 if(processNextLevel) {
│ │ │ -
694 // next level
│ │ │ -
695 for(std::size_t i=0; i<gamma_; i++)
│ │ │ -
696 mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
│ │ │ -
697 }
│ │ │ -
698
│ │ │ -
699 moveToFineLevel(levelContext, processNextLevel, v);
│ │ │ -
700#else
│ │ │ -
701 *lhs=0;
│ │ │ -
702#endif
│ │ │ -
703
│ │ │ -
704 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ -
705 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ -
706 if(!coarsesolverconverged)
│ │ │ -
707 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ -
708 }
│ │ │ -
709
│ │ │ -
710 postsmooth(levelContext, v, b);
│ │ │ -
711 }
│ │ │ -
712 }
│ │ │ -
713
│ │ │ -
714
│ │ │ -
716 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ -
717 void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ -
718 {
│ │ │ -
719 lhs_=nullptr;
│ │ │ -
720 rhs_=nullptr;
│ │ │ -
721 residual_=nullptr;
│ │ │ -
722 }
│ │ │ -
│ │ │ -
723
│ │ │ -
724 template<class M, class X, class PI, class A>
│ │ │ -
725 template<class A1>
│ │ │ -
│ │ │ -
726 void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ -
727 {
│ │ │ -
728 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ -
729 }
│ │ │ -
│ │ │ -
730
│ │ │ -
731 } // end namespace Amg
│ │ │ -
732} // end namespace Dune
│ │ │ -
733
│ │ │ -
734#endif
│ │ │ -
Classes for using SuperLU with ISTL matrices.
│ │ │ -
Classes for using UMFPack with ISTL matrices.
│ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
Define base class for scalar product and norm.
│ │ │ -
Define general preconditioner interface.
│ │ │ -
Prolongation and restriction for amg.
│ │ │ -
Classes for the generic construction and application of the smoothers.
│ │ │ -
Provides a classes representing the hierarchies in AMG.
│ │ │ - │ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ -
Col col
Definition matrixmatrix.hh:351
│ │ │ -
Matrix & mat
Definition matrixmatrix.hh:347
│ │ │ -
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ -
static std::shared_ptr< T > construct(Arguments &args)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
int iterations
The number of iterations to perform.
Definition smoother.hh:47
│ │ │ -
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition fastamg.hh:207
│ │ │ -
void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont)
Get the aggregate number of each unknown on the coarsest level.
Definition fastamg.hh:726
│ │ │ -
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition fastamg.hh:211
│ │ │ -
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition fastamg.hh:173
│ │ │ -
void post(Domain &x)
Clean up.
Definition fastamg.hh:717
│ │ │ -
std::size_t maxlevels()
Definition fastamg.hh:503
│ │ │ -
X Domain
The domain type.
Definition fastamg.hh:77
│ │ │ -
Hierarchy< Domain, A >::Iterator residual
The iterator over the residuals.
Definition fastamg.hh:227
│ │ │ -
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category)
Definition fastamg.hh:146
│ │ │ -
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition fastamg.hh:72
│ │ │ -
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition fastamg.hh:215
│ │ │ -
X Range
The range type.
Definition fastamg.hh:79
│ │ │ -
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition fastamg.hh:70
│ │ │ -
M Operator
The matrix operator type.
Definition fastamg.hh:63
│ │ │ -
std::size_t levels()
Definition fastamg.hh:498
│ │ │ -
FastAMG(const Operator &fineOperator, const C &criterion, const Parameters &parms=Parameters(), bool symmetric=true, const ParallelInformation &pinfo=ParallelInformation())
Construct an AMG with an inexact coarse solver based on the smoother.
Definition fastamg.hh:125
│ │ │ -
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition fastamg.hh:81
│ │ │ -
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition fastamg.hh:654
│ │ │ -
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition fastamg.hh:223
│ │ │ -
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition fastamg.hh:231
│ │ │ -
std::size_t level
The level index.
Definition fastamg.hh:235
│ │ │ -
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition fastamg.hh:510
│ │ │ -
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition fastamg.hh:74
│ │ │ -
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition fastamg.hh:449
│ │ │ -
FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const Parameters &parms, bool symmetric=true)
Construct a new amg with a specific coarse solver.
Definition fastamg.hh:320
│ │ │ -
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition fastamg.hh:219
│ │ │ +
163 // solve D w = v, note: diagonal stores Dii^{-1}
│ │ │ +
164 if( isLowerTriangular )
│ │ │ +
165 {
│ │ │ +
166 // The matrix is lower triangular, so the diagonal entry is the
│ │ │ +
167 // last one in each row.
│ │ │ +
168 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ +
169 {
│ │ │ +
170 const auto &A_i = *i;
│ │ │ +
171 const auto ii = A_i.beforeEnd();
│ │ │ +
172 assert( ii.index() == i.index() );
│ │ │ +
173 // We need to be careful here: Directly using
│ │ │ +
174 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ +
175 // is not OK in case this is a proxy. Hence
│ │ │ +
176 // we first have to copy the value. Notice that
│ │ │ +
177 // this is still not OK, if the vector type itself returns
│ │ │ +
178 // proxy references.
│ │ │ +
179 auto rhsValue = v[ i.index() ];
│ │ │ +
180 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ +
181 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ +
182 Impl::asMatrix(*ii).mv(rhs, vi);
│ │ │ +
183 }
│ │ │ +
184 }
│ │ │ +
185 else
│ │ │ +
186 {
│ │ │ +
187 // Without assumptions on the sparsity pattern we have to search
│ │ │ +
188 // for the diagonal entry in each row.
│ │ │ +
189 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ +
190 {
│ │ │ +
191 const auto &A_i = *i;
│ │ │ +
192 const auto ii = A_i.find( i.index() );
│ │ │ +
193 assert( ii.index() == i.index() );
│ │ │ +
194 // We need to be careful here: Directly using
│ │ │ +
195 // auto rhs = Impl::asVector(v[ i.index() ]);
│ │ │ +
196 // is not OK in case this is a proxy. Hence
│ │ │ +
197 // we first have to copy the value. Notice that
│ │ │ +
198 // this is still not OK, if the vector type itself returns
│ │ │ +
199 // proxy references.
│ │ │ +
200 auto rhsValue = v[ i.index() ];
│ │ │ +
201 auto&& rhs = Impl::asVector(rhsValue);
│ │ │ +
202 auto&& vi = Impl::asVector( v[ i.index() ] );
│ │ │ +
203 Impl::asMatrix(*ii).mv(rhs, vi);
│ │ │ +
204 }
│ │ │ +
205 }
│ │ │ +
206
│ │ │ +
207 // solve L^T v = w, note: only L is stored
│ │ │ +
208 // note: we perform the operation column-wise from right to left
│ │ │ +
209 for( auto i = A.beforeEnd(), iend = A.beforeBegin(); i != iend; --i )
│ │ │ +
210 {
│ │ │ +
211 const auto &A_i = *i;
│ │ │ +
212 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij )
│ │ │ +
213 {
│ │ │ +
214 auto&& vij = Impl::asVector( v[ ij.index() ] );
│ │ │ +
215 Impl::asMatrix(*ij).mmtv(Impl::asVector( v[ i.index() ] ), vij);
│ │ │ +
216 }
│ │ │ +
217 }
│ │ │ +
218 }
│ │ │ +
│ │ │ +
219
│ │ │ +
220} // namespace Dune
│ │ │ +
221
│ │ │ +
222#endif // #ifndef DUNE_ISTL_ILDL_HH
│ │ │ +
The incomplete LU factorization kernels.
│ │ │
Definition allocator.hh:11
│ │ │ -
ConstIterator class for sequential access.
Definition matrix.hh:404
│ │ │ +
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition ildl.hh:88
│ │ │ +
void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool isLowerTriangular=false)
Definition ildl.hh:149
│ │ │ +
static void bildl_subtractBCT(const FieldMatrix< K, m, n > &B, const FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A)
Definition ildl.hh:24
│ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ +
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ -
typename Imp::BlockTraits< T >::field_type field_type
Export the type representing the underlying field.
Definition matrix.hh:565
│ │ │ -
row_type::const_iterator ConstColIterator
Const iterator for the entries of each row.
Definition matrix.hh:589
│ │ │ -
T block_type
Export the type representing the components.
Definition matrix.hh:568
│ │ │ -
A fast (sequential) algebraic multigrid based on agglomeration that saves memory bandwidth.
Definition fastamg.hh:60
│ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:19
│ │ │ - │ │ │ -
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:216
│ │ │ -
Iterator over the levels in the hierarchy.
Definition hierarchy.hh:120
│ │ │ -
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ -
All parameters for AMG.
Definition parameters.hh:416
│ │ │ -
The default class for the smoother arguments.
Definition smoother.hh:38
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
Sequential SSOR preconditioner.
Definition preconditioners.hh:142
│ │ │ -
Base class for scalar product and norm computation.
Definition scalarproducts.hh:52
│ │ │ -
Statistics about the application of an inverse operator.
Definition solver.hh:50
│ │ │ -
bool converged
True if convergence criterion has been met.
Definition solver.hh:75
│ │ │ -
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
Definition solvertype.hh:16
│ │ │ +
RowIterator beforeBegin()
Definition matrix.hh:630
│ │ │ +
RowIterator beforeEnd()
Definition matrix.hh:623
│ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:616
│ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:610
│ │ │ +
Definition matrixutils.hh:27
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,841 +1,266 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -fastamg.hh │ │ │ │ +ildl.hh │ │ │ │ _G_o_ _t_o_ _t_h_e_ _d_o_c_u_m_e_n_t_a_t_i_o_n_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ 1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file │ │ │ │ LICENSE.md in module root │ │ │ │ 2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception │ │ │ │ -3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- │ │ │ │ -4// vi: set et ts=4 sw=2 sts=2: │ │ │ │ -5#ifndef DUNE_ISTL_FASTAMG_HH │ │ │ │ -6#define DUNE_ISTL_FASTAMG_HH │ │ │ │ -7 │ │ │ │ -8#include │ │ │ │ -9#include │ │ │ │ -10#include │ │ │ │ -11#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_s_m_o_o_t_h_e_r_._h_h> │ │ │ │ -12#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_t_r_a_n_s_f_e_r_._h_h> │ │ │ │ -13#include <_d_u_n_e_/_i_s_t_l_/_p_a_a_m_g_/_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h> │ │ │ │ -14#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -15#include <_d_u_n_e_/_i_s_t_l_/_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h> │ │ │ │ -16#include <_d_u_n_e_/_i_s_t_l_/_s_u_p_e_r_l_u_._h_h> │ │ │ │ -17#include <_d_u_n_e_/_i_s_t_l_/_u_m_f_p_a_c_k_._h_h> │ │ │ │ -18#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -19#include <_d_u_n_e_/_i_s_t_l_/_i_o_._h_h> │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h> │ │ │ │ -21 │ │ │ │ -22#include "_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h" │ │ │ │ -23 │ │ │ │ -32namespace _D_u_n_e │ │ │ │ -33{ │ │ │ │ -34 namespace Amg │ │ │ │ -35 { │ │ │ │ -58 template > │ │ │ │ -_5_9 class _F_a_s_t_A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +3#ifndef DUNE_ISTL_ILDL_HH │ │ │ │ +4#define DUNE_ISTL_ILDL_HH │ │ │ │ +5 │ │ │ │ +6#include │ │ │ │ +7#include │ │ │ │ +8#include "_i_l_u_._h_h" │ │ │ │ +9 │ │ │ │ +17namespace _D_u_n_e │ │ │ │ +18{ │ │ │ │ +19 │ │ │ │ +20 // bildl_subtractBCT │ │ │ │ +21 // ----------------- │ │ │ │ +22 │ │ │ │ +23 template< class K, int m, int n > │ │ │ │ +_2_4 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &B, │ │ │ │ +const _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &CT, _F_i_e_l_d_M_a_t_r_i_x_<_ _K_,_ _m_,_ _n_ _> &A ) │ │ │ │ +25 { │ │ │ │ +26 for( int i = 0; i < m; ++i ) │ │ │ │ +27 { │ │ │ │ +28 for( int j = 0; j < n; ++j ) │ │ │ │ +29 { │ │ │ │ +30 for( int k = 0; k < n; ++k ) │ │ │ │ +31 A[ i ][ j ] -= B[ i ][ k ] * CT[ j ][ k ]; │ │ │ │ +32 } │ │ │ │ +33 } │ │ │ │ +34 } │ │ │ │ +35 │ │ │ │ +36 template< class K > │ │ │ │ +_3_7 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const K &B, const K &CT, K &A, │ │ │ │ +38 typename std::enable_if_t::value>* sfinae = nullptr ) │ │ │ │ +39 { │ │ │ │ +40 A -= B * CT; │ │ │ │ +41 } │ │ │ │ +42 │ │ │ │ +43 template< class Matrix > │ │ │ │ +_4_4 inline static void _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T ( const _M_a_t_r_i_x &B, const _M_a_t_r_i_x &CT, │ │ │ │ +_M_a_t_r_i_x &A, │ │ │ │ +45 typename std::enable_if_t::value>* sfinae = nullptr │ │ │ │ +) │ │ │ │ +46 { │ │ │ │ +47 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ +48 { │ │ │ │ +49 auto &&A_i = *i; │ │ │ │ +50 auto &&B_i = B[ i.index() ]; │ │ │ │ +51 const auto ikend = B_i._e_n_d(); │ │ │ │ +52 for( auto j = A_i.begin(), jend = A_i.end(); j != jend; ++j ) │ │ │ │ +53 { │ │ │ │ +54 auto &&A_ij = *j; │ │ │ │ +55 auto &&CT_j = CT[ j.index() ]; │ │ │ │ +56 const auto jkend = CT_j._e_n_d(); │ │ │ │ +57 for( auto ik = B_i.begin(), jk = CT_j.begin(); (ik != ikend) && (jk != │ │ │ │ +jkend); ) │ │ │ │ +58 { │ │ │ │ +59 if( ik.index() == jk.index() ) │ │ │ │ 60 { │ │ │ │ -61 public: │ │ │ │ -_6_3 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ -_7_0 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ -_7_2 typedef _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y_<_M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_> _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y; │ │ │ │ -_7_4 typedef typename _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ -_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y; │ │ │ │ -75 │ │ │ │ -_7_7 typedef X _D_o_m_a_i_n; │ │ │ │ -_7_9 typedef X _R_a_n_g_e; │ │ │ │ -_8_1 typedef _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_X_,_X_> _C_o_a_r_s_e_S_o_l_v_e_r; │ │ │ │ -82 │ │ │ │ -90 _F_a_s_t_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& coarseSolver, │ │ │ │ -91 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ -92 bool symmetric=true); │ │ │ │ +61 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T( *ik, *jk, A_ij ); │ │ │ │ +62 ++ik; ++jk; │ │ │ │ +63 } │ │ │ │ +64 else if( ik.index() < jk.index() ) │ │ │ │ +65 ++ik; │ │ │ │ +66 else │ │ │ │ +67 ++jk; │ │ │ │ +68 } │ │ │ │ +69 } │ │ │ │ +70 } │ │ │ │ +71 } │ │ │ │ +72 │ │ │ │ +73 │ │ │ │ +74 │ │ │ │ +75 // bildl_decompose │ │ │ │ +76 // --------------- │ │ │ │ +77 │ │ │ │ +87 template< class Matrix > │ │ │ │ +_8_8 inline void _b_i_l_d_l___d_e_c_o_m_p_o_s_e ( _M_a_t_r_i_x &A ) │ │ │ │ +89 { │ │ │ │ +90 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ +91 { │ │ │ │ +92 auto &&A_i = *i; │ │ │ │ 93 │ │ │ │ -105 template │ │ │ │ -106 _F_a_s_t_A_M_G(std::shared_ptr fineOperator, │ │ │ │ -107 const C& criterion, │ │ │ │ -108 const _P_a_r_a_m_e_t_e_r_s& parms=_P_a_r_a_m_e_t_e_r_s(), │ │ │ │ -109 bool symmetric=true, │ │ │ │ -110 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()); │ │ │ │ -111 │ │ │ │ -124 template │ │ │ │ -_1_2_5 _F_a_s_t_A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, │ │ │ │ -126 const C& criterion, │ │ │ │ -127 const _P_a_r_a_m_e_t_e_r_s& parms=_P_a_r_a_m_e_t_e_r_s(), │ │ │ │ -128 bool symmetric=true, │ │ │ │ -129 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo=_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n()) │ │ │ │ -130 : _F_a_s_t_A_M_G(stackobject_to_shared_ptr(fineOperator), │ │ │ │ -131 criterion, parms, symmetric, pinfo) │ │ │ │ -132 {} │ │ │ │ -133 │ │ │ │ -137 _F_a_s_t_A_M_G(const _F_a_s_t_A_M_G& amg); │ │ │ │ -138 │ │ │ │ -140 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ -141 │ │ │ │ -143 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ +94 auto ij = A_i.begin(); │ │ │ │ +95 for( ; ij.index() < i.index(); ++ij ) │ │ │ │ +96 { │ │ │ │ +97 auto &&A_ij = *ij; │ │ │ │ +98 auto &&A_j = A[ ij.index() ]; │ │ │ │ +99 │ │ │ │ +100 // store L_ij Dj in A_ij (note: for k < i: A_kj = L_kj) │ │ │ │ +101 // L_ij Dj = A_ij - \sum_{k < j} (L_ik D_k) L_jk^T │ │ │ │ +102 auto ik = A_i._b_e_g_i_n(); │ │ │ │ +103 auto jk = A_j.begin(); │ │ │ │ +104 while( (ik != ij) && (jk.index() < ij.index()) ) │ │ │ │ +105 { │ │ │ │ +106 if( ik.index() == jk.index() ) │ │ │ │ +107 { │ │ │ │ +108 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T(*ik, *jk, A_ij); │ │ │ │ +109 ++ik; ++jk; │ │ │ │ +110 } │ │ │ │ +111 else if( ik.index() < jk.index() ) │ │ │ │ +112 ++ik; │ │ │ │ +113 else │ │ │ │ +114 ++jk; │ │ │ │ +115 } │ │ │ │ +116 } │ │ │ │ +117 │ │ │ │ +118 if( ij.index() != i.index() ) │ │ │ │ +119 DUNE_THROW( _I_S_T_L_E_r_r_o_r, "diagonal entry missing" ); │ │ │ │ +120 │ │ │ │ +121 // update diagonal and multiply A_ij by D_j^{-1} │ │ │ │ +122 auto &&A_ii = *ij; │ │ │ │ +123 for( auto ik = A_i.begin(); ik != ij; ++ik ) │ │ │ │ +124 { │ │ │ │ +125 auto &&A_ik = *ik; │ │ │ │ +126 const auto &A_k = A[ ik.index() ]; │ │ │ │ +127 │ │ │ │ +128 auto B = A_ik; │ │ │ │ +129 Impl::asMatrix(A_ik).rightmultiply( Impl::asMatrix(*A_k.find( ik.index() )) │ │ │ │ +); │ │ │ │ +130 _b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T( B, A_ik, A_ii ); │ │ │ │ +131 } │ │ │ │ +132 try │ │ │ │ +133 { │ │ │ │ +134 Impl::asMatrix(A_ii).invert(); │ │ │ │ +135 } │ │ │ │ +136 catch( const Dune::FMatrixError &e ) │ │ │ │ +137 { │ │ │ │ +138 DUNE_THROW( _M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r, "ILDL failed to invert matrix block A[" << │ │ │ │ +i.index() << "][" << ij.index() << "]" << e.what(); th__ex.r = i.index(); │ │ │ │ +th__ex.c = ij.index() ); │ │ │ │ +139 } │ │ │ │ +140 } │ │ │ │ +141 } │ │ │ │ +142 │ │ │ │ +143 │ │ │ │ 144 │ │ │ │ -_1_4_6 virtual _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y _c_a_t_e_g_o_r_y() const │ │ │ │ -147 { │ │ │ │ -148 return _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l; │ │ │ │ -149 } │ │ │ │ -150 │ │ │ │ -152 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ -153 │ │ │ │ -158 template │ │ │ │ -159 void _g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont); │ │ │ │ -160 │ │ │ │ -161 std::size_t _l_e_v_e_l_s(); │ │ │ │ +145 // bildl_backsolve │ │ │ │ +146 // --------------- │ │ │ │ +147 │ │ │ │ +148 template< class Matrix, class X, class Y > │ │ │ │ +_1_4_9 inline void _b_i_l_d_l___b_a_c_k_s_o_l_v_e ( const _M_a_t_r_i_x &A, X &v, const Y &d, bool │ │ │ │ +isLowerTriangular = false ) │ │ │ │ +150 { │ │ │ │ +151 // solve L v = d, note: Lii = I │ │ │ │ +152 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ +153 { │ │ │ │ +154 const auto &A_i = *i; │ │ │ │ +155 v[ i.index() ] = d[ i.index() ]; │ │ │ │ +156 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij ) │ │ │ │ +157 { │ │ │ │ +158 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ +159 Impl::asMatrix(*ij).mmv(Impl::asVector( v[ ij.index() ] ), vi); │ │ │ │ +160 } │ │ │ │ +161 } │ │ │ │ 162 │ │ │ │ -163 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ -164 │ │ │ │ -_1_7_3 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ -174 { │ │ │ │ -175 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ -176 } │ │ │ │ -177 │ │ │ │ -182 bool _u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const; │ │ │ │ -183 │ │ │ │ -184 private: │ │ │ │ -191 template │ │ │ │ -192 void createHierarchies(C& criterion, │ │ │ │ -193 std::shared_ptr fineOperator, │ │ │ │ -194 const PI& pinfo); │ │ │ │ -195 │ │ │ │ -202 struct LevelContext │ │ │ │ -203 { │ │ │ │ -_2_0_7 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ -_2_1_1 typename _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y_:_:_I_t_e_r_a_t_o_r _p_i_n_f_o; │ │ │ │ -_2_1_5 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ -_2_1_9 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ -_2_2_3 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _l_h_s; │ │ │ │ -_2_2_7 typename _H_i_e_r_a_r_c_h_y_<_D_o_m_a_i_n_,_A_>_:_:_I_t_e_r_a_t_o_r _r_e_s_i_d_u_a_l; │ │ │ │ -_2_3_1 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r _r_h_s; │ │ │ │ -_2_3_5 std::size_t _l_e_v_e_l; │ │ │ │ -236 }; │ │ │ │ -237 │ │ │ │ -239 void mgc(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ -240 │ │ │ │ -247 void presmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ -248 │ │ │ │ -255 void postsmooth(LevelContext& levelContext, _D_o_m_a_i_n& x, const _R_a_n_g_e& b); │ │ │ │ -256 │ │ │ │ -263 void moveToFineLevel(LevelContext& levelContext, bool processedFineLevel, │ │ │ │ -264 _D_o_m_a_i_n& fineX); │ │ │ │ -265 │ │ │ │ -270 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ -271 │ │ │ │ -276 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ -277 │ │ │ │ -279 std::shared_ptr matrices_; │ │ │ │ -281 std::shared_ptr solver_; │ │ │ │ -283 std::shared_ptr> rhs_; │ │ │ │ -285 std::shared_ptr> lhs_; │ │ │ │ -287 std::shared_ptr> residual_; │ │ │ │ -288 │ │ │ │ -290 using _S_c_a_l_a_r_P_r_o_d_u_c_t = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ -292 std::shared_ptr scalarProduct_; │ │ │ │ -294 std::size_t gamma_; │ │ │ │ -296 std::size_t preSteps_; │ │ │ │ -298 std::size_t postSteps_; │ │ │ │ -299 std::size_t level; │ │ │ │ -300 bool buildHierarchy_; │ │ │ │ -301 bool symmetric; │ │ │ │ -302 bool coarsesolverconverged; │ │ │ │ -303 typedef _S_e_q_S_S_O_R_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_X_,_X_> _S_m_o_o_t_h_e_r; │ │ │ │ -304 typedef std::shared_ptr SmootherPointer; │ │ │ │ -305 SmootherPointer coarseSmoother_; │ │ │ │ -307 std::size_t verbosity_; │ │ │ │ -308 }; │ │ │ │ -309 │ │ │ │ -310 template │ │ │ │ -_3_1_1 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(const _F_a_s_t_A_M_G& amg) │ │ │ │ -312 : matrices_(amg.matrices_), solver_(amg.solver_), │ │ │ │ -313 rhs_(), lhs_(), residual_(), scalarProduct_(amg.scalarProduct_), │ │ │ │ -314 gamma_(amg.gamma_), preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ -315 symmetric(amg.symmetric), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ -316 coarseSmoother_(amg.coarseSmoother_), verbosity_(amg.verbosity_) │ │ │ │ -317 {} │ │ │ │ -318 │ │ │ │ -319 template │ │ │ │ -_3_2_0 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y& matrices, _C_o_a_r_s_e_S_o_l_v_e_r& │ │ │ │ -coarseSolver, │ │ │ │ -321 const _P_a_r_a_m_e_t_e_r_s& parms, bool symmetric_) │ │ │ │ -322 : matrices_(stackobject_to_shared_ptr(matrices)), solver_(&coarseSolver), │ │ │ │ -323 rhs_(), lhs_(), residual_(), scalarProduct_(), │ │ │ │ -324 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ -325 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ -326 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ -327 coarseSmoother_(), verbosity_(parms.debugLevel()) │ │ │ │ -328 { │ │ │ │ -329 if(preSteps_>1||postSteps_>1) │ │ │ │ -330 { │ │ │ │ -331 std::cerr<<"WARNING only one step of smoothing is supported!"<isBuilt()); │ │ │ │ -335 static_assert(std::is_same::value, │ │ │ │ -336 "Currently only sequential runs are supported"); │ │ │ │ -337 } │ │ │ │ -338 template │ │ │ │ -339 template │ │ │ │ -_3_4_0 _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_F_a_s_t_A_M_G(std::shared_ptr fineOperator, │ │ │ │ -341 const C& criterion, │ │ │ │ -342 const _P_a_r_a_m_e_t_e_r_s& parms, │ │ │ │ -343 bool symmetric_, │ │ │ │ -344 const PI& pinfo) │ │ │ │ -345 : solver_(), rhs_(), lhs_(), residual_(), scalarProduct_(), gamma_ │ │ │ │ -(parms.getGamma()), │ │ │ │ -346 preSteps_(parms.getNoPreSmoothSteps()), postSteps_ │ │ │ │ -(parms.getNoPostSmoothSteps()), │ │ │ │ -347 buildHierarchy_(true), │ │ │ │ -348 symmetric(symmetric_), coarsesolverconverged(true), │ │ │ │ -349 coarseSmoother_(), verbosity_(criterion.debugLevel()) │ │ │ │ -350 { │ │ │ │ -351 if(preSteps_>1||postSteps_>1) │ │ │ │ -352 { │ │ │ │ -353 std::cerr<<"WARNING only one step of smoothing is supported!"<::value, │ │ │ │ -357 "Currently only sequential runs are supported"); │ │ │ │ -358 // TODO: reestablish compile time checks. │ │ │ │ -359 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ -category), │ │ │ │ -360 // "Matrix and Solver must match in terms of category!"); │ │ │ │ -361 createHierarchies(criterion, std::move(fineOperator), pinfo); │ │ │ │ -362 } │ │ │ │ -363 │ │ │ │ -364 template │ │ │ │ -365 template │ │ │ │ -366 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_c_r_e_a_t_e_H_i_e_r_a_r_c_h_i_e_s(C& criterion, │ │ │ │ -367 std::shared_ptr fineOperator, │ │ │ │ -368 const PI& pinfo) │ │ │ │ -369 { │ │ │ │ -370 Timer watch; │ │ │ │ -371 matrices_ = std::make_shared( │ │ │ │ -372 std::const_pointer_cast(std::move(fineOperator)), │ │ │ │ -373 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ -374 │ │ │ │ -375 matrices_->template build >(criterion); │ │ │ │ -376 │ │ │ │ -377 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ -().rank()==0) │ │ │ │ -378 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ -"<levels()==matrices_->maxlevels()) { │ │ │ │ -381 // We have the carsest level. Create the coarse Solver │ │ │ │ -382 typedef typename _S_m_o_o_t_h_e_r_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s SmootherArgs; │ │ │ │ -383 SmootherArgs sargs; │ │ │ │ -384 sargs._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ -385 │ │ │ │ -386 typename _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_A_r_g_u_m_e_n_t_s cargs; │ │ │ │ -387 cargs.setArgs(sargs); │ │ │ │ -388 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ -389 // Solve on the redistributed partitioning │ │ │ │ -390 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ -()); │ │ │ │ -391 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ -()); │ │ │ │ -392 }else{ │ │ │ │ -393 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ -394 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ -395 } │ │ │ │ -396 │ │ │ │ -397 coarseSmoother_ = _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_S_m_o_o_t_h_e_r_>_:_:_c_o_n_s_t_r_u_c_t(cargs); │ │ │ │ -398 scalarProduct_ = createScalarProduct(cargs.getComm(),category()); │ │ │ │ -399 │ │ │ │ -400#if HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ -401#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ -402#define DIRECTSOLVER UMFPack │ │ │ │ -403#else │ │ │ │ -404#define DIRECTSOLVER SuperLU │ │ │ │ -405#endif │ │ │ │ -406 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ -the coarsest level. │ │ │ │ -407 if(std::is_same::value / │ │ │ │ -/ sequential mode │ │ │ │ -408 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ -parallel mode and only one processor │ │ │ │ -409 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ -410 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ -().communicator().size()==1 │ │ │ │ -411 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ -().communicator().size()>0)) { // redistribute and 1 proc │ │ │ │ -412 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ ->communicator().rank()==0) │ │ │ │ -413 std::cout<<"Using superlu"<parallelInformation().coarsest().isRedistributed()) │ │ │ │ -415 { │ │ │ │ -416 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ -417 // We are still participating on this level │ │ │ │ -418 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ -().coarsest().getRedistributed().getmat(), false, false)); │ │ │ │ -419 else │ │ │ │ -420 solver_.reset(); │ │ │ │ -421 }else │ │ │ │ -422 solver_.reset(new DIRECTSOLVER(matrices_->matrices │ │ │ │ -().coarsest()->getmat(), false, false)); │ │ │ │ -423 }else │ │ │ │ -424#undef DIRECTSOLVER │ │ │ │ -425#endif // HAVE_SUPERLU|| HAVE_SUITESPARSE_UMFPACK │ │ │ │ -426 { │ │ │ │ -427 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ -428 { │ │ │ │ -429 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ -430 // We are still participating on this level │ │ │ │ -431 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ -().coarsest().getRedistributed()), │ │ │ │ -432 *scalarProduct_, │ │ │ │ -433 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ -434 else │ │ │ │ -435 solver_.reset(); │ │ │ │ -436 }else │ │ │ │ -437 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ -().coarsest()), │ │ │ │ -438 *scalarProduct_, │ │ │ │ -439 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ -440 } │ │ │ │ -441 } │ │ │ │ -442 │ │ │ │ -443 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ -().rank()==0) │ │ │ │ -444 std::cout<<"Building Hierarchy of "<maxlevels()<<" levels took │ │ │ │ -"< │ │ │ │ -_4_4_9 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b) │ │ │ │ -450 { │ │ │ │ -451 Timer watch, watch1; │ │ │ │ -452 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ -453 // zero and set x such that A_dd*x_d=b_d │ │ │ │ -454 // Thus users can be more careless when setting up their linear │ │ │ │ -455 // systems. │ │ │ │ -456 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ -457 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r RowIter; │ │ │ │ -458 typedef typename _M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r ColIter; │ │ │ │ -459 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ -460 Block zero; │ │ │ │ -461 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ -462 │ │ │ │ -463 const _M_a_t_r_i_x& _m_a_t=matrices_->matrices().finest()->getmat(); │ │ │ │ -464 for(RowIter row=_m_a_t.begin(); row!=_m_a_t.end(); ++row) { │ │ │ │ -465 bool isDirichlet = true; │ │ │ │ -466 bool hasDiagonal = false; │ │ │ │ -467 ColIter diag; │ │ │ │ -468 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ -469 if(row.index()==_c_o_l.index()) { │ │ │ │ -470 diag = _c_o_l; │ │ │ │ -471 hasDiagonal = (*_c_o_l != zero); │ │ │ │ -472 }else{ │ │ │ │ -473 if(*_c_o_l!=zero) │ │ │ │ -474 isDirichlet = false; │ │ │ │ -475 } │ │ │ │ -476 } │ │ │ │ -477 if(isDirichlet && hasDiagonal) │ │ │ │ -478 diag->solve(x[row.index()], b[row.index()]); │ │ │ │ -479 } │ │ │ │ -480 if (verbosity_>0) │ │ │ │ -481 std::cout<<" Preprocessing Dirichlet took "<parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ -485 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ -486 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ -487 residual_ = std::make_shared>(std::make_shared │ │ │ │ -(x)); │ │ │ │ -488 matrices_->coarsenVector(*rhs_); │ │ │ │ -489 matrices_->coarsenVector(*lhs_); │ │ │ │ -490 matrices_->coarsenVector(*residual_); │ │ │ │ -491 │ │ │ │ -492 // The preconditioner might change x and b. So we have to │ │ │ │ -493 // copy the changes to the original vectors. │ │ │ │ -494 x = *lhs_->finest(); │ │ │ │ -495 b = *rhs_->finest(); │ │ │ │ -496 } │ │ │ │ -497 template │ │ │ │ -_4_9_8 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ -499 { │ │ │ │ -500 return matrices_->levels(); │ │ │ │ -501 } │ │ │ │ -502 template │ │ │ │ -_5_0_3 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ -504 { │ │ │ │ -505 return matrices_->maxlevels(); │ │ │ │ -506 } │ │ │ │ -507 │ │ │ │ -509 template │ │ │ │ -_5_1_0 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d) │ │ │ │ -511 { │ │ │ │ -512 LevelContext levelContext; │ │ │ │ -513 // Init all iterators for the current level │ │ │ │ -514 initIteratorsWithFineLevel(levelContext); │ │ │ │ -515 │ │ │ │ -516 assert(v.two_norm()==0); │ │ │ │ -517 │ │ │ │ -518 level=0; │ │ │ │ -519 if(matrices_->maxlevels()==1){ │ │ │ │ -520 // The coarse solver might modify the d! │ │ │ │ -521 _R_a_n_g_e b(d); │ │ │ │ -522 mgc(levelContext, v, b); │ │ │ │ -523 }else │ │ │ │ -524 mgc(levelContext, v, d); │ │ │ │ -525 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ -526 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ -527 } │ │ │ │ -528 │ │ │ │ -529 template │ │ │ │ -530 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_i_n_i_t_I_t_e_r_a_t_o_r_s_W_i_t_h_F_i_n_e_L_e_v_e_l(LevelContext& │ │ │ │ -levelContext) │ │ │ │ -531 { │ │ │ │ -532 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ -533 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ -534 levelContext.redist = │ │ │ │ -535 matrices_->redistributeInformation().begin(); │ │ │ │ -536 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ -537 levelContext.lhs = lhs_->finest(); │ │ │ │ -538 levelContext.residual = residual_->finest(); │ │ │ │ -539 levelContext.rhs = rhs_->finest(); │ │ │ │ -540 levelContext.level=0; │ │ │ │ -541 } │ │ │ │ -542 │ │ │ │ -543 template │ │ │ │ -544 bool FastAMG │ │ │ │ -545 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ -546 { │ │ │ │ -547 bool processNextLevel=true; │ │ │ │ -548 │ │ │ │ -549 if(levelContext.redist->isSetup()) { │ │ │ │ -550 throw "bla"; │ │ │ │ -551 levelContext.redist->redistribute(static_cast │ │ │ │ -(*levelContext.residual), │ │ │ │ -552 levelContext.residual.getRedistributed()); │ │ │ │ -553 processNextLevel = levelContext.residual.getRedistributed().size()>0; │ │ │ │ -554 if(processNextLevel) { │ │ │ │ -555 //restrict defect to coarse level right hand side. │ │ │ │ -556 ++levelContext.pinfo; │ │ │ │ -557 Transfer │ │ │ │ -558 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ -559 static_cast(levelContext.residual.getRedistributed()), │ │ │ │ -560 *levelContext.pinfo); │ │ │ │ -561 } │ │ │ │ -562 }else{ │ │ │ │ -563 //restrict defect to coarse level right hand side. │ │ │ │ -564 ++levelContext.rhs; │ │ │ │ -565 ++levelContext.pinfo; │ │ │ │ -566 Transfer │ │ │ │ -567 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ -568 static_cast(*levelContext.residual), *levelContext.pinfo); │ │ │ │ -569 } │ │ │ │ -570 │ │ │ │ -571 if(processNextLevel) { │ │ │ │ -572 // prepare coarse system │ │ │ │ -573 ++levelContext.residual; │ │ │ │ -574 ++levelContext.lhs; │ │ │ │ -575 ++levelContext.matrix; │ │ │ │ -576 ++levelContext.level; │ │ │ │ -577 ++levelContext.redist; │ │ │ │ -578 │ │ │ │ -579 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ ->levels()maxlevels()) { │ │ │ │ -580 // next level is not the globally coarsest one │ │ │ │ -581 ++levelContext.aggregates; │ │ │ │ -582 } │ │ │ │ -583 // prepare the lhs on the next level │ │ │ │ -584 *levelContext.lhs=0; │ │ │ │ -585 *levelContext.residual=0; │ │ │ │ -586 } │ │ │ │ -587 return processNextLevel; │ │ │ │ -588 } │ │ │ │ -589 │ │ │ │ -590 template │ │ │ │ -591 void FastAMG │ │ │ │ -592 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, │ │ │ │ -Domain& x) │ │ │ │ -593 { │ │ │ │ -594 if(processNextLevel) { │ │ │ │ -595 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ ->levels()maxlevels()) { │ │ │ │ -596 // previous level is not the globally coarsest one │ │ │ │ -597 --levelContext.aggregates; │ │ │ │ -598 } │ │ │ │ -599 --levelContext.redist; │ │ │ │ -600 --levelContext.level; │ │ │ │ -601 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ -602 --levelContext.matrix; │ │ │ │ -603 --levelContext.residual; │ │ │ │ -604 │ │ │ │ -605 } │ │ │ │ -606 │ │ │ │ -607 typename Hierarchy::Iterator coarseLhs = levelContext.lhs--; │ │ │ │ -608 if(levelContext.redist->isSetup()) { │ │ │ │ -609 │ │ │ │ -610 // Need to redistribute during prolongate │ │ │ │ -611 Transfer │ │ │ │ -612 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ -613 levelContext.lhs.getRedistributed(), │ │ │ │ -614 matrices_->getProlongationDampingFactor(), │ │ │ │ -615 *levelContext.pinfo, *levelContext.redist); │ │ │ │ -616 }else{ │ │ │ │ -617 Transfer │ │ │ │ -618 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ -619 matrices_->getProlongationDampingFactor(), *levelContext.pinfo); │ │ │ │ -620 │ │ │ │ -621 // printvector(std::cout, *lhs, "prolongated coarse grid correction", │ │ │ │ -"lhs", 10, 10, 10); │ │ │ │ -622 } │ │ │ │ -623 │ │ │ │ -624 │ │ │ │ -625 if(processNextLevel) { │ │ │ │ -626 --levelContext.rhs; │ │ │ │ -627 } │ │ │ │ -628 │ │ │ │ -629 } │ │ │ │ -630 │ │ │ │ -631 │ │ │ │ -632 template │ │ │ │ -633 void FastAMG │ │ │ │ -634 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ -635 { │ │ │ │ -636 constexpr auto bl = blockLevel(); │ │ │ │ -637 _G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_<_b_l_>_:_:_a_p_p_l_y(levelContext.matrix->getmat(), │ │ │ │ -638 x, │ │ │ │ -639 *levelContext.residual, │ │ │ │ -640 b); │ │ │ │ -641 } │ │ │ │ -642 │ │ │ │ -643 template │ │ │ │ -644 void FastAMG │ │ │ │ -645 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ -646 { │ │ │ │ -647 constexpr auto bl = blockLevel(); │ │ │ │ -648 GaussSeidelPostsmoothDefect │ │ │ │ -649 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b); │ │ │ │ -650 } │ │ │ │ -651 │ │ │ │ -652 │ │ │ │ -653 template │ │ │ │ -_6_5_4 bool _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r() const │ │ │ │ -655 { │ │ │ │ -656 return _I_s_D_i_r_e_c_t_S_o_l_v_e_r_<_ _C_o_a_r_s_e_S_o_l_v_e_r_>_:_:_v_a_l_u_e; │ │ │ │ -657 } │ │ │ │ -658 │ │ │ │ -659 template │ │ │ │ -660 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_g_c(LevelContext& levelContext, Domain& v, const │ │ │ │ -Range& b){ │ │ │ │ -661 │ │ │ │ -662 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ -()==maxlevels()) { │ │ │ │ -663 // Solve directly │ │ │ │ -664 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ -665 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ -666 if(levelContext.redist->isSetup()) { │ │ │ │ -667 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed()); │ │ │ │ -668 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ -669 // We are still participating in the computation │ │ │ │ -670 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ -(levelContext.rhs.getRedistributed(), │ │ │ │ -671 levelContext.rhs.getRedistributed()); │ │ │ │ -672 solver_->apply(levelContext.lhs.getRedistributed(), │ │ │ │ -levelContext.rhs.getRedistributed(), res); │ │ │ │ -673 } │ │ │ │ -674 levelContext.redist->redistributeBackward(v, │ │ │ │ -levelContext.lhs.getRedistributed()); │ │ │ │ -675 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ -676 }else{ │ │ │ │ -677 levelContext.pinfo->copyOwnerToAll(b, b); │ │ │ │ -678 solver_->apply(v, const_cast(b), res); │ │ │ │ -679 } │ │ │ │ -680 │ │ │ │ -681 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10); │ │ │ │ -682 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10); │ │ │ │ -683 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ -684 coarsesolverconverged = false; │ │ │ │ -685 }else{ │ │ │ │ -686 // presmoothing │ │ │ │ -687 _p_r_e_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ -688 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10); │ │ │ │ -689 // printvector(std::cout, *residual, "post presmooth residual", "r", 10); │ │ │ │ -690#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ -691 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ -692 │ │ │ │ -693 if(processNextLevel) { │ │ │ │ -694 // next level │ │ │ │ -695 for(std::size_t i=0; imatrices().finest()) { │ │ │ │ -705 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ ->communicator().prod(coarsesolverconverged); │ │ │ │ -706 if(!coarsesolverconverged) │ │ │ │ -707 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ -708 } │ │ │ │ -709 │ │ │ │ -710 _p_o_s_t_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ -711 } │ │ │ │ -712 } │ │ │ │ -713 │ │ │ │ -714 │ │ │ │ -716 template │ │ │ │ -_7_1_7 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_p_o_s_t([[maybe_unused]] _D_o_m_a_i_n& x) │ │ │ │ -718 { │ │ │ │ -719 lhs_=nullptr; │ │ │ │ -720 rhs_=nullptr; │ │ │ │ -721 residual_=nullptr; │ │ │ │ -722 } │ │ │ │ -723 │ │ │ │ -724 template │ │ │ │ -725 template │ │ │ │ -_7_2_6 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s(std::vector& cont) │ │ │ │ -727 { │ │ │ │ -728 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ -729 } │ │ │ │ -730 │ │ │ │ -731 } // end namespace Amg │ │ │ │ -732} // end namespace Dune │ │ │ │ -733 │ │ │ │ -734#endif │ │ │ │ -_s_u_p_e_r_l_u_._h_h │ │ │ │ -Classes for using SuperLU with ISTL matrices. │ │ │ │ -_u_m_f_p_a_c_k_._h_h │ │ │ │ -Classes for using UMFPack with ISTL matrices. │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ -_s_o_l_v_e_r_s_._h_h │ │ │ │ -Implementations of the inverse operator interface. │ │ │ │ -_s_c_a_l_a_r_p_r_o_d_u_c_t_s_._h_h │ │ │ │ -Define base class for scalar product and norm. │ │ │ │ -_p_r_e_c_o_n_d_i_t_i_o_n_e_r_s_._h_h │ │ │ │ -Define general preconditioner interface. │ │ │ │ -_t_r_a_n_s_f_e_r_._h_h │ │ │ │ -Prolongation and restriction for amg. │ │ │ │ -_s_m_o_o_t_h_e_r_._h_h │ │ │ │ -Classes for the generic construction and application of the smoothers. │ │ │ │ -_m_a_t_r_i_x_h_i_e_r_a_r_c_h_y_._h_h │ │ │ │ -Provides a classes representing the hierarchies in AMG. │ │ │ │ -_f_a_s_t_a_m_g_s_m_o_o_t_h_e_r_._h_h │ │ │ │ -_i_o_._h_h │ │ │ │ -Some generic functions for pretty printing vectors and matrices. │ │ │ │ -_c_o_l │ │ │ │ -Col col │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:351 │ │ │ │ -_m_a_t │ │ │ │ -Matrix & mat │ │ │ │ -DDeeffiinniittiioonn matrixmatrix.hh:347 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_p_r_e_s_m_o_o_t_h │ │ │ │ -void presmooth(LevelContext &levelContext, size_t steps) │ │ │ │ -Apply pre smoothing on the current level. │ │ │ │ -DDeeffiinniittiioonn smoother.hh:406 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ -const void * Arguments │ │ │ │ -A type holding all the arguments needed to call the constructor. │ │ │ │ -DDeeffiinniittiioonn construction.hh:44 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ -static std::shared_ptr< T > construct(Arguments &args) │ │ │ │ -Construct an object with the specified arguments. │ │ │ │ -DDeeffiinniittiioonn construction.hh:52 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_p_o_s_t_s_m_o_o_t_h │ │ │ │ -void postsmooth(LevelContext &levelContext, size_t steps) │ │ │ │ -Apply post smoothing on the current level. │ │ │ │ -DDeeffiinniittiioonn smoother.hh:428 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s_:_:_i_t_e_r_a_t_i_o_n_s │ │ │ │ -int iterations │ │ │ │ -The number of iterations to perform. │ │ │ │ -DDeeffiinniittiioonn smoother.hh:47 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_m_a_t_r_i_x │ │ │ │ -OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix │ │ │ │ -The iterator over the matrices. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:207 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_g_e_t_C_o_a_r_s_e_s_t_A_g_g_r_e_g_a_t_e_N_u_m_b_e_r_s │ │ │ │ -void getCoarsestAggregateNumbers(std::vector< std::size_t, A1 > &cont) │ │ │ │ -Get the aggregate number of each unknown on the coarsest level. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:726 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_p_i_n_f_o │ │ │ │ -ParallelInformationHierarchy::Iterator pinfo │ │ │ │ -The iterator over the parallel information. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:211 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y │ │ │ │ -void recalculateHierarchy() │ │ │ │ -Recalculate the matrix hierarchy. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:173 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_p_o_s_t │ │ │ │ -void post(Domain &x) │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:717 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_m_a_x_l_e_v_e_l_s │ │ │ │ -std::size_t maxlevels() │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:503 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ -X Domain │ │ │ │ -The domain type. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:77 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_s_i_d_u_a_l │ │ │ │ -Hierarchy< Domain, A >::Iterator residual │ │ │ │ -The iterator over the residuals. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:227 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_c_a_t_e_g_o_r_y │ │ │ │ -virtual SolverCategory::Category category() const │ │ │ │ -Category of the preconditioner (see SolverCategory::Category) │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:146 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ -MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy │ │ │ │ -The operator hierarchy type. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:72 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_e_d_i_s_t │ │ │ │ -OperatorHierarchy::RedistributeInfoList::const_iterator redist │ │ │ │ -The iterator over the redistribution information. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:215 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_R_a_n_g_e │ │ │ │ -X Range │ │ │ │ -The range type. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:79 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -PI ParallelInformation │ │ │ │ -The type of the parallel information. Either OwnerOverlapCommunication or │ │ │ │ -another type describing the... │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:70 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_O_p_e_r_a_t_o_r │ │ │ │ -M Operator │ │ │ │ -The matrix operator type. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:63 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_l_e_v_e_l_s │ │ │ │ -std::size_t levels() │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:498 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_F_a_s_t_A_M_G │ │ │ │ -FastAMG(const Operator &fineOperator, const C &criterion, const Parameters │ │ │ │ -&parms=Parameters(), bool symmetric=true, const ParallelInformation │ │ │ │ -&pinfo=ParallelInformation()) │ │ │ │ -Construct an AMG with an inexact coarse solver based on the smoother. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:125 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ -InverseOperator< X, X > CoarseSolver │ │ │ │ -the type of the coarse solver. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:81 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_u_s_e_s_D_i_r_e_c_t_C_o_a_r_s_e_L_e_v_e_l_S_o_l_v_e_r │ │ │ │ -bool usesDirectCoarseLevelSolver() const │ │ │ │ -Check whether the coarse solver used is a direct solver. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:654 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_h_s │ │ │ │ -Hierarchy< Domain, A >::Iterator lhs │ │ │ │ -The iterator over the left hand side. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:223 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_r_h_s │ │ │ │ -Hierarchy< Range, A >::Iterator rhs │ │ │ │ -The iterator over the right hand sided. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:231 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_l_e_v_e_l │ │ │ │ -std::size_t level │ │ │ │ -The level index. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:235 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_a_p_p_l_y │ │ │ │ -void apply(Domain &v, const Range &d) │ │ │ │ -Apply one step of the preconditioner to the system A(v)=d. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:510 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_H_i_e_r_a_r_c_h_y │ │ │ │ -OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ -The parallal data distribution hierarchy type. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:74 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_p_r_e │ │ │ │ -void pre(Domain &x, Range &b) │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:449 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_F_a_s_t_A_M_G │ │ │ │ -FastAMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const │ │ │ │ -Parameters &parms, bool symmetric=true) │ │ │ │ -Construct a new amg with a specific coarse solver. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:320 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G_:_:_L_e_v_e_l_C_o_n_t_e_x_t_:_:_a_g_g_r_e_g_a_t_e_s │ │ │ │ -OperatorHierarchy::AggregatesMapList::const_iterator aggregates │ │ │ │ -The iterator over the aggregates maps. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:219 │ │ │ │ +163 // solve D w = v, note: diagonal stores Dii^{-1} │ │ │ │ +164 if( isLowerTriangular ) │ │ │ │ +165 { │ │ │ │ +166 // The matrix is lower triangular, so the diagonal entry is the │ │ │ │ +167 // last one in each row. │ │ │ │ +168 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ +169 { │ │ │ │ +170 const auto &A_i = *i; │ │ │ │ +171 const auto ii = A_i.beforeEnd(); │ │ │ │ +172 assert( ii.index() == i.index() ); │ │ │ │ +173 // We need to be careful here: Directly using │ │ │ │ +174 // auto rhs = Impl::asVector(v[ i.index() ]); │ │ │ │ +175 // is not OK in case this is a proxy. Hence │ │ │ │ +176 // we first have to copy the value. Notice that │ │ │ │ +177 // this is still not OK, if the vector type itself returns │ │ │ │ +178 // proxy references. │ │ │ │ +179 auto rhsValue = v[ i.index() ]; │ │ │ │ +180 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ +181 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ +182 Impl::asMatrix(*ii).mv(rhs, vi); │ │ │ │ +183 } │ │ │ │ +184 } │ │ │ │ +185 else │ │ │ │ +186 { │ │ │ │ +187 // Without assumptions on the sparsity pattern we have to search │ │ │ │ +188 // for the diagonal entry in each row. │ │ │ │ +189 for( auto i = A._b_e_g_i_n(), iend = A._e_n_d(); i != iend; ++i ) │ │ │ │ +190 { │ │ │ │ +191 const auto &A_i = *i; │ │ │ │ +192 const auto ii = A_i.find( i.index() ); │ │ │ │ +193 assert( ii.index() == i.index() ); │ │ │ │ +194 // We need to be careful here: Directly using │ │ │ │ +195 // auto rhs = Impl::asVector(v[ i.index() ]); │ │ │ │ +196 // is not OK in case this is a proxy. Hence │ │ │ │ +197 // we first have to copy the value. Notice that │ │ │ │ +198 // this is still not OK, if the vector type itself returns │ │ │ │ +199 // proxy references. │ │ │ │ +200 auto rhsValue = v[ i.index() ]; │ │ │ │ +201 auto&& rhs = Impl::asVector(rhsValue); │ │ │ │ +202 auto&& vi = Impl::asVector( v[ i.index() ] ); │ │ │ │ +203 Impl::asMatrix(*ii).mv(rhs, vi); │ │ │ │ +204 } │ │ │ │ +205 } │ │ │ │ +206 │ │ │ │ +207 // solve L^T v = w, note: only L is stored │ │ │ │ +208 // note: we perform the operation column-wise from right to left │ │ │ │ +209 for( auto i = A._b_e_f_o_r_e_E_n_d(), iend = A._b_e_f_o_r_e_B_e_g_i_n(); i != iend; --i ) │ │ │ │ +210 { │ │ │ │ +211 const auto &A_i = *i; │ │ │ │ +212 for( auto ij = A_i.begin(); ij.index() < i.index(); ++ij ) │ │ │ │ +213 { │ │ │ │ +214 auto&& vij = Impl::asVector( v[ ij.index() ] ); │ │ │ │ +215 Impl::asMatrix(*ij).mmtv(Impl::asVector( v[ i.index() ] ), vij); │ │ │ │ +216 } │ │ │ │ +217 } │ │ │ │ +218 } │ │ │ │ +219 │ │ │ │ +220} // namespace Dune │ │ │ │ +221 │ │ │ │ +222#endif // #ifndef DUNE_ISTL_ILDL_HH │ │ │ │ +_i_l_u_._h_h │ │ │ │ +The incomplete LU factorization kernels. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_I_m_p_:_:_D_e_n_s_e_M_a_t_r_i_x_B_a_s_e_:_:_C_o_n_s_t_I_t_e_r_a_t_o_r │ │ │ │ -ConstIterator class for sequential access. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:404 │ │ │ │ +_D_u_n_e_:_:_b_i_l_d_l___d_e_c_o_m_p_o_s_e │ │ │ │ +void bildl_decompose(Matrix &A) │ │ │ │ +compute ILDL decomposition of a symmetric matrix A │ │ │ │ +DDeeffiinniittiioonn ildl.hh:88 │ │ │ │ +_D_u_n_e_:_:_b_i_l_d_l___b_a_c_k_s_o_l_v_e │ │ │ │ +void bildl_backsolve(const Matrix &A, X &v, const Y &d, bool │ │ │ │ +isLowerTriangular=false) │ │ │ │ +DDeeffiinniittiioonn ildl.hh:149 │ │ │ │ +_D_u_n_e_:_:_b_i_l_d_l___s_u_b_t_r_a_c_t_B_C_T │ │ │ │ +static void bildl_subtractBCT(const FieldMatrix< K, m, n > &B, const │ │ │ │ +FieldMatrix< K, m, n > &CT, FieldMatrix< K, m, n > &A) │ │ │ │ +DDeeffiinniittiioonn ildl.hh:24 │ │ │ │ +_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r │ │ │ │ +derive error class from the base class in common │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:19 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r │ │ │ │ +Error when performing an operation on a matrix block. │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:52 │ │ │ │ _D_u_n_e_:_:_M_a_t_r_i_x │ │ │ │ A generic dynamic dense matrix. │ │ │ │ DDeeffiinniittiioonn matrix.hh:561 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -typename Imp::BlockTraits< T >::field_type field_type │ │ │ │ -Export the type representing the underlying field. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:565 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r │ │ │ │ -row_type::const_iterator ConstColIterator │ │ │ │ -Const iterator for the entries of each row. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:589 │ │ │ │ -_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ -T block_type │ │ │ │ -Export the type representing the components. │ │ │ │ -DDeeffiinniittiioonn matrix.hh:568 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_F_a_s_t_A_M_G │ │ │ │ -A fast (sequential) algebraic multigrid based on agglomeration that saves │ │ │ │ -memory bandwidth. │ │ │ │ -DDeeffiinniittiioonn fastamg.hh:60 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_G_a_u_s_s_S_e_i_d_e_l_P_r_e_s_m_o_o_t_h_D_e_f_e_c_t_:_:_a_p_p_l_y │ │ │ │ -static void apply(const M &A, X &x, Y &d, const Y &b) │ │ │ │ -DDeeffiinniittiioonn fastamgsmoother.hh:19 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _> │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_<_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_l_l_o_c_a_t_o_r_ _>_:_:_I_t_e_r_a_t_o_r │ │ │ │ -LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation │ │ │ │ -> Iterator │ │ │ │ -Type of the mutable iterator. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:216 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_H_i_e_r_a_r_c_h_y_:_:_L_e_v_e_l_I_t_e_r_a_t_o_r │ │ │ │ -Iterator over the levels in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:120 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ -The hierarchies build by the coarsening process. │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:61 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_a_r_a_m_e_t_e_r_s │ │ │ │ -All parameters for AMG. │ │ │ │ -DDeeffiinniittiioonn parameters.hh:416 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_D_e_f_a_u_l_t_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -The default class for the smoother arguments. │ │ │ │ -DDeeffiinniittiioonn smoother.hh:38 │ │ │ │ -_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ -Base class for matrix free definition of preconditioners. │ │ │ │ -DDeeffiinniittiioonn preconditioner.hh:33 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R │ │ │ │ -Sequential SSOR preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:142 │ │ │ │ -_D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -Base class for scalar product and norm computation. │ │ │ │ -DDeeffiinniittiioonn scalarproducts.hh:52 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t │ │ │ │ -Statistics about the application of an inverse operator. │ │ │ │ -DDeeffiinniittiioonn solver.hh:50 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t_:_:_c_o_n_v_e_r_g_e_d │ │ │ │ -bool converged │ │ │ │ -True if convergence criterion has been met. │ │ │ │ -DDeeffiinniittiioonn solver.hh:75 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r │ │ │ │ -Abstract base class for all solvers. │ │ │ │ -DDeeffiinniittiioonn solver.hh:101 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y │ │ │ │ -Category │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:23 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_s_e_q_u_e_n_t_i_a_l │ │ │ │ -@ sequential │ │ │ │ -Category for sequential solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:25 │ │ │ │ -_D_u_n_e_:_:_I_s_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ -DDeeffiinniittiioonn solvertype.hh:16 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_B_e_g_i_n │ │ │ │ +RowIterator beforeBegin() │ │ │ │ +DDeeffiinniittiioonn matrix.hh:630 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_f_o_r_e_E_n_d │ │ │ │ +RowIterator beforeEnd() │ │ │ │ +DDeeffiinniittiioonn matrix.hh:623 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_e_n_d │ │ │ │ +RowIterator end() │ │ │ │ +Get iterator to one beyond last row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:616 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_:_:_b_e_g_i_n │ │ │ │ +RowIterator begin() │ │ │ │ +Get iterator to first row. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:610 │ │ │ │ +_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: dependency.hh File Reference │ │ │ +dune-istl: solverfactory.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -65,69 +65,95 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ +Typedefs | │ │ │ Functions
│ │ │ - │ │ │ +
solverfactory.hh File Reference
│ │ │
│ │ │
│ │ │ - │ │ │ -

Provides classes for initializing the link attributes of a matrix graph. │ │ │ -More...

│ │ │ -
#include <bitset>
│ │ │ -#include <ostream>
│ │ │ -#include "graph.hh"
│ │ │ -#include "properties.hh"
│ │ │ -#include <dune/common/propertymap.hh>
│ │ │ +
#include <unordered_map>
│ │ │ +#include <functional>
│ │ │ +#include <memory>
│ │ │ +#include <dune/common/parametertree.hh>
│ │ │ +#include <dune/common/singleton.hh>
│ │ │ +#include "solverregistry.hh"
│ │ │ +#include <dune/istl/solver.hh>
│ │ │ +#include <dune/istl/schwarz.hh>
│ │ │ +#include <dune/istl/novlpschwarz.hh>
│ │ │
│ │ │

Go to the source code of this file.

│ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ │ │ │

│ │ │ Classes

class  Dune::Amg::EdgeProperties
 Class representing the properties of an edge in the matrix graph. More...
 
class  Dune::Amg::VertexProperties
 Class representing a node in the matrix graph. More...
 
class  Dune::Amg::PropertyGraphVertexPropertyMap< G, i >
 
struct  Dune::PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >
class  Dune::SolverFactory< Operator >
 Factory to assembly solvers configured by a ParameterTree. More...
 
│ │ │ │ │ │ │ │ │ │ │ │ - │ │ │ - │ │ │ +

│ │ │ Namespaces

namespace  Dune
 
namespace  Dune::Amg
 
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ +Typedefs

template<class M , class X , class Y >
using Dune::DirectSolverSignature = std::shared_ptr< InverseOperator< X, Y > >(const M &, const ParameterTree &)
 
template<class M , class X , class Y >
using Dune::DirectSolverFactory = Singleton< ParameterizedObjectFactory< DirectSolverSignature< M, X, Y > > >
 
template<class M , class X , class Y >
using Dune::PreconditionerSignature = std::shared_ptr< Preconditioner< X, Y > >(const std::shared_ptr< M > &, const ParameterTree &)
 
template<class M , class X , class Y >
using Dune::PreconditionerFactory = Singleton< ParameterizedObjectFactory< PreconditionerSignature< M, X, Y > > >
 
template<class X , class Y >
using Dune::IterativeSolverSignature = std::shared_ptr< InverseOperator< X, Y > >(const std::shared_ptr< LinearOperator< X, Y > > &, const std::shared_ptr< ScalarProduct< X > > &, const std::shared_ptr< Preconditioner< X, Y > >, const ParameterTree &)
 
template<class X , class Y >
using Dune::IterativeSolverFactory = Singleton< ParameterizedObjectFactory< IterativeSolverSignature< X, Y > > >
 
│ │ │ │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ Functions

template<typename G , typename EP , typename VM , typename EM >
PropertyMapTypeSelector< Amg::VertexVisitedTag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > >::Type Dune::get (const Amg::VertexVisitedTag &tag, Amg::PropertiesGraph< G, Amg::VertexProperties, EP, VM, EM > &graph)
 
std::ostream & Dune::Amg::operator<< (std::ostream &os, const EdgeProperties &props)
 
std::ostream & Dune::Amg::operator<< (std::ostream &os, const VertexProperties &props)
 
template<class O , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const O &)
 
template<class M , class X , class Y , class C , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y , class C , class Preconditioner >
std::shared_ptr< PreconditionerDune::wrapPreconditioner4Parallel (const std::shared_ptr< Preconditioner > &prec, const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< MatrixAdapter< M, X, Y > > &)
 
template<class M , class X , class Y , class C >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< OverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class M , class X , class Y , class C >
std::shared_ptr< ScalarProduct< X > > Dune::createScalarProduct (const std::shared_ptr< NonoverlappingSchwarzOperator< M, X, Y, C > > &op)
 
template<class Operator >
std::shared_ptr< InverseOperator< typename Operator::domain_type, typename Operator::range_type > > Dune::getSolverFromFactory (std::shared_ptr< Operator > op, const ParameterTree &config, std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > prec=nullptr)
 Instantiates an InverseOperator from an Operator and a configuration given as a ParameterTree.
 
│ │ │ -

Detailed Description

│ │ │ -

Provides classes for initializing the link attributes of a matrix graph.

│ │ │ -
Author
Markus Blatt
│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,56 +1,101 @@ │ │ │ │ dune-istl 2.10 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ - * _p_a_a_m_g │ │ │ │ -_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _F_u_n_c_t_i_o_n_s │ │ │ │ -dependency.hh File Reference │ │ │ │ -_I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s_ _T_e_m_p_l_a_t_e_ _L_i_b_r_a_r_y_ _(_I_S_T_L_) » _I_t_e_r_a_t_i_v_e_ _S_o_l_v_e_r_s » _P_r_e_c_o_n_d_i_t_i_o_n_e_r_s │ │ │ │ -» _P_a_r_a_l_l_e_l_ _A_l_g_e_b_r_a_i_c_ _M_u_l_t_i_g_r_i_d │ │ │ │ -Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ -_M_o_r_e_._._. │ │ │ │ -#include │ │ │ │ -#include │ │ │ │ -#include "_g_r_a_p_h_._h_h" │ │ │ │ -#include "_p_r_o_p_e_r_t_i_e_s_._h_h" │ │ │ │ -#include │ │ │ │ +_C_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s | _T_y_p_e_d_e_f_s | _F_u_n_c_t_i_o_n_s │ │ │ │ +solverfactory.hh File Reference │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include │ │ │ │ +#include "_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h" │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ +#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ _G_o_ _t_o_ _t_h_e_ _s_o_u_r_c_e_ _c_o_d_e_ _o_f_ _t_h_i_s_ _f_i_l_e_. │ │ │ │ CCllaasssseess │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_E_d_g_e_P_r_o_p_e_r_t_i_e_s │ │ │ │ -  Class representing the properties of an edge in the matrix graph. │ │ │ │ - _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -  Class representing a node in the matrix graph. _M_o_r_e_._._. │ │ │ │ -  │ │ │ │ - class   _D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_y_G_r_a_p_h_V_e_r_t_e_x_P_r_o_p_e_r_t_y_M_a_p_<_ _G_,_ _i_ _> │ │ │ │ -  │ │ │ │ -struct   _D_u_n_e_:_:_P_r_o_p_e_r_t_y_M_a_p_T_y_p_e_S_e_l_e_c_t_o_r_<_ _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g_,_ _A_m_g_:_: │ │ │ │ - _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_,_ _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_P_,_ _V_M_,_ _E_M_ _>_ _> │ │ │ │ +class   _D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y_<_ _O_p_e_r_a_t_o_r_ _> │ │ │ │ +  Factory to assembly solvers configured by a ParameterTree. _M_o_r_e_._._. │ │ │ │   │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │   │ │ │ │ -namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +TTyyppeeddeeffss │ │ │ │ +template │ │ │ │ +using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y > > │ │ │ │ + (const M &, const ParameterTree &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +using  _D_u_n_e_:_:_D_i_r_e_c_t_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ + _D_i_r_e_c_t_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ +  │ │ │ │ +template │ │ │ │ +using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ + >(const std::shared_ptr< M > &, const ParameterTree &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +using  _D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ + _P_r_e_c_o_n_d_i_t_i_o_n_e_r_S_i_g_n_a_t_u_r_e< M, X, Y > > > │ │ │ │ +  │ │ │ │ +template │ │ │ │ +using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< X, Y │ │ │ │ + > >(const std::shared_ptr< _L_i_n_e_a_r_O_p_e_r_a_t_o_r< X, Y > > &, const std:: │ │ │ │ + shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > > &, const std::shared_ptr< │ │ │ │ + _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > >, const ParameterTree &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +using  _D_u_n_e_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_F_a_c_t_o_r_y = Singleton< ParameterizedObjectFactory< │ │ │ │ + _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e< X, Y > > > │ │ │ │   │ │ │ │ FFuunnccttiioonnss │ │ │ │ -template │ │ │ │ - PropertyMapTypeSelector< _A_m_g_:_: │ │ │ │ -_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g, _A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h< _D_u_n_e_:_:_g_e_t (const _A_m_g_:_:_V_e_r_t_e_x_V_i_s_i_t_e_d_T_a_g │ │ │ │ - G, _A_m_g_:_:_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, EP, VM, EM > &tag, _A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h< G, _A_m_g_:_: │ │ │ │ - >::Type  _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s, EP, VM, EM > &graph) │ │ │ │ -  │ │ │ │ - std::ostream &  _D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream │ │ │ │ - &os, const _E_d_g_e_P_r_o_p_e_r_t_i_e_s &props) │ │ │ │ -  │ │ │ │ - std::ostream &  _D_u_n_e_:_:_A_m_g_:_:_o_p_e_r_a_t_o_r_<_< (std::ostream │ │ │ │ - &os, const _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s &props) │ │ │ │ -  │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provides classes for initializing the link attributes of a matrix graph. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ +template │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ + const O &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ + const std::shared_ptr< │ │ │ │ + _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, C > │ │ │ │ + > &op) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r >  _D_u_n_e_:_:_w_r_a_p_P_r_e_c_o_n_d_i_t_i_o_n_e_r_4_P_a_r_a_l_l_e_l (const │ │ │ │ + std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r > &prec, │ │ │ │ + const std::shared_ptr< │ │ │ │ + _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ + C > > &op) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ + shared_ptr< _M_a_t_r_i_x_A_d_a_p_t_e_r< M, X, Y > > │ │ │ │ + &) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ + shared_ptr< _O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< │ │ │ │ + M, X, Y, C > > &op) │ │ │ │ +  │ │ │ │ +template │ │ │ │ +std::shared_ptr< _S_c_a_l_a_r_P_r_o_d_u_c_t< X > >  _D_u_n_e_:_:_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t (const std:: │ │ │ │ + shared_ptr< │ │ │ │ + _N_o_n_o_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z_O_p_e_r_a_t_o_r< M, X, Y, │ │ │ │ + C > > &op) │ │ │ │ +  │ │ │ │ +template │ │ │ │ + std::shared_ptr< _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< _D_u_n_e_:_:_g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y (std:: │ │ │ │ + typename Operator::domain_type, shared_ptr< Operator > op, const │ │ │ │ + typename Operator::range_type > >  ParameterTree &config, std::shared_ptr< │ │ │ │ + _P_r_e_c_o_n_d_i_t_i_o_n_e_r< typename Operator:: │ │ │ │ + domain_type, typename Operator:: │ │ │ │ + range_type > > prec=nullptr) │ │ │ │ + Instantiates an _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r from an │ │ │ │ +  Operator and a configuration given as a │ │ │ │ + ParameterTree. │ │ │ │ +  │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.9.8 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: dependency.hh Source File │ │ │ +dune-istl: solverfactory.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -70,490 +70,244 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │ -
dependency.hh
│ │ │ +
solverfactory.hh
│ │ │
│ │ │
│ │ │ Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
│ │ │
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
│ │ │
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
│ │ │
4// vi: set et ts=4 sw=2 sts=2:
│ │ │ -
5#ifndef DUNE_AMG_DEPENDENCY_HH
│ │ │ -
6#define DUNE_AMG_DEPENDENCY_HH
│ │ │ -
7
│ │ │ +
5
│ │ │ +
6#ifndef DUNE_ISTL_SOLVERFACTORY_HH
│ │ │ +
7#define DUNE_ISTL_SOLVERFACTORY_HH
│ │ │
8
│ │ │ -
9#include <bitset>
│ │ │ -
10#include <ostream>
│ │ │ -
11
│ │ │ -
12#include "graph.hh"
│ │ │ -
13#include "properties.hh"
│ │ │ -
14#include <dune/common/propertymap.hh>
│ │ │ +
9#include <unordered_map>
│ │ │ +
10#include <functional>
│ │ │ +
11#include <memory>
│ │ │ +
12
│ │ │ +
13#include <dune/common/parametertree.hh>
│ │ │ +
14#include <dune/common/singleton.hh>
│ │ │
15
│ │ │ -
16
│ │ │ -
17namespace Dune
│ │ │ -
18{
│ │ │ -
19 namespace Amg
│ │ │ -
20 {
│ │ │ -
│ │ │ - │ │ │ -
39 {
│ │ │ -
40 friend std::ostream& operator<<(std::ostream& os, const EdgeProperties& props);
│ │ │ -
41 public:
│ │ │ - │ │ │ -
44
│ │ │ -
45 private:
│ │ │ -
46
│ │ │ -
47 std::bitset<SIZE> flags_;
│ │ │ -
48 public:
│ │ │ - │ │ │ -
51
│ │ │ -
53 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ -
54
│ │ │ -
56 bool operator[](std::size_t v) const;
│ │ │ -
57
│ │ │ -
63 bool depends() const;
│ │ │ -
64
│ │ │ -
69 void setDepends();
│ │ │ -
70
│ │ │ -
74 void resetDepends();
│ │ │ -
75
│ │ │ -
80 bool influences() const;
│ │ │ -
81
│ │ │ -
85 void setInfluences();
│ │ │ -
86
│ │ │ -
90 void resetInfluences();
│ │ │ -
91
│ │ │ -
96 bool isOneWay() const;
│ │ │ -
97
│ │ │ -
102 bool isTwoWay() const;
│ │ │ +
16#include "solverregistry.hh"
│ │ │ +
17#include <dune/istl/solver.hh>
│ │ │ +
18#include <dune/istl/schwarz.hh>
│ │ │ + │ │ │ +
20
│ │ │ +
21namespace Dune{
│ │ │ +
26 // Direct solver factory:
│ │ │ +
27 template<class M, class X, class Y>
│ │ │ +
28 using DirectSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const M&, const ParameterTree&);
│ │ │ +
29 template<class M, class X, class Y>
│ │ │ +
30 using DirectSolverFactory = Singleton<ParameterizedObjectFactory<DirectSolverSignature<M,X,Y>>>;
│ │ │ +
31
│ │ │ +
32 // Preconditioner factory:
│ │ │ +
33 template<class M, class X, class Y>
│ │ │ +
34 using PreconditionerSignature = std::shared_ptr<Preconditioner<X,Y>>(const std::shared_ptr<M>&, const ParameterTree&);
│ │ │ +
35 template<class M, class X, class Y>
│ │ │ +
36 using PreconditionerFactory = Singleton<ParameterizedObjectFactory<PreconditionerSignature<M,X,Y>>>;
│ │ │ +
37
│ │ │ +
38 // Iterative solver factory
│ │ │ +
39 template<class X, class Y>
│ │ │ +
40 using IterativeSolverSignature = std::shared_ptr<InverseOperator<X,Y>>(const std::shared_ptr<LinearOperator<X,Y>>&, const std::shared_ptr<ScalarProduct<X>>&, const std::shared_ptr<Preconditioner<X,Y>>, const ParameterTree&);
│ │ │ +
41 template<class X, class Y>
│ │ │ +
42 using IterativeSolverFactory = Singleton<ParameterizedObjectFactory<IterativeSolverSignature<X,Y>>>;
│ │ │ +
43
│ │ │ +
44 // initSolverFactories differs in different compilation units, so we have it
│ │ │ +
45 // in an anonymous namespace
│ │ │ +
46 namespace {
│ │ │ +
47
│ │ │ +
53 template<class O>
│ │ │ +
54 int initSolverFactories(){
│ │ │ +
55 using M = typename O::matrix_type;
│ │ │ +
56 using X = typename O::range_type;
│ │ │ +
57 using Y = typename O::domain_type;
│ │ │ +
58 using TL = Dune::TypeList<M,X,Y>;
│ │ │ + │ │ │ +
60 addRegistryToFactory<TL>(dsfac, DirectSolverTag{});
│ │ │ + │ │ │ +
62 addRegistryToFactory<TL>(pfac, PreconditionerTag{});
│ │ │ +
63 using TLS = Dune::TypeList<X,Y>;
│ │ │ + │ │ │ +
65 return addRegistryToFactory<TLS>(isfac, IterativeSolverTag{});
│ │ │ +
66 }
│ │ │ +
67 } // end anonymous namespace
│ │ │ +
68
│ │ │ +
69
│ │ │ +
70 template<class O, class Preconditioner>
│ │ │ +
│ │ │ +
71 std::shared_ptr<Preconditioner> wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ +
72 const O&)
│ │ │ +
73 {
│ │ │ +
74 return prec;
│ │ │ +
75 }
│ │ │ +
│ │ │ +
76
│ │ │ +
77 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ +
78 std::shared_ptr<Preconditioner>
│ │ │ +
│ │ │ +
79 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ +
80 const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ +
81 {
│ │ │ +
82 return std::make_shared<BlockPreconditioner<X,Y,C,Preconditioner> >(prec, op->getCommunication());
│ │ │ +
83 }
│ │ │ +
│ │ │ +
84
│ │ │ +
85 template<class M, class X, class Y, class C, class Preconditioner>
│ │ │ +
86 std::shared_ptr<Preconditioner>
│ │ │ +
│ │ │ +
87 wrapPreconditioner4Parallel(const std::shared_ptr<Preconditioner>& prec,
│ │ │ +
88 const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ +
89 {
│ │ │ +
90 return std::make_shared<NonoverlappingBlockPreconditioner<C,Preconditioner> >(prec, op->getCommunication());
│ │ │ +
91 }
│ │ │ +
│ │ │ +
92
│ │ │ +
93 template<class M, class X, class Y>
│ │ │ +
│ │ │ +
94 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<MatrixAdapter<M,X,Y> >&)
│ │ │ +
95 {
│ │ │ +
96 return std::make_shared<SeqScalarProduct<X>>();
│ │ │ +
97 }
│ │ │ +
│ │ │ +
98 template<class M, class X, class Y, class C>
│ │ │ +
│ │ │ +
99 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ +
100 {
│ │ │ +
101 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ +
102 }
│ │ │ +
│ │ │
103
│ │ │ -
108 bool isStrong() const;
│ │ │ +
104 template<class M, class X, class Y, class C>
│ │ │ +
│ │ │ +
105 std::shared_ptr<ScalarProduct<X>> createScalarProduct(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C> >& op)
│ │ │ +
106 {
│ │ │ +
107 return createScalarProduct<X>(op->getCommunication(), op->category());
│ │ │ +
108 }
│ │ │ +
│ │ │
109
│ │ │ -
113 void reset();
│ │ │ -
114
│ │ │ -
118 void printFlags() const;
│ │ │ -
119 };
│ │ │ -
│ │ │ -
120
│ │ │ -
│ │ │ - │ │ │ -
127 friend std::ostream& operator<<(std::ostream& os, const VertexProperties& props);
│ │ │ -
128 public:
│ │ │ - │ │ │ -
130 private:
│ │ │ -
131
│ │ │ -
133 std::bitset<SIZE> flags_;
│ │ │ -
134
│ │ │ -
135 public:
│ │ │ - │ │ │ -
138
│ │ │ -
140 std::bitset<SIZE>::reference operator[](std::size_t v);
│ │ │ -
141
│ │ │ -
143 bool operator[](std::size_t v) const;
│ │ │ -
144
│ │ │ -
151 void setIsolated();
│ │ │ -
152
│ │ │ -
156 bool isolated() const;
│ │ │ -
157
│ │ │ -
161 void resetIsolated();
│ │ │ -
162
│ │ │ -
166 void setVisited();
│ │ │ -
167
│ │ │ -
171 bool visited() const;
│ │ │ -
172
│ │ │ -
176 void resetVisited();
│ │ │ -
177
│ │ │ -
181 void setFront();
│ │ │ -
182
│ │ │ -
186 bool front() const;
│ │ │ -
187
│ │ │ -
191 void resetFront();
│ │ │ -
192
│ │ │ -
196 void setExcludedBorder();
│ │ │ -
197
│ │ │ -
202 bool excludedBorder() const;
│ │ │ -
203
│ │ │ -
207 void resetExcludedBorder();
│ │ │ -
208
│ │ │ -
212 void reset();
│ │ │ -
213
│ │ │ -
214 };
│ │ │ -
│ │ │ -
215
│ │ │ -
216 template<typename G, std::size_t i>
│ │ │ -
│ │ │ - │ │ │ -
218 : public RAPropertyMapHelper<typename std::bitset<VertexProperties::SIZE>::reference,
│ │ │ -
219 PropertyGraphVertexPropertyMap<G,i> >
│ │ │ -
220 {
│ │ │ -
221 public:
│ │ │ -
222
│ │ │ -
223 typedef ReadWritePropertyMapTag Category;
│ │ │ +
129 template<class Operator>
│ │ │ +
│ │ │ + │ │ │ +
131 using Domain = typename Operator::domain_type;
│ │ │ +
132 using Range = typename Operator::range_type;
│ │ │ + │ │ │ + │ │ │ +