--- /srv/rebuilderd/tmp/rebuilderdfPIE9z/inputs/libdune-istl-doc_2.11.0-1_all.deb +++ /srv/rebuilderd/tmp/rebuilderdfPIE9z/out/libdune-istl-doc_2.11.0-1_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2026-02-06 16:25:13.000000 debian-binary │ --rw-r--r-- 0 0 0 29484 2026-02-06 16:25:13.000000 control.tar.xz │ --rw-r--r-- 0 0 0 7671832 2026-02-06 16:25:13.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 29476 2026-02-06 16:25:13.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 7675256 2026-02-06 16:25:13.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 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/ │ │ │ -rw-r--r-- 0 root (0) root (0) 1737 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/changelog.Debian.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 5154 2025-12-11 14:20:36.000000 ./usr/share/doc/libdune-istl-doc/changelog.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 3412 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/copyright │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/ │ │ │ -rw-r--r-- 0 root (0) root (0) 3046 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00002.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3044 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00005.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6513 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ --rw-r--r-- 0 root (0) root (0) 103927 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12550 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ --rw-r--r-- 0 root (0) root (0) 160125 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10283 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ --rw-r--r-- 0 root (0) root (0) 72587 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4731 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ --rw-r--r-- 0 root (0) root (0) 24119 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9927 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ --rw-r--r-- 0 root (0) root (0) 137811 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9027 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ --rw-r--r-- 0 root (0) root (0) 74751 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4968 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9251 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16447 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ --rw-r--r-- 0 root (0) root (0) 321808 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10633 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ --rw-r--r-- 0 root (0) root (0) 25202 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10725 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ --rw-r--r-- 0 root (0) root (0) 43967 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4846 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14227 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10631 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041.html │ │ │ --rw-r--r-- 0 root (0) root (0) 105445 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7200 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ --rw-r--r-- 0 root (0) root (0) 57795 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6259 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ --rw-r--r-- 0 root (0) root (0) 126047 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9694 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ --rw-r--r-- 0 root (0) root (0) 41893 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11763 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ --rw-r--r-- 0 root (0) root (0) 300833 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15783 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ --rw-r--r-- 0 root (0) root (0) 174826 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4812 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14866 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7674 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ --rw-r--r-- 0 root (0) root (0) 98476 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6828 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ --rw-r--r-- 0 root (0) root (0) 54357 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 21334 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ --rw-r--r-- 0 root (0) root (0) 210966 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5692 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071.html │ │ │ --rw-r--r-- 0 root (0) root (0) 21988 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6359 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17118 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5286 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ --rw-r--r-- 0 root (0) root (0) 29300 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8601 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ --rw-r--r-- 0 root (0) root (0) 72517 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10825 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ --rw-r--r-- 0 root (0) root (0) 189273 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6397 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ --rw-r--r-- 0 root (0) root (0) 66124 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7468 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ --rw-r--r-- 0 root (0) root (0) 78304 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6704 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ --rw-r--r-- 0 root (0) root (0) 70412 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5705 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ --rw-r--r-- 0 root (0) root (0) 30529 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14486 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ --rw-r--r-- 0 root (0) root (0) 360292 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9140 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ --rw-r--r-- 0 root (0) root (0) 67633 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9886 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ --rw-r--r-- 0 root (0) root (0) 135119 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5238 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ --rw-r--r-- 0 root (0) root (0) 27073 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8125 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ --rw-r--r-- 0 root (0) root (0) 128983 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9429 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ --rw-r--r-- 0 root (0) root (0) 87696 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10207 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ --rw-r--r-- 0 root (0) root (0) 48577 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5374 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14125 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9971 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ --rw-r--r-- 0 root (0) root (0) 243839 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15821 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ --rw-r--r-- 0 root (0) root (0) 417824 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10190 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128.html │ │ │ --rw-r--r-- 0 root (0) root (0) 128796 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 22151 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ --rw-r--r-- 0 root (0) root (0) 323687 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6697 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ --rw-r--r-- 0 root (0) root (0) 34399 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6834 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ --rw-r--r-- 0 root (0) root (0) 74685 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8317 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140.html │ │ │ --rw-r--r-- 0 root (0) root (0) 62968 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 10642 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ --rw-r--r-- 0 root (0) root (0) 126559 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13907 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146.html │ │ │ --rw-r--r-- 0 root (0) root (0) 136731 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16505 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ --rw-r--r-- 0 root (0) root (0) 186944 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12953 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152.html │ │ │ --rw-r--r-- 0 root (0) root (0) 119901 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 43348 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ --rw-r--r-- 0 root (0) root (0) 266104 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4861 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ --rw-r--r-- 0 root (0) root (0) 42003 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7883 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161.html │ │ │ --rw-r--r-- 0 root (0) root (0) 222693 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9191 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ --rw-r--r-- 0 root (0) root (0) 79175 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6684 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11353 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 16198 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ --rw-r--r-- 0 root (0) root (0) 128420 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6598 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173.html │ │ │ --rw-r--r-- 0 root (0) root (0) 44877 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 11330 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ --rw-r--r-- 0 root (0) root (0) 83458 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8042 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ --rw-r--r-- 0 root (0) root (0) 42681 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 30728 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ --rw-r--r-- 0 root (0) root (0) 147769 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 8060 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ --rw-r--r-- 0 root (0) root (0) 34901 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5954 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ --rw-r--r-- 0 root (0) root (0) 158386 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5470 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ --rw-r--r-- 0 root (0) root (0) 165282 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 6177 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ --rw-r--r-- 0 root (0) root (0) 24623 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7680 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17199 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9753 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ --rw-r--r-- 0 root (0) root (0) 12104 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7007 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203.html │ │ │ --rw-r--r-- 0 root (0) root (0) 87325 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7520 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ --rw-r--r-- 0 root (0) root (0) 141322 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5633 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ --rw-r--r-- 0 root (0) root (0) 44725 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7318 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ --rw-r--r-- 0 root (0) root (0) 34673 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5602 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ --rw-r--r-- 0 root (0) root (0) 36596 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 9288 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ --rw-r--r-- 0 root (0) root (0) 418813 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4408 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ --rw-r--r-- 0 root (0) root (0) 51110 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4249 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ --rw-r--r-- 0 root (0) root (0) 17943 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 4543 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ --rw-r--r-- 0 root (0) root (0) 58728 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227_source.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7177 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13779 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4861 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 42003 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7680 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17199 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9753 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12104 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6684 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11353 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6598 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 44877 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10190 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 128796 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00023_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5705 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 30529 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00026_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6359 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17118 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00029_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6828 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 54357 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00032_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10207 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 48577 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00035_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9886 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 135119 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00038_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9971 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 243839 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00041_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9429 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 87696 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00044_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6704 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 70412 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00047_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5286 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 29300 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00050_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15821 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 417824 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00053_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5692 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 21988 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00056_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10825 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 189273 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00059_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6397 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 66124 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00062_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14486 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 360292 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00065_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5238 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 27073 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00068_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5374 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14125 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00071_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7674 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 98476 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00074_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8601 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 72517 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00077_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7468 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 78304 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00080_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9140 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 67633 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00083_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8125 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 128983 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00086_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 21334 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 210966 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00089_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6177 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 24623 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00092_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8317 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 62968 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00095_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7520 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 141322 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00098_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8060 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 34901 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00101_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9191 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 79175 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00104_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 43348 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 266104 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00107_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 8042 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 42681 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00110_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10725 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 43967 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00113_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4408 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 51110 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00116_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13907 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 136731 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00119_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6834 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 74685 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00122_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9694 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 41893 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00125_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4731 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 24119 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00128_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4846 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14227 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00131_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11330 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 83458 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00134_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7200 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 57795 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00137_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5633 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 44725 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00140_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 11763 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 300833 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00143_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12550 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 160125 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00146_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 15783 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 174826 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00149_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4543 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 58728 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00152_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 12953 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 119901 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00155_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7177 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 13779 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00158_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 30728 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 147769 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00161_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4968 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9251 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00164_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4812 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 14866 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00167_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6513 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 103927 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00170_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10283 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 72587 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00173_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10633 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 25202 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00176_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7318 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 34673 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00179_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16447 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 321808 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00182_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9288 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 418813 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00185_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16505 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 186944 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00188_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9927 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 137811 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00191_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10642 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 126559 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00194_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 16198 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 128420 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00197_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7007 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 87325 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00200_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6259 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 126047 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00203_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 22151 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 323687 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00206_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 7883 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 222693 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00209_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 6697 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 34399 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00212_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 4249 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 17943 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00215_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5602 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 36596 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00218_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 10631 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 105445 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00221_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5470 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 165282 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00224_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5954 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 158386 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00227_source.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 9027 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 74751 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00230_source.html │ │ │ -rw-r--r-- 0 root (0) root (0) 5523 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00233.html │ │ │ -rw-r--r-- 0 root (0) root (0) 3422 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00234.html │ │ │ -rw-r--r-- 0 root (0) root (0) 264826 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00235.html │ │ │ -rw-r--r-- 0 root (0) root (0) 22661 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00235.png │ │ │ -rw-r--r-- 0 root (0) root (0) 30323 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00236.html │ │ │ -rw-r--r-- 0 root (0) root (0) 18441 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00236.png │ │ │ -rw-r--r-- 0 root (0) root (0) 5146 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/a00237.html │ │ │ @@ -1234,15 +1234,15 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 4247 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e69be5995c9f5d42bf491ae6f29600e.html │ │ │ -rw-r--r-- 0 root (0) root (0) 1646 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_5e69be5995c9f5d42bf491ae6f29600e_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 13832 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4.html │ │ │ -rw-r--r-- 0 root (0) root (0) 2055 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_667edbdb0a8210232217f5e7df6d52d4_dep.png │ │ │ -rw-r--r-- 0 root (0) root (0) 3654 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dir_e68e8157741866f444e17edd764ebbae.html │ │ │ -rw-r--r-- 0 root (0) root (0) 54624 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/doxygen.css │ │ │ -rw-r--r-- 0 root (0) root (0) 238504 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/doxygen_crawl.html │ │ │ --rw-r--r-- 0 root (0) root (0) 178463 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 178465 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dune-istl.tag.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 7707 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/dynsections.js │ │ │ -rw-r--r-- 0 root (0) root (0) 31995 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/files.html │ │ │ -rw-r--r-- 0 root (0) root (0) 549 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_0.png │ │ │ -rw-r--r-- 0 root (0) root (0) 572 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_0_dark.png │ │ │ -rw-r--r-- 0 root (0) root (0) 531 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_1.png │ │ │ -rw-r--r-- 0 root (0) root (0) 860 2026-02-06 16:25:13.000000 ./usr/share/doc/libdune-istl-doc/doxygen/form_10.png │ │ │ -rw-r--r-- 0 root (0) root (0) 909 2026-02-06 16:25:13.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: vbvector.hh File Reference │ │ │ +dune-istl: matrixindexset.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,49 +74,37 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces
│ │ │ -
vbvector.hh File Reference
│ │ │ +
matrixindexset.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 <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

class  Dune::VariableBlockVector< B, A >
 A Vector of blocks with different blocksizes. More...
class  Dune::VariableBlockVector< B, A >::CreateIterator
 Iterator class for sequential creation of blocks. More...
struct  Dune::FieldTraits< VariableBlockVector< B, A > >
class  Dune::MatrixIndexSet
 Stores the nonzero entries for creating a sparse matrix. More...
│ │ │ │ │ │ │ │ │

│ │ │ Namespaces

namespace  Dune
│ │ │ -

Detailed Description

│ │ │ -

???

│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,33 +1,23 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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> │ │ │ │ +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 │ │ │ │ - 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_:_:_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 │ │ │ │ -  _I_t_e_r_a_t_o_r class for sequential creation of blocks. _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_:_:_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 │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -??? │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00008_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: vbvector.hh Source File │ │ │ +dune-istl: matrixindexset.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,617 +71,249 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
vbvector.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_VBVECTOR_HH
│ │ │ -
6#define DUNE_ISTL_VBVECTOR_HH
│ │ │ +
5#ifndef DUNE_ISTL_MATRIXINDEXSET_HH
│ │ │ +
6#define DUNE_ISTL_MATRIXINDEXSET_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
│ │ │ -
25
│ │ │ -
26namespace Dune {
│ │ │ -
27
│ │ │ -
32
│ │ │ -
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;
│ │ │ +
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 namespace Impl {
│ │ │ +
20
│ │ │ +
40 class RowIndexSet {
│ │ │ +
41 using Index = std::uint_least32_t;
│ │ │ +
42 class Vector : public std::vector<Index> {
│ │ │ +
43 // store max size within class so that variant uses less memory
│ │ │ +
44 size_type maxVectorSize_;
│ │ │ +
45 friend class RowIndexSet;
│ │ │ +
46 };
│ │ │ +
47
│ │ │ +
49 static Index getMaxVectorSize(const RowIndexSet::Vector& v) {
│ │ │ +
50 return v.maxVectorSize_;
│ │ │ +
51 }
│ │ │ +
52
│ │ │ +
53 public:
│ │ │ +
54 using size_type = Index;
│ │ │ +
55
│ │ │ +
67 static constexpr size_type defaultMaxVectorSize = 2048;
│ │ │ +
68
│ │ │ +
75 RowIndexSet(size_type maxVectorSize = defaultMaxVectorSize) : storage_{Vector()}
│ │ │ +
76 {
│ │ │ +
77 std::get<Vector>(storage_).maxVectorSize_ = maxVectorSize;
│ │ │ +
78 }
│ │ │ +
79
│ │ │ +
88 void insert(size_type col){
│ │ │ +
89 std::visit(Dune::overload(
│ │ │ +
90 // If row is stored as set, call insert directly
│ │ │ +
91 [&](std::set<size_type>& set) {
│ │ │ +
92 set.insert(col);
│ │ │ +
93 },
│ │ │ +
94 // If row is stored as vector only insert directly
│ │ │ +
95 // if maxVectorSize_ is not reached. Otherwise switch
│ │ │ +
96 // to set storage first.
│ │ │ +
97 [&](Vector& sortedVector) {
│ │ │ +
98 auto it = std::lower_bound(sortedVector.cbegin(), sortedVector.cend(), col);
│ │ │ +
99 if (it == sortedVector.cend() or (*it != col)) {
│ │ │ +
100 if (sortedVector.size() < getMaxVectorSize(sortedVector)) {
│ │ │ +
101 sortedVector.insert(it, col);
│ │ │ +
102 } else {
│ │ │ +
103 std::set<size_type> set(sortedVector.cbegin(), sortedVector.cend());
│ │ │ +
104 set.insert(col);
│ │ │ +
105 storage_ = std::move(set);
│ │ │ +
106 }
│ │ │ +
107 }
│ │ │ +
108 }
│ │ │ +
109 ), storage_);
│ │ │ +
110 }
│ │ │ +
111
│ │ │ +
118 bool contains(const Index& col) const {
│ │ │ +
119 return std::visit(Dune::overload(
│ │ │ +
120 [&](const std::set<Index>& set) {
│ │ │ +
121 return set.contains(col);
│ │ │ +
122 },
│ │ │ +
123 [&](const std::vector<Index>& sortedVector) {
│ │ │ +
124 return std::binary_search(sortedVector.cbegin(), sortedVector.cend(), col);
│ │ │ +
125 }
│ │ │ +
126 ), storage_);
│ │ │ +
127 }
│ │ │ +
128
│ │ │ +
134 const auto& storage() const {
│ │ │ +
135 return storage_;
│ │ │ +
136 }
│ │ │ +
137
│ │ │ +
143 size_type size() const {
│ │ │ +
144 return std::visit([&](const auto& rowIndices) {
│ │ │ +
145 return rowIndices.size();
│ │ │ +
146 }, storage_);
│ │ │ +
147 }
│ │ │ +
148
│ │ │ +
152 void clear() {
│ │ │ +
153 std::visit([&](auto& rowIndices) {
│ │ │ +
154 rowIndices.clear();
│ │ │ +
155 }, storage_);
│ │ │ +
156 }
│ │ │ +
157
│ │ │ +
158 private:
│ │ │ +
159 std::variant<Vector, std::set<Index>> storage_;
│ │ │ +
160 };
│ │ │ +
161 }
│ │ │ +
162
│ │ │ +
163
│ │ │ +
│ │ │ + │ │ │ +
181 {
│ │ │ +
182 public:
│ │ │ +
183 using size_type = typename Impl::RowIndexSet::size_type;
│ │ │ +
184
│ │ │ +
196 static constexpr size_type defaultMaxVectorSize = Impl::RowIndexSet::defaultMaxVectorSize;
│ │ │ +
197
│ │ │ +
│ │ │ +
203 MatrixIndexSet(size_type maxVectorSize=defaultMaxVectorSize) noexcept : rows_(0), cols_(0), maxVectorSize_(maxVectorSize)
│ │ │ +
204 {}
│ │ │ +
│ │ │ +
205
│ │ │ +
│ │ │ +
213 MatrixIndexSet(size_type rows, size_type cols, size_type maxVectorSize=defaultMaxVectorSize) : rows_(rows), cols_(cols), maxVectorSize_(maxVectorSize)
│ │ │ +
214 {
│ │ │ +
215 indices_.resize(rows_, Impl::RowIndexSet(maxVectorSize_));
│ │ │ +
216 }
│ │ │ +
│ │ │ +
217
│ │ │ +
│ │ │ + │ │ │ +
220 rows_ = rows;
│ │ │ +
221 cols_ = cols;
│ │ │ +
222 indices_.resize(rows_, Impl::RowIndexSet(maxVectorSize_));
│ │ │
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
│ │ │ - │ │ │ +
224
│ │ │ +
│ │ │ + │ │ │ +
233 indices_[row].insert(col);
│ │ │ +
234 }
│ │ │ +
│ │ │ +
235
│ │ │ +
│ │ │ +
237 size_type size() const {
│ │ │ +
238 size_type entries = 0;
│ │ │ +
239 for (size_type i=0; i<rows_; i++)
│ │ │ +
240 entries += rowsize(i);
│ │ │ +
241 return entries;
│ │ │ +
242 }
│ │ │ +
│ │ │ +
243
│ │ │ +
245 size_type rows() const {return rows_;}
│ │ │ +
246
│ │ │ +
248 size_type cols() const {return cols_;}
│ │ │ +
249
│ │ │ +
│ │ │ +
259 const auto& columnIndices(size_type row) const {
│ │ │ +
260 return indices_[row].storage();
│ │ │ +
261 }
│ │ │ +
│ │ │ +
262
│ │ │ +
│ │ │ + │ │ │ +
265 return indices_[row].size();
│ │ │ +
266 }
│ │ │ +
│ │ │ +
267
│ │ │ +
274 template <class MatrixType>
│ │ │ +
│ │ │ +
275 void import(const MatrixType& m, size_type rowOffset=0, size_type colOffset=0) {
│ │ │ +
276
│ │ │ +
277 typedef typename MatrixType::row_type RowType;
│ │ │ +
278 typedef typename RowType::ConstIterator ColumnIterator;
│ │ │ +
279
│ │ │ +
280 for (size_type rowIdx=0; rowIdx<m.N(); rowIdx++) {
│ │ │ +
281
│ │ │ +
282 const RowType& row = m[rowIdx];
│ │ │ +
283
│ │ │ +
284 ColumnIterator cIt = row.begin();
│ │ │ +
285 ColumnIterator cEndIt = row.end();
│ │ │ +
286
│ │ │ +
287 for(; cIt!=cEndIt; ++cIt)
│ │ │ +
288 add(rowIdx+rowOffset, cIt.index()+colOffset);
│ │ │ +
289
│ │ │ +
290 }
│ │ │ +
291
│ │ │ +
292 }
│ │ │ +
│ │ │
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 not (*this == it);
│ │ │ -
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 bool isEnd; // flag if this object was created as the end iterator.
│ │ │ -
371 };
│ │ │ -
│ │ │ -
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 };
│ │ │ -
│ │ │ -
561
│ │ │ -
564
│ │ │ -
565
│ │ │ -
567
│ │ │ -
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.
│ │ │ +
299 template <class MatrixType>
│ │ │ +
│ │ │ +
300 void exportIdx(MatrixType& matrix) const {
│ │ │ +
301
│ │ │ +
302 matrix.setSize(rows_, cols_);
│ │ │ +
303 matrix.setBuildMode(MatrixType::random);
│ │ │ +
304
│ │ │ +
305 for (size_type row=0; row<rows_; row++)
│ │ │ +
306 matrix.setrowsize(row, rowsize(row));
│ │ │ +
307
│ │ │ +
308 matrix.endrowsizes();
│ │ │ +
309
│ │ │ +
310 for (size_type row=0; row<rows_; row++) {
│ │ │ +
311 std::visit([&](const auto& rowIndices) {
│ │ │ +
312 matrix.setIndicesNoSort(row, rowIndices.begin(), rowIndices.end());
│ │ │ +
313 }, indices_[row].storage());
│ │ │ +
314 }
│ │ │ +
315
│ │ │ +
316 matrix.endindices();
│ │ │ +
317
│ │ │ +
318 }
│ │ │ +
│ │ │ +
319
│ │ │ +
320 private:
│ │ │ +
321
│ │ │ +
322 std::vector<Impl::RowIndexSet> indices_;
│ │ │ +
323
│ │ │ +
324 size_type rows_, cols_;
│ │ │ +
325 size_type maxVectorSize_;
│ │ │ +
326
│ │ │ +
327 };
│ │ │ +
│ │ │ +
328
│ │ │ +
329
│ │ │ +
330} // end namespace Dune
│ │ │ +
331
│ │ │ +
332#endif
│ │ │
Definition allocator.hh:11
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ │ │ │ -
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
│ │ │ -
friend class CreateIterator
Definition vbvector.hh:374
│ │ │ -
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
│ │ │ -
BlockVector< B, A > block_type
Same as value_type, here for historical reasons.
Definition vbvector.hh:94
│ │ │ -
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
│ │ │ - │ │ │ -
BlockVector< B, A > value_type
Type of the elements of the outer vector, i.e., dynamic vectors of B.
Definition vbvector.hh:90
│ │ │ -
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
│ │ │ +
void resize(size_type rows, size_type cols)
Reset the size of an index set.
Definition matrixindexset.hh:219
│ │ │ +
static constexpr size_type defaultMaxVectorSize
Default value for maxVectorSize.
Definition matrixindexset.hh:196
│ │ │ +
typename Impl::RowIndexSet::size_type size_type
Definition matrixindexset.hh:183
│ │ │ +
size_type rows() const
Return the number of rows.
Definition matrixindexset.hh:245
│ │ │ +
void exportIdx(MatrixType &matrix) const
Initializes a BCRSMatrix with the indices contained in this MatrixIndexSet.
Definition matrixindexset.hh:300
│ │ │ +
void add(size_type row, size_type col)
Add an index to the index set.
Definition matrixindexset.hh:232
│ │ │ +
MatrixIndexSet(size_type rows, size_type cols, size_type maxVectorSize=defaultMaxVectorSize)
Constructor setting the matrix size.
Definition matrixindexset.hh:213
│ │ │ +
MatrixIndexSet(size_type maxVectorSize=defaultMaxVectorSize) noexcept
Constructor with custom maxVectorSize.
Definition matrixindexset.hh:203
│ │ │ +
const auto & columnIndices(size_type row) const
Return column indices of entries in given row.
Definition matrixindexset.hh:259
│ │ │ +
size_type rowsize(size_type row) const
Return the number of entries in a given row.
Definition matrixindexset.hh:264
│ │ │ +
size_type size() const
Return the number of entries.
Definition matrixindexset.hh:237
│ │ │ +
size_type cols() const
Return the number of columns.
Definition matrixindexset.hh:248
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,703 +1,269 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -vbvector.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_VBVECTOR_HH │ │ │ │ -6#define DUNE_ISTL_VBVECTOR_HH │ │ │ │ +5#ifndef DUNE_ISTL_MATRIXINDEXSET_HH │ │ │ │ +6#define DUNE_ISTL_MATRIXINDEXSET_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 │ │ │ │ -25 │ │ │ │ -26namespace _D_u_n_e { │ │ │ │ -27 │ │ │ │ -32 │ │ │ │ -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>; │ │ │ │ -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(); │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13#include │ │ │ │ +14 │ │ │ │ +15#include │ │ │ │ +16 │ │ │ │ +17namespace _D_u_n_e { │ │ │ │ +18 │ │ │ │ +19 namespace Impl { │ │ │ │ +20 │ │ │ │ +40 class RowIndexSet { │ │ │ │ +41 using Index = std::uint_least32_t; │ │ │ │ +42 class Vector : public std::vector { │ │ │ │ +43 // store max size within class so that variant uses less memory │ │ │ │ +44 size_type maxVectorSize_; │ │ │ │ +45 friend class RowIndexSet; │ │ │ │ +46 }; │ │ │ │ +47 │ │ │ │ +49 static Index getMaxVectorSize(const RowIndexSet::Vector& v) { │ │ │ │ +50 return v.maxVectorSize_; │ │ │ │ +51 } │ │ │ │ +52 │ │ │ │ +53 public: │ │ │ │ +54 using size_type = Index; │ │ │ │ +55 │ │ │ │ +67 static constexpr size_type defaultMaxVectorSize = 2048; │ │ │ │ +68 │ │ │ │ +75 RowIndexSet(size_type maxVectorSize = defaultMaxVectorSize) : storage_ │ │ │ │ +{Vector()} │ │ │ │ +76 { │ │ │ │ +77 std::get(storage_).maxVectorSize_ = maxVectorSize; │ │ │ │ +78 } │ │ │ │ +79 │ │ │ │ +88 void insert(size_type _c_o_l){ │ │ │ │ +89 std::visit(Dune::overload( │ │ │ │ +90 // If row is stored as set, call insert directly │ │ │ │ +91 [&](std::set& set) { │ │ │ │ +92 set.insert(_c_o_l); │ │ │ │ +93 }, │ │ │ │ +94 // If row is stored as vector only insert directly │ │ │ │ +95 // if maxVectorSize_ is not reached. Otherwise switch │ │ │ │ +96 // to set storage first. │ │ │ │ +97 [&](Vector& sortedVector) { │ │ │ │ +98 auto it = std::lower_bound(sortedVector.cbegin(), sortedVector.cend(), _c_o_l); │ │ │ │ +99 if (it == sortedVector.cend() or (*it != _c_o_l)) { │ │ │ │ +100 if (sortedVector.size() < getMaxVectorSize(sortedVector)) { │ │ │ │ +101 sortedVector.insert(it, _c_o_l); │ │ │ │ +102 } else { │ │ │ │ +103 std::set set(sortedVector.cbegin(), sortedVector.cend()); │ │ │ │ +104 set.insert(_c_o_l); │ │ │ │ +105 storage_ = std::move(set); │ │ │ │ +106 } │ │ │ │ +107 } │ │ │ │ +108 } │ │ │ │ +109 ), storage_); │ │ │ │ +110 } │ │ │ │ +111 │ │ │ │ +118 bool contains(const Index& _c_o_l) const { │ │ │ │ +119 return std::visit(Dune::overload( │ │ │ │ +120 [&](const std::set& set) { │ │ │ │ +121 return set.contains(_c_o_l); │ │ │ │ +122 }, │ │ │ │ +123 [&](const std::vector& sortedVector) { │ │ │ │ +124 return std::binary_search(sortedVector.cbegin(), sortedVector.cend(), _c_o_l); │ │ │ │ +125 } │ │ │ │ +126 ), storage_); │ │ │ │ +127 } │ │ │ │ +128 │ │ │ │ +134 const auto& storage() const { │ │ │ │ +135 return storage_; │ │ │ │ +136 } │ │ │ │ +137 │ │ │ │ +143 size_type size() const { │ │ │ │ +144 return std::visit([&](const auto& rowIndices) { │ │ │ │ +145 return rowIndices.size(); │ │ │ │ +146 }, storage_); │ │ │ │ +147 } │ │ │ │ 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; i> storage_; │ │ │ │ +160 }; │ │ │ │ +161 } │ │ │ │ +162 │ │ │ │ +163 │ │ │ │ +_1_8_0 class _M_a_t_r_i_x_I_n_d_e_x_S_e_t │ │ │ │ +181 { │ │ │ │ +182 public: │ │ │ │ +_1_8_3 using _s_i_z_e___t_y_p_e = typename Impl::RowIndexSet::size_type; │ │ │ │ 184 │ │ │ │ -185 other.syncBaseArray(); │ │ │ │ -186 syncBaseArray(); │ │ │ │ -187 } │ │ │ │ -188 │ │ │ │ -_1_9_0 friend void _s_w_a_p (_V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& lhs, _V_a_r_i_a_b_l_e_B_l_o_c_k_V_e_c_t_o_r& rhs) │ │ │ │ -noexcept │ │ │ │ -191 { │ │ │ │ -192 lhs.swap(rhs); │ │ │ │ -193 } │ │ │ │ -194 │ │ │ │ -_1_9_6 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e 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 │ │ │ │ -_2_1_0 void _r_e_s_i_z_e (_s_i_z_e___t_y_p_e numBlocks, _s_i_z_e___t_y_p_e 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 (_s_i_z_e___t_y_p_e i=0; ip+(i*blockSize)); │ │ │ │ -220 │ │ │ │ -221 // and the vector is usable │ │ │ │ -222 initialized = true; │ │ │ │ +_1_9_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 = Impl::RowIndexSet:: │ │ │ │ +defaultMaxVectorSize; │ │ │ │ +197 │ │ │ │ +_2_0_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) │ │ │ │ +204 {} │ │ │ │ +205 │ │ │ │ +_2_1_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) │ │ │ │ +214 { │ │ │ │ +215 indices_.resize(rows_, Impl::RowIndexSet(maxVectorSize_)); │ │ │ │ +216 } │ │ │ │ +217 │ │ │ │ +_2_1_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) { │ │ │ │ +220 rows_ = _r_o_w_s; │ │ │ │ +221 cols_ = _c_o_l_s; │ │ │ │ +222 indices_.resize(rows_, Impl::RowIndexSet(maxVectorSize_)); │ │ │ │ 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 _C_r_e_a_t_e_I_t_e_r_a_t_o_r; │ │ │ │ -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 _s_i_z_e___t_y_p_e () 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 {} │ │ │ │ +_2_3_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) { │ │ │ │ +233 indices_[row].insert(_c_o_l); │ │ │ │ +234 } │ │ │ │ +235 │ │ │ │ +_2_3_7 _s_i_z_e___t_y_p_e _s_i_z_e() const { │ │ │ │ +238 _s_i_z_e___t_y_p_e entries = 0; │ │ │ │ +239 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ +_2_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) { │ │ │ │ +276 │ │ │ │ +277 typedef typename MatrixType::row_type RowType; │ │ │ │ +278 typedef typename RowType::ConstIterator ColumnIterator; │ │ │ │ 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*; │ │ │ │ +280 for (_s_i_z_e___t_y_p_e rowIdx=0; rowIdxblock.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 } │ │ │ │ +299 template │ │ │ │ +_3_0_0 void _e_x_p_o_r_t_I_d_x(MatrixType& matrix) const { │ │ │ │ +301 │ │ │ │ +302 matrix.setSize(rows_, cols_); │ │ │ │ +303 matrix.setBuildMode(MatrixType::random); │ │ │ │ +304 │ │ │ │ +305 for (_s_i_z_e___t_y_p_e row=0; row indices_; │ │ │ │ 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 } │ │ │ │ +324 _s_i_z_e___t_y_p_e rows_, cols_; │ │ │ │ +325 _s_i_z_e___t_y_p_e maxVectorSize_; │ │ │ │ +326 │ │ │ │ +327 }; │ │ │ │ +328 │ │ │ │ +329 │ │ │ │ +330} // end namespace Dune │ │ │ │ 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 not (*this == it); │ │ │ │ -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 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 }; │ │ │ │ -561 │ │ │ │ -564 │ │ │ │ -565 │ │ │ │ -567 │ │ │ │ -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. │ │ │ │ +332#endif │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ +_D_u_n_e_:_:_c_o_l │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ _D_u_n_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ -_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_:_:_C_r_e_a_t_e_I_t_e_r_a_t_o_r │ │ │ │ -friend class CreateIterator │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:374 │ │ │ │ -_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_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ -BlockVector< B, A > block_type │ │ │ │ -Same as value_type, here for historical reasons. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:94 │ │ │ │ -_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_:_:_v_a_l_u_e___t_y_p_e │ │ │ │ -BlockVector< B, A > value_type │ │ │ │ -Type of the elements of the outer vector, i.e., dynamic vectors of B. │ │ │ │ -DDeeffiinniittiioonn vbvector.hh:90 │ │ │ │ -_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_:_:_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:219 │ │ │ │ +_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:196 │ │ │ │ +_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 │ │ │ │ +typename Impl::RowIndexSet::size_type size_type │ │ │ │ +DDeeffiinniittiioonn matrixindexset.hh:183 │ │ │ │ +_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:245 │ │ │ │ +_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:300 │ │ │ │ +_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:232 │ │ │ │ +_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:213 │ │ │ │ +_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:203 │ │ │ │ +_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:259 │ │ │ │ +_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:264 │ │ │ │ +_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:237 │ │ │ │ +_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:248 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00011.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: umfpack.hh File Reference │ │ │ +dune-istl: registry.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,72 +66,86 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -Classes | │ │ │ Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Macros
│ │ │ +
registry.hh File Reference
│ │ │
│ │ │
│ │ │ - │ │ │ -

Classes for using UMFPack with ISTL matrices. │ │ │ -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/matrix.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 <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.

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

│ │ │ -Classes

struct  Dune::UMFPackMethodChooser< T >
struct  Dune::UMFPackMethodChooser< double >
struct  Dune::UMFPackMethodChooser< std::complex< double > >
class  Dune::UMFPack< M >
 The UMFPack direct sparse solver. More...
struct  Dune::IsDirectSolver< UMFPack< M > >
struct  Dune::StoresColumnCompressed< UMFPack< BCRSMatrix< T, A > > >
struct  Dune::UMFPackImpl::isValidBlock< OpTraits, class >
struct  Dune::UMFPackImpl::isValidBlock< OpTraits, std::enable_if_t< std::is_same_v< Impl::UMFPackDomainType< typename OpTraits::matrix_type >, typename OpTraits::domain_type > &&std::is_same_v< Impl::UMFPackRangeType< typename OpTraits::matrix_type >, typename OpTraits::range_type > &&std::is_same_v< typename FieldTraits< typename OpTraits::domain_type::field_type >::real_type, double > &&std::is_same_v< typename FieldTraits< typename OpTraits::range_type::field_type >::real_type, double > > >
│ │ │ │ │ │ │ │ │ - │ │ │

│ │ │ Namespaces

namespace  Dune
namespace  Dune::UMFPackImpl
│ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │

│ │ │ -Functions

 Dune::DUNE_REGISTER_SOLVER ("umfpack", [](auto opTraits, const auto &op, const Dune::ParameterTree &config) -> std::shared_ptr< typename decltype(opTraits)::solver_type > { using OpTraits=decltype(opTraits);if constexpr(OpTraits::isParallel){ if(opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune::InvalidStateException, "UMFPack works only for sequential operators.");} if constexpr(OpTraits::isAssembled){ using M=typename OpTraits::matrix_type;if constexpr(UMFPackImpl::isValidBlock< OpTraits >::value) { const auto &A=opTraits.getAssembledOpOrThrow(op);const M &mat=A->getmat();int verbose=config.get("verbose", 0);return std::make_shared< Dune::UMFPack< M > >(mat, verbose);} } DUNE_THROW(UnsupportedType, "Unsupported Type in UMFPack (only double and std::complex<double> supported)");return nullptr;})

│ │ │ +Macros

#define DUNE_REGISTRY_PUT(Tag, id, ...)
│ │ │ -

Detailed Description

│ │ │ -

Classes for using UMFPack with ISTL matrices.

│ │ │ -
Author
Dominic Kempf
│ │ │ -
│ │ │ +

Macro Definition Documentation

│ │ │ + │ │ │ +

◆ DUNE_REGISTRY_PUT

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
#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,65 +1,46 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_/_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_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_. │ │ │ │ -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_ _> │ │ │ │ -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_ _> │ │ │ │ -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_<_ _M_ _>_ _> │ │ │ │ -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_I_m_p_l_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _O_p_T_r_a_i_t_s_,_ _c_l_a_s_s_ _> │ │ │ │ -struct   _D_u_n_e_:_:_U_M_F_P_a_c_k_I_m_p_l_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_ _O_p_T_r_a_i_t_s_,_ _s_t_d_:_:_e_n_a_b_l_e___i_f___t_<_ _s_t_d_:_: │ │ │ │ - _i_s___s_a_m_e___v_<_ _I_m_p_l_:_:_U_M_F_P_a_c_k_D_o_m_a_i_n_T_y_p_e_<_ _t_y_p_e_n_a_m_e_ _O_p_T_r_a_i_t_s_:_:_m_a_t_r_i_x___t_y_p_e_ _>_, │ │ │ │ - _t_y_p_e_n_a_m_e_ _O_p_T_r_a_i_t_s_:_:_d_o_m_a_i_n___t_y_p_e_ _>_ _&_&_s_t_d_:_:_i_s___s_a_m_e___v_<_ _I_m_p_l_:_: │ │ │ │ - _U_M_F_P_a_c_k_R_a_n_g_e_T_y_p_e_<_ _t_y_p_e_n_a_m_e_ _O_p_T_r_a_i_t_s_:_:_m_a_t_r_i_x___t_y_p_e_ _>_,_ _t_y_p_e_n_a_m_e │ │ │ │ - _O_p_T_r_a_i_t_s_:_:_r_a_n_g_e___t_y_p_e_ _>_ _&_&_s_t_d_:_:_i_s___s_a_m_e___v_<_ _t_y_p_e_n_a_m_e_ _F_i_e_l_d_T_r_a_i_t_s_< │ │ │ │ - _t_y_p_e_n_a_m_e_ _O_p_T_r_a_i_t_s_:_:_d_o_m_a_i_n___t_y_p_e_:_:_f_i_e_l_d___t_y_p_e_ _>_:_:_r_e_a_l___t_y_p_e_,_ _d_o_u_b_l_e_ _> │ │ │ │ - _&_&_s_t_d_:_:_i_s___s_a_m_e___v_<_ _t_y_p_e_n_a_m_e_ _F_i_e_l_d_T_r_a_i_t_s_<_ _t_y_p_e_n_a_m_e_ _O_p_T_r_a_i_t_s_:_: │ │ │ │ - _r_a_n_g_e___t_y_p_e_:_:_f_i_e_l_d___t_y_p_e_ _>_:_:_r_e_a_l___t_y_p_e_,_ _d_o_u_b_l_e_ _>_ _>_ _> │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │ -namespace   _D_u_n_e_:_:_U_M_F_P_a_c_k_I_m_p_l │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -  _D_u_n_e_:_:_D_U_N_E___R_E_G_I_S_T_E_R___S_O_L_V_E_R ("umfpack", [](auto opTraits, const auto &op, │ │ │ │ - const Dune::ParameterTree &config) -> std::shared_ptr< typename decltype │ │ │ │ - (opTraits)::solver_type > { using OpTraits=decltype(opTraits);if constexpr │ │ │ │ - (OpTraits::isParallel){ if(opTraits.getCommOrThrow(op).communicator().size() │ │ │ │ - > 1) DUNE_THROW(Dune::InvalidStateException, "UMFPack works only for │ │ │ │ - sequential operators.");} if constexpr(OpTraits::isAssembled){ using │ │ │ │ - M=typename OpTraits::matrix_type;if constexpr(_U_M_F_P_a_c_k_I_m_p_l_:_:_i_s_V_a_l_i_d_B_l_o_c_k< │ │ │ │ - OpTraits >::value) { const auto &A=opTraits.getAssembledOpOrThrow(op);const M │ │ │ │ - &mat=A->getmat();int verbose=config.get("verbose", 0);return std:: │ │ │ │ - make_shared< _D_u_n_e_:_:_U_M_F_P_a_c_k< M > >(mat, verbose);} } DUNE_THROW │ │ │ │ - (_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "Unsupported Type in _U_M_F_P_a_c_k (only double and std:: │ │ │ │ - complex supported)");return nullptr;}) │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Classes for using UMFPack with ISTL matrices. │ │ │ │ - Author │ │ │ │ - Dominic Kempf │ │ │ │ +MMaaccrrooss │ │ │ │ +#define  _D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(Tag, id, ...) │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? DDUUNNEE__RREEGGIISSTTRRYY__PPUUTT ********** │ │ │ │ +#define DUNE_REGISTRY_PUT ( TTaagg, │ │ │ │ + iidd, │ │ │ │ + ... ) │ │ │ │ +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.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00011_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: umfpack.hh Source File │ │ │ +dune-istl: registry.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,911 +66,107 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
umfpack.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_UMFPACK_HH
│ │ │ -
6#define DUNE_ISTL_UMFPACK_HH
│ │ │ -
7
│ │ │ -
8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN
│ │ │ -
9
│ │ │ -
10#include<complex>
│ │ │ -
11#include<type_traits>
│ │ │ -
12
│ │ │ -
13#include<umfpack.h>
│ │ │ -
14
│ │ │ -
15#include<dune/common/exceptions.hh>
│ │ │ -
16#include<dune/common/fmatrix.hh>
│ │ │ -
17#include<dune/common/fvector.hh>
│ │ │ - │ │ │ - │ │ │ -
20#include<dune/istl/matrix.hh>
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
27
│ │ │ -
28
│ │ │ -
29
│ │ │ -
30namespace Dune {
│ │ │ -
41
│ │ │ -
42 // FORWARD DECLARATIONS
│ │ │ -
43 template<class M, class T, class TM, class TD, class TA>
│ │ │ - │ │ │ -
45
│ │ │ -
46 template<class T, bool tag>
│ │ │ - │ │ │ -
48
│ │ │ -
49 // wrapper class for C-Function Calls in the backend. Choose the right function namespace
│ │ │ -
50 // depending on the template parameter used.
│ │ │ -
51 template<typename T>
│ │ │ -
│ │ │ - │ │ │ -
53 {
│ │ │ -
54 static constexpr bool valid = false ;
│ │ │ -
55 };
│ │ │ -
│ │ │ -
56
│ │ │ -
57 template<>
│ │ │ -
│ │ │ -
58 struct UMFPackMethodChooser<double>
│ │ │ -
59 {
│ │ │ -
60 static constexpr bool valid = true ;
│ │ │ -
61
│ │ │ -
62 template<typename... A>
│ │ │ -
│ │ │ -
63 static void defaults(A... args)
│ │ │ -
64 {
│ │ │ -
65 umfpack_dl_defaults(args...);
│ │ │ -
66 }
│ │ │ -
│ │ │ -
67 template<typename... A>
│ │ │ -
│ │ │ -
68 static void free_numeric(A... args)
│ │ │ -
69 {
│ │ │ -
70 umfpack_dl_free_numeric(args...);
│ │ │ -
71 }
│ │ │ -
│ │ │ -
72 template<typename... A>
│ │ │ -
│ │ │ -
73 static void free_symbolic(A... args)
│ │ │ -
74 {
│ │ │ -
75 umfpack_dl_free_symbolic(args...);
│ │ │ +
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
│ │ │ +
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 template<typename... A>
│ │ │ -
│ │ │ -
78 static int load_numeric(A... args)
│ │ │ -
79 {
│ │ │ -
80 return umfpack_dl_load_numeric(args...);
│ │ │ -
81 }
│ │ │ -
│ │ │ -
82 template<typename... A>
│ │ │ -
│ │ │ -
83 static void numeric(A... args)
│ │ │ -
84 {
│ │ │ -
85 umfpack_dl_numeric(args...);
│ │ │ -
86 }
│ │ │ -
│ │ │ -
87 template<typename... A>
│ │ │ -
│ │ │ -
88 static void report_info(A... args)
│ │ │ -
89 {
│ │ │ -
90 umfpack_dl_report_info(args...);
│ │ │ -
91 }
│ │ │ -
│ │ │ -
92 template<typename... A>
│ │ │ -
│ │ │ -
93 static void report_status(A... args)
│ │ │ -
94 {
│ │ │ -
95 umfpack_dl_report_status(args...);
│ │ │ -
96 }
│ │ │ -
│ │ │ -
97 template<typename... A>
│ │ │ -
│ │ │ -
98 static int save_numeric(A... args)
│ │ │ -
99 {
│ │ │ -
100 return umfpack_dl_save_numeric(args...);
│ │ │ -
101 }
│ │ │ -
│ │ │ -
102 template<typename... A>
│ │ │ -
│ │ │ -
103 static void solve(A... args)
│ │ │ -
104 {
│ │ │ -
105 umfpack_dl_solve(args...);
│ │ │ -
106 }
│ │ │ -
│ │ │ -
107 template<typename... A>
│ │ │ -
│ │ │ -
108 static void symbolic(A... args)
│ │ │ -
109 {
│ │ │ -
110 umfpack_dl_symbolic(args...);
│ │ │ -
111 }
│ │ │ -
│ │ │ -
112 };
│ │ │ -
│ │ │ -
113
│ │ │ -
114 template<>
│ │ │ -
│ │ │ -
115 struct UMFPackMethodChooser<std::complex<double> >
│ │ │ -
116 {
│ │ │ -
117 static constexpr bool valid = true ;
│ │ │ -
118 using size_type = SuiteSparse_long;
│ │ │ -
119
│ │ │ -
120 template<typename... A>
│ │ │ -
│ │ │ -
121 static void defaults(A... args)
│ │ │ -
122 {
│ │ │ -
123 umfpack_zl_defaults(args...);
│ │ │ -
124 }
│ │ │ -
│ │ │ -
125 template<typename... A>
│ │ │ -
│ │ │ -
126 static void free_numeric(A... args)
│ │ │ -
127 {
│ │ │ -
128 umfpack_zl_free_numeric(args...);
│ │ │ -
129 }
│ │ │ -
│ │ │ -
130 template<typename... A>
│ │ │ -
│ │ │ -
131 static void free_symbolic(A... args)
│ │ │ -
132 {
│ │ │ -
133 umfpack_zl_free_symbolic(args...);
│ │ │ -
134 }
│ │ │ -
│ │ │ -
135 template<typename... A>
│ │ │ -
│ │ │ -
136 static int load_numeric(A... args)
│ │ │ -
137 {
│ │ │ -
138 return umfpack_zl_load_numeric(args...);
│ │ │ -
139 }
│ │ │ -
│ │ │ -
140 template<typename... A>
│ │ │ -
│ │ │ -
141 static void numeric(const size_type* cs, const size_type* ri, const double* val, A... args)
│ │ │ -
142 {
│ │ │ -
143 umfpack_zl_numeric(cs,ri,val,NULL,args...);
│ │ │ -
144 }
│ │ │ -
│ │ │ -
145 template<typename... A>
│ │ │ -
│ │ │ -
146 static void report_info(A... args)
│ │ │ -
147 {
│ │ │ -
148 umfpack_zl_report_info(args...);
│ │ │ -
149 }
│ │ │ -
│ │ │ -
150 template<typename... A>
│ │ │ -
│ │ │ -
151 static void report_status(A... args)
│ │ │ -
152 {
│ │ │ -
153 umfpack_zl_report_status(args...);
│ │ │ -
154 }
│ │ │ -
│ │ │ -
155 template<typename... A>
│ │ │ -
│ │ │ -
156 static int save_numeric(A... args)
│ │ │ -
157 {
│ │ │ -
158 return umfpack_zl_save_numeric(args...);
│ │ │ -
159 }
│ │ │ -
│ │ │ -
160 template<typename... A>
│ │ │ -
│ │ │ -
161 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)
│ │ │ -
162 {
│ │ │ -
163 const double* cval = reinterpret_cast<const double*>(val);
│ │ │ -
164 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...);
│ │ │ -
165 }
│ │ │ -
│ │ │ -
166 template<typename... A>
│ │ │ -
│ │ │ -
167 static void symbolic(size_type m, size_type n, const size_type* cs, const size_type* ri, const double* val, A... args)
│ │ │ -
168 {
│ │ │ -
169 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...);
│ │ │ -
170 }
│ │ │ -
│ │ │ -
171 };
│ │ │ -
│ │ │ -
172
│ │ │ -
173 namespace Impl
│ │ │ -
174 {
│ │ │ -
175 template<class M, class = void>
│ │ │ -
176 struct UMFPackVectorChooser;
│ │ │ -
177
│ │ │ -
179 template<class M> using UMFPackDomainType = typename UMFPackVectorChooser<M>::domain_type;
│ │ │ -
180
│ │ │ -
182 template<class M> using UMFPackRangeType = typename UMFPackVectorChooser<M>::range_type;
│ │ │ -
183
│ │ │ -
184 template<class M>
│ │ │ -
185 struct UMFPackVectorChooser<M,
│ │ │ -
186 std::enable_if_t<(std::is_same<M,double>::value) || (std::is_same<M,std::complex<double> >::value)>>
│ │ │ -
187 {
│ │ │ -
188 using domain_type = M;
│ │ │ -
189 using range_type = M;
│ │ │ -
190 };
│ │ │ -
191
│ │ │ -
192 template<typename T, int n, int m>
│ │ │ -
193 struct UMFPackVectorChooser<FieldMatrix<T,n,m>,
│ │ │ -
194 std::enable_if_t<(std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value)>>
│ │ │ -
195 {
│ │ │ -
197 using domain_type = FieldVector<T,m>;
│ │ │ -
199 using range_type = FieldVector<T,n>;
│ │ │ -
200 };
│ │ │ -
201
│ │ │ -
202 template<typename T, typename A>
│ │ │ -
203 struct UMFPackVectorChooser<BCRSMatrix<T,A>,
│ │ │ -
204 std::void_t<UMFPackDomainType<T>, UMFPackRangeType<T>>>
│ │ │ -
205 {
│ │ │ -
206 // In case of recursive deduction (e.g., BCRSMatrix<FieldMatrix<...>, Allocator<FieldMatrix<...>>>)
│ │ │ -
207 // the allocator needs to be converted to the sub-block allocator type too (e.g., Allocator<FieldVector<...>>).
│ │ │ -
208 // Note that matrix allocator is assumed to be the same as the domain/range type of allocators
│ │ │ -
210 using domain_type = BlockVector<UMFPackDomainType<T>, typename std::allocator_traits<A>::template rebind_alloc<UMFPackDomainType<T>>>;
│ │ │ -
212 using range_type = BlockVector<UMFPackRangeType<T>, typename std::allocator_traits<A>::template rebind_alloc<UMFPackRangeType<T>>>;
│ │ │ -
213 };
│ │ │ -
214
│ │ │ -
215 template<typename T, typename A>
│ │ │ -
216 struct UMFPackVectorChooser<Matrix<T,A>,
│ │ │ -
217 std::void_t<UMFPackDomainType<T>, UMFPackRangeType<T>>>
│ │ │ -
218 : public UMFPackVectorChooser<BCRSMatrix<T,A>, std::void_t<UMFPackDomainType<T>, UMFPackRangeType<T>>>
│ │ │ -
219 {};
│ │ │ -
220
│ │ │ -
221 // to make the `UMFPackVectorChooser` work with `MultiTypeBlockMatrix`, we need to add an intermediate step for the rows, which are typically `MultiTypeBlockVector`
│ │ │ -
222 template<typename FirstBlock, typename... Blocks>
│ │ │ -
223 struct UMFPackVectorChooser<MultiTypeBlockVector<FirstBlock, Blocks...>,
│ │ │ -
224 std::void_t<UMFPackDomainType<FirstBlock>, UMFPackRangeType<FirstBlock>, UMFPackDomainType<Blocks>...>>
│ │ │ -
225 {
│ │ │ -
227 using domain_type = MultiTypeBlockVector<UMFPackDomainType<FirstBlock>, UMFPackDomainType<Blocks>...>;
│ │ │ -
229 using range_type = UMFPackRangeType<FirstBlock>;
│ │ │ -
230 };
│ │ │ -
231
│ │ │ -
232 // specialization for `MultiTypeBlockMatrix` with `MultiTypeBlockVector` rows
│ │ │ -
233 template<typename FirstRow, typename... Rows>
│ │ │ -
234 struct UMFPackVectorChooser<MultiTypeBlockMatrix<FirstRow, Rows...>,
│ │ │ -
235 std::void_t<UMFPackDomainType<FirstRow>, UMFPackRangeType<FirstRow>, UMFPackRangeType<Rows>...>>
│ │ │ -
236 {
│ │ │ -
238 using domain_type = UMFPackDomainType<FirstRow>;
│ │ │ -
240 using range_type = MultiTypeBlockVector< UMFPackRangeType<FirstRow>, UMFPackRangeType<Rows>... >;
│ │ │ -
241 };
│ │ │ -
242
│ │ │ -
243 // dummy class to represent no BitVector
│ │ │ -
244 struct NoBitVector
│ │ │ -
245 {};
│ │ │ -
246
│ │ │ -
247
│ │ │ -
248 }
│ │ │ -
249
│ │ │ -
263 template<typename M>
│ │ │ -
│ │ │ -
264 class UMFPack : public InverseOperator<Impl::UMFPackDomainType<M>,Impl::UMFPackRangeType<M>>
│ │ │ -
265 {
│ │ │ -
266 using T = typename M::field_type;
│ │ │ -
267
│ │ │ -
268 public:
│ │ │ -
269 using size_type = SuiteSparse_long;
│ │ │ -
270
│ │ │ -
272 using Matrix = M;
│ │ │ -
273 using matrix_type = M;
│ │ │ -
275 using UMFPackMatrix = ISTL::Impl::BCCSMatrix<typename Matrix::field_type, size_type>;
│ │ │ -
277 using MatrixInitializer = ISTL::Impl::BCCSMatrixInitializer<M, size_type>;
│ │ │ -
279 using domain_type = Impl::UMFPackDomainType<M>;
│ │ │ -
281 using range_type = Impl::UMFPackRangeType<M>;
│ │ │ -
282
│ │ │ -
│ │ │ - │ │ │ -
285 {
│ │ │ - │ │ │ -
287 }
│ │ │ -
│ │ │ -
288
│ │ │ -
│ │ │ -
297 UMFPack(const Matrix& matrix, int verbose=0) : matrixIsLoaded_(false)
│ │ │ -
298 {
│ │ │ -
299 //check whether T is a supported type
│ │ │ -
300 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
301 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
302 Caller::defaults(UMF_Control);
│ │ │ -
303 setVerbosity(verbose);
│ │ │ -
304 setMatrix(matrix);
│ │ │ -
305 }
│ │ │ -
│ │ │ -
306
│ │ │ -
│ │ │ -
315 UMFPack(const Matrix& matrix, int verbose, bool) : matrixIsLoaded_(false)
│ │ │ -
316 {
│ │ │ -
317 //check whether T is a supported type
│ │ │ -
318 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
319 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
320 Caller::defaults(UMF_Control);
│ │ │ -
321 setVerbosity(verbose);
│ │ │ -
322 setMatrix(matrix);
│ │ │ -
323 }
│ │ │ -
│ │ │ -
324
│ │ │ -
│ │ │ -
334 UMFPack(const Matrix& mat_, const ParameterTree& config)
│ │ │ -
335 : UMFPack(mat_, config.get<int>("verbose", 0))
│ │ │ -
336 {}
│ │ │ -
│ │ │ -
337
│ │ │ -
│ │ │ -
340 UMFPack() : matrixIsLoaded_(false), verbosity_(0)
│ │ │ -
341 {
│ │ │ -
342 //check whether T is a supported type
│ │ │ -
343 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
344 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
345 Caller::defaults(UMF_Control);
│ │ │ -
346 }
│ │ │ -
│ │ │ -
347
│ │ │ -
│ │ │ -
358 UMFPack(const Matrix& mat_, const char* file, int verbose=0)
│ │ │ -
359 {
│ │ │ -
360 //check whether T is a supported type
│ │ │ -
361 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
362 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
363 Caller::defaults(UMF_Control);
│ │ │ -
364 setVerbosity(verbose);
│ │ │ -
365 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ -
366 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == UMFPACK_ERROR_file_IO))
│ │ │ -
367 {
│ │ │ -
368 matrixIsLoaded_ = false;
│ │ │ -
369 setMatrix(mat_);
│ │ │ -
370 saveDecomposition(file);
│ │ │ -
371 }
│ │ │ -
372 else
│ │ │ -
373 {
│ │ │ -
374 matrixIsLoaded_ = true;
│ │ │ -
375 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ -
376 }
│ │ │ -
377 }
│ │ │ -
│ │ │ -
378
│ │ │ -
│ │ │ -
385 UMFPack(const char* file, int verbose=0)
│ │ │ -
386 {
│ │ │ -
387 //check whether T is a supported type
│ │ │ -
388 static_assert((std::is_same<T,double>::value) || (std::is_same<T,std::complex<double> >::value),
│ │ │ -
389 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
390 Caller::defaults(UMF_Control);
│ │ │ -
391 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast<char*>(file));
│ │ │ -
392 if (errcode == UMFPACK_ERROR_out_of_memory)
│ │ │ -
393 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack decomposition");
│ │ │ -
394 if (errcode == UMFPACK_ERROR_file_IO)
│ │ │ -
395 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack decomposition");
│ │ │ -
396 matrixIsLoaded_ = true;
│ │ │ -
397 std::cout << "UMFPack decomposition successfully loaded from " << file << std::endl;
│ │ │ -
398 setVerbosity(verbose);
│ │ │ -
399 }
│ │ │ -
│ │ │ -
400
│ │ │ -
│ │ │ -
401 virtual ~UMFPack()
│ │ │ -
402 {
│ │ │ -
403 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
404 free();
│ │ │ -
405 }
│ │ │ -
│ │ │ -
406
│ │ │ -
│ │ │ - │ │ │ -
411 {
│ │ │ -
412 if (umfpackMatrix_.N() != b.dim())
│ │ │ -
413 DUNE_THROW(Dune::ISTLError, "Size of right-hand-side vector b does not match the number of matrix rows!");
│ │ │ -
414 if (umfpackMatrix_.M() != x.dim())
│ │ │ -
415 DUNE_THROW(Dune::ISTLError, "Size of solution vector x does not match the number of matrix columns!");
│ │ │ -
416 if (b.size() == 0)
│ │ │ -
417 return;
│ │ │ -
418
│ │ │ -
419 // we have to convert x and b into flat structures
│ │ │ -
420 // however, this is linear in time
│ │ │ -
421 std::vector<T> xFlat(x.dim()), bFlat(b.dim());
│ │ │ -
422
│ │ │ -
423 flatVectorForEach(x, [&](auto&& entry, auto&& offset)
│ │ │ -
424 {
│ │ │ -
425 xFlat[ offset ] = entry;
│ │ │ -
426 });
│ │ │ -
427
│ │ │ -
428 flatVectorForEach(b, [&](auto&& entry, auto&& offset)
│ │ │ -
429 {
│ │ │ -
430 bFlat[ offset ] = entry;
│ │ │ -
431 });
│ │ │ -
432
│ │ │ -
433 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ -
434 Caller::solve(UMFPACK_A,
│ │ │ -
435 umfpackMatrix_.getColStart(),
│ │ │ -
436 umfpackMatrix_.getRowIndex(),
│ │ │ -
437 umfpackMatrix_.getValues(),
│ │ │ -
438 reinterpret_cast<double*>(&xFlat[0]),
│ │ │ -
439 reinterpret_cast<double*>(&bFlat[0]),
│ │ │ -
440 UMF_Numeric,
│ │ │ -
441 UMF_Control,
│ │ │ -
442 UMF_Apply_Info);
│ │ │ -
443
│ │ │ -
444 // copy back to blocked vector
│ │ │ -
445 flatVectorForEach(x, [&](auto&& entry, auto offset)
│ │ │ -
446 {
│ │ │ -
447 entry = xFlat[offset];
│ │ │ -
448 });
│ │ │ -
449
│ │ │ -
450 //this is a direct solver
│ │ │ -
451 res.iterations = 1;
│ │ │ -
452 res.converged = true;
│ │ │ -
453 res.elapsed = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME];
│ │ │ -
454
│ │ │ -
455 printOnApply(UMF_Apply_Info);
│ │ │ -
456 }
│ │ │ -
│ │ │ -
457
│ │ │ -
│ │ │ -
461 void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ -
462 {
│ │ │ -
463 apply(x,b,res);
│ │ │ -
464 }
│ │ │ -
│ │ │ -
465
│ │ │ -
│ │ │ -
473 void apply(T* x, T* b)
│ │ │ -
474 {
│ │ │ -
475 double UMF_Apply_Info[UMFPACK_INFO];
│ │ │ -
476 Caller::solve(UMFPACK_A,
│ │ │ -
477 umfpackMatrix_.getColStart(),
│ │ │ -
478 umfpackMatrix_.getRowIndex(),
│ │ │ -
479 umfpackMatrix_.getValues(),
│ │ │ -
480 x,
│ │ │ -
481 b,
│ │ │ -
482 UMF_Numeric,
│ │ │ -
483 UMF_Control,
│ │ │ -
484 UMF_Apply_Info);
│ │ │ -
485 printOnApply(UMF_Apply_Info);
│ │ │ -
486 }
│ │ │ -
│ │ │ -
487
│ │ │ -
│ │ │ -
499 void setOption(unsigned int option, double value)
│ │ │ -
500 {
│ │ │ -
501 if (option >= UMFPACK_CONTROL)
│ │ │ -
502 DUNE_THROW(RangeError, "Requested non-existing UMFPack option");
│ │ │ -
503
│ │ │ -
504 UMF_Control[option] = value;
│ │ │ -
505 }
│ │ │ -
│ │ │ -
506
│ │ │ -
│ │ │ -
510 void saveDecomposition(const char* file)
│ │ │ -
511 {
│ │ │ -
512 int errcode = Caller::save_numeric(UMF_Numeric, const_cast<char*>(file));
│ │ │ -
513 if (errcode != UMFPACK_OK)
│ │ │ -
514 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack decomposition");
│ │ │ -
515 }
│ │ │ -
│ │ │ -
516
│ │ │ -
526 template<class BitVector = Impl::NoBitVector>
│ │ │ -
│ │ │ -
527 void setMatrix(const Matrix& matrix, const BitVector& bitVector = {})
│ │ │ -
528 {
│ │ │ -
529 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
530 free();
│ │ │ -
531 if (matrix.N() == 0 or matrix.M() == 0)
│ │ │ -
532 return;
│ │ │ -
533
│ │ │ -
534 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ -
535 umfpackMatrix_.free();
│ │ │ -
536
│ │ │ -
537 constexpr bool useBitVector = not std::is_same_v<BitVector,Impl::NoBitVector>;
│ │ │ -
538
│ │ │ -
539 // use a dynamic flat vector for the bitset
│ │ │ -
540 std::vector<bool> flatBitVector;
│ │ │ -
541 // and a mapping from the compressed indices
│ │ │ -
542 std::vector<size_type> subIndices;
│ │ │ -
543
│ │ │ -
544 [[maybe_unused]] int numberOfIgnoredDofs = 0;
│ │ │ -
545 int nonZeros = 0;
│ │ │ -
546
│ │ │ -
547 if constexpr ( useBitVector )
│ │ │ -
548 {
│ │ │ -
549 auto flatSize = flatVectorForEach(bitVector, [](auto&&, auto&&){});
│ │ │ -
550 flatBitVector.resize(flatSize);
│ │ │ -
551
│ │ │ -
552 flatVectorForEach(bitVector, [&](auto&& entry, auto&& offset)
│ │ │ -
553 {
│ │ │ -
554 flatBitVector[ offset ] = entry;
│ │ │ -
555 if ( entry )
│ │ │ -
556 {
│ │ │ -
557 numberOfIgnoredDofs++;
│ │ │ -
558 }
│ │ │ -
559 });
│ │ │ -
560 }
│ │ │ -
561
│ │ │ -
562 // compute the flat dimension and the number of nonzeros of the matrix
│ │ │ -
563 auto [flatRows,flatCols] = flatMatrixForEach( matrix, [&](auto&& /*entry*/, auto&& row, auto&& col){
│ │ │ -
564 // do not count ignored entries
│ │ │ -
565 if constexpr ( useBitVector )
│ │ │ -
566 if ( flatBitVector[row] or flatBitVector[col] )
│ │ │ -
567 return;
│ │ │ -
568
│ │ │ -
569 nonZeros++;
│ │ │ -
570 });
│ │ │ -
571
│ │ │ -
572 if constexpr ( useBitVector )
│ │ │ -
573 {
│ │ │ -
574 // use the original flatRows!
│ │ │ -
575 subIndices.resize(flatRows,std::numeric_limits<std::size_t>::max());
│ │ │ -
576
│ │ │ -
577 size_type subIndexCounter = 0;
│ │ │ -
578 for ( size_type i=0; i<size_type(flatRows); i++ )
│ │ │ -
579 if ( not flatBitVector[ i ] )
│ │ │ -
580 subIndices[ i ] = subIndexCounter++;
│ │ │ -
581
│ │ │ -
582 // update the original matrix size
│ │ │ -
583 flatRows -= numberOfIgnoredDofs;
│ │ │ -
584 flatCols -= numberOfIgnoredDofs;
│ │ │ -
585 }
│ │ │ -
586
│ │ │ -
587
│ │ │ -
588 umfpackMatrix_.setSize(flatRows,flatCols);
│ │ │ -
589 umfpackMatrix_.Nnz_ = nonZeros;
│ │ │ -
590
│ │ │ -
591 // prepare the arrays
│ │ │ -
592 umfpackMatrix_.colstart = new size_type[flatCols+1];
│ │ │ -
593 umfpackMatrix_.rowindex = new size_type[nonZeros];
│ │ │ -
594 umfpackMatrix_.values = new T[nonZeros];
│ │ │ -
595
│ │ │ -
596 for ( size_type i=0; i<size_type(flatCols+1); i++ )
│ │ │ -
597 {
│ │ │ -
598 umfpackMatrix_.colstart[i] = 0;
│ │ │ -
599 }
│ │ │ -
600
│ │ │ -
601 // at first, we need to compute the column start indices
│ │ │ -
602 // therefore, we count all entries in each column and in the end we accumulate everything
│ │ │ -
603 flatMatrixForEach(matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& flatColIndex)
│ │ │ -
604 {
│ │ │ -
605 // do nothing if entry is excluded
│ │ │ -
606 if constexpr ( useBitVector )
│ │ │ -
607 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] )
│ │ │ -
608 return;
│ │ │ -
609
│ │ │ -
610 // pick compressed or uncompressed index
│ │ │ -
611 // compiler will hopefully do some constexpr optimization here
│ │ │ -
612 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex;
│ │ │ -
613
│ │ │ -
614 umfpackMatrix_.colstart[colIdx+1]++;
│ │ │ -
615 });
│ │ │ -
616
│ │ │ -
617 // now accumulate
│ │ │ -
618 for ( size_type i=0; i<(size_type)flatCols; i++ )
│ │ │ -
619 {
│ │ │ -
620 umfpackMatrix_.colstart[i+1] += umfpackMatrix_.colstart[i];
│ │ │ -
621 }
│ │ │ -
622
│ │ │ -
623 // we need a compressed position counter in each column
│ │ │ -
624 std::vector<size_type> colPosition(flatCols,0);
│ │ │ -
625
│ │ │ -
626 // now we can set the entries: the procedure below works with both row- or column major index ordering
│ │ │ -
627 flatMatrixForEach(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& flatColIndex)
│ │ │ -
628 {
│ │ │ -
629 // do nothing if entry is excluded
│ │ │ -
630 if constexpr ( useBitVector )
│ │ │ -
631 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] )
│ │ │ -
632 return;
│ │ │ -
633
│ │ │ -
634 // pick compressed or uncompressed index
│ │ │ -
635 // compiler will hopefully do some constexpr optimization here
│ │ │ -
636 auto rowIdx = useBitVector ? subIndices[flatRowIndex] : flatRowIndex;
│ │ │ -
637 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex;
│ │ │ -
638
│ │ │ -
639 // the start index of each column is already fixed
│ │ │ -
640 auto colStart = umfpackMatrix_.colstart[colIdx];
│ │ │ -
641 // get the current number of picked elements in this column
│ │ │ -
642 auto colPos = colPosition[colIdx];
│ │ │ -
643 // assign the corresponding row index and the value of this element
│ │ │ -
644 umfpackMatrix_.rowindex[ colStart + colPos ] = rowIdx;
│ │ │ -
645 umfpackMatrix_.values[ colStart + colPos ] = entry;
│ │ │ -
646 // increase the number of picked elements in this column
│ │ │ -
647 colPosition[colIdx]++;
│ │ │ -
648 });
│ │ │ -
649
│ │ │ -
650 decompose();
│ │ │ -
651 }
│ │ │ -
│ │ │ -
652
│ │ │ -
653 // Keep legacy version using a set of scalar indices
│ │ │ -
654 // The new version using a bitVector type for marking the active matrix indices is
│ │ │ -
655 // directly given in `setMatrix` with an additional BitVector argument.
│ │ │ -
656 // The new version is more flexible and allows, e.g., marking single components of a matrix block.
│ │ │ -
│ │ │ -
657 void setSubMatrix(const Matrix& _mat, const std::set<typename Matrix::size_type>& rowIndexSet)
│ │ │ -
658 {
│ │ │ -
659 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_)
│ │ │ -
660 free();
│ │ │ -
661
│ │ │ -
662 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != 0)
│ │ │ -
663 umfpackMatrix_.free();
│ │ │ -
664
│ │ │ -
665 umfpackMatrix_.setSize(rowIndexSet.size()*MatrixDimension<Matrix>::rowdim(_mat) / _mat.N(),
│ │ │ -
666 rowIndexSet.size()*MatrixDimension<Matrix>::coldim(_mat) / _mat.M());
│ │ │ -
667 ISTL::Impl::BCCSMatrixInitializer<Matrix, SuiteSparse_long> initializer(umfpackMatrix_);
│ │ │ -
668
│ │ │ -
669 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<typename Matrix::size_type> >(_mat,rowIndexSet));
│ │ │ -
670
│ │ │ -
671 decompose();
│ │ │ -
672 }
│ │ │ -
│ │ │ -
673
│ │ │ -
│ │ │ -
681 void setVerbosity(int v)
│ │ │ -
682 {
│ │ │ -
683 verbosity_ = v;
│ │ │ -
684 // set the verbosity level in UMFPack
│ │ │ -
685 if (verbosity_ == 0)
│ │ │ -
686 UMF_Control[UMFPACK_PRL] = 1;
│ │ │ -
687 if (verbosity_ == 1)
│ │ │ -
688 UMF_Control[UMFPACK_PRL] = 2;
│ │ │ -
689 if (verbosity_ == 2)
│ │ │ -
690 UMF_Control[UMFPACK_PRL] = 4;
│ │ │ -
691 }
│ │ │ -
│ │ │ -
692
│ │ │ -
│ │ │ - │ │ │ -
698 {
│ │ │ -
699 return UMF_Numeric;
│ │ │ -
700 }
│ │ │ -
│ │ │ -
701
│ │ │ -
│ │ │ - │ │ │ -
707 {
│ │ │ -
708 return umfpackMatrix_;
│ │ │ -
709 }
│ │ │ -
│ │ │ -
710
│ │ │ -
│ │ │ -
715 void free()
│ │ │ -
716 {
│ │ │ -
717 if (!matrixIsLoaded_)
│ │ │ -
718 {
│ │ │ -
719 Caller::free_symbolic(&UMF_Symbolic);
│ │ │ -
720 umfpackMatrix_.free();
│ │ │ -
721 }
│ │ │ -
722 Caller::free_numeric(&UMF_Numeric);
│ │ │ -
723 matrixIsLoaded_ = false;
│ │ │ -
724 }
│ │ │ -
│ │ │ -
725
│ │ │ -
726 const char* name() { return "UMFPACK"; }
│ │ │ -
727
│ │ │ -
728 private:
│ │ │ -
729 typedef typename Dune::UMFPackMethodChooser<T> Caller;
│ │ │ -
730
│ │ │ -
731 template<class Mat,class X, class TM, class TD, class T1>
│ │ │ - │ │ │ - │ │ │ -
734
│ │ │ -
736 void decompose()
│ │ │ -
737 {
│ │ │ -
738 double UMF_Decomposition_Info[UMFPACK_INFO];
│ │ │ -
739 Caller::symbolic(static_cast<SuiteSparse_long>(umfpackMatrix_.N()),
│ │ │ -
740 static_cast<SuiteSparse_long>(umfpackMatrix_.N()),
│ │ │ -
741 umfpackMatrix_.getColStart(),
│ │ │ -
742 umfpackMatrix_.getRowIndex(),
│ │ │ -
743 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ -
744 &UMF_Symbolic,
│ │ │ -
745 UMF_Control,
│ │ │ -
746 UMF_Decomposition_Info);
│ │ │ -
747 Caller::numeric(umfpackMatrix_.getColStart(),
│ │ │ -
748 umfpackMatrix_.getRowIndex(),
│ │ │ -
749 reinterpret_cast<double*>(umfpackMatrix_.getValues()),
│ │ │ -
750 UMF_Symbolic,
│ │ │ -
751 &UMF_Numeric,
│ │ │ -
752 UMF_Control,
│ │ │ -
753 UMF_Decomposition_Info);
│ │ │ -
754 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]);
│ │ │ -
755 if (verbosity_ == 1)
│ │ │ -
756 {
│ │ │ -
757 std::cout << "[UMFPack Decomposition]" << std::endl;
│ │ │ -
758 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info[UMFPACK_NUMERIC_TIME] << ")" << std::endl;
│ │ │ -
759 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << std::endl;
│ │ │ -
760 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" << std::endl;
│ │ │ -
761 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info[UMFPACK_RCOND] << std::endl;
│ │ │ -
762 std::cout << "Numbers of non-zeroes in decomposition: L: " << UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info[UMFPACK_UNZ] << std::endl;
│ │ │ -
763 }
│ │ │ -
764 if (verbosity_ == 2)
│ │ │ -
765 {
│ │ │ -
766 Caller::report_info(UMF_Control,UMF_Decomposition_Info);
│ │ │ -
767 }
│ │ │ -
768 }
│ │ │ -
769
│ │ │ -
770 void printOnApply(double* UMF_Info)
│ │ │ -
771 {
│ │ │ -
772 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]);
│ │ │ -
773 if (verbosity_ > 0)
│ │ │ -
774 {
│ │ │ -
775 std::cout << "[UMFPack Solve]" << std::endl;
│ │ │ -
776 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " (CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl;
│ │ │ -
777 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl;
│ │ │ -
778 std::cout << "Iterative Refinement steps taken: " << UMF_Info[UMFPACK_IR_TAKEN] << std::endl;
│ │ │ -
779 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << UMF_Info[UMFPACK_OMEGA2] << std::endl;
│ │ │ -
780 }
│ │ │ -
781 }
│ │ │ -
782
│ │ │ -
783 UMFPackMatrix umfpackMatrix_;
│ │ │ -
784 bool matrixIsLoaded_;
│ │ │ -
785 int verbosity_;
│ │ │ -
786 void *UMF_Symbolic;
│ │ │ -
787 void *UMF_Numeric;
│ │ │ -
788 double UMF_Control[UMFPACK_CONTROL];
│ │ │ -
789 };
│ │ │ -
│ │ │ -
790
│ │ │ -
791 template<typename M>
│ │ │ -
│ │ │ - │ │ │ -
793 {
│ │ │ -
794 enum { value=true};
│ │ │ -
795 };
│ │ │ -
│ │ │ -
796
│ │ │ -
797 template<typename T, typename A>
│ │ │ -
│ │ │ - │ │ │ -
799 {
│ │ │ -
800 enum { value = true };
│ │ │ -
801 };
│ │ │ -
│ │ │ -
802
│ │ │ -
│ │ │ -
803 namespace UMFPackImpl {
│ │ │ -
804 template<class OpTraits, class=void> struct isValidBlock : std::false_type{};
│ │ │ -
│ │ │ -
805 template<class OpTraits> struct isValidBlock<OpTraits,
│ │ │ -
806 std::enable_if_t<
│ │ │ -
807 std::is_same_v<Impl::UMFPackDomainType<typename OpTraits::matrix_type>, typename OpTraits::domain_type>
│ │ │ -
808 && std::is_same_v<Impl::UMFPackRangeType<typename OpTraits::matrix_type>, typename OpTraits::range_type>
│ │ │ -
809 && std::is_same_v<typename FieldTraits<typename OpTraits::domain_type::field_type>::real_type, double>
│ │ │ -
810 && std::is_same_v<typename FieldTraits<typename OpTraits::range_type::field_type>::real_type, double>
│ │ │ -
811 >> : std::true_type {};
│ │ │ -
│ │ │ -
812 }
│ │ │ -
│ │ │ - │ │ │ -
814 [](auto opTraits, const auto& op, const Dune::ParameterTree& config)
│ │ │ -
815 -> std::shared_ptr<typename decltype(opTraits)::solver_type>
│ │ │ -
816 {
│ │ │ -
817 using OpTraits = decltype(opTraits);
│ │ │ -
818 // works only for sequential operators
│ │ │ -
819 if constexpr (OpTraits::isParallel){
│ │ │ -
820 if(opTraits.getCommOrThrow(op).communicator().size() > 1)
│ │ │ -
821 DUNE_THROW(Dune::InvalidStateException, "UMFPack works only for sequential operators.");
│ │ │ -
822 }
│ │ │ -
823 if constexpr (OpTraits::isAssembled){
│ │ │ -
824 using M = typename OpTraits::matrix_type;
│ │ │ -
825 // check if UMFPack<M>* is convertible to
│ │ │ -
826 // InverseOperator*. This checks compatibility of the
│ │ │ -
827 // domain and range types
│ │ │ - │ │ │ -
829 const auto& A = opTraits.getAssembledOpOrThrow(op);
│ │ │ -
830 const M& mat = A->getmat();
│ │ │ -
831 int verbose = config.get("verbose", 0);
│ │ │ -
832 return std::make_shared<Dune::UMFPack<M>>(mat,verbose);
│ │ │ -
833 }
│ │ │ -
834 }
│ │ │ -
835 DUNE_THROW(UnsupportedType,
│ │ │ -
836 "Unsupported Type in UMFPack (only double and std::complex<double> supported)");
│ │ │ -
837 return nullptr;
│ │ │ -
838 });
│ │ │ -
839} // end namespace Dune
│ │ │ -
840
│ │ │ -
841#endif // HAVE_SUITESPARSE_UMFPACK
│ │ │ -
842
│ │ │ -
843#endif //DUNE_ISTL_UMFPACK_HH
│ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
#define DUNE_REGISTER_SOLVER(name,...)
Definition solverregistry.hh:16
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
A dynamic dense block matrix class.
│ │ │ - │ │ │ -
Implementation of the BCRSMatrix class.
│ │ │ - │ │ │ -
void setSubMatrix(const Matrix &_mat, const std::set< typename Matrix::size_type > &rowIndexSet)
Definition umfpack.hh:657
│ │ │ -
void free()
free allocated space.
Definition umfpack.hh:715
│ │ │ -
friend class SeqOverlappingSchwarz
Definition umfpack.hh:732
│ │ │ -
SuiteSparse_long size_type
Definition umfpack.hh:269
│ │ │ -
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:167
│ │ │ -
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:161
│ │ │ -
M matrix_type
Definition umfpack.hh:273
│ │ │ -
static void numeric(const size_type *cs, const size_type *ri, const double *val, A... args)
Definition umfpack.hh:141
│ │ │ -
static void report_info(A... args)
Definition umfpack.hh:146
│ │ │ -
UMFPack(const Matrix &mat_, const ParameterTree &config)
Construct a solver object from a matrix.
Definition umfpack.hh:334
│ │ │ -
static int load_numeric(A... args)
Definition umfpack.hh:136
│ │ │ -
static int load_numeric(A... args)
Definition umfpack.hh:78
│ │ │ -
static void report_status(A... args)
Definition umfpack.hh:93
│ │ │ -
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:358
│ │ │ -
Impl::UMFPackRangeType< M > range_type
The type of the range of the solver.
Definition umfpack.hh:281
│ │ │ -
UMFPack()
default constructor
Definition umfpack.hh:340
│ │ │ -
static void symbolic(A... args)
Definition umfpack.hh:108
│ │ │ -
static void report_info(A... args)
Definition umfpack.hh:88
│ │ │ -
static void free_symbolic(A... args)
Definition umfpack.hh:73
│ │ │ -
static int save_numeric(A... args)
Definition umfpack.hh:156
│ │ │ -
static void free_numeric(A... args)
Definition umfpack.hh:126
│ │ │ -
static int save_numeric(A... args)
Definition umfpack.hh:98
│ │ │ -
static void report_status(A... args)
Definition umfpack.hh:151
│ │ │ -
Impl::UMFPackDomainType< M > domain_type
The type of the domain of the solver.
Definition umfpack.hh:279
│ │ │ -
void apply(T *x, T *b)
additional apply method with c-arrays in analogy to superlu
Definition umfpack.hh:473
│ │ │ -
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category).
Definition umfpack.hh:284
│ │ │ -
static void defaults(A... args)
Definition umfpack.hh:121
│ │ │ -
static void free_numeric(A... args)
Definition umfpack.hh:68
│ │ │ -
void setVerbosity(int v)
sets the verbosity level for the UMFPack solver
Definition umfpack.hh:681
│ │ │ -
UMFPack(const char *file, int verbose=0)
try loading a decomposition from file
Definition umfpack.hh:385
│ │ │ -
static void numeric(A... args)
Definition umfpack.hh:83
│ │ │ -
static constexpr bool valid
Definition umfpack.hh:60
│ │ │ -
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res) override
apply inverse operator, with given convergence criteria.
Definition umfpack.hh:461
│ │ │ -
static constexpr bool valid
Definition umfpack.hh:54
│ │ │ -
virtual ~UMFPack()
Definition umfpack.hh:401
│ │ │ -
const char * name()
Definition umfpack.hh:726
│ │ │ -
void setMatrix(const Matrix &matrix, const BitVector &bitVector={})
Initialize data from given matrix.
Definition umfpack.hh:527
│ │ │ -
void saveDecomposition(const char *file)
saves a decomposition to a file
Definition umfpack.hh:510
│ │ │ -
UMFPackMatrix & getInternalMatrix()
Return the column compress matrix from UMFPack.
Definition umfpack.hh:706
│ │ │ -
SuiteSparse_long size_type
Definition umfpack.hh:118
│ │ │ -
UMFPack(const Matrix &matrix, int verbose=0)
Construct a solver object from a matrix.
Definition umfpack.hh:297
│ │ │ -
ISTL::Impl::BCCSMatrixInitializer< M, size_type > MatrixInitializer
Type of an associated initializer class.
Definition umfpack.hh:277
│ │ │ -
ISTL::Impl::BCCSMatrix< typename Matrix::field_type, size_type > UMFPackMatrix
The corresponding (scalar) UMFPack matrix type.
Definition umfpack.hh:275
│ │ │ -
void setOption(unsigned int option, double value)
Set UMFPack-specific options.
Definition umfpack.hh:499
│ │ │ -
static void free_symbolic(A... args)
Definition umfpack.hh:131
│ │ │ -
M Matrix
The matrix type.
Definition umfpack.hh:272
│ │ │ -
static void defaults(A... args)
Definition umfpack.hh:63
│ │ │ -
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition umfpack.hh:410
│ │ │ -
static void solve(A... args)
Definition umfpack.hh:103
│ │ │ -
static constexpr bool valid
Definition umfpack.hh:117
│ │ │ -
UMFPack(const Matrix &matrix, int verbose, bool)
Constructor for compatibility with SuperLU standard constructor.
Definition umfpack.hh:315
│ │ │ -
void * getFactorization()
Return the matrix factorization.
Definition umfpack.hh:697
│ │ │ -
@ value
Definition umfpack.hh:794
│ │ │ - │ │ │ -
STL namespace.
│ │ │ +
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
│ │ │ -
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
│ │ │ -
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ -
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 umfpack.hh:803
│ │ │ -
static auto coldim(const M &)
Definition matrixutils.hh:219
│ │ │ -
static auto rowdim(const M &)
Definition matrixutils.hh:214
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:467
│ │ │ -
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
│ │ │ -
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:97
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
Definition umfpack.hh:53
│ │ │ -
The UMFPack direct sparse solver.
Definition umfpack.hh:265
│ │ │ -
Definition umfpack.hh:804
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1075 +1,100 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -umfpack.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_UMFPACK_HH │ │ │ │ -6#define DUNE_ISTL_UMFPACK_HH │ │ │ │ -7 │ │ │ │ -8#if HAVE_SUITESPARSE_UMFPACK || defined DOXYGEN │ │ │ │ -9 │ │ │ │ -10#include │ │ │ │ -11#include │ │ │ │ -12 │ │ │ │ -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_/_m_a_t_r_i_x_._h_h> │ │ │ │ -21#include<_d_u_n_e_/_i_s_t_l_/_f_o_r_e_a_c_h_._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_m_a_t_r_i_x_._h_h> │ │ │ │ -23#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> │ │ │ │ -24#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_s_._h_h> │ │ │ │ -25#include<_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_t_y_p_e_._h_h> │ │ │ │ -26#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_f_a_c_t_o_r_y_._h_h> │ │ │ │ -27 │ │ │ │ -28 │ │ │ │ -29 │ │ │ │ -30namespace _D_u_n_e { │ │ │ │ -41 │ │ │ │ -42 // FORWARD DECLARATIONS │ │ │ │ -43 template │ │ │ │ -44 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -45 │ │ │ │ -46 template │ │ │ │ -47 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; │ │ │ │ -48 │ │ │ │ -49 // wrapper class for C-Function Calls in the backend. Choose the right │ │ │ │ -function namespace │ │ │ │ -50 // depending on the template parameter used. │ │ │ │ -51 template │ │ │ │ -_5_2 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ -53 { │ │ │ │ -_5_4 static constexpr bool _v_a_l_i_d = false ; │ │ │ │ -55 }; │ │ │ │ -56 │ │ │ │ -57 template<> │ │ │ │ -_5_8 struct _U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ -59 { │ │ │ │ -_6_0 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ -61 │ │ │ │ -62 template │ │ │ │ -_6_3 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ -64 { │ │ │ │ -65 umfpack_dl_defaults(args...); │ │ │ │ -66 } │ │ │ │ -67 template │ │ │ │ -_6_8 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -69 { │ │ │ │ -70 umfpack_dl_free_numeric(args...); │ │ │ │ -71 } │ │ │ │ -72 template │ │ │ │ -_7_3 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ -74 { │ │ │ │ -75 umfpack_dl_free_symbolic(args...); │ │ │ │ +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 │ │ │ │ +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 template │ │ │ │ -_7_8 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ -79 { │ │ │ │ -80 return umfpack_dl_load_numeric(args...); │ │ │ │ -81 } │ │ │ │ -82 template │ │ │ │ -_8_3 static void _n_u_m_e_r_i_c(A... args) │ │ │ │ -84 { │ │ │ │ -85 umfpack_dl_numeric(args...); │ │ │ │ -86 } │ │ │ │ -87 template │ │ │ │ -_8_8 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ -89 { │ │ │ │ -90 umfpack_dl_report_info(args...); │ │ │ │ -91 } │ │ │ │ -92 template │ │ │ │ -_9_3 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ -94 { │ │ │ │ -95 umfpack_dl_report_status(args...); │ │ │ │ -96 } │ │ │ │ -97 template │ │ │ │ -_9_8 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -99 { │ │ │ │ -100 return umfpack_dl_save_numeric(args...); │ │ │ │ -101 } │ │ │ │ -102 template │ │ │ │ -_1_0_3 static void _s_o_l_v_e(A... args) │ │ │ │ -104 { │ │ │ │ -105 umfpack_dl_solve(args...); │ │ │ │ -106 } │ │ │ │ -107 template │ │ │ │ -_1_0_8 static void _s_y_m_b_o_l_i_c(A... args) │ │ │ │ -109 { │ │ │ │ -110 umfpack_dl_symbolic(args...); │ │ │ │ -111 } │ │ │ │ -112 }; │ │ │ │ -113 │ │ │ │ -114 template<> │ │ │ │ -_1_1_5 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 > │ │ │ │ -116 { │ │ │ │ -_1_1_7 static constexpr bool _v_a_l_i_d = true ; │ │ │ │ -_1_1_8 using _s_i_z_e___t_y_p_e = SuiteSparse_long; │ │ │ │ -119 │ │ │ │ -120 template │ │ │ │ -_1_2_1 static void _d_e_f_a_u_l_t_s(A... args) │ │ │ │ -122 { │ │ │ │ -123 umfpack_zl_defaults(args...); │ │ │ │ -124 } │ │ │ │ -125 template │ │ │ │ -_1_2_6 static void _f_r_e_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -127 { │ │ │ │ -128 umfpack_zl_free_numeric(args...); │ │ │ │ -129 } │ │ │ │ -130 template │ │ │ │ -_1_3_1 static void _f_r_e_e___s_y_m_b_o_l_i_c(A... args) │ │ │ │ -132 { │ │ │ │ -133 umfpack_zl_free_symbolic(args...); │ │ │ │ -134 } │ │ │ │ -135 template │ │ │ │ -_1_3_6 static int _l_o_a_d___n_u_m_e_r_i_c(A... args) │ │ │ │ -137 { │ │ │ │ -138 return umfpack_zl_load_numeric(args...); │ │ │ │ -139 } │ │ │ │ -140 template │ │ │ │ -_1_4_1 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) │ │ │ │ -142 { │ │ │ │ -143 umfpack_zl_numeric(cs,ri,val,NULL,args...); │ │ │ │ -144 } │ │ │ │ -145 template │ │ │ │ -_1_4_6 static void _r_e_p_o_r_t___i_n_f_o(A... args) │ │ │ │ -147 { │ │ │ │ -148 umfpack_zl_report_info(args...); │ │ │ │ -149 } │ │ │ │ -150 template │ │ │ │ -_1_5_1 static void _r_e_p_o_r_t___s_t_a_t_u_s(A... args) │ │ │ │ -152 { │ │ │ │ -153 umfpack_zl_report_status(args...); │ │ │ │ -154 } │ │ │ │ -155 template │ │ │ │ -_1_5_6 static int _s_a_v_e___n_u_m_e_r_i_c(A... args) │ │ │ │ -157 { │ │ │ │ -158 return umfpack_zl_save_numeric(args...); │ │ │ │ -159 } │ │ │ │ -160 template │ │ │ │ -_1_6_1 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) │ │ │ │ -162 { │ │ │ │ -163 const double* cval = reinterpret_cast(val); │ │ │ │ -164 umfpack_zl_solve(m,cs,ri,cval,NULL,x,NULL,b,NULL,args...); │ │ │ │ -165 } │ │ │ │ -166 template │ │ │ │ -_1_6_7 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) │ │ │ │ -168 { │ │ │ │ -169 umfpack_zl_symbolic(m,n,cs,ri,val,NULL,args...); │ │ │ │ -170 } │ │ │ │ -171 }; │ │ │ │ -172 │ │ │ │ -173 namespace Impl │ │ │ │ -174 { │ │ │ │ -175 template │ │ │ │ -176 struct UMFPackVectorChooser; │ │ │ │ -177 │ │ │ │ -179 template using UMFPackDomainType = typename │ │ │ │ -UMFPackVectorChooser::domain_type; │ │ │ │ -180 │ │ │ │ -182 template using UMFPackRangeType = typename │ │ │ │ -UMFPackVectorChooser::range_type; │ │ │ │ -183 │ │ │ │ -184 template │ │ │ │ -185 struct UMFPackVectorChooser::value) || (std::is_same >::value)>> │ │ │ │ -187 { │ │ │ │ -188 using domain_type = M; │ │ │ │ -189 using range_type = M; │ │ │ │ -190 }; │ │ │ │ -191 │ │ │ │ -192 template │ │ │ │ -193 struct UMFPackVectorChooser, │ │ │ │ -194 std::enable_if_t<(std::is_same::value) || (std::is_same >::value)>> │ │ │ │ -195 { │ │ │ │ -197 using domain_type = FieldVector; │ │ │ │ -199 using range_type = FieldVector; │ │ │ │ -200 }; │ │ │ │ -201 │ │ │ │ -202 template │ │ │ │ -203 struct UMFPackVectorChooser, │ │ │ │ -204 std::void_t, UMFPackRangeType>> │ │ │ │ -205 { │ │ │ │ -206 // In case of recursive deduction (e.g., BCRSMatrix, │ │ │ │ -Allocator>>) │ │ │ │ -207 // the allocator needs to be converted to the sub-block allocator type too │ │ │ │ -(e.g., Allocator>). │ │ │ │ -208 // Note that matrix allocator is assumed to be the same as the domain/range │ │ │ │ -type of allocators │ │ │ │ -210 using domain_type = BlockVector, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc>>; │ │ │ │ -212 using range_type = BlockVector, typename std:: │ │ │ │ -allocator_traits::template rebind_alloc>>; │ │ │ │ -213 }; │ │ │ │ -214 │ │ │ │ -215 template │ │ │ │ -216 struct UMFPackVectorChooser, │ │ │ │ -217 std::void_t, UMFPackRangeType>> │ │ │ │ -218 : public UMFPackVectorChooser, std:: │ │ │ │ -void_t, UMFPackRangeType>> │ │ │ │ -219 {}; │ │ │ │ -220 │ │ │ │ -221 // to make the `UMFPackVectorChooser` work with `MultiTypeBlockMatrix`, we │ │ │ │ -need to add an intermediate step for the rows, which are typically │ │ │ │ -`MultiTypeBlockVector` │ │ │ │ -222 template │ │ │ │ -223 struct UMFPackVectorChooser, │ │ │ │ -224 std::void_t, UMFPackRangeType, │ │ │ │ -UMFPackDomainType...>> │ │ │ │ -225 { │ │ │ │ -227 using domain_type = MultiTypeBlockVector, │ │ │ │ -UMFPackDomainType...>; │ │ │ │ -229 using range_type = UMFPackRangeType; │ │ │ │ -230 }; │ │ │ │ -231 │ │ │ │ -232 // specialization for `MultiTypeBlockMatrix` with `MultiTypeBlockVector` │ │ │ │ -rows │ │ │ │ -233 template │ │ │ │ -234 struct UMFPackVectorChooser, │ │ │ │ -235 std::void_t, UMFPackRangeType, │ │ │ │ -UMFPackRangeType...>> │ │ │ │ -236 { │ │ │ │ -238 using domain_type = UMFPackDomainType; │ │ │ │ -240 using range_type = MultiTypeBlockVector< UMFPackRangeType, │ │ │ │ -UMFPackRangeType... >; │ │ │ │ -241 }; │ │ │ │ -242 │ │ │ │ -243 // dummy class to represent no BitVector │ │ │ │ -244 struct NoBitVector │ │ │ │ -245 {}; │ │ │ │ -246 │ │ │ │ -247 │ │ │ │ -248 } │ │ │ │ -249 │ │ │ │ -263 template │ │ │ │ -_2_6_4 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> │ │ │ │ -265 { │ │ │ │ -266 using T = typename M::field_type; │ │ │ │ -267 │ │ │ │ -268 public: │ │ │ │ -_2_6_9 using _s_i_z_e___t_y_p_e = SuiteSparse_long; │ │ │ │ -270 │ │ │ │ -_2_7_2 using _M_a_t_r_i_x = M; │ │ │ │ -_2_7_3 using _m_a_t_r_i_x___t_y_p_e = M; │ │ │ │ -_2_7_5 using _U_M_F_P_a_c_k_M_a_t_r_i_x = ISTL::Impl::BCCSMatrix; │ │ │ │ -_2_7_7 using _M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r = ISTL::Impl::BCCSMatrixInitializer; │ │ │ │ -_2_7_9 using _d_o_m_a_i_n___t_y_p_e = Impl::UMFPackDomainType; │ │ │ │ -_2_8_1 using _r_a_n_g_e___t_y_p_e = Impl::UMFPackRangeType; │ │ │ │ -282 │ │ │ │ -_2_8_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 override │ │ │ │ -285 { │ │ │ │ -286 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; │ │ │ │ -287 } │ │ │ │ -288 │ │ │ │ -_2_9_7 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose=0) : matrixIsLoaded_(false) │ │ │ │ -298 { │ │ │ │ -299 //check whether T is a supported type │ │ │ │ -300 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -301 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -302 Caller::defaults(UMF_Control); │ │ │ │ -303 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -304 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ -305 } │ │ │ │ -306 │ │ │ │ -_3_1_5 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& matrix, int verbose, bool) : matrixIsLoaded_(false) │ │ │ │ -316 { │ │ │ │ -317 //check whether T is a supported type │ │ │ │ -318 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -319 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -320 Caller::defaults(UMF_Control); │ │ │ │ -321 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -322 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ -323 } │ │ │ │ -324 │ │ │ │ -_3_3_4 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const ParameterTree& config) │ │ │ │ -335 : _U_M_F_P_a_c_k(mat_, config._g_e_t("verbose", 0)) │ │ │ │ -336 {} │ │ │ │ -337 │ │ │ │ -_3_4_0 _U_M_F_P_a_c_k() : matrixIsLoaded_(false), verbosity_(0) │ │ │ │ -341 { │ │ │ │ -342 //check whether T is a supported type │ │ │ │ -343 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -344 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -345 Caller::defaults(UMF_Control); │ │ │ │ -346 } │ │ │ │ -347 │ │ │ │ -_3_5_8 _U_M_F_P_a_c_k(const _M_a_t_r_i_x& mat_, const char* file, int verbose=0) │ │ │ │ -359 { │ │ │ │ -360 //check whether T is a supported type │ │ │ │ -361 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -362 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -363 Caller::defaults(UMF_Control); │ │ │ │ -364 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -365 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ -366 if ((errcode == UMFPACK_ERROR_out_of_memory) || (errcode == │ │ │ │ -UMFPACK_ERROR_file_IO)) │ │ │ │ -367 { │ │ │ │ -368 matrixIsLoaded_ = false; │ │ │ │ -369 _s_e_t_M_a_t_r_i_x(mat_); │ │ │ │ -370 _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(file); │ │ │ │ -371 } │ │ │ │ -372 else │ │ │ │ -373 { │ │ │ │ -374 matrixIsLoaded_ = true; │ │ │ │ -375 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ -std::endl; │ │ │ │ -376 } │ │ │ │ -377 } │ │ │ │ -378 │ │ │ │ -_3_8_5 _U_M_F_P_a_c_k(const char* file, int verbose=0) │ │ │ │ -386 { │ │ │ │ -387 //check whether T is a supported type │ │ │ │ -388 static_assert((std::is_same::value) || (std::is_same >::value), │ │ │ │ -389 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -390 Caller::defaults(UMF_Control); │ │ │ │ -391 int errcode = Caller::load_numeric(&UMF_Numeric, const_cast(file)); │ │ │ │ -392 if (errcode == UMFPACK_ERROR_out_of_memory) │ │ │ │ -393 DUNE_THROW(Dune::Exception, "ran out of memory while loading UMFPack │ │ │ │ -decomposition"); │ │ │ │ -394 if (errcode == UMFPACK_ERROR_file_IO) │ │ │ │ -395 DUNE_THROW(Dune::Exception, "IO error while loading UMFPack │ │ │ │ -decomposition"); │ │ │ │ -396 matrixIsLoaded_ = true; │ │ │ │ -397 std::cout << "UMFPack decomposition successfully loaded from " << file << │ │ │ │ -std::endl; │ │ │ │ -398 _s_e_t_V_e_r_b_o_s_i_t_y(verbose); │ │ │ │ -399 } │ │ │ │ -400 │ │ │ │ -_4_0_1 virtual _~_U_M_F_P_a_c_k() │ │ │ │ -402 { │ │ │ │ -403 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -404 _f_r_e_e(); │ │ │ │ -405 } │ │ │ │ -406 │ │ │ │ -_4_1_0 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) │ │ │ │ -override │ │ │ │ -411 { │ │ │ │ -412 if (umfpackMatrix_.N() != b.dim()) │ │ │ │ -413 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!"); │ │ │ │ -414 if (umfpackMatrix_.M() != x.dim()) │ │ │ │ -415 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!"); │ │ │ │ -416 if (b.size() == 0) │ │ │ │ -417 return; │ │ │ │ -418 │ │ │ │ -419 // we have to convert x and b into flat structures │ │ │ │ -420 // however, this is linear in time │ │ │ │ -421 std::vector xFlat(x.dim()), bFlat(b.dim()); │ │ │ │ -422 │ │ │ │ -423 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(x, [&](auto&& entry, auto&& offset) │ │ │ │ -424 { │ │ │ │ -425 xFlat[ offset ] = entry; │ │ │ │ -426 }); │ │ │ │ -427 │ │ │ │ -428 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(b, [&](auto&& entry, auto&& offset) │ │ │ │ -429 { │ │ │ │ -430 bFlat[ offset ] = entry; │ │ │ │ -431 }); │ │ │ │ -432 │ │ │ │ -433 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ -434 Caller::solve(UMFPACK_A, │ │ │ │ -435 umfpackMatrix_.getColStart(), │ │ │ │ -436 umfpackMatrix_.getRowIndex(), │ │ │ │ -437 umfpackMatrix_.getValues(), │ │ │ │ -438 reinterpret_cast(&xFlat[0]), │ │ │ │ -439 reinterpret_cast(&bFlat[0]), │ │ │ │ -440 UMF_Numeric, │ │ │ │ -441 UMF_Control, │ │ │ │ -442 UMF_Apply_Info); │ │ │ │ -443 │ │ │ │ -444 // copy back to blocked vector │ │ │ │ -445 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(x, [&](auto&& entry, auto offset) │ │ │ │ -446 { │ │ │ │ -447 entry = xFlat[offset]; │ │ │ │ -448 }); │ │ │ │ -449 │ │ │ │ -450 //this is a direct solver │ │ │ │ -451 res._i_t_e_r_a_t_i_o_n_s = 1; │ │ │ │ -452 res._c_o_n_v_e_r_g_e_d = true; │ │ │ │ -453 res._e_l_a_p_s_e_d = UMF_Apply_Info[UMFPACK_SOLVE_WALLTIME]; │ │ │ │ -454 │ │ │ │ -455 printOnApply(UMF_Apply_Info); │ │ │ │ -456 } │ │ │ │ -457 │ │ │ │ -_4_6_1 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) override │ │ │ │ -462 { │ │ │ │ -463 _a_p_p_l_y(x,b,res); │ │ │ │ -464 } │ │ │ │ -465 │ │ │ │ -_4_7_3 void _a_p_p_l_y(T* x, T* b) │ │ │ │ -474 { │ │ │ │ -475 double UMF_Apply_Info[UMFPACK_INFO]; │ │ │ │ -476 Caller::solve(UMFPACK_A, │ │ │ │ -477 umfpackMatrix_.getColStart(), │ │ │ │ -478 umfpackMatrix_.getRowIndex(), │ │ │ │ -479 umfpackMatrix_.getValues(), │ │ │ │ -480 x, │ │ │ │ -481 b, │ │ │ │ -482 UMF_Numeric, │ │ │ │ -483 UMF_Control, │ │ │ │ -484 UMF_Apply_Info); │ │ │ │ -485 printOnApply(UMF_Apply_Info); │ │ │ │ -486 } │ │ │ │ -487 │ │ │ │ -_4_9_9 void _s_e_t_O_p_t_i_o_n(unsigned int option, double value) │ │ │ │ -500 { │ │ │ │ -501 if (option >= UMFPACK_CONTROL) │ │ │ │ -502 DUNE_THROW(RangeError, "Requested non-existing UMFPack option"); │ │ │ │ -503 │ │ │ │ -504 UMF_Control[option] = value; │ │ │ │ -505 } │ │ │ │ -506 │ │ │ │ -_5_1_0 void _s_a_v_e_D_e_c_o_m_p_o_s_i_t_i_o_n(const char* file) │ │ │ │ -511 { │ │ │ │ -512 int errcode = Caller::save_numeric(UMF_Numeric, const_cast(file)); │ │ │ │ -513 if (errcode != UMFPACK_OK) │ │ │ │ -514 DUNE_THROW(Dune::Exception,"IO ERROR while trying to save UMFPack │ │ │ │ -decomposition"); │ │ │ │ -515 } │ │ │ │ -516 │ │ │ │ -526 template │ │ │ │ -_5_2_7 void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& matrix, const BitVector& bitVector = {}) │ │ │ │ -528 { │ │ │ │ -529 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -530 _f_r_e_e(); │ │ │ │ -531 if (matrix.N() == 0 or matrix.M() == 0) │ │ │ │ -532 return; │ │ │ │ -533 │ │ │ │ -534 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ -0) │ │ │ │ -535 umfpackMatrix_.free(); │ │ │ │ -536 │ │ │ │ -537 constexpr bool useBitVector = not std::is_same_v; │ │ │ │ -538 │ │ │ │ -539 // use a dynamic flat vector for the bitset │ │ │ │ -540 std::vector flatBitVector; │ │ │ │ -541 // and a mapping from the compressed indices │ │ │ │ -542 std::vector subIndices; │ │ │ │ -543 │ │ │ │ -544 [[maybe_unused]] int numberOfIgnoredDofs = 0; │ │ │ │ -545 int nonZeros = 0; │ │ │ │ -546 │ │ │ │ -547 if constexpr ( useBitVector ) │ │ │ │ -548 { │ │ │ │ -549 auto flatSize = _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(bitVector, [](auto&&, auto&&){}); │ │ │ │ -550 flatBitVector.resize(flatSize); │ │ │ │ -551 │ │ │ │ -552 _f_l_a_t_V_e_c_t_o_r_F_o_r_E_a_c_h(bitVector, [&](auto&& entry, auto&& offset) │ │ │ │ -553 { │ │ │ │ -554 flatBitVector[ offset ] = entry; │ │ │ │ -555 if ( entry ) │ │ │ │ -556 { │ │ │ │ -557 numberOfIgnoredDofs++; │ │ │ │ -558 } │ │ │ │ -559 }); │ │ │ │ -560 } │ │ │ │ -561 │ │ │ │ -562 // compute the flat dimension and the number of nonzeros of the matrix │ │ │ │ -563 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){ │ │ │ │ -564 // do not count ignored entries │ │ │ │ -565 if constexpr ( useBitVector ) │ │ │ │ -566 if ( flatBitVector[row] or flatBitVector[_c_o_l] ) │ │ │ │ -567 return; │ │ │ │ -568 │ │ │ │ -569 nonZeros++; │ │ │ │ -570 }); │ │ │ │ -571 │ │ │ │ -572 if constexpr ( useBitVector ) │ │ │ │ -573 { │ │ │ │ -574 // use the original flatRows! │ │ │ │ -575 subIndices.resize(flatRows,std::numeric_limits::max()); │ │ │ │ -576 │ │ │ │ -577 _s_i_z_e___t_y_p_e subIndexCounter = 0; │ │ │ │ -578 for ( _s_i_z_e___t_y_p_e i=0; i<_s_i_z_e___t_y_p_e(flatRows); i++ ) │ │ │ │ -579 if ( not flatBitVector[ i ] ) │ │ │ │ -580 subIndices[ i ] = subIndexCounter++; │ │ │ │ -581 │ │ │ │ -582 // update the original matrix size │ │ │ │ -583 flatRows -= numberOfIgnoredDofs; │ │ │ │ -584 flatCols -= numberOfIgnoredDofs; │ │ │ │ -585 } │ │ │ │ -586 │ │ │ │ -587 │ │ │ │ -588 umfpackMatrix_.setSize(flatRows,flatCols); │ │ │ │ -589 umfpackMatrix_.Nnz_ = nonZeros; │ │ │ │ -590 │ │ │ │ -591 // prepare the arrays │ │ │ │ -592 umfpackMatrix_.colstart = new _s_i_z_e___t_y_p_e[flatCols+1]; │ │ │ │ -593 umfpackMatrix_.rowindex = new _s_i_z_e___t_y_p_e[nonZeros]; │ │ │ │ -594 umfpackMatrix_.values = new T[nonZeros]; │ │ │ │ -595 │ │ │ │ -596 for ( _s_i_z_e___t_y_p_e i=0; i<_s_i_z_e___t_y_p_e(flatCols+1); i++ ) │ │ │ │ -597 { │ │ │ │ -598 umfpackMatrix_.colstart[i] = 0; │ │ │ │ -599 } │ │ │ │ -600 │ │ │ │ -601 // at first, we need to compute the column start indices │ │ │ │ -602 // therefore, we count all entries in each column and in the end we │ │ │ │ -accumulate everything │ │ │ │ -603 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix, [&](auto&& /*entry*/, auto&& flatRowIndex, auto&& │ │ │ │ -flatColIndex) │ │ │ │ -604 { │ │ │ │ -605 // do nothing if entry is excluded │ │ │ │ -606 if constexpr ( useBitVector ) │ │ │ │ -607 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] ) │ │ │ │ -608 return; │ │ │ │ -609 │ │ │ │ -610 // pick compressed or uncompressed index │ │ │ │ -611 // compiler will hopefully do some constexpr optimization here │ │ │ │ -612 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex; │ │ │ │ -613 │ │ │ │ -614 umfpackMatrix_.colstart[colIdx+1]++; │ │ │ │ -615 }); │ │ │ │ -616 │ │ │ │ -617 // now accumulate │ │ │ │ -618 for ( _s_i_z_e___t_y_p_e i=0; i<(_s_i_z_e___t_y_p_e)flatCols; i++ ) │ │ │ │ -619 { │ │ │ │ -620 umfpackMatrix_.colstart[i+1] += umfpackMatrix_.colstart[i]; │ │ │ │ -621 } │ │ │ │ -622 │ │ │ │ -623 // we need a compressed position counter in each column │ │ │ │ -624 std::vector colPosition(flatCols,0); │ │ │ │ -625 │ │ │ │ -626 // now we can set the entries: the procedure below works with both row- or │ │ │ │ -column major index ordering │ │ │ │ -627 _f_l_a_t_M_a_t_r_i_x_F_o_r_E_a_c_h(matrix, [&](auto&& entry, auto&& flatRowIndex, auto&& │ │ │ │ -flatColIndex) │ │ │ │ -628 { │ │ │ │ -629 // do nothing if entry is excluded │ │ │ │ -630 if constexpr ( useBitVector ) │ │ │ │ -631 if ( flatBitVector[flatRowIndex] or flatBitVector[flatColIndex] ) │ │ │ │ -632 return; │ │ │ │ -633 │ │ │ │ -634 // pick compressed or uncompressed index │ │ │ │ -635 // compiler will hopefully do some constexpr optimization here │ │ │ │ -636 auto rowIdx = useBitVector ? subIndices[flatRowIndex] : flatRowIndex; │ │ │ │ -637 auto colIdx = useBitVector ? subIndices[flatColIndex] : flatColIndex; │ │ │ │ -638 │ │ │ │ -639 // the start index of each column is already fixed │ │ │ │ -640 auto colStart = umfpackMatrix_.colstart[colIdx]; │ │ │ │ -641 // get the current number of picked elements in this column │ │ │ │ -642 auto colPos = colPosition[colIdx]; │ │ │ │ -643 // assign the corresponding row index and the value of this element │ │ │ │ -644 umfpackMatrix_.rowindex[ colStart + colPos ] = rowIdx; │ │ │ │ -645 umfpackMatrix_.values[ colStart + colPos ] = entry; │ │ │ │ -646 // increase the number of picked elements in this column │ │ │ │ -647 colPosition[colIdx]++; │ │ │ │ -648 }); │ │ │ │ -649 │ │ │ │ -650 decompose(); │ │ │ │ -651 } │ │ │ │ -652 │ │ │ │ -653 // Keep legacy version using a set of scalar indices │ │ │ │ -654 // The new version using a bitVector type for marking the active matrix │ │ │ │ -indices is │ │ │ │ -655 // directly given in `setMatrix` with an additional BitVector argument. │ │ │ │ -656 // The new version is more flexible and allows, e.g., marking single │ │ │ │ -components of a matrix block. │ │ │ │ -_6_5_7 void _s_e_t_S_u_b_M_a_t_r_i_x(const _M_a_t_r_i_x& _mat, const std::set& rowIndexSet) │ │ │ │ -658 { │ │ │ │ -659 if ((umfpackMatrix_.N() + umfpackMatrix_.M() > 0) || matrixIsLoaded_) │ │ │ │ -660 _f_r_e_e(); │ │ │ │ -661 │ │ │ │ -662 if (umfpackMatrix_.N() + umfpackMatrix_.M() + umfpackMatrix_.nonzeroes() != │ │ │ │ -0) │ │ │ │ -663 umfpackMatrix_.free(); │ │ │ │ -664 │ │ │ │ -665 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(), │ │ │ │ -666 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()); │ │ │ │ -667 ISTL::Impl::BCCSMatrixInitializer initializer │ │ │ │ -(umfpackMatrix_); │ │ │ │ -668 │ │ │ │ -669 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ -set >(_mat,rowIndexSet)); │ │ │ │ -670 │ │ │ │ -671 decompose(); │ │ │ │ -672 } │ │ │ │ -673 │ │ │ │ -_6_8_1 void _s_e_t_V_e_r_b_o_s_i_t_y(int v) │ │ │ │ -682 { │ │ │ │ -683 verbosity_ = v; │ │ │ │ -684 // set the verbosity level in UMFPack │ │ │ │ -685 if (verbosity_ == 0) │ │ │ │ -686 UMF_Control[UMFPACK_PRL] = 1; │ │ │ │ -687 if (verbosity_ == 1) │ │ │ │ -688 UMF_Control[UMFPACK_PRL] = 2; │ │ │ │ -689 if (verbosity_ == 2) │ │ │ │ -690 UMF_Control[UMFPACK_PRL] = 4; │ │ │ │ -691 } │ │ │ │ -692 │ │ │ │ -_6_9_7 void* _g_e_t_F_a_c_t_o_r_i_z_a_t_i_o_n() │ │ │ │ -698 { │ │ │ │ -699 return UMF_Numeric; │ │ │ │ -700 } │ │ │ │ -701 │ │ │ │ -_7_0_6 _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() │ │ │ │ -707 { │ │ │ │ -708 return umfpackMatrix_; │ │ │ │ -709 } │ │ │ │ -710 │ │ │ │ -_7_1_5 void _f_r_e_e() │ │ │ │ -716 { │ │ │ │ -717 if (!matrixIsLoaded_) │ │ │ │ -718 { │ │ │ │ -719 Caller::free_symbolic(&UMF_Symbolic); │ │ │ │ -720 umfpackMatrix_.free(); │ │ │ │ -721 } │ │ │ │ -722 Caller::free_numeric(&UMF_Numeric); │ │ │ │ -723 matrixIsLoaded_ = false; │ │ │ │ -724 } │ │ │ │ -725 │ │ │ │ -_7_2_6 const char* _n_a_m_e() { return "UMFPACK"; } │ │ │ │ -727 │ │ │ │ -728 private: │ │ │ │ -729 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; │ │ │ │ -730 │ │ │ │ -731 template │ │ │ │ -_7_3_2 friend class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -733 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>; │ │ │ │ -734 │ │ │ │ -736 void decompose() │ │ │ │ -737 { │ │ │ │ -738 double UMF_Decomposition_Info[UMFPACK_INFO]; │ │ │ │ -739 Caller::symbolic(static_cast(umfpackMatrix_.N()), │ │ │ │ -740 static_cast(umfpackMatrix_.N()), │ │ │ │ -741 umfpackMatrix_.getColStart(), │ │ │ │ -742 umfpackMatrix_.getRowIndex(), │ │ │ │ -743 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ -744 &UMF_Symbolic, │ │ │ │ -745 UMF_Control, │ │ │ │ -746 UMF_Decomposition_Info); │ │ │ │ -747 Caller::numeric(umfpackMatrix_.getColStart(), │ │ │ │ -748 umfpackMatrix_.getRowIndex(), │ │ │ │ -749 reinterpret_cast(umfpackMatrix_.getValues()), │ │ │ │ -750 UMF_Symbolic, │ │ │ │ -751 &UMF_Numeric, │ │ │ │ -752 UMF_Control, │ │ │ │ -753 UMF_Decomposition_Info); │ │ │ │ -754 Caller::report_status(UMF_Control,UMF_Decomposition_Info[UMFPACK_STATUS]); │ │ │ │ -755 if (verbosity_ == 1) │ │ │ │ -756 { │ │ │ │ -757 std::cout << "[UMFPack Decomposition]" << std::endl; │ │ │ │ -758 std::cout << "Wallclock Time taken: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_NUMERIC_WALLTIME] << " (CPU Time: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_NUMERIC_TIME] << ")" << std::endl; │ │ │ │ -759 std::cout << "Flops taken: " << UMF_Decomposition_Info[UMFPACK_FLOPS] << │ │ │ │ -std::endl; │ │ │ │ -760 std::cout << "Peak Memory Usage: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_PEAK_MEMORY]*UMF_Decomposition_Info[UMFPACK_SIZE_OF_UNIT] << " bytes" │ │ │ │ -<< std::endl; │ │ │ │ -761 std::cout << "Condition number estimate: " << 1./UMF_Decomposition_Info │ │ │ │ -[UMFPACK_RCOND] << std::endl; │ │ │ │ -762 std::cout << "Numbers of non-zeroes in decomposition: L: " << │ │ │ │ -UMF_Decomposition_Info[UMFPACK_LNZ] << " U: " << UMF_Decomposition_Info │ │ │ │ -[UMFPACK_UNZ] << std::endl; │ │ │ │ -763 } │ │ │ │ -764 if (verbosity_ == 2) │ │ │ │ -765 { │ │ │ │ -766 Caller::report_info(UMF_Control,UMF_Decomposition_Info); │ │ │ │ -767 } │ │ │ │ -768 } │ │ │ │ -769 │ │ │ │ -770 void printOnApply(double* UMF_Info) │ │ │ │ -771 { │ │ │ │ -772 Caller::report_status(UMF_Control,UMF_Info[UMFPACK_STATUS]); │ │ │ │ -773 if (verbosity_ > 0) │ │ │ │ -774 { │ │ │ │ -775 std::cout << "[UMFPack Solve]" << std::endl; │ │ │ │ -776 std::cout << "Wallclock Time: " << UMF_Info[UMFPACK_SOLVE_WALLTIME] << " │ │ │ │ -(CPU Time: " << UMF_Info[UMFPACK_SOLVE_TIME] << ")" << std::endl; │ │ │ │ -777 std::cout << "Flops Taken: " << UMF_Info[UMFPACK_SOLVE_FLOPS] << std::endl; │ │ │ │ -778 std::cout << "Iterative Refinement steps taken: " << UMF_Info │ │ │ │ -[UMFPACK_IR_TAKEN] << std::endl; │ │ │ │ -779 std::cout << "Error Estimate: " << UMF_Info[UMFPACK_OMEGA1] << " resp. " << │ │ │ │ -UMF_Info[UMFPACK_OMEGA2] << std::endl; │ │ │ │ -780 } │ │ │ │ -781 } │ │ │ │ -782 │ │ │ │ -783 _U_M_F_P_a_c_k_M_a_t_r_i_x umfpackMatrix_; │ │ │ │ -784 bool matrixIsLoaded_; │ │ │ │ -785 int verbosity_; │ │ │ │ -786 void *UMF_Symbolic; │ │ │ │ -787 void *UMF_Numeric; │ │ │ │ -788 double UMF_Control[UMFPACK_CONTROL]; │ │ │ │ -789 }; │ │ │ │ -790 │ │ │ │ -791 template │ │ │ │ -_7_9_2 struct _I_s_D_i_r_e_c_t_S_o_l_v_e_r<_U_M_F_P_a_c_k> │ │ │ │ -793 { │ │ │ │ -_7_9_4 enum { _v_a_l_u_e=true}; │ │ │ │ -795 }; │ │ │ │ -796 │ │ │ │ -797 template │ │ │ │ -_7_9_8 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 > > │ │ │ │ -799 { │ │ │ │ -_8_0_0 enum { _v_a_l_u_e = true }; │ │ │ │ -801 }; │ │ │ │ -802 │ │ │ │ -_8_0_3 namespace _U_M_F_P_a_c_k_I_m_p_l { │ │ │ │ -_8_0_4 template struct _i_s_V_a_l_i_d_B_l_o_c_k : std::false_type │ │ │ │ -{}; │ │ │ │ -_8_0_5 template struct _i_s_V_a_l_i_d_B_l_o_c_k, │ │ │ │ -typename OpTraits::domain_type> │ │ │ │ -808 && std::is_same_v, │ │ │ │ -typename OpTraits::range_type> │ │ │ │ -809 && std::is_same_v::real_type, double> │ │ │ │ -810 && std::is_same_v::real_type, double> │ │ │ │ -811 >> : std::true_type {}; │ │ │ │ -812 } │ │ │ │ -_8_1_3 _D_U_N_E___R_E_G_I_S_T_E_R___S_O_L_V_E_R("umfpack", │ │ │ │ -814 [](auto opTraits, const auto& op, const Dune::ParameterTree& config) │ │ │ │ -815 -> std::shared_ptr │ │ │ │ -816 { │ │ │ │ -817 using OpTraits = decltype(opTraits); │ │ │ │ -818 // works only for sequential operators │ │ │ │ -819 if constexpr (OpTraits::isParallel){ │ │ │ │ -820 if(opTraits.getCommOrThrow(op).communicator().size() > 1) │ │ │ │ -821 DUNE_THROW(Dune::InvalidStateException, "UMFPack works only for sequential │ │ │ │ -operators."); │ │ │ │ -822 } │ │ │ │ -823 if constexpr (OpTraits::isAssembled){ │ │ │ │ -824 using M = typename OpTraits::matrix_type; │ │ │ │ -825 // check if UMFPack* is convertible to │ │ │ │ -826 // InverseOperator*. This checks compatibility of the │ │ │ │ -827 // domain and range types │ │ │ │ -828 if constexpr (_U_M_F_P_a_c_k_I_m_p_l_:_:_i_s_V_a_l_i_d_B_l_o_c_k_<_O_p_T_r_a_i_t_s_>_:_:_v_a_l_u_e) { │ │ │ │ -829 const auto& A = opTraits.getAssembledOpOrThrow(op); │ │ │ │ -830 const M& mat = A->getmat(); │ │ │ │ -831 int verbose = config.get("verbose", 0); │ │ │ │ -832 return std::make_shared>(mat,verbose); │ │ │ │ -833 } │ │ │ │ -834 } │ │ │ │ -835 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ -836 "Unsupported Type in UMFPack (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -837 return nullptr; │ │ │ │ -838 }); │ │ │ │ -839} // end namespace Dune │ │ │ │ -840 │ │ │ │ -841#endif // HAVE_SUITESPARSE_UMFPACK │ │ │ │ -842 │ │ │ │ -843#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___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ -_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 │ │ │ │ -_m_a_t_r_i_x_._h_h │ │ │ │ -A dynamic dense block matrix class. │ │ │ │ -_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_:_:_s_e_t_S_u_b_M_a_t_r_i_x │ │ │ │ -void setSubMatrix(const Matrix &_mat, const std::set< typename Matrix:: │ │ │ │ -size_type > &rowIndexSet) │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:657 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_f_r_e_e │ │ │ │ -void free() │ │ │ │ -free allocated space. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:715 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -friend class SeqOverlappingSchwarz │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:732 │ │ │ │ -_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:269 │ │ │ │ -_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:167 │ │ │ │ -_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:161 │ │ │ │ -_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:273 │ │ │ │ -_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:141 │ │ │ │ -_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:146 │ │ │ │ -_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:334 │ │ │ │ -_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:136 │ │ │ │ -_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:78 │ │ │ │ -_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:93 │ │ │ │ -_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:358 │ │ │ │ -_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:281 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_U_M_F_P_a_c_k │ │ │ │ -UMFPack() │ │ │ │ -default constructor │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:340 │ │ │ │ -_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:108 │ │ │ │ -_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:88 │ │ │ │ -_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:73 │ │ │ │ -_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:156 │ │ │ │ -_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:126 │ │ │ │ -_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:98 │ │ │ │ -_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:151 │ │ │ │ -_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:279 │ │ │ │ -_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:473 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the solver (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:284 │ │ │ │ -_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:121 │ │ │ │ -_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:68 │ │ │ │ -_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:681 │ │ │ │ -_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:385 │ │ │ │ -_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:83 │ │ │ │ -_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_ _>_:_:_v_a_l_i_d │ │ │ │ -static constexpr bool valid │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:60 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ -InverseOperatorResult &res) override │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:461 │ │ │ │ -_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:54 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_~_U_M_F_P_a_c_k │ │ │ │ -virtual ~UMFPack() │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:401 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_n_a_m_e │ │ │ │ -const char * name() │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:726 │ │ │ │ -_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:527 │ │ │ │ -_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:510 │ │ │ │ -_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:706 │ │ │ │ -_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:118 │ │ │ │ -_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:297 │ │ │ │ -_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:277 │ │ │ │ -_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:275 │ │ │ │ -_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:499 │ │ │ │ -_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:131 │ │ │ │ -_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:272 │ │ │ │ -_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:63 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:410 │ │ │ │ -_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:103 │ │ │ │ -_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_ _>_ _>_:_:_v_a_l_i_d │ │ │ │ -static constexpr bool valid │ │ │ │ -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, bool) │ │ │ │ -Constructor for compatibility with SuperLU standard constructor. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:315 │ │ │ │ -_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:697 │ │ │ │ -_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_<_ _M_ _>_ _>_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:794 │ │ │ │ -_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_ _>_ _>_ _>_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:800 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +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 │ │ │ │ -_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_:_:_c_o_l │ │ │ │ -MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ -MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ -DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ -_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_:_:_U_M_F_P_a_c_k_I_m_p_l │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:803 │ │ │ │ -_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 &) │ │ │ │ -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 &) │ │ │ │ -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:467 │ │ │ │ -_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_:_:_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:97 │ │ │ │ -_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_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_:_:_U_M_F_P_a_c_k_M_e_t_h_o_d_C_h_o_o_s_e_r │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:53 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ -The UMFPack direct sparse solver. │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:265 │ │ │ │ -_D_u_n_e_:_:_U_M_F_P_a_c_k_I_m_p_l_:_:_i_s_V_a_l_i_d_B_l_o_c_k │ │ │ │ -DDeeffiinniittiioonn umfpack.hh:804 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00014.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: supermatrix.hh File Reference │ │ │ +dune-istl: counter.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,63 +66,120 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -Classes | │ │ │ Namespaces | │ │ │ +Macros | │ │ │ Variables
│ │ │ -
supermatrix.hh File Reference
│ │ │ +
counter.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 <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::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 > >
│ │ │ │ │ │ │ │ │ + │ │ │ +

│ │ │ Namespaces

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

│ │ │ +Macros

#define DUNE_GET_COUNTER(Tag)
#define DUNE_INC_COUNTER(Tag)
│ │ │ │ │ │ - │ │ │ - │ │ │ + │ │ │ +

│ │ │ Variables

template<class T>
const Dtype_t Dune::BaseGetSuperLUType< T >::type
constexpr std::size_t maxcount = 100
│ │ │ +

Macro Definition Documentation

│ │ │ + │ │ │ +

◆ DUNE_GET_COUNTER

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
#define DUNE_GET_COUNTER( Tag)
│ │ │ +
│ │ │ +Value:
(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

│ │ │ + │ │ │ +
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
std::size_t maxcount = 100
│ │ │ +
│ │ │ +constexpr
│ │ │ +
│ │ │ + │ │ │ +
│ │ │ +
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,40 +1,52 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 | _V_a_r_i_a_b_l_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" │ │ │ │ + * _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_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_ _>_ _> │ │ │ │ NNaammeessppaacceess │ │ │ │ namespace   _D_u_n_e │ │ │ │ +namespace   _D_u_n_e_:_:_C_o_u_n_t_e_r_I_m_p_l │ │ │ │ +MMaaccrrooss │ │ │ │ +#define  _D_U_N_E___G_E_T___C_O_U_N_T_E_R(Tag) │ │ │ │ +#define  _D_U_N_E___I_N_C___C_O_U_N_T_E_R(Tag) │ │ │ │ VVaarriiaabblleess │ │ │ │ -template │ │ │ │ -const Dtype_t  _D_u_n_e_:_:_B_a_s_e_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_ _T_ _>_:_:_t_y_p_e │ │ │ │ +constexpr std::size_t  _m_a_x_c_o_u_n_t = 100 │ │ │ │ +********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ +********** _?◆_? DDUUNNEE__GGEETT__CCOOUUNNTTEERR ********** │ │ │ │ +#define DUNE_GET_COUNTER ( TTaagg ) │ │ │ │ +VVaalluuee:: │ │ │ │ +(counterFunc(Dune::PriorityTag{}, Tag{}, Dune::CounterImpl::ADLTag │ │ │ │ +{})) │ │ │ │ +********** _?◆_? DDUUNNEE__IINNCC__CCOOUUNNTTEERR ********** │ │ │ │ +#define DUNE_INC_COUNTER ( TTaagg ) │ │ │ │ +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 ********** │ │ │ │ +std::size_t maxcount = 100 constexpr │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00014_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: supermatrix.hh Source File │ │ │ +dune-istl: counter.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,431 +66,79 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
supermatrix.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_SUPERMATRIX_HH
│ │ │ -
6#define DUNE_ISTL_SUPERMATRIX_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>
│ │ │ +
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
│ │ │ - │ │ │ -
18
│ │ │ -
19#include "superlufunctions.hh"
│ │ │ -
20
│ │ │ -
21namespace Dune
│ │ │ -
22{
│ │ │ -
23
│ │ │ -
24 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
26 {};
│ │ │ -
│ │ │ -
27
│ │ │ -
28 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
30 {};
│ │ │ +
│ │ │ +
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
│ │ │ -
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 };
│ │ │ +
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 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<>
│ │ │ - │ │ │ -
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
│ │ │ -
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 {};
│ │ │ -
│ │ │ -
133
│ │ │ -
134 template<class T>
│ │ │ - │ │ │ -
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 };
│ │ │ -
│ │ │ -
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 {};
│ │ │ -
│ │ │ -
176
│ │ │ -
177 template<class M>
│ │ │ -
│ │ │ - │ │ │ -
179 {};
│ │ │ -
│ │ │ -
180
│ │ │ -
181 template<class T>
│ │ │ -
182 class SuperLU;
│ │ │ -
183
│ │ │ -
184 template<class M, class X, class TM, class TD, class T1>
│ │ │ - │ │ │ -
186
│ │ │ -
187 template<class T, bool flag>
│ │ │ - │ │ │ -
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;
│ │ │ -
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 {}
│ │ │ -
│ │ │ -
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 this->N_ = MatrixDimension<Matrix>::rowdim(mat);
│ │ │ -
243 this->M_ = MatrixDimension<Matrix>::coldim(mat);
│ │ │ -
244 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*this);
│ │ │ -
245
│ │ │ -
246 copyToBCCSMatrix(initializer, mat);
│ │ │ -
247
│ │ │ - │ │ │ -
249 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
│ │ │ -
250 this->values,this->rowindex, this->colstart, SLU_NC,
│ │ │ -
251 static_cast<Dtype_t>(GetSuperLUType<typename Matrix::field_type>::type), SLU_GE);
│ │ │ -
252 return *this;
│ │ │ -
253 }
│ │ │ -
│ │ │ -
254
│ │ │ -
│ │ │ - │ │ │ -
256 {
│ │ │ -
257 if (this->N_ + this->M_ + this->Nnz_!=0)
│ │ │ -
258 free();
│ │ │ -
259
│ │ │ -
260 this->N_ = MatrixDimension<Matrix>::rowdim(mat);
│ │ │ -
261 this->M_ = MatrixDimension<Matrix>::coldim(mat);
│ │ │ -
262 ISTL::Impl::BCCSMatrixInitializer<Matrix, int> initializer(*this);
│ │ │ -
263
│ │ │ -
264 copyToBCCSMatrix(initializer, mat);
│ │ │ -
265
│ │ │ - │ │ │ -
267 ::create(&A, this->N_, this->M_, this->colstart[this->N_],
│ │ │ -
268 this->values,this->rowindex, this->colstart, SLU_NC,
│ │ │ -
269 static_cast<Dtype_t>(GetSuperLUType<B>::type), SLU_GE);
│ │ │ -
270 return *this;
│ │ │ -
271 }
│ │ │ -
│ │ │ -
272
│ │ │ -
│ │ │ -
279 virtual void setMatrix(const Matrix& mat, const std::set<typename Matrix::size_type>& mrs)
│ │ │ -
280 {
│ │ │ -
281 if(this->N_+this->M_+this->Nnz_!=0)
│ │ │ -
282 free();
│ │ │ -
283 this->N_=mrs.size()*MatrixDimension<typename Matrix::block_type>::rowdim(*(mat[0].begin()));
│ │ │ -
284 this->M_=mrs.size()*MatrixDimension<typename Matrix::block_type>::coldim(*(mat[0].begin()));
│ │ │ -
285 SuperMatrixInitializer<Matrix> initializer(*this);
│ │ │ -
286
│ │ │ -
287 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<Matrix,std::set<typename Matrix::size_type> >(mat,mrs));
│ │ │ -
288 }
│ │ │ -
│ │ │ -
289
│ │ │ -
│ │ │ -
291 virtual void setMatrix(const Matrix& mat)
│ │ │ -
292 {
│ │ │ - │ │ │ - │ │ │ -
295 SuperMatrixInitializer<Matrix> initializer(*this);
│ │ │ -
296
│ │ │ -
297 copyToBCCSMatrix(initializer, mat);
│ │ │ -
298 }
│ │ │ -
│ │ │ -
299
│ │ │ -
│ │ │ -
301 void free() override
│ │ │ -
302 {
│ │ │ -
303 ISTL::Impl::BCCSMatrix<typename BCRSMatrix<B,TA>::field_type, int>::free();
│ │ │ -
304 SUPERLU_FREE(A.Store);
│ │ │ -
305 }
│ │ │ -
│ │ │ -
306 private:
│ │ │ -
307 SuperMatrix A;
│ │ │ -
308 };
│ │ │ -
│ │ │ -
309
│ │ │ -
310 template<class B, class A>
│ │ │ -
│ │ │ - │ │ │ -
312 : public ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>
│ │ │ -
313 {
│ │ │ -
314 template<class I, class S, class D>
│ │ │ - │ │ │ -
316 public:
│ │ │ - │ │ │ - │ │ │ -
319
│ │ │ -
│ │ │ -
320 SuperMatrixInitializer(SuperLUMatrix& lum) : ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>(lum)
│ │ │ -
321 ,slumat(&lum)
│ │ │ -
322 {}
│ │ │ -
│ │ │ -
323
│ │ │ -
│ │ │ -
324 SuperMatrixInitializer() : ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>()
│ │ │ -
325 {}
│ │ │ -
│ │ │ -
326
│ │ │ -
│ │ │ -
327 void createMatrix() const override
│ │ │ -
328 {
│ │ │ -
329 ISTL::Impl::BCCSMatrixInitializer<BCRSMatrix<B,A>, int>::createMatrix();
│ │ │ - │ │ │ -
331 ::create(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols],
│ │ │ -
332 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC,
│ │ │ -
333 static_cast<Dtype_t>(GetSuperLUType<typename Matrix::field_type>::type), SLU_GE);
│ │ │ -
334 }
│ │ │ -
│ │ │ -
335 private:
│ │ │ -
336 SuperLUMatrix* slumat;
│ │ │ -
337 };
│ │ │ +
45 } // end namespace CounterImpl
│ │ │
│ │ │ -
338}
│ │ │ -
339#endif // HAVE_SUPERLU
│ │ │ -
340#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.
│ │ │ - │ │ │ -
STL namespace.
│ │ │ +
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
│ │ │ -
Definition bccsmatrix.hh:13
│ │ │ -
static auto coldim(const M &)
Definition matrixutils.hh:219
│ │ │ -
static auto rowdim(const M &)
Definition matrixutils.hh:214
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:467
│ │ │ -
TA::size_type size_type
Definition bcrsmatrix.hh:498
│ │ │ -
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
│ │ │ -
friend class SeqOverlappingSchwarz
Definition supermatrix.hh:198
│ │ │ -
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const SuperLUMatrix< BCRSMatrix< B, TA > > &mat)
Definition supermatrix.hh:255
│ │ │ -
SuperLUMatrix< BCRSMatrix< B, TA > > & operator=(const BCRSMatrix< B, TA > &mat)
Definition supermatrix.hh:237
│ │ │ -
virtual void setMatrix(const Matrix &mat, const std::set< typename Matrix::size_type > &mrs)
Initialize data from a given set of matrix rows and columns.
Definition supermatrix.hh:279
│ │ │ -
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:291
│ │ │ -
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 ~SuperLUMatrix()
Destructor.
Definition supermatrix.hh:219
│ │ │ -
void free() override
free allocated space.
Definition supermatrix.hh:301
│ │ │ -
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
Definition supermatrix.hh:318
│ │ │ -
BCRSMatrix< B, A > Matrix
Definition supermatrix.hh:317
│ │ │ -
SuperMatrixInitializer()
Definition supermatrix.hh:324
│ │ │ -
void createMatrix() const override
Definition supermatrix.hh:327
│ │ │ -
friend class OverlappingSchwarzInitializer
Definition supermatrix.hh:315
│ │ │ -
SuperMatrixInitializer(SuperLUMatrix &lum)
Definition supermatrix.hh:320
│ │ │ +
Definition counter.hh:35
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,463 +1,68 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -supermatrix.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_SUPERMATRIX_HH │ │ │ │ -6#define DUNE_ISTL_SUPERMATRIX_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 │ │ │ │ +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 │ │ │ │ -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 │ │ │ │ -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 {}; │ │ │ │ +_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 │ │ │ │ -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 *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 }; │ │ │ │ +32namespace _D_u_n_e { │ │ │ │ +33 namespace { │ │ │ │ +34 │ │ │ │ +_3_5 namespace _C_o_u_n_t_e_r_I_m_p_l { │ │ │ │ +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 template<> │ │ │ │ -46 struct _S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r │ │ │ │ -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 _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 │ │ │ │ -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 _S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r │ │ │ │ -70 { │ │ │ │ -71 static void print(char* name, SuperMatrix* mat) │ │ │ │ -72 { │ │ │ │ -73 dPrint_CompCol_Matrix(name, mat); │ │ │ │ -74 } │ │ │ │ -75 }; │ │ │ │ -76#endif │ │ │ │ -77 │ │ │ │ -78#if __has_include("slu_cdefs.h") │ │ │ │ -79 template<> │ │ │ │ -80 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 > │ │ │ │ -81 { │ │ │ │ -82 static void create(SuperMatrix *mat, 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(mat, n, m, offset, reinterpret_cast< singlecomplex*> │ │ │ │ -(values), │ │ │ │ -87 rowindex, colindex, stype, dtype, mtype); │ │ │ │ -88 } │ │ │ │ -89 }; │ │ │ │ -90 │ │ │ │ -91 template<> │ │ │ │ -92 struct _S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r > │ │ │ │ -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 _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 > │ │ │ │ -104 { │ │ │ │ -105 static void create(SuperMatrix *mat, 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(mat, n, m, offset, reinterpret_cast │ │ │ │ -(values), │ │ │ │ -110 rowindex, colindex, stype, dtype, mtype); │ │ │ │ -111 } │ │ │ │ -112 }; │ │ │ │ -113 │ │ │ │ -114 template<> │ │ │ │ -115 struct _S_u_p_e_r_M_a_t_r_i_x_P_r_i_n_t_e_r > │ │ │ │ -116 { │ │ │ │ -117 static void print(char* name, SuperMatrix* mat) │ │ │ │ -118 { │ │ │ │ -119 zPrint_CompCol_Matrix(name, mat); │ │ │ │ -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 {}; │ │ │ │ -133 │ │ │ │ -134 template │ │ │ │ -_1_3_5 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 }; │ │ │ │ -160 │ │ │ │ -161 template<> │ │ │ │ -_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 {}; │ │ │ │ -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; │ │ │ │ -183 │ │ │ │ -184 template │ │ │ │ -185 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -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; │ │ │ │ -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; │ │ │ │ -207 │ │ │ │ -_2_1_2 explicit _S_u_p_e_r_L_U_M_a_t_r_i_x(const _M_a_t_r_i_x& mat) : _I_S_T_L::Impl:: │ │ │ │ -BCCSMatrix<_B_C_R_S_M_a_t_r_i_x, int>(mat) │ │ │ │ -213 {} │ │ │ │ -214 │ │ │ │ -_2_1_5 _S_u_p_e_r_L_U_M_a_t_r_i_x() : _I_S_T_L::Impl::BCCSMatrix:: │ │ │ │ -field_type, int>() │ │ │ │ -216 {} │ │ │ │ -217 │ │ │ │ -_2_1_9 virtual _~_S_u_p_e_r_L_U_M_a_t_r_i_x() │ │ │ │ -220 { │ │ │ │ -221 if (this->N_+this->M_*this->Nnz_ != 0) │ │ │ │ -222 _f_r_e_e(); │ │ │ │ -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_>& mat) │ │ │ │ -238 { │ │ │ │ -239 if (this->N_ + this->M_ + this->Nnz_!=0) │ │ │ │ -240 _f_r_e_e(); │ │ │ │ -241 │ │ │ │ -242 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(mat); │ │ │ │ -243 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(mat); │ │ │ │ -244 ISTL::Impl::BCCSMatrixInitializer initializer(*this); │ │ │ │ -245 │ │ │ │ -246 copyToBCCSMatrix(initializer, mat); │ │ │ │ -247 │ │ │ │ -248 _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_> │ │ │ │ -249_ _:_:_c_r_e_a_t_e(&A, this->N_, this->M_, this->colstart[this->N_], │ │ │ │ -250 this->values,this->rowindex, this->colstart, SLU_NC, │ │ │ │ -251 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); │ │ │ │ -252 return *this; │ │ │ │ -253 } │ │ │ │ -254 │ │ │ │ -_2_5_5 _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_> >& mat) │ │ │ │ -256 { │ │ │ │ -257 if (this->N_ + this->M_ + this->Nnz_!=0) │ │ │ │ -258 _f_r_e_e(); │ │ │ │ -259 │ │ │ │ -260 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(mat); │ │ │ │ -261 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(mat); │ │ │ │ -262 ISTL::Impl::BCCSMatrixInitializer initializer(*this); │ │ │ │ -263 │ │ │ │ -264 copyToBCCSMatrix(initializer, mat); │ │ │ │ -265 │ │ │ │ -266 _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_> │ │ │ │ -267_ _:_:_c_r_e_a_t_e(&A, this->N_, this->M_, this->colstart[this->N_], │ │ │ │ -268 this->values,this->rowindex, this->colstart, SLU_NC, │ │ │ │ -269 static_cast(_G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_B_>_:_:_t_y_p_e), SLU_GE); │ │ │ │ -270 return *this; │ │ │ │ -271 } │ │ │ │ -272 │ │ │ │ -_2_7_9 virtual void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& mat, const std::set& mrs) │ │ │ │ -280 { │ │ │ │ -281 if(this->N_+this->M_+this->Nnz_!=0) │ │ │ │ -282 _f_r_e_e(); │ │ │ │ -283 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(* │ │ │ │ -(mat[0].begin())); │ │ │ │ -284 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(* │ │ │ │ -(mat[0].begin())); │ │ │ │ -285 _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); │ │ │ │ -286 │ │ │ │ -287 copyToBCCSMatrix(initializer, ISTL::Impl::MatrixRowSubset<_M_a_t_r_i_x,std:: │ │ │ │ -set >(mat,mrs)); │ │ │ │ -288 } │ │ │ │ -289 │ │ │ │ -_2_9_1 virtual void _s_e_t_M_a_t_r_i_x(const _M_a_t_r_i_x& mat) │ │ │ │ -292 { │ │ │ │ -293 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(mat); │ │ │ │ -294 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(mat); │ │ │ │ -295 _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); │ │ │ │ -296 │ │ │ │ -297 copyToBCCSMatrix(initializer, mat); │ │ │ │ -298 } │ │ │ │ -299 │ │ │ │ -_3_0_1 void _f_r_e_e() override │ │ │ │ -302 { │ │ │ │ -303 ISTL::Impl::BCCSMatrix::field_type, int>_:_:_f_r_e_e(); │ │ │ │ -304 SUPERLU_FREE(A.Store); │ │ │ │ -305 } │ │ │ │ -306 private: │ │ │ │ -307 SuperMatrix A; │ │ │ │ -308 }; │ │ │ │ -309 │ │ │ │ -310 template │ │ │ │ -_3_1_1 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 > │ │ │ │ -312 : public ISTL::Impl::BCCSMatrixInitializer, int> │ │ │ │ -313 { │ │ │ │ -314 template │ │ │ │ -_3_1_5 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; │ │ │ │ -316 public: │ │ │ │ -_3_1_7 typedef _B_C_R_S_M_a_t_r_i_x_<_B_,_A_> _M_a_t_r_i_x; │ │ │ │ -_3_1_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; │ │ │ │ -319 │ │ │ │ -_3_2_0 _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) : _I_S_T_L::Impl:: │ │ │ │ -BCCSMatrixInitializer<_B_C_R_S_M_a_t_r_i_x, int>(lum) │ │ │ │ -321 ,slumat(&lum) │ │ │ │ -322 {} │ │ │ │ -323 │ │ │ │ -_3_2_4 _S_u_p_e_r_M_a_t_r_i_x_I_n_i_t_i_a_l_i_z_e_r() : _I_S_T_L::Impl:: │ │ │ │ -BCCSMatrixInitializer<_B_C_R_S_M_a_t_r_i_x, int>() │ │ │ │ -325 {} │ │ │ │ -326 │ │ │ │ -_3_2_7 void _c_r_e_a_t_e_M_a_t_r_i_x() const override │ │ │ │ -328 { │ │ │ │ -329 ISTL::Impl::BCCSMatrixInitializer, int>_:_:_c_r_e_a_t_e_M_a_t_r_i_x(); │ │ │ │ -330 _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_> │ │ │ │ -331_ _:_:_c_r_e_a_t_e(&slumat->A, slumat->N_, slumat->M_, slumat->colstart[this->cols], │ │ │ │ -332 slumat->values,slumat->rowindex, slumat->colstart, SLU_NC, │ │ │ │ -333 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); │ │ │ │ -334 } │ │ │ │ -335 private: │ │ │ │ -336 _S_u_p_e_r_L_U_M_a_t_r_i_x* slumat; │ │ │ │ -337 }; │ │ │ │ -338} │ │ │ │ -339#endif // HAVE_SUPERLU │ │ │ │ -340#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 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +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_:_:_I_S_T_L │ │ │ │ -DDeeffiinniittiioonn bccsmatrix.hh:13 │ │ │ │ -_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 &) │ │ │ │ -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 &) │ │ │ │ -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:467 │ │ │ │ -_D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_ _B_,_ _T_A_ _>_:_:_s_i_z_e___t_y_p_e │ │ │ │ -TA::size_type size_type │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:498 │ │ │ │ -_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_ _>_ _>_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -friend class SeqOverlappingSchwarz │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:198 │ │ │ │ -_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:255 │ │ │ │ -_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_e_t_M_a_t_r_i_x │ │ │ │ -virtual void setMatrix(const Matrix &mat, const std::set< typename Matrix:: │ │ │ │ -size_type > &mrs) │ │ │ │ -Initialize data from a given set of matrix rows and columns. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:279 │ │ │ │ -_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:291 │ │ │ │ -_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_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_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 │ │ │ │ -void free() override │ │ │ │ -free allocated space. │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:301 │ │ │ │ -_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:318 │ │ │ │ -_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:317 │ │ │ │ -_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:324 │ │ │ │ -_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 │ │ │ │ -void createMatrix() const override │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:327 │ │ │ │ -_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_ _>_ _>_:_: │ │ │ │ -_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 │ │ │ │ -friend class OverlappingSchwarzInitializer │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:315 │ │ │ │ -_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:320 │ │ │ │ +_D_u_n_e_:_:_C_o_u_n_t_e_r_I_m_p_l │ │ │ │ +DDeeffiinniittiioonn counter.hh:35 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00017.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlufunctions.hh File Reference │ │ │ +dune-istl: istlexception.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -72,43 +72,41 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -Macros
│ │ │ -
superlufunctions.hh File Reference
│ │ │ +Classes | │ │ │ +Namespaces
│ │ │ +
istlexception.hh File Reference
│ │ │
│ │ │
│ │ │ -
#include <dune-istl-config.hh>
│ │ │ -#include <supermatrix.h>
│ │ │ -#include <slu_util.h>
│ │ │ +
#include <dune/common/exceptions.hh>
│ │ │ +#include <dune/common/fmatrix.hh>
│ │ │
│ │ │

Go to the source code of this file.

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

│ │ │ -Macros

#define int_t   SUPERLU_INT_TYPE

│ │ │ +Classes

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::SolverAbort
 Thrown when a solver aborts due to some problem. More...
class  Dune::MatrixBlockError
 Error when performing an operation on a matrix block. More...
│ │ │ + │ │ │ + │ │ │

│ │ │ +Namespaces

namespace  Dune
│ │ │ -

Macro Definition Documentation

│ │ │ - │ │ │ -

◆ int_t

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define int_t   SUPERLU_INT_TYPE
│ │ │ -
│ │ │ - │ │ │ -
│ │ │ -
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,19 +1,27 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_l_a_s_s_e_s | _N_a_m_e_s_p_a_c_e_s │ │ │ │ +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_. │ │ │ │ -MMaaccrrooss │ │ │ │ -#define  _i_n_t___t   SUPERLU_INT_TYPE │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? iinntt__tt ********** │ │ │ │ -#define int_t   SUPERLU_INT_TYPE │ │ │ │ +CCllaasssseess │ │ │ │ +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_:_:_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_._._. │ │ │ │ +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 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00017_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlufunctions.hh Source File │ │ │ +dune-istl: istlexception.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,140 +71,67 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
superlufunctions.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_SUPERLUFUNCTIONS_HH
│ │ │ -
6#define DUNE_ISTL_SUPERLUFUNCTIONS_HH
│ │ │ -
7#if HAVE_SUPERLU
│ │ │ -
8
│ │ │ -
9#include <dune-istl-config.hh> // SUPERLU_INT_TYPE
│ │ │ +
5#ifndef DUNE_ISTL_ISTLEXCEPTION_HH
│ │ │ +
6#define DUNE_ISTL_ISTLEXCEPTION_HH
│ │ │ +
7
│ │ │ +
8#include <dune/common/exceptions.hh>
│ │ │ +
9#include <dune/common/fmatrix.hh>
│ │ │
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 *);
│ │ │ -
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
│ │ │ -
62#include "slu_scomplex.h"
│ │ │ -
63
│ │ │ -
64// fallback by introducing typedef for complex for older versions
│ │ │ -
65#ifdef SUPERLU_MAJOR_VERSION
│ │ │ -
66#if SUPERLU_MAJOR_VERSION < 7
│ │ │ -
67typedef ::complex singlecomplex;
│ │ │ -
68#endif
│ │ │ -
69#endif
│ │ │ -
70
│ │ │ -
71
│ │ │ -
72extern "C" {
│ │ │ -
73 extern void
│ │ │ -
74 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ -
75 char *, float *, float *, SuperMatrix *, SuperMatrix *,
│ │ │ -
76 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ -
77 float *, float *, float *, float *,
│ │ │ -
78 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ -
79
│ │ │ -
80
│ │ │ -
81 extern void
│ │ │ -
82 cCreate_Dense_Matrix(SuperMatrix *, int, int, singlecomplex*, int,
│ │ │ -
83 Stype_t, Dtype_t, Mtype_t);
│ │ │ -
84
│ │ │ -
85
│ │ │ -
86 extern void
│ │ │ -
87 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, singlecomplex*,
│ │ │ -
88 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ -
89
│ │ │ -
90 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ -
91
│ │ │ -
92 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ -
93}
│ │ │ -
94#endif
│ │ │ -
95
│ │ │ -
96#if __has_include("slu_zdefs.h")
│ │ │ -
97#include "slu_dcomplex.h"
│ │ │ -
98extern "C" {
│ │ │ -
99 extern void
│ │ │ -
100 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *,
│ │ │ -
101 char *, double *, double *, SuperMatrix *, SuperMatrix *,
│ │ │ -
102 void *, int, SuperMatrix *, SuperMatrix *,
│ │ │ -
103 double *, double *, double *, double *,
│ │ │ -
104 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *);
│ │ │ -
105
│ │ │ -
106
│ │ │ -
107 extern void
│ │ │ -
108 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *,
│ │ │ -
109 int *, int *, Stype_t, Dtype_t, Mtype_t);
│ │ │ -
110
│ │ │ -
111 extern void
│ │ │ -
112 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int,
│ │ │ -
113 Stype_t, Dtype_t, Mtype_t);
│ │ │ -
114
│ │ │ -
115 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *);
│ │ │ -
116
│ │ │ -
117 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *);
│ │ │ -
118}
│ │ │ -
119#endif
│ │ │ -
120
│ │ │ -
121
│ │ │ -
122#endif
│ │ │ -
123#endif
│ │ │ +
11namespace Dune {
│ │ │ +
12
│ │ │ +
17
│ │ │ +
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 };
│ │ │ +
│ │ │ +
56
│ │ │ +
58
│ │ │ +
59} // end namespace
│ │ │ +
60
│ │ │ +
61#endif
│ │ │ +
Definition allocator.hh:11
│ │ │ +
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ +
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,134 +1,71 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -superlufunctions.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_SUPERLUFUNCTIONS_HH │ │ │ │ -6#define DUNE_ISTL_SUPERLUFUNCTIONS_HH │ │ │ │ -7#if HAVE_SUPERLU │ │ │ │ -8 │ │ │ │ -9#include // SUPERLU_INT_TYPE │ │ │ │ +5#ifndef DUNE_ISTL_ISTLEXCEPTION_HH │ │ │ │ +6#define DUNE_ISTL_ISTLEXCEPTION_HH │ │ │ │ +7 │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ 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 *); │ │ │ │ -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); │ │ │ │ +11namespace _D_u_n_e { │ │ │ │ +12 │ │ │ │ +17 │ │ │ │ +_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 │ │ │ │ -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 │ │ │ │ -62#include "slu_scomplex.h" │ │ │ │ -63 │ │ │ │ -64// fallback by introducing typedef for complex for older versions │ │ │ │ -65#ifdef SUPERLU_MAJOR_VERSION │ │ │ │ -66#if SUPERLU_MAJOR_VERSION < 7 │ │ │ │ -67typedef ::complex singlecomplex; │ │ │ │ -68#endif │ │ │ │ -69#endif │ │ │ │ -70 │ │ │ │ -71 │ │ │ │ -72extern "C" { │ │ │ │ -73 extern void │ │ │ │ -74 cgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ -75 char *, float *, float *, SuperMatrix *, SuperMatrix *, │ │ │ │ -76 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ -77 float *, float *, float *, float *, │ │ │ │ -78 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ -79 │ │ │ │ -80 │ │ │ │ -81 extern void │ │ │ │ -82 cCreate_Dense_Matrix(SuperMatrix *, int, int, singlecomplex*, int, │ │ │ │ -83 Stype_t, Dtype_t, Mtype_t); │ │ │ │ -84 │ │ │ │ -85 │ │ │ │ -86 extern void │ │ │ │ -87 cCreate_CompCol_Matrix(SuperMatrix *, int, int, int, singlecomplex*, │ │ │ │ -88 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ -89 │ │ │ │ -90 extern int cQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ -91 │ │ │ │ -92 extern void cPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ -93} │ │ │ │ -94#endif │ │ │ │ -95 │ │ │ │ -96#if __has_include("slu_zdefs.h") │ │ │ │ -97#include "slu_dcomplex.h" │ │ │ │ -98extern "C" { │ │ │ │ -99 extern void │ │ │ │ -100 zgssvx(superlu_options_t *, SuperMatrix *, int *, int *, int *, │ │ │ │ -101 char *, double *, double *, SuperMatrix *, SuperMatrix *, │ │ │ │ -102 void *, int, SuperMatrix *, SuperMatrix *, │ │ │ │ -103 double *, double *, double *, double *, │ │ │ │ -104 GlobalLU_t*, mem_usage_t *, SuperLUStat_t *, int *); │ │ │ │ -105 │ │ │ │ -106 │ │ │ │ -107 extern void │ │ │ │ -108 zCreate_CompCol_Matrix(SuperMatrix *, int, int, int, doublecomplex *, │ │ │ │ -109 int *, int *, Stype_t, Dtype_t, Mtype_t); │ │ │ │ -110 │ │ │ │ -111 extern void │ │ │ │ -112 zCreate_Dense_Matrix(SuperMatrix *, int, int, doublecomplex *, int, │ │ │ │ -113 Stype_t, Dtype_t, Mtype_t); │ │ │ │ -114 │ │ │ │ -115 extern int zQuerySpace (SuperMatrix *, SuperMatrix *, mem_usage_t *); │ │ │ │ -116 │ │ │ │ -117 extern void zPrint_CompCol_Matrix(char *, SuperMatrix *); │ │ │ │ -118} │ │ │ │ -119#endif │ │ │ │ -120 │ │ │ │ -121 │ │ │ │ -122#endif │ │ │ │ -123#endif │ │ │ │ +_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 │ │ │ │ +58 │ │ │ │ +59} // end namespace │ │ │ │ +60 │ │ │ │ +61#endif │ │ │ │ +_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_:_:_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.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00020.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlu.hh File Reference │ │ │ +dune-istl: ilusubdomainsolver.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,59 +73,44 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Functions
│ │ │ - │ │ │ +Namespaces
│ │ │ +
ilusubdomainsolver.hh File Reference
│ │ │
│ │ │
│ │ │ │ │ │ -

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

Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ 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 <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::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 > > >
class  Dune::ILUSubdomainSolver< M, X, Y >
 base class encapsulating common algorithms of ILU0SubdomainSolver and ILUNSubdomainSolver. More...
class  Dune::ILU0SubdomainSolver< M, X, Y >
 Exact subdomain solver using ILU(p) with appropriate p. More...
class  Dune::ILUNSubdomainSolver< M, X, Y >
│ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

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

│ │ │ -Functions

 Dune::DUNE_REGISTER_SOLVER ("superlu", [](auto opTraits, const auto &op, const Dune::ParameterTree &config) -> std::shared_ptr< typename decltype(opTraits)::solver_type > { using OpTraits=decltype(opTraits);using M=typename OpTraits::matrix_type;if constexpr(OpTraits::isParallel){ if(opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune::InvalidStateException, "SuperLU works only for sequential operators.");} if constexpr(OpTraits::isAssembled &&std::is_same_v< typename FieldTraits< M >::real_type, double >){ if constexpr(std::is_convertible_v< SuperLU< M > *, Dune::InverseOperator< typename OpTraits::domain_type, typename OpTraits::range_type > * >){ const auto &A=opTraits.getAssembledOpOrThrow(op);const M &mat=A->getmat();int verbose=config.get("verbose", 0);return std::make_shared< Dune::SuperLU< M > >(mat, verbose);} } DUNE_THROW(UnsupportedType, "Unsupported Type in SuperLU (only double and std::complex<double> supported)");})
│ │ │

Detailed Description

│ │ │ -

Classes for using SuperLU with ISTL matrices.

│ │ │ +

Various local subdomain solvers based on ILU for SeqOverlappingSchwarz.

│ │ │
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -1,56 +1,31 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_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_:_:_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_ _>_ _>_ _> │ │ │ │ +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_._._. │ │ │ │ +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_._._. │ │ │ │ +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___S_O_L_V_E_R ("superlu", [](auto opTraits, const auto &op, │ │ │ │ - const Dune::ParameterTree &config) -> std::shared_ptr< typename decltype │ │ │ │ - (opTraits)::solver_type > { using OpTraits=decltype(opTraits);using │ │ │ │ - M=typename OpTraits::matrix_type;if constexpr(OpTraits::isParallel){ if │ │ │ │ - (opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune:: │ │ │ │ - InvalidStateException, "SuperLU works only for sequential operators.");} if │ │ │ │ - constexpr(OpTraits::isAssembled &&std::is_same_v< typename FieldTraits< M >:: │ │ │ │ - real_type, double >){ if constexpr(std::is_convertible_v< _S_u_p_e_r_L_U< M > *, │ │ │ │ - _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< typename OpTraits::domain_type, typename OpTraits:: │ │ │ │ - range_type > * >){ const auto &A=opTraits.getAssembledOpOrThrow(op);const M │ │ │ │ - &mat=A->getmat();int verbose=config.get("verbose", 0);return std:: │ │ │ │ - make_shared< _D_u_n_e_:_:_S_u_p_e_r_L_U< M > >(mat, verbose);} } DUNE_THROW │ │ │ │ - (_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "Unsupported Type in _S_u_p_e_r_L_U (only double and std:: │ │ │ │ - complex supported)");}) │ │ │ │ ********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Classes for using SuperLU with ISTL matrices. │ │ │ │ +Various local subdomain solvers based on ILU for SeqOverlappingSchwarz. │ │ │ │ Author │ │ │ │ Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./usr/share/doc/libdune-istl-doc/doxygen/a00020_source.html │ │ │ @@ -1,15 +1,15 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ -dune-istl: superlu.hh Source File │ │ │ +dune-istl: ilusubdomainsolver.hh Source File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,826 +71,237 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
superlu.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_SUPERLU_HH
│ │ │ -
6#define DUNE_ISTL_SUPERLU_HH
│ │ │ +
5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH
│ │ │ +
6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_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>
│ │ │ - │ │ │ -
39
│ │ │ -
40 template<class T, bool tag>
│ │ │ - │ │ │ -
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)
│ │ │ +
8#include <map>
│ │ │ +
9#include <dune/common/typetraits.hh>
│ │ │ + │ │ │ +
11#include "matrix.hh"
│ │ │ +
12#include <cmath>
│ │ │ +
13#include <cstdlib>
│ │ │ +
14
│ │ │ +
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
│ │ │ +
51 virtual void apply (X& v, const Y& d) =0;
│ │ │ +
52
│ │ │ +
│ │ │ + │ │ │ +
54 {}
│ │ │ +
│ │ │ +
55
│ │ │ +
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 sQuerySpace(L,U,memusage);
│ │ │ +
95 ILU::blockILUBacksolve(this->ILU,v,d);
│ │ │
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 };
│ │ │ +
│ │ │ +
97
│ │ │ +
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 void apply (X& v, const Y& d)
│ │ │ +
126 {
│ │ │ +
127 ILU::blockILUBacksolve(RILU,v,d);
│ │ │ +
128 }
│ │ │ +
│ │ │ +
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 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
│ │ │ +
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#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 }
│ │ │ +
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 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& matrix, bool verbose=false,
│ │ │ -
307 bool reusevector=true);
│ │ │ -
308
│ │ │ -
309
│ │ │ -
│ │ │ -
320 SuperLU(const Matrix& matrix, const ParameterTree& config)
│ │ │ -
321 : SuperLU(matrix, config.get<bool>("verbose", false), config.get<bool>("reuseVector", true))
│ │ │ -
322 {}
│ │ │ -
│ │ │ -
323
│ │ │ -
330 SuperLU();
│ │ │ -
331
│ │ │ -
332 ~SuperLU();
│ │ │ -
333
│ │ │ -
337 void apply(domain_type& x, range_type& b, InverseOperatorResult& res) override;
│ │ │ -
338
│ │ │ -
│ │ │ -
342 void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ -
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
│ │ │ -
382 SuperLUMatrix mat;
│ │ │ -
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()>0 or 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>
│ │ │ -
471 void SuperLU<M>::decompose()
│ │ │ -
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 }
│ │ │ -
│ │ │ -
713
│ │ │ -
714
│ │ │ -
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
│ │ │ -
727
│ │ │ - │ │ │ -
729 [](auto opTraits, const auto& op, const Dune::ParameterTree& config)
│ │ │ -
730 -> std::shared_ptr<typename decltype(opTraits)::solver_type>
│ │ │ -
731 {
│ │ │ -
732 using OpTraits = decltype(opTraits);
│ │ │ -
733 using M = typename OpTraits::matrix_type;
│ │ │ -
734 // works only for sequential operators
│ │ │ -
735 if constexpr (OpTraits::isParallel){
│ │ │ -
736 if(opTraits.getCommOrThrow(op).communicator().size() > 1)
│ │ │ -
737 DUNE_THROW(Dune::InvalidStateException, "SuperLU works only for sequential operators.");
│ │ │ -
738 }
│ │ │ -
739 if constexpr (OpTraits::isAssembled &&
│ │ │ -
740 // check whether the Matrix field_type is double or complex<double>
│ │ │ -
741 std::is_same_v<typename FieldTraits<M>::real_type, double>){
│ │ │ -
742 // check if SuperLU<M>* is convertible to
│ │ │ -
743 // InverseOperator*. This checks compatibility of the
│ │ │ -
744 // domain and range types
│ │ │ -
745 if constexpr (std::is_convertible_v<SuperLU<M>*,
│ │ │ -
746 Dune::InverseOperator<typename OpTraits::domain_type,
│ │ │ -
747 typename OpTraits::range_type>*>
│ │ │ -
748 ){
│ │ │ -
749 const auto& A = opTraits.getAssembledOpOrThrow(op);
│ │ │ -
750 const M& mat = A->getmat();
│ │ │ -
751 int verbose = config.get("verbose", 0);
│ │ │ -
752 return std::make_shared<Dune::SuperLU<M>>(mat,verbose);
│ │ │ -
753 }
│ │ │ -
754 }
│ │ │ -
755 DUNE_THROW(UnsupportedType,
│ │ │ -
756 "Unsupported Type in SuperLU (only double and std::complex<double> supported)");
│ │ │ -
757 });
│ │ │ -
758} // end namespace DUNE
│ │ │ -
759
│ │ │ -
760// undefine macros from SuperLU's slu_util.h
│ │ │ -
761#undef FIRSTCOL_OF_SNODE
│ │ │ -
762#undef NO_MARKER
│ │ │ -
763#undef NUM_TEMPV
│ │ │ -
764#undef USER_ABORT
│ │ │ -
765#undef USER_MALLOC
│ │ │ -
766#undef SUPERLU_MALLOC
│ │ │ -
767#undef USER_FREE
│ │ │ -
768#undef SUPERLU_FREE
│ │ │ -
769#undef CHECK_MALLOC
│ │ │ -
770#undef SUPERLU_MAX
│ │ │ -
771#undef SUPERLU_MIN
│ │ │ -
772#undef L_SUB_START
│ │ │ -
773#undef L_SUB
│ │ │ -
774#undef L_NZ_START
│ │ │ -
775#undef L_FST_SUPC
│ │ │ -
776#undef U_NZ_START
│ │ │ -
777#undef U_SUB
│ │ │ -
778#undef TRUE
│ │ │ -
779#undef FALSE
│ │ │ -
780#undef EMPTY
│ │ │ -
781#undef NODROP
│ │ │ -
782#undef DROP_BASIC
│ │ │ -
783#undef DROP_PROWS
│ │ │ -
784#undef DROP_COLUMN
│ │ │ -
785#undef DROP_AREA
│ │ │ -
786#undef DROP_SECONDARY
│ │ │ -
787#undef DROP_DYNAMIC
│ │ │ -
788#undef DROP_INTERP
│ │ │ -
789#undef MILU_ALPHA
│ │ │ -
790
│ │ │ -
791#endif // HAVE_SUPERLU
│ │ │ -
792#endif // DUNE_SUPERLU_HH
│ │ │ - │ │ │ - │ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
#define DUNE_REGISTER_SOLVER(name,...)
Definition solverregistry.hh:16
│ │ │ - │ │ │ - │ │ │ -
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
│ │ │ -
SuperLU(const Matrix &matrix, bool verbose=false, bool reusevector=true)
Constructs the SuperLU solver.
Definition superlu.hh:424
│ │ │ -
void setVerbosity(bool v)
Definition superlu.hh:437
│ │ │ -
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition superlu.hh:563
│ │ │ -
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
│ │ │ +
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#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
│ │ │
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:467
│ │ │ -
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
│ │ │ -
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:97
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
Definition superlu.hh:45
│ │ │ -
Definition superlu.hh:49
│ │ │ -
Definition superlu.hh:53
│ │ │ -
Definition superlu.hh:57
│ │ │ -
SuperLu Solver.
Definition superlu.hh:271
│ │ │ -
friend class SeqOverlappingSchwarz
Definition superlu.hh:374
│ │ │ -
SuperLU(const Matrix &matrix, const ParameterTree &config)
Constructs the SuperLU solver.
Definition superlu.hh:320
│ │ │ -
SuperLUMatrix::size_type nnz() const
Definition superlu.hh:355
│ │ │ -
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res) override
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
│ │ │ -
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category).
Definition superlu.hh:287
│ │ │ -
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
│ │ │ -
Dune::SuperLUMatrix< Matrix > SuperLUMatrix
The corresponding SuperLU Matrix type.
Definition superlu.hh:278
│ │ │ - │ │ │ - │ │ │ -
Definition supermatrix.hh:132
│ │ │ -
Utility class for converting an ISTL Matrix into a SuperLU Matrix.
Definition supermatrix.hh:175
│ │ │ -
Definition supermatrix.hh:179
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ +
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:103
│ │ │ +
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:35
│ │ │ +
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:176
│ │ │ + │ │ │ +
Iterator begin()
Get iterator to first row.
Definition bcrsmatrix.hh:672
│ │ │ +
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
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,925 +1,291 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ Loading... │ │ │ │ Searching... │ │ │ │ No Matches │ │ │ │ * _d_u_n_e │ │ │ │ * _i_s_t_l │ │ │ │ -superlu.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_SUPERLU_HH │ │ │ │ -6#define DUNE_ISTL_SUPERLU_HH │ │ │ │ +5#ifndef DUNE_ISTL_ILUSUBDOMAINSOLVER_HH │ │ │ │ +6#define DUNE_ISTL_ILUSUBDOMAINSOLVER_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 _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -39 │ │ │ │ -40 template │ │ │ │ -41 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; │ │ │ │ -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 *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 } │ │ │ │ +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 │ │ │ │ +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 │ │ │ │ +_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 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 │ │ │ │ -70 static void destroy(SuperMatrix*) │ │ │ │ -71 {} │ │ │ │ -72 │ │ │ │ -73 }; │ │ │ │ -74 template<> │ │ │ │ -75 struct _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r │ │ │ │ -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 _Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r │ │ │ │ -92 { │ │ │ │ -93 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* │ │ │ │ -memusage) │ │ │ │ +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 sQuerySpace(L,U,memusage); │ │ │ │ +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 } │ │ │ │ -97 }; │ │ │ │ -98 │ │ │ │ -99#endif │ │ │ │ -100 │ │ │ │ -101#if __has_include("slu_ddefs.h") │ │ │ │ -102 │ │ │ │ -103 template<> │ │ │ │ -104 struct _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r │ │ │ │ -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 _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r │ │ │ │ -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 _Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r │ │ │ │ -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 _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r > │ │ │ │ -145 { │ │ │ │ -146 static void create(SuperMatrix *mat, int n, int m, std::complex │ │ │ │ -*dat, int n1, │ │ │ │ -147 Stype_t stype, Dtype_t dtype, Mtype_t mtype) │ │ │ │ -148 { │ │ │ │ -149 zCreate_Dense_Matrix(mat, n, m, reinterpret_cast(dat), n1, │ │ │ │ -stype, dtype, mtype); │ │ │ │ -150 │ │ │ │ -151 } │ │ │ │ -152 │ │ │ │ -153 static void destroy(SuperMatrix*) │ │ │ │ -154 {} │ │ │ │ -155 }; │ │ │ │ -156 │ │ │ │ -157 template<> │ │ │ │ -158 struct _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r > │ │ │ │ -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 }; │ │ │ │ +97 │ │ │ │ +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 _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 │ │ │ │ +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 _s_i_z_e___t_y_p_e; │ │ │ │ +156 typedef std::map IndexMap; │ │ │ │ +157 typedef typename IndexMap::iterator IMIter; │ │ │ │ +158 IndexMap indexMap; │ │ │ │ +159 IMIter guess = indexMap._b_e_g_i_n(); │ │ │ │ +160 _s_i_z_e___t_y_p_e 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 _I_L_U.setSize(rowSet.size(),rowSet.size()); │ │ │ │ +171 _I_L_U.setBuildMode(matrix_type::row_wise); │ │ │ │ 172 │ │ │ │ -173 template<> │ │ │ │ -174 struct _Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r > │ │ │ │ -175 { │ │ │ │ -176 static void querySpace(SuperMatrix* L, SuperMatrix* U, mem_usage_t* │ │ │ │ -memusage) │ │ │ │ -177 { │ │ │ │ -178 zQuerySpace(L,U,memusage); │ │ │ │ -179 } │ │ │ │ -180 }; │ │ │ │ -181#endif │ │ │ │ +173 // Create sparsity pattern │ │ │ │ +174 typedef typename matrix_type::CreateIterator CIter; │ │ │ │ +175 CIter rowCreator = _I_L_U.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#if __has_include("slu_cdefs.h") │ │ │ │ -184 template<> │ │ │ │ -185 struct _S_u_p_e_r_L_U_D_e_n_s_e_M_a_t_C_h_o_o_s_e_r > │ │ │ │ -186 { │ │ │ │ -187 static void create(SuperMatrix *mat, int n, int m, std::complex │ │ │ │ -*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 │ │ │ │ +183 for(typename matrix_type::ConstColIterator _c_o_l=A[*rowIdx].begin(), │ │ │ │ +184 endcol=A[*rowIdx].end(); _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 static void destroy(SuperMatrix* /* mat */) │ │ │ │ -195 {} │ │ │ │ -196 }; │ │ │ │ -197 │ │ │ │ -198 template<> │ │ │ │ -199 struct _S_u_p_e_r_L_U_S_o_l_v_e_C_h_o_o_s_e_r > │ │ │ │ -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 _Q_u_e_r_y_S_p_a_c_e_C_h_o_o_s_e_r > │ │ │ │ -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 _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 │ │ │ │ -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& matrix, 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& matrix, const ParameterTree& config) │ │ │ │ -321 : _S_u_p_e_r_L_U(matrix, 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) │ │ │ │ -override; │ │ │ │ -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) override │ │ │ │ -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 mat; } │ │ │ │ -378 │ │ │ │ -380 void decompose(); │ │ │ │ -381 │ │ │ │ -382 _S_u_p_e_r_L_U_M_a_t_r_i_x mat; │ │ │ │ -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(mat.N()+mat.M()>0) │ │ │ │ -399 _f_r_e_e(); │ │ │ │ -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 mat.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(mat.N()+mat.M()>0) { │ │ │ │ -446 _f_r_e_e(); │ │ │ │ -447 } │ │ │ │ -448 lwork=0; │ │ │ │ -449 work=0; │ │ │ │ -450 //a=&mat_; │ │ │ │ -451 mat=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(mat.N()>0 or mat.M()>0) { │ │ │ │ -461 _f_r_e_e(); │ │ │ │ -462 } │ │ │ │ -463 lwork=0; │ │ │ │ -464 work=0; │ │ │ │ -465 //a=&mat_; │ │ │ │ -466 mat.setMatrix(mat_,mrs); │ │ │ │ -467 decompose(); │ │ │ │ -468 } │ │ │ │ -469 │ │ │ │ -470 template │ │ │ │ -471 void SuperLU::decompose() │ │ │ │ -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 _G_e_t_S_u_p_e_r_L_U_T_y_p_e_<_T_>_:_:_f_l_o_a_t___t_y_p_e[mat.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[mat.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=mat.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(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<(mat).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 _S_u_p_e_r_L_U_<_M_> │ │ │ │ -_5_6_3_ _:_:_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) │ │ │ │ -564 { │ │ │ │ -565 if (mat.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 (mat.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 (mat.M()+mat.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)mat.N(), 1, reinterpret_cast │ │ │ │ -(&b[0]), (int)mat.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)mat.N(), 1, reinterpret_cast │ │ │ │ -(&x[0]), (int)mat.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)mat.N(), 1, │ │ │ │ -reinterpret_cast(&b[0]), (int)mat.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)mat.N(), 1, │ │ │ │ -reinterpret_cast(&x[0]), (int)mat.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(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._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<(mat).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(mat.N()+mat.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, mat.N(), 1, b, mat.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, mat.N(), 1, x, mat.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, mat.N(), 1, b, mat.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, mat.N(), 1, x, mat.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(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<(mat).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 │ │ │ │ -727 │ │ │ │ -_7_2_8 _D_U_N_E___R_E_G_I_S_T_E_R___S_O_L_V_E_R("superlu", │ │ │ │ -729 [](auto opTraits, const auto& op, const Dune::ParameterTree& config) │ │ │ │ -730 -> std::shared_ptr │ │ │ │ -731 { │ │ │ │ -732 using OpTraits = decltype(opTraits); │ │ │ │ -733 using M = typename OpTraits::matrix_type; │ │ │ │ -734 // works only for sequential operators │ │ │ │ -735 if constexpr (OpTraits::isParallel){ │ │ │ │ -736 if(opTraits.getCommOrThrow(op).communicator().size() > 1) │ │ │ │ -737 DUNE_THROW(Dune::InvalidStateException, "SuperLU works only for sequential │ │ │ │ -operators."); │ │ │ │ -738 } │ │ │ │ -739 if constexpr (OpTraits::isAssembled && │ │ │ │ -740 // check whether the Matrix field_type is double or complex │ │ │ │ -741 std::is_same_v::real_type, double>){ │ │ │ │ -742 // check if SuperLU* is convertible to │ │ │ │ -743 // InverseOperator*. This checks compatibility of the │ │ │ │ -744 // domain and range types │ │ │ │ -745 if constexpr (std::is_convertible_v*, │ │ │ │ -746 _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r*> │ │ │ │ -748 ){ │ │ │ │ -749 const auto& A = opTraits.getAssembledOpOrThrow(op); │ │ │ │ -750 const M& mat = A->getmat(); │ │ │ │ -751 int verbose = config.get("verbose", 0); │ │ │ │ -752 return std::make_shared>(mat,verbose); │ │ │ │ -753 } │ │ │ │ -754 } │ │ │ │ -755 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ -756 "Unsupported Type in SuperLU (only double and std::complex │ │ │ │ -supported)"); │ │ │ │ -757 }); │ │ │ │ -758} // end namespace DUNE │ │ │ │ -759 │ │ │ │ -760// undefine macros from SuperLU's slu_util.h │ │ │ │ -761#undef FIRSTCOL_OF_SNODE │ │ │ │ -762#undef NO_MARKER │ │ │ │ -763#undef NUM_TEMPV │ │ │ │ -764#undef USER_ABORT │ │ │ │ -765#undef USER_MALLOC │ │ │ │ -766#undef SUPERLU_MALLOC │ │ │ │ -767#undef USER_FREE │ │ │ │ -768#undef SUPERLU_FREE │ │ │ │ -769#undef CHECK_MALLOC │ │ │ │ -770#undef SUPERLU_MAX │ │ │ │ -771#undef SUPERLU_MIN │ │ │ │ -772#undef L_SUB_START │ │ │ │ -773#undef L_SUB │ │ │ │ -774#undef L_NZ_START │ │ │ │ -775#undef L_FST_SUPC │ │ │ │ -776#undef U_NZ_START │ │ │ │ -777#undef U_SUB │ │ │ │ -778#undef TRUE │ │ │ │ -779#undef FALSE │ │ │ │ -780#undef EMPTY │ │ │ │ -781#undef NODROP │ │ │ │ -782#undef DROP_BASIC │ │ │ │ -783#undef DROP_PROWS │ │ │ │ -784#undef DROP_COLUMN │ │ │ │ -785#undef DROP_AREA │ │ │ │ -786#undef DROP_SECONDARY │ │ │ │ -787#undef DROP_DYNAMIC │ │ │ │ -788#undef DROP_INTERP │ │ │ │ -789#undef MILU_ALPHA │ │ │ │ -790 │ │ │ │ -791#endif // HAVE_SUPERLU │ │ │ │ -792#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___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ -_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_:_:_S_u_p_e_r_L_U │ │ │ │ -SuperLU(const Matrix &matrix, bool verbose=false, bool reusevector=true) │ │ │ │ -Constructs the SuperLU solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:424 │ │ │ │ -_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_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:563 │ │ │ │ -_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 │ │ │ │ +194 } │ │ │ │ +195 │ │ │ │ +196 // Insert the matrix values for the local problem │ │ │ │ +197 typename matrix_type::iterator iluRow=_I_L_U.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].end(); _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->_c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x(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->_I_L_U); │ │ │ │ +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=_c_o_p_y_T_o_L_o_c_a_l_M_a_t_r_i_x(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->_I_L_U, (offset+1)/2, RILU); │ │ │ │ +235 } │ │ │ │ +236 │ │ │ │ +238} // end name space DUNE │ │ │ │ +239 │ │ │ │ +240 │ │ │ │ +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 │ │ │ │ _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:467 │ │ │ │ -_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_:_:_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:97 │ │ │ │ -_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_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_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_:_:_S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -friend class SeqOverlappingSchwarz │ │ │ │ -DDeeffiinniittiioonn superlu.hh:374 │ │ │ │ -_D_u_n_e_:_:_S_u_p_e_r_L_U_:_:_S_u_p_e_r_L_U │ │ │ │ -SuperLU(const Matrix &matrix, const ParameterTree &config) │ │ │ │ -Constructs the SuperLU solver. │ │ │ │ -DDeeffiinniittiioonn superlu.hh:320 │ │ │ │ -_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) override │ │ │ │ -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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the solver (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn superlu.hh:287 │ │ │ │ -_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_:_:_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_:_:_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_ _>_ _>_ _>_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -DDeeffiinniittiioonn superlu.hh:718 │ │ │ │ -_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_ _>_ _>_ _>_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -DDeeffiinniittiioonn superlu.hh:724 │ │ │ │ -_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 │ │ │ │ +_D_u_n_e_:_:_c_o_l │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ +_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:103 │ │ │ │ +_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:35 │ │ │ │ +_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:176 │ │ │ │ +_D_u_n_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ +_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:672 │ │ │ │ +_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 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -75,52 +75,86 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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...
class  Dune::SPQR< BCRSMatrix< FieldMatrix< T, n, m >, A > >
 The SPQR direct sparse solver for matrices of type BCRSMatrix. More...
struct  Dune::IsDirectSolver< SPQR< BCRSMatrix< T, A > > >
struct  Dune::StoresColumnCompressed< SPQR< BCRSMatrix< T, A > > >
struct  Dune::OwnerOverlapCopyAttributeSet
 Attribute set for overlapping Schwarz. More...
class  Dune::IndexInfoFromGrid< G, L >
 Information about the index distribution. More...
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::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::CopyGatherScatter< T >
 gather/scatter callback for communication More...
struct  Dune::OwnerOverlapCopyCommunication< GlobalIdType, LocalIdType >::AddGatherScatter< T >
│ │ │ │ │ │ │ │ │

│ │ │ Namespaces

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

│ │ │ Functions

 Dune::DUNE_REGISTER_SOLVER ("spqr", [](auto opTraits, const auto &op, const Dune::ParameterTree &config) -> std::shared_ptr< typename decltype(opTraits)::solver_type > { using OpTraits=decltype(opTraits);using M=typename OpTraits::matrix_type;if constexpr(OpTraits::isParallel){ if(opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune::InvalidStateException, "SPQR works only for sequential operators.");} if constexpr(std::is_convertible_v< SPQR< M > *, Dune::InverseOperator< typename OpTraits::domain_type, typename OpTraits::range_type > * > &&std::is_same_v< typename FieldTraits< M >::field_type, double >){ const auto &A=opTraits.getAssembledOpOrThrow(op);const M &mat=A->getmat();int verbose=config.get("verbose", 0);return std::make_shared< Dune::SPQR< M > >(mat, verbose);} DUNE_THROW(UnsupportedType, "Unsupported Type in SPQR (only FieldMatrix<double,...> supported)");})
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,58 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_._._. │ │ │ │ - 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_._._. │ │ │ │ -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_ _>_ _>_ _> │ │ │ │ -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_:_:_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_:_:_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_._._. │ │ │ │ + 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_:_:_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___S_O_L_V_E_R ("spqr", [](auto opTraits, const auto &op, const │ │ │ │ - Dune::ParameterTree &config) -> std::shared_ptr< typename decltype │ │ │ │ - (opTraits)::solver_type > { using OpTraits=decltype(opTraits);using │ │ │ │ - M=typename OpTraits::matrix_type;if constexpr(OpTraits::isParallel){ if │ │ │ │ - (opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune:: │ │ │ │ - InvalidStateException, "SPQR works only for sequential operators.");} if │ │ │ │ - constexpr(std::is_convertible_v< _S_P_Q_R< M > *, _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< typename │ │ │ │ - OpTraits::domain_type, typename OpTraits::range_type > * > &&std::is_same_v< │ │ │ │ - typename FieldTraits< M >::field_type, double >){ const auto │ │ │ │ - &A=opTraits.getAssembledOpOrThrow(op);const M &mat=A->getmat();int │ │ │ │ - verbose=config.get("verbose", 0);return std::make_shared< _D_u_n_e_:_:_S_P_Q_R< M > > │ │ │ │ - (mat, verbose);} DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "Unsupported Type in _S_P_Q_R (only │ │ │ │ - _F_i_e_l_d_M_a_t_r_i_x supported)");}) │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,392 +71,713 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
33
│ │ │ -
34 // forward declarations
│ │ │ -
35 template<class M, class T, class TM, class TD, class TA>
│ │ │ - │ │ │ -
37
│ │ │ -
38 template<class T, bool tag>
│ │ │ - │ │ │ -
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];
│ │ │ +
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
│ │ │ +
41namespace Dune {
│ │ │ +
42
│ │ │ +
47
│ │ │ +
54
│ │ │ +
│ │ │ + │ │ │ +
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 void apply (domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ -
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;
│ │ │ +
185 typedef typename OwnerOverlapCopyAttributeSet::AttributeSet AttributeSet;
│ │ │ +
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 };
│ │ │ -
│ │ │ -
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
│ │ │ - │ │ │ -
334 [](auto opTraits, const auto& op, const Dune::ParameterTree& config)
│ │ │ -
335 -> std::shared_ptr<typename decltype(opTraits)::solver_type>
│ │ │ -
336 {
│ │ │ -
337 using OpTraits = decltype(opTraits);
│ │ │ -
338 using M = typename OpTraits::matrix_type;
│ │ │ -
339 // works only for sequential operators
│ │ │ -
340 if constexpr (OpTraits::isParallel){
│ │ │ -
341 if(opTraits.getCommOrThrow(op).communicator().size() > 1)
│ │ │ -
342 DUNE_THROW(Dune::InvalidStateException, "SPQR works only for sequential operators.");
│ │ │ -
343 }
│ │ │ -
344 // check if SPQR<M>* is convertible to
│ │ │ -
345 // InverseOperator*. This allows only the explicit
│ │ │ -
346 // specialized variants of SPQR
│ │ │ -
347 // std::complex is temporary disabled, because it fails if libc++ is used
│ │ │ -
348 if constexpr (std::is_convertible_v<SPQR<M>*,
│ │ │ -
349 Dune::InverseOperator<typename OpTraits::domain_type,
│ │ │ -
350 typename OpTraits::range_type>*> &&
│ │ │ -
351 std::is_same_v<typename FieldTraits<M>::field_type, double>
│ │ │ -
352 ){
│ │ │ -
353 const auto& A = opTraits.getAssembledOpOrThrow(op);
│ │ │ -
354 const M& mat = A->getmat();
│ │ │ -
355 int verbose = config.get("verbose", 0);
│ │ │ -
356 return std::make_shared<Dune::SPQR<M>>(mat,verbose);
│ │ │ -
357 }
│ │ │ -
358 DUNE_THROW(UnsupportedType,
│ │ │ -
359 "Unsupported Type in SPQR (only FieldMatrix<double,...> supported)");
│ │ │ -
360 });
│ │ │ -
361
│ │ │ -
362} // end namespace Dune
│ │ │ -
363
│ │ │ -
364
│ │ │ -
365#endif //HAVE_SUITESPARSE_SPQR
│ │ │ -
366#endif //DUNE_ISTL_SPQR_HH
│ │ │ -
Templates characterizing the type of a solver.
│ │ │ -
Implementations of the inverse operator interface.
│ │ │ -
#define DUNE_REGISTER_SOLVER(name,...)
Definition solverregistry.hh:16
│ │ │ - │ │ │ - │ │ │ -
Dune::BCRSMatrix< FieldMatrix< T, n, m >, A > matrix_type
Definition spqr.hh:71
│ │ │ -
friend class SeqOverlappingSchwarz
Definition spqr.hh:282
│ │ │ -
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
│ │ │ -
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
│ │ │ -
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition spqr.hh:155
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category).
Definition spqr.hh:82
│ │ │ -
SPQR()
Default constructor.
Definition spqr.hh:137
│ │ │ -
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
│ │ │ -
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
│ │ │ -
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
│ │ │ -
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res) override
apply inverse operator, with given convergence criteria.
Definition spqr.hh:191
│ │ │ - │ │ │ - │ │ │ +
│ │ │ +
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
│ │ │ +
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
│ │ │ +
700
│ │ │ +
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
│ │ │ -
static auto coldim(const M &)
Definition matrixutils.hh:219
│ │ │ -
static auto rowdim(const M &)
Definition matrixutils.hh:214
│ │ │ -
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:467
│ │ │ -
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:2010
│ │ │ -
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2004
│ │ │ -
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< T, 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
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
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
│ │ │ +
friend void loadMatrixMarket(M &, const std::string &, OwnerOverlapCopyCommunication< G, L > &, bool)
Load a parallel matrix/vector stored in matrix market format.
Definition matrixmarket.hh:1312
│ │ │ +
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
│ │ │ +
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< T, LI, 512 > ParallelIndexSet
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:97
│ │ │ -
Definition solvertype.hh:16
│ │ │ -
Definition solvertype.hh:30
│ │ │ -
Use the SPQR package to directly solve linear systems – empty default class.
Definition spqr.hh:48
│ │ │ +
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,486 +1,837 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 { │ │ │ │ -33 │ │ │ │ -34 // forward declarations │ │ │ │ -35 template │ │ │ │ -36 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ -37 │ │ │ │ -38 template │ │ │ │ -39 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; │ │ │ │ +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 _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 │ │ │ │ -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 _s_e_t_M_a_t_r_i_x(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 _s_e_t_M_a_t_r_i_x(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 _f_r_e_e(); │ │ │ │ -151 cholmod_l_finish(cc_); │ │ │ │ -152 } │ │ │ │ -153 │ │ │ │ -_1_5_5 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) │ │ │ │ -override │ │ │ │ -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 │ │ │ │ +47 │ │ │ │ +54 │ │ │ │ +_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 │ │ │ │ +62 }; │ │ │ │ +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 _f_r_e_e(); │ │ │ │ -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 _f_r_e_e(); │ │ │ │ +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 AttributeSet; │ │ │ │ +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,AttributeSet> _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,AttributeSet> │ │ │ │ +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,AttributeSet> │ │ │ │ +OwnerCopySet; │ │ │ │ +260 OwnerCopySet sourceFlags; │ │ │ │ +261 Combine,AttributeSet> 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,AttributeSet> │ │ │ │ +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 _D_U_N_E___R_E_G_I_S_T_E_R___S_O_L_V_E_R("spqr", │ │ │ │ -334 [](auto opTraits, const auto& op, const Dune::ParameterTree& config) │ │ │ │ -335 -> std::shared_ptr │ │ │ │ -336 { │ │ │ │ -337 using OpTraits = decltype(opTraits); │ │ │ │ -338 using M = typename OpTraits::matrix_type; │ │ │ │ -339 // works only for sequential operators │ │ │ │ -340 if constexpr (OpTraits::isParallel){ │ │ │ │ -341 if(opTraits.getCommOrThrow(op).communicator().size() > 1) │ │ │ │ -342 DUNE_THROW(Dune::InvalidStateException, "SPQR works only for sequential │ │ │ │ -operators."); │ │ │ │ -343 } │ │ │ │ -344 // check if SPQR* is convertible to │ │ │ │ -345 // InverseOperator*. This allows only the explicit │ │ │ │ -346 // specialized variants of SPQR │ │ │ │ -347 // std::complex is temporary disabled, because it fails if libc++ is used │ │ │ │ -348 if constexpr (std::is_convertible_v*, │ │ │ │ -349 _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r*> && │ │ │ │ -351 std::is_same_v::field_type, double> │ │ │ │ -352 ){ │ │ │ │ -353 const auto& A = opTraits.getAssembledOpOrThrow(op); │ │ │ │ -354 const M& mat = A->getmat(); │ │ │ │ -355 int verbose = config.get("verbose", 0); │ │ │ │ -356 return std::make_shared>(mat,verbose); │ │ │ │ -357 } │ │ │ │ -358 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ -359 "Unsupported Type in SPQR (only FieldMatrix supported)"); │ │ │ │ -360 }); │ │ │ │ -361 │ │ │ │ -362} // end namespace Dune │ │ │ │ -363 │ │ │ │ -364 │ │ │ │ -365#endif //HAVE_SUITESPARSE_SPQR │ │ │ │ -366#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___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ -_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_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z │ │ │ │ -friend class SeqOverlappingSchwarz │ │ │ │ -DDeeffiinniittiioonn spqr.hh:282 │ │ │ │ -_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_ _>_ _>_:_:_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_ _>_ _>_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override │ │ │ │ -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_ _>_ _>_:_:_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_ _>_ _>_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -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_ _>_ _>_:_:_S_P_Q_R │ │ │ │ -SPQR() │ │ │ │ -Default constructor. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:137 │ │ │ │ -_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_ _>_ _>_:_:_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_ _>_ _>_:_:_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 │ │ │ │ -_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 │ │ │ │ -void apply(domain_type &x, range_type &b, double reduction, │ │ │ │ -InverseOperatorResult &res) override │ │ │ │ -apply inverse operator, with given convergence criteria. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:191 │ │ │ │ -_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_ _>_ _>_ _>_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -DDeeffiinniittiioonn spqr.hh:324 │ │ │ │ -_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_ _>_ _>_ _>_:_:_v_a_l_u_e │ │ │ │ -@ value │ │ │ │ -DDeeffiinniittiioonn spqr.hh:330 │ │ │ │ +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 │ │ │ │ +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)==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._r_e_m_o_t_e_I_n_d_i_c_e_s().size()>0) │ │ │ │ +613 { │ │ │ │ +614 remoteindex_iterator i=indexinfo.remoteIndices().begin(); │ │ │ │ +615 int p = std::get<0>(*i); │ │ │ │ +616 RILM modifier = ri.template getModifier(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(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(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 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 mask; │ │ │ │ +690 int oldseqNo; │ │ │ │ +691 GlobalLookupIndexSet* 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 │ │ │ │ +700 │ │ │ │ +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_:_:_c_o_l_d_i_m │ │ │ │ -static auto coldim(const M &) │ │ │ │ -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 &) │ │ │ │ -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:467 │ │ │ │ -_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:2010 │ │ │ │ -_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:2004 │ │ │ │ -_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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_P_I_S │ │ │ │ +Dune::ParallelIndexSet< T, 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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_R_e_m_o_t_e_I_n_d_i_c_e_s │ │ │ │ +Dune::RemoteIndices< PIS > RemoteIndices │ │ │ │ +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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ +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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_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_:_:_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:1312 │ │ │ │ +_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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_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_<_ _T_,_ _T_1_ _>_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +Dune::ParallelIndexSet< T, LI, 512 > ParallelIndexSet │ │ │ │ +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:97 │ │ │ │ -_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_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_P_Q_R │ │ │ │ -Use the SPQR package to directly solve linear systems – empty default class. │ │ │ │ -DDeeffiinniittiioonn spqr.hh:48 │ │ │ │ +_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,43 +66,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::StoresColumnCompressed< Solver >
struct  Dune::Amg::PropertiesGraphCreator< M, PI >
struct  Dune::Amg::PropertiesGraphCreator< M, SequentialInformation >
│ │ │ │ │ │ │ │ │ + │ │ │

│ │ │ Namespaces

namespace  Dune
namespace  Dune::Amg
│ │ │ -

Detailed Description

│ │ │ -

Templates characterizing the type of a solver.

│ │ │ -
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,19 +1,24 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_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_,_ _P_I_ _> │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,59 +66,157 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ -
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
│ │ │ +
5#ifndef DUNE_AMG_GRAPHCREATOR_HH
│ │ │ +
6#define DUNE_AMG_GRAPHCREATOR_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,
│ │ │ +
31 typename SubGraph::EdgeIndexMap>
│ │ │ + │ │ │ +
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
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
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.
│ │ │ +
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,187 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 { │ │ │ │ -_2_4 _v_a_l_u_e =false │ │ │ │ -25 }; │ │ │ │ -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 { │ │ │ │ -_3_6 _v_a_l_u_e = false │ │ │ │ -37 }; │ │ │ │ -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 _A_m_g │ │ │ │ +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 SubGraph::EdgeIndexMap> │ │ │ │ +_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 │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,97 +66,47 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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...
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...
struct  Dune::Amg::VertexVisitedTag
 Tag idnetifying the visited property of a vertex. 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_SOLVER ("loopsolver", defaultIterativeSolverCreator< Dune::LoopSolver >())
 Dune::DUNE_REGISTER_SOLVER ("gradientsolver", defaultIterativeSolverCreator< Dune::GradientSolver >())
 Dune::DUNE_REGISTER_SOLVER ("cgsolver", defaultIterativeSolverCreator< Dune::CGSolver >())
 Dune::DUNE_REGISTER_SOLVER ("bicgstabsolver", defaultIterativeSolverCreator< Dune::BiCGSTABSolver >())
 Dune::DUNE_REGISTER_SOLVER ("minressolver", defaultIterativeSolverCreator< Dune::MINRESSolver >())
 Dune::DUNE_REGISTER_SOLVER ("restartedgmressolver", defaultIterativeSolverCreator< Dune::RestartedGMResSolver >())
 Dune::DUNE_REGISTER_SOLVER ("restartedflexiblegmressolver", defaultIterativeSolverCreator< Dune::RestartedFlexibleGMResSolver >())
 Dune::DUNE_REGISTER_SOLVER ("generalizedpcgsolver", defaultIterativeSolverCreator< Dune::GeneralizedPCGSolver >())
 Dune::DUNE_REGISTER_SOLVER ("restartedfcgsolver", defaultIterativeSolverCreator< Dune::RestartedFCGSolver >())
 Dune::DUNE_REGISTER_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,83 +1,29 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_._._. │ │ │ │ -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_._._. │ │ │ │ +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_:_:_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___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___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___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___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___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___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___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___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___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___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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,1678 +66,101 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
38
│ │ │ -
45
│ │ │ -
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
│ │ │ - │ │ │ -
68
│ │ │ -
69 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
70 using IterativeSolver<X,X>::apply;
│ │ │ -
71
│ │ │ -
│ │ │ -
73 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
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 };
│ │ │ -
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
133
│ │ │ -
134 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
135 using IterativeSolver<X,X>::apply;
│ │ │ -
136
│ │ │ -
│ │ │ -
142 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
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 field_type(_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 };
│ │ │ -
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
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
│ │ │ -
│ │ │ -
257 CGSolver (std::shared_ptr<const LinearOperator<X,X>> op, std::shared_ptr<ScalarProduct<X>> sp,
│ │ │ -
258 std::shared_ptr<Preconditioner<X,X>> prec,
│ │ │ -
259 scalar_real_type reduction, int maxit, int verbose, bool condition_estimate)
│ │ │ -
260 : IterativeSolver<X,X>(op, sp, prec, reduction, maxit, verbose),
│ │ │ -
261 condition_estimate_(condition_estimate)
│ │ │ -
262 {
│ │ │ -
263 if (condition_estimate && !(std::is_same<field_type,float>::value || std::is_same<field_type,double>::value)) {
│ │ │ -
264 condition_estimate_ = false;
│ │ │ -
265 std::cerr << "WARNING: Condition estimate was disabled. It is only available for double and float field types!" << std::endl;
│ │ │ -
266 }
│ │ │ -
267 }
│ │ │ -
│ │ │ -
268
│ │ │ -
│ │ │ -
280 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
281 {
│ │ │ -
282 Iteration iteration(*this,res);
│ │ │ -
283 _prec->pre(x,b); // prepare preconditioner
│ │ │ -
284
│ │ │ -
285 _op->applyscaleadd(-1,x,b); // overwrite b with defect
│ │ │ -
286
│ │ │ -
287 real_type def = _sp->norm(b); // compute norm
│ │ │ -
288 if(iteration.step(0, def)){
│ │ │ -
289 _prec->post(x);
│ │ │ -
290 return;
│ │ │ -
291 }
│ │ │ -
292
│ │ │ -
293 X p(x); // the search direction
│ │ │ -
294 X q(x); // a temporary vector
│ │ │ -
295
│ │ │ -
296 // Remember lambda and beta values for condition estimate
│ │ │ -
297 std::vector<real_type> lambdas(0);
│ │ │ -
298 std::vector<real_type> betas(0);
│ │ │ -
299
│ │ │ -
300 // some local variables
│ │ │ -
301 field_type rho,rholast,lambda,alpha,beta;
│ │ │ -
302
│ │ │ -
303 // determine initial search direction
│ │ │ -
304 p = 0; // clear correction
│ │ │ -
305 _prec->apply(p,b); // apply preconditioner
│ │ │ -
306 rholast = _sp->dot(p,b); // orthogonalization
│ │ │ -
307
│ │ │ -
308 // the loop
│ │ │ -
309 int i=1;
│ │ │ -
310 for ( ; i<=_maxit; i++ )
│ │ │ -
311 {
│ │ │ -
312 // minimize in given search direction p
│ │ │ -
313 _op->apply(p,q); // q=Ap
│ │ │ -
314 alpha = _sp->dot(p,q); // scalar product
│ │ │ -
315 lambda = Simd::cond(def==field_type(0.), field_type(0.), field_type(rholast/alpha)); // minimization
│ │ │ -
316 if constexpr (enableConditionEstimate)
│ │ │ -
317 if (condition_estimate_)
│ │ │ -
318 lambdas.push_back(std::real(lambda));
│ │ │ -
319 x.axpy(lambda,p); // update solution
│ │ │ -
320 b.axpy(-lambda,q); // update defect
│ │ │ -
321
│ │ │ -
322 // convergence test
│ │ │ -
323 def=_sp->norm(b); // comp defect norm
│ │ │ -
324 if(iteration.step(i, def))
│ │ │ -
325 break;
│ │ │ -
326
│ │ │ -
327 // determine new search direction
│ │ │ -
328 q = 0; // clear correction
│ │ │ -
329 _prec->apply(q,b); // apply preconditioner
│ │ │ -
330 rho = _sp->dot(q,b); // orthogonalization
│ │ │ -
331 beta = Simd::cond(def==field_type(0.), field_type(0.), field_type(rho/rholast)); // scaling factor
│ │ │ -
332 if constexpr (enableConditionEstimate)
│ │ │ -
333 if (condition_estimate_)
│ │ │ -
334 betas.push_back(std::real(beta));
│ │ │ -
335 p *= beta; // scale old search direction
│ │ │ -
336 p += q; // orthogonalization with correction
│ │ │ -
337 rholast = rho; // remember rho for recurrence
│ │ │ -
338 }
│ │ │ -
339
│ │ │ -
340 _prec->post(x); // postprocess preconditioner
│ │ │ -
341
│ │ │ -
342 if (condition_estimate_) {
│ │ │ -
343#if HAVE_ARPACKPP
│ │ │ -
344 if constexpr (enableConditionEstimate) {
│ │ │ -
345 using std::sqrt;
│ │ │ -
346
│ │ │ -
347 // Build T matrix which has extreme eigenvalues approximating
│ │ │ -
348 // those of the original system
│ │ │ -
349 // (see Y. Saad, Iterative methods for sparse linear systems)
│ │ │ -
350
│ │ │ -
351 COND_MAT T(i, i, COND_MAT::row_wise);
│ │ │ -
352
│ │ │ -
353 for (auto row = T.createbegin(); row != T.createend(); ++row) {
│ │ │ -
354 if (row.index() > 0)
│ │ │ -
355 row.insert(row.index()-1);
│ │ │ -
356 row.insert(row.index());
│ │ │ -
357 if (row.index() < T.N() - 1)
│ │ │ -
358 row.insert(row.index()+1);
│ │ │ -
359 }
│ │ │ -
360 for (int row = 0; row < i; ++row) {
│ │ │ -
361 if (row > 0) {
│ │ │ -
362 T[row][row-1] = sqrt(betas[row-1]) / lambdas[row-1];
│ │ │ -
363 }
│ │ │ -
364
│ │ │ -
365 T[row][row] = 1.0 / lambdas[row];
│ │ │ -
366 if (row > 0) {
│ │ │ -
367 T[row][row] += betas[row-1] / lambdas[row-1];
│ │ │ -
368 }
│ │ │ -
369
│ │ │ -
370 if (row < i - 1) {
│ │ │ -
371 T[row][row+1] = sqrt(betas[row]) / lambdas[row];
│ │ │ -
372 }
│ │ │ -
373 }
│ │ │ -
374
│ │ │ -
375 // Compute largest and smallest eigenvalue of T matrix and return as estimate
│ │ │ - │ │ │ -
377
│ │ │ -
378 real_type eps = 0.0;
│ │ │ -
379 COND_VEC eigv;
│ │ │ -
380 real_type min_eigv, max_eigv;
│ │ │ -
381 arpack.computeSymMinMagnitude (eps, eigv, min_eigv);
│ │ │ -
382 arpack.computeSymMaxMagnitude (eps, eigv, max_eigv);
│ │ │ -
383
│ │ │ -
384 res.condition_estimate = max_eigv / min_eigv;
│ │ │ -
385
│ │ │ -
386 if (this->_verbose > 0) {
│ │ │ -
387 std::cout << "Min eigv estimate: " << Simd::io(min_eigv) << '\n';
│ │ │ -
388 std::cout << "Max eigv estimate: " << Simd::io(max_eigv) << '\n';
│ │ │ -
389 std::cout << "Condition estimate: "
│ │ │ -
390 << Simd::io(max_eigv / min_eigv) << std::endl;
│ │ │ -
391 }
│ │ │ -
392 }
│ │ │ -
393#else
│ │ │ -
394 std::cerr << "WARNING: Condition estimate was requested. This requires ARPACK, but ARPACK was not found!" << std::endl;
│ │ │ -
395#endif
│ │ │ -
396 }
│ │ │ -
397 }
│ │ │ -
│ │ │ -
398
│ │ │ -
399 private:
│ │ │ -
400 bool condition_estimate_ = false;
│ │ │ -
401
│ │ │ -
402 // Matrix and vector types used for condition estimate
│ │ │ - │ │ │ - │ │ │ -
405
│ │ │ -
406 protected:
│ │ │ -
407 using IterativeSolver<X,X>::_op;
│ │ │ -
408 using IterativeSolver<X,X>::_prec;
│ │ │ -
409 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
411 using IterativeSolver<X,X>::_maxit;
│ │ │ -
412 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
414 };
│ │ │ -
│ │ │ - │ │ │ -
416
│ │ │ -
417 // Ronald Kriemanns BiCG-STAB implementation from Sumo
│ │ │ -
419 template<class X>
│ │ │ -
│ │ │ -
420 class BiCGSTABSolver : public IterativeSolver<X,X> {
│ │ │ -
421 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
425 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
426
│ │ │ -
427 // copy base class constructors
│ │ │ - │ │ │ -
429
│ │ │ -
430 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
431 using IterativeSolver<X,X>::apply;
│ │ │ -
432
│ │ │ -
│ │ │ -
440 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
441 {
│ │ │ -
442 using std::abs;
│ │ │ -
443 const Simd::Scalar<real_type> EPSILON=1e-80;
│ │ │ -
444 using std::abs;
│ │ │ -
445 double it;
│ │ │ -
446 field_type rho, rho_new, alpha, beta, h, omega;
│ │ │ -
447 real_type norm;
│ │ │ -
448
│ │ │ -
449 //
│ │ │ -
450 // get vectors and matrix
│ │ │ -
451 //
│ │ │ -
452 X& r=b;
│ │ │ -
453 X p(x);
│ │ │ -
454 X v(x);
│ │ │ -
455 X t(x);
│ │ │ -
456 X y(x);
│ │ │ -
457 X rt(x);
│ │ │ -
458
│ │ │ -
459 //
│ │ │ -
460 // begin iteration
│ │ │ -
461 //
│ │ │ -
462
│ │ │ -
463 // r = r - Ax; rt = r
│ │ │ -
464 Iteration<double> iteration(*this,res);
│ │ │ -
465 _prec->pre(x,r); // prepare preconditioner
│ │ │ -
466
│ │ │ -
467 _op->applyscaleadd(-1,x,r); // overwrite b with defect
│ │ │ -
468
│ │ │ -
469 rt=r;
│ │ │ -
470
│ │ │ -
471 norm = _sp->norm(r);
│ │ │ -
472 if(iteration.step(0, norm)){
│ │ │ -
473 _prec->post(x);
│ │ │ -
474 return;
│ │ │ -
475 }
│ │ │ -
476 p=0;
│ │ │ -
477 v=0;
│ │ │ -
478
│ │ │ -
479 rho = 1;
│ │ │ -
480 alpha = 1;
│ │ │ -
481 omega = 1;
│ │ │ -
482
│ │ │ -
483 //
│ │ │ -
484 // iteration
│ │ │ -
485 //
│ │ │ -
486
│ │ │ -
487 for (it = 0.5; it < _maxit; it+=.5)
│ │ │ -
488 {
│ │ │ -
489 //
│ │ │ -
490 // preprocess, set vecsizes etc.
│ │ │ -
491 //
│ │ │ -
492
│ │ │ -
493 // rho_new = < rt , r >
│ │ │ -
494 rho_new = _sp->dot(rt,r);
│ │ │ -
495
│ │ │ -
496 // look if breakdown occurred
│ │ │ -
497 if (Simd::allTrue(abs(rho) <= EPSILON))
│ │ │ -
498 DUNE_THROW(SolverAbort,"breakdown in BiCGSTAB - rho "
│ │ │ -
499 << Simd::io(rho) << " <= EPSILON " << EPSILON
│ │ │ -
500 << " after " << it << " iterations");
│ │ │ -
501 if (Simd::allTrue(abs(omega) <= EPSILON))
│ │ │ -
502 DUNE_THROW(SolverAbort,"breakdown in BiCGSTAB - omega "
│ │ │ -
503 << Simd::io(omega) << " <= EPSILON " << EPSILON
│ │ │ -
504 << " after " << it << " iterations");
│ │ │ -
505
│ │ │ -
506
│ │ │ -
507 if (it<1)
│ │ │ -
508 p = r;
│ │ │ -
509 else
│ │ │ -
510 {
│ │ │ -
511 beta = Simd::cond(norm==field_type(0.),
│ │ │ -
512 field_type(0.), // no need for orthogonalization if norm is already 0
│ │ │ -
513 field_type(( rho_new / rho ) * ( alpha / omega )));
│ │ │ -
514 p.axpy(-omega,v); // p = r + beta (p - omega*v)
│ │ │ -
515 p *= beta;
│ │ │ -
516 p += r;
│ │ │ -
517 }
│ │ │ -
518
│ │ │ -
519 // y = W^-1 * p
│ │ │ -
520 y = 0;
│ │ │ -
521 _prec->apply(y,p); // apply preconditioner
│ │ │ -
522
│ │ │ -
523 // v = A * y
│ │ │ -
524 _op->apply(y,v);
│ │ │ -
525
│ │ │ -
526 // alpha = rho_new / < rt, v >
│ │ │ -
527 h = _sp->dot(rt,v);
│ │ │ -
528
│ │ │ -
529 if ( Simd::allTrue(abs(h) < EPSILON) )
│ │ │ -
530 DUNE_THROW(SolverAbort,"abs(h) < EPSILON in BiCGSTAB - abs(h) "
│ │ │ -
531 << Simd::io(abs(h)) << " < EPSILON " << EPSILON
│ │ │ -
532 << " after " << it << " iterations");
│ │ │ -
533
│ │ │ -
534 alpha = Simd::cond(norm==field_type(0.),
│ │ │ -
535 field_type(0.),
│ │ │ -
536 field_type(rho_new / h));
│ │ │ -
537
│ │ │ -
538 // apply first correction to x
│ │ │ -
539 // x <- x + alpha y
│ │ │ -
540 x.axpy(alpha,y);
│ │ │ -
541
│ │ │ -
542 // r = r - alpha*v
│ │ │ -
543 r.axpy(-alpha,v);
│ │ │ -
544
│ │ │ -
545 //
│ │ │ -
546 // test stop criteria
│ │ │ -
547 //
│ │ │ -
548
│ │ │ -
549 norm = _sp->norm(r);
│ │ │ -
550 if(iteration.step(it, norm)){
│ │ │ -
551 break;
│ │ │ -
552 }
│ │ │ -
553
│ │ │ -
554 it+=.5;
│ │ │ -
555
│ │ │ -
556 // y = W^-1 * r
│ │ │ -
557 y = 0;
│ │ │ -
558 _prec->apply(y,r);
│ │ │ -
559
│ │ │ -
560 // t = A * y
│ │ │ -
561 _op->apply(y,t);
│ │ │ -
562
│ │ │ -
563 // omega = < t, r > / < t, t >
│ │ │ -
564 h = _sp->dot(t,t);
│ │ │ -
565 omega = Simd::cond(norm==field_type(0.),
│ │ │ -
566 field_type(0.),
│ │ │ -
567 field_type(_sp->dot(t,r)/h));
│ │ │ -
568
│ │ │ -
569 // apply second correction to x
│ │ │ -
570 // x <- x + omega y
│ │ │ -
571 x.axpy(omega,y);
│ │ │ -
572
│ │ │ -
573 // r = s - omega*t (remember : r = s)
│ │ │ -
574 r.axpy(-omega,t);
│ │ │ -
575
│ │ │ -
576 rho = rho_new;
│ │ │ -
577
│ │ │ -
578 //
│ │ │ -
579 // test stop criteria
│ │ │ -
580 //
│ │ │ -
581
│ │ │ -
582 norm = _sp->norm(r);
│ │ │ -
583 if(iteration.step(it, norm)){
│ │ │ -
584 break;
│ │ │ -
585 }
│ │ │ -
586 } // end for
│ │ │ -
587
│ │ │ -
588 _prec->post(x); // postprocess preconditioner
│ │ │ -
589 }
│ │ │ -
│ │ │ -
590
│ │ │ -
591 protected:
│ │ │ -
592 using IterativeSolver<X,X>::_op;
│ │ │ -
593 using IterativeSolver<X,X>::_prec;
│ │ │ -
594 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
596 using IterativeSolver<X,X>::_maxit;
│ │ │ -
597 using IterativeSolver<X,X>::_verbose;
│ │ │ -
598 template<class CountType>
│ │ │ - │ │ │ -
600 };
│ │ │ -
│ │ │ - │ │ │ -
602
│ │ │ -
609 template<class X>
│ │ │ -
│ │ │ -
610 class MINRESSolver : public IterativeSolver<X,X> {
│ │ │ -
611 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
615 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
616
│ │ │ -
617 // copy base class constructors
│ │ │ - │ │ │ -
619
│ │ │ -
620 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
621 using IterativeSolver<X,X>::apply;
│ │ │ -
622
│ │ │ -
│ │ │ -
628 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
629 {
│ │ │ -
630 using std::sqrt;
│ │ │ -
631 using std::abs;
│ │ │ -
632 Iteration iteration(*this, res);
│ │ │ -
633 // prepare preconditioner
│ │ │ -
634 _prec->pre(x,b);
│ │ │ -
635
│ │ │ -
636 // overwrite rhs with defect
│ │ │ -
637 _op->applyscaleadd(-1.0,x,b); // b -= Ax
│ │ │ -
638
│ │ │ -
639 // some temporary vectors
│ │ │ -
640 X z(b), dummy(b);
│ │ │ -
641 z = 0.0;
│ │ │ -
642
│ │ │ -
643 // calculate preconditioned defect
│ │ │ -
644 _prec->apply(z,b); // r = W^-1 (b - Ax)
│ │ │ -
645 real_type def = _sp->norm(z);
│ │ │ -
646 if (iteration.step(0, def)){
│ │ │ -
647 _prec->post(x);
│ │ │ -
648 return;
│ │ │ -
649 }
│ │ │ -
650
│ │ │ -
651 // recurrence coefficients as computed in Lanczos algorithm
│ │ │ -
652 field_type alpha, beta;
│ │ │ -
653 // diagonal entries of givens rotation
│ │ │ -
654 std::array<real_type,2> c{{0.0,0.0}};
│ │ │ -
655 // off-diagonal entries of givens rotation
│ │ │ -
656 std::array<field_type,2> s{{0.0,0.0}};
│ │ │ -
657
│ │ │ -
658 // recurrence coefficients (column k of tridiag matrix T_k)
│ │ │ -
659 std::array<field_type,3> T{{0.0,0.0,0.0}};
│ │ │ -
660
│ │ │ -
661 // the rhs vector of the min problem
│ │ │ -
662 std::array<field_type,2> xi{{1.0,0.0}};
│ │ │ -
663
│ │ │ -
664 // beta is real and positive in exact arithmetic
│ │ │ -
665 // since it is the norm of the basis vectors (in unpreconditioned case)
│ │ │ -
666 beta = sqrt(_sp->dot(b,z));
│ │ │ -
667 field_type beta0 = beta;
│ │ │ -
668
│ │ │ -
669 // the search directions
│ │ │ -
670 std::array<X,3> p{{b,b,b}};
│ │ │ -
671 p[0] = 0.0;
│ │ │ -
672 p[1] = 0.0;
│ │ │ -
673 p[2] = 0.0;
│ │ │ -
674
│ │ │ -
675 // orthonormal basis vectors (in unpreconditioned case)
│ │ │ -
676 std::array<X,3> q{{b,b,b}};
│ │ │ -
677 q[0] = 0.0;
│ │ │ -
678 q[1] *= Simd::cond(def==field_type(0.),
│ │ │ -
679 field_type(0.),
│ │ │ -
680 field_type(real_type(1.0)/beta));
│ │ │ -
681 q[2] = 0.0;
│ │ │ -
682
│ │ │ -
683 z *= Simd::cond(def==field_type(0.),
│ │ │ -
684 field_type(0.),
│ │ │ -
685 field_type(real_type(1.0)/beta));
│ │ │ -
686
│ │ │ -
687 // the loop
│ │ │ -
688 int i = 1;
│ │ │ -
689 for( ; i<=_maxit; i++) {
│ │ │ -
690
│ │ │ -
691 dummy = z;
│ │ │ -
692 int i1 = i%3,
│ │ │ -
693 i0 = (i1+2)%3,
│ │ │ -
694 i2 = (i1+1)%3;
│ │ │ -
695
│ │ │ -
696 // symmetrically preconditioned Lanczos algorithm (see Greenbaum p.121)
│ │ │ -
697 _op->apply(z,q[i2]); // q[i2] = Az
│ │ │ -
698 q[i2].axpy(-beta,q[i0]);
│ │ │ -
699 // alpha is real since it is the diagonal entry of the hermitian tridiagonal matrix
│ │ │ -
700 // from the Lanczos Algorithm
│ │ │ -
701 // so the order in the scalar product doesn't matter even for the complex case
│ │ │ -
702 alpha = _sp->dot(z,q[i2]);
│ │ │ -
703 q[i2].axpy(-alpha,q[i1]);
│ │ │ -
704
│ │ │ -
705 z = 0.0;
│ │ │ -
706 _prec->apply(z,q[i2]);
│ │ │ -
707
│ │ │ -
708 // beta is real and positive in exact arithmetic
│ │ │ -
709 // since it is the norm of the basis vectors (in unpreconditioned case)
│ │ │ -
710 beta = sqrt(_sp->dot(q[i2],z));
│ │ │ -
711
│ │ │ -
712 q[i2] *= Simd::cond(def==field_type(0.),
│ │ │ -
713 field_type(0.),
│ │ │ -
714 field_type(real_type(1.0)/beta));
│ │ │ -
715 z *= Simd::cond(def==field_type(0.),
│ │ │ -
716 field_type(0.),
│ │ │ -
717 field_type(real_type(1.0)/beta));
│ │ │ -
718
│ │ │ -
719 // QR Factorization of recurrence coefficient matrix
│ │ │ -
720 // apply previous givens rotations to last column of T
│ │ │ -
721 T[1] = T[2];
│ │ │ -
722 if(i>2) {
│ │ │ -
723 T[0] = s[i%2]*T[1];
│ │ │ -
724 T[1] = c[i%2]*T[1];
│ │ │ -
725 }
│ │ │ -
726 if(i>1) {
│ │ │ -
727 T[2] = c[(i+1)%2]*alpha - s[(i+1)%2]*T[1];
│ │ │ -
728 T[1] = c[(i+1)%2]*T[1] + s[(i+1)%2]*alpha;
│ │ │ -
729 }
│ │ │ -
730 else
│ │ │ -
731 T[2] = alpha;
│ │ │ -
732
│ │ │ -
733 // update QR factorization
│ │ │ -
734 generateGivensRotation(T[2],beta,c[i%2],s[i%2]);
│ │ │ -
735 // to last column of T_k
│ │ │ -
736 T[2] = c[i%2]*T[2] + s[i%2]*beta;
│ │ │ -
737 // and to the rhs xi of the min problem
│ │ │ -
738 xi[i%2] = -s[i%2]*xi[(i+1)%2];
│ │ │ -
739 xi[(i+1)%2] *= c[i%2];
│ │ │ -
740
│ │ │ -
741 // compute correction direction
│ │ │ -
742 p[i2] = dummy;
│ │ │ -
743 p[i2].axpy(-T[1],p[i1]);
│ │ │ -
744 p[i2].axpy(-T[0],p[i0]);
│ │ │ -
745 p[i2] *= real_type(1.0)/T[2];
│ │ │ -
746
│ │ │ -
747 // apply correction/update solution
│ │ │ -
748 x.axpy(beta0*xi[(i+1)%2],p[i2]);
│ │ │ -
749
│ │ │ -
750 // remember beta_old
│ │ │ -
751 T[2] = beta;
│ │ │ -
752
│ │ │ -
753 // check for convergence
│ │ │ -
754 // the last entry in the rhs of the min-problem is the residual
│ │ │ -
755 def = abs(beta0*xi[i%2]);
│ │ │ -
756 if(iteration.step(i, def)){
│ │ │ -
757 break;
│ │ │ -
758 }
│ │ │ -
759 } // end for
│ │ │ -
760
│ │ │ -
761 // postprocess preconditioner
│ │ │ -
762 _prec->post(x);
│ │ │ -
763 }
│ │ │ -
│ │ │ -
764
│ │ │ -
765 private:
│ │ │ -
766
│ │ │ -
767 void generateGivensRotation(field_type &dx, field_type &dy, real_type &cs, field_type &sn)
│ │ │ -
768 {
│ │ │ -
769 using std::sqrt;
│ │ │ -
770 using std::abs;
│ │ │ -
771 using std::max;
│ │ │ -
772 using std::min;
│ │ │ -
773 const real_type eps = 1e-15;
│ │ │ -
774 real_type norm_dx = abs(dx);
│ │ │ -
775 real_type norm_dy = abs(dy);
│ │ │ -
776 real_type norm_max = max(norm_dx, norm_dy);
│ │ │ -
777 real_type norm_min = min(norm_dx, norm_dy);
│ │ │ -
778 real_type temp = norm_min/norm_max;
│ │ │ -
779 // we rewrite the code in a vectorizable fashion
│ │ │ -
780 cs = Simd::cond(norm_dy < eps,
│ │ │ -
781 real_type(1.0),
│ │ │ -
782 real_type(Simd::cond(norm_dx < eps,
│ │ │ -
783 real_type(0.0),
│ │ │ -
784 real_type(Simd::cond(norm_dy > norm_dx,
│ │ │ -
785 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)*temp,
│ │ │ -
786 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)
│ │ │ -
787 )))));
│ │ │ -
788 sn = Simd::cond(norm_dy < eps,
│ │ │ -
789 field_type(0.0),
│ │ │ -
790 field_type(Simd::cond(norm_dx < eps,
│ │ │ -
791 field_type(1.0),
│ │ │ -
792 field_type(Simd::cond(norm_dy > norm_dx,
│ │ │ -
793 // dy and dx are real in exact arithmetic
│ │ │ -
794 // thus dx*dy is real so we can explicitly enforce it
│ │ │ -
795 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*dx*dy/norm_dx/norm_dy,
│ │ │ -
796 // dy and dx is real in exact arithmetic
│ │ │ -
797 // so we don't have to conjugate both of them
│ │ │ -
798 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*dy/dx
│ │ │ -
799 )))));
│ │ │ -
800 }
│ │ │ -
801
│ │ │ -
802 protected:
│ │ │ -
803 using IterativeSolver<X,X>::_op;
│ │ │ -
804 using IterativeSolver<X,X>::_prec;
│ │ │ -
805 using IterativeSolver<X,X>::_sp;
│ │ │ - │ │ │ -
807 using IterativeSolver<X,X>::_maxit;
│ │ │ -
808 using IterativeSolver<X,X>::_verbose;
│ │ │ - │ │ │ -
810 };
│ │ │ -
│ │ │ - │ │ │ -
812
│ │ │ -
825
│ │ │ -
826 template<class X, class Y=X, class F = Y>
│ │ │ -
│ │ │ - │ │ │ -
828 {
│ │ │ -
829 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
833 using typename IterativeSolver<X,Y>::real_type;
│ │ │ -
834
│ │ │ -
835 protected:
│ │ │ - │ │ │ -
837
│ │ │ - │ │ │ - │ │ │ -
842
│ │ │ -
843 public:
│ │ │ -
844
│ │ │ -
│ │ │ -
851 RestartedGMResSolver (const LinearOperator<X,Y>& op, Preconditioner<X,Y>& prec, scalar_real_type reduction, int restart, int maxit, int verbose) :
│ │ │ -
852 IterativeSolver<X,Y>::IterativeSolver(op,prec,reduction,maxit,verbose),
│ │ │ -
853 _restart(restart)
│ │ │ -
854 {}
│ │ │ -
│ │ │ -
855
│ │ │ -
│ │ │ -
862 RestartedGMResSolver (const LinearOperator<X,Y>& op, const ScalarProduct<X>& sp, Preconditioner<X,Y>& prec, scalar_real_type reduction, int restart, int maxit, int verbose) :
│ │ │ -
863 IterativeSolver<X,Y>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
864 _restart(restart)
│ │ │ -
865 {}
│ │ │ -
│ │ │ -
866
│ │ │ -
│ │ │ -
879 RestartedGMResSolver (std::shared_ptr<const LinearOperator<X,Y> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
880 IterativeSolver<X,Y>::IterativeSolver(op,prec,configuration),
│ │ │ -
881 _restart(configuration.get<int>("restart"))
│ │ │ -
882 {}
│ │ │ -
│ │ │ -
883
│ │ │ -
│ │ │ -
884 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) :
│ │ │ -
885 IterativeSolver<X,Y>::IterativeSolver(op,sp,prec,configuration),
│ │ │ -
886 _restart(configuration.get<int>("restart"))
│ │ │ -
887 {}
│ │ │ -
│ │ │ -
888
│ │ │ -
│ │ │ -
895 RestartedGMResSolver (std::shared_ptr<const LinearOperator<X,Y>> op,
│ │ │ -
896 std::shared_ptr<const ScalarProduct<X>> sp,
│ │ │ -
897 std::shared_ptr<Preconditioner<X,Y>> prec,
│ │ │ -
898 scalar_real_type reduction, int restart, int maxit, int verbose) :
│ │ │ -
899 IterativeSolver<X,Y>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
900 _restart(restart)
│ │ │ -
901 {}
│ │ │ -
│ │ │ -
902
│ │ │ -
│ │ │ -
911 void apply (X& x, Y& b, InverseOperatorResult& res) override
│ │ │ -
912 {
│ │ │ -
913 apply(x,b,Simd::max(_reduction),res);
│ │ │ -
914 }
│ │ │ -
│ │ │ -
915
│ │ │ -
│ │ │ -
924 void apply (X& x, Y& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ -
925 {
│ │ │ -
926 using std::abs;
│ │ │ -
927 const Simd::Scalar<real_type> EPSILON = 1e-80;
│ │ │ -
928 const int m = _restart;
│ │ │ -
929 real_type norm = 0.0;
│ │ │ -
930 int j = 1;
│ │ │ -
931 std::vector<field_type,fAlloc> s(m+1), sn(m);
│ │ │ -
932 std::vector<real_type,rAlloc> cs(m);
│ │ │ -
933 // need copy of rhs if GMRes has to be restarted
│ │ │ -
934 Y b2(b);
│ │ │ -
935 // helper vector
│ │ │ -
936 Y w(b);
│ │ │ -
937 std::vector< std::vector<field_type,fAlloc> > H(m+1,s);
│ │ │ -
938 std::vector<F> v(m+1,b);
│ │ │ -
939
│ │ │ -
940 Iteration iteration(*this,res);
│ │ │ -
941
│ │ │ -
942 // clear solver statistics and set res.converged to false
│ │ │ -
943 _prec->pre(x,b);
│ │ │ -
944
│ │ │ -
945 // calculate defect and overwrite rhs with it
│ │ │ -
946 _op->applyscaleadd(-1.0,x,b); // b -= Ax
│ │ │ -
947 // calculate preconditioned defect
│ │ │ -
948 v[0] = 0.0; _prec->apply(v[0],b); // r = W^-1 b
│ │ │ -
949 norm = _sp->norm(v[0]);
│ │ │ -
950 if(iteration.step(0, norm)){
│ │ │ -
951 _prec->post(x);
│ │ │ -
952 return;
│ │ │ -
953 }
│ │ │ -
954
│ │ │ -
955 while(j <= _maxit && res.converged != true) {
│ │ │ -
956
│ │ │ -
957 int i = 0;
│ │ │ -
958 v[0] *= Simd::cond(norm==real_type(0.),
│ │ │ -
959 real_type(0.),
│ │ │ -
960 real_type(real_type(1.0)/norm));
│ │ │ -
961 s[0] = norm;
│ │ │ -
962 for(i=1; i<m+1; i++)
│ │ │ -
963 s[i] = 0.0;
│ │ │ -
964
│ │ │ -
965 for(i=0; i < m && j <= _maxit && res.converged != true; i++, j++) {
│ │ │ -
966 w = 0.0;
│ │ │ -
967 // use v[i+1] as temporary vector
│ │ │ -
968 v[i+1] = 0.0;
│ │ │ -
969 // do Arnoldi algorithm
│ │ │ -
970 _op->apply(v[i],v[i+1]);
│ │ │ -
971 _prec->apply(w,v[i+1]);
│ │ │ -
972 for(int k=0; k<i+1; k++) {
│ │ │ -
973 // notice that _sp->dot(v[k],w) = v[k]\adjoint w
│ │ │ -
974 // so one has to pay attention to the order
│ │ │ -
975 // in the scalar product for the complex case
│ │ │ -
976 // doing the modified Gram-Schmidt algorithm
│ │ │ -
977 H[k][i] = _sp->dot(v[k],w);
│ │ │ -
978 // w -= H[k][i] * v[k]
│ │ │ -
979 w.axpy(-H[k][i],v[k]);
│ │ │ -
980 }
│ │ │ -
981 H[i+1][i] = _sp->norm(w);
│ │ │ -
982 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON))
│ │ │ -
983 DUNE_THROW(SolverAbort,
│ │ │ -
984 "breakdown in GMRes - |w| == 0.0 after " << j << " iterations");
│ │ │ -
985
│ │ │ -
986 // normalize new vector
│ │ │ -
987 v[i+1] = w;
│ │ │ -
988 v[i+1] *= Simd::cond(norm==real_type(0.),
│ │ │ -
989 field_type(0.),
│ │ │ -
990 field_type(real_type(1.0)/H[i+1][i]));
│ │ │ -
991
│ │ │ -
992 // update QR factorization
│ │ │ -
993 for(int k=0; k<i; k++)
│ │ │ -
994 applyPlaneRotation(H[k][i],H[k+1][i],cs[k],sn[k]);
│ │ │ -
995
│ │ │ -
996 // compute new givens rotation
│ │ │ -
997 generatePlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
998 // finish updating QR factorization
│ │ │ -
999 applyPlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
1000 applyPlaneRotation(s[i],s[i+1],cs[i],sn[i]);
│ │ │ -
1001
│ │ │ -
1002 // norm of the defect is the last component the vector s
│ │ │ -
1003 norm = abs(s[i+1]);
│ │ │ -
1004
│ │ │ -
1005 iteration.step(j, norm);
│ │ │ -
1006
│ │ │ -
1007 } // end for
│ │ │ -
1008
│ │ │ -
1009 // calculate update vector
│ │ │ -
1010 w = 0.0;
│ │ │ -
1011 update(w,i,H,s,v);
│ │ │ -
1012 // and current iterate
│ │ │ -
1013 x += w;
│ │ │ -
1014
│ │ │ -
1015 // restart GMRes if convergence was not achieved,
│ │ │ -
1016 // i.e. linear defect has not reached desired reduction
│ │ │ -
1017 // and if j < _maxit (do not restart on last iteration)
│ │ │ -
1018 if( res.converged != true && j < _maxit ) {
│ │ │ -
1019
│ │ │ -
1020 if(_verbose > 0)
│ │ │ -
1021 std::cout << "=== GMRes::restart" << std::endl;
│ │ │ -
1022 // get saved rhs
│ │ │ -
1023 b = b2;
│ │ │ -
1024 // calculate new defect
│ │ │ -
1025 _op->applyscaleadd(-1.0,x,b); // b -= Ax;
│ │ │ -
1026 // calculate preconditioned defect
│ │ │ -
1027 v[0] = 0.0;
│ │ │ -
1028 _prec->apply(v[0],b);
│ │ │ -
1029 norm = _sp->norm(v[0]);
│ │ │ -
1030 }
│ │ │ -
1031
│ │ │ -
1032 } //end while
│ │ │ -
1033
│ │ │ -
1034 // postprocess preconditioner
│ │ │ -
1035 _prec->post(x);
│ │ │ -
1036 }
│ │ │ -
│ │ │ -
1037
│ │ │ -
1038 protected :
│ │ │ -
1039
│ │ │ -
│ │ │ -
1040 void update(X& w, int i,
│ │ │ -
1041 const std::vector<std::vector<field_type,fAlloc> >& H,
│ │ │ -
1042 const std::vector<field_type,fAlloc>& s,
│ │ │ -
1043 const std::vector<X>& v) {
│ │ │ -
1044 // solution vector of the upper triangular system
│ │ │ -
1045 std::vector<field_type,fAlloc> y(s);
│ │ │ -
1046
│ │ │ -
1047 // backsolve
│ │ │ -
1048 for(int a=i-1; a>=0; a--) {
│ │ │ -
1049 field_type rhs(s[a]);
│ │ │ -
1050 for(int b=a+1; b<i; b++)
│ │ │ -
1051 rhs -= H[a][b]*y[b];
│ │ │ -
1052 y[a] = Simd::cond(rhs==field_type(0.),
│ │ │ -
1053 field_type(0.),
│ │ │ -
1054 field_type(rhs/H[a][a]));
│ │ │ -
1055
│ │ │ -
1056 // compute update on the fly
│ │ │ -
1057 // w += y[a]*v[a]
│ │ │ -
1058 w.axpy(y[a],v[a]);
│ │ │ -
1059 }
│ │ │ -
1060 }
│ │ │ -
│ │ │ -
1061
│ │ │ -
1062 template<typename T>
│ │ │ -
│ │ │ -
1063 typename std::enable_if<std::is_same<field_type,real_type>::value,T>::type conjugate(const T& t) {
│ │ │ -
1064 return t;
│ │ │ -
1065 }
│ │ │ -
│ │ │ -
1066
│ │ │ -
1067 template<typename T>
│ │ │ -
│ │ │ -
1068 typename std::enable_if<!std::is_same<field_type,real_type>::value,T>::type conjugate(const T& t) {
│ │ │ -
1069 using std::conj;
│ │ │ -
1070 return conj(t);
│ │ │ -
1071 }
│ │ │ -
│ │ │ -
1072
│ │ │ -
1073 void
│ │ │ -
│ │ │ - │ │ │ -
1075 {
│ │ │ -
1076 using std::sqrt;
│ │ │ -
1077 using std::abs;
│ │ │ -
1078 using std::max;
│ │ │ -
1079 using std::min;
│ │ │ -
1080 const real_type eps = 1e-15;
│ │ │ -
1081 real_type norm_dx = abs(dx);
│ │ │ -
1082 real_type norm_dy = abs(dy);
│ │ │ -
1083 real_type norm_max = max(norm_dx, norm_dy);
│ │ │ -
1084 real_type norm_min = min(norm_dx, norm_dy);
│ │ │ -
1085 real_type temp = norm_min/norm_max;
│ │ │ -
1086 // we rewrite the code in a vectorizable fashion
│ │ │ -
1087 cs = Simd::cond(norm_dy < eps,
│ │ │ -
1088 real_type(1.0),
│ │ │ -
1089 Simd::cond(norm_dx < eps,
│ │ │ -
1090 real_type(0.0),
│ │ │ -
1091 real_type(Simd::cond(norm_dy > norm_dx,
│ │ │ -
1092 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)*temp,
│ │ │ -
1093 real_type(1.0)/sqrt(real_type(1.0) + temp*temp)
│ │ │ -
1094 ))));
│ │ │ -
1095 sn = Simd::cond(norm_dy < eps,
│ │ │ -
1096 field_type(0.0),
│ │ │ -
1097 Simd::cond(norm_dx < eps,
│ │ │ -
1098 field_type(1.0),
│ │ │ -
1099 field_type(Simd::cond(norm_dy > norm_dx,
│ │ │ -
1100 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*dx*conjugate(dy)/norm_dx/norm_dy,
│ │ │ -
1101 field_type(1.0)/sqrt(real_type(1.0) + temp*temp)*conjugate(dy/dx)
│ │ │ -
1102 ))));
│ │ │ -
1103 }
│ │ │ -
│ │ │ -
1104
│ │ │ -
1105
│ │ │ -
1106 void
│ │ │ -
│ │ │ - │ │ │ -
1108 {
│ │ │ -
1109 field_type temp = cs * dx + sn * dy;
│ │ │ -
1110 dy = -conjugate(sn) * dx + cs * dy;
│ │ │ -
1111 dx = temp;
│ │ │ -
1112 }
│ │ │ -
│ │ │ -
1113
│ │ │ -
1114 using IterativeSolver<X,Y>::_op;
│ │ │ -
1115 using IterativeSolver<X,Y>::_prec;
│ │ │ -
1116 using IterativeSolver<X,Y>::_sp;
│ │ │ -
1117 using IterativeSolver<X,Y>::_reduction;
│ │ │ -
1118 using IterativeSolver<X,Y>::_maxit;
│ │ │ -
1119 using IterativeSolver<X,Y>::_verbose;
│ │ │ - │ │ │ - │ │ │ -
1122 };
│ │ │ -
│ │ │ - │ │ │ -
1124
│ │ │ -
1137
│ │ │ -
1138 template<class X, class Y=X, class F = Y>
│ │ │ -
│ │ │ - │ │ │ -
1140 {
│ │ │ -
1141 public:
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
1146
│ │ │ -
1147 private:
│ │ │ - │ │ │ -
1149
│ │ │ -
1151 using fAlloc = typename RestartedGMResSolver<X,Y>::fAlloc;
│ │ │ -
1153 using rAlloc = typename RestartedGMResSolver<X,Y>::rAlloc;
│ │ │ -
1154
│ │ │ -
1155 public:
│ │ │ -
1156 // copy base class constructors
│ │ │ - │ │ │ -
1158
│ │ │ -
1159 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
1160 using RestartedGMResSolver<X,Y>::apply;
│ │ │ -
1161
│ │ │ -
│ │ │ -
1170 void apply (X& x, Y& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ -
1171 {
│ │ │ -
1172 using std::abs;
│ │ │ -
1173 const Simd::Scalar<real_type> EPSILON = 1e-80;
│ │ │ -
1174 const int m = _restart;
│ │ │ -
1175 real_type norm = 0.0;
│ │ │ -
1176 int i, j = 1, k;
│ │ │ -
1177 std::vector<field_type,fAlloc> s(m+1), sn(m);
│ │ │ -
1178 std::vector<real_type,rAlloc> cs(m);
│ │ │ -
1179 // helper vector
│ │ │ -
1180 Y tmp(b);
│ │ │ -
1181 std::vector< std::vector<field_type,fAlloc> > H(m+1,s);
│ │ │ -
1182 std::vector<F> v(m+1,b);
│ │ │ -
1183 std::vector<X> w(m+1,b);
│ │ │ -
1184
│ │ │ -
1185 Iteration iteration(*this,res);
│ │ │ -
1186 // setup preconditioner if it does something in pre
│ │ │ -
1187
│ │ │ -
1188 // calculate residual and overwrite a copy of the rhs with it
│ │ │ -
1189 _prec->pre(x, b);
│ │ │ -
1190 v[0] = b;
│ │ │ -
1191 _op->applyscaleadd(-1.0, x, v[0]); // b -= Ax
│ │ │ -
1192
│ │ │ -
1193 norm = _sp->norm(v[0]); // the residual norm
│ │ │ -
1194 if(iteration.step(0, norm)){
│ │ │ -
1195 _prec->post(x);
│ │ │ -
1196 return;
│ │ │ -
1197 }
│ │ │ -
1198
│ │ │ -
1199 // start iterations
│ │ │ -
1200 res.converged = false;;
│ │ │ -
1201 while(j <= _maxit && res.converged != true)
│ │ │ -
1202 {
│ │ │ -
1203 v[0] *= (1.0 / norm);
│ │ │ -
1204 s[0] = norm;
│ │ │ -
1205 for(i=1; i<m+1; ++i)
│ │ │ -
1206 s[i] = 0.0;
│ │ │ -
1207
│ │ │ -
1208 // inner loop
│ │ │ -
1209 for(i=0; i < m && j <= _maxit && res.converged != true; i++, j++)
│ │ │ -
1210 {
│ │ │ -
1211 w[i] = 0.0;
│ │ │ -
1212 // compute wi = M^-1*vi (also called zi)
│ │ │ -
1213 _prec->apply(w[i], v[i]);
│ │ │ -
1214 // compute vi = A*wi
│ │ │ -
1215 // use v[i+1] as temporary vector for w
│ │ │ -
1216 _op->apply(w[i], v[i+1]);
│ │ │ -
1217 // do Arnoldi algorithm
│ │ │ -
1218 for(int kk=0; kk<i+1; kk++)
│ │ │ -
1219 {
│ │ │ -
1220 // notice that _sp->dot(v[k],v[i+1]) = v[k]\adjoint v[i+1]
│ │ │ -
1221 // so one has to pay attention to the order
│ │ │ -
1222 // in the scalar product for the complex case
│ │ │ -
1223 // doing the modified Gram-Schmidt algorithm
│ │ │ -
1224 H[kk][i] = _sp->dot(v[kk],v[i+1]);
│ │ │ -
1225 // w -= H[k][i] * v[kk]
│ │ │ -
1226 v[i+1].axpy(-H[kk][i], v[kk]);
│ │ │ -
1227 }
│ │ │ -
1228 H[i+1][i] = _sp->norm(v[i+1]);
│ │ │ -
1229 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON))
│ │ │ -
1230 DUNE_THROW(SolverAbort, "breakdown in fGMRes - |w| (-> "
│ │ │ -
1231 << w[i] << ") == 0.0 after "
│ │ │ -
1232 << j << " iterations");
│ │ │ -
1233
│ │ │ -
1234 // v[i+1] = w*1/H[i+1][i]
│ │ │ -
1235 v[i+1] *= real_type(1.0)/H[i+1][i];
│ │ │ -
1236
│ │ │ -
1237 // update QR factorization
│ │ │ -
1238 for(k=0; k<i; k++)
│ │ │ -
1239 this->applyPlaneRotation(H[k][i],H[k+1][i],cs[k],sn[k]);
│ │ │ -
1240
│ │ │ -
1241 // compute new givens rotation
│ │ │ -
1242 this->generatePlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
1243
│ │ │ -
1244 // finish updating QR factorization
│ │ │ -
1245 this->applyPlaneRotation(H[i][i],H[i+1][i],cs[i],sn[i]);
│ │ │ -
1246 this->applyPlaneRotation(s[i],s[i+1],cs[i],sn[i]);
│ │ │ -
1247
│ │ │ -
1248 // norm of the residual is the last component of vector s
│ │ │ -
1249 using std::abs;
│ │ │ -
1250 norm = abs(s[i+1]);
│ │ │ -
1251 iteration.step(j, norm);
│ │ │ -
1252 } // end inner for loop
│ │ │ -
1253
│ │ │ -
1254 // calculate update vector
│ │ │ -
1255 tmp = 0.0;
│ │ │ -
1256 this->update(tmp, i, H, s, w);
│ │ │ -
1257 // and update current iterate
│ │ │ -
1258 x += tmp;
│ │ │ -
1259
│ │ │ -
1260 // restart fGMRes if convergence was not achieved,
│ │ │ -
1261 // i.e. linear residual has not reached desired reduction
│ │ │ -
1262 // and if still j < _maxit (do not restart on last iteration)
│ │ │ -
1263 if( res.converged != true && j < _maxit)
│ │ │ -
1264 {
│ │ │ -
1265 if (_verbose > 0)
│ │ │ -
1266 std::cout << "=== fGMRes::restart" << std::endl;
│ │ │ -
1267 // get rhs
│ │ │ -
1268 v[0] = b;
│ │ │ -
1269 // calculate new defect
│ │ │ -
1270 _op->applyscaleadd(-1.0, x,v[0]); // b -= Ax;
│ │ │ -
1271 // calculate preconditioned defect
│ │ │ -
1272 norm = _sp->norm(v[0]); // update the residual norm
│ │ │ -
1273 }
│ │ │ -
1274
│ │ │ -
1275 } // end outer while loop
│ │ │ -
1276
│ │ │ -
1277 // post-process preconditioner
│ │ │ -
1278 _prec->post(x);
│ │ │ -
1279 }
│ │ │ -
│ │ │ -
1280
│ │ │ -
1281private:
│ │ │ -
1282 using RestartedGMResSolver<X,Y>::_op;
│ │ │ -
1283 using RestartedGMResSolver<X,Y>::_prec;
│ │ │ -
1284 using RestartedGMResSolver<X,Y>::_sp;
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
1290 };
│ │ │ -
│ │ │ - │ │ │ -
1292
│ │ │ -
1306 template<class X>
│ │ │ -
│ │ │ - │ │ │ -
1308 {
│ │ │ -
1309 public:
│ │ │ -
1310 using typename IterativeSolver<X,X>::domain_type;
│ │ │ -
1311 using typename IterativeSolver<X,X>::range_type;
│ │ │ -
1312 using typename IterativeSolver<X,X>::field_type;
│ │ │ -
1313 using typename IterativeSolver<X,X>::real_type;
│ │ │ -
1314
│ │ │ -
1315 private:
│ │ │ - │ │ │ -
1317
│ │ │ - │ │ │ -
1320
│ │ │ -
1321 public:
│ │ │ -
1322
│ │ │ -
1323 // don't shadow four-argument version of apply defined in the base class
│ │ │ -
1324 using IterativeSolver<X,X>::apply;
│ │ │ -
1325
│ │ │ -
│ │ │ -
1332 GeneralizedPCGSolver (const LinearOperator<X,X>& op, Preconditioner<X,X>& prec, scalar_real_type reduction, int maxit, int verbose, int restart = 10) :
│ │ │ -
1333 IterativeSolver<X,X>::IterativeSolver(op,prec,reduction,maxit,verbose),
│ │ │ -
1334 _restart(restart)
│ │ │ -
1335 {}
│ │ │ -
│ │ │ -
1336
│ │ │ -
│ │ │ -
1344 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) :
│ │ │ -
1345 IterativeSolver<X,X>::IterativeSolver(op,sp,prec,reduction,maxit,verbose),
│ │ │ -
1346 _restart(restart)
│ │ │ -
1347 {}
│ │ │ -
│ │ │ -
1348
│ │ │ -
1349
│ │ │ -
│ │ │ -
1362 GeneralizedPCGSolver (std::shared_ptr<const LinearOperator<X,X> > op, std::shared_ptr<Preconditioner<X,X> > prec, const ParameterTree& configuration) :
│ │ │ -
1363 IterativeSolver<X,X>::IterativeSolver(op,prec,configuration),
│ │ │ -
1364 _restart(configuration.get<int>("restart"))
│ │ │ -
1365 {}
│ │ │ -
│ │ │ -
1366
│ │ │ -
│ │ │ -
1367 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) :
│ │ │ -
1368 IterativeSolver<X,X>::IterativeSolver(op,sp,prec,configuration),
│ │ │ -
1369 _restart(configuration.get<int>("restart"))
│ │ │ -
1370 {}
│ │ │ -
│ │ │ -
1371
│ │ │ -
│ │ │ -
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 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
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 };
│ │ │ -
│ │ │ - │ │ │ -
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& configuration)
│ │ │ -
1561 : IterativeSolver<X,X>(op, prec, configuration), _mmax(configuration.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
│ │ │ -
1582
│ │ │ -
│ │ │ -
1583 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
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 };
│ │ │ -
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
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 void apply (X& x, X& b, InverseOperatorResult& res) override
│ │ │ -
1694 {
│ │ │ -
1695 // reset limiter of orthogonalization loop
│ │ │ -
1696 _k_limit = 0;
│ │ │ -
1697 this->RestartedFCGSolver<X>::apply(x,b,res);
│ │ │ -
1698 };
│ │ │ -
│ │ │ -
1699
│ │ │ -
1700 private:
│ │ │ -
1701 // This function is called every iteration to orthogonalize against the last search directions.
│ │ │ -
1702 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 {
│ │ │ -
1703 // This FCGSolver uses values with higher array indexes too, if existent.
│ │ │ -
1704 for (int k = 0; k < _k_limit; k++) {
│ │ │ -
1705 if(i_bounded!=k)
│ │ │ -
1706 d[i_bounded].axpy(-_sp->dot(Ad[k], w) / ddotAd[k], d[k]); // d[i] -= <<Ad[k],w>/<d[k],Ad[k]>>d[k]
│ │ │ -
1707 }
│ │ │ -
1708 // The loop limit increase, if array is not completely filled.
│ │ │ -
1709 if(_k_limit<=i_bounded)
│ │ │ -
1710 _k_limit++;
│ │ │ -
1711
│ │ │ -
1712 };
│ │ │ -
1713
│ │ │ -
1714 // This function is called every mmax iterations to handle limited array sizes.
│ │ │ -
1715 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 {
│ │ │ -
1716 // Only the loop index i_bounded return to 0, if it reached mmax.
│ │ │ -
1717 i_bounded = 0;
│ │ │ -
1718 // Now all arrays are filled and the loop in void orthogonalizations can use the whole arrays.
│ │ │ -
1719 _k_limit = Ad.size();
│ │ │ -
1720 };
│ │ │ -
1721
│ │ │ -
1722 int _k_limit = 0;
│ │ │ -
1723
│ │ │ -
1724 protected:
│ │ │ - │ │ │ -
1726 using RestartedFCGSolver<X>::_op;
│ │ │ - │ │ │ -
1728 using RestartedFCGSolver<X>::_sp;
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
1732 };
│ │ │ -
│ │ │ - │ │ │ -
1735} // end namespace
│ │ │ -
1736
│ │ │ -
1737#endif
│ │ │ - │ │ │ -
#define DUNE_REGISTER_SOLVER(name,...)
Definition solverregistry.hh:16
│ │ │ -
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.
│ │ │ - │ │ │ -
auto defaultIterativeSolverCreator()
Definition solverregistry.hh:76
│ │ │ +
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 {
│ │ │ +
24
│ │ │ +
│ │ │ + │ │ │ +
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 {
│ │ │ + │ │ │ +
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
│ │ │ -
const Dtype_t BaseGetSuperLUType< T >::type
Definition supermatrix.hh:135
│ │ │ -
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:467
│ │ │ - │ │ │ -
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:68
│ │ │ -
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
│ │ │ -
IterativeSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > &prec, scalar_real_type reduction, int maxit, int verbose)
Definition solver.hh:232
│ │ │ -
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
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:116
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition solvers.hh:73
│ │ │ -
gradient method
Definition solvers.hh:124
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:142
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:187
│ │ │ -
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:257
│ │ │ -
static constexpr bool enableConditionEstimate
Definition solvers.hh:208
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:280
│ │ │ -
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
│ │ │ -
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:413
│ │ │ -
Bi-conjugate Gradient Stabilized (BiCG-STAB).
Definition solvers.hh:420
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< CountType > Iteration
Definition solvers.hh:599
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:440
│ │ │ -
Minimal Residual Method (MINRES).
Definition solvers.hh:610
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:809
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:628
│ │ │ -
implements the Generalized Minimal Residual (GMRes) method
Definition solvers.hh:828
│ │ │ -
RestartedGMResSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solvers.hh:879
│ │ │ -
void apply(X &x, Y &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:911
│ │ │ -
std::enable_if<!std::is_same< field_type, real_type >::value, T >::type conjugate(const T &t)
Definition solvers.hh:1068
│ │ │ -
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:884
│ │ │ -
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:1040
│ │ │ -
std::enable_if< std::is_same< field_type, real_type >::value, T >::type conjugate(const T &t)
Definition solvers.hh:1063
│ │ │ -
ReboundAllocatorType< X, field_type > fAlloc
field_type Allocator retrieved from domain type
Definition solvers.hh:839
│ │ │ -
int _restart
Definition solvers.hh:1121
│ │ │ -
ReboundAllocatorType< X, real_type > rAlloc
real_type Allocator retrieved from domain type
Definition solvers.hh:841
│ │ │ -
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:851
│ │ │ -
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:862
│ │ │ -
void generatePlaneRotation(field_type &dx, field_type &dy, real_type &cs, field_type &sn)
Definition solvers.hh:1074
│ │ │ -
void apply(X &x, Y &b, double reduction, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:924
│ │ │ -
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:895
│ │ │ -
typename IterativeSolver< X, X >::template Iteration< unsigned int > Iteration
Definition solvers.hh:1120
│ │ │ -
void applyPlaneRotation(field_type &dx, field_type &dy, real_type &cs, field_type &sn)
Definition solvers.hh:1107
│ │ │ -
implements the Flexible Generalized Minimal Residual (FGMRes) method (right preconditioned)
Definition solvers.hh:1140
│ │ │ -
void apply(X &x, Y &b, double reduction, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:1170
│ │ │ -
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:1344
│ │ │ -
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:1332
│ │ │ -
GeneralizedPCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Set up nonlinear preconditioned conjugate gradient solver.
Definition solvers.hh:1362
│ │ │ -
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:1367
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:1391
│ │ │ -
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< 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
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator.
Definition solvers.hh:1583
│ │ │ -
RestartedFCGSolver(std::shared_ptr< const LinearOperator< X, X > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor to initialize a RestartedFCG solver.
Definition solvers.hh:1558
│ │ │ -
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
│ │ │ -
void apply(X &x, X &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition solvers.hh:1693
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1923 +1,110 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 { │ │ │ │ -38 │ │ │ │ -45 │ │ │ │ -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_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r; │ │ │ │ -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 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 │ │ │ │ -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___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_>()); │ │ │ │ -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_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r; │ │ │ │ -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 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 │ │ │ │ -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 _f_i_e_l_d___t_y_p_e(___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___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_>()); │ │ │ │ -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_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r; │ │ │ │ -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_7 _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, │ │ │ │ -258 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_X_>> prec, │ │ │ │ -259 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int maxit, int verbose, bool │ │ │ │ -condition_estimate) │ │ │ │ -260 : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, sp, prec, reduction, maxit, verbose), │ │ │ │ -261 condition_estimate_(condition_estimate) │ │ │ │ -262 { │ │ │ │ -263 if (condition_estimate && !(std::is_same::value || std:: │ │ │ │ -is_same::value)) { │ │ │ │ -264 condition_estimate_ = false; │ │ │ │ -265 std::cerr << "WARNING: Condition estimate was disabled. It is only │ │ │ │ -available for double and float field types!" << std::endl; │ │ │ │ -266 } │ │ │ │ -267 } │ │ │ │ -268 │ │ │ │ -_2_8_0 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 │ │ │ │ -281 { │ │ │ │ -282 _I_t_e_r_a_t_i_o_n iteration(*this,res); │ │ │ │ -283 ___p_r_e_c->pre(x,b); // prepare preconditioner │ │ │ │ -284 │ │ │ │ -285 ___o_p->applyscaleadd(-1,x,b); // overwrite b with defect │ │ │ │ -286 │ │ │ │ -287 _r_e_a_l___t_y_p_e def = ___s_p->norm(b); // compute norm │ │ │ │ -288 if(iteration.step(0, def)){ │ │ │ │ -289 ___p_r_e_c->post(x); │ │ │ │ -290 return; │ │ │ │ -291 } │ │ │ │ -292 │ │ │ │ -293 X p(x); // the search direction │ │ │ │ -294 X q(x); // a temporary vector │ │ │ │ -295 │ │ │ │ -296 // Remember lambda and beta values for condition estimate │ │ │ │ -297 std::vector lambdas(0); │ │ │ │ -298 std::vector betas(0); │ │ │ │ -299 │ │ │ │ -300 // some local variables │ │ │ │ -301 _f_i_e_l_d___t_y_p_e rho,rholast,lambda,alpha,beta; │ │ │ │ -302 │ │ │ │ -303 // determine initial search direction │ │ │ │ -304 p = 0; // clear correction │ │ │ │ -305 ___p_r_e_c->apply(p,b); // apply preconditioner │ │ │ │ -306 rholast = ___s_p->dot(p,b); // orthogonalization │ │ │ │ -307 │ │ │ │ -308 // the loop │ │ │ │ -309 int i=1; │ │ │ │ -310 for ( ; i<=___m_a_x_i_t; i++ ) │ │ │ │ -311 { │ │ │ │ -312 // minimize in given search direction p │ │ │ │ -313 ___o_p->apply(p,q); // q=Ap │ │ │ │ -314 alpha = ___s_p->dot(p,q); // scalar product │ │ │ │ -315 lambda = Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), _f_i_e_l_d___t_y_p_e(0.), _f_i_e_l_d___t_y_p_e │ │ │ │ -(rholast/alpha)); // minimization │ │ │ │ -316 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) │ │ │ │ -317 if (condition_estimate_) │ │ │ │ -318 lambdas.push_back(std::real(lambda)); │ │ │ │ -319 x.axpy(lambda,p); // update solution │ │ │ │ -320 b.axpy(-lambda,q); // update defect │ │ │ │ -321 │ │ │ │ -322 // convergence test │ │ │ │ -323 def=___s_p->norm(b); // comp defect norm │ │ │ │ -324 if(iteration.step(i, def)) │ │ │ │ -325 break; │ │ │ │ -326 │ │ │ │ -327 // determine new search direction │ │ │ │ -328 q = 0; // clear correction │ │ │ │ -329 ___p_r_e_c->apply(q,b); // apply preconditioner │ │ │ │ -330 rho = ___s_p->dot(q,b); // orthogonalization │ │ │ │ -331 beta = Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), _f_i_e_l_d___t_y_p_e(0.), _f_i_e_l_d___t_y_p_e(rho/ │ │ │ │ -rholast)); // scaling factor │ │ │ │ -332 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) │ │ │ │ -333 if (condition_estimate_) │ │ │ │ -334 betas.push_back(std::real(beta)); │ │ │ │ -335 p *= beta; // scale old search direction │ │ │ │ -336 p += q; // orthogonalization with correction │ │ │ │ -337 rholast = rho; // remember rho for recurrence │ │ │ │ -338 } │ │ │ │ -339 │ │ │ │ -340 ___p_r_e_c->post(x); // postprocess preconditioner │ │ │ │ -341 │ │ │ │ -342 if (condition_estimate_) { │ │ │ │ -343#if HAVE_ARPACKPP │ │ │ │ -344 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) { │ │ │ │ -345 using std::sqrt; │ │ │ │ -346 │ │ │ │ -347 // Build T matrix which has extreme eigenvalues approximating │ │ │ │ -348 // those of the original system │ │ │ │ -349 // (see Y. Saad, Iterative methods for sparse linear systems) │ │ │ │ -350 │ │ │ │ -351 COND_MAT T(i, i, _C_O_N_D___M_A_T_:_:_r_o_w___w_i_s_e); │ │ │ │ -352 │ │ │ │ -353 for (auto row = T.createbegin(); row != T.createend(); ++row) { │ │ │ │ -354 if (row.index() > 0) │ │ │ │ -355 row.insert(row.index()-1); │ │ │ │ -356 row.insert(row.index()); │ │ │ │ -357 if (row.index() < T.N() - 1) │ │ │ │ -358 row.insert(row.index()+1); │ │ │ │ -359 } │ │ │ │ -360 for (int row = 0; row < i; ++row) { │ │ │ │ -361 if (row > 0) { │ │ │ │ -362 T[row][row-1] = sqrt(betas[row-1]) / lambdas[row-1]; │ │ │ │ -363 } │ │ │ │ -364 │ │ │ │ -365 T[row][row] = 1.0 / lambdas[row]; │ │ │ │ -366 if (row > 0) { │ │ │ │ -367 T[row][row] += betas[row-1] / lambdas[row-1]; │ │ │ │ -368 } │ │ │ │ -369 │ │ │ │ -370 if (row < i - 1) { │ │ │ │ -371 T[row][row+1] = sqrt(betas[row]) / lambdas[row]; │ │ │ │ -372 } │ │ │ │ -373 } │ │ │ │ -374 │ │ │ │ -375 // Compute largest and smallest eigenvalue of T matrix and return as │ │ │ │ -estimate │ │ │ │ -376 _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); │ │ │ │ -377 │ │ │ │ -378 _r_e_a_l___t_y_p_e eps = 0.0; │ │ │ │ -379 COND_VEC eigv; │ │ │ │ -380 _r_e_a_l___t_y_p_e min_eigv, max_eigv; │ │ │ │ -381 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); │ │ │ │ -382 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); │ │ │ │ -383 │ │ │ │ -384 res._c_o_n_d_i_t_i_o_n___e_s_t_i_m_a_t_e = max_eigv / min_eigv; │ │ │ │ -385 │ │ │ │ -386 if (this->___v_e_r_b_o_s_e > 0) { │ │ │ │ -387 std::cout << "Min eigv estimate: " << Simd::io(min_eigv) << '\n'; │ │ │ │ -388 std::cout << "Max eigv estimate: " << Simd::io(max_eigv) << '\n'; │ │ │ │ -389 std::cout << "Condition estimate: " │ │ │ │ -390 << Simd::io(max_eigv / min_eigv) << std::endl; │ │ │ │ -391 } │ │ │ │ -392 } │ │ │ │ -393#else │ │ │ │ -394 std::cerr << "WARNING: Condition estimate was requested. This requires │ │ │ │ -ARPACK, but ARPACK was not found!" << std::endl; │ │ │ │ -395#endif │ │ │ │ -396 } │ │ │ │ -397 } │ │ │ │ -398 │ │ │ │ -399 private: │ │ │ │ -400 bool condition_estimate_ = false; │ │ │ │ -401 │ │ │ │ -402 // Matrix and vector types used for condition estimate │ │ │ │ -403 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; │ │ │ │ -404 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; │ │ │ │ -405 │ │ │ │ -406 protected: │ │ │ │ -407 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -408 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -409 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -410 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; │ │ │ │ -411 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -412 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_3 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_>; │ │ │ │ -414 }; │ │ │ │ -_4_1_5 _D_U_N_E___R_E_G_I_S_T_E_R___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_>()); │ │ │ │ -416 │ │ │ │ -417 // Ronald Kriemanns BiCG-STAB implementation from Sumo │ │ │ │ -419 template │ │ │ │ -_4_2_0 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 { │ │ │ │ -421 public: │ │ │ │ -422 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; │ │ │ │ -423 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; │ │ │ │ -424 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; │ │ │ │ -425 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; │ │ │ │ -426 │ │ │ │ -427 // copy base class constructors │ │ │ │ -428 using _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; │ │ │ │ -429 │ │ │ │ -430 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -431 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -432 │ │ │ │ -_4_4_0 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 │ │ │ │ -441 { │ │ │ │ -442 using std::abs; │ │ │ │ -443 const Simd::Scalar EPSILON=1e-80; │ │ │ │ -444 using std::abs; │ │ │ │ -445 double it; │ │ │ │ -446 _f_i_e_l_d___t_y_p_e rho, rho_new, alpha, beta, h, omega; │ │ │ │ -447 _r_e_a_l___t_y_p_e norm; │ │ │ │ -448 │ │ │ │ -449 // │ │ │ │ -450 // get vectors and matrix │ │ │ │ -451 // │ │ │ │ -452 X& r=b; │ │ │ │ -453 X p(x); │ │ │ │ -454 X v(x); │ │ │ │ -455 X t(x); │ │ │ │ -456 X y(x); │ │ │ │ -457 X rt(x); │ │ │ │ -458 │ │ │ │ -459 // │ │ │ │ -460 // begin iteration │ │ │ │ -461 // │ │ │ │ -462 │ │ │ │ -463 // r = r - Ax; rt = r │ │ │ │ -464 _I_t_e_r_a_t_i_o_n_<_d_o_u_b_l_e_> iteration(*this,res); │ │ │ │ -465 ___p_r_e_c->pre(x,r); // prepare preconditioner │ │ │ │ -466 │ │ │ │ -467 ___o_p->applyscaleadd(-1,x,r); // overwrite b with defect │ │ │ │ -468 │ │ │ │ -469 rt=r; │ │ │ │ -470 │ │ │ │ -471 norm = ___s_p->norm(r); │ │ │ │ -472 if(iteration.step(0, norm)){ │ │ │ │ -473 ___p_r_e_c->post(x); │ │ │ │ -474 return; │ │ │ │ -475 } │ │ │ │ -476 p=0; │ │ │ │ -477 v=0; │ │ │ │ -478 │ │ │ │ -479 rho = 1; │ │ │ │ -480 alpha = 1; │ │ │ │ -481 omega = 1; │ │ │ │ -482 │ │ │ │ -483 // │ │ │ │ -484 // iteration │ │ │ │ -485 // │ │ │ │ -486 │ │ │ │ -487 for (it = 0.5; it < ___m_a_x_i_t; it+=.5) │ │ │ │ -488 { │ │ │ │ -489 // │ │ │ │ -490 // preprocess, set vecsizes etc. │ │ │ │ -491 // │ │ │ │ -492 │ │ │ │ -493 // rho_new = < rt , r > │ │ │ │ -494 rho_new = ___s_p->dot(rt,r); │ │ │ │ -495 │ │ │ │ -496 // look if breakdown occurred │ │ │ │ -497 if (Simd::allTrue(abs(rho) <= EPSILON)) │ │ │ │ -498 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t,"breakdown in BiCGSTAB - rho " │ │ │ │ -499 << Simd::io(rho) << " <= EPSILON " << EPSILON │ │ │ │ -500 << " after " << it << " iterations"); │ │ │ │ -501 if (Simd::allTrue(abs(omega) <= EPSILON)) │ │ │ │ -502 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t,"breakdown in BiCGSTAB - omega " │ │ │ │ -503 << Simd::io(omega) << " <= EPSILON " << EPSILON │ │ │ │ -504 << " after " << it << " iterations"); │ │ │ │ -505 │ │ │ │ -506 │ │ │ │ -507 if (it<1) │ │ │ │ -508 p = r; │ │ │ │ -509 else │ │ │ │ -510 { │ │ │ │ -511 beta = Simd::cond(norm==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -512 _f_i_e_l_d___t_y_p_e(0.), // no need for orthogonalization if norm is already 0 │ │ │ │ -513 _f_i_e_l_d___t_y_p_e(( rho_new / rho ) * ( alpha / omega ))); │ │ │ │ -514 p.axpy(-omega,v); // p = r + beta (p - omega*v) │ │ │ │ -515 p *= beta; │ │ │ │ -516 p += r; │ │ │ │ -517 } │ │ │ │ -518 │ │ │ │ -519 // y = W^-1 * p │ │ │ │ -520 y = 0; │ │ │ │ -521 ___p_r_e_c->apply(y,p); // apply preconditioner │ │ │ │ -522 │ │ │ │ -523 // v = A * y │ │ │ │ -524 ___o_p->apply(y,v); │ │ │ │ -525 │ │ │ │ -526 // alpha = rho_new / < rt, v > │ │ │ │ -527 h = ___s_p->dot(rt,v); │ │ │ │ -528 │ │ │ │ -529 if ( Simd::allTrue(abs(h) < EPSILON) ) │ │ │ │ -530 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t,"abs(h) < EPSILON in BiCGSTAB - abs(h) " │ │ │ │ -531 << Simd::io(abs(h)) << " < EPSILON " << EPSILON │ │ │ │ -532 << " after " << it << " iterations"); │ │ │ │ -533 │ │ │ │ -534 alpha = Simd::cond(norm==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -535 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -536 _f_i_e_l_d___t_y_p_e(rho_new / h)); │ │ │ │ -537 │ │ │ │ -538 // apply first correction to x │ │ │ │ -539 // x <- x + alpha y │ │ │ │ -540 x.axpy(alpha,y); │ │ │ │ -541 │ │ │ │ -542 // r = r - alpha*v │ │ │ │ -543 r.axpy(-alpha,v); │ │ │ │ -544 │ │ │ │ -545 // │ │ │ │ -546 // test stop criteria │ │ │ │ -547 // │ │ │ │ -548 │ │ │ │ -549 norm = ___s_p->norm(r); │ │ │ │ -550 if(iteration.step(it, norm)){ │ │ │ │ -551 break; │ │ │ │ -552 } │ │ │ │ -553 │ │ │ │ -554 it+=.5; │ │ │ │ -555 │ │ │ │ -556 // y = W^-1 * r │ │ │ │ -557 y = 0; │ │ │ │ -558 ___p_r_e_c->apply(y,r); │ │ │ │ -559 │ │ │ │ -560 // t = A * y │ │ │ │ -561 ___o_p->apply(y,t); │ │ │ │ -562 │ │ │ │ -563 // omega = < t, r > / < t, t > │ │ │ │ -564 h = ___s_p->dot(t,t); │ │ │ │ -565 omega = Simd::cond(norm==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -566 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -567 _f_i_e_l_d___t_y_p_e(___s_p->dot(t,r)/h)); │ │ │ │ -568 │ │ │ │ -569 // apply second correction to x │ │ │ │ -570 // x <- x + omega y │ │ │ │ -571 x.axpy(omega,y); │ │ │ │ -572 │ │ │ │ -573 // r = s - omega*t (remember : r = s) │ │ │ │ -574 r.axpy(-omega,t); │ │ │ │ -575 │ │ │ │ -576 rho = rho_new; │ │ │ │ -577 │ │ │ │ -578 // │ │ │ │ -579 // test stop criteria │ │ │ │ -580 // │ │ │ │ -581 │ │ │ │ -582 norm = ___s_p->norm(r); │ │ │ │ -583 if(iteration.step(it, norm)){ │ │ │ │ -584 break; │ │ │ │ -585 } │ │ │ │ -586 } // end for │ │ │ │ -587 │ │ │ │ -588 ___p_r_e_c->post(x); // postprocess preconditioner │ │ │ │ -589 } │ │ │ │ -590 │ │ │ │ -591 protected: │ │ │ │ -592 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -593 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -594 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -595 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; │ │ │ │ -596 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -597 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -598 template │ │ │ │ -_5_9_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_<_C_o_u_n_t_T_y_p_e_>; │ │ │ │ -600 }; │ │ │ │ -_6_0_1 _D_U_N_E___R_E_G_I_S_T_E_R___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_>()); │ │ │ │ -602 │ │ │ │ -609 template │ │ │ │ -_6_1_0 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 { │ │ │ │ -611 public: │ │ │ │ -612 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; │ │ │ │ -613 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; │ │ │ │ -614 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; │ │ │ │ -615 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; │ │ │ │ -616 │ │ │ │ -617 // copy base class constructors │ │ │ │ -618 using _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; │ │ │ │ -619 │ │ │ │ -620 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -621 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -622 │ │ │ │ -_6_2_8 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 │ │ │ │ -629 { │ │ │ │ -630 using std::sqrt; │ │ │ │ -631 using std::abs; │ │ │ │ -632 _I_t_e_r_a_t_i_o_n iteration(*this, res); │ │ │ │ -633 // prepare preconditioner │ │ │ │ -634 ___p_r_e_c->pre(x,b); │ │ │ │ -635 │ │ │ │ -636 // overwrite rhs with defect │ │ │ │ -637 ___o_p->applyscaleadd(-1.0,x,b); // b -= Ax │ │ │ │ -638 │ │ │ │ -639 // some temporary vectors │ │ │ │ -640 X z(b), dummy(b); │ │ │ │ -641 z = 0.0; │ │ │ │ -642 │ │ │ │ -643 // calculate preconditioned defect │ │ │ │ -644 ___p_r_e_c->apply(z,b); // r = W^-1 (b - Ax) │ │ │ │ -645 _r_e_a_l___t_y_p_e def = ___s_p->norm(z); │ │ │ │ -646 if (iteration.step(0, def)){ │ │ │ │ -647 ___p_r_e_c->post(x); │ │ │ │ -648 return; │ │ │ │ -649 } │ │ │ │ -650 │ │ │ │ -651 // recurrence coefficients as computed in Lanczos algorithm │ │ │ │ -652 _f_i_e_l_d___t_y_p_e alpha, beta; │ │ │ │ -653 // diagonal entries of givens rotation │ │ │ │ -654 std::array c{{0.0,0.0}}; │ │ │ │ -655 // off-diagonal entries of givens rotation │ │ │ │ -656 std::array s{{0.0,0.0}}; │ │ │ │ -657 │ │ │ │ -658 // recurrence coefficients (column k of tridiag matrix T_k) │ │ │ │ -659 std::array T{{0.0,0.0,0.0}}; │ │ │ │ -660 │ │ │ │ -661 // the rhs vector of the min problem │ │ │ │ -662 std::array xi{{1.0,0.0}}; │ │ │ │ -663 │ │ │ │ -664 // beta is real and positive in exact arithmetic │ │ │ │ -665 // since it is the norm of the basis vectors (in unpreconditioned case) │ │ │ │ -666 beta = sqrt(___s_p->dot(b,z)); │ │ │ │ -667 _f_i_e_l_d___t_y_p_e beta0 = beta; │ │ │ │ -668 │ │ │ │ -669 // the search directions │ │ │ │ -670 std::array p{{b,b,b}}; │ │ │ │ -671 p[0] = 0.0; │ │ │ │ -672 p[1] = 0.0; │ │ │ │ -673 p[2] = 0.0; │ │ │ │ -674 │ │ │ │ -675 // orthonormal basis vectors (in unpreconditioned case) │ │ │ │ -676 std::array q{{b,b,b}}; │ │ │ │ -677 q[0] = 0.0; │ │ │ │ -678 q[1] *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -679 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -680 _f_i_e_l_d___t_y_p_e(_r_e_a_l___t_y_p_e(1.0)/beta)); │ │ │ │ -681 q[2] = 0.0; │ │ │ │ -682 │ │ │ │ -683 z *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -684 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -685 _f_i_e_l_d___t_y_p_e(_r_e_a_l___t_y_p_e(1.0)/beta)); │ │ │ │ -686 │ │ │ │ -687 // the loop │ │ │ │ -688 int i = 1; │ │ │ │ -689 for( ; i<=___m_a_x_i_t; i++) { │ │ │ │ -690 │ │ │ │ -691 dummy = z; │ │ │ │ -692 int i1 = i%3, │ │ │ │ -693 i0 = (i1+2)%3, │ │ │ │ -694 i2 = (i1+1)%3; │ │ │ │ -695 │ │ │ │ -696 // symmetrically preconditioned Lanczos algorithm (see Greenbaum p.121) │ │ │ │ -697 ___o_p->apply(z,q[i2]); // q[i2] = Az │ │ │ │ -698 q[i2].axpy(-beta,q[i0]); │ │ │ │ -699 // alpha is real since it is the diagonal entry of the hermitian │ │ │ │ -tridiagonal matrix │ │ │ │ -700 // from the Lanczos Algorithm │ │ │ │ -701 // so the order in the scalar product doesn't matter even for the complex │ │ │ │ -case │ │ │ │ -702 alpha = ___s_p->dot(z,q[i2]); │ │ │ │ -703 q[i2].axpy(-alpha,q[i1]); │ │ │ │ -704 │ │ │ │ -705 z = 0.0; │ │ │ │ -706 ___p_r_e_c->apply(z,q[i2]); │ │ │ │ -707 │ │ │ │ -708 // beta is real and positive in exact arithmetic │ │ │ │ -709 // since it is the norm of the basis vectors (in unpreconditioned case) │ │ │ │ -710 beta = sqrt(___s_p->dot(q[i2],z)); │ │ │ │ -711 │ │ │ │ -712 q[i2] *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -713 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -714 _f_i_e_l_d___t_y_p_e(_r_e_a_l___t_y_p_e(1.0)/beta)); │ │ │ │ -715 z *= Simd::cond(def==_f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -716 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -717 _f_i_e_l_d___t_y_p_e(_r_e_a_l___t_y_p_e(1.0)/beta)); │ │ │ │ -718 │ │ │ │ -719 // QR Factorization of recurrence coefficient matrix │ │ │ │ -720 // apply previous givens rotations to last column of T │ │ │ │ -721 T[1] = T[2]; │ │ │ │ -722 if(i>2) { │ │ │ │ -723 T[0] = s[i%2]*T[1]; │ │ │ │ -724 T[1] = c[i%2]*T[1]; │ │ │ │ -725 } │ │ │ │ -726 if(i>1) { │ │ │ │ -727 T[2] = c[(i+1)%2]*alpha - s[(i+1)%2]*T[1]; │ │ │ │ -728 T[1] = c[(i+1)%2]*T[1] + s[(i+1)%2]*alpha; │ │ │ │ -729 } │ │ │ │ -730 else │ │ │ │ -731 T[2] = alpha; │ │ │ │ -732 │ │ │ │ -733 // update QR factorization │ │ │ │ -734 generateGivensRotation(T[2],beta,c[i%2],s[i%2]); │ │ │ │ -735 // to last column of T_k │ │ │ │ -736 T[2] = c[i%2]*T[2] + s[i%2]*beta; │ │ │ │ -737 // and to the rhs xi of the min problem │ │ │ │ -738 xi[i%2] = -s[i%2]*xi[(i+1)%2]; │ │ │ │ -739 xi[(i+1)%2] *= c[i%2]; │ │ │ │ -740 │ │ │ │ -741 // compute correction direction │ │ │ │ -742 p[i2] = dummy; │ │ │ │ -743 p[i2].axpy(-T[1],p[i1]); │ │ │ │ -744 p[i2].axpy(-T[0],p[i0]); │ │ │ │ -745 p[i2] *= _r_e_a_l___t_y_p_e(1.0)/T[2]; │ │ │ │ -746 │ │ │ │ -747 // apply correction/update solution │ │ │ │ -748 x.axpy(beta0*xi[(i+1)%2],p[i2]); │ │ │ │ -749 │ │ │ │ -750 // remember beta_old │ │ │ │ -751 T[2] = beta; │ │ │ │ -752 │ │ │ │ -753 // check for convergence │ │ │ │ -754 // the last entry in the rhs of the min-problem is the residual │ │ │ │ -755 def = abs(beta0*xi[i%2]); │ │ │ │ -756 if(iteration.step(i, def)){ │ │ │ │ -757 break; │ │ │ │ -758 } │ │ │ │ -759 } // end for │ │ │ │ -760 │ │ │ │ -761 // postprocess preconditioner │ │ │ │ -762 ___p_r_e_c->post(x); │ │ │ │ -763 } │ │ │ │ -764 │ │ │ │ -765 private: │ │ │ │ -766 │ │ │ │ -767 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) │ │ │ │ -768 { │ │ │ │ -769 using std::sqrt; │ │ │ │ -770 using std::abs; │ │ │ │ -771 using std::max; │ │ │ │ -772 using std::min; │ │ │ │ -773 const _r_e_a_l___t_y_p_e eps = 1e-15; │ │ │ │ -774 _r_e_a_l___t_y_p_e norm_dx = abs(dx); │ │ │ │ -775 _r_e_a_l___t_y_p_e norm_dy = abs(dy); │ │ │ │ -776 _r_e_a_l___t_y_p_e norm_max = max(norm_dx, norm_dy); │ │ │ │ -777 _r_e_a_l___t_y_p_e norm_min = min(norm_dx, norm_dy); │ │ │ │ -778 _r_e_a_l___t_y_p_e temp = norm_min/norm_max; │ │ │ │ -779 // we rewrite the code in a vectorizable fashion │ │ │ │ -780 cs = Simd::cond(norm_dy < eps, │ │ │ │ -781 _r_e_a_l___t_y_p_e(1.0), │ │ │ │ -782 _r_e_a_l___t_y_p_e(Simd::cond(norm_dx < eps, │ │ │ │ -783 _r_e_a_l___t_y_p_e(0.0), │ │ │ │ -784 _r_e_a_l___t_y_p_e(Simd::cond(norm_dy > norm_dx, │ │ │ │ -785 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*temp, │ │ │ │ -786 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp) │ │ │ │ -787 ))))); │ │ │ │ -788 sn = Simd::cond(norm_dy < eps, │ │ │ │ -789 _f_i_e_l_d___t_y_p_e(0.0), │ │ │ │ -790 _f_i_e_l_d___t_y_p_e(Simd::cond(norm_dx < eps, │ │ │ │ -791 _f_i_e_l_d___t_y_p_e(1.0), │ │ │ │ -792 _f_i_e_l_d___t_y_p_e(Simd::cond(norm_dy > norm_dx, │ │ │ │ -793 // dy and dx are real in exact arithmetic │ │ │ │ -794 // thus dx*dy is real so we can explicitly enforce it │ │ │ │ -795 _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, │ │ │ │ -796 // dy and dx is real in exact arithmetic │ │ │ │ -797 // so we don't have to conjugate both of them │ │ │ │ -798 _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 │ │ │ │ -799 ))))); │ │ │ │ -800 } │ │ │ │ -801 │ │ │ │ -802 protected: │ │ │ │ -803 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -804 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -805 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -806 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; │ │ │ │ -807 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -808 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___v_e_r_b_o_s_e; │ │ │ │ -_8_0_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_>; │ │ │ │ -810 }; │ │ │ │ -_8_1_1 _D_U_N_E___R_E_G_I_S_T_E_R___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_>()); │ │ │ │ -812 │ │ │ │ -825 │ │ │ │ -826 template │ │ │ │ -_8_2_7 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 │ │ │ │ -828 { │ │ │ │ -829 public: │ │ │ │ -830 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; │ │ │ │ -831 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; │ │ │ │ -832 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; │ │ │ │ -833 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; │ │ │ │ -834 │ │ │ │ -835 protected: │ │ │ │ -836 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; │ │ │ │ -837 │ │ │ │ -_8_3_9 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_1 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_>; │ │ │ │ -842 │ │ │ │ -843 public: │ │ │ │ -844 │ │ │ │ -_8_5_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, _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) : │ │ │ │ -852 _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), │ │ │ │ -853 ___r_e_s_t_a_r_t(restart) │ │ │ │ -854 {} │ │ │ │ -855 │ │ │ │ -_8_6_2 _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) : │ │ │ │ -863 _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), │ │ │ │ -864 ___r_e_s_t_a_r_t(restart) │ │ │ │ -865 {} │ │ │ │ -866 │ │ │ │ -_8_7_9 _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) : │ │ │ │ -880 _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), │ │ │ │ -881 ___r_e_s_t_a_r_t(configuration._g_e_t("restart")) │ │ │ │ -882 {} │ │ │ │ -883 │ │ │ │ -_8_8_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, 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) : │ │ │ │ -885 _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), │ │ │ │ -886 ___r_e_s_t_a_r_t(configuration._g_e_t("restart")) │ │ │ │ -887 {} │ │ │ │ -888 │ │ │ │ -_8_9_5 _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r (std::shared_ptr> op, │ │ │ │ -896 std::shared_ptr> sp, │ │ │ │ -897 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_X_,_Y_>> prec, │ │ │ │ -898 _s_c_a_l_a_r___r_e_a_l___t_y_p_e reduction, int restart, int maxit, int verbose) : │ │ │ │ -899 _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), │ │ │ │ -900 ___r_e_s_t_a_r_t(restart) │ │ │ │ -901 {} │ │ │ │ -902 │ │ │ │ -_9_1_1 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) override │ │ │ │ -912 { │ │ │ │ -913 _a_p_p_l_y(x,b,Simd::max(___r_e_d_u_c_t_i_o_n),res); │ │ │ │ -914 } │ │ │ │ -915 │ │ │ │ -_9_2_4 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 │ │ │ │ -925 { │ │ │ │ -926 using std::abs; │ │ │ │ -927 const Simd::Scalar EPSILON = 1e-80; │ │ │ │ -928 const int m = ___r_e_s_t_a_r_t; │ │ │ │ -929 _r_e_a_l___t_y_p_e norm = 0.0; │ │ │ │ -930 int j = 1; │ │ │ │ -931 std::vector s(m+1), sn(m); │ │ │ │ -932 std::vector cs(m); │ │ │ │ -933 // need copy of rhs if GMRes has to be restarted │ │ │ │ -934 Y b2(b); │ │ │ │ -935 // helper vector │ │ │ │ -936 Y w(b); │ │ │ │ -937 std::vector< std::vector > H(m+1,s); │ │ │ │ -938 std::vector v(m+1,b); │ │ │ │ -939 │ │ │ │ -940 _I_t_e_r_a_t_i_o_n iteration(*this,res); │ │ │ │ -941 │ │ │ │ -942 // clear solver statistics and set res.converged to false │ │ │ │ -943 ___p_r_e_c->pre(x,b); │ │ │ │ -944 │ │ │ │ -945 // calculate defect and overwrite rhs with it │ │ │ │ -946 ___o_p->applyscaleadd(-1.0,x,b); // b -= Ax │ │ │ │ -947 // calculate preconditioned defect │ │ │ │ -948 v[0] = 0.0; ___p_r_e_c->apply(v[0],b); // r = W^-1 b │ │ │ │ -949 norm = ___s_p->norm(v[0]); │ │ │ │ -950 if(iteration.step(0, norm)){ │ │ │ │ -951 ___p_r_e_c->post(x); │ │ │ │ -952 return; │ │ │ │ -953 } │ │ │ │ -954 │ │ │ │ -955 while(j <= ___m_a_x_i_t && res._c_o_n_v_e_r_g_e_d != true) { │ │ │ │ -956 │ │ │ │ -957 int i = 0; │ │ │ │ -958 v[0] *= Simd::cond(norm==_r_e_a_l___t_y_p_e(0.), │ │ │ │ -959 _r_e_a_l___t_y_p_e(0.), │ │ │ │ -960 _r_e_a_l___t_y_p_e(_r_e_a_l___t_y_p_e(1.0)/norm)); │ │ │ │ -961 s[0] = norm; │ │ │ │ -962 for(i=1; iapply(v[i],v[i+1]); │ │ │ │ -971 ___p_r_e_c->apply(w,v[i+1]); │ │ │ │ -972 for(int k=0; kdot(v[k],w) = v[k]\adjoint w │ │ │ │ -974 // so one has to pay attention to the order │ │ │ │ -975 // in the scalar product for the complex case │ │ │ │ -976 // doing the modified Gram-Schmidt algorithm │ │ │ │ -977 H[k][i] = ___s_p->dot(v[k],w); │ │ │ │ -978 // w -= H[k][i] * v[k] │ │ │ │ -979 w.axpy(-H[k][i],v[k]); │ │ │ │ -980 } │ │ │ │ -981 H[i+1][i] = ___s_p->norm(w); │ │ │ │ -982 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON)) │ │ │ │ -983 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t, │ │ │ │ -984 "breakdown in GMRes - |w| == 0.0 after " << j << " iterations"); │ │ │ │ -985 │ │ │ │ -986 // normalize new vector │ │ │ │ -987 v[i+1] = w; │ │ │ │ -988 v[i+1] *= Simd::cond(norm==_r_e_a_l___t_y_p_e(0.), │ │ │ │ -989 _f_i_e_l_d___t_y_p_e(0.), │ │ │ │ -990 _f_i_e_l_d___t_y_p_e(_r_e_a_l___t_y_p_e(1.0)/H[i+1][i])); │ │ │ │ -991 │ │ │ │ -992 // update QR factorization │ │ │ │ -993 for(int k=0; k 0) │ │ │ │ -1021 std::cout << "=== GMRes::restart" << std::endl; │ │ │ │ -1022 // get saved rhs │ │ │ │ -1023 b = b2; │ │ │ │ -1024 // calculate new defect │ │ │ │ -1025 ___o_p->applyscaleadd(-1.0,x,b); // b -= Ax; │ │ │ │ -1026 // calculate preconditioned defect │ │ │ │ -1027 v[0] = 0.0; │ │ │ │ -1028 ___p_r_e_c->apply(v[0],b); │ │ │ │ -1029 norm = ___s_p->norm(v[0]); │ │ │ │ -1030 } │ │ │ │ -1031 │ │ │ │ -1032 } //end while │ │ │ │ -1033 │ │ │ │ -1034 // postprocess preconditioner │ │ │ │ -1035 ___p_r_e_c->post(x); │ │ │ │ -1036 } │ │ │ │ -1037 │ │ │ │ -1038 protected : │ │ │ │ -1039 │ │ │ │ -_1_0_4_0 void _u_p_d_a_t_e(X& w, int i, │ │ │ │ -1041 const std::vector >& H, │ │ │ │ -1042 const std::vector& s, │ │ │ │ -1043 const std::vector& v) { │ │ │ │ -1044 // solution vector of the upper triangular system │ │ │ │ -1045 std::vector y(s); │ │ │ │ -1046 │ │ │ │ -1047 // backsolve │ │ │ │ -1048 for(int a=i-1; a>=0; a--) { │ │ │ │ -1049 _f_i_e_l_d___t_y_p_e rhs(s[a]); │ │ │ │ -1050 for(int b=a+1; b │ │ │ │ -_1_0_6_3 typename std::enable_if::value,T>_:_:_t_y_p_e │ │ │ │ -_c_o_n_j_u_g_a_t_e(const T& t) { │ │ │ │ -1064 return t; │ │ │ │ -1065 } │ │ │ │ -1066 │ │ │ │ -1067 template │ │ │ │ -_1_0_6_8 typename std::enable_if::value,T>_:_: │ │ │ │ -_t_y_p_e _c_o_n_j_u_g_a_t_e(const T& t) { │ │ │ │ -1069 using std::conj; │ │ │ │ -1070 return conj(t); │ │ │ │ -1071 } │ │ │ │ -1072 │ │ │ │ -1073 void │ │ │ │ -_1_0_7_4 _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) │ │ │ │ -1075 { │ │ │ │ -1076 using std::sqrt; │ │ │ │ -1077 using std::abs; │ │ │ │ -1078 using std::max; │ │ │ │ -1079 using std::min; │ │ │ │ -1080 const _r_e_a_l___t_y_p_e eps = 1e-15; │ │ │ │ -1081 _r_e_a_l___t_y_p_e norm_dx = abs(dx); │ │ │ │ -1082 _r_e_a_l___t_y_p_e norm_dy = abs(dy); │ │ │ │ -1083 _r_e_a_l___t_y_p_e norm_max = max(norm_dx, norm_dy); │ │ │ │ -1084 _r_e_a_l___t_y_p_e norm_min = min(norm_dx, norm_dy); │ │ │ │ -1085 _r_e_a_l___t_y_p_e temp = norm_min/norm_max; │ │ │ │ -1086 // we rewrite the code in a vectorizable fashion │ │ │ │ -1087 cs = Simd::cond(norm_dy < eps, │ │ │ │ -1088 _r_e_a_l___t_y_p_e(1.0), │ │ │ │ -1089 Simd::cond(norm_dx < eps, │ │ │ │ -1090 _r_e_a_l___t_y_p_e(0.0), │ │ │ │ -1091 _r_e_a_l___t_y_p_e(Simd::cond(norm_dy > norm_dx, │ │ │ │ -1092 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp)*temp, │ │ │ │ -1093 _r_e_a_l___t_y_p_e(1.0)/sqrt(_r_e_a_l___t_y_p_e(1.0) + temp*temp) │ │ │ │ -1094 )))); │ │ │ │ -1095 sn = Simd::cond(norm_dy < eps, │ │ │ │ -1096 _f_i_e_l_d___t_y_p_e(0.0), │ │ │ │ -1097 Simd::cond(norm_dx < eps, │ │ │ │ -1098 _f_i_e_l_d___t_y_p_e(1.0), │ │ │ │ -1099 _f_i_e_l_d___t_y_p_e(Simd::cond(norm_dy > norm_dx, │ │ │ │ -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)*dx*_c_o_n_j_u_g_a_t_e(dy)/norm_dx/ │ │ │ │ -norm_dy, │ │ │ │ -1101 _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) │ │ │ │ -1102 )))); │ │ │ │ -1103 } │ │ │ │ -1104 │ │ │ │ -1105 │ │ │ │ -1106 void │ │ │ │ -_1_1_0_7 _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) │ │ │ │ -1108 { │ │ │ │ -1109 _f_i_e_l_d___t_y_p_e temp = cs * dx + sn * dy; │ │ │ │ -1110 dy = -_c_o_n_j_u_g_a_t_e(sn) * dx + cs * dy; │ │ │ │ -1111 dx = temp; │ │ │ │ -1112 } │ │ │ │ -1113 │ │ │ │ -1114 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1115 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -1116 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1117 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; │ │ │ │ -1118 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -1119 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_2_0 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_1 int ___r_e_s_t_a_r_t; │ │ │ │ -1122 }; │ │ │ │ -_1_1_2_3 _D_U_N_E___R_E_G_I_S_T_E_R___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_>()); │ │ │ │ -1124 │ │ │ │ -1137 │ │ │ │ -1138 template │ │ │ │ -_1_1_3_9 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 │ │ │ │ -1140 { │ │ │ │ -1141 public: │ │ │ │ -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_>_:_:_d_o_m_a_i_n___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_>_:_:_r_a_n_g_e___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_>_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ -1145 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; │ │ │ │ -1146 │ │ │ │ -1147 private: │ │ │ │ -1148 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; │ │ │ │ -1149 │ │ │ │ -1151 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; │ │ │ │ -1153 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; │ │ │ │ -1154 │ │ │ │ -1155 public: │ │ │ │ -1156 // copy base class constructors │ │ │ │ -1157 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_e_d_G_M_R_e_s_S_o_l_v_e_r; │ │ │ │ -1158 │ │ │ │ -1159 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -1160 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; │ │ │ │ -1161 │ │ │ │ -_1_1_7_0 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 │ │ │ │ -1171 { │ │ │ │ -1172 using std::abs; │ │ │ │ -1173 const Simd::Scalar EPSILON = 1e-80; │ │ │ │ -1174 const int m = ___r_e_s_t_a_r_t; │ │ │ │ -1175 _r_e_a_l___t_y_p_e norm = 0.0; │ │ │ │ -1176 int i, j = 1, k; │ │ │ │ -1177 std::vector s(m+1), sn(m); │ │ │ │ -1178 std::vector cs(m); │ │ │ │ -1179 // helper vector │ │ │ │ -1180 Y tmp(b); │ │ │ │ -1181 std::vector< std::vector > H(m+1,s); │ │ │ │ -1182 std::vector v(m+1,b); │ │ │ │ -1183 std::vector w(m+1,b); │ │ │ │ -1184 │ │ │ │ -1185 Iteration iteration(*this,res); │ │ │ │ -1186 // setup preconditioner if it does something in pre │ │ │ │ -1187 │ │ │ │ -1188 // calculate residual and overwrite a copy of the rhs with it │ │ │ │ -1189 ___p_r_e_c->pre(x, b); │ │ │ │ -1190 v[0] = b; │ │ │ │ -1191 ___o_p->applyscaleadd(-1.0, x, v[0]); // b -= Ax │ │ │ │ -1192 │ │ │ │ -1193 norm = ___s_p->norm(v[0]); // the residual norm │ │ │ │ -1194 if(iteration.step(0, norm)){ │ │ │ │ -1195 ___p_r_e_c->post(x); │ │ │ │ -1196 return; │ │ │ │ -1197 } │ │ │ │ -1198 │ │ │ │ -1199 // start iterations │ │ │ │ -1200 res._c_o_n_v_e_r_g_e_d = false;; │ │ │ │ -1201 while(j <= ___m_a_x_i_t && res._c_o_n_v_e_r_g_e_d != true) │ │ │ │ -1202 { │ │ │ │ -1203 v[0] *= (1.0 / norm); │ │ │ │ -1204 s[0] = norm; │ │ │ │ -1205 for(i=1; iapply(w[i], v[i]); │ │ │ │ -1214 // compute vi = A*wi │ │ │ │ -1215 // use v[i+1] as temporary vector for w │ │ │ │ -1216 ___o_p->apply(w[i], v[i+1]); │ │ │ │ -1217 // do Arnoldi algorithm │ │ │ │ -1218 for(int kk=0; kkdot(v[k],v[i+1]) = v[k]\adjoint v[i+1] │ │ │ │ -1221 // so one has to pay attention to the order │ │ │ │ -1222 // in the scalar product for the complex case │ │ │ │ -1223 // doing the modified Gram-Schmidt algorithm │ │ │ │ -1224 H[kk][i] = ___s_p->dot(v[kk],v[i+1]); │ │ │ │ -1225 // w -= H[k][i] * v[kk] │ │ │ │ -1226 v[i+1].axpy(-H[kk][i], v[kk]); │ │ │ │ -1227 } │ │ │ │ -1228 H[i+1][i] = ___s_p->norm(v[i+1]); │ │ │ │ -1229 if(Simd::allTrue(abs(H[i+1][i]) < EPSILON)) │ │ │ │ -1230 DUNE_THROW(_S_o_l_v_e_r_A_b_o_r_t, "breakdown in fGMRes - |w| (-> " │ │ │ │ -1231 << w[i] << ") == 0.0 after " │ │ │ │ -1232 << j << " iterations"); │ │ │ │ -1233 │ │ │ │ -1234 // v[i+1] = w*1/H[i+1][i] │ │ │ │ -1235 v[i+1] *= _r_e_a_l___t_y_p_e(1.0)/H[i+1][i]; │ │ │ │ -1236 │ │ │ │ -1237 // update QR factorization │ │ │ │ -1238 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]); │ │ │ │ -1240 │ │ │ │ -1241 // compute new givens rotation │ │ │ │ -1242 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]); │ │ │ │ -1243 │ │ │ │ -1244 // finish updating QR factorization │ │ │ │ -1245 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]); │ │ │ │ -1246 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]); │ │ │ │ -1247 │ │ │ │ -1248 // norm of the residual is the last component of vector s │ │ │ │ -1249 using std::abs; │ │ │ │ -1250 norm = abs(s[i+1]); │ │ │ │ -1251 iteration.step(j, norm); │ │ │ │ -1252 } // end inner for loop │ │ │ │ -1253 │ │ │ │ -1254 // calculate update vector │ │ │ │ -1255 tmp = 0.0; │ │ │ │ -1256 this->_u_p_d_a_t_e(tmp, i, H, s, w); │ │ │ │ -1257 // and update current iterate │ │ │ │ -1258 x += tmp; │ │ │ │ -1259 │ │ │ │ -1260 // restart fGMRes if convergence was not achieved, │ │ │ │ -1261 // i.e. linear residual has not reached desired reduction │ │ │ │ -1262 // and if still j < _maxit (do not restart on last iteration) │ │ │ │ -1263 if( res._c_o_n_v_e_r_g_e_d != true && j < ___m_a_x_i_t) │ │ │ │ -1264 { │ │ │ │ -1265 if (___v_e_r_b_o_s_e > 0) │ │ │ │ -1266 std::cout << "=== fGMRes::restart" << std::endl; │ │ │ │ -1267 // get rhs │ │ │ │ -1268 v[0] = b; │ │ │ │ -1269 // calculate new defect │ │ │ │ -1270 ___o_p->applyscaleadd(-1.0, x,v[0]); // b -= Ax; │ │ │ │ -1271 // calculate preconditioned defect │ │ │ │ -1272 norm = ___s_p->norm(v[0]); // update the residual norm │ │ │ │ -1273 } │ │ │ │ -1274 │ │ │ │ -1275 } // end outer while loop │ │ │ │ -1276 │ │ │ │ -1277 // post-process preconditioner │ │ │ │ -1278 ___p_r_e_c->post(x); │ │ │ │ -1279 } │ │ │ │ -1280 │ │ │ │ -1281private: │ │ │ │ -1282 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1283 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; │ │ │ │ -1284 using _R_e_s_t_a_r_t_e_d_G_M_R_e_s_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1285 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; │ │ │ │ -1286 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; │ │ │ │ -1287 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; │ │ │ │ -1288 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; │ │ │ │ -1289 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_>; │ │ │ │ -1290 }; │ │ │ │ -_1_2_9_1 _D_U_N_E___R_E_G_I_S_T_E_R___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_>()); │ │ │ │ -1292 │ │ │ │ -1306 template │ │ │ │ -_1_3_0_7 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 │ │ │ │ -1308 { │ │ │ │ -1309 public: │ │ │ │ -1310 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; │ │ │ │ -1311 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; │ │ │ │ -1312 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; │ │ │ │ -1313 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; │ │ │ │ -1314 │ │ │ │ -1315 private: │ │ │ │ -1316 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; │ │ │ │ -1317 │ │ │ │ -1319 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_>; │ │ │ │ -1320 │ │ │ │ -1321 public: │ │ │ │ -1322 │ │ │ │ -1323 // don't shadow four-argument version of apply defined in the base class │ │ │ │ -1324 using _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r_:_:_a_p_p_l_y; │ │ │ │ -1325 │ │ │ │ -_1_3_3_2 _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) : │ │ │ │ -1333 _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), │ │ │ │ -1334 _restart(restart) │ │ │ │ -1335 {} │ │ │ │ -1336 │ │ │ │ -_1_3_4_4 _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) : │ │ │ │ -1345 _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), │ │ │ │ -1346 _restart(restart) │ │ │ │ -1347 {} │ │ │ │ -1348 │ │ │ │ -1349 │ │ │ │ -_1_3_6_2 _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) │ │ │ │ -: │ │ │ │ -1363 _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), │ │ │ │ -1364 _restart(configuration._g_e_t("restart")) │ │ │ │ -1365 {} │ │ │ │ -1366 │ │ │ │ -_1_3_6_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, │ │ │ │ -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) : │ │ │ │ -1368 _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), │ │ │ │ -1369 _restart(configuration._g_e_t("restart")) │ │ │ │ -1370 {} │ │ │ │ -1371 │ │ │ │ -_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 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 │ │ │ │ -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& configuration) │ │ │ │ -1561 : _I_t_e_r_a_t_i_v_e_S_o_l_v_e_r(op, prec, configuration), ___m_m_a_x(configuration._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 │ │ │ │ -1582 │ │ │ │ -_1_5_8_3 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 │ │ │ │ -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,_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,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___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_>()); │ │ │ │ -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_:_:_R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r; │ │ │ │ -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 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 { │ │ │ │ -1695 // reset limiter of orthogonalization loop │ │ │ │ -1696 _k_limit = 0; │ │ │ │ -1697 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); │ │ │ │ -1698 }; │ │ │ │ -1699 │ │ │ │ -1700 private: │ │ │ │ -1701 // This function is called every iteration to orthogonalize against the │ │ │ │ -last search directions. │ │ │ │ -1702 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 { │ │ │ │ -1703 // This FCGSolver uses values with higher array indexes too, if existent. │ │ │ │ -1704 for (int k = 0; k < _k_limit; k++) { │ │ │ │ -1705 if(i_bounded!=k) │ │ │ │ -1706 d[i_bounded].axpy(-___s_p->dot(Ad[k], w) / ddotAd[k], d[k]); // d[i] -= </>d[k] │ │ │ │ -1707 } │ │ │ │ -1708 // The loop limit increase, if array is not completely filled. │ │ │ │ -1709 if(_k_limit<=i_bounded) │ │ │ │ -1710 _k_limit++; │ │ │ │ -1711 │ │ │ │ -1712 }; │ │ │ │ -1713 │ │ │ │ -1714 // This function is called every mmax iterations to handle limited array │ │ │ │ -sizes. │ │ │ │ -1715 void cycle(std::vector& Ad, [[maybe_unused]] std::vector& d, [ │ │ │ │ -[maybe_unused]] 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,int& i_bounded) override { │ │ │ │ -1716 // Only the loop index i_bounded return to 0, if it reached mmax. │ │ │ │ -1717 i_bounded = 0; │ │ │ │ -1718 // Now all arrays are filled and the loop in void orthogonalizations can │ │ │ │ -use the whole arrays. │ │ │ │ -1719 _k_limit = Ad.size(); │ │ │ │ -1720 }; │ │ │ │ -1721 │ │ │ │ -1722 int _k_limit = 0; │ │ │ │ -1723 │ │ │ │ -1724 protected: │ │ │ │ -1725 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___m_m_a_x; │ │ │ │ -1726 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___o_p; │ │ │ │ -1727 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___p_r_e_c; │ │ │ │ -1728 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___s_p; │ │ │ │ -1729 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; │ │ │ │ -1730 using _R_e_s_t_a_r_t_e_d_F_C_G_S_o_l_v_e_r_:_:___m_a_x_i_t; │ │ │ │ -1731 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; │ │ │ │ -1732 }; │ │ │ │ -_1_7_3_3 _D_U_N_E___R_E_G_I_S_T_E_R___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_>()); │ │ │ │ -1735} // end namespace │ │ │ │ -1736 │ │ │ │ -1737#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___S_O_L_V_E_R │ │ │ │ -#define DUNE_REGISTER_SOLVER(name,...) │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:16 │ │ │ │ -_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 │ │ │ │ -_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:76 │ │ │ │ +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 _A_m_g │ │ │ │ +14 { │ │ │ │ +24 │ │ │ │ +_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 { │ │ │ │ +_6_1 _i_n_d_e_x = i │ │ │ │ +62 }; │ │ │ │ +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_:_:_t_y_p_e │ │ │ │ -const Dtype_t BaseGetSuperLUType< T >::type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:135 │ │ │ │ -_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:467 │ │ │ │ -_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_ _>_ _>_:_:_r_o_w___w_i_s_e │ │ │ │ -@ row_wise │ │ │ │ -DDeeffiinniittiioonn bcrsmatrix.hh:518 │ │ │ │ -_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:68 │ │ │ │ -_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_ _>_:_:_I_t_e_r_a_t_i_v_e_S_o_l_v_e_r │ │ │ │ -IterativeSolver(const LinearOperator< X, X > &op, Preconditioner< X, X > &prec, │ │ │ │ -scalar_real_type reduction, int maxit, int verbose) │ │ │ │ -DDeeffiinniittiioonn solver.hh:232 │ │ │ │ -_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_:_:_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_:_:_L_o_o_p_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:73 │ │ │ │ -_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 │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -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_:_:_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:257 │ │ │ │ -_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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:280 │ │ │ │ -_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_:_:_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:413 │ │ │ │ -_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:420 │ │ │ │ -_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:599 │ │ │ │ -_D_u_n_e_:_:_B_i_C_G_S_T_A_B_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:440 │ │ │ │ -_D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r │ │ │ │ -Minimal Residual Method (MINRES). │ │ │ │ -DDeeffiinniittiioonn solvers.hh:610 │ │ │ │ -_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:809 │ │ │ │ -_D_u_n_e_:_:_M_I_N_R_E_S_S_o_l_v_e_r_:_:_a_p_p_l_y │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:628 │ │ │ │ -_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:828 │ │ │ │ -_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:879 │ │ │ │ -_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 │ │ │ │ -void apply(X &x, Y &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:911 │ │ │ │ -_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:1068 │ │ │ │ -_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:884 │ │ │ │ -_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:1040 │ │ │ │ -_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:1063 │ │ │ │ -_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:839 │ │ │ │ -_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:1121 │ │ │ │ -_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:841 │ │ │ │ -_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:851 │ │ │ │ -_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:862 │ │ │ │ -_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:1074 │ │ │ │ -_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 │ │ │ │ -void apply(X &x, Y &b, double reduction, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:924 │ │ │ │ -_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:895 │ │ │ │ -_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: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_:_:_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:1107 │ │ │ │ -_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:1140 │ │ │ │ -_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:1170 │ │ │ │ -_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:1344 │ │ │ │ -_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:1332 │ │ │ │ -_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) │ │ │ │ -Set up nonlinear preconditioned conjugate gradient solver. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1362 │ │ │ │ -_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:1367 │ │ │ │ -_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 │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1391 │ │ │ │ -_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< 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 │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -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(std::shared_ptr< const LinearOperator< X, X > > op, std:: │ │ │ │ -shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration) │ │ │ │ -Constructor to initialize a RestartedFCG solver. │ │ │ │ -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(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 │ │ │ │ -void apply(X &x, X &b, InverseOperatorResult &res) override │ │ │ │ -Apply inverse operator,. │ │ │ │ -DDeeffiinniittiioonn solvers.hh:1693 │ │ │ │ +_D_u_n_e_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,105 +66,52 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::NoAssembledOperator
 This exception is thrown if the requested solver or preconditioner needs an assembled matrix. More...
class  Dune::UnsupportedType
class  Dune::InvalidSolverFactoryConfiguration
class  Dune::Amg::Transfer< V1, V2, T >
class  Dune::Amg::Transfer< V, V1, SequentialInformation >
class  Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > >
│ │ │ │ │ │ │ │ │ -

│ │ │ Namespaces

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

│ │ │ -Macros

#define DUNE_REGISTER_PRECONDITIONER(name, ...)
#define DUNE_REGISTER_SOLVER(name, ...)
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │

│ │ │ -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_PRECONDITIONER

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define DUNE_REGISTER_PRECONDITIONER( name,
... )
│ │ │ -
│ │ │ -Value:
DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ -
#define DUNE_REGISTRY_PUT(Tag, id,...)
Definition registry.hh:18
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ - │ │ │ -

◆ DUNE_REGISTER_SOLVER

│ │ │ - │ │ │ -
│ │ │ -
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ -
#define DUNE_REGISTER_SOLVER( name,
... )
│ │ │ -
│ │ │ -Value:
DUNE_REGISTRY_PUT(SolverTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Prolongation and restriction for amg.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,47 +1,32 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r │ │ │ │ -  This exception is thrown if the requested solver or preconditioner │ │ │ │ - needs an assembled matrix. _M_o_r_e_._._. │ │ │ │ -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_:_:_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_1_,_ _V_2_,_ _T_ _> │ │ │ │ +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___P_R_E_C_O_N_D_I_T_I_O_N_E_R(name, ...) │ │ │ │ -#define  _D_U_N_E___R_E_G_I_S_T_E_R___S_O_L_V_E_R(name, ...) │ │ │ │ -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 () │ │ │ │ -********** MMaaccrroo DDeeffiinniittiioonn DDooccuummeennttaattiioonn ********** │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__PPRREECCOONNDDIITTIIOONNEERR ********** │ │ │ │ -#define DUNE_REGISTER_PRECONDITIONER ( nnaammee, │ │ │ │ - ... ) │ │ │ │ -VVaalluuee:: │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(PreconditionerTag, name, __VA_ARGS__) │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T │ │ │ │ -#define DUNE_REGISTRY_PUT(Tag, id,...) │ │ │ │ -DDeeffiinniittiioonn registry.hh:18 │ │ │ │ -********** _?◆_? DDUUNNEE__RREEGGIISSTTEERR__SSOOLLVVEERR ********** │ │ │ │ -#define DUNE_REGISTER_SOLVER ( nnaammee, │ │ │ │ - ... ) │ │ │ │ -VVaalluuee:: │ │ │ │ -_D_U_N_E___R_E_G_I_S_T_R_Y___P_U_T(SolverTag, name, __VA_ARGS__) │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ +********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ +Prolongation and restriction for amg. │ │ │ │ + Author │ │ │ │ + Markus Blatt │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,144 +66,255 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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_PRECONDITIONER(name, ...) \
│ │ │ -
14 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ -
15
│ │ │ -
│ │ │ -
16#define DUNE_REGISTER_SOLVER(name, ...) \
│ │ │ -
17 DUNE_REGISTRY_PUT(SolverTag, name, __VA_ARGS__)
│ │ │ -
│ │ │ -
18
│ │ │ -
19namespace Dune{
│ │ │ -
20
│ │ │ -
24
│ │ │ -
25 namespace {
│ │ │ -
26 struct PreconditionerTag {};
│ │ │ -
27 struct SolverTag {};
│ │ │ -
28 }
│ │ │ -
29
│ │ │ -
31 class NoAssembledOperator : public InvalidStateException{};
│ │ │ -
32
│ │ │ -
33 template<template<class,class,class,int>class Preconditioner, int blockLevel=1>
│ │ │ -
│ │ │ - │ │ │ -
35 return [](auto opInfo, const auto& linearOperator, const Dune::ParameterTree& config)
│ │ │ -
36 {
│ │ │ -
37 using OpInfo = std::decay_t<decltype(opInfo)>;
│ │ │ -
38 using Matrix = typename OpInfo::matrix_type;
│ │ │ -
39 using Domain = typename OpInfo::domain_type;
│ │ │ -
40 using Range = typename OpInfo::range_type;
│ │ │ -
41 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner;
│ │ │ -
42 if constexpr (OpInfo::isAssembled){
│ │ │ -
43 const auto& A = opInfo.getAssembledOpOrThrow(linearOperator);
│ │ │ -
44 // const Matrix& matrix = A->getmat();
│ │ │ -
45 preconditioner
│ │ │ -
46 = std::make_shared<Preconditioner<Matrix, Domain, Range, blockLevel>>(A, config);
│ │ │ -
47 }else{
│ │ │ -
48 DUNE_THROW(NoAssembledOperator, "Could not obtain matrix from operator. Please pass in an AssembledLinearOperator.");
│ │ │ -
49 }
│ │ │ -
50 return preconditioner;
│ │ │ -
51 };
│ │ │ -
52 }
│ │ │ -
│ │ │ -
53
│ │ │ -
54 template<template<class,class,class>class Preconditioner>
│ │ │ -
│ │ │ - │ │ │ -
56 return [](auto opInfo, const auto& linearOperator, const Dune::ParameterTree& config)
│ │ │ -
57 {
│ │ │ -
58 using OpInfo = std::decay_t<decltype(opInfo)>;
│ │ │ -
59 using Matrix = typename OpInfo::matrix_type;
│ │ │ -
60 using Domain = typename OpInfo::domain_type;
│ │ │ -
61 using Range = typename OpInfo::range_type;
│ │ │ -
62 std::shared_ptr<Dune::Preconditioner<Domain, Range>> preconditioner;
│ │ │ -
63 if constexpr (OpInfo::isAssembled){
│ │ │ -
64 const auto& A = opInfo.getAssembledOpOrThrow(linearOperator);
│ │ │ -
65 // const Matrix& matrix = A->getmat();
│ │ │ -
66 preconditioner
│ │ │ -
67 = std::make_shared<Preconditioner<Matrix, Domain, Range>>(A, config);
│ │ │ -
68 }else{
│ │ │ -
69 DUNE_THROW(NoAssembledOperator, "Could not obtain matrix from operator. Please pass in an AssembledLinearOperator.");
│ │ │ -
70 }
│ │ │ -
71 return preconditioner;
│ │ │ -
72 };
│ │ │ -
73 }
│ │ │ -
│ │ │ -
74
│ │ │ -
75 template<template<class...>class Solver>
│ │ │ -
│ │ │ - │ │ │ -
77 return [](auto opInfo,
│ │ │ -
78 const auto& linearOperator,
│ │ │ -
79 const Dune::ParameterTree& config)
│ │ │ -
80 {
│ │ │ -
81 using OpInfo = std::decay_t<decltype(opInfo)>;
│ │ │ -
82 using Operator = typename OpInfo::operator_type;
│ │ │ -
83 using Domain = typename OpInfo::domain_type;
│ │ │ -
84 using Range = typename OpInfo::range_type;
│ │ │ -
85 std::shared_ptr<Operator> _op = std::dynamic_pointer_cast<Operator>(linearOperator);
│ │ │ -
86 std::shared_ptr<Preconditioner<Domain,Range>> preconditioner = getPreconditionerFromFactory(_op, config.sub("preconditioner"));
│ │ │ -
87 std::shared_ptr<ScalarProduct<Range>> scalarProduct = opInfo.getScalarProduct(linearOperator);
│ │ │ -
88 std::shared_ptr<Dune::InverseOperator<Domain, Range>> solver
│ │ │ -
89 = std::make_shared<Solver<Domain>>(linearOperator, scalarProduct, preconditioner, config);
│ │ │ -
90 return solver;
│ │ │ +
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
│ │ │ +
25
│ │ │ +
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 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
│ │ │ -
94 /* This exception is thrown, when the requested solver is in the factory but
│ │ │ -
95 cannot be instantiated for the required template parameters
│ │ │ -
96 */
│ │ │ -
97 class UnsupportedType : public NotImplemented {};
│ │ │ -
98
│ │ │ -
99 class InvalidSolverFactoryConfiguration : public InvalidStateException{};
│ │ │ -
100} // end namespace Dune
│ │ │ -
101
│ │ │ -
102#endif // DUNE_ISTL_SOLVERREGISTRY_HH
│ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ - │ │ │ - │ │ │ -
auto defaultIterativeSolverCreator()
Definition solverregistry.hh:76
│ │ │ -
auto defaultPreconditionerBlockLevelCreator()
Definition solverregistry.hh:34
│ │ │ -
std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > getPreconditionerFromFactory(std::shared_ptr< Operator > op, const ParameterTree &config)
Construct a Preconditioner for a given Operator.
Definition solverfactory.hh:157
│ │ │ -
auto defaultPreconditionerCreator()
Definition solverregistry.hh:55
│ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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.
│ │ │ +
static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, const Vector &fine, OwnerOverlapCopyCommunication< T1, T2 > &comm)
Definition transfer.hh:181
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ +
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T3 damp, OwnerOverlapCopyCommunication< T1, T2 > &comm, const Redist &redist)
Definition transfer.hh:156
│ │ │
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
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
This exception is thrown if the requested solver or preconditioner needs an assembled matrix.
Definition solverregistry.hh:31
│ │ │ -
Definition solverregistry.hh:97
│ │ │ -
Definition solverregistry.hh:99
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
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:566
│ │ │ +
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,158 +1,309 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_PRECONDITIONER(name, ...) \ │ │ │ │ -14 DUNE_REGISTRY_PUT(PreconditionerTag, name, __VA_ARGS__) │ │ │ │ -15 │ │ │ │ -_1_6#define DUNE_REGISTER_SOLVER(name, ...) \ │ │ │ │ -17 DUNE_REGISTRY_PUT(SolverTag, name, __VA_ARGS__) │ │ │ │ -18 │ │ │ │ -19namespace _D_u_n_e{ │ │ │ │ -20 │ │ │ │ -24 │ │ │ │ -25 namespace { │ │ │ │ -26 struct PreconditionerTag {}; │ │ │ │ -27 struct SolverTag {}; │ │ │ │ -28 } │ │ │ │ -29 │ │ │ │ -_3_1 class _N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r : public InvalidStateException{}; │ │ │ │ -32 │ │ │ │ -33 templateclass _P_r_e_c_o_n_d_i_t_i_o_n_e_r, int │ │ │ │ -_b_l_o_c_k_L_e_v_e_l=1> │ │ │ │ -_3_4 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(){ │ │ │ │ -35 return [](auto opInfo, const auto& linearOperator, const Dune:: │ │ │ │ -ParameterTree& config) │ │ │ │ -36 { │ │ │ │ -37 using OpInfo = std::decay_t; │ │ │ │ -38 using _M_a_t_r_i_x = typename OpInfo::matrix_type; │ │ │ │ -39 using Domain = typename OpInfo::domain_type; │ │ │ │ -40 using Range = typename OpInfo::range_type; │ │ │ │ -41 std::shared_ptr> preconditioner; │ │ │ │ -42 if constexpr (OpInfo::isAssembled){ │ │ │ │ -43 const auto& A = opInfo.getAssembledOpOrThrow(linearOperator); │ │ │ │ -44 // const Matrix& matrix = A->getmat(); │ │ │ │ -45 preconditioner │ │ │ │ -46 = std::make_shared>(A, │ │ │ │ -config); │ │ │ │ -47 }else{ │ │ │ │ -48 DUNE_THROW(_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r, "Could not obtain matrix from operator. │ │ │ │ -Please pass in an AssembledLinearOperator."); │ │ │ │ -49 } │ │ │ │ -50 return preconditioner; │ │ │ │ -51 }; │ │ │ │ -52 } │ │ │ │ -53 │ │ │ │ -54 templateclass Preconditioner> │ │ │ │ -_5_5 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(){ │ │ │ │ -56 return [](auto opInfo, const auto& linearOperator, const Dune:: │ │ │ │ -ParameterTree& config) │ │ │ │ -57 { │ │ │ │ -58 using OpInfo = std::decay_t; │ │ │ │ -59 using _M_a_t_r_i_x = typename OpInfo::matrix_type; │ │ │ │ -60 using Domain = typename OpInfo::domain_type; │ │ │ │ -61 using Range = typename OpInfo::range_type; │ │ │ │ -62 std::shared_ptr> preconditioner; │ │ │ │ -63 if constexpr (OpInfo::isAssembled){ │ │ │ │ -64 const auto& A = opInfo.getAssembledOpOrThrow(linearOperator); │ │ │ │ -65 // const Matrix& matrix = A->getmat(); │ │ │ │ -66 preconditioner │ │ │ │ -67 = std::make_shared>(A, config); │ │ │ │ -68 }else{ │ │ │ │ -69 DUNE_THROW(_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r, "Could not obtain matrix from operator. │ │ │ │ -Please pass in an AssembledLinearOperator."); │ │ │ │ -70 } │ │ │ │ -71 return preconditioner; │ │ │ │ -72 }; │ │ │ │ -73 } │ │ │ │ -74 │ │ │ │ -75 templateclass Solver> │ │ │ │ -_7_6 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(){ │ │ │ │ -77 return [](auto opInfo, │ │ │ │ -78 const auto& linearOperator, │ │ │ │ -79 const Dune::ParameterTree& config) │ │ │ │ -80 { │ │ │ │ -81 using OpInfo = std::decay_t; │ │ │ │ -82 using Operator = typename OpInfo::operator_type; │ │ │ │ -83 using Domain = typename OpInfo::domain_type; │ │ │ │ -84 using Range = typename OpInfo::range_type; │ │ │ │ -85 std::shared_ptr _op = std::dynamic_pointer_cast │ │ │ │ -(linearOperator); │ │ │ │ -86 std::shared_ptr> preconditioner = │ │ │ │ -_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_r_o_m_F_a_c_t_o_r_y(_op, config.sub("preconditioner")); │ │ │ │ -87 std::shared_ptr> scalarProduct = │ │ │ │ -opInfo.getScalarProduct(linearOperator); │ │ │ │ -88 std::shared_ptr> solver │ │ │ │ -89 = std::make_shared>(linearOperator, scalarProduct, │ │ │ │ -preconditioner, config); │ │ │ │ -90 return solver; │ │ │ │ +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 _A_m_g │ │ │ │ +18 { │ │ │ │ +19 │ │ │ │ +25 │ │ │ │ +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 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 │ │ │ │ -94 /* This exception is thrown, when the requested solver is in the factory but │ │ │ │ -95 cannot be instantiated for the required template parameters │ │ │ │ -96 */ │ │ │ │ -_9_7 class _U_n_s_u_p_p_o_r_t_e_d_T_y_p_e : public NotImplemented {}; │ │ │ │ -98 │ │ │ │ -_9_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{}; │ │ │ │ -100} // end namespace Dune │ │ │ │ -101 │ │ │ │ -102#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:76 │ │ │ │ -_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:34 │ │ │ │ -_D_u_n_e_:_:_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_r_o_m_F_a_c_t_o_r_y │ │ │ │ -std::shared_ptr< Preconditioner< typename Operator::domain_type, typename │ │ │ │ -Operator::range_type > > getPreconditionerFromFactory(std::shared_ptr< Operator │ │ │ │ -> op, const ParameterTree &config) │ │ │ │ -Construct a Preconditioner for a given Operator. │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:157 │ │ │ │ -_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:55 │ │ │ │ +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 _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(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.end(); │ │ │ │ +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_> >_:_: │ │ │ │ +_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, │ │ │ │ +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_> >_:_: │ │ │ │ +_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r( │ │ │ │ +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_> >_:_: │ │ │ │ +_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, │ │ │ │ +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_:_:_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_s_t_r_i_c_t_V_e_c_t_o_r │ │ │ │ +static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ +&coarse, const Vector &fine, OwnerOverlapCopyCommunication< T1, T2 > &comm) │ │ │ │ +DDeeffiinniittiioonn transfer.hh:181 │ │ │ │ +_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:577 │ │ │ │ +_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_ _>_ _>_:_: │ │ │ │ +_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, T3 damp, │ │ │ │ +OwnerOverlapCopyCommunication< T1, T2 > &comm, const Redist &redist) │ │ │ │ +DDeeffiinniittiioonn transfer.hh:156 │ │ │ │ _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_:_:_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_:_:_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r │ │ │ │ -This exception is thrown if the requested solver or preconditioner needs an │ │ │ │ -assembled matrix. │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:31 │ │ │ │ -_D_u_n_e_:_:_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:97 │ │ │ │ -_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:99 │ │ │ │ +_D_u_n_e_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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:566 │ │ │ │ +_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,72 +66,60 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces | │ │ │ -Typedefs | │ │ │ -Functions
│ │ │ -
solverfactory.hh File Reference
│ │ │ +Namespaces
│ │ │ + │ │ │
│ │ │
│ │ │ -
#include <unordered_map>
│ │ │ -#include <functional>
│ │ │ -#include <memory>
│ │ │ -#include <dune/common/parametertree.hh>
│ │ │ -#include <dune/common/std/type_traits.hh>
│ │ │ -#include <dune/common/singleton.hh>
│ │ │ -#include <dune/common/parameterizedobject.hh>
│ │ │ -#include <dune/istl/solverregistry.hh>
│ │ │ -#include <dune/istl/common/registry.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

struct  Dune::OperatorTraits< Operator >
class  Dune::UnknownSolverCategory
struct  Dune::Amg::ConstructionTraits< T >
 Traits class for generically constructing non default constructable types. 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 OP>
using Dune::PreconditionerSignature = std::shared_ptr<Preconditioner<typename OP::domain_type,typename OP::range_type>>(const std::shared_ptr<OP>&, const ParameterTree&)
template<class OP>
using Dune::PreconditionerFactory = Singleton<ParameterizedObjectFactory<PreconditionerSignature<OP>>>
template<class OP>
using Dune::SolverSignature = std::shared_ptr<InverseOperator<typename OP::domain_type,typename OP::range_type>>(const std::shared_ptr<OP>&, const ParameterTree&)
template<class OP>
using Dune::SolverFactory = Singleton<ParameterizedObjectFactory<SolverSignature<OP>>>
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │

│ │ │ -Functions

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.
template<class Operator>
std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > Dune::getPreconditionerFromFactory (std::shared_ptr< Operator > op, const ParameterTree &config)
 Construct a Preconditioner for a given Operator.
namespace  Dune::Amg
│ │ │ -
│ │ │ +

Detailed Description

│ │ │ +

Helper classes for the construction of classes without empty constructor.

│ │ │ +
Author
Markus Blatt
│ │ │ +
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,60 +1,45 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ -#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 <_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_/_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 │ │ │ │ -struct   _D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_<_ _O_p_e_r_a_t_o_r_ _> │ │ │ │ - class   _D_u_n_e_:_:_U_n_k_n_o_w_n_S_o_l_v_e_r_C_a_t_e_g_o_r_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_<_ _T_ _> │ │ │ │ +  Traits class for generically constructing non default constructable │ │ │ │ + types. _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_:_:_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>(const std::shared_ptr&, │ │ │ │ - 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>> │ │ │ │ -template │ │ │ │ -using  _D_u_n_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>(const std::shared_ptr&, const │ │ │ │ - ParameterTree&) │ │ │ │ -template │ │ │ │ -using  _D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ - Singleton>> │ │ │ │ -FFuunnccttiioonnss │ │ │ │ -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. │ │ │ │ -template │ │ │ │ - std::shared_ptr< _P_r_e_c_o_n_d_i_t_i_o_n_e_r< _D_u_n_e_:_:_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_r_o_m_F_a_c_t_o_r_y │ │ │ │ - typename Operator::domain_type, (std::shared_ptr< Operator > op, const │ │ │ │ -typename Operator::range_type > >  ParameterTree &config) │ │ │ │ -  Construct a _P_r_e_c_o_n_d_i_t_i_o_n_e_r for a given │ │ │ │ - Operator. │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,210 +66,266 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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/std/type_traits.hh>
│ │ │ -
15#include <dune/common/singleton.hh>
│ │ │ -
16#include <dune/common/parameterizedobject.hh>
│ │ │ -
17
│ │ │ - │ │ │ - │ │ │ -
20#include <dune/istl/solver.hh>
│ │ │ -
21#include <dune/istl/schwarz.hh>
│ │ │ - │ │ │ -
23
│ │ │ -
24namespace Dune{
│ │ │ -
28
│ │ │ -
29 // Preconditioner factory:
│ │ │ -
30 template<class OP>
│ │ │ -
31 using PreconditionerSignature = std::shared_ptr<Preconditioner<typename OP::domain_type,typename OP::range_type>>(const std::shared_ptr<OP>&, const ParameterTree&);
│ │ │ -
32 template<class OP>
│ │ │ -
33 using PreconditionerFactory = Singleton<ParameterizedObjectFactory<PreconditionerSignature<OP>>>;
│ │ │ -
34
│ │ │ -
35 // Iterative solver factory
│ │ │ -
36 template<class OP>
│ │ │ -
37 using SolverSignature = std::shared_ptr<InverseOperator<typename OP::domain_type,typename OP::range_type>>(const std::shared_ptr<OP>&, const ParameterTree&);
│ │ │ -
38 template<class OP>
│ │ │ -
39 using SolverFactory = Singleton<ParameterizedObjectFactory<SolverSignature<OP>>>;
│ │ │ -
40
│ │ │ -
41 template<class Operator>
│ │ │ -
│ │ │ - │ │ │ -
43 private:
│ │ │ -
44 template<class O>
│ │ │ -
45 using _matrix_type = typename O::matrix_type;
│ │ │ -
46 template<class O>
│ │ │ -
47 using _comm_type = typename O::communication_type;
│ │ │ -
48 public:
│ │ │ -
49 using domain_type = typename Operator::domain_type;
│ │ │ -
50 using range_type = typename Operator::range_type;
│ │ │ -
51 using operator_type = Operator;
│ │ │ - │ │ │ -
53 using matrix_type = Std::detected_or_t<int, _matrix_type, Operator>;
│ │ │ -
54 static constexpr bool isAssembled = !std::is_same<matrix_type, int>::value;
│ │ │ -
55 using comm_type = Std::detected_or_t<int, _comm_type, Operator>;
│ │ │ -
56 static constexpr bool isParallel = !std::is_same<comm_type, int>::value;
│ │ │ -
57
│ │ │ -
58 static const std::shared_ptr<AssembledLinearOperator<matrix_type, domain_type, range_type>>
│ │ │ -
│ │ │ - │ │ │ -
60 std::shared_ptr<AssembledLinearOperator<matrix_type, domain_type, range_type>> aop
│ │ │ -
61 = std::dynamic_pointer_cast<AssembledLinearOperator<matrix_type, domain_type, range_type>>(op);
│ │ │ -
62 if(aop)
│ │ │ -
63 return aop;
│ │ │ -
64 DUNE_THROW(NoAssembledOperator, "Failed to cast to AssembledLinearOperator. Please pass in an AssembledLinearOperator.");
│ │ │ -
65 }
│ │ │ -
│ │ │ -
66
│ │ │ -
│ │ │ - │ │ │ -
68 std::shared_ptr<Operator> _op
│ │ │ -
69 = std::dynamic_pointer_cast<Operator>(op);
│ │ │ -
70 if constexpr (isParallel){
│ │ │ -
71 return _op->getCommunication();
│ │ │ -
72 }else{
│ │ │ -
73 DUNE_THROW(NoAssembledOperator, "Could not obtain communication object from operator. Please pass in a parallel operator.");
│ │ │ -
74 }
│ │ │ -
75 }
│ │ │ -
│ │ │ -
76
│ │ │ -
│ │ │ -
77 static std::shared_ptr<ScalarProduct<domain_type>> getScalarProduct(std::shared_ptr<LinearOperator<domain_type, range_type>> op)
│ │ │ -
78 {
│ │ │ -
79 if constexpr (isParallel){
│ │ │ -
80 return createScalarProduct<domain_type>(getCommOrThrow(op), op->category());
│ │ │ -
81 }else{
│ │ │ -
82 return std::make_shared<SeqScalarProduct<domain_type>>();
│ │ │ -
83 }
│ │ │ -
84 }
│ │ │ -
│ │ │ -
85 };
│ │ │ -
│ │ │ -
86
│ │ │ -
87 // initSolverFactories differs in different compilation units, so we have it
│ │ │ -
88 // in an anonymous namespace
│ │ │ -
89 namespace {
│ │ │ -
90
│ │ │ -
96 template<class O>
│ │ │ -
97 int initSolverFactories(){
│ │ │ -
98 using OpInfo = OperatorTraits<O>;
│ │ │ - │ │ │ -
100 addRegistryToFactory<OpInfo>(pfac, PreconditionerTag{});
│ │ │ -
101 auto& isfac=Dune::SolverFactory<O>::instance();
│ │ │ -
102 return addRegistryToFactory<OpInfo>(isfac, SolverTag{});
│ │ │ -
103 }
│ │ │ -
104 } // end anonymous namespace
│ │ │ -
105
│ │ │ -
130 template<class Operator>
│ │ │ -
131 std::shared_ptr<InverseOperator<typename Operator::domain_type,
│ │ │ -
132 typename Operator::range_type>>
│ │ │ -
│ │ │ -
133 getSolverFromFactory(std::shared_ptr<Operator> op, const ParameterTree& config,
│ │ │ - │ │ │ -
135 {
│ │ │ -
136 if(prec){
│ │ │ -
137 PreconditionerFactory<Operator>::instance().define("__passed at runtime__",
│ │ │ -
138 [=](auto...){
│ │ │ -
139 return prec;
│ │ │ -
140 });
│ │ │ -
141 ParameterTree config_tmp = config;
│ │ │ -
142 config_tmp.sub("preconditioner")["type"] = std::string("__passed at runtime__");
│ │ │ - │ │ │ -
144 create(config.get<std::string>("type"),op, config_tmp);
│ │ │ -
145 }
│ │ │ - │ │ │ -
147 create(config.get<std::string>("type"),op, config);
│ │ │ -
148 }
│ │ │ +
5#ifndef DUNE_AMGCONSTRUCTION_HH
│ │ │ +
6#define DUNE_AMGCONSTRUCTION_HH
│ │ │ +
7
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
12#include "pinfo.hh"
│ │ │ +
13
│ │ │ +
14namespace Dune
│ │ │ +
15{
│ │ │ +
16 namespace Amg
│ │ │ +
17 {
│ │ │ +
18
│ │ │ +
24
│ │ │ +
37 template<typename T>
│ │ │ +
│ │ │ + │ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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 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>
│ │ │ +
│ │ │ + │ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
147 {
│ │ │ + │ │ │
149
│ │ │ -
150 class UnknownSolverCategory : public InvalidStateException{};
│ │ │ -
154 template<class Operator>
│ │ │ -
155 std::shared_ptr<Preconditioner<typename Operator::domain_type,
│ │ │ -
156 typename Operator::range_type>>
│ │ │ -
│ │ │ -
157 getPreconditionerFromFactory(std::shared_ptr<Operator> op,
│ │ │ -
158 const ParameterTree& config){
│ │ │ -
159 using Domain = typename Operator::domain_type;
│ │ │ -
160 using Range = typename Operator::range_type;
│ │ │ -
161 std::string prec_type = config.get<std::string>("type");
│ │ │ -
162 std::shared_ptr<Preconditioner<typename Operator::domain_type,
│ │ │ -
163 typename Operator::range_type>> prec = PreconditionerFactory<Operator>::instance().create(prec_type, op, config);
│ │ │ - │ │ │ -
165 using Comm = typename OperatorTraits<Operator>::comm_type;
│ │ │ -
166 const Comm& comm = OperatorTraits<Operator>::getCommOrThrow(op);
│ │ │ -
167 if(op->category() == SolverCategory::overlapping && prec->category() == SolverCategory::sequential)
│ │ │ -
168 return std::make_shared<BlockPreconditioner<Domain,Range,Comm> >(prec, comm);
│ │ │ -
169 else if(op->category() == SolverCategory::nonoverlapping && prec->category() == SolverCategory::sequential)
│ │ │ -
170 return std::make_shared<NonoverlappingBlockPreconditioner<Comm, Preconditioner<Domain, Range>> >(prec, comm);
│ │ │ -
171 }
│ │ │ -
172 return prec;
│ │ │ -
173 }
│ │ │ +
│ │ │ +
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<>
│ │ │ +
│ │ │ + │ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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 };
│ │ │
│ │ │ -
174
│ │ │ -
178} // end namespace Dune
│ │ │
179
│ │ │ -
180
│ │ │ -
181#endif
│ │ │ - │ │ │ -
Define general, extensible interface for inverse operators.
│ │ │ - │ │ │ - │ │ │ - │ │ │ -
Singleton< ParameterizedObjectFactory< SolverSignature< OP > > > SolverFactory
Definition solverfactory.hh:39
│ │ │ -
std::shared_ptr< Preconditioner< typename Operator::domain_type, typename Operator::range_type > > getPreconditionerFromFactory(std::shared_ptr< Operator > op, const ParameterTree &config)
Construct a Preconditioner for a given Operator.
Definition solverfactory.hh:157
│ │ │ -
Singleton< ParameterizedObjectFactory< PreconditionerSignature< OP > > > PreconditionerFactory
Definition solverfactory.hh:33
│ │ │ -
std::shared_ptr< Preconditioner< typename OP::domain_type, typename OP::range_type > >(const std::shared_ptr< OP > &, const ParameterTree &) PreconditionerSignature
Definition solverfactory.hh:31
│ │ │ -
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:133
│ │ │ -
std::shared_ptr< InverseOperator< typename OP::domain_type, typename OP::range_type > >(const std::shared_ptr< OP > &, const ParameterTree &) SolverSignature
Definition solverfactory.hh:37
│ │ │ +
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.
│ │ │ +
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
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
│ │ │ +
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 linear operator.
Definition operators.hh:68
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
Abstract base class for all solvers.
Definition solver.hh:101
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ -
@ nonoverlapping
Category for non-overlapping solvers.
Definition solvercategory.hh:27
│ │ │ -
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ -
Definition solverfactory.hh:42
│ │ │ -
static constexpr bool isParallel
Definition solverfactory.hh:56
│ │ │ -
Std::detected_or_t< int, _matrix_type, Operator > matrix_type
Definition solverfactory.hh:53
│ │ │ -
Operator operator_type
Definition solverfactory.hh:51
│ │ │ -
typename Operator::domain_type domain_type
Definition solverfactory.hh:49
│ │ │ -
InverseOperator< domain_type, range_type > solver_type
Definition solverfactory.hh:52
│ │ │ -
typename Operator::range_type range_type
Definition solverfactory.hh:50
│ │ │ -
static constexpr bool isAssembled
Definition solverfactory.hh:54
│ │ │ -
static const comm_type & getCommOrThrow(std::shared_ptr< LinearOperator< domain_type, range_type > > op)
Definition solverfactory.hh:67
│ │ │ -
Std::detected_or_t< int, _comm_type, Operator > comm_type
Definition solverfactory.hh:55
│ │ │ -
static const std::shared_ptr< AssembledLinearOperator< matrix_type, domain_type, range_type > > getAssembledOpOrThrow(std::shared_ptr< LinearOperator< domain_type, range_type > > op)
Definition solverfactory.hh:59
│ │ │ -
static std::shared_ptr< ScalarProduct< domain_type > > getScalarProduct(std::shared_ptr< LinearOperator< domain_type, range_type > > op)
Definition solverfactory.hh:77
│ │ │ -
Definition solverfactory.hh:150
│ │ │ -
This exception is thrown if the requested solver or preconditioner needs an assembled matrix.
Definition solverregistry.hh:31
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
A vector of blocks with memory management.
Definition bvector.hh:392
│ │ │ +
A nonoverlapping operator with communication object.
Definition novlpschwarz.hh:61
│ │ │ +
Traits class for generically constructing non default constructable types.
Definition construction.hh:39
│ │ │ +
Adapter to turn a matrix into a linear operator.
Definition operators.hh:135
│ │ │ +
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
│ │ │ +
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,285 +1,306 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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#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 <_d_u_n_e_/_i_s_t_l_/_c_o_m_m_o_n_/_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ -20#include <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_._h_h> │ │ │ │ -21#include <_d_u_n_e_/_i_s_t_l_/_s_c_h_w_a_r_z_._h_h> │ │ │ │ -22#include <_d_u_n_e_/_i_s_t_l_/_n_o_v_l_p_s_c_h_w_a_r_z_._h_h> │ │ │ │ -23 │ │ │ │ -24namespace _D_u_n_e{ │ │ │ │ -28 │ │ │ │ -29 // Preconditioner factory: │ │ │ │ -30 template │ │ │ │ -_3_1 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&); │ │ │ │ -32 template │ │ │ │ -_3_3 using _P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_a_c_t_o_r_y = │ │ │ │ -Singleton>>; │ │ │ │ -34 │ │ │ │ -35 // Iterative solver factory │ │ │ │ -36 template │ │ │ │ -_3_7 using _S_o_l_v_e_r_S_i_g_n_a_t_u_r_e = std::shared_ptr>(const std::shared_ptr&, const │ │ │ │ -ParameterTree&); │ │ │ │ -38 template │ │ │ │ -_3_9 using _S_o_l_v_e_r_F_a_c_t_o_r_y = │ │ │ │ -Singleton>>; │ │ │ │ -40 │ │ │ │ -41 template │ │ │ │ -_4_2 struct _O_p_e_r_a_t_o_r_T_r_a_i_t_s{ │ │ │ │ -43 private: │ │ │ │ -44 template │ │ │ │ -45 using _matrix_type = typename O::matrix_type; │ │ │ │ -46 template │ │ │ │ -47 using _comm_type = typename O::communication_type; │ │ │ │ -48 public: │ │ │ │ -_4_9 using _d_o_m_a_i_n___t_y_p_e = typename Operator::domain_type; │ │ │ │ -_5_0 using _r_a_n_g_e___t_y_p_e = typename Operator::range_type; │ │ │ │ -_5_1 using _o_p_e_r_a_t_o_r___t_y_p_e = Operator; │ │ │ │ -_5_2 using _s_o_l_v_e_r___t_y_p_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_,_ _r_a_n_g_e___t_y_p_e_>; │ │ │ │ -_5_3 using _m_a_t_r_i_x___t_y_p_e = Std::detected_or_t; │ │ │ │ -_5_4 static constexpr bool _i_s_A_s_s_e_m_b_l_e_d = !std::is_same::value; │ │ │ │ -_5_5 using _c_o_m_m___t_y_p_e = Std::detected_or_t; │ │ │ │ -_5_6 static constexpr bool _i_s_P_a_r_a_l_l_e_l = !std::is_same::value; │ │ │ │ +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 _A_m_g │ │ │ │ +17 { │ │ │ │ +18 │ │ │ │ +24 │ │ │ │ +37 template │ │ │ │ +_3_8 struct _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ +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 static const std::shared_ptr> │ │ │ │ -_5_9 _g_e_t_A_s_s_e_m_b_l_e_d_O_p_O_r_T_h_r_o_w(std::shared_ptr<_L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_d_o_m_a_i_n___t_y_p_e_, │ │ │ │ -_r_a_n_g_e___t_y_p_e_>> op){ │ │ │ │ -60 std::shared_ptr> aop │ │ │ │ -61 = std::dynamic_pointer_cast>(op); │ │ │ │ -62 if(aop) │ │ │ │ -63 return aop; │ │ │ │ -64 DUNE_THROW(_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r, "Failed to cast to AssembledLinearOperator. │ │ │ │ -Please pass in an AssembledLinearOperator."); │ │ │ │ +58 template │ │ │ │ +_5_9 struct _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 > │ │ │ │ +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 │ │ │ │ -_6_7 static const _c_o_m_m___t_y_p_e& _g_e_t_C_o_m_m_O_r_T_h_r_o_w(std:: │ │ │ │ -shared_ptr<_L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_d_o_m_a_i_n___t_y_p_e_,_ _r_a_n_g_e___t_y_p_e_>> op){ │ │ │ │ -68 std::shared_ptr _op │ │ │ │ -69 = std::dynamic_pointer_cast(op); │ │ │ │ -70 if constexpr (_i_s_P_a_r_a_l_l_e_l){ │ │ │ │ -71 return _op->getCommunication(); │ │ │ │ -72 }else{ │ │ │ │ -73 DUNE_THROW(_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r, "Could not obtain communication object from │ │ │ │ -operator. Please pass in a parallel operator."); │ │ │ │ -74 } │ │ │ │ -75 } │ │ │ │ -76 │ │ │ │ -_7_7 static std::shared_ptr> _g_e_t_S_c_a_l_a_r_P_r_o_d_u_c_t(std:: │ │ │ │ -shared_ptr<_L_i_n_e_a_r_O_p_e_r_a_t_o_r_<_d_o_m_a_i_n___t_y_p_e_,_ _r_a_n_g_e___t_y_p_e_>> op) │ │ │ │ -78 { │ │ │ │ -79 if constexpr (_i_s_P_a_r_a_l_l_e_l){ │ │ │ │ -80 return _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t_<_d_o_m_a_i_n___t_y_p_e_>(_g_e_t_C_o_m_m_O_r_T_h_r_o_w(op), op->category()); │ │ │ │ -81 }else{ │ │ │ │ -82 return std::make_shared>(); │ │ │ │ -83 } │ │ │ │ -84 } │ │ │ │ -85 }; │ │ │ │ -86 │ │ │ │ -87 // initSolverFactories differs in different compilation units, so we have it │ │ │ │ -88 // in an anonymous namespace │ │ │ │ -89 namespace { │ │ │ │ +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 { │ │ │ │ +_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 │ │ │ │ -96 template │ │ │ │ -97 int initSolverFactories(){ │ │ │ │ -98 using OpInfo = OperatorTraits; │ │ │ │ -99 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_>_:_:_i_n_s_t_a_n_c_e(); │ │ │ │ -100 addRegistryToFactory(pfac, PreconditionerTag{}); │ │ │ │ -101 auto& isfac=Dune::SolverFactory::instance(); │ │ │ │ -102 return addRegistryToFactory(isfac, SolverTag{}); │ │ │ │ -103 } │ │ │ │ -104 } // end anonymous namespace │ │ │ │ +_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 │ │ │ │ -130 template │ │ │ │ -131 std::shared_ptr<_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r> │ │ │ │ -_1_3_3 _g_e_t_S_o_l_v_e_r_F_r_o_m_F_a_c_t_o_r_y(std::shared_ptr op, const ParameterTree& │ │ │ │ -config, │ │ │ │ -134 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_:_:_d_o_m_a_i_n___t_y_p_e_,_ _t_y_p_e_n_a_m_e │ │ │ │ -_O_p_e_r_a_t_o_r_:_:_r_a_n_g_e___t_y_p_e_>> prec = nullptr) │ │ │ │ -135 { │ │ │ │ -136 if(prec){ │ │ │ │ -137 _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_>_:_:_i_n_s_t_a_n_c_e().define("__passed at runtime__", │ │ │ │ -138 [=](auto...){ │ │ │ │ -139 return prec; │ │ │ │ -140 }); │ │ │ │ -141 ParameterTree config_tmp = config; │ │ │ │ -142 config_tmp.sub("preconditioner")["type"] = std::string("__passed at │ │ │ │ -runtime__"); │ │ │ │ -143 return _S_o_l_v_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_>_:_:_i_n_s_t_a_n_c_e(). │ │ │ │ -144 create(config.get("type"),op, config_tmp); │ │ │ │ -145 } │ │ │ │ -146 return _S_o_l_v_e_r_F_a_c_t_o_r_y_<_O_p_e_r_a_t_o_r_>_:_:_i_n_s_t_a_n_c_e(). │ │ │ │ -147 create(config.get("type"),op, config); │ │ │ │ -148 } │ │ │ │ +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 _A_m_g │ │ │ │ +110 { │ │ │ │ +111 template │ │ │ │ +_1_1_2 struct _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 > │ │ │ │ +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 _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 > │ │ │ │ +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 _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 > │ │ │ │ +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 class _U_n_k_n_o_w_n_S_o_l_v_e_r_C_a_t_e_g_o_r_y : public InvalidStateException{}; │ │ │ │ -154 template │ │ │ │ -155 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r> │ │ │ │ -_1_5_7 _g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_r_o_m_F_a_c_t_o_r_y(std::shared_ptr op, │ │ │ │ -158 const ParameterTree& config){ │ │ │ │ -159 using Domain = typename Operator::domain_type; │ │ │ │ -160 using Range = typename Operator::range_type; │ │ │ │ -161 std::string prec_type = config.get("type"); │ │ │ │ -162 std::shared_ptr<_P_r_e_c_o_n_d_i_t_i_o_n_e_r> 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_>_:_: │ │ │ │ -_i_n_s_t_a_n_c_e().create(prec_type, op, config); │ │ │ │ -164 if constexpr (_O_p_e_r_a_t_o_r_T_r_a_i_t_s_<_O_p_e_r_a_t_o_r_>_:_:_i_s_P_a_r_a_l_l_e_l){ │ │ │ │ -165 using Comm = typename _O_p_e_r_a_t_o_r_T_r_a_i_t_s_<_O_p_e_r_a_t_o_r_>_:_:_c_o_m_m___t_y_p_e; │ │ │ │ -166 const Comm& comm = _O_p_e_r_a_t_o_r_T_r_a_i_t_s_<_O_p_e_r_a_t_o_r_>_:_:_g_e_t_C_o_m_m_O_r_T_h_r_o_w(op); │ │ │ │ -167 if(op->category() == _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 && 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) │ │ │ │ -168 return std::make_shared >(prec, │ │ │ │ -comm); │ │ │ │ -169 else if(op->category() == _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 && 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) │ │ │ │ -170 return std::make_shared> >(prec, comm); │ │ │ │ -171 } │ │ │ │ -172 return prec; │ │ │ │ -173 } │ │ │ │ -174 │ │ │ │ -178} // end namespace Dune │ │ │ │ +_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 _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> │ │ │ │ +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 }; │ │ │ │ +165 │ │ │ │ +166 │ │ │ │ +167#if HAVE_MPI │ │ │ │ +168 │ │ │ │ +169 template │ │ │ │ +_1_7_0 struct _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 > │ │ │ │ +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 │ │ │ │ -181#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 │ │ │ │ -_r_e_g_i_s_t_r_y_._h_h │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_F_a_c_t_o_r_y │ │ │ │ -Singleton< ParameterizedObjectFactory< SolverSignature< OP > > > SolverFactory │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:39 │ │ │ │ -_D_u_n_e_:_:_g_e_t_P_r_e_c_o_n_d_i_t_i_o_n_e_r_F_r_o_m_F_a_c_t_o_r_y │ │ │ │ -std::shared_ptr< Preconditioner< typename Operator::domain_type, typename │ │ │ │ -Operator::range_type > > getPreconditionerFromFactory(std::shared_ptr< Operator │ │ │ │ -> op, const ParameterTree &config) │ │ │ │ -Construct a Preconditioner for a given Operator. │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:157 │ │ │ │ -_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< OP > > > │ │ │ │ -PreconditionerFactory │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:33 │ │ │ │ -_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< typename OP::domain_type, typename OP:: │ │ │ │ -range_type > >(const std::shared_ptr< OP > &, const ParameterTree &) │ │ │ │ -PreconditionerSignature │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:31 │ │ │ │ -_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:133 │ │ │ │ -_D_u_n_e_:_:_S_o_l_v_e_r_S_i_g_n_a_t_u_r_e │ │ │ │ -std::shared_ptr< InverseOperator< typename OP::domain_type, typename OP:: │ │ │ │ -range_type > >(const std::shared_ptr< OP > &, const ParameterTree &) │ │ │ │ -SolverSignature │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:37 │ │ │ │ +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_:_:_c_o_n_s_t_r_u_c_t │ │ │ │ +static std::shared_ptr< T > construct(Arguments &) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ +_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_:_:_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_:_:_L_i_n_e_a_r_O_p_e_r_a_t_o_r │ │ │ │ -A linear operator. │ │ │ │ -DDeeffiinniittiioonn operators.hh:68 │ │ │ │ -_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 │ │ │ │ -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_:_:_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_:_:_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_:_:_o_v_e_r_l_a_p_p_i_n_g │ │ │ │ -@ overlapping │ │ │ │ -Category for overlapping solvers. │ │ │ │ -DDeeffiinniittiioonn solvercategory.hh:29 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:42 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_i_s_P_a_r_a_l_l_e_l │ │ │ │ -static constexpr bool isParallel │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:56 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -Std::detected_or_t< int, _matrix_type, Operator > matrix_type │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:53 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_o_p_e_r_a_t_o_r___t_y_p_e │ │ │ │ -Operator operator_type │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:51 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -typename Operator::domain_type domain_type │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:49 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_s_o_l_v_e_r___t_y_p_e │ │ │ │ -InverseOperator< domain_type, range_type > solver_type │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:52 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -typename Operator::range_type range_type │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:50 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_i_s_A_s_s_e_m_b_l_e_d │ │ │ │ -static constexpr bool isAssembled │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:54 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_g_e_t_C_o_m_m_O_r_T_h_r_o_w │ │ │ │ -static const comm_type & getCommOrThrow(std::shared_ptr< LinearOperator< │ │ │ │ -domain_type, range_type > > op) │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:67 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_c_o_m_m___t_y_p_e │ │ │ │ -Std::detected_or_t< int, _comm_type, Operator > comm_type │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:55 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_g_e_t_A_s_s_e_m_b_l_e_d_O_p_O_r_T_h_r_o_w │ │ │ │ -static const std::shared_ptr< AssembledLinearOperator< matrix_type, │ │ │ │ -domain_type, range_type > > getAssembledOpOrThrow(std::shared_ptr< │ │ │ │ -LinearOperator< domain_type, range_type > > op) │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:59 │ │ │ │ -_D_u_n_e_:_:_O_p_e_r_a_t_o_r_T_r_a_i_t_s_:_:_g_e_t_S_c_a_l_a_r_P_r_o_d_u_c_t │ │ │ │ -static std::shared_ptr< ScalarProduct< domain_type > > getScalarProduct(std:: │ │ │ │ -shared_ptr< LinearOperator< domain_type, range_type > > op) │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:77 │ │ │ │ -_D_u_n_e_:_:_U_n_k_n_o_w_n_S_o_l_v_e_r_C_a_t_e_g_o_r_y │ │ │ │ -DDeeffiinniittiioonn solverfactory.hh:150 │ │ │ │ -_D_u_n_e_:_:_N_o_A_s_s_e_m_b_l_e_d_O_p_e_r_a_t_o_r │ │ │ │ -This exception is thrown if the requested solver or preconditioner needs an │ │ │ │ -assembled matrix. │ │ │ │ -DDeeffiinniittiioonn solverregistry.hh:31 │ │ │ │ +_D_u_n_e_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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_:_:_A_m_g_:_:_C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s │ │ │ │ +Traits class for generically constructing non default constructable types. │ │ │ │ +DDeeffiinniittiioonn construction.hh:39 │ │ │ │ +_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:135 │ │ │ │ +_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,40 +66,63 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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...
class  Dune::InvalidSolverCategory
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::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,18 +1,47 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_._._. │ │ │ │ - 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 │ │ │ │ +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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,84 +66,751 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ -
17
│ │ │ -
│ │ │ - │ │ │ -
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 }
│ │ │ -
│ │ │ -
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 };
│ │ │ -
│ │ │ -
53
│ │ │ -
54 class InvalidSolverCategory : public InvalidStateException{};
│ │ │ -
55
│ │ │ -
57
│ │ │ -
58} // end namespace
│ │ │ -
59
│ │ │ -
60#endif
│ │ │ +
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 {
│ │ │ +
30
│ │ │ +
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
│ │ │ +
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<std::size_t>(minRowSize_, row_.size());
│ │ │ +
543 maxRowSize_=std::max<std::size_t>(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.
│ │ │ +
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.
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ +
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
│ │ │ +
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:572
│ │ │ +
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
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ +
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:604
│ │ │ +
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,87 +1,828 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ -17 │ │ │ │ -_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, │ │ │ │ -_2_9 _o_v_e_r_l_a_p_p_i_n_g │ │ │ │ -30 }; │ │ │ │ -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 _A_m_g │ │ │ │ +19 { │ │ │ │ +30 │ │ │ │ +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 │ │ │ │ -57 │ │ │ │ -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 │ │ │ │ +_1_8_7 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 │ │ │ │ +_1_9_6 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 GalerkinProduct::buildOverlapVertices(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& _i_n_d_e_x) │ │ │ │ +553 { │ │ │ │ +554 row_.insert(_i_n_d_e_x); │ │ │ │ +555#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ +556 diagonalInserted = diagonalInserted || row_.index()==_i_n_d_e_x; │ │ │ │ +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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,70 +66,71 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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/istl/solverregistry.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::InverseOperator< X, Y >
 Abstract base class for all solvers. More...
class  Dune::IterativeSolver< X, Y >
 Base class for all implementations of iterative solvers. More...
class  Dune::IterativeSolver< X, Y >::Iteration< CountType >
 Class for controlling iterative methods. More...
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::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::SolverHelper< ISTLLinearSolver, BCRSMatrix >::Implementation< true, Dummy >
 Implementation that works together with direct ISTL solvers, e.g. Dune::SuperLU or Dune::UMFPack. More...
class  Dune::Amg::AMG< M, X, S, PI, A >
 Parallel algebraic multigrid based on agglomeration. More...
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, SolverType >
struct  Dune::Amg::DirectSolverSelector< Matrix, Vector >::Solver< M, superlu >
struct  Dune::AMGCreator
struct  Dune::AMGCreator::isValidMatrix< class >
struct  Dune::AMGCreator::isValidMatrix< BCRSMatrix< FieldMatrix< T, n, m >, A > >
│ │ │ │ │ │ │ │ │ + │ │ │ +

│ │ │ 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,55 +1,52 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 <_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 │ │ │ │ +#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_:_:_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_._._. │ │ │ │ - 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_._._. │ │ │ │ - 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_._._. │ │ │ │ + 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_._._. │ │ │ │ +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_ _> │ │ │ │ +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_ _> │ │ │ │ +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_M_a_t_r_i_x_<_ _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_M_a_t_r_i_x_<_ _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 │ │ │ │ + _>_ _> │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,500 +66,1276 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ - │ │ │ -
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;
│ │ │ +
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>
│ │ │ + │ │ │ + │ │ │ +
20#include <dune/common/typetraits.hh>
│ │ │ +
21#include <dune/common/exceptions.hh>
│ │ │ +
22#include <dune/common/scalarvectorview.hh>
│ │ │ +
23#include <dune/common/scalarmatrixview.hh>
│ │ │ +
24#include <dune/common/parametertree.hh>
│ │ │ +
25
│ │ │ +
26namespace Dune
│ │ │ +
27{
│ │ │ +
28 namespace Amg
│ │ │ +
29 {
│ │ │ +
35
│ │ │ +
41
│ │ │ +
46
│ │ │ +
47 template<class M, class X, class S, class P, class K, class A>
│ │ │ +
48 class KAMG;
│ │ │ +
49
│ │ │ +
50 template<class T>
│ │ │ +
51 class KAmgTwoGrid;
│ │ │ +
52
│ │ │ +
63 template<class M, class X, class S, class PI=SequentialInformation,
│ │ │ +
64 class A=std::allocator<X> >
│ │ │ +
│ │ │ +
65 class AMG : public Preconditioner<X,X>
│ │ │ +
66 {
│ │ │ +
67 template<class M1, class X1, class S1, class P1, class K1, class A1>
│ │ │ +
68 friend class KAMG;
│ │ │ +
69
│ │ │ +
70 friend class KAmgTwoGrid<AMG>;
│ │ │ +
71
│ │ │ +
72 public:
│ │ │ +
74 typedef M Operator;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
86
│ │ │ +
88 typedef X Domain;
│ │ │ +
90 typedef X Range;
│ │ │ + │ │ │ +
98 typedef S Smoother;
│ │ │ +
99
│ │ │ + │ │ │ +
102
│ │ │ +
112 AMG(OperatorHierarchy& matrices, CoarseSolver& coarseSolver,
│ │ │ +
113 const SmootherArgs& smootherArgs, const Parameters& parms);
│ │ │
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;
│ │ │ - │ │ │ -
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 void apply (X& x, X& b, double reduction, InverseOperatorResult& res) override
│ │ │ -
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)));
│ │ │ -
484 _res.iterations = _i;
│ │ │ -
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 }
│ │ │ -
│ │ │ -
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.
│ │ │ +
126 template<class C>
│ │ │ +
127 AMG(const Operator& fineOperator, const C& criterion,
│ │ │ +
128 const SmootherArgs& smootherArgs=SmootherArgs(),
│ │ │ + │ │ │ +
130
│ │ │ +
181 AMG(std::shared_ptr<const Operator> fineOperator, const ParameterTree& configuration, const ParallelInformation& pinfo=ParallelInformation());
│ │ │ +
182
│ │ │ +
186 AMG(const AMG& amg);
│ │ │ +
187
│ │ │ +
189 void pre(Domain& x, Range& b);
│ │ │ +
190
│ │ │ +
192 void apply(Domain& v, const Range& d);
│ │ │ +
193
│ │ │ +
│ │ │ + │ │ │ +
196 {
│ │ │ +
197 return category_;
│ │ │ +
198 }
│ │ │ +
│ │ │ +
199
│ │ │ +
201 void post(Domain& x);
│ │ │ +
202
│ │ │ +
207 template<class A1>
│ │ │ +
208 void getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont);
│ │ │ +
209
│ │ │ +
210 std::size_t levels();
│ │ │ +
211
│ │ │ +
212 std::size_t maxlevels();
│ │ │ +
213
│ │ │ +
│ │ │ + │ │ │ +
223 {
│ │ │ +
224 matrices_->recalculateGalerkin(NegateSet<typename PI::OwnerSet>());
│ │ │ +
225 }
│ │ │ +
│ │ │ +
226
│ │ │ + │ │ │ +
232
│ │ │ +
233 private:
│ │ │ +
234 /*
│ │ │ +
235 * @brief Helper function to create hierarchies with parameter tree.
│ │ │ +
236 *
│ │ │ +
237 * Will create the coarsen criterion with the norm and create the
│ │ │ +
238 * Hierarchies
│ │ │ +
239 * \tparam Norm Type of the norm to use.
│ │ │ +
240 */
│ │ │ +
241 template<class Norm>
│ │ │ +
242 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ +
243 const PI& pinfo, const Norm&,
│ │ │ +
244 const ParameterTree& configuration,
│ │ │ +
245 std::true_type compiles = std::true_type());
│ │ │ +
246 template<class Norm>
│ │ │ +
247 void createCriterionAndHierarchies(std::shared_ptr<const Operator> matrixptr,
│ │ │ +
248 const PI& pinfo, const Norm&,
│ │ │ +
249 const ParameterTree& configuration,
│ │ │ +
250 std::false_type);
│ │ │ +
255 template<class C>
│ │ │ +
256 void createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr,
│ │ │ +
257 const PI& pinfo, const ParameterTree& configuration);
│ │ │ +
264 template<class C>
│ │ │ +
265 void createHierarchies(C& criterion,
│ │ │ +
266 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ +
267 const PI& pinfo);
│ │ │ +
274 struct LevelContext
│ │ │ +
275 {
│ │ │ + │ │ │ + │ │ │ +
284 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix;
│ │ │ + │ │ │ +
292 typename OperatorHierarchy::RedistributeInfoList::const_iterator redist;
│ │ │ +
296 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates;
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
312 std::size_t level;
│ │ │ +
313 };
│ │ │ +
314
│ │ │ +
315
│ │ │ +
320 void mgc(LevelContext& levelContext);
│ │ │ +
321
│ │ │ +
322 void additiveMgc();
│ │ │ +
323
│ │ │ +
330 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel);
│ │ │ +
331
│ │ │ +
336 bool moveToCoarseLevel(LevelContext& levelContext);
│ │ │ +
337
│ │ │ +
342 void initIteratorsWithFineLevel(LevelContext& levelContext);
│ │ │ +
343
│ │ │ +
345 std::shared_ptr<OperatorHierarchy> matrices_;
│ │ │ +
347 SmootherArgs smootherArgs_;
│ │ │ +
349 std::shared_ptr<Hierarchy<Smoother,A> > smoothers_;
│ │ │ +
351 std::shared_ptr<CoarseSolver> solver_;
│ │ │ +
353 std::shared_ptr<Hierarchy<Range,A>> rhs_;
│ │ │ +
355 std::shared_ptr<Hierarchy<Domain,A>> lhs_;
│ │ │ +
357 std::shared_ptr<Hierarchy<Domain,A>> update_;
│ │ │ +
359 using ScalarProduct = Dune::ScalarProduct<X>;
│ │ │ +
361 std::shared_ptr<ScalarProduct> scalarProduct_;
│ │ │ +
363 std::size_t gamma_;
│ │ │ +
365 std::size_t preSteps_;
│ │ │ +
367 std::size_t postSteps_;
│ │ │ +
368 bool buildHierarchy_;
│ │ │ +
369 bool additive;
│ │ │ +
370 bool coarsesolverconverged;
│ │ │ +
371 std::shared_ptr<Smoother> coarseSmoother_;
│ │ │ +
373 SolverCategory::Category category_;
│ │ │ +
375 std::size_t verbosity_;
│ │ │ +
376
│ │ │ +
377 struct ToLower
│ │ │ +
378 {
│ │ │ +
│ │ │ +
379 std::string operator()(const std::string& str)
│ │ │ +
380 {
│ │ │ +
381 std::stringstream retval;
│ │ │ +
382 std::ostream_iterator<char> out(retval);
│ │ │ +
383 std::transform(str.begin(), str.end(), out,
│ │ │ +
384 [](char c){
│ │ │ +
385 return std::tolower(c, std::locale::classic());
│ │ │ +
386 });
│ │ │ +
387 return retval.str();
│ │ │ +
388 }
│ │ │ +
│ │ │ +
389 };
│ │ │ +
390 };
│ │ │ +
│ │ │ +
391
│ │ │ +
392 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ +
393 inline AMG<M,X,S,PI,A>::AMG(const AMG& amg)
│ │ │ +
394 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_),
│ │ │ +
395 smoothers_(amg.smoothers_), solver_(amg.solver_),
│ │ │ +
396 rhs_(), lhs_(), update_(),
│ │ │ +
397 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_),
│ │ │ +
398 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_),
│ │ │ +
399 buildHierarchy_(amg.buildHierarchy_),
│ │ │ +
400 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged),
│ │ │ +
401 coarseSmoother_(amg.coarseSmoother_),
│ │ │ +
402 category_(amg.category_),
│ │ │ +
403 verbosity_(amg.verbosity_)
│ │ │ +
404 {}
│ │ │ +
│ │ │ +
405
│ │ │ +
406 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
408 const SmootherArgs& smootherArgs,
│ │ │ +
409 const Parameters& parms)
│ │ │ +
410 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_(smootherArgs),
│ │ │ +
411 smoothers_(new Hierarchy<Smoother,A>), solver_(&coarseSolver),
│ │ │ +
412 rhs_(), lhs_(), update_(), scalarProduct_(0),
│ │ │ +
413 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()),
│ │ │ +
414 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false),
│ │ │ +
415 additive(parms.getAdditive()), coarsesolverconverged(true),
│ │ │ +
416 coarseSmoother_(),
│ │ │ +
417// #warning should category be retrieved from matrices?
│ │ │ +
418 category_(SolverCategory::category(*smoothers_->coarsest())),
│ │ │ +
419 verbosity_(parms.debugLevel())
│ │ │ +
420 {
│ │ │ +
421 assert(matrices_->isBuilt());
│ │ │ +
422
│ │ │ +
423 // build the necessary smoother hierarchies
│ │ │ +
424 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ +
425 }
│ │ │ +
│ │ │ +
426
│ │ │ +
427 template<class M, class X, class S, class PI, class A>
│ │ │ +
428 template<class C>
│ │ │ +
│ │ │ + │ │ │ +
430 const C& criterion,
│ │ │ +
431 const SmootherArgs& smootherArgs,
│ │ │ +
432 const PI& pinfo)
│ │ │ +
433 : smootherArgs_(smootherArgs),
│ │ │ +
434 smoothers_(new Hierarchy<Smoother,A>), solver_(),
│ │ │ +
435 rhs_(), lhs_(), update_(), scalarProduct_(),
│ │ │ +
436 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()),
│ │ │ +
437 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true),
│ │ │ +
438 additive(criterion.getAdditive()), coarsesolverconverged(true),
│ │ │ +
439 coarseSmoother_(),
│ │ │ +
440 category_(SolverCategory::category(pinfo)),
│ │ │ +
441 verbosity_(criterion.debugLevel())
│ │ │ +
442 {
│ │ │ + │ │ │ +
444 DUNE_THROW(InvalidSolverCategory, "Matrix and Communication must have the same SolverCategory!");
│ │ │ +
445 // TODO: reestablish compile time checks.
│ │ │ +
446 //static_assert(static_cast<int>(PI::category)==static_cast<int>(S::category),
│ │ │ +
447 // "Matrix and Solver must match in terms of category!");
│ │ │ +
448 auto matrixptr = stackobject_to_shared_ptr(matrix);
│ │ │ +
449 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ +
450 }
│ │ │ +
│ │ │ +
451
│ │ │ +
452 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ +
453 AMG<M,X,S,PI,A>::AMG(std::shared_ptr<const Operator> matrixptr,
│ │ │ +
454 const ParameterTree& configuration,
│ │ │ +
455 const ParallelInformation& pinfo) :
│ │ │ +
456 smoothers_(new Hierarchy<Smoother,A>),
│ │ │ +
457 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_(true),
│ │ │ +
458 coarsesolverconverged(true), coarseSmoother_(),
│ │ │ +
459 category_(SolverCategory::category(pinfo))
│ │ │ +
460 {
│ │ │ +
461
│ │ │ +
462 if (configuration.hasKey ("smootherIterations"))
│ │ │ +
463 smootherArgs_.iterations = configuration.get<int>("smootherIterations");
│ │ │ +
464
│ │ │ +
465 if (configuration.hasKey ("smootherRelaxation"))
│ │ │ +
466 smootherArgs_.relaxationFactor = configuration.get<typename SmootherArgs::RelaxationFactor>("smootherRelaxation");
│ │ │ +
467
│ │ │ +
468 auto normName = ToLower()(configuration.get("strengthMeasure", "diagonal"));
│ │ │ +
469 auto index = configuration.get<int>("diagonalRowIndex", 0);
│ │ │ +
470
│ │ │ +
471 if ( normName == "diagonal")
│ │ │ +
472 {
│ │ │ +
473 using field_type = typename M::field_type;
│ │ │ +
474 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ +
475 std::is_convertible<field_type, real_type> compiles;
│ │ │ +
476
│ │ │ +
477 switch (index)
│ │ │ +
478 {
│ │ │ +
479 case 0:
│ │ │ +
480 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<0>(), configuration, compiles);
│ │ │ +
481 break;
│ │ │ +
482 case 1:
│ │ │ +
483 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<1>(), configuration, compiles);
│ │ │ +
484 break;
│ │ │ +
485 case 2:
│ │ │ +
486 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<2>(), configuration, compiles);
│ │ │ +
487 break;
│ │ │ +
488 case 3:
│ │ │ +
489 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<3>(), configuration, compiles);
│ │ │ +
490 break;
│ │ │ +
491 case 4:
│ │ │ +
492 createCriterionAndHierarchies(matrixptr, pinfo, Diagonal<4>(), configuration, compiles);
│ │ │ +
493 break;
│ │ │ +
494 default:
│ │ │ +
495 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not supported.");
│ │ │ +
496 }
│ │ │ +
497 }
│ │ │ +
498 else if (normName == "rowsum")
│ │ │ +
499 createCriterionAndHierarchies(matrixptr, pinfo, RowSum(), configuration);
│ │ │ +
500 else if (normName == "frobenius")
│ │ │ +
501 createCriterionAndHierarchies(matrixptr, pinfo, FrobeniusNorm(), configuration);
│ │ │ +
502 else if (normName == "one")
│ │ │ +
503 createCriterionAndHierarchies(matrixptr, pinfo, AlwaysOneNorm(), configuration);
│ │ │ +
504 else
│ │ │ +
505 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure "<<normName<<" is not supported by AMG");
│ │ │ +
506 }
│ │ │ +
│ │ │ +
507
│ │ │ +
508 template<class M, class X, class S, class PI, class A>
│ │ │ +
509 template<class Norm>
│ │ │ +
510 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)
│ │ │ +
511 {
│ │ │ +
512 DUNE_THROW(InvalidStateException, "Strength of connection measure does not support this type ("
│ │ │ +
513 << className<typename M::field_type>() << ") as it is lacking a conversion to"
│ │ │ +
514 << className<typename FieldTraits<typename M::field_type>::real_type>() << ".");
│ │ │ +
515 }
│ │ │ +
516
│ │ │ +
517 template<class M, class X, class S, class PI, class A>
│ │ │ +
518 template<class Norm>
│ │ │ +
519 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)
│ │ │ +
520 {
│ │ │ +
521 if (configuration.get<bool>("criterionSymmetric", true))
│ │ │ +
522 {
│ │ │ +
523 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ + │ │ │ +
525 Criterion criterion;
│ │ │ +
526 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ +
527 }
│ │ │ +
528 else
│ │ │ +
529 {
│ │ │ +
530 using Criterion = Dune::Amg::CoarsenCriterion<
│ │ │ + │ │ │ +
532 Criterion criterion;
│ │ │ +
533 createHierarchies(criterion, matrixptr, pinfo, configuration);
│ │ │ +
534 }
│ │ │ +
535 }
│ │ │ +
536
│ │ │ +
537 template<class M, class X, class S, class PI, class A>
│ │ │ +
538 template<class C>
│ │ │ +
539 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion, std::shared_ptr<const Operator> matrixptr, const PI& pinfo, const ParameterTree& configuration)
│ │ │ +
540 {
│ │ │ +
541 if (configuration.hasKey ("maxLevel"))
│ │ │ +
542 criterion.setMaxLevel(configuration.get<int>("maxLevel"));
│ │ │ +
543
│ │ │ +
544 if (configuration.hasKey ("minCoarseningRate"))
│ │ │ +
545 criterion.setMinCoarsenRate(configuration.get<int>("minCoarseningRate"));
│ │ │ +
546
│ │ │ +
547 if (configuration.hasKey ("coarsenTarget"))
│ │ │ +
548 criterion.setCoarsenTarget (configuration.get<int>("coarsenTarget"));
│ │ │ +
549
│ │ │ +
550 if (configuration.hasKey ("accumulationMode"))
│ │ │ +
551 {
│ │ │ +
552 std::string mode = ToLower()(configuration.get<std::string>("accumulationMode"));
│ │ │ +
553 if ( mode == "none")
│ │ │ +
554 criterion.setAccumulate(AccumulationMode::noAccu);
│ │ │ +
555 else if ( mode == "atonce" )
│ │ │ +
556 criterion.setAccumulate(AccumulationMode::atOnceAccu);
│ │ │ +
557 else if ( mode == "successive")
│ │ │ +
558 criterion.setCoarsenTarget (AccumulationMode::successiveAccu);
│ │ │ +
559 else
│ │ │ +
560 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ +
561 << mode <<".");
│ │ │ +
562 }
│ │ │ +
563
│ │ │ +
564 if (configuration.hasKey ("prolongationDampingFactor"))
│ │ │ +
565 criterion.setProlongationDampingFactor (configuration.get<double>("prolongationDampingFactor"));
│ │ │ +
566
│ │ │ +
567 if (configuration.hasKey("defaultAggregationSizeMode"))
│ │ │ +
568 {
│ │ │ +
569 auto mode = ToLower()(configuration.get<std::string>("defaultAggregationSizeMode"));
│ │ │ +
570 auto dim = configuration.get<std::size_t>("defaultAggregationDimension");
│ │ │ +
571 std::size_t maxDistance = 2;
│ │ │ +
572 if (configuration.hasKey("MaxAggregateDistance"))
│ │ │ +
573 maxDistance = configuration.get<std::size_t>("maxAggregateDistance");
│ │ │ +
574 if (mode == "isotropic")
│ │ │ +
575 criterion.setDefaultValuesIsotropic(dim, maxDistance);
│ │ │ +
576 else if(mode == "anisotropic")
│ │ │ +
577 criterion.setDefaultValuesAnisotropic(dim, maxDistance);
│ │ │ +
578 else
│ │ │ +
579 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode does not allow value "
│ │ │ +
580 << mode <<".");
│ │ │ +
581 }
│ │ │ +
582
│ │ │ +
583 if (configuration.hasKey("maxAggregateDistance"))
│ │ │ +
584 criterion.setMaxDistance(configuration.get<std::size_t>("maxAggregateDistance"));
│ │ │ +
585
│ │ │ +
586 if (configuration.hasKey("minAggregateSize"))
│ │ │ +
587 criterion.setMinAggregateSize(configuration.get<std::size_t>("minAggregateSize"));
│ │ │ +
588
│ │ │ +
589 if (configuration.hasKey("maxAggregateSize"))
│ │ │ +
590 criterion.setMaxAggregateSize(configuration.get<std::size_t>("maxAggregateSize"));
│ │ │ +
591
│ │ │ +
592 if (configuration.hasKey("maxAggregateConnectivity"))
│ │ │ +
593 criterion.setMaxConnectivity(configuration.get<std::size_t>("maxAggregateConnectivity"));
│ │ │ +
594
│ │ │ +
595 if (configuration.hasKey ("alpha"))
│ │ │ +
596 criterion.setAlpha (configuration.get<double> ("alpha"));
│ │ │ +
597
│ │ │ +
598 if (configuration.hasKey ("beta"))
│ │ │ +
599 criterion.setBeta (configuration.get<double> ("beta"));
│ │ │ +
600
│ │ │ +
601 if (configuration.hasKey ("gamma"))
│ │ │ +
602 criterion.setGamma (configuration.get<std::size_t> ("gamma"));
│ │ │ +
603 gamma_ = criterion.getGamma();
│ │ │ +
604
│ │ │ +
605 if (configuration.hasKey ("additive"))
│ │ │ +
606 criterion.setAdditive (configuration.get<bool>("additive"));
│ │ │ +
607 additive = criterion.getAdditive();
│ │ │ +
608
│ │ │ +
609 if (configuration.hasKey ("preSteps"))
│ │ │ +
610 criterion.setNoPreSmoothSteps (configuration.get<std::size_t> ("preSteps"));
│ │ │ +
611 preSteps_ = criterion.getNoPreSmoothSteps ();
│ │ │ +
612
│ │ │ +
613 if (configuration.hasKey ("postSteps"))
│ │ │ +
614 criterion.setNoPostSmoothSteps (configuration.get<std::size_t> ("postSteps"));
│ │ │ +
615 postSteps_ = criterion.getNoPostSmoothSteps ();
│ │ │ +
616
│ │ │ +
617 verbosity_ = configuration.get("verbosity", 0);
│ │ │ +
618 criterion.setDebugLevel (verbosity_);
│ │ │ +
619
│ │ │ +
620 createHierarchies(criterion, matrixptr, pinfo);
│ │ │ +
621 }
│ │ │ +
622
│ │ │ +
623 template <class Matrix,
│ │ │ +
624 class Vector>
│ │ │ +
│ │ │ + │ │ │ +
626 {
│ │ │ +
627 typedef typename Matrix :: field_type field_type;
│ │ │ + │ │ │ +
629
│ │ │ +
630 static constexpr SolverType solver =
│ │ │ +
631#if DISABLE_AMG_DIRECTSOLVER
│ │ │ +
632 none;
│ │ │ +
633#elif HAVE_SUITESPARSE_UMFPACK
│ │ │ + │ │ │ +
635#elif HAVE_SUPERLU
│ │ │ +
636 superlu ;
│ │ │ +
637#else
│ │ │ +
638 none;
│ │ │ +
639#endif
│ │ │ +
640
│ │ │ +
641 template <class M, SolverType>
│ │ │ +
│ │ │ +
642 struct Solver
│ │ │ +
643 {
│ │ │ + │ │ │ +
│ │ │ +
645 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ +
646 {
│ │ │ +
647 DUNE_THROW(NotImplemented,"DirectSolver not selected");
│ │ │ +
648 return nullptr;
│ │ │ +
649 }
│ │ │ +
│ │ │ +
650 static std::string name () { return "None"; }
│ │ │ +
651 };
│ │ │ +
│ │ │ +
652#if HAVE_SUITESPARSE_UMFPACK
│ │ │ +
653 template <class M>
│ │ │ +
654 struct Solver< M, umfpack >
│ │ │ +
655 {
│ │ │ +
656 typedef UMFPack< M > type;
│ │ │ +
657 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ +
658 {
│ │ │ +
659 return new type(mat, verbose, reusevector );
│ │ │ +
660 }
│ │ │ +
661 static std::string name () { return "UMFPack"; }
│ │ │ +
662 };
│ │ │ +
663#endif
│ │ │ +
664#if HAVE_SUPERLU
│ │ │ +
665 template <class M>
│ │ │ +
│ │ │ +
666 struct Solver< M, superlu >
│ │ │ +
667 {
│ │ │ + │ │ │ +
│ │ │ +
669 static type* create(const M& mat, bool verbose, bool reusevector )
│ │ │ +
670 {
│ │ │ +
671 return new type(mat, verbose, reusevector );
│ │ │ +
672 }
│ │ │ +
│ │ │ +
673 static std::string name () { return "SuperLU"; }
│ │ │ +
674 };
│ │ │ +
│ │ │ +
675#endif
│ │ │ +
676
│ │ │ +
677 // define direct solver type to be used
│ │ │ + │ │ │ +
679 typedef typename SelectedSolver :: type DirectSolver;
│ │ │ +
680 static constexpr bool isDirectSolver = solver != none;
│ │ │ +
681 static std::string name() { return SelectedSolver :: name (); }
│ │ │ +
│ │ │ +
682 static DirectSolver* create(const Matrix& mat, bool verbose, bool reusevector )
│ │ │ +
683 {
│ │ │ +
684 return SelectedSolver :: create( mat, verbose, reusevector );
│ │ │ +
685 }
│ │ │ +
│ │ │ +
686 };
│ │ │ +
│ │ │ +
687
│ │ │ +
688 template<class M, class X, class S, class PI, class A>
│ │ │ +
689 template<class C>
│ │ │ +
690 void AMG<M,X,S,PI,A>::createHierarchies(C& criterion,
│ │ │ +
691 const std::shared_ptr<const Operator>& matrixptr,
│ │ │ +
692 const PI& pinfo)
│ │ │ +
693 {
│ │ │ +
694 Timer watch;
│ │ │ +
695 matrices_ = std::make_shared<OperatorHierarchy>(
│ │ │ +
696 std::const_pointer_cast<Operator>(matrixptr),
│ │ │ +
697 stackobject_to_shared_ptr(const_cast<PI&>(pinfo)));
│ │ │ +
698
│ │ │ +
699 matrices_->template build<NegateSet<typename PI::OwnerSet> >(criterion);
│ │ │ +
700
│ │ │ +
701 // build the necessary smoother hierarchies
│ │ │ +
702 matrices_->coarsenSmoother(*smoothers_, smootherArgs_);
│ │ │ +
703
│ │ │ +
704 // test whether we should solve on the coarse level. That is the case if we
│ │ │ +
705 // have that level and if there was a redistribution on this level then our
│ │ │ +
706 // communicator has to be valid (size()>0) as the smoother might try to communicate
│ │ │ +
707 // in the constructor.
│ │ │ +
708 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels()
│ │ │ +
709 && ( ! matrices_->redistributeInformation().back().isSetup() ||
│ │ │ +
710 matrices_->parallelInformation().coarsest().getRedistributed().communicator().size() ) )
│ │ │ +
711 {
│ │ │ +
712 // We have the carsest level. Create the coarse Solver
│ │ │ +
713 SmootherArgs sargs(smootherArgs_);
│ │ │ +
714 sargs.iterations = 1;
│ │ │ +
715
│ │ │ + │ │ │ +
717 cargs.setArgs(sargs);
│ │ │ +
718 if(matrices_->redistributeInformation().back().isSetup()) {
│ │ │ +
719 // Solve on the redistributed partitioning
│ │ │ +
720 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat());
│ │ │ +
721 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed());
│ │ │ +
722 }else{
│ │ │ +
723 cargs.setMatrix(matrices_->matrices().coarsest()->getmat());
│ │ │ +
724 cargs.setComm(*matrices_->parallelInformation().coarsest());
│ │ │ +
725 }
│ │ │ +
726
│ │ │ +
727 coarseSmoother_ = ConstructionTraits<Smoother>::construct(cargs);
│ │ │ +
728 scalarProduct_ = createScalarProduct<X>(cargs.getComm(),category());
│ │ │ +
729
│ │ │ + │ │ │ +
731
│ │ │ +
732 // Use superlu if we are purely sequential or with only one processor on the coarsest level.
│ │ │ +
733 if( SolverSelector::isDirectSolver &&
│ │ │ +
734 (std::is_same<ParallelInformation,SequentialInformation>::value // sequential mode
│ │ │ +
735 || matrices_->parallelInformation().coarsest()->communicator().size()==1 //parallel mode and only one processor
│ │ │ +
736 || (matrices_->parallelInformation().coarsest().isRedistributed()
│ │ │ +
737 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()==1
│ │ │ +
738 && matrices_->parallelInformation().coarsest().getRedistributed().communicator().size()>0) )
│ │ │ +
739 )
│ │ │ +
740 { // redistribute and 1 proc
│ │ │ +
741 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ +
742 {
│ │ │ +
743 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ +
744 {
│ │ │ +
745 // We are still participating on this level
│ │ │ +
746 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest().getRedistributed().getmat(), false, false));
│ │ │ +
747 }
│ │ │ +
748 else
│ │ │ +
749 solver_.reset();
│ │ │ +
750 }
│ │ │ +
751 else
│ │ │ +
752 {
│ │ │ +
753 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()->getmat(), false, false));
│ │ │ +
754 }
│ │ │ +
755 if(verbosity_>0 && matrices_->parallelInformation().coarsest()->communicator().rank()==0)
│ │ │ +
756 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << ")" << std::endl;
│ │ │ +
757 }
│ │ │ +
758 else
│ │ │ +
759 {
│ │ │ +
760 if(matrices_->parallelInformation().coarsest().isRedistributed())
│ │ │ +
761 {
│ │ │ +
762 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0)
│ │ │ +
763 // We are still participating on this level
│ │ │ +
764
│ │ │ +
765 // we have to allocate these types using the rebound allocator
│ │ │ +
766 // in order to ensure that we fulfill the alignment requirements
│ │ │ +
767 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()),
│ │ │ +
768 *scalarProduct_,
│ │ │ +
769 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ +
770 else
│ │ │ +
771 solver_.reset();
│ │ │ +
772 }else
│ │ │ +
773 {
│ │ │ +
774 solver_.reset(new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ +
775 *scalarProduct_,
│ │ │ +
776 *coarseSmoother_, 1E-2, 1000, 0));
│ │ │ +
777 // // we have to allocate these types using the rebound allocator
│ │ │ +
778 // // in order to ensure that we fulfill the alignment requirements
│ │ │ +
779 // using Alloc = typename std::allocator_traits<A>::template rebind_alloc<BiCGSTABSolver<X>>;
│ │ │ +
780 // Alloc alloc;
│ │ │ +
781 // auto p = alloc.allocate(1);
│ │ │ +
782 // std::allocator_traits<Alloc>::construct(alloc, p,
│ │ │ +
783 // const_cast<M&>(*matrices_->matrices().coarsest()),
│ │ │ +
784 // *scalarProduct_,
│ │ │ +
785 // *coarseSmoother_, 1E-2, 1000, 0);
│ │ │ +
786 // solver_.reset(p,[](BiCGSTABSolver<X>* p){
│ │ │ +
787 // Alloc alloc;
│ │ │ +
788 // std::allocator_traits<Alloc>::destroy(alloc, p);
│ │ │ +
789 // alloc.deallocate(p,1);
│ │ │ +
790 // });
│ │ │ +
791 }
│ │ │ +
792 }
│ │ │ +
793 }
│ │ │ +
794
│ │ │ +
795 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator().rank()==0)
│ │ │ +
796 std::cout<<"Building hierarchy of "<<matrices_->maxlevels()<<" levels "
│ │ │ +
797 <<"(including coarse solver) took "<<watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
798 }
│ │ │ +
799
│ │ │ +
800
│ │ │ +
801 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
803 {
│ │ │ +
804 // Detect Matrix rows where all offdiagonal entries are
│ │ │ +
805 // zero and set x such that A_dd*x_d=b_d
│ │ │ +
806 // Thus users can be more careless when setting up their linear
│ │ │ +
807 // systems.
│ │ │ +
808 typedef typename M::matrix_type Matrix;
│ │ │ +
809 typedef typename Matrix::ConstRowIterator RowIter;
│ │ │ +
810 typedef typename Matrix::ConstColIterator ColIter;
│ │ │ +
811 typedef typename Matrix::block_type Block;
│ │ │ +
812 Block zero;
│ │ │ +
813 zero=typename Matrix::field_type();
│ │ │ +
814
│ │ │ +
815 const Matrix& mat=matrices_->matrices().finest()->getmat();
│ │ │ +
816 for(RowIter row=mat.begin(); row!=mat.end(); ++row) {
│ │ │ +
817 bool isDirichlet = true;
│ │ │ +
818 bool hasDiagonal = false;
│ │ │ +
819 Block diagonal{};
│ │ │ +
820 for(ColIter col=row->begin(); col!=row->end(); ++col) {
│ │ │ +
821 if(row.index()==col.index()) {
│ │ │ +
822 diagonal = *col;
│ │ │ +
823 hasDiagonal = true;
│ │ │ +
824 }else{
│ │ │ +
825 if(*col!=zero)
│ │ │ +
826 isDirichlet = false;
│ │ │ +
827 }
│ │ │ +
828 }
│ │ │ +
829 if(isDirichlet && hasDiagonal)
│ │ │ +
830 {
│ │ │ +
831 auto&& xEntry = Impl::asVector(x[row.index()]);
│ │ │ +
832 auto&& bEntry = Impl::asVector(b[row.index()]);
│ │ │ +
833 Impl::asMatrix(diagonal).solve(xEntry, bEntry);
│ │ │ +
834 }
│ │ │ +
835 }
│ │ │ +
836
│ │ │ +
837 if(smoothers_->levels()>0)
│ │ │ +
838 smoothers_->finest()->pre(x,b);
│ │ │ +
839 else
│ │ │ +
840 // No smoother to make x consistent! Do it by hand
│ │ │ +
841 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ +
842 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ +
843 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
844 update_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
845 matrices_->coarsenVector(*rhs_);
│ │ │ +
846 matrices_->coarsenVector(*lhs_);
│ │ │ +
847 matrices_->coarsenVector(*update_);
│ │ │ +
848
│ │ │ +
849 // Preprocess all smoothers
│ │ │ +
850 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ +
851 typedef typename Hierarchy<Range,A>::Iterator RIterator;
│ │ │ +
852 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ +
853 Iterator coarsest = smoothers_->coarsest();
│ │ │ +
854 Iterator smoother = smoothers_->finest();
│ │ │ +
855 RIterator rhs = rhs_->finest();
│ │ │ +
856 DIterator lhs = lhs_->finest();
│ │ │ +
857 if(smoothers_->levels()>1) {
│ │ │ +
858
│ │ │ +
859 assert(lhs_->levels()==rhs_->levels());
│ │ │ +
860 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels()==matrices_->maxlevels());
│ │ │ +
861 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels()<matrices_->maxlevels());
│ │ │ +
862
│ │ │ +
863 if(smoother!=coarsest)
│ │ │ +
864 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, ++rhs)
│ │ │ +
865 smoother->pre(*lhs,*rhs);
│ │ │ +
866 smoother->pre(*lhs,*rhs);
│ │ │ +
867 }
│ │ │ +
868
│ │ │ +
869
│ │ │ +
870 // The preconditioner might change x and b. So we have to
│ │ │ +
871 // copy the changes to the original vectors.
│ │ │ +
872 x = *lhs_->finest();
│ │ │ +
873 b = *rhs_->finest();
│ │ │ +
874
│ │ │ +
875 }
│ │ │ +
│ │ │ +
876 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
878 {
│ │ │ +
879 return matrices_->levels();
│ │ │ +
880 }
│ │ │ +
│ │ │ +
881 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
883 {
│ │ │ +
884 return matrices_->maxlevels();
│ │ │ +
885 }
│ │ │ +
│ │ │ +
886
│ │ │ +
888 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
890 {
│ │ │ +
891 LevelContext levelContext;
│ │ │ +
892
│ │ │ +
893 if(additive) {
│ │ │ +
894 *(rhs_->finest())=d;
│ │ │ +
895 additiveMgc();
│ │ │ +
896 v=*lhs_->finest();
│ │ │ +
897 }else{
│ │ │ +
898 // Init all iterators for the current level
│ │ │ +
899 initIteratorsWithFineLevel(levelContext);
│ │ │ +
900
│ │ │ +
901
│ │ │ +
902 *levelContext.lhs = v;
│ │ │ +
903 *levelContext.rhs = d;
│ │ │ +
904 *levelContext.update=0;
│ │ │ +
905 levelContext.level=0;
│ │ │ +
906
│ │ │ +
907 mgc(levelContext);
│ │ │ +
908
│ │ │ +
909 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ +
910 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ +
911
│ │ │ +
912 v=*levelContext.update;
│ │ │ +
913 }
│ │ │ +
914
│ │ │ +
915 }
│ │ │ +
│ │ │ +
916
│ │ │ +
917 template<class M, class X, class S, class PI, class A>
│ │ │ +
918 void AMG<M,X,S,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ +
919 {
│ │ │ +
920 levelContext.smoother = smoothers_->finest();
│ │ │ +
921 levelContext.matrix = matrices_->matrices().finest();
│ │ │ +
922 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ +
923 levelContext.redist =
│ │ │ +
924 matrices_->redistributeInformation().begin();
│ │ │ +
925 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ +
926 levelContext.lhs = lhs_->finest();
│ │ │ +
927 levelContext.update = update_->finest();
│ │ │ +
928 levelContext.rhs = rhs_->finest();
│ │ │ +
929 }
│ │ │ +
930
│ │ │ +
931 template<class M, class X, class S, class PI, class A>
│ │ │ +
932 bool AMG<M,X,S,PI,A>
│ │ │ +
933 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ +
934 {
│ │ │ +
935
│ │ │ +
936 bool processNextLevel=true;
│ │ │ +
937
│ │ │ +
938 if(levelContext.redist->isSetup()) {
│ │ │ +
939 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.rhs),
│ │ │ +
940 levelContext.rhs.getRedistributed());
│ │ │ +
941 processNextLevel = levelContext.rhs.getRedistributed().size()>0;
│ │ │ +
942 if(processNextLevel) {
│ │ │ +
943 //restrict defect to coarse level right hand side.
│ │ │ +
944 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ +
945 ++levelContext.pinfo;
│ │ │ +
946 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
947 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ +
948 static_cast<const Range&>(fineRhs.getRedistributed()),
│ │ │ +
949 *levelContext.pinfo);
│ │ │ +
950 }
│ │ │ +
951 }else{
│ │ │ +
952 //restrict defect to coarse level right hand side.
│ │ │ +
953 typename Hierarchy<Range,A>::Iterator fineRhs = levelContext.rhs++;
│ │ │ +
954 ++levelContext.pinfo;
│ │ │ + │ │ │ +
956 ::restrictVector(*(*levelContext.aggregates),
│ │ │ +
957 *levelContext.rhs, static_cast<const Range&>(*fineRhs),
│ │ │ +
958 *levelContext.pinfo);
│ │ │ +
959 }
│ │ │ +
960
│ │ │ +
961 if(processNextLevel) {
│ │ │ +
962 // prepare coarse system
│ │ │ +
963 ++levelContext.lhs;
│ │ │ +
964 ++levelContext.update;
│ │ │ +
965 ++levelContext.matrix;
│ │ │ +
966 ++levelContext.level;
│ │ │ +
967 ++levelContext.redist;
│ │ │ +
968
│ │ │ +
969 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
970 // next level is not the globally coarsest one
│ │ │ +
971 ++levelContext.smoother;
│ │ │ +
972 ++levelContext.aggregates;
│ │ │ +
973 }
│ │ │ +
974 // prepare the update on the next level
│ │ │ +
975 *levelContext.update=0;
│ │ │ +
976 }
│ │ │ +
977 return processNextLevel;
│ │ │ +
978 }
│ │ │ +
979
│ │ │ +
980 template<class M, class X, class S, class PI, class A>
│ │ │ +
981 void AMG<M,X,S,PI,A>
│ │ │ +
982 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel)
│ │ │ +
983 {
│ │ │ +
984 if(processNextLevel) {
│ │ │ +
985 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
986 // previous level is not the globally coarsest one
│ │ │ +
987 --levelContext.smoother;
│ │ │ +
988 --levelContext.aggregates;
│ │ │ +
989 }
│ │ │ +
990 --levelContext.redist;
│ │ │ +
991 --levelContext.level;
│ │ │ +
992 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ +
993 --levelContext.matrix;
│ │ │ +
994
│ │ │ +
995 //typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--;
│ │ │ +
996 --levelContext.lhs;
│ │ │ +
997 --levelContext.pinfo;
│ │ │ +
998 }
│ │ │ +
999 if(levelContext.redist->isSetup()) {
│ │ │ +
1000 // Need to redistribute during prolongateVector
│ │ │ +
1001 levelContext.lhs.getRedistributed()=0;
│ │ │ + │ │ │ +
1003 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ +
1004 levelContext.lhs.getRedistributed(),
│ │ │ +
1005 matrices_->getProlongationDampingFactor(),
│ │ │ +
1006 *levelContext.pinfo, *levelContext.redist);
│ │ │ +
1007 }else{
│ │ │ +
1008 *levelContext.lhs=0;
│ │ │ + │ │ │ +
1010 ::prolongateVector(*(*levelContext.aggregates), *levelContext.update, *levelContext.lhs,
│ │ │ +
1011 matrices_->getProlongationDampingFactor(),
│ │ │ +
1012 *levelContext.pinfo);
│ │ │ +
1013 }
│ │ │ +
1014
│ │ │ +
1015
│ │ │ +
1016 if(processNextLevel) {
│ │ │ +
1017 --levelContext.update;
│ │ │ +
1018 --levelContext.rhs;
│ │ │ +
1019 }
│ │ │ +
1020
│ │ │ +
1021 *levelContext.update += *levelContext.lhs;
│ │ │ +
1022 }
│ │ │ +
1023
│ │ │ +
1024 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
1026 {
│ │ │ + │ │ │ +
1028 }
│ │ │ +
│ │ │ +
1029
│ │ │ +
1030 template<class M, class X, class S, class PI, class A>
│ │ │ +
1031 void AMG<M,X,S,PI,A>::mgc(LevelContext& levelContext){
│ │ │ +
1032 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ +
1033 // Solve directly
│ │ │ + │ │ │ +
1035 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ +
1036 if(levelContext.redist->isSetup()) {
│ │ │ +
1037 levelContext.redist->redistribute(*levelContext.rhs, levelContext.rhs.getRedistributed());
│ │ │ +
1038 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ +
1039 // We are still participating in the computation
│ │ │ +
1040 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ +
1041 levelContext.rhs.getRedistributed());
│ │ │ +
1042 solver_->apply(levelContext.update.getRedistributed(),
│ │ │ +
1043 levelContext.rhs.getRedistributed(), res);
│ │ │ +
1044 }
│ │ │ +
1045 levelContext.redist->redistributeBackward(*levelContext.update, levelContext.update.getRedistributed());
│ │ │ +
1046 levelContext.pinfo->copyOwnerToAll(*levelContext.update, *levelContext.update);
│ │ │ +
1047 }else{
│ │ │ +
1048 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs);
│ │ │ +
1049 solver_->apply(*levelContext.update, *levelContext.rhs, res);
│ │ │ +
1050 }
│ │ │ +
1051
│ │ │ +
1052 if (!res.converged)
│ │ │ +
1053 coarsesolverconverged = false;
│ │ │ +
1054 }else{
│ │ │ +
1055 // presmoothing
│ │ │ +
1056 presmooth(levelContext, preSteps_);
│ │ │ +
1057
│ │ │ +
1058#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ +
1059 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ +
1060
│ │ │ +
1061 if(processNextLevel) {
│ │ │ +
1062 // next level
│ │ │ +
1063 for(std::size_t i=0; i<gamma_; i++){
│ │ │ +
1064 mgc(levelContext);
│ │ │ +
1065 if (levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels())
│ │ │ +
1066 break;
│ │ │ +
1067 if(i+1 < gamma_){
│ │ │ +
1068 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, *levelContext.rhs);
│ │ │ +
1069 }
│ │ │ +
1070 }
│ │ │ +
1071 }
│ │ │ +
1072
│ │ │ +
1073 moveToFineLevel(levelContext, processNextLevel);
│ │ │ +
1074#else
│ │ │ +
1075 *lhs=0;
│ │ │ +
1076#endif
│ │ │ +
1077
│ │ │ +
1078 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ +
1079 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ +
1080 if(!coarsesolverconverged)
│ │ │ +
1081 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ +
1082 }
│ │ │ +
1083 // postsmoothing
│ │ │ +
1084 postsmooth(levelContext, postSteps_);
│ │ │ +
1085
│ │ │ +
1086 }
│ │ │ +
1087 }
│ │ │ +
1088
│ │ │ +
1089 template<class M, class X, class S, class PI, class A>
│ │ │ +
1090 void AMG<M,X,S,PI,A>::additiveMgc(){
│ │ │ +
1091
│ │ │ +
1092 // restrict residual to all levels
│ │ │ +
1093 typename ParallelInformationHierarchy::Iterator pinfo=matrices_->parallelInformation().finest();
│ │ │ +
1094 typename Hierarchy<Range,A>::Iterator rhs=rhs_->finest();
│ │ │ +
1095 typename Hierarchy<Domain,A>::Iterator lhs = lhs_->finest();
│ │ │ +
1096 typename OperatorHierarchy::AggregatesMapList::const_iterator aggregates=matrices_->aggregatesMaps().begin();
│ │ │ +
1097
│ │ │ +
1098 for(typename Hierarchy<Range,A>::Iterator fineRhs=rhs++; fineRhs != rhs_->coarsest(); fineRhs=rhs++, ++aggregates) {
│ │ │ +
1099 ++pinfo;
│ │ │ + │ │ │ +
1101 ::restrictVector(*(*aggregates), *rhs, static_cast<const Range&>(*fineRhs), *pinfo);
│ │ │ +
1102 }
│ │ │ +
1103
│ │ │ +
1104 // pinfo is invalid, set to coarsest level
│ │ │ +
1105 //pinfo = matrices_->parallelInformation().coarsest
│ │ │ +
1106 // calculate correction for all levels
│ │ │ +
1107 lhs = lhs_->finest();
│ │ │ +
1108 typename Hierarchy<Smoother,A>::Iterator smoother = smoothers_->finest();
│ │ │ +
1109
│ │ │ +
1110 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) {
│ │ │ +
1111 // presmoothing
│ │ │ +
1112 *lhs=0;
│ │ │ +
1113 smoother->apply(*lhs, *rhs);
│ │ │ +
1114 }
│ │ │ +
1115
│ │ │ +
1116 // Coarse level solve
│ │ │ +
1117#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ +
1118 InverseOperatorResult res;
│ │ │ +
1119 pinfo->copyOwnerToAll(*rhs, *rhs);
│ │ │ +
1120 solver_->apply(*lhs, *rhs, res);
│ │ │ +
1121
│ │ │ +
1122 if(!res.converged)
│ │ │ +
1123 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ +
1124#else
│ │ │ +
1125 *lhs=0;
│ │ │ +
1126#endif
│ │ │ +
1127 // Prologate and add up corrections from all levels
│ │ │ +
1128 --pinfo;
│ │ │ +
1129 --aggregates;
│ │ │ +
1130
│ │ │ +
1131 for(typename Hierarchy<Domain,A>::Iterator coarseLhs = lhs--; coarseLhs != lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) {
│ │ │ + │ │ │ +
1133 ::prolongateVector(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo);
│ │ │ +
1134 }
│ │ │ +
1135 }
│ │ │ +
1136
│ │ │ +
1137
│ │ │ +
1139 template<class M, class X, class S, class PI, class A>
│ │ │ +
│ │ │ +
1140 void AMG<M,X,S,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ +
1141 {
│ │ │ +
1142 // Postprocess all smoothers
│ │ │ +
1143 typedef typename Hierarchy<Smoother,A>::Iterator Iterator;
│ │ │ +
1144 typedef typename Hierarchy<Domain,A>::Iterator DIterator;
│ │ │ +
1145 Iterator coarsest = smoothers_->coarsest();
│ │ │ +
1146 Iterator smoother = smoothers_->finest();
│ │ │ +
1147 DIterator lhs = lhs_->finest();
│ │ │ +
1148 if(smoothers_->levels()>0) {
│ │ │ +
1149 if(smoother != coarsest || matrices_->levels()<matrices_->maxlevels())
│ │ │ +
1150 smoother->post(*lhs);
│ │ │ +
1151 if(smoother!=coarsest)
│ │ │ +
1152 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs)
│ │ │ +
1153 smoother->post(*lhs);
│ │ │ +
1154 smoother->post(*lhs);
│ │ │ +
1155 }
│ │ │ +
1156 lhs_ = nullptr;
│ │ │ +
1157 update_ = nullptr;
│ │ │ +
1158 rhs_ = nullptr;
│ │ │ +
1159 }
│ │ │ +
│ │ │ +
1160
│ │ │ +
1161 template<class M, class X, class S, class PI, class A>
│ │ │ +
1162 template<class A1>
│ │ │ +
│ │ │ +
1163 void AMG<M,X,S,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ +
1164 {
│ │ │ +
1165 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ +
1166 }
│ │ │ +
│ │ │ +
1167
│ │ │ +
1168 } // end namespace Amg
│ │ │ +
1169
│ │ │ +
│ │ │ + │ │ │ +
1171 template<class> struct isValidMatrix : std::false_type{};
│ │ │ +
1172 template<class T, int n, int m, class A> struct isValidMatrix<BCRSMatrix<FieldMatrix<T,n,m>, A>> : std::true_type{};
│ │ │ +
1173
│ │ │ +
1174 template<class OP>
│ │ │ +
1175 std::shared_ptr<Dune::Preconditioner<typename OP::element_type::domain_type, typename OP::element_type::range_type> >
│ │ │ +
│ │ │ +
1176 makeAMG(const OP& op, const std::string& smoother, const Dune::ParameterTree& config) const
│ │ │ +
1177 {
│ │ │ +
1178 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG");
│ │ │ +
1179 }
│ │ │ +
│ │ │ +
1180
│ │ │ +
1181 template<class M, class X, class Y>
│ │ │ +
1182 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ +
│ │ │ +
1183 makeAMG(const std::shared_ptr<MatrixAdapter<M,X,Y>>& op, const std::string& smoother,
│ │ │ +
1184 const Dune::ParameterTree& config) const
│ │ │ +
1185 {
│ │ │ +
1186 using OP = MatrixAdapter<M,X,Y>;
│ │ │ +
1187
│ │ │ +
1188 if(smoother == "ssor")
│ │ │ +
1189 return std::make_shared<Amg::AMG<OP, X, SeqSSOR<M,X,Y>>>(op, config);
│ │ │ +
1190 if(smoother == "sor")
│ │ │ +
1191 return std::make_shared<Amg::AMG<OP, X, SeqSOR<M,X,Y>>>(op, config);
│ │ │ +
1192 if(smoother == "jac")
│ │ │ +
1193 return std::make_shared<Amg::AMG<OP, X, SeqJac<M,X,Y>>>(op, config);
│ │ │ +
1194 if(smoother == "gs")
│ │ │ +
1195 return std::make_shared<Amg::AMG<OP, X, SeqGS<M,X,Y>>>(op, config);
│ │ │ +
1196 if(smoother == "ilu")
│ │ │ +
1197 return std::make_shared<Amg::AMG<OP, X, SeqILU<M,X,Y>>>(op, config);
│ │ │ +
1198 else
│ │ │ +
1199 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ +
1200 }
│ │ │ +
│ │ │ +
1201
│ │ │ +
1202 template<class M, class X, class Y, class C>
│ │ │ +
1203 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ +
│ │ │ +
1204 makeAMG(const std::shared_ptr<OverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ +
1205 const Dune::ParameterTree& config) const
│ │ │ +
1206 {
│ │ │ + │ │ │ +
1208
│ │ │ +
1209 auto cop = std::static_pointer_cast<const OP>(op);
│ │ │ +
1210
│ │ │ +
1211 if(smoother == "ssor")
│ │ │ +
1212 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1213 if(smoother == "sor")
│ │ │ +
1214 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqSOR<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1215 if(smoother == "jac")
│ │ │ +
1216 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqJac<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1217 if(smoother == "gs")
│ │ │ +
1218 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqGS<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1219 if(smoother == "ilu")
│ │ │ +
1220 return std::make_shared<Amg::AMG<OP, X, BlockPreconditioner<X,Y,C,SeqILU<M,X,Y>>,C>>(cop, config, op->getCommunication());
│ │ │ +
1221 else
│ │ │ +
1222 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ +
1223 }
│ │ │ +
│ │ │ +
1224
│ │ │ +
1225 template<class M, class X, class Y, class C>
│ │ │ +
1226 std::shared_ptr<Dune::Preconditioner<X,Y> >
│ │ │ +
│ │ │ +
1227 makeAMG(const std::shared_ptr<NonoverlappingSchwarzOperator<M,X,Y,C>>& op, const std::string& smoother,
│ │ │ +
1228 const Dune::ParameterTree& config) const
│ │ │ +
1229 {
│ │ │ + │ │ │ +
1231
│ │ │ +
1232 if(smoother == "ssor")
│ │ │ +
1233 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1234 if(smoother == "sor")
│ │ │ +
1235 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqSOR<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1236 if(smoother == "jac")
│ │ │ +
1237 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqJac<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1238 if(smoother == "gs")
│ │ │ +
1239 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqGS<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1240 if(smoother == "ilu")
│ │ │ +
1241 return std::make_shared<Amg::AMG<OP, X, NonoverlappingBlockPreconditioner<C,SeqILU<M,X,Y>>,C>>(op, config, op->getCommunication());
│ │ │ +
1242 else
│ │ │ +
1243 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG");
│ │ │ +
1244 }
│ │ │ +
│ │ │ +
1245
│ │ │ +
1246 template<typename OpTraits, typename OP>
│ │ │ +
1247 std::shared_ptr<Dune::Preconditioner<typename OpTraits::domain_type,
│ │ │ +
1248 typename OpTraits::range_type>>
│ │ │ +
│ │ │ +
1249 operator() (OpTraits opTraits, const std::shared_ptr<OP>& op, const Dune::ParameterTree& config,
│ │ │ +
1250 std::enable_if_t<isValidMatrix<typename OpTraits::matrix_type>::value,int> = 0) const
│ │ │ +
1251 {
│ │ │ +
1252 using field_type = typename OpTraits::matrix_type::field_type;
│ │ │ +
1253 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ +
1254 if (!std::is_convertible<field_type, real_type>())
│ │ │ +
1255 DUNE_THROW(UnsupportedType, "AMG needs field_type(" <<
│ │ │ +
1256 className<field_type>() <<
│ │ │ +
1257 ") to be convertible to its real_type (" <<
│ │ │ +
1258 className<real_type>() <<
│ │ │ +
1259 ").");
│ │ │ +
1260 std::string smoother = config.get("smoother", "ssor");
│ │ │ +
1261 // we can irgnore the OpTraits here. As the AMG can only work
│ │ │ +
1262 // with actual matrices, the operator op must be of type
│ │ │ +
1263 // MatrixAdapter or *SchwarzOperator. In any case these
│ │ │ +
1264 // operators provide all necessary information about matrix,
│ │ │ +
1265 // domain and range type
│ │ │ +
1266 return makeAMG(op, smoother, config);
│ │ │ +
1267 }
│ │ │ +
│ │ │ +
1268
│ │ │ +
1269 template<typename OpTraits, typename OP>
│ │ │ +
1270 std::shared_ptr<Dune::Preconditioner<typename OpTraits::domain_type,
│ │ │ +
1271 typename OpTraits::range_type>>
│ │ │ +
│ │ │ +
1272 operator() (OpTraits opTraits, const std::shared_ptr<OP>& op, const Dune::ParameterTree& config,
│ │ │ +
1273 std::enable_if_t<!isValidMatrix<typename OpTraits::matrix_type>::value,int> = 0) const
│ │ │ +
1274 {
│ │ │ +
1275 DUNE_THROW(UnsupportedType, "AMG needs a FieldMatrix as Matrix block_type");
│ │ │ +
1276 }
│ │ │ +
│ │ │ +
1277 };
│ │ │ +
│ │ │ +
1278
│ │ │ + │ │ │ +
1280} // end namespace Dune
│ │ │ +
1281
│ │ │ +
1282#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.
│ │ │ +
Templates characterizing the type of a solver.
│ │ │ + │ │ │ +
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:13
│ │ │ +
Implementations of the inverse operator interface.
│ │ │ +
Classes for using SuperLU with ISTL matrices.
│ │ │ +
AMG(const AMG &amg)
Copy constructor.
Definition amg.hh:393
│ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition amg.hh:802
│ │ │ +
static DirectSolver * create(const Matrix &mat, bool verbose, bool reusevector)
Definition amg.hh:682
│ │ │ +
std::shared_ptr< Dune::Preconditioner< typename OpTraits::domain_type, typename OpTraits::range_type > > operator()(OpTraits opTraits, const std::shared_ptr< OP > &op, const Dune::ParameterTree &config, std::enable_if_t< isValidMatrix< typename OpTraits::matrix_type >::value, int >=0) const
Definition amg.hh:1249
│ │ │ +
static std::string name()
Definition amg.hh:681
│ │ │ +
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ +
Hierarchy< Domain, A >::Iterator update
The iterator over the updates.
Definition amg.hh:304
│ │ │ +
Hierarchy< Range, A >::Iterator rhs
The iterator over the right hand sided.
Definition amg.hh:308
│ │ │ +
static std::string name()
Definition amg.hh:673
│ │ │ +
bool usesDirectCoarseLevelSolver() const
Check whether the coarse solver used is a direct solver.
Definition amg.hh:1025
│ │ │ +
X Domain
The domain type.
Definition amg.hh:88
│ │ │ +
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:645
│ │ │ +
AMG(OperatorHierarchy &matrices, CoarseSolver &coarseSolver, const SmootherArgs &smootherArgs, const Parameters &parms)
Construct a new amg with a specific coarse solver.
Definition amg.hh:407
│ │ │ +
AMG(std::shared_ptr< const Operator > fineOperator, const ParameterTree &configuration, const ParallelInformation &pinfo=ParallelInformation())
Constructor an AMG via ParameterTree.
Definition amg.hh:453
│ │ │ +
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition amg.hh:288
│ │ │ +
SolverType
Definition amg.hh:628
│ │ │ +
OperatorHierarchy::AggregatesMapList::const_iterator aggregates
The iterator over the aggregates maps.
Definition amg.hh:296
│ │ │ +
SmootherTraits< Smoother >::Arguments SmootherArgs
The argument type for the construction of the smoother.
Definition amg.hh:101
│ │ │ +
Solver< Matrix, solver > SelectedSolver
Definition amg.hh:678
│ │ │ +
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:1183
│ │ │ +
std::string operator()(const std::string &str)
Definition amg.hh:379
│ │ │ +
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:1176
│ │ │ +
S Smoother
The type of the smoother.
Definition amg.hh:98
│ │ │ +
static std::string name()
Definition amg.hh:650
│ │ │ +
Hierarchy< Smoother, A >::Iterator smoother
The iterator over the smoothers.
Definition amg.hh:280
│ │ │ +
M Operator
The matrix operator type.
Definition amg.hh:74
│ │ │ +
OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator matrix
The iterator over the matrices.
Definition amg.hh:284
│ │ │ + │ │ │ +
static type * create(const M &mat, bool verbose, bool reusevector)
Definition amg.hh:669
│ │ │ +
OperatorHierarchy::RedistributeInfoList::const_iterator redist
The iterator over the redistribution information.
Definition amg.hh:292
│ │ │ +
X Range
The range type.
Definition amg.hh:90
│ │ │ +
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:1163
│ │ │ +
std::size_t levels()
Definition amg.hh:877
│ │ │ +
InverseOperator< Vector, Vector > type
Definition amg.hh:644
│ │ │ +
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:1204
│ │ │ +
Hierarchy< Domain, A >::Iterator lhs
The iterator over the left hand side.
Definition amg.hh:300
│ │ │ +
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:630
│ │ │ +
static constexpr bool isDirectSolver
Definition amg.hh:680
│ │ │ +
void recalculateHierarchy()
Recalculate the matrix hierarchy.
Definition amg.hh:222
│ │ │ +
FieldTraits< T >::real_type RelaxationFactor
The type of the relaxation factor.
Definition smoother.hh:42
│ │ │ +
Matrix::field_type field_type
Definition amg.hh:627
│ │ │ +
SelectedSolver::type DirectSolver
Definition amg.hh:679
│ │ │ +
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
The parallal data distribution hierarchy type.
Definition amg.hh:85
│ │ │ +
InverseOperator< X, X > CoarseSolver
the type of the coarse solver.
Definition amg.hh:92
│ │ │ +
void post(Domain &x)
Clean up.
Definition amg.hh:1140
│ │ │ +
std::size_t maxlevels()
Definition amg.hh:882
│ │ │ +
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:1227
│ │ │ +
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:312
│ │ │ +
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:429
│ │ │ +
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition amg.hh:889
│ │ │ +
Smoother SmootherType
Definition amg.hh:276
│ │ │ +
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
The operator hierarchy type.
Definition amg.hh:83
│ │ │ +
virtual SolverCategory::Category category() const
Category of the preconditioner (see SolverCategory::Category).
Definition amg.hh:195
│ │ │ +
friend class KAMG
Definition amg.hh:68
│ │ │ +
PI ParallelInformation
The type of the parallel information. Either OwnerOverlapCommunication or another type describing the...
Definition amg.hh:81
│ │ │ +
@ none
Definition amg.hh:628
│ │ │ +
@ umfpack
Definition amg.hh:628
│ │ │ +
@ superlu
Definition amg.hh:628
│ │ │ +
@ 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
│ │ │ +
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ +
const Dtype_t BaseGetSuperLUType< T >::type
Definition supermatrix.hh:135
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:467
│ │ │ -
Thrown when a solver aborts due to some problem.
Definition istlexception.hh:46
│ │ │ -
A linear operator.
Definition operators.hh:68
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator
Const iterator over the matrix rows.
Definition matrix.hh:586
│ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:616
│ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:610
│ │ │ +
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:135
│ │ │ +
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:381
│ │ │ +
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:465
│ │ │ +
Definition aggregates.hh:486
│ │ │ +
Definition aggregates.hh:502
│ │ │ +
Criterion taking advantage of symmetric matrices.
Definition aggregates.hh:525
│ │ │ +
Criterion suitable for unsymmetric matrices.
Definition aggregates.hh:545
│ │ │ +
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:66
│ │ │ +
Definition amg.hh:626
│ │ │ + │ │ │ +
Definition amg.hh:1170
│ │ │ +
Definition amg.hh:1171
│ │ │ +
An overlapping Schwarz operator.
Definition schwarz.hh:75
│ │ │ +
A hierarchy of containers (e.g. matrices or vectors).
Definition hierarchy.hh:40
│ │ │ +
LevelIterator< Hierarchy< T, A >, T > Iterator
Type of the mutable iterator.
Definition hierarchy.hh:220
│ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ +
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
Definition matrixhierarchy.hh:82
│ │ │ +
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
│ │ │ +
Definition transfer.hh:32
│ │ │
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ +
X::field_type field_type
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.
│ │ │ -
@ normSpacing
Definition solver.hh:162
│ │ │ -
@ iterationSpacing
Definition solver.hh:162
│ │ │ -
Simd::Scalar< real_type > scalar_real_type
Definition solver.hh:116
│ │ │ -
X range_type
Definition solver.hh:107
│ │ │ -
X domain_type
Definition solver.hh:104
│ │ │ -
virtual void apply(X &x, Y &b, InverseOperatorResult &res)=0
Apply inverse operator,.
│ │ │ -
X::field_type field_type
Definition solver.hh:110
│ │ │ -
FieldTraits< field_type >::real_type real_type
Definition solver.hh:113
│ │ │ -
virtual SolverCategory::Category category() const =0
Category of the solver (see SolverCategory::Category).
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category).
Definition solver.hh:385
│ │ │ -
IterativeSolver(std::shared_ptr< const LinearOperator< X, Y > > op, std::shared_ptr< Preconditioner< X, X > > prec, const ParameterTree &configuration)
Constructor.
Definition solver.hh:292
│ │ │ -
std::shared_ptr< const ScalarProduct< X > > _sp
Definition solver.hh:508
│ │ │ -
void apply(X &x, X &b, double reduction, InverseOperatorResult &res) override
Apply inverse operator with given reduction factor.
Definition solver.hh:376
│ │ │ -
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
│ │ │ -
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:97
│ │ │
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │ +
SuperLu Solver.
Definition superlu.hh:271
│ │ │ +
Definition umfpack.hh:53
│ │ │ +
The UMFPack direct sparse solver.
Definition umfpack.hh:265
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,634 +1,1632 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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; │ │ │ │ -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 }; │ │ │ │ +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 <_d_u_n_e_/_i_s_t_l_/_s_o_l_v_e_r_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ +20#include │ │ │ │ +21#include │ │ │ │ +22#include │ │ │ │ +23#include │ │ │ │ +24#include │ │ │ │ +25 │ │ │ │ +26namespace _D_u_n_e │ │ │ │ +27{ │ │ │ │ +28 namespace _A_m_g │ │ │ │ +29 { │ │ │ │ +35 │ │ │ │ +41 │ │ │ │ +46 │ │ │ │ +47 template │ │ │ │ +48 class _K_A_M_G; │ │ │ │ +49 │ │ │ │ +50 template │ │ │ │ +51 class _K_A_m_g_T_w_o_G_r_i_d; │ │ │ │ +52 │ │ │ │ +63 template > │ │ │ │ +_6_5 class _A_M_G : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r │ │ │ │ +66 { │ │ │ │ +67 template │ │ │ │ +_6_8 friend class _K_A_M_G; │ │ │ │ +69 │ │ │ │ +70 friend class _K_A_m_g_T_w_o_G_r_i_d<_A_M_G>; │ │ │ │ +71 │ │ │ │ +72 public: │ │ │ │ +_7_4 typedef M _O_p_e_r_a_t_o_r; │ │ │ │ +_8_1 typedef PI _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n; │ │ │ │ +_8_3 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_5 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; │ │ │ │ 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; │ │ │ │ +_8_8 typedef X _D_o_m_a_i_n; │ │ │ │ +_9_0 typedef X _R_a_n_g_e; │ │ │ │ +_9_2 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_8 typedef S _S_m_o_o_t_h_e_r; │ │ │ │ +99 │ │ │ │ +_1_0_1 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; │ │ │ │ +102 │ │ │ │ +_1_1_2 _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, │ │ │ │ +113 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); │ │ │ │ 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; │ │ │ │ -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 {} │ │ │ │ +126 template │ │ │ │ +_1_2_7 _A_M_G(const _O_p_e_r_a_t_o_r& fineOperator, const C& criterion, │ │ │ │ +128 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(), │ │ │ │ +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 │ │ │ │ +_1_8_1 _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()); │ │ │ │ +182 │ │ │ │ +_1_8_6 _A_M_G(const _A_M_G& amg); │ │ │ │ +187 │ │ │ │ +_1_8_9 void _p_r_e(_D_o_m_a_i_n& x, _R_a_n_g_e& b); │ │ │ │ +190 │ │ │ │ +_1_9_2 void _a_p_p_l_y(_D_o_m_a_i_n& v, const _R_a_n_g_e& d); │ │ │ │ +193 │ │ │ │ +_1_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 │ │ │ │ +196 { │ │ │ │ +197 return category_; │ │ │ │ +198 } │ │ │ │ +199 │ │ │ │ +_2_0_1 void _p_o_s_t(_D_o_m_a_i_n& x); │ │ │ │ +202 │ │ │ │ +207 template │ │ │ │ +_2_0_8 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); │ │ │ │ +209 │ │ │ │ +_2_1_0 std::size_t _l_e_v_e_l_s(); │ │ │ │ +211 │ │ │ │ +_2_1_2 std::size_t _m_a_x_l_e_v_e_l_s(); │ │ │ │ +213 │ │ │ │ +_2_2_2 void _r_e_c_a_l_c_u_l_a_t_e_H_i_e_r_a_r_c_h_y() │ │ │ │ +223 { │ │ │ │ +224 matrices_->recalculateGalerkin(NegateSet()); │ │ │ │ +225 } │ │ │ │ +226 │ │ │ │ +_2_3_1 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; │ │ │ │ +232 │ │ │ │ +233 private: │ │ │ │ +234 /* │ │ │ │ +235 * @brief Helper function to create hierarchies with parameter tree. │ │ │ │ +236 * │ │ │ │ +237 * Will create the coarsen criterion with the norm and create the │ │ │ │ +238 * Hierarchies │ │ │ │ +239 * \tparam Norm Type of the norm to use. │ │ │ │ +240 */ │ │ │ │ +241 template │ │ │ │ +242 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ +matrixptr, │ │ │ │ +243 const PI& pinfo, const Norm&, │ │ │ │ +244 const ParameterTree& configuration, │ │ │ │ +245 std::true_type compiles = std::true_type()); │ │ │ │ +246 template │ │ │ │ +247 void createCriterionAndHierarchies(std::shared_ptr │ │ │ │ +matrixptr, │ │ │ │ +248 const PI& pinfo, const Norm&, │ │ │ │ +249 const ParameterTree& configuration, │ │ │ │ +250 std::false_type); │ │ │ │ +255 template │ │ │ │ +256 void createHierarchies(C& criterion, std::shared_ptr │ │ │ │ +matrixptr, │ │ │ │ +257 const PI& pinfo, const ParameterTree& configuration); │ │ │ │ +264 template │ │ │ │ +265 void createHierarchies(C& criterion, │ │ │ │ +266 const std::shared_ptr& matrixptr, │ │ │ │ +267 const PI& pinfo); │ │ │ │ +274 struct LevelContext │ │ │ │ +275 { │ │ │ │ +_2_7_6 typedef _S_m_o_o_t_h_e_r _S_m_o_o_t_h_e_r_T_y_p_e; │ │ │ │ +_2_8_0 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_4 typename OperatorHierarchy::ParallelMatrixHierarchy::ConstIterator _m_a_t_r_i_x; │ │ │ │ +_2_8_8 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_2 typename OperatorHierarchy::RedistributeInfoList::const_iterator _r_e_d_i_s_t; │ │ │ │ +_2_9_6 typename OperatorHierarchy::AggregatesMapList::const_iterator _a_g_g_r_e_g_a_t_e_s; │ │ │ │ +_3_0_0 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_4 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_8 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_2 std::size_t _l_e_v_e_l; │ │ │ │ +313 }; │ │ │ │ +314 │ │ │ │ +315 │ │ │ │ +320 void mgc(LevelContext& levelContext); │ │ │ │ 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 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) │ │ │ │ -override │ │ │ │ -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 _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 │ │ │ │ -386 { │ │ │ │ -387 return ___c_a_t_e_g_o_r_y; │ │ │ │ +322 void additiveMgc(); │ │ │ │ +323 │ │ │ │ +330 void moveToFineLevel(LevelContext& levelContext,bool processedFineLevel); │ │ │ │ +331 │ │ │ │ +336 bool moveToCoarseLevel(LevelContext& levelContext); │ │ │ │ +337 │ │ │ │ +342 void initIteratorsWithFineLevel(LevelContext& levelContext); │ │ │ │ +343 │ │ │ │ +345 std::shared_ptr matrices_; │ │ │ │ +347 _S_m_o_o_t_h_e_r_A_r_g_s smootherArgs_; │ │ │ │ +349 std::shared_ptr > smoothers_; │ │ │ │ +351 std::shared_ptr solver_; │ │ │ │ +353 std::shared_ptr> rhs_; │ │ │ │ +355 std::shared_ptr> lhs_; │ │ │ │ +357 std::shared_ptr> update_; │ │ │ │ +359 using ScalarProduct = _D_u_n_e_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>; │ │ │ │ +361 std::shared_ptr scalarProduct_; │ │ │ │ +363 std::size_t gamma_; │ │ │ │ +365 std::size_t preSteps_; │ │ │ │ +367 std::size_t postSteps_; │ │ │ │ +368 bool buildHierarchy_; │ │ │ │ +369 bool additive; │ │ │ │ +370 bool coarsesolverconverged; │ │ │ │ +371 std::shared_ptr coarseSmoother_; │ │ │ │ +373 _S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_C_a_t_e_g_o_r_y category_; │ │ │ │ +375 std::size_t verbosity_; │ │ │ │ +376 │ │ │ │ +377 struct ToLower │ │ │ │ +378 { │ │ │ │ +_3_7_9 std::string _o_p_e_r_a_t_o_r_(_)(const std::string& str) │ │ │ │ +380 { │ │ │ │ +381 std::stringstream retval; │ │ │ │ +382 std::ostream_iterator out(retval); │ │ │ │ +383 std::transform(str.begin(), str.end(), out, │ │ │ │ +384 [](char c){ │ │ │ │ +385 return std::tolower(c, std::locale::classic()); │ │ │ │ +386 }); │ │ │ │ +387 return retval.str(); │ │ │ │ 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) │ │ │ │ +389 }; │ │ │ │ +390 }; │ │ │ │ +391 │ │ │ │ +392 template │ │ │ │ +_3_9_3 inline _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _A_M_G& amg) │ │ │ │ +394 : matrices_(amg.matrices_), smootherArgs_(amg.smootherArgs_), │ │ │ │ +395 smoothers_(amg.smoothers_), solver_(amg.solver_), │ │ │ │ +396 rhs_(), lhs_(), update_(), │ │ │ │ +397 scalarProduct_(amg.scalarProduct_), gamma_(amg.gamma_), │ │ │ │ +398 preSteps_(amg.preSteps_), postSteps_(amg.postSteps_), │ │ │ │ +399 buildHierarchy_(amg.buildHierarchy_), │ │ │ │ +400 additive(amg.additive), coarsesolverconverged(amg.coarsesolverconverged), │ │ │ │ +401 coarseSmoother_(amg.coarseSmoother_), │ │ │ │ +402 category_(amg.category_), │ │ │ │ +403 verbosity_(amg.verbosity_) │ │ │ │ +404 {} │ │ │ │ +405 │ │ │ │ +406 template │ │ │ │ +_4_0_7 _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, │ │ │ │ +408 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ +409 const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +410 : matrices_(stackobject_to_shared_ptr(matrices)), smootherArgs_ │ │ │ │ +(smootherArgs), │ │ │ │ +411 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(&coarseSolver), │ │ │ │ +412 rhs_(), lhs_(), update_(), scalarProduct_(0), │ │ │ │ +413 gamma_(parms.getGamma()), preSteps_(parms.getNoPreSmoothSteps()), │ │ │ │ +414 postSteps_(parms.getNoPostSmoothSteps()), buildHierarchy_(false), │ │ │ │ +415 additive(parms.getAdditive()), coarsesolverconverged(true), │ │ │ │ +416 coarseSmoother_(), │ │ │ │ +417// #warning should category be retrieved from matrices? │ │ │ │ +418 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::_c_a_t_e_g_o_r_y(*smoothers_->coarsest())), │ │ │ │ +419 verbosity_(parms.debugLevel()) │ │ │ │ 420 { │ │ │ │ -421 res._c_l_e_a_r(); │ │ │ │ -422 if(___p_a_r_e_n_t._verbose>0){ │ │ │ │ -423 std::cout << "=== " << parent.name() << std::endl; │ │ │ │ -424 if(_parent._verbose > 1) │ │ │ │ -425 _parent.printHeader(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 │ │ │ │ -459 { │ │ │ │ -460 if (___p_a_r_e_n_t._verbose>0) │ │ │ │ -461 std::cout << "=== " << ___p_a_r_e_n_t.name() << ": 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.name() << ": 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._verbose > 1){ │ │ │ │ -470 if(i!=0) │ │ │ │ -471 ___p_a_r_e_n_t.printOutput(std::cout,i,def,___d_e_f); │ │ │ │ -472 else │ │ │ │ -473 ___p_a_r_e_n_t.printOutput(std::cout,i,def); │ │ │ │ -474 } │ │ │ │ -475 ___d_e_f = def; │ │ │ │ -476 ___i = i; │ │ │ │ -477 ___r_e_s.converged = (Simd::allTrue(def<___d_e_f_0*___p_a_r_e_n_t._reduction || │ │ │ │ -def<_r_e_a_l___t_y_p_e(1E-30))); // convergence check │ │ │ │ -478 return ___r_e_s.converged; │ │ │ │ -479 } │ │ │ │ -480 │ │ │ │ -481 protected: │ │ │ │ -_4_8_2 void _f_i_n_a_l_i_z_e(){ │ │ │ │ -483 ___r_e_s.converged = (Simd::allTrue(___d_e_f<___d_e_f_0*___p_a_r_e_n_t._reduction || │ │ │ │ -___d_e_f<_r_e_a_l___t_y_p_e(1E-30))); │ │ │ │ -484 ___r_e_s.iterations = ___i; │ │ │ │ -485 ___r_e_s.reduction = static_cast(Simd::max(___d_e_f/___d_e_f_0)); │ │ │ │ -486 ___r_e_s.conv_rate = pow(___r_e_s.reduction,1.0/___i); │ │ │ │ -487 ___r_e_s.elapsed = ___w_a_t_c_h.elapsed(); │ │ │ │ -488 if (___p_a_r_e_n_t._verbose>0) // final print │ │ │ │ -489 { │ │ │ │ -490 std::cout << "=== rate=" << ___r_e_s.conv_rate │ │ │ │ -491 << ", T=" << ___r_e_s.elapsed │ │ │ │ -492 << ", TIT=" << ___r_e_s.elapsed/___r_e_s.iterations │ │ │ │ -493 << ", IT=" << ___r_e_s.iterations << std::endl; │ │ │ │ -494 } │ │ │ │ -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) │ │ │ │ -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); │ │ │ │ -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 }; │ │ │ │ -562 │ │ │ │ -566} │ │ │ │ -567 │ │ │ │ -568#endif │ │ │ │ -_s_o_l_v_e_r_t_y_p_e_._h_h │ │ │ │ -Templates characterizing the type of a solver. │ │ │ │ +421 assert(matrices_->isBuilt()); │ │ │ │ +422 │ │ │ │ +423 // build the necessary smoother hierarchies │ │ │ │ +424 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ +425 } │ │ │ │ +426 │ │ │ │ +427 template │ │ │ │ +428 template │ │ │ │ +_4_2_9 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(const _O_p_e_r_a_t_o_r& matrix, │ │ │ │ +430 const C& criterion, │ │ │ │ +431 const _S_m_o_o_t_h_e_r_A_r_g_s& smootherArgs, │ │ │ │ +432 const PI& pinfo) │ │ │ │ +433 : smootherArgs_(smootherArgs), │ │ │ │ +434 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), solver_(), │ │ │ │ +435 rhs_(), lhs_(), update_(), scalarProduct_(), │ │ │ │ +436 gamma_(criterion.getGamma()), preSteps_(criterion.getNoPreSmoothSteps()), │ │ │ │ +437 postSteps_(criterion.getNoPostSmoothSteps()), buildHierarchy_(true), │ │ │ │ +438 additive(criterion.getAdditive()), coarsesolverconverged(true), │ │ │ │ +439 coarseSmoother_(), │ │ │ │ +440 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::_c_a_t_e_g_o_r_y(pinfo)), │ │ │ │ +441 verbosity_(criterion.debugLevel()) │ │ │ │ +442 { │ │ │ │ +443 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)) │ │ │ │ +444 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!"); │ │ │ │ +445 // TODO: reestablish compile time checks. │ │ │ │ +446 //static_assert(static_cast(PI::category)==static_cast(S:: │ │ │ │ +category), │ │ │ │ +447 // "Matrix and Solver must match in terms of category!"); │ │ │ │ +448 auto matrixptr = stackobject_to_shared_ptr(matrix); │ │ │ │ +449 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ +450 } │ │ │ │ +451 │ │ │ │ +452 template │ │ │ │ +_4_5_3 _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_A_M_G(std::shared_ptr matrixptr, │ │ │ │ +454 const ParameterTree& configuration, │ │ │ │ +455 const _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n& pinfo) : │ │ │ │ +456 smoothers_(new _H_i_e_r_a_r_c_h_y<_S_m_o_o_t_h_e_r,A>), │ │ │ │ +457 solver_(), rhs_(), lhs_(), update_(), scalarProduct_(), buildHierarchy_ │ │ │ │ +(true), │ │ │ │ +458 coarsesolverconverged(true), coarseSmoother_(), │ │ │ │ +459 category_(_S_o_l_v_e_r_C_a_t_e_g_o_r_y::_c_a_t_e_g_o_r_y(pinfo)) │ │ │ │ +460 { │ │ │ │ +461 │ │ │ │ +462 if (configuration.hasKey ("smootherIterations")) │ │ │ │ +463 smootherArgs_.iterations = configuration.get("smootherIterations"); │ │ │ │ +464 │ │ │ │ +465 if (configuration.hasKey ("smootherRelaxation")) │ │ │ │ +466 smootherArgs_.relaxationFactor = configuration.get("smootherRelaxation"); │ │ │ │ +467 │ │ │ │ +468 auto normName = ToLower()(configuration.get("strengthMeasure", │ │ │ │ +"diagonal")); │ │ │ │ +469 auto index = configuration.get("diagonalRowIndex", 0); │ │ │ │ +470 │ │ │ │ +471 if ( normName == "diagonal") │ │ │ │ +472 { │ │ │ │ +473 using _f_i_e_l_d___t_y_p_e = typename M::field_type; │ │ │ │ +474 using real_type = typename FieldTraits::real_type; │ │ │ │ +475 std::is_convertible compiles; │ │ │ │ +476 │ │ │ │ +477 switch (index) │ │ │ │ +478 { │ │ │ │ +479 case 0: │ │ │ │ +480 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_0_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +481 break; │ │ │ │ +482 case 1: │ │ │ │ +483 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_1_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +484 break; │ │ │ │ +485 case 2: │ │ │ │ +486 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_2_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +487 break; │ │ │ │ +488 case 3: │ │ │ │ +489 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_3_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +490 break; │ │ │ │ +491 case 4: │ │ │ │ +492 createCriterionAndHierarchies(matrixptr, pinfo, _D_i_a_g_o_n_a_l_<_4_>(), │ │ │ │ +configuration, compiles); │ │ │ │ +493 break; │ │ │ │ +494 default: │ │ │ │ +495 DUNE_THROW(InvalidStateException, "Currently strengthIndex>4 is not │ │ │ │ +supported."); │ │ │ │ +496 } │ │ │ │ +497 } │ │ │ │ +498 else if (normName == "rowsum") │ │ │ │ +499 createCriterionAndHierarchies(matrixptr, pinfo, _R_o_w_S_u_m(), configuration); │ │ │ │ +500 else if (normName == "frobenius") │ │ │ │ +501 createCriterionAndHierarchies(matrixptr, pinfo, _F_r_o_b_e_n_i_u_s_N_o_r_m(), │ │ │ │ +configuration); │ │ │ │ +502 else if (normName == "one") │ │ │ │ +503 createCriterionAndHierarchies(matrixptr, pinfo, _A_l_w_a_y_s_O_n_e_N_o_r_m(), │ │ │ │ +configuration); │ │ │ │ +504 else │ │ │ │ +505 DUNE_THROW(Dune::NotImplemented, "Wrong config file: strengthMeasure │ │ │ │ +"< │ │ │ │ +509 template │ │ │ │ +510 void AMG::createCriterionAndHierarchies(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ +configuration, std::false_type) │ │ │ │ +511 { │ │ │ │ +512 DUNE_THROW(InvalidStateException, "Strength of connection measure does not │ │ │ │ +support this type (" │ │ │ │ +513 << className() << ") as it is lacking a conversion │ │ │ │ +to" │ │ │ │ +514 << className::real_type>() << │ │ │ │ +"."); │ │ │ │ +515 } │ │ │ │ +516 │ │ │ │ +517 template │ │ │ │ +518 template │ │ │ │ +519 void AMG::createCriterionAndHierarchies(std::shared_ptr matrixptr, const PI& pinfo, const Norm&, const ParameterTree& │ │ │ │ +configuration, std::true_type) │ │ │ │ +520 { │ │ │ │ +521 if (configuration.get("criterionSymmetric", true)) │ │ │ │ +522 { │ │ │ │ +523 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< │ │ │ │ +524 _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_> >; │ │ │ │ +525 Criterion criterion; │ │ │ │ +526 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ +527 } │ │ │ │ +528 else │ │ │ │ +529 { │ │ │ │ +530 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< │ │ │ │ +531 _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_> >; │ │ │ │ +532 Criterion criterion; │ │ │ │ +533 createHierarchies(criterion, matrixptr, pinfo, configuration); │ │ │ │ +534 } │ │ │ │ +535 } │ │ │ │ +536 │ │ │ │ +537 template │ │ │ │ +538 template │ │ │ │ +539 void AMG::createHierarchies(C& criterion, std::shared_ptr matrixptr, const PI& pinfo, const ParameterTree& configuration) │ │ │ │ +540 { │ │ │ │ +541 if (configuration.hasKey ("maxLevel")) │ │ │ │ +542 criterion.setMaxLevel(configuration.get("maxLevel")); │ │ │ │ +543 │ │ │ │ +544 if (configuration.hasKey ("minCoarseningRate")) │ │ │ │ +545 criterion.setMinCoarsenRate(configuration.get("minCoarseningRate")); │ │ │ │ +546 │ │ │ │ +547 if (configuration.hasKey ("coarsenTarget")) │ │ │ │ +548 criterion.setCoarsenTarget (configuration.get("coarsenTarget")); │ │ │ │ +549 │ │ │ │ +550 if (configuration.hasKey ("accumulationMode")) │ │ │ │ +551 { │ │ │ │ +552 std::string mode = ToLower()(configuration.get │ │ │ │ +("accumulationMode")); │ │ │ │ +553 if ( mode == "none") │ │ │ │ +554 criterion.setAccumulate(_A_c_c_u_m_u_l_a_t_i_o_n_M_o_d_e_:_:_n_o_A_c_c_u); │ │ │ │ +555 else if ( mode == "atonce" ) │ │ │ │ +556 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); │ │ │ │ +557 else if ( mode == "successive") │ │ │ │ +558 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); │ │ │ │ +559 else │ │ │ │ +560 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ +does not allow value " │ │ │ │ +561 << mode <<"."); │ │ │ │ +562 } │ │ │ │ +563 │ │ │ │ +564 if (configuration.hasKey ("prolongationDampingFactor")) │ │ │ │ +565 criterion.setProlongationDampingFactor (configuration.get │ │ │ │ +("prolongationDampingFactor")); │ │ │ │ +566 │ │ │ │ +567 if (configuration.hasKey("defaultAggregationSizeMode")) │ │ │ │ +568 { │ │ │ │ +569 auto mode = ToLower()(configuration.get │ │ │ │ +("defaultAggregationSizeMode")); │ │ │ │ +570 auto dim = configuration.get("defaultAggregationDimension"); │ │ │ │ +571 std::size_t maxDistance = 2; │ │ │ │ +572 if (configuration.hasKey("MaxAggregateDistance")) │ │ │ │ +573 maxDistance = configuration.get("maxAggregateDistance"); │ │ │ │ +574 if (mode == "isotropic") │ │ │ │ +575 criterion.setDefaultValuesIsotropic(dim, maxDistance); │ │ │ │ +576 else if(mode == "anisotropic") │ │ │ │ +577 criterion.setDefaultValuesAnisotropic(dim, maxDistance); │ │ │ │ +578 else │ │ │ │ +579 DUNE_THROW(InvalidSolverFactoryConfiguration, "Parameter accumulationMode │ │ │ │ +does not allow value " │ │ │ │ +580 << mode <<"."); │ │ │ │ +581 } │ │ │ │ +582 │ │ │ │ +583 if (configuration.hasKey("maxAggregateDistance")) │ │ │ │ +584 criterion.setMaxDistance(configuration.get │ │ │ │ +("maxAggregateDistance")); │ │ │ │ +585 │ │ │ │ +586 if (configuration.hasKey("minAggregateSize")) │ │ │ │ +587 criterion.setMinAggregateSize(configuration.get │ │ │ │ +("minAggregateSize")); │ │ │ │ +588 │ │ │ │ +589 if (configuration.hasKey("maxAggregateSize")) │ │ │ │ +590 criterion.setMaxAggregateSize(configuration.get │ │ │ │ +("maxAggregateSize")); │ │ │ │ +591 │ │ │ │ +592 if (configuration.hasKey("maxAggregateConnectivity")) │ │ │ │ +593 criterion.setMaxConnectivity(configuration.get │ │ │ │ +("maxAggregateConnectivity")); │ │ │ │ +594 │ │ │ │ +595 if (configuration.hasKey ("alpha")) │ │ │ │ +596 criterion.setAlpha (configuration.get ("alpha")); │ │ │ │ +597 │ │ │ │ +598 if (configuration.hasKey ("beta")) │ │ │ │ +599 criterion.setBeta (configuration.get ("beta")); │ │ │ │ +600 │ │ │ │ +601 if (configuration.hasKey ("gamma")) │ │ │ │ +602 criterion.setGamma (configuration.get ("gamma")); │ │ │ │ +603 gamma_ = criterion.getGamma(); │ │ │ │ +604 │ │ │ │ +605 if (configuration.hasKey ("additive")) │ │ │ │ +606 criterion.setAdditive (configuration.get("additive")); │ │ │ │ +607 additive = criterion.getAdditive(); │ │ │ │ +608 │ │ │ │ +609 if (configuration.hasKey ("preSteps")) │ │ │ │ +610 criterion.setNoPreSmoothSteps (configuration.get │ │ │ │ +("preSteps")); │ │ │ │ +611 preSteps_ = criterion.getNoPreSmoothSteps (); │ │ │ │ +612 │ │ │ │ +613 if (configuration.hasKey ("postSteps")) │ │ │ │ +614 criterion.setNoPostSmoothSteps (configuration.get │ │ │ │ +("postSteps")); │ │ │ │ +615 postSteps_ = criterion.getNoPostSmoothSteps (); │ │ │ │ +616 │ │ │ │ +617 verbosity_ = configuration.get("verbosity", 0); │ │ │ │ +618 criterion.setDebugLevel (verbosity_); │ │ │ │ +619 │ │ │ │ +620 createHierarchies(criterion, matrixptr, pinfo); │ │ │ │ +621 } │ │ │ │ +622 │ │ │ │ +623 template │ │ │ │ +_6_2_5 struct _D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r │ │ │ │ +626 { │ │ │ │ +_6_2_7 typedef typename Matrix :: field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ +_6_2_8 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 }; │ │ │ │ +629 │ │ │ │ +_6_3_0 static constexpr _S_o_l_v_e_r_T_y_p_e _s_o_l_v_e_r = │ │ │ │ +631#if DISABLE_AMG_DIRECTSOLVER │ │ │ │ +632 _n_o_n_e; │ │ │ │ +633#elif HAVE_SUITESPARSE_UMFPACK │ │ │ │ +634 _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 ; │ │ │ │ +635#elif HAVE_SUPERLU │ │ │ │ +636 _s_u_p_e_r_l_u ; │ │ │ │ +637#else │ │ │ │ +638 _n_o_n_e; │ │ │ │ +639#endif │ │ │ │ +640 │ │ │ │ +641 template │ │ │ │ +_6_4_2 struct _S_o_l_v_e_r │ │ │ │ +643 { │ │ │ │ +_6_4_4 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_5 static _t_y_p_e* _c_r_e_a_t_e(const M& mat, bool verbose, bool reusevector ) │ │ │ │ +646 { │ │ │ │ +647 DUNE_THROW(NotImplemented,"DirectSolver not selected"); │ │ │ │ +648 return nullptr; │ │ │ │ +649 } │ │ │ │ +_6_5_0 static std::string _n_a_m_e () { return "None"; } │ │ │ │ +651 }; │ │ │ │ +652#if HAVE_SUITESPARSE_UMFPACK │ │ │ │ +653 template │ │ │ │ +654 struct Solver< M, _u_m_f_p_a_c_k > │ │ │ │ +655 { │ │ │ │ +656 typedef _U_M_F_P_a_c_k_<_ _M_ _> _t_y_p_e; │ │ │ │ +657 static _t_y_p_e* _c_r_e_a_t_e(const M& mat, bool verbose, bool reusevector ) │ │ │ │ +658 { │ │ │ │ +659 return new _t_y_p_e(mat, verbose, reusevector ); │ │ │ │ +660 } │ │ │ │ +661 static std::string _n_a_m_e () { return "UMFPack"; } │ │ │ │ +662 }; │ │ │ │ +663#endif │ │ │ │ +664#if HAVE_SUPERLU │ │ │ │ +665 template │ │ │ │ +_6_6_6 struct _S_o_l_v_e_r< M, _s_u_p_e_r_l_u > │ │ │ │ +667 { │ │ │ │ +_6_6_8 typedef _S_u_p_e_r_L_U_<_ _M_ _> _t_y_p_e; │ │ │ │ +_6_6_9 static _t_y_p_e* _c_r_e_a_t_e(const M& mat, bool verbose, bool reusevector ) │ │ │ │ +670 { │ │ │ │ +671 return new _t_y_p_e(mat, verbose, reusevector ); │ │ │ │ +672 } │ │ │ │ +_6_7_3 static std::string _n_a_m_e () { return "SuperLU"; } │ │ │ │ +674 }; │ │ │ │ +675#endif │ │ │ │ +676 │ │ │ │ +677 // define direct solver type to be used │ │ │ │ +_6_7_8 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_9 typedef typename SelectedSolver :: type _D_i_r_e_c_t_S_o_l_v_e_r; │ │ │ │ +_6_8_0 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_1 static std::string _n_a_m_e() { return SelectedSolver :: name (); } │ │ │ │ +_6_8_2 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& mat, bool verbose, bool │ │ │ │ +reusevector ) │ │ │ │ +683 { │ │ │ │ +684 return SelectedSolver :: create( mat, verbose, reusevector ); │ │ │ │ +685 } │ │ │ │ +686 }; │ │ │ │ +687 │ │ │ │ +688 template │ │ │ │ +689 template │ │ │ │ +690 void AMG::createHierarchies(C& criterion, │ │ │ │ +691 const std::shared_ptr& matrixptr, │ │ │ │ +692 const PI& pinfo) │ │ │ │ +693 { │ │ │ │ +694 Timer watch; │ │ │ │ +695 matrices_ = std::make_shared( │ │ │ │ +696 std::const_pointer_cast(matrixptr), │ │ │ │ +697 stackobject_to_shared_ptr(const_cast(pinfo))); │ │ │ │ +698 │ │ │ │ +699 matrices_->template build >(criterion); │ │ │ │ +700 │ │ │ │ +701 // build the necessary smoother hierarchies │ │ │ │ +702 matrices_->coarsenSmoother(*smoothers_, smootherArgs_); │ │ │ │ +703 │ │ │ │ +704 // test whether we should solve on the coarse level. That is the case if we │ │ │ │ +705 // have that level and if there was a redistribution on this level then our │ │ │ │ +706 // communicator has to be valid (size()>0) as the smoother might try to │ │ │ │ +communicate │ │ │ │ +707 // in the constructor. │ │ │ │ +708 if(buildHierarchy_ && matrices_->levels()==matrices_->maxlevels() │ │ │ │ +709 && ( ! matrices_->redistributeInformation().back().isSetup() || │ │ │ │ +710 matrices_->parallelInformation().coarsest().getRedistributed().communicator │ │ │ │ +().size() ) ) │ │ │ │ +711 { │ │ │ │ +712 // We have the carsest level. Create the coarse Solver │ │ │ │ +713 SmootherArgs sargs(smootherArgs_); │ │ │ │ +714 sargs.iterations = 1; │ │ │ │ +715 │ │ │ │ +716 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; │ │ │ │ +717 cargs.setArgs(sargs); │ │ │ │ +718 if(matrices_->redistributeInformation().back().isSetup()) { │ │ │ │ +719 // Solve on the redistributed partitioning │ │ │ │ +720 cargs.setMatrix(matrices_->matrices().coarsest().getRedistributed().getmat │ │ │ │ +()); │ │ │ │ +721 cargs.setComm(matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +()); │ │ │ │ +722 }else{ │ │ │ │ +723 cargs.setMatrix(matrices_->matrices().coarsest()->getmat()); │ │ │ │ +724 cargs.setComm(*matrices_->parallelInformation().coarsest()); │ │ │ │ +725 } │ │ │ │ +726 │ │ │ │ +727 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); │ │ │ │ +728 scalarProduct_ = _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>(cargs.getComm(),category()); │ │ │ │ +729 │ │ │ │ +730 typedef _D_i_r_e_c_t_S_o_l_v_e_r_S_e_l_e_c_t_o_r_<_ _t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_,_ _X_ _> SolverSelector; │ │ │ │ +731 │ │ │ │ +732 // Use superlu if we are purely sequential or with only one processor on │ │ │ │ +the coarsest level. │ │ │ │ +733 if( SolverSelector::isDirectSolver && │ │ │ │ +734 (std::is_same::value / │ │ │ │ +/ sequential mode │ │ │ │ +735 || matrices_->parallelInformation().coarsest()->communicator().size()==1 // │ │ │ │ +parallel mode and only one processor │ │ │ │ +736 || (matrices_->parallelInformation().coarsest().isRedistributed() │ │ │ │ +737 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +().communicator().size()==1 │ │ │ │ +738 && matrices_->parallelInformation().coarsest().getRedistributed │ │ │ │ +().communicator().size()>0) ) │ │ │ │ +739 ) │ │ │ │ +740 { // redistribute and 1 proc │ │ │ │ +741 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ +742 { │ │ │ │ +743 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ +744 { │ │ │ │ +745 // We are still participating on this level │ │ │ │ +746 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest │ │ │ │ +().getRedistributed().getmat(), false, false)); │ │ │ │ +747 } │ │ │ │ +748 else │ │ │ │ +749 solver_.reset(); │ │ │ │ +750 } │ │ │ │ +751 else │ │ │ │ +752 { │ │ │ │ +753 solver_.reset(SolverSelector::create(matrices_->matrices().coarsest()- │ │ │ │ +>getmat(), false, false)); │ │ │ │ +754 } │ │ │ │ +755 if(verbosity_>0 && matrices_->parallelInformation().coarsest()- │ │ │ │ +>communicator().rank()==0) │ │ │ │ +756 std::cout<< "Using a direct coarse solver (" << SolverSelector::name() << │ │ │ │ +")" << std::endl; │ │ │ │ +757 } │ │ │ │ +758 else │ │ │ │ +759 { │ │ │ │ +760 if(matrices_->parallelInformation().coarsest().isRedistributed()) │ │ │ │ +761 { │ │ │ │ +762 if(matrices_->matrices().coarsest().getRedistributed().getmat().N()>0) │ │ │ │ +763 // We are still participating on this level │ │ │ │ +764 │ │ │ │ +765 // we have to allocate these types using the rebound allocator │ │ │ │ +766 // in order to ensure that we fulfill the alignment requirements │ │ │ │ +767 solver_.reset(new BiCGSTABSolver(const_cast(matrices_->matrices │ │ │ │ +().coarsest().getRedistributed()), │ │ │ │ +768 *scalarProduct_, │ │ │ │ +769 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ +770 else │ │ │ │ +771 solver_.reset(); │ │ │ │ +772 }else │ │ │ │ +773 { │ │ │ │ +774 solver_.reset(new BiCGSTABSolver(const_cast(*matrices_->matrices │ │ │ │ +().coarsest()), │ │ │ │ +775 *scalarProduct_, │ │ │ │ +776 *coarseSmoother_, 1E-2, 1000, 0)); │ │ │ │ +777 // // we have to allocate these types using the rebound allocator │ │ │ │ +778 // // in order to ensure that we fulfill the alignment requirements │ │ │ │ +779 // using Alloc = typename std::allocator_traits::template │ │ │ │ +rebind_alloc>; │ │ │ │ +780 // Alloc alloc; │ │ │ │ +781 // auto p = alloc.allocate(1); │ │ │ │ +782 // std::allocator_traits::construct(alloc, p, │ │ │ │ +783 // const_cast(*matrices_->matrices().coarsest()), │ │ │ │ +784 // *scalarProduct_, │ │ │ │ +785 // *coarseSmoother_, 1E-2, 1000, 0); │ │ │ │ +786 // solver_.reset(p,[](BiCGSTABSolver* p){ │ │ │ │ +787 // Alloc alloc; │ │ │ │ +788 // std::allocator_traits::destroy(alloc, p); │ │ │ │ +789 // alloc.deallocate(p,1); │ │ │ │ +790 // }); │ │ │ │ +791 } │ │ │ │ +792 } │ │ │ │ +793 } │ │ │ │ +794 │ │ │ │ +795 if(verbosity_>0 && matrices_->parallelInformation().finest()->communicator │ │ │ │ +().rank()==0) │ │ │ │ +796 std::cout<<"Building hierarchy of "<maxlevels()<<" levels " │ │ │ │ +797 <<"(including coarse solver) took "< │ │ │ │ +_8_0_2 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) │ │ │ │ +803 { │ │ │ │ +804 // Detect Matrix rows where all offdiagonal entries are │ │ │ │ +805 // zero and set x such that A_dd*x_d=b_d │ │ │ │ +806 // Thus users can be more careless when setting up their linear │ │ │ │ +807 // systems. │ │ │ │ +808 typedef typename M::matrix_type _M_a_t_r_i_x; │ │ │ │ +809 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; │ │ │ │ +810 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; │ │ │ │ +811 typedef typename _M_a_t_r_i_x_:_:_b_l_o_c_k___t_y_p_e Block; │ │ │ │ +812 Block zero; │ │ │ │ +813 zero=typename _M_a_t_r_i_x_:_:_f_i_e_l_d___t_y_p_e(); │ │ │ │ +814 │ │ │ │ +815 const _M_a_t_r_i_x& mat=matrices_->matrices().finest()->getmat(); │ │ │ │ +816 for(RowIter row=mat._b_e_g_i_n(); row!=mat._e_n_d(); ++row) { │ │ │ │ +817 bool isDirichlet = true; │ │ │ │ +818 bool hasDiagonal = false; │ │ │ │ +819 Block diagonal{}; │ │ │ │ +820 for(ColIter _c_o_l=row->begin(); _c_o_l!=row->end(); ++_c_o_l) { │ │ │ │ +821 if(row.index()==_c_o_l.index()) { │ │ │ │ +822 diagonal = *_c_o_l; │ │ │ │ +823 hasDiagonal = true; │ │ │ │ +824 }else{ │ │ │ │ +825 if(*_c_o_l!=zero) │ │ │ │ +826 isDirichlet = false; │ │ │ │ +827 } │ │ │ │ +828 } │ │ │ │ +829 if(isDirichlet && hasDiagonal) │ │ │ │ +830 { │ │ │ │ +831 auto&& xEntry = Impl::asVector(x[row.index()]); │ │ │ │ +832 auto&& bEntry = Impl::asVector(b[row.index()]); │ │ │ │ +833 Impl::asMatrix(diagonal).solve(xEntry, bEntry); │ │ │ │ +834 } │ │ │ │ +835 } │ │ │ │ +836 │ │ │ │ +837 if(smoothers_->levels()>0) │ │ │ │ +838 smoothers_->finest()->pre(x,b); │ │ │ │ +839 else │ │ │ │ +840 // No smoother to make x consistent! Do it by hand │ │ │ │ +841 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ +842 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ +843 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ +844 update_ = std::make_shared>(std::make_shared │ │ │ │ +(x)); │ │ │ │ +845 matrices_->coarsenVector(*rhs_); │ │ │ │ +846 matrices_->coarsenVector(*lhs_); │ │ │ │ +847 matrices_->coarsenVector(*update_); │ │ │ │ +848 │ │ │ │ +849 // Preprocess all smoothers │ │ │ │ +850 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; │ │ │ │ +851 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; │ │ │ │ +852 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; │ │ │ │ +853 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ +854 Iterator smoother = smoothers_->finest(); │ │ │ │ +855 RIterator rhs = rhs_->finest(); │ │ │ │ +856 DIterator lhs = lhs_->finest(); │ │ │ │ +857 if(smoothers_->levels()>1) { │ │ │ │ +858 │ │ │ │ +859 assert(lhs_->levels()==rhs_->levels()); │ │ │ │ +860 assert(smoothers_->levels()==lhs_->levels() || matrices_->levels │ │ │ │ +()==matrices_->maxlevels()); │ │ │ │ +861 assert(smoothers_->levels()+1==lhs_->levels() || matrices_->levels │ │ │ │ +()maxlevels()); │ │ │ │ +862 │ │ │ │ +863 if(smoother!=coarsest) │ │ │ │ +864 for(++smoother, ++lhs, ++rhs; smoother != coarsest; ++smoother, ++lhs, │ │ │ │ +++rhs) │ │ │ │ +865 smoother->pre(*lhs,*rhs); │ │ │ │ +866 smoother->pre(*lhs,*rhs); │ │ │ │ +867 } │ │ │ │ +868 │ │ │ │ +869 │ │ │ │ +870 // The preconditioner might change x and b. So we have to │ │ │ │ +871 // copy the changes to the original vectors. │ │ │ │ +872 x = *lhs_->finest(); │ │ │ │ +873 b = *rhs_->finest(); │ │ │ │ +874 │ │ │ │ +875 } │ │ │ │ +876 template │ │ │ │ +_8_7_7 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ +878 { │ │ │ │ +879 return matrices_->levels(); │ │ │ │ +880 } │ │ │ │ +881 template │ │ │ │ +_8_8_2 std::size_t _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ +883 { │ │ │ │ +884 return matrices_->maxlevels(); │ │ │ │ +885 } │ │ │ │ +886 │ │ │ │ +888 template │ │ │ │ +_8_8_9 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) │ │ │ │ +890 { │ │ │ │ +891 LevelContext levelContext; │ │ │ │ +892 │ │ │ │ +893 if(additive) { │ │ │ │ +894 *(rhs_->finest())=d; │ │ │ │ +895 additiveMgc(); │ │ │ │ +896 v=*lhs_->finest(); │ │ │ │ +897 }else{ │ │ │ │ +898 // Init all iterators for the current level │ │ │ │ +899 initIteratorsWithFineLevel(levelContext); │ │ │ │ +900 │ │ │ │ +901 │ │ │ │ +902 *levelContext._l_h_s = v; │ │ │ │ +903 *levelContext._r_h_s = d; │ │ │ │ +904 *levelContext._u_p_d_a_t_e=0; │ │ │ │ +905 levelContext._l_e_v_e_l=0; │ │ │ │ +906 │ │ │ │ +907 mgc(levelContext); │ │ │ │ +908 │ │ │ │ +909 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ +910 levelContext._p_i_n_f_o->copyOwnerToAll(*levelContext._u_p_d_a_t_e, │ │ │ │ +*levelContext._u_p_d_a_t_e); │ │ │ │ +911 │ │ │ │ +912 v=*levelContext._u_p_d_a_t_e; │ │ │ │ +913 } │ │ │ │ +914 │ │ │ │ +915 } │ │ │ │ +916 │ │ │ │ +917 template │ │ │ │ +918 void AMG::initIteratorsWithFineLevel(LevelContext& │ │ │ │ +levelContext) │ │ │ │ +919 { │ │ │ │ +920 levelContext.smoother = smoothers_->finest(); │ │ │ │ +921 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ +922 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ +923 levelContext.redist = │ │ │ │ +924 matrices_->redistributeInformation().begin(); │ │ │ │ +925 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ +926 levelContext.lhs = lhs_->finest(); │ │ │ │ +927 levelContext.update = update_->finest(); │ │ │ │ +928 levelContext.rhs = rhs_->finest(); │ │ │ │ +929 } │ │ │ │ +930 │ │ │ │ +931 template │ │ │ │ +932 bool AMG │ │ │ │ +933 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ +934 { │ │ │ │ +935 │ │ │ │ +936 bool processNextLevel=true; │ │ │ │ +937 │ │ │ │ +938 if(levelContext.redist->isSetup()) { │ │ │ │ +939 levelContext.redist->redistribute(static_cast │ │ │ │ +(*levelContext.rhs), │ │ │ │ +940 levelContext.rhs.getRedistributed()); │ │ │ │ +941 processNextLevel = levelContext.rhs.getRedistributed().size()>0; │ │ │ │ +942 if(processNextLevel) { │ │ │ │ +943 //restrict defect to coarse level right hand side. │ │ │ │ +944 typename Hierarchy::Iterator fineRhs = levelContext.rhs++; │ │ │ │ +945 ++levelContext.pinfo; │ │ │ │ +946 Transfer │ │ │ │ +947 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ +948 static_cast(fineRhs.getRedistributed()), │ │ │ │ +949 *levelContext.pinfo); │ │ │ │ +950 } │ │ │ │ +951 }else{ │ │ │ │ +952 //restrict defect to coarse level right hand side. │ │ │ │ +953 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r fineRhs = levelContext.rhs++; │ │ │ │ +954 ++levelContext.pinfo; │ │ │ │ +955 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +956_ _:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(*(*levelContext.aggregates), │ │ │ │ +957 *levelContext.rhs, static_cast(*fineRhs), │ │ │ │ +958 *levelContext.pinfo); │ │ │ │ +959 } │ │ │ │ +960 │ │ │ │ +961 if(processNextLevel) { │ │ │ │ +962 // prepare coarse system │ │ │ │ +963 ++levelContext.lhs; │ │ │ │ +964 ++levelContext.update; │ │ │ │ +965 ++levelContext.matrix; │ │ │ │ +966 ++levelContext.level; │ │ │ │ +967 ++levelContext.redist; │ │ │ │ +968 │ │ │ │ +969 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +970 // next level is not the globally coarsest one │ │ │ │ +971 ++levelContext.smoother; │ │ │ │ +972 ++levelContext.aggregates; │ │ │ │ +973 } │ │ │ │ +974 // prepare the update on the next level │ │ │ │ +975 *levelContext.update=0; │ │ │ │ +976 } │ │ │ │ +977 return processNextLevel; │ │ │ │ +978 } │ │ │ │ +979 │ │ │ │ +980 template │ │ │ │ +981 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_> │ │ │ │ +982_ _:_:_m_o_v_e_T_o_F_i_n_e_L_e_v_e_l(LevelContext& levelContext, bool processNextLevel) │ │ │ │ +983 { │ │ │ │ +984 if(processNextLevel) { │ │ │ │ +985 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +986 // previous level is not the globally coarsest one │ │ │ │ +987 --levelContext.smoother; │ │ │ │ +988 --levelContext.aggregates; │ │ │ │ +989 } │ │ │ │ +990 --levelContext.redist; │ │ │ │ +991 --levelContext.level; │ │ │ │ +992 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ +993 --levelContext.matrix; │ │ │ │ +994 │ │ │ │ +995 //typename Hierarchy::Iterator coarseLhs = lhs--; │ │ │ │ +996 --levelContext.lhs; │ │ │ │ +997 --levelContext.pinfo; │ │ │ │ +998 } │ │ │ │ +999 if(levelContext.redist->isSetup()) { │ │ │ │ +1000 // Need to redistribute during prolongateVector │ │ │ │ +1001 levelContext.lhs.getRedistributed()=0; │ │ │ │ +1002 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +1003_ _:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ +*levelContext.lhs, │ │ │ │ +1004 levelContext.lhs.getRedistributed(), │ │ │ │ +1005 matrices_->getProlongationDampingFactor(), │ │ │ │ +1006 *levelContext.pinfo, *levelContext.redist); │ │ │ │ +1007 }else{ │ │ │ │ +1008 *levelContext.lhs=0; │ │ │ │ +1009 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +1010_ _:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(*(*levelContext.aggregates), *levelContext.update, │ │ │ │ +*levelContext.lhs, │ │ │ │ +1011 matrices_->getProlongationDampingFactor(), │ │ │ │ +1012 *levelContext.pinfo); │ │ │ │ +1013 } │ │ │ │ +1014 │ │ │ │ +1015 │ │ │ │ +1016 if(processNextLevel) { │ │ │ │ +1017 --levelContext.update; │ │ │ │ +1018 --levelContext.rhs; │ │ │ │ +1019 } │ │ │ │ +1020 │ │ │ │ +1021 *levelContext.update += *levelContext.lhs; │ │ │ │ +1022 } │ │ │ │ +1023 │ │ │ │ +1024 template │ │ │ │ +_1_0_2_5 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 │ │ │ │ +1026 { │ │ │ │ +1027 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; │ │ │ │ +1028 } │ │ │ │ +1029 │ │ │ │ +1030 template │ │ │ │ +1031 void AMG::mgc(LevelContext& levelContext){ │ │ │ │ +1032 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ +()==maxlevels()) { │ │ │ │ +1033 // Solve directly │ │ │ │ +1034 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ +1035 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ +1036 if(levelContext.redist->isSetup()) { │ │ │ │ +1037 levelContext.redist->redistribute(*levelContext.rhs, │ │ │ │ +levelContext.rhs.getRedistributed()); │ │ │ │ +1038 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ +1039 // We are still participating in the computation │ │ │ │ +1040 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ +(levelContext.rhs.getRedistributed(), │ │ │ │ +1041 levelContext.rhs.getRedistributed()); │ │ │ │ +1042 solver_->apply(levelContext.update.getRedistributed(), │ │ │ │ +1043 levelContext.rhs.getRedistributed(), res); │ │ │ │ +1044 } │ │ │ │ +1045 levelContext.redist->redistributeBackward(*levelContext.update, │ │ │ │ +levelContext.update.getRedistributed()); │ │ │ │ +1046 levelContext.pinfo->copyOwnerToAll(*levelContext.update, │ │ │ │ +*levelContext.update); │ │ │ │ +1047 }else{ │ │ │ │ +1048 levelContext.pinfo->copyOwnerToAll(*levelContext.rhs, *levelContext.rhs); │ │ │ │ +1049 solver_->apply(*levelContext.update, *levelContext.rhs, res); │ │ │ │ +1050 } │ │ │ │ +1051 │ │ │ │ +1052 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ +1053 coarsesolverconverged = false; │ │ │ │ +1054 }else{ │ │ │ │ +1055 // presmoothing │ │ │ │ +1056 _p_r_e_s_m_o_o_t_h(levelContext, preSteps_); │ │ │ │ +1057 │ │ │ │ +1058#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ +1059 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ +1060 │ │ │ │ +1061 if(processNextLevel) { │ │ │ │ +1062 // next level │ │ │ │ +1063 for(std::size_t i=0; imatrices().coarsest() && levels │ │ │ │ +()==maxlevels()) │ │ │ │ +1066 break; │ │ │ │ +1067 if(i+1 < gamma_){ │ │ │ │ +1068 levelContext.matrix->applyscaleadd(-1., *levelContext.lhs, │ │ │ │ +*levelContext.rhs); │ │ │ │ +1069 } │ │ │ │ +1070 } │ │ │ │ +1071 } │ │ │ │ +1072 │ │ │ │ +1073 moveToFineLevel(levelContext, processNextLevel); │ │ │ │ +1074#else │ │ │ │ +1075 *lhs=0; │ │ │ │ +1076#endif │ │ │ │ +1077 │ │ │ │ +1078 if(levelContext.matrix == matrices_->matrices().finest()) { │ │ │ │ +1079 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ +>communicator().prod(coarsesolverconverged); │ │ │ │ +1080 if(!coarsesolverconverged) │ │ │ │ +1081 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ +1082 } │ │ │ │ +1083 // postsmoothing │ │ │ │ +1084 _p_o_s_t_s_m_o_o_t_h(levelContext, postSteps_); │ │ │ │ +1085 │ │ │ │ +1086 } │ │ │ │ +1087 } │ │ │ │ +1088 │ │ │ │ +1089 template │ │ │ │ +1090 void AMG::additiveMgc(){ │ │ │ │ +1091 │ │ │ │ +1092 // restrict residual to all levels │ │ │ │ +1093 typename ParallelInformationHierarchy::Iterator pinfo=matrices_- │ │ │ │ +>parallelInformation().finest(); │ │ │ │ +1094 typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r rhs=rhs_->finest(); │ │ │ │ +1095 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 lhs = lhs_->finest(); │ │ │ │ +1096 typename OperatorHierarchy::AggregatesMapList::const_iterator │ │ │ │ +aggregates=matrices_->aggregatesMaps().begin(); │ │ │ │ +1097 │ │ │ │ +1098 for(typename _H_i_e_r_a_r_c_h_y_<_R_a_n_g_e_,_A_>_:_:_I_t_e_r_a_t_o_r fineRhs=rhs++; fineRhs != rhs_- │ │ │ │ +>coarsest(); fineRhs=rhs++, ++aggregates) { │ │ │ │ +1099 ++pinfo; │ │ │ │ +1100 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +1101_ _:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(*(*aggregates), *rhs, static_cast │ │ │ │ +(*fineRhs), *pinfo); │ │ │ │ +1102 } │ │ │ │ +1103 │ │ │ │ +1104 // pinfo is invalid, set to coarsest level │ │ │ │ +1105 //pinfo = matrices_->parallelInformation().coarsest │ │ │ │ +1106 // calculate correction for all levels │ │ │ │ +1107 lhs = lhs_->finest(); │ │ │ │ +1108 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 smoother = smoothers_->finest(); │ │ │ │ +1109 │ │ │ │ +1110 for(rhs=rhs_->finest(); rhs != rhs_->coarsest(); ++lhs, ++rhs, ++smoother) │ │ │ │ +{ │ │ │ │ +1111 // presmoothing │ │ │ │ +1112 *lhs=0; │ │ │ │ +1113 smoother->apply(*lhs, *rhs); │ │ │ │ +1114 } │ │ │ │ +1115 │ │ │ │ +1116 // Coarse level solve │ │ │ │ +1117#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ +1118 InverseOperatorResult res; │ │ │ │ +1119 pinfo->copyOwnerToAll(*rhs, *rhs); │ │ │ │ +1120 solver_->apply(*lhs, *rhs, res); │ │ │ │ +1121 │ │ │ │ +1122 if(!res.converged) │ │ │ │ +1123 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ +1124#else │ │ │ │ +1125 *lhs=0; │ │ │ │ +1126#endif │ │ │ │ +1127 // Prologate and add up corrections from all levels │ │ │ │ +1128 --pinfo; │ │ │ │ +1129 --aggregates; │ │ │ │ +1130 │ │ │ │ +1131 for(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 coarseLhs = lhs--; coarseLhs != │ │ │ │ +lhs_->finest(); coarseLhs = lhs--, --aggregates, --pinfo) { │ │ │ │ +1132 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +1133_ _:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(*(*aggregates), *coarseLhs, *lhs, 1.0, *pinfo); │ │ │ │ +1134 } │ │ │ │ +1135 } │ │ │ │ +1136 │ │ │ │ +1137 │ │ │ │ +1139 template │ │ │ │ +_1_1_4_0 void _A_M_G_<_M_,_X_,_S_,_P_I_,_A_>_:_:_p_o_s_t([[maybe_unused]] _D_o_m_a_i_n& x) │ │ │ │ +1141 { │ │ │ │ +1142 // Postprocess all smoothers │ │ │ │ +1143 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; │ │ │ │ +1144 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; │ │ │ │ +1145 Iterator coarsest = smoothers_->coarsest(); │ │ │ │ +1146 Iterator smoother = smoothers_->finest(); │ │ │ │ +1147 DIterator lhs = lhs_->finest(); │ │ │ │ +1148 if(smoothers_->levels()>0) { │ │ │ │ +1149 if(smoother != coarsest || matrices_->levels()maxlevels()) │ │ │ │ +1150 smoother->post(*lhs); │ │ │ │ +1151 if(smoother!=coarsest) │ │ │ │ +1152 for(++smoother, ++lhs; smoother != coarsest; ++smoother, ++lhs) │ │ │ │ +1153 smoother->post(*lhs); │ │ │ │ +1154 smoother->post(*lhs); │ │ │ │ +1155 } │ │ │ │ +1156 lhs_ = nullptr; │ │ │ │ +1157 update_ = nullptr; │ │ │ │ +1158 rhs_ = nullptr; │ │ │ │ +1159 } │ │ │ │ +1160 │ │ │ │ +1161 template │ │ │ │ +1162 template │ │ │ │ +_1_1_6_3 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) │ │ │ │ +1164 { │ │ │ │ +1165 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ +1166 } │ │ │ │ +1167 │ │ │ │ +1168 } // end namespace Amg │ │ │ │ +1169 │ │ │ │ +_1_1_7_0 struct _A_M_G_C_r_e_a_t_o_r{ │ │ │ │ +_1_1_7_1 template struct _i_s_V_a_l_i_d_M_a_t_r_i_x : std::false_type{}; │ │ │ │ +_1_1_7_2 template struct │ │ │ │ +_i_s_V_a_l_i_d_M_a_t_r_i_x<_B_C_R_S_M_a_t_r_i_x<_F_i_e_l_d_M_a_t_r_i_x, A>> : std::true_type{}; │ │ │ │ +1173 │ │ │ │ +1174 template │ │ │ │ +1175 std::shared_ptr > │ │ │ │ +_1_1_7_6 _m_a_k_e_A_M_G(const OP& op, const std::string& smoother, const Dune:: │ │ │ │ +ParameterTree& config) const │ │ │ │ +1177 { │ │ │ │ +1178 DUNE_THROW(Dune::Exception, "Operator type not supported by AMG"); │ │ │ │ +1179 } │ │ │ │ +1180 │ │ │ │ +1181 template │ │ │ │ +1182 std::shared_ptr > │ │ │ │ +_1_1_8_3 _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, │ │ │ │ +1184 const Dune::ParameterTree& config) const │ │ │ │ +1185 { │ │ │ │ +1186 using OP = _M_a_t_r_i_x_A_d_a_p_t_e_r_<_M_,_X_,_Y_>; │ │ │ │ +1187 │ │ │ │ +1188 if(smoother == "ssor") │ │ │ │ +1189 return std::make_shared>>(op, config); │ │ │ │ +1190 if(smoother == "sor") │ │ │ │ +1191 return std::make_shared>>(op, config); │ │ │ │ +1192 if(smoother == "jac") │ │ │ │ +1193 return std::make_shared>>(op, config); │ │ │ │ +1194 if(smoother == "gs") │ │ │ │ +1195 return std::make_shared>>(op, config); │ │ │ │ +1196 if(smoother == "ilu") │ │ │ │ +1197 return std::make_shared>>(op, config); │ │ │ │ +1198 else │ │ │ │ +1199 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ +1200 } │ │ │ │ +1201 │ │ │ │ +1202 template │ │ │ │ +1203 std::shared_ptr > │ │ │ │ +_1_2_0_4 _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, │ │ │ │ +1205 const Dune::ParameterTree& config) const │ │ │ │ +1206 { │ │ │ │ +1207 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_>; │ │ │ │ +1208 │ │ │ │ +1209 auto cop = std::static_pointer_cast(op); │ │ │ │ +1210 │ │ │ │ +1211 if(smoother == "ssor") │ │ │ │ +1212 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1213 if(smoother == "sor") │ │ │ │ +1214 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1215 if(smoother == "jac") │ │ │ │ +1216 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1217 if(smoother == "gs") │ │ │ │ +1218 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1219 if(smoother == "ilu") │ │ │ │ +1220 return std::make_shared>,C>>(cop, config, op->getCommunication │ │ │ │ +()); │ │ │ │ +1221 else │ │ │ │ +1222 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ +1223 } │ │ │ │ +1224 │ │ │ │ +1225 template │ │ │ │ +1226 std::shared_ptr > │ │ │ │ +_1_2_2_7 _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, │ │ │ │ +1228 const Dune::ParameterTree& config) const │ │ │ │ +1229 { │ │ │ │ +1230 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_>; │ │ │ │ +1231 │ │ │ │ +1232 if(smoother == "ssor") │ │ │ │ +1233 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1234 if(smoother == "sor") │ │ │ │ +1235 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1236 if(smoother == "jac") │ │ │ │ +1237 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1238 if(smoother == "gs") │ │ │ │ +1239 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1240 if(smoother == "ilu") │ │ │ │ +1241 return std::make_shared>,C>>(op, config, op- │ │ │ │ +>getCommunication()); │ │ │ │ +1242 else │ │ │ │ +1243 DUNE_THROW(Dune::Exception, "Unknown smoother for AMG"); │ │ │ │ +1244 } │ │ │ │ +1245 │ │ │ │ +1246 template │ │ │ │ +1247 std::shared_ptr<_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r> │ │ │ │ +_1_2_4_9 _o_p_e_r_a_t_o_r_(_)_ (OpTraits opTraits, const std::shared_ptr& op, const Dune:: │ │ │ │ +ParameterTree& config, │ │ │ │ +1250 std::enable_if_t<_i_s_V_a_l_i_d_M_a_t_r_i_x_<_t_y_p_e_n_a_m_e_ _O_p_T_r_a_i_t_s_:_:_m_a_t_r_i_x___t_y_p_e_>_:_:_v_a_l_u_e,int> │ │ │ │ += 0) const │ │ │ │ +1251 { │ │ │ │ +1252 using field_type = typename OpTraits::matrix_type::field_type; │ │ │ │ +1253 using real_type = typename FieldTraits::real_type; │ │ │ │ +1254 if (!std::is_convertible()) │ │ │ │ +1255 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "AMG needs field_type(" << │ │ │ │ +1256 className() << │ │ │ │ +1257 ") to be convertible to its real_type (" << │ │ │ │ +1258 className() << │ │ │ │ +1259 ")."); │ │ │ │ +1260 std::string smoother = config.get("smoother", "ssor"); │ │ │ │ +1261 // we can irgnore the OpTraits here. As the AMG can only work │ │ │ │ +1262 // with actual matrices, the operator op must be of type │ │ │ │ +1263 // MatrixAdapter or *SchwarzOperator. In any case these │ │ │ │ +1264 // operators provide all necessary information about matrix, │ │ │ │ +1265 // domain and range type │ │ │ │ +1266 return _m_a_k_e_A_M_G(op, smoother, config); │ │ │ │ +1267 } │ │ │ │ +1268 │ │ │ │ +1269 template │ │ │ │ +1270 std::shared_ptr<_D_u_n_e_:_:_P_r_e_c_o_n_d_i_t_i_o_n_e_r> │ │ │ │ +_1_2_7_2 _o_p_e_r_a_t_o_r_(_)_ (OpTraits opTraits, const std::shared_ptr& op, const Dune:: │ │ │ │ +ParameterTree& config, │ │ │ │ +1273 std::enable_if_t_:_: │ │ │ │ +_v_a_l_u_e,int> = 0) const │ │ │ │ +1274 { │ │ │ │ +1275 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"); │ │ │ │ +1276 } │ │ │ │ +1277 }; │ │ │ │ +1278 │ │ │ │ +_1_2_7_9 _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()); │ │ │ │ +1280} // end namespace Dune │ │ │ │ +1281 │ │ │ │ +1282#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. │ │ │ │ +_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:13 │ │ │ │ +_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. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_A_M_G │ │ │ │ +AMG(const AMG &amg) │ │ │ │ +Copy constructor. │ │ │ │ +DDeeffiinniittiioonn amg.hh:393 │ │ │ │ +_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:802 │ │ │ │ +_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:682 │ │ │ │ +_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 OpTraits::domain_type, typename │ │ │ │ +OpTraits::range_type > > operator()(OpTraits opTraits, const std::shared_ptr< │ │ │ │ +OP > &op, const Dune::ParameterTree &config, std::enable_if_t< isValidMatrix< │ │ │ │ +typename OpTraits::matrix_type >::value, int >=0) const │ │ │ │ +DDeeffiinniittiioonn amg.hh:1249 │ │ │ │ +_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:681 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments │ │ │ │ +DDeeffiinniittiioonn smoother.hh:67 │ │ │ │ +_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:304 │ │ │ │ +_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:308 │ │ │ │ +_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:673 │ │ │ │ +_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:1025 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_D_o_m_a_i_n │ │ │ │ +X Domain │ │ │ │ +The domain type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:88 │ │ │ │ +_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 &) │ │ │ │ +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_:_:_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:645 │ │ │ │ +_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:407 │ │ │ │ +_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:453 │ │ │ │ +_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:288 │ │ │ │ +_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:628 │ │ │ │ +_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:296 │ │ │ │ +_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:101 │ │ │ │ +_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:678 │ │ │ │ +_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:1183 │ │ │ │ +_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:379 │ │ │ │ +_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:1176 │ │ │ │ +_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:98 │ │ │ │ +_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:650 │ │ │ │ +_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:280 │ │ │ │ +_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:74 │ │ │ │ +_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:284 │ │ │ │ +_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:668 │ │ │ │ +_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:669 │ │ │ │ +_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:292 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_R_a_n_g_e │ │ │ │ +X Range │ │ │ │ +The range type. │ │ │ │ +DDeeffiinniittiioonn amg.hh:90 │ │ │ │ +_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:1163 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() │ │ │ │ +DDeeffiinniittiioonn amg.hh:877 │ │ │ │ +_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:644 │ │ │ │ +_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:1204 │ │ │ │ +_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:300 │ │ │ │ +_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:630 │ │ │ │ +_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:680 │ │ │ │ +_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:222 │ │ │ │ +_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_:_:_R_e_l_a_x_a_t_i_o_n_F_a_c_t_o_r │ │ │ │ +FieldTraits< T >::real_type RelaxationFactor │ │ │ │ +The type of the relaxation factor. │ │ │ │ +DDeeffiinniittiioonn smoother.hh:42 │ │ │ │ +_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: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_:_:_D_i_r_e_c_t_S_o_l_v_e_r │ │ │ │ +SelectedSolver::type DirectSolver │ │ │ │ +DDeeffiinniittiioonn amg.hh:679 │ │ │ │ +_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:85 │ │ │ │ +_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:92 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_:_:_p_o_s_t │ │ │ │ +void post(Domain &x) │ │ │ │ +Clean up. │ │ │ │ +DDeeffiinniittiioonn amg.hh:1140 │ │ │ │ +_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:882 │ │ │ │ +_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:1227 │ │ │ │ +_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:312 │ │ │ │ +_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:429 │ │ │ │ +_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:889 │ │ │ │ +_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:276 │ │ │ │ +_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:83 │ │ │ │ +_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:195 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _>_:_:_K_A_M_G │ │ │ │ +friend class KAMG │ │ │ │ +DDeeffiinniittiioonn amg.hh:68 │ │ │ │ +_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:81 │ │ │ │ +_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:628 │ │ │ │ +_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:628 │ │ │ │ +_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:628 │ │ │ │ +_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_:_:_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_:_:_c_o_l │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ +_D_u_n_e_:_:_t_y_p_e │ │ │ │ +const Dtype_t BaseGetSuperLUType< T >::type │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:135 │ │ │ │ +_D_u_n_e_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ _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:467 │ │ │ │ -_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:68 │ │ │ │ +_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_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator │ │ │ │ +Const iterator over the matrix rows. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:586 │ │ │ │ +_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_:_:_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:135 │ │ │ │ +_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:381 │ │ │ │ +_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:465 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:486 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:502 │ │ │ │ +_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:525 │ │ │ │ +_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:545 │ │ │ │ +_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:66 │ │ │ │ +_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: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_:_:_S_o_l_v_e_r │ │ │ │ +DDeeffiinniittiioonn amg.hh:643 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r │ │ │ │ +DDeeffiinniittiioonn amg.hh:1170 │ │ │ │ +_D_u_n_e_:_:_A_M_G_C_r_e_a_t_o_r_:_:_i_s_V_a_l_i_d_M_a_t_r_i_x │ │ │ │ +DDeeffiinniittiioonn amg.hh:1171 │ │ │ │ +_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 │ │ │ │ +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_:_:_I_t_e_r_a_t_o_r │ │ │ │ +LevelIterator< Hierarchy< T, A >, T > Iterator │ │ │ │ +Type of the mutable iterator. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:220 │ │ │ │ +_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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _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 │ │ │ │ +Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ +ParallelInformationHierarchy │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:82 │ │ │ │ +_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_:_:_T_r_a_n_s_f_e_r │ │ │ │ +DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ _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 │ │ │ │ +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_<_ _X_,_ _X_ _>_:_:_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_<_ _X_,_ _X_ _>_:_:_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_<_ _X_,_ _X_ _>_:_:_s_c_a_l_a_r___r_e_a_l___t_y_p_e │ │ │ │ -Simd::Scalar< real_type > scalar_real_type │ │ │ │ -DDeeffiinniittiioonn solver.hh:116 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _X_,_ _X_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -X range_type │ │ │ │ -DDeeffiinniittiioonn solver.hh:107 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _X_,_ _X_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -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_<_ _X_,_ _X_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -DDeeffiinniittiioonn solver.hh:110 │ │ │ │ -_D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_<_ _X_,_ _X_ _>_:_:_r_e_a_l___t_y_p_e │ │ │ │ -FieldTraits< field_type >::real_type real_type │ │ │ │ -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_:_:_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -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_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_:_:___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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &x, X &b, double reduction, InverseOperatorResult &res) override │ │ │ │ -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_:_:_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_:_:_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:97 │ │ │ │ _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_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:53 │ │ │ │ +_D_u_n_e_:_:_U_M_F_P_a_c_k │ │ │ │ +The UMFPack direct sparse solver. │ │ │ │ +DDeeffiinniittiioonn umfpack.hh:265 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,60 +66,62 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::ParSSOR< M, X, Y, C >
 A parallel SSOR preconditioner. More...
class  Dune::BlockPreconditioner< X, Y, C, P >
 Block parallel preconditioner. 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::Amg::PropertyGraphVertexPropertyMap< G, i >
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,38 +1,47 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_P_a_r_S_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _C_ _> │ │ │ │ -  A parallel SSOR preconditioner. _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_:_:_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_ _>_ _> │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,305 +66,491 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ -
53
│ │ │ -
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 {
│ │ │ +
30
│ │ │ +
│ │ │ + │ │ │ +
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 void apply (const X& x, Y& y) const override
│ │ │ -
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 void applyscaleadd (field_type alpha, const X& x, Y& y) const override
│ │ │ -
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 const matrix_type& getmat () const override
│ │ │ -
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
│ │ │ -
156
│ │ │ -
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 void pre (X& x, [[maybe_unused]] Y& b) override
│ │ │ -
207 {
│ │ │ -
208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ -
209 }
│ │ │ -
│ │ │ -
210
│ │ │ -
│ │ │ -
216 void apply (X& v, const Y& d) override
│ │ │ -
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 }
│ │ │ -
│ │ │ -
224
│ │ │ -
230 void post ([[maybe_unused]] X& x) override {}
│ │ │ -
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 void pre (X& x, Y& b) override
│ │ │ -
327 {
│ │ │ -
328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent
│ │ │ -
329 _preconditioner->pre(x,b);
│ │ │ +
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
│ │ │ +
225 enum {
│ │ │ + │ │ │ +
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 void apply (X& v, const Y& d) override
│ │ │ -
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 void post (X& x) override
│ │ │ -
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
│ │ │ -
375
│ │ │ -
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
│ │ │ +
331
│ │ │ +
│ │ │ +
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:115
│ │ │ +
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
│ │ │ +
@ 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
│ │ │ +
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 novlpschwarz.hh:256
│ │ │ -
Traits class for generically constructing non default constructable types.
Definition construction.hh:39
│ │ │ -
A linear operator exporting itself in matrix form.
Definition operators.hh:110
│ │ │ -
const matrix_type & getmat() const override
get the sequential assembled linear operator.
Definition schwarz.hh:133
│ │ │ -
const communication_type & getCommunication() const
Get the object responsible for communication.
Definition schwarz.hh:146
│ │ │ -
void apply(const X &x, Y &y) const override
apply operator to x:
Definition schwarz.hh:116
│ │ │ -
void applyscaleadd(field_type alpha, const X &x, Y &y) const override
apply operator to x, scale and add:
Definition schwarz.hh:125
│ │ │ -
C communication_type
The type of the communication object.
Definition schwarz.hh:98
│ │ │ -
SolverCategory::Category category() const override
Category of the linear operator (see SolverCategory::Category).
Definition schwarz.hh:139
│ │ │ -
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
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
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
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition schwarz.hh:206
│ │ │ -
ParSSOR(const matrix_type &A, int n, field_type w, const communication_type &c)
Constructor.
Definition schwarz.hh:197
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition schwarz.hh:233
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition schwarz.hh:216
│ │ │ -
void post(X &x) override
Clean up.
Definition schwarz.hh:230
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition schwarz.hh:361
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition schwarz.hh:326
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition schwarz.hh:337
│ │ │ - │ │ │ -
BlockPreconditioner(const std::shared_ptr< P > &p, const communication_type &c)
Constructor.
Definition schwarz.hh:317
│ │ │ -
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
│ │ │ -
void post(X &x) override
Clean up.
Definition schwarz.hh:355
│ │ │ - │ │ │ -
X::field_type field_type
Definition schwarz.hh:292
│ │ │ - │ │ │ -
Category
Definition solvercategory.hh:23
│ │ │ -
@ overlapping
Category for overlapping solvers.
Definition solvercategory.hh:29
│ │ │ +
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,386 +1,572 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ -53 │ │ │ │ -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 _A_m_g │ │ │ │ +20 { │ │ │ │ +30 │ │ │ │ +_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 void _a_p_p_l_y (const X& x, Y& y) const override │ │ │ │ -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 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 override │ │ │ │ -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 const _m_a_t_r_i_x___t_y_p_e& _g_e_t_m_a_t () const override │ │ │ │ -134 { │ │ │ │ -135 return *_A_; │ │ │ │ -136 } │ │ │ │ -137 │ │ │ │ -_1_3_9 _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 │ │ │ │ -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 │ │ │ │ -156 │ │ │ │ -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 void _p_r_e (X& x, [[maybe_unused]] Y& b) override │ │ │ │ -207 { │ │ │ │ -208 communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ -209 } │ │ │ │ -210 │ │ │ │ -_2_1_6 void _a_p_p_l_y (X& v, const Y& d) override │ │ │ │ -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 void _p_o_s_t ([[maybe_unused]] X& x) override {} │ │ │ │ -231 │ │ │ │ -_2_3_3 _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 │ │ │ │ -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 _A_m_g │ │ │ │ -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 _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 >; │ │ │ │ -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 void _p_r_e (X& x, Y& b) override │ │ │ │ -327 { │ │ │ │ -328 _communication.copyOwnerToAll(x,x); // make dirichlet values consistent │ │ │ │ -329 _preconditioner->pre(x,b); │ │ │ │ +225 enum { │ │ │ │ +_2_2_7 _i_n_d_e_x = i │ │ │ │ +228 }; │ │ │ │ +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<_A_m_g::VertexVisitedTag,_A_m_g_:_: │ │ │ │ +_P_r_o_p_e_r_t_i_e_s_G_r_a_p_h > │ │ │ │ +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_>, _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> _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 _a_p_p_l_y_<_f_o_r_w_a_r_d_>(v,d); │ │ │ │ -347 _communication.copyOwnerToAll(v,v); │ │ │ │ -348 } │ │ │ │ -349 │ │ │ │ -_3_5_5 void _p_o_s_t (X& x) override │ │ │ │ -356 { │ │ │ │ -357 _preconditioner->post(x); │ │ │ │ -358 } │ │ │ │ -359 │ │ │ │ -_3_6_1 _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 │ │ │ │ -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 │ │ │ │ -375 │ │ │ │ -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 │ │ │ │ +_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 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 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 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:115 │ │ │ │ +_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_:_:_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_:_:_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_ _>_:_:_i_n_d_e_x │ │ │ │ +@ index │ │ │ │ +DDeeffiinniittiioonn dependency.hh:227 │ │ │ │ +_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 │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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 │ │ │ │ -Traits class for generically constructing non default constructable types. │ │ │ │ -DDeeffiinniittiioonn construction.hh:39 │ │ │ │ -_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:110 │ │ │ │ -_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 │ │ │ │ -const matrix_type & getmat() const override │ │ │ │ -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_:_:_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_:_:_a_p_p_l_y │ │ │ │ -void apply(const X &x, Y &y) const override │ │ │ │ -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_:_:_a_p_p_l_y_s_c_a_l_e_a_d_d │ │ │ │ -void applyscaleadd(field_type alpha, const X &x, Y &y) const override │ │ │ │ -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_:_:_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the linear operator (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:139 │ │ │ │ -_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_:_:_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_:_:_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_:_:_p_r_e │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:206 │ │ │ │ -_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) │ │ │ │ -Constructor. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:197 │ │ │ │ -_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:233 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:216 │ │ │ │ -_D_u_n_e_:_:_P_a_r_S_S_O_R_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:230 │ │ │ │ -_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 │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:361 │ │ │ │ -_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 │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -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_<_ _X_,_ _Y_,_ _C_,_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -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) │ │ │ │ -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_:_:_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) │ │ │ │ -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_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -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_<_ _X_,_ _Y_,_ _C_,_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _>_:_:_c_o_m_m_u_n_i_c_a_t_i_o_n___t_y_p_e │ │ │ │ -C communication_type │ │ │ │ -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_<_ _X_,_ _Y_,_ _C_,_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -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_<_ _X_,_ _Y_,_ _C_,_ _S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -DDeeffiinniittiioonn schwarz.hh:290 │ │ │ │ -_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 │ │ │ │ +_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,52 +66,53 @@ │ │ │

│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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...
struct  Dune::DenseMatrixAssigner< DenseMatrix, ScaledIdentityMatrix< field, N > >
struct  Dune::FieldTraits< ScaledIdentityMatrix< K, n > >
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
│ │ │

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,32 +1,34 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_._._. │ │ │ │ -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_ _> │ │ │ │ +  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_ _> │ │ │ │ +  _I_t_e_r_a_t_o_r 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,698 +66,411 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ -
7
│ │ │ -
13
│ │ │ -
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
│ │ │ -
40 template<class K, int n>
│ │ │ -
│ │ │ - │ │ │ -
42 {
│ │ │ -
43 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix<K,n> > WrapperType;
│ │ │ -
44
│ │ │ -
45 public:
│ │ │ -
46 //===== type definitions and constants
│ │ │ -
47
│ │ │ -
49 typedef K field_type;
│ │ │ -
50
│ │ │ -
52 typedef K block_type;
│ │ │ -
53
│ │ │ -
55 typedef std::size_t size_type;
│ │ │ -
56
│ │ │ -
65 typedef DiagonalRowVector<K,n> row_type;
│ │ │ - │ │ │ +
5#ifndef DUNE_AMGHIERARCHY_HH
│ │ │ +
6#define DUNE_AMGHIERARCHY_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 {
│ │ │ +
25
│ │ │ +
30
│ │ │ +
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
│ │ │ +
60 std::weak_ptr<Element> coarser_;
│ │ │ +
61
│ │ │ +
63 std::shared_ptr<Element> finer_;
│ │ │ +
64
│ │ │ +
66 std::shared_ptr<MemberType> element_;
│ │ │
67
│ │ │ -
69 typedef DiagonalRowVectorConst<K,n> const_row_type;
│ │ │ - │ │ │ -
71
│ │ │ -
73 static constexpr std::integral_constant<size_type,n> rows = {};
│ │ │ -
74
│ │ │ -
76 static constexpr std::integral_constant<size_type,n> cols = {};
│ │ │ +
69 std::shared_ptr<MemberType> redistributed_;
│ │ │ +
70 };
│ │ │ +
71 public:
│ │ │ +
72
│ │ │ +
76 using Allocator = typename std::allocator_traits<A>::template rebind_alloc<Element>;
│ │ │
77
│ │ │ -
78 //===== constructors
│ │ │ - │ │ │ -
82
│ │ │ -
│ │ │ - │ │ │ -
86 : p_(k)
│ │ │ -
87 {}
│ │ │ -
│ │ │ -
88
│ │ │ -
│ │ │ - │ │ │ -
92 {
│ │ │ -
93 p_ = k;
│ │ │ -
94 return *this;
│ │ │ -
95 }
│ │ │ + │ │ │ +
79
│ │ │ +
84 Hierarchy(const std::shared_ptr<MemberType> & first);
│ │ │ +
85
│ │ │ +
│ │ │ +
89 Hierarchy() : levels_(0)
│ │ │ +
90 {}
│ │ │
│ │ │ +
91
│ │ │ +
95 Hierarchy(const Hierarchy& other);
│ │ │
96
│ │ │ -
│ │ │ -
101 bool identical(const ScaledIdentityMatrix<K,n>& other) const
│ │ │ -
102 {
│ │ │ -
103 return (this==&other);
│ │ │ -
104 }
│ │ │ -
│ │ │ -
105
│ │ │ -
106 //===== iterator interface to rows of the matrix
│ │ │ -
108 typedef ContainerWrapperIterator<const WrapperType, reference, reference> Iterator;
│ │ │ - │ │ │ - │ │ │ -
114 typedef typename row_type::Iterator ColIterator;
│ │ │ -
115
│ │ │ -
│ │ │ - │ │ │ -
118 {
│ │ │ -
119 return Iterator(WrapperType(this),0);
│ │ │ -
120 }
│ │ │ -
│ │ │ -
121
│ │ │ -
│ │ │ - │ │ │ -
124 {
│ │ │ -
125 return Iterator(WrapperType(this),n);
│ │ │ -
126 }
│ │ │ -
│ │ │ -
127
│ │ │ + │ │ │ +
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:
│ │ │ +
128 LevelIterator() = default;
│ │ │ +
129
│ │ │
│ │ │ - │ │ │ -
131 {
│ │ │ -
132 return Iterator(WrapperType(this),n-1);
│ │ │ -
133 }
│ │ │ -
│ │ │ -
134
│ │ │ -
│ │ │ - │ │ │ -
138 {
│ │ │ -
139 return Iterator(WrapperType(this),-1);
│ │ │ -
140 }
│ │ │ +
130 LevelIterator(std::shared_ptr<Element> element)
│ │ │ +
131 : element_(std::move(element))
│ │ │ +
132 {}
│ │ │ +
│ │ │ +
133
│ │ │ +
135 template <class C_, class T1_,
│ │ │ +
136 std::enable_if_t<std::is_same_v<std::remove_const_t<C>, std::remove_const_t<C_>>, int> = 0,
│ │ │ +
137 std::enable_if_t<std::is_same_v<std::remove_const_t<T1>, std::remove_const_t<T1_>>, int> = 0>
│ │ │ +
│ │ │ + │ │ │ +
139 : element_(other.element_)
│ │ │ +
140 {}
│ │ │
│ │ │
141
│ │ │ -
142
│ │ │ -
144 typedef ContainerWrapperIterator<const WrapperType, const_reference, const_reference> ConstIterator;
│ │ │ - │ │ │ - │ │ │ -
150 typedef typename const_row_type::ConstIterator ConstColIterator;
│ │ │ -
151
│ │ │ -
│ │ │ - │ │ │ -
154 {
│ │ │ -
155 return ConstIterator(WrapperType(this),0);
│ │ │ -
156 }
│ │ │ -
│ │ │ -
157
│ │ │ -
│ │ │ - │ │ │ -
160 {
│ │ │ -
161 return ConstIterator(WrapperType(this),n);
│ │ │ -
162 }
│ │ │ -
│ │ │ -
163
│ │ │ -
│ │ │ - │ │ │ -
167 {
│ │ │ -
168 return ConstIterator(WrapperType(this),n-1);
│ │ │ -
169 }
│ │ │ -
│ │ │ -
170
│ │ │ -
│ │ │ - │ │ │ -
174 {
│ │ │ -
175 return ConstIterator(WrapperType(this),-1);
│ │ │ -
176 }
│ │ │ -
│ │ │ -
177
│ │ │ -
181
│ │ │ -
│ │ │ - │ │ │ -
184 {
│ │ │ -
185 p_ += y.p_;
│ │ │ -
186 return *this;
│ │ │ -
187 }
│ │ │ -
│ │ │ -
188
│ │ │ -
│ │ │ - │ │ │ -
191 {
│ │ │ -
192 p_ -= y.p_;
│ │ │ -
193 return *this;
│ │ │ -
194 }
│ │ │ +
142 template <class C_, class T1_,
│ │ │ +
143 std::enable_if_t<std::is_same_v<std::remove_const_t<C>, std::remove_const_t<C_>>, int> = 0,
│ │ │ +
144 std::enable_if_t<std::is_same_v<std::remove_const_t<T1>, std::remove_const_t<T1_>>, int> = 0>
│ │ │ +
│ │ │ + │ │ │ +
146 {
│ │ │ +
147 element_ = other.element_;
│ │ │ +
148 return *this;
│ │ │ +
149 }
│ │ │ +
│ │ │ +
150
│ │ │ +
│ │ │ +
154 bool equals(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ +
155 typename std::remove_const<T1>::type>& other) const
│ │ │ +
156 {
│ │ │ +
157 return element_ == other.element_;
│ │ │ +
158 }
│ │ │ +
│ │ │ +
159
│ │ │ +
│ │ │ +
163 bool equals(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ +
164 const typename std::remove_const<T1>::type>& other) const
│ │ │ +
165 {
│ │ │ +
166 return element_ == other.element_;
│ │ │ +
167 }
│ │ │ +
│ │ │ +
168
│ │ │ +
│ │ │ +
170 T1& dereference() const
│ │ │ +
171 {
│ │ │ +
172 return *(element_->element_);
│ │ │ +
173 }
│ │ │ +
│ │ │ +
174
│ │ │ +
│ │ │ + │ │ │ +
177 {
│ │ │ +
178 element_ = element_->coarser_.lock();
│ │ │ +
179 }
│ │ │ +
│ │ │ +
180
│ │ │ +
│ │ │ + │ │ │ +
183 {
│ │ │ +
184 element_ = element_->finer_;
│ │ │ +
185 }
│ │ │ +
│ │ │ +
186
│ │ │ +
│ │ │ +
191 bool isRedistributed() const
│ │ │ +
192 {
│ │ │ +
193 return (bool)element_->redistributed_;
│ │ │ +
194 }
│ │ │
│ │ │
195
│ │ │
│ │ │ - │ │ │ -
201 {
│ │ │ -
202 p_ += k;
│ │ │ -
203 return *this;
│ │ │ -
204 }
│ │ │ + │ │ │ +
201 {
│ │ │ +
202 assert(element_->redistributed_);
│ │ │ +
203 return *element_->redistributed_;
│ │ │ +
204 }
│ │ │ +
│ │ │ +
│ │ │ +
205 void addRedistributed(std::shared_ptr<T1> t)
│ │ │ +
206 {
│ │ │ +
207 element_->redistributed_ = t;
│ │ │ +
208 }
│ │ │
│ │ │ -
205
│ │ │ +
209
│ │ │
│ │ │ - │ │ │ -
211 {
│ │ │ -
212 p_ -= k;
│ │ │ -
213 return *this;
│ │ │ -
214 }
│ │ │ -
│ │ │ -
215
│ │ │ -
│ │ │ - │ │ │ -
218 {
│ │ │ -
219 p_ *= k;
│ │ │ -
220 return *this;
│ │ │ -
221 }
│ │ │ -
│ │ │ -
222
│ │ │ -
│ │ │ - │ │ │ -
225 {
│ │ │ -
226 p_ /= k;
│ │ │ -
227 return *this;
│ │ │ -
228 }
│ │ │ -
│ │ │ -
229
│ │ │ -
231 template <class Scalar,
│ │ │ -
232 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ -
│ │ │ -
233 friend auto operator* ( const ScaledIdentityMatrix& matrix, Scalar scalar)
│ │ │ -
234 {
│ │ │ - │ │ │ -
236 }
│ │ │ -
│ │ │ + │ │ │ +
211 {
│ │ │ +
212 element_->redistributed_ = nullptr;
│ │ │ +
213 }
│ │ │ +
│ │ │ +
214
│ │ │ +
215 private:
│ │ │ +
216 std::shared_ptr<Element> element_ = {};
│ │ │ +
217 };
│ │ │ +
│ │ │ +
218
│ │ │ + │ │ │ +
221
│ │ │ + │ │ │ +
224
│ │ │ + │ │ │ +
230
│ │ │ + │ │ │ +
236
│ │ │
237
│ │ │ -
239 template <class Scalar,
│ │ │ -
240 std::enable_if_t<IsNumber<Scalar>::value, int> = 0>
│ │ │ -
│ │ │ -
241 friend auto operator* (Scalar scalar, const ScaledIdentityMatrix& matrix)
│ │ │ -
242 {
│ │ │ - │ │ │ -
244 }
│ │ │ -
│ │ │ -
245
│ │ │ -
247 template <class OtherScalar>
│ │ │ -
248 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; }
│ │ │ -
│ │ │ -
249 friend auto& operator+= (FieldMatrix<OtherScalar,n,n>& fieldMatrix,
│ │ │ -
250 const ScaledIdentityMatrix& matrix)
│ │ │ -
251 {
│ │ │ -
252 for (int i=0; i<n; i++)
│ │ │ -
253 fieldMatrix[i][i] += matrix.p_;
│ │ │ -
254
│ │ │ -
255 return fieldMatrix;
│ │ │ -
256 }
│ │ │ -
│ │ │ -
257
│ │ │ -
259 template <class OtherScalar>
│ │ │ -
260 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; }
│ │ │ -
│ │ │ -
261 friend auto operator+ (const FieldMatrix<OtherScalar,n,n>& fieldMatrix,
│ │ │ -
262 const ScaledIdentityMatrix& matrix)
│ │ │ -
263 {
│ │ │ - │ │ │ -
265 Result result = fieldMatrix;
│ │ │ -
266 result += matrix;
│ │ │ -
267 return result;
│ │ │ -
268 }
│ │ │ -
│ │ │ -
269
│ │ │ -
271 template <class OtherScalar>
│ │ │ -
272 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; }
│ │ │ -
│ │ │ -
273 friend auto operator+ (const ScaledIdentityMatrix& matrix,
│ │ │ -
274 const FieldMatrix<OtherScalar,n,n>& fieldMatrix)
│ │ │ -
275 {
│ │ │ -
276 return fieldMatrix + matrix;
│ │ │ -
277 }
│ │ │ -
│ │ │ -
278
│ │ │ -
280 template <class OtherScalar>
│ │ │ -
281 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; }
│ │ │ -
│ │ │ -
282 friend auto operator+= (DiagonalMatrix<OtherScalar,n>& diagonalMatrix,
│ │ │ -
283 const ScaledIdentityMatrix& matrix)
│ │ │ -
284 {
│ │ │ -
285 for (std::size_t i=0; i<n; i++)
│ │ │ -
286 diagonalMatrix.diagonal(i) += matrix.p_;
│ │ │ -
287
│ │ │ -
288 return diagonalMatrix;
│ │ │ -
289 }
│ │ │ -
│ │ │ -
290
│ │ │ -
292 template <class OtherScalar>
│ │ │ -
293 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; }
│ │ │ -
│ │ │ -
294 friend auto operator+ (const DiagonalMatrix<OtherScalar,n>& diagonalMatrix,
│ │ │ -
295 const ScaledIdentityMatrix& matrix)
│ │ │ -
296 {
│ │ │ -
297 using Result = DiagonalMatrix<typename PromotionTraits<K,OtherScalar>::PromotedType,n>;
│ │ │ -
298 Result result = diagonalMatrix;
│ │ │ -
299 result += matrix;
│ │ │ -
300 return result;
│ │ │ -
301 }
│ │ │ -
│ │ │ -
302
│ │ │ -
304 template <class OtherScalar>
│ │ │ -
305 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; }
│ │ │ -
│ │ │ -
306 friend auto operator+ (const ScaledIdentityMatrix& matrix,
│ │ │ -
307 const DiagonalMatrix<OtherScalar,n>& diagonalMatrix)
│ │ │ -
308 {
│ │ │ -
309 return diagonalMatrix + matrix;
│ │ │ -
310 }
│ │ │ -
│ │ │ -
311
│ │ │ -
312
│ │ │ -
313 //===== comparison ops
│ │ │ -
314
│ │ │ -
│ │ │ -
316 bool operator==(const ScaledIdentityMatrix& other) const
│ │ │ -
317 {
│ │ │ -
318 return p_==other.scalar();
│ │ │ -
319 }
│ │ │ -
│ │ │ -
320
│ │ │ -
│ │ │ -
322 bool operator!=(const ScaledIdentityMatrix& other) const
│ │ │ -
323 {
│ │ │ -
324 return p_!=other.scalar();
│ │ │ -
325 }
│ │ │ -
│ │ │ -
326
│ │ │ -
330
│ │ │ -
332 template<class X, class Y>
│ │ │ -
│ │ │ -
333 void mv (const X& x, Y& y) const
│ │ │ -
334 {
│ │ │ -
335#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
336 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
337 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
338#endif
│ │ │ -
339 for (size_type i=0; i<n; ++i)
│ │ │ -
340 y[i] = p_ * x[i];
│ │ │ -
341 }
│ │ │ -
│ │ │ -
342
│ │ │ -
344 template<class X, class Y>
│ │ │ -
│ │ │ -
345 void mtv (const X& x, Y& y) const
│ │ │ -
346 {
│ │ │ -
347 mv(x, y);
│ │ │ -
348 }
│ │ │ -
│ │ │ -
349
│ │ │ -
351 template<class X, class Y>
│ │ │ -
│ │ │ -
352 void umv (const X& x, Y& y) const
│ │ │ -
353 {
│ │ │ -
354#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
355 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
356 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
357#endif
│ │ │ -
358 for (size_type i=0; i<n; ++i)
│ │ │ -
359 y[i] += p_ * x[i];
│ │ │ -
360 }
│ │ │ -
│ │ │ -
361
│ │ │ -
363 template<class X, class Y>
│ │ │ -
│ │ │ -
364 void umtv (const X& x, Y& y) const
│ │ │ -
365 {
│ │ │ -
366#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
367 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
368 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
369#endif
│ │ │ -
370 for (size_type i=0; i<n; ++i)
│ │ │ -
371 y[i] += p_ * x[i];
│ │ │ -
372 }
│ │ │ -
│ │ │ -
373
│ │ │ -
375 template<class X, class Y>
│ │ │ -
│ │ │ -
376 void umhv (const X& x, Y& y) const
│ │ │ -
377 {
│ │ │ -
378#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
379 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
380 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
381#endif
│ │ │ -
382 for (size_type i=0; i<n; i++)
│ │ │ -
383 y[i] += conjugateComplex(p_)*x[i];
│ │ │ + │ │ │ +
243
│ │ │ + │ │ │ +
249
│ │ │ +
254 std::size_t levels() const;
│ │ │ +
255
│ │ │ +
256 private:
│ │ │ +
262 std::shared_ptr<MemberType> originalFinest_;
│ │ │ +
264 std::shared_ptr<Element> finest_;
│ │ │ +
266 std::shared_ptr<Element> coarsest_;
│ │ │ +
268 Allocator allocator_;
│ │ │ +
270 int levels_;
│ │ │ +
271 };
│ │ │ +
│ │ │ +
272
│ │ │ +
273 template<class T, class A>
│ │ │ +
│ │ │ +
274 Hierarchy<T,A>::Hierarchy(const std::shared_ptr<MemberType> & first)
│ │ │ +
275 : originalFinest_(first)
│ │ │ +
276 {
│ │ │ +
277 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
278 finest_->element_ = originalFinest_;
│ │ │ +
279 coarsest_ = finest_;
│ │ │ +
280 levels_ = 1;
│ │ │ +
281 }
│ │ │ +
│ │ │ +
282
│ │ │ +
284 //TODO: do we actually want to support this? This might be very expensive?!
│ │ │ +
285 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
287 : allocator_(other.allocator_),
│ │ │ +
288 levels_(other.levels_)
│ │ │ +
289 {
│ │ │ +
290 if(!other.finest_)
│ │ │ +
291 {
│ │ │ +
292 finest_=coarsest_=nullptr;
│ │ │ +
293 return;
│ │ │ +
294 }
│ │ │ +
295 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
296 std::shared_ptr<Element> finer_;
│ │ │ +
297 std::shared_ptr<Element> current_ = finest_;
│ │ │ +
298 std::weak_ptr<Element> otherWeak_ = other.finest_;
│ │ │ +
299
│ │ │ +
300 while(! otherWeak_.expired())
│ │ │ +
301 {
│ │ │ +
302 // create shared_ptr from weak_ptr, we just checked that this is safe
│ │ │ +
303 std::shared_ptr<Element> otherCurrent_ = std::shared_ptr<Element>(otherWeak_);
│ │ │ +
304 // clone current level
│ │ │ +
305 //TODO: should we use the allocator?
│ │ │ +
306 current_->element_ =
│ │ │ +
307 std::make_shared<MemberType>(*(otherCurrent_->element_));
│ │ │ +
308 current_->finer_=finer_;
│ │ │ +
309 if(otherCurrent_->redistributed_)
│ │ │ +
310 current_->redistributed_ =
│ │ │ +
311 std::make_shared<MemberType>(*(otherCurrent_->redistributed_));
│ │ │ +
312 finer_=current_;
│ │ │ +
313 if(not otherCurrent_->coarser_.expired())
│ │ │ +
314 {
│ │ │ +
315 auto c = std::allocate_shared<Element>(allocator_);
│ │ │ +
316 current_->coarser_ = c;
│ │ │ +
317 current_ = c;
│ │ │ +
318 }
│ │ │ +
319 // go to coarser level
│ │ │ +
320 otherWeak_ = otherCurrent_->coarser_;
│ │ │ +
321 }
│ │ │ +
322 coarsest_=current_;
│ │ │ +
323 }
│ │ │ +
│ │ │ +
324
│ │ │ +
325 template<class T, class A>
│ │ │ +
│ │ │ +
326 std::size_t Hierarchy<T,A>::levels() const
│ │ │ +
327 {
│ │ │ +
328 return levels_;
│ │ │ +
329 }
│ │ │ +
│ │ │ +
330
│ │ │ +
331 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
333 {
│ │ │ +
334 coarsest_->redistributed_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
335 }
│ │ │ +
│ │ │ +
336
│ │ │ +
337 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
339 {
│ │ │ +
340 if(!coarsest_) {
│ │ │ +
341 // we have no levels at all...
│ │ │ +
342 assert(!finest_);
│ │ │ +
343 // allocate into the shared_ptr
│ │ │ +
344 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
345 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
346 coarsest_->element_ = originalFinest_;
│ │ │ +
347 finest_ = coarsest_;
│ │ │ +
348 }else{
│ │ │ +
349 auto old_coarsest = coarsest_;
│ │ │ +
350 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
351 coarsest_->finer_ = old_coarsest;
│ │ │ +
352 coarsest_->element_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
353 old_coarsest->coarser_ = coarsest_;
│ │ │ +
354 }
│ │ │ +
355 ++levels_;
│ │ │ +
356 }
│ │ │ +
│ │ │ +
357
│ │ │ +
358
│ │ │ +
359 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
361 {
│ │ │ +
362 //TODO: wouldn't it be better to do this in the constructor?'
│ │ │ +
363 if(!finest_) {
│ │ │ +
364 // we have no levels at all...
│ │ │ +
365 assert(!coarsest_);
│ │ │ +
366 // allocate into the shared_ptr
│ │ │ +
367 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ +
368 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
369 finest_->element = originalFinest_;
│ │ │ +
370 coarsest_ = finest_;
│ │ │ +
371 }else{
│ │ │ +
372 finest_->finer_ = std::allocate_shared<Element>(allocator_);
│ │ │ +
373 finest_->finer_->coarser_ = finest_;
│ │ │ +
374 finest_ = finest_->finer_;
│ │ │ +
375 finest_->element = ConstructionTraits<T>::construct(args);
│ │ │ +
376 }
│ │ │ +
377 ++levels_;
│ │ │ +
378 }
│ │ │ +
│ │ │ +
379
│ │ │ +
380 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
382 {
│ │ │ +
383 return Iterator(finest_);
│ │ │
384 }
│ │ │
│ │ │ -
385
│ │ │ -
387 template<class X, class Y>
│ │ │ -
│ │ │ -
388 void mmv (const X& x, Y& y) const
│ │ │ -
389 {
│ │ │ -
390#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
391 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
392 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
393#endif
│ │ │ -
394 for (size_type i=0; i<n; ++i)
│ │ │ -
395 y[i] -= p_ * x[i];
│ │ │ +
385
│ │ │ +
386 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
388 {
│ │ │ +
389 return Iterator(coarsest_);
│ │ │ +
390 }
│ │ │ +
│ │ │ +
391
│ │ │ +
392 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
394 {
│ │ │ +
395 return ConstIterator(finest_);
│ │ │
396 }
│ │ │
│ │ │ -
397
│ │ │ -
399 template<class X, class Y>
│ │ │ -
│ │ │ -
400 void mmtv (const X& x, Y& y) const
│ │ │ -
401 {
│ │ │ -
402#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
403 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
404 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
405#endif
│ │ │ -
406 for (size_type i=0; i<n; ++i)
│ │ │ -
407 y[i] -= p_ * x[i];
│ │ │ -
408 }
│ │ │ -
│ │ │ -
409
│ │ │ -
411 template<class X, class Y>
│ │ │ -
│ │ │ -
412 void mmhv (const X& x, Y& y) const
│ │ │ -
413 {
│ │ │ -
414#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
415 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
416 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
417#endif
│ │ │ -
418 for (size_type i=0; i<n; i++)
│ │ │ -
419 y[i] -= conjugateComplex(p_)*x[i];
│ │ │ -
420 }
│ │ │ -
│ │ │ -
421
│ │ │ -
423 template<class X, class Y>
│ │ │ -
│ │ │ -
424 void usmv (const K& alpha, const X& x, Y& y) const
│ │ │ -
425 {
│ │ │ -
426#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
427 if (x.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
428 if (y.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
429#endif
│ │ │ -
430 for (size_type i=0; i<n; i++)
│ │ │ -
431 y[i] += alpha * p_ * x[i];
│ │ │ -
432 }
│ │ │ -
│ │ │ -
433
│ │ │ -
435 template<class X, class Y>
│ │ │ -
│ │ │ -
436 void usmtv (const K& alpha, const X& x, Y& y) const
│ │ │ -
437 {
│ │ │ -
438#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
439 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
440 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
441#endif
│ │ │ -
442 for (size_type i=0; i<n; i++)
│ │ │ -
443 y[i] += alpha * p_ * x[i];
│ │ │ -
444 }
│ │ │ -
│ │ │ -
445
│ │ │ -
447 template<class X, class Y>
│ │ │ -
│ │ │ -
448 void usmhv (const K& alpha, const X& x, Y& y) const
│ │ │ -
449 {
│ │ │ -
450#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
451 if (x.N()!=N()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
452 if (y.N()!=M()) DUNE_THROW(FMatrixError,"index out of range");
│ │ │ -
453#endif
│ │ │ -
454 for (size_type i=0; i<n; i++)
│ │ │ -
455 y[i] += alpha * conjugateComplex(p_) * x[i];
│ │ │ -
456 }
│ │ │ -
│ │ │ -
457
│ │ │ -
459
│ │ │ -
460
│ │ │ -
464
│ │ │ -
│ │ │ -
466 typename FieldTraits<field_type>::real_type frobenius_norm () const
│ │ │ -
467 {
│ │ │ -
468 return fvmeta::sqrt(n*p_*p_);
│ │ │ -
469 }
│ │ │ -
│ │ │ -
470
│ │ │ -
│ │ │ -
472 typename FieldTraits<field_type>::real_type frobenius_norm2 () const
│ │ │ -
473 {
│ │ │ -
474 return n*p_*p_;
│ │ │ -
475 }
│ │ │ -
│ │ │ -
476
│ │ │ -
│ │ │ -
482 typename FieldTraits<field_type>::real_type infinity_norm () const
│ │ │ -
483 {
│ │ │ -
484 return std::abs(p_);
│ │ │ -
485 }
│ │ │ -
│ │ │ -
486
│ │ │ -
│ │ │ -
488 typename FieldTraits<field_type>::real_type infinity_norm_real () const
│ │ │ -
489 {
│ │ │ -
490 return fvmeta::absreal(p_);
│ │ │ -
491 }
│ │ │ -
│ │ │ -
492
│ │ │ -
494
│ │ │ -
499 template<class V>
│ │ │ -
│ │ │ -
500 void solve (V& x, const V& b) const
│ │ │ -
501 {
│ │ │ -
502 for (int i=0; i<n; i++)
│ │ │ -
503 x[i] = b[i]/p_;
│ │ │ -
504 }
│ │ │ -
│ │ │ -
505
│ │ │ -
│ │ │ -
508 void invert()
│ │ │ -
509 {
│ │ │ -
510 p_ = 1/p_;
│ │ │ -
511 }
│ │ │ -
│ │ │ -
512
│ │ │ -
│ │ │ -
514 K determinant () const {
│ │ │ -
515 return std::pow(p_,n);
│ │ │ -
516 }
│ │ │ -
│ │ │ -
517
│ │ │ -
518 //===== sizes
│ │ │ -
519
│ │ │ -
│ │ │ -
521 size_type N () const
│ │ │ -
522 {
│ │ │ -
523 return n;
│ │ │ -
524 }
│ │ │ -
│ │ │ -
525
│ │ │ -
│ │ │ -
527 size_type M () const
│ │ │ -
528 {
│ │ │ -
529 return n;
│ │ │ -
530 }
│ │ │ -
│ │ │ -
531
│ │ │ -
532 //===== query
│ │ │ -
533
│ │ │ -
│ │ │ -
535 bool exists (size_type i, size_type j) const
│ │ │ -
536 {
│ │ │ -
537#ifdef DUNE_FMatrix_WITH_CHECKING
│ │ │ -
538 if (i<0 || i>=n) DUNE_THROW(FMatrixError,"row index out of range");
│ │ │ -
539 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range");
│ │ │ -
540#endif
│ │ │ -
541 return i==j;
│ │ │ -
542 }
│ │ │ -
│ │ │ -
543
│ │ │ -
544 //===== conversion operator
│ │ │ -
545
│ │ │ -
│ │ │ -
547 friend std::ostream& operator<< (std::ostream& s, const ScaledIdentityMatrix<K,n>& a)
│ │ │ -
548 {
│ │ │ -
549 for (size_type i=0; i<n; i++) {
│ │ │ -
550 for (size_type j=0; j<n; j++)
│ │ │ -
551 s << ((i==j) ? a.p_ : 0) << " ";
│ │ │ -
552 s << std::endl;
│ │ │ -
553 }
│ │ │ -
554 return s;
│ │ │ -
555 }
│ │ │ -
│ │ │ -
556
│ │ │ -
│ │ │ - │ │ │ -
559 {
│ │ │ -
560 return reference(const_cast<K*>(&p_), i);
│ │ │ -
561 }
│ │ │ -
│ │ │ -
562
│ │ │ -
│ │ │ - │ │ │ -
565 {
│ │ │ -
566 return const_reference(const_cast<K*>(&p_), i);
│ │ │ -
567 }
│ │ │ -
│ │ │ -
568
│ │ │ -
│ │ │ -
570 const K& diagonal(size_type /*i*/) const
│ │ │ -
571 {
│ │ │ -
572 return p_;
│ │ │ -
573 }
│ │ │ -
│ │ │ -
574
│ │ │ -
│ │ │ - │ │ │ -
577 {
│ │ │ -
578 return p_;
│ │ │ -
579 }
│ │ │ -
│ │ │ -
580
│ │ │ -
│ │ │ -
583 const K& scalar() const
│ │ │ -
584 {
│ │ │ -
585 return p_;
│ │ │ -
586 }
│ │ │ -
│ │ │ -
587
│ │ │ -
│ │ │ - │ │ │ -
591 {
│ │ │ -
592 return p_;
│ │ │ -
593 }
│ │ │ -
│ │ │ -
594
│ │ │ -
595 private:
│ │ │ -
596 // the data, very simply a single number
│ │ │ -
597 K p_;
│ │ │ -
598
│ │ │ -
599 };
│ │ │ -
│ │ │ -
600
│ │ │ -
601 template <class DenseMatrix, class field, int N>
│ │ │ -
│ │ │ -
602 struct DenseMatrixAssigner<DenseMatrix, ScaledIdentityMatrix<field, N>> {
│ │ │ -
│ │ │ -
603 static void apply(DenseMatrix& denseMatrix,
│ │ │ - │ │ │ -
605 assert(denseMatrix.M() == N);
│ │ │ -
606 assert(denseMatrix.N() == N);
│ │ │ -
607 denseMatrix = field(0);
│ │ │ -
608 for (int i = 0; i < N; ++i)
│ │ │ -
609 denseMatrix[i][i] = rhs.scalar();
│ │ │ -
610 }
│ │ │ -
│ │ │ -
611 };
│ │ │ -
│ │ │ -
612
│ │ │ -
613 template<class K, int n>
│ │ │ -
│ │ │ -
614 struct FieldTraits< ScaledIdentityMatrix<K, n> >
│ │ │ -
615 {
│ │ │ - │ │ │ -
617 using real_type = typename FieldTraits<field_type>::real_type;
│ │ │ -
618 };
│ │ │ -
│ │ │ -
619
│ │ │ -
620} // end namespace
│ │ │ -
621
│ │ │ -
622#endif
│ │ │ +
397
│ │ │ +
398 template<class T, class A>
│ │ │ +
│ │ │ + │ │ │ +
400 {
│ │ │ +
401 return ConstIterator(coarsest_);
│ │ │ +
402 }
│ │ │ +
│ │ │ +
403
│ │ │ +
404 } // namespace Amg
│ │ │ +
405} // namespace Dune
│ │ │ +
406
│ │ │ +
407#endif
│ │ │ +
Helper classes for the construction of classes without empty constructor.
│ │ │ +
Hierarchy(const Hierarchy &other)
Copy constructor (deep copy!).
Definition hierarchy.hh:286
│ │ │ +
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
void addRedistributedOnCoarsest(Arguments &args)
Definition hierarchy.hh:332
│ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:326
│ │ │ +
ConstIterator coarsest() const
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:399
│ │ │ +
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:338
│ │ │ +
void addFiner(Arguments &args)
Add an element on a finer level.
Definition hierarchy.hh:360
│ │ │ +
Hierarchy(const std::shared_ptr< MemberType > &first)
Construct a new hierarchy.
Definition hierarchy.hh:274
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ +
Iterator coarsest()
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:387
│ │ │ +
ConstIterator finest() const
Get an iterator positioned at the finest level.
Definition hierarchy.hh:393
│ │ │ +
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:381
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │ -
Definition matrixutils.hh:27
│ │ │ -
A multiple of the identity matrix of static size.
Definition scaledidmatrix.hh:42
│ │ │ -
void usmhv(const K &alpha, const X &x, Y &y) const
y += alpha A^H x
Definition scaledidmatrix.hh:448
│ │ │ -
void mmtv(const X &x, Y &y) const
y -= A^T x
Definition scaledidmatrix.hh:400
│ │ │ -
ScaledIdentityMatrix & operator-=(const ScaledIdentityMatrix &y)
Vector space subtraction.
Definition scaledidmatrix.hh:190
│ │ │ -
const_row_type::ConstIterator ConstColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:150
│ │ │ -
ConstIterator end() const
end iterator
Definition scaledidmatrix.hh:159
│ │ │ -
Iterator beforeBegin()
Definition scaledidmatrix.hh:137
│ │ │ -
static constexpr std::integral_constant< size_type, n > rows
The number of matrix rows.
Definition scaledidmatrix.hh:73
│ │ │ -
bool operator!=(const ScaledIdentityMatrix &other) const
Test for inequality.
Definition scaledidmatrix.hh:322
│ │ │ -
void mmv(const X &x, Y &y) const
y -= A x
Definition scaledidmatrix.hh:388
│ │ │ -
std::size_t size_type
The type used for the indices and sizes.
Definition scaledidmatrix.hh:55
│ │ │ -
void usmv(const K &alpha, const X &x, Y &y) const
y += alpha A x
Definition scaledidmatrix.hh:424
│ │ │ -
row_type::Iterator ColIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:114
│ │ │ -
const_row_type const_reference
Definition scaledidmatrix.hh:70
│ │ │ -
void mv(const X &x, Y &y) const
y = A x
Definition scaledidmatrix.hh:333
│ │ │ -
void umtv(const X &x, Y &y) const
y += A^T x
Definition scaledidmatrix.hh:364
│ │ │ -
void umhv(const X &x, Y &y) const
y += A^H x
Definition scaledidmatrix.hh:376
│ │ │ -
DiagonalRowVector< K, n > row_type
Type of a single matrix row.
Definition scaledidmatrix.hh:65
│ │ │ -
ContainerWrapperIterator< const WrapperType, reference, reference > Iterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:108
│ │ │ -
Iterator beforeEnd()
Definition scaledidmatrix.hh:130
│ │ │ -
K determinant() const
Calculates the determinant of this matrix.
Definition scaledidmatrix.hh:514
│ │ │ -
K field_type
The type representing numbers.
Definition scaledidmatrix.hh:49
│ │ │ -
void usmtv(const K &alpha, const X &x, Y &y) const
y += alpha A^T x
Definition scaledidmatrix.hh:436
│ │ │ -
Iterator end()
end iterator
Definition scaledidmatrix.hh:123
│ │ │ -
Iterator iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:110
│ │ │ -
static constexpr std::integral_constant< size_type, n > cols
The number of matrix columns.
Definition scaledidmatrix.hh:76
│ │ │ -
const K & scalar() const
Get const reference to the scalar diagonal value.
Definition scaledidmatrix.hh:583
│ │ │ -
friend auto operator+(const FieldMatrix< OtherScalar, n, n > &fieldMatrix, const ScaledIdentityMatrix &matrix)
Addition of ScaledIdentityMatrix to FieldMatrix.
Definition scaledidmatrix.hh:261
│ │ │ -
void umv(const X &x, Y &y) const
y += A x
Definition scaledidmatrix.hh:352
│ │ │ -
const K & diagonal(size_type) const
Get const reference to diagonal entry.
Definition scaledidmatrix.hh:570
│ │ │ -
ScaledIdentityMatrix & operator=(const K &k)
Assignment from scalar.
Definition scaledidmatrix.hh:91
│ │ │ -
ContainerWrapperIterator< const WrapperType, const_reference, const_reference > ConstIterator
Iterator class for sequential access.
Definition scaledidmatrix.hh:144
│ │ │ -
K & diagonal(size_type)
Get reference to diagonal entry.
Definition scaledidmatrix.hh:576
│ │ │ -
void solve(V &x, const V &b) const
Solve linear system A x = b.
Definition scaledidmatrix.hh:500
│ │ │ -
bool exists(size_type i, size_type j) const
Return true if (i,j) is in the matrix pattern, i.e., if i==j.
Definition scaledidmatrix.hh:535
│ │ │ -
Iterator RowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:112
│ │ │ -
ConstIterator const_iterator
typedef for stl compliant access
Definition scaledidmatrix.hh:146
│ │ │ -
ScaledIdentityMatrix()
Default constructor.
Definition scaledidmatrix.hh:81
│ │ │ -
bool operator==(const ScaledIdentityMatrix &other) const
Test for equality.
Definition scaledidmatrix.hh:316
│ │ │ -
ConstIterator beforeBegin() const
Definition scaledidmatrix.hh:173
│ │ │ -
ScaledIdentityMatrix & operator/=(const K &k)
Vector space division by scalar.
Definition scaledidmatrix.hh:224
│ │ │ -
friend std::ostream & operator<<(std::ostream &s, const ScaledIdentityMatrix< K, n > &a)
Sends the matrix to an output stream.
Definition scaledidmatrix.hh:547
│ │ │ -
FieldTraits< field_type >::real_type frobenius_norm2() const
The square of the Frobenius norm.
Definition scaledidmatrix.hh:472
│ │ │ -
FieldTraits< field_type >::real_type frobenius_norm() const
The Frobenius norm.
Definition scaledidmatrix.hh:466
│ │ │ -
FieldTraits< field_type >::real_type infinity_norm() const
The row sum norm.
Definition scaledidmatrix.hh:482
│ │ │ -
ConstIterator ConstRowIterator
rename the iterators for easier access
Definition scaledidmatrix.hh:148
│ │ │ -
ConstIterator beforeEnd() const
Definition scaledidmatrix.hh:166
│ │ │ -
size_type M() const
number of blocks in column direction
Definition scaledidmatrix.hh:527
│ │ │ -
const_reference operator[](size_type i) const
Return const_reference object as row replacement.
Definition scaledidmatrix.hh:564
│ │ │ -
ScaledIdentityMatrix(const K &k)
Constructor initializing the whole matrix with a scalar.
Definition scaledidmatrix.hh:85
│ │ │ -
friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar)
Vector space multiplication with scalar.
Definition scaledidmatrix.hh:233
│ │ │ -
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition scaledidmatrix.hh:488
│ │ │ -
ScaledIdentityMatrix & operator*=(const K &k)
Vector space multiplication with scalar.
Definition scaledidmatrix.hh:217
│ │ │ -
bool identical(const ScaledIdentityMatrix< K, n > &other) const
Check if matrix is identical to other matrix.
Definition scaledidmatrix.hh:101
│ │ │ -
void invert()
Compute inverse.
Definition scaledidmatrix.hh:508
│ │ │ -
Iterator begin()
begin iterator
Definition scaledidmatrix.hh:117
│ │ │ -
K & scalar()
Get reference to the scalar diagonal value.
Definition scaledidmatrix.hh:590
│ │ │ -
row_type reference
Definition scaledidmatrix.hh:66
│ │ │ -
K block_type
The type representing matrix entries (which may be matrices themselves).
Definition scaledidmatrix.hh:52
│ │ │ -
void mmhv(const X &x, Y &y) const
y -= A^H x
Definition scaledidmatrix.hh:412
│ │ │ -
ScaledIdentityMatrix & operator+=(const ScaledIdentityMatrix &y)
Vector space addition.
Definition scaledidmatrix.hh:183
│ │ │ -
DiagonalRowVectorConst< K, n > const_row_type
Const type of a single row.
Definition scaledidmatrix.hh:69
│ │ │ -
void mtv(const X &x, Y &y) const
y = A^T x
Definition scaledidmatrix.hh:345
│ │ │ -
reference operator[](size_type i)
Return reference object as row replacement.
Definition scaledidmatrix.hh:558
│ │ │ -
ConstIterator begin() const
begin iterator
Definition scaledidmatrix.hh:153
│ │ │ -
size_type N() const
number of blocks in row direction
Definition scaledidmatrix.hh:521
│ │ │ -
static void apply(DenseMatrix &denseMatrix, ScaledIdentityMatrix< field, N > const &rhs)
Definition scaledidmatrix.hh:603
│ │ │ -
typename ScaledIdentityMatrix< K, n >::field_type field_type
Definition scaledidmatrix.hh:616
│ │ │ -
typename FieldTraits< field_type >::real_type real_type
Definition scaledidmatrix.hh:617
│ │ │ +
const Dtype_t BaseGetSuperLUType< T >::type
Definition supermatrix.hh:135
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
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:220
│ │ │ +
LevelIterator< const Hierarchy< T, A >, const T > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:223
│ │ │ +
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 & operator=(const LevelIterator< C_, T1_ > &other)
Definition hierarchy.hh:145
│ │ │ +
void addRedistributed(std::shared_ptr< T1 > t)
Definition hierarchy.hh:205
│ │ │ +
T1 & dereference() const
Dereference the iterator.
Definition hierarchy.hh:170
│ │ │ +
bool equals(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:154
│ │ │ +
bool isRedistributed() const
Check whether there was a redistribution at the current level.
Definition hierarchy.hh:191
│ │ │ +
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:163
│ │ │ +
void increment()
Move to the next coarser level.
Definition hierarchy.hh:176
│ │ │ +
void deleteRedistributed()
Definition hierarchy.hh:210
│ │ │ +
void decrement()
Move to the next fine level.
Definition hierarchy.hh:182
│ │ │ +
LevelIterator(const LevelIterator< C_, T1_ > &other)
Copy constructor.
Definition hierarchy.hh:138
│ │ │ +
T1 & getRedistributed() const
Get the redistributed container.
Definition hierarchy.hh:200
│ │ │ +
LevelIterator()=default
Constructor.
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,780 +1,452 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ -13 │ │ │ │ -14#include │ │ │ │ -15#include │ │ │ │ -16#include │ │ │ │ -17#include │ │ │ │ -18#include │ │ │ │ -19#include │ │ │ │ -20#include │ │ │ │ -21#include │ │ │ │ -22 │ │ │ │ -23namespace _D_u_n_e { │ │ │ │ -24 │ │ │ │ -40 template │ │ │ │ -_4_1 class _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x │ │ │ │ -42 { │ │ │ │ -43 typedef DiagonalMatrixWrapper< ScaledIdentityMatrix > WrapperType; │ │ │ │ -44 │ │ │ │ -45 public: │ │ │ │ -46 //===== type definitions and constants │ │ │ │ -47 │ │ │ │ -_4_9 typedef K _f_i_e_l_d___t_y_p_e; │ │ │ │ -50 │ │ │ │ -_5_2 typedef K _b_l_o_c_k___t_y_p_e; │ │ │ │ -53 │ │ │ │ -_5_5 typedef std::size_t _s_i_z_e___t_y_p_e; │ │ │ │ -56 │ │ │ │ -_6_5 typedef DiagonalRowVector _r_o_w___t_y_p_e; │ │ │ │ -_6_6 typedef _r_o_w___t_y_p_e _r_e_f_e_r_e_n_c_e; │ │ │ │ +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 _A_m_g │ │ │ │ +19 { │ │ │ │ +25 │ │ │ │ +30 │ │ │ │ +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 │ │ │ │ +60 std::weak_ptr coarser_; │ │ │ │ +61 │ │ │ │ +63 std::shared_ptr finer_; │ │ │ │ +64 │ │ │ │ +66 std::shared_ptr element_; │ │ │ │ 67 │ │ │ │ -_6_9 typedef DiagonalRowVectorConst _c_o_n_s_t___r_o_w___t_y_p_e; │ │ │ │ -_7_0 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; │ │ │ │ -71 │ │ │ │ -_7_3 static constexpr std::integral_constant _r_o_w_s = {}; │ │ │ │ -74 │ │ │ │ -_7_6 static constexpr std::integral_constant _c_o_l_s = {}; │ │ │ │ +_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 │ │ │ │ -78 //===== constructors │ │ │ │ -_8_1 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x () {} │ │ │ │ -82 │ │ │ │ -_8_5 _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x (const K& k) │ │ │ │ -86 : p_(k) │ │ │ │ -87 {} │ │ │ │ -88 │ │ │ │ -_9_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) │ │ │ │ -92 { │ │ │ │ -93 p_ = k; │ │ │ │ -94 return *this; │ │ │ │ -95 } │ │ │ │ +_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 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 │ │ │ │ -102 { │ │ │ │ -103 return (this==&other); │ │ │ │ -104 } │ │ │ │ -105 │ │ │ │ -106 //===== iterator interface to rows of the matrix │ │ │ │ -_1_0_8 typedef ContainerWrapperIterator │ │ │ │ -_I_t_e_r_a_t_o_r; │ │ │ │ -_1_1_0 typedef _I_t_e_r_a_t_o_r _i_t_e_r_a_t_o_r; │ │ │ │ -_1_1_2 typedef _I_t_e_r_a_t_o_r _R_o_w_I_t_e_r_a_t_o_r; │ │ │ │ -_1_1_4 typedef typename row_type::Iterator _C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ -115 │ │ │ │ -_1_1_7 _I_t_e_r_a_t_o_r _b_e_g_i_n () │ │ │ │ -118 { │ │ │ │ -119 return _I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ -120 } │ │ │ │ -121 │ │ │ │ -_1_2_3 _I_t_e_r_a_t_o_r _e_n_d () │ │ │ │ -124 { │ │ │ │ -125 return _I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ -126 } │ │ │ │ -127 │ │ │ │ -_1_3_0 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d () │ │ │ │ -131 { │ │ │ │ -132 return _I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ -133 } │ │ │ │ -134 │ │ │ │ -_1_3_7 _I_t_e_r_a_t_o_r _b_e_f_o_r_e_B_e_g_i_n () │ │ │ │ -138 { │ │ │ │ -139 return _I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ -140 } │ │ │ │ +_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&> │ │ │ │ +120 { │ │ │ │ +121 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_t_y_p_e, │ │ │ │ +122 typename std::remove_const_:_:_t_y_p_e >; │ │ │ │ +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() = default; │ │ │ │ +129 │ │ │ │ +_1_3_0 _L_e_v_e_l_I_t_e_r_a_t_o_r(std::shared_ptr element) │ │ │ │ +131 : element_(std::move(element)) │ │ │ │ +132 {} │ │ │ │ +133 │ │ │ │ +135 template , std:: │ │ │ │ +remove_const_t>, int> = 0, │ │ │ │ +137 std::enable_if_t, std:: │ │ │ │ +remove_const_t>, int> = 0> │ │ │ │ +_1_3_8 _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_<_C___,_T_1___>& other) │ │ │ │ +139 : element_(other.element_) │ │ │ │ +140 {} │ │ │ │ 141 │ │ │ │ -142 │ │ │ │ -_1_4_4 typedef ContainerWrapperIterator _C_o_n_s_t_I_t_e_r_a_t_o_r; │ │ │ │ -_1_4_6 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_4_8 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_5_0 typedef typename const_row_type::ConstIterator _C_o_n_s_t_C_o_l_I_t_e_r_a_t_o_r; │ │ │ │ -151 │ │ │ │ -_1_5_3 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_g_i_n () const │ │ │ │ -154 { │ │ │ │ -155 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),0); │ │ │ │ -156 } │ │ │ │ -157 │ │ │ │ -_1_5_9 _C_o_n_s_t_I_t_e_r_a_t_o_r _e_n_d () const │ │ │ │ -160 { │ │ │ │ -161 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n); │ │ │ │ -162 } │ │ │ │ -163 │ │ │ │ -_1_6_6 _C_o_n_s_t_I_t_e_r_a_t_o_r _b_e_f_o_r_e_E_n_d() const │ │ │ │ -167 { │ │ │ │ -168 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),n-1); │ │ │ │ -169 } │ │ │ │ -170 │ │ │ │ -_1_7_3 _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 │ │ │ │ -174 { │ │ │ │ -175 return _C_o_n_s_t_I_t_e_r_a_t_o_r(WrapperType(this),-1); │ │ │ │ -176 } │ │ │ │ -177 │ │ │ │ -181 │ │ │ │ -_1_8_3 _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) │ │ │ │ -184 { │ │ │ │ -185 p_ += y.p_; │ │ │ │ -186 return *this; │ │ │ │ -187 } │ │ │ │ -188 │ │ │ │ -_1_9_0 _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) │ │ │ │ -191 { │ │ │ │ -192 p_ -= y.p_; │ │ │ │ -193 return *this; │ │ │ │ +142 template , std:: │ │ │ │ +remove_const_t>, int> = 0, │ │ │ │ +144 std::enable_if_t, std:: │ │ │ │ +remove_const_t>, int> = 0> │ │ │ │ +_1_4_5 _L_e_v_e_l_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(const _L_e_v_e_l_I_t_e_r_a_t_o_r_<_C___,_T_1___>& other) │ │ │ │ +146 { │ │ │ │ +147 element_ = other.element_; │ │ │ │ +148 return *this; │ │ │ │ +149 } │ │ │ │ +150 │ │ │ │ +_1_5_4 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +155 typename std::remove_const::type>& other) const │ │ │ │ +156 { │ │ │ │ +157 return element_ == other.element_; │ │ │ │ +158 } │ │ │ │ +159 │ │ │ │ +_1_6_3 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ +164 const typename std::remove_const::type>& other) const │ │ │ │ +165 { │ │ │ │ +166 return element_ == other.element_; │ │ │ │ +167 } │ │ │ │ +168 │ │ │ │ +_1_7_0 T1& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ +171 { │ │ │ │ +172 return *(element_->element_); │ │ │ │ +173 } │ │ │ │ +174 │ │ │ │ +_1_7_6 void _i_n_c_r_e_m_e_n_t() │ │ │ │ +177 { │ │ │ │ +178 element_ = element_->coarser_.lock(); │ │ │ │ +179 } │ │ │ │ +180 │ │ │ │ +_1_8_2 void _d_e_c_r_e_m_e_n_t() │ │ │ │ +183 { │ │ │ │ +184 element_ = element_->finer_; │ │ │ │ +185 } │ │ │ │ +186 │ │ │ │ +_1_9_1 bool _i_s_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ +192 { │ │ │ │ +193 return (bool)element_->redistributed_; │ │ │ │ 194 } │ │ │ │ 195 │ │ │ │ -_2_0_0 _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) │ │ │ │ +_2_0_0 T1& _g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ 201 { │ │ │ │ -202 p_ += k; │ │ │ │ -203 return *this; │ │ │ │ +202 assert(element_->redistributed_); │ │ │ │ +203 return *element_->redistributed_; │ │ │ │ 204 } │ │ │ │ -205 │ │ │ │ -_2_1_0 _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) │ │ │ │ +_2_0_5 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d(std::shared_ptr t) │ │ │ │ +206 { │ │ │ │ +207 element_->redistributed_ = t; │ │ │ │ +208 } │ │ │ │ +209 │ │ │ │ +_2_1_0 void _d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d() │ │ │ │ 211 { │ │ │ │ -212 p_ -= k; │ │ │ │ -213 return *this; │ │ │ │ -214 } │ │ │ │ -215 │ │ │ │ -_2_1_7 _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) │ │ │ │ -218 { │ │ │ │ -219 p_ *= k; │ │ │ │ -220 return *this; │ │ │ │ -221 } │ │ │ │ -222 │ │ │ │ -_2_2_4 _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) │ │ │ │ -225 { │ │ │ │ -226 p_ /= k; │ │ │ │ -227 return *this; │ │ │ │ -228 } │ │ │ │ -229 │ │ │ │ -231 template ::value, int> = 0> │ │ │ │ -_2_3_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) │ │ │ │ -234 { │ │ │ │ -235 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}; │ │ │ │ -236 } │ │ │ │ +212 element_->redistributed_ = nullptr; │ │ │ │ +213 } │ │ │ │ +214 │ │ │ │ +215 private: │ │ │ │ +216 std::shared_ptr element_ = {}; │ │ │ │ +217 }; │ │ │ │ +218 │ │ │ │ +_2_2_0 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; │ │ │ │ +221 │ │ │ │ +_2_2_3 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; │ │ │ │ +224 │ │ │ │ +_2_2_9 _I_t_e_r_a_t_o_r _f_i_n_e_s_t(); │ │ │ │ +230 │ │ │ │ +_2_3_5 _I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t(); │ │ │ │ +236 │ │ │ │ 237 │ │ │ │ -239 template ::value, int> = 0> │ │ │ │ -_2_4_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) │ │ │ │ -242 { │ │ │ │ -243 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()}; │ │ │ │ -244 } │ │ │ │ -245 │ │ │ │ -247 template │ │ │ │ -248 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; } │ │ │ │ -_2_4_9 friend auto& _o_p_e_r_a_t_o_r_+_=_ (_F_i_e_l_d_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_n_,_n_>& fieldMatrix, │ │ │ │ -250 const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& matrix) │ │ │ │ -251 { │ │ │ │ -252 for (int i=0; i │ │ │ │ -260 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; } │ │ │ │ -_2_6_1 friend auto _o_p_e_r_a_t_o_r_+_ (const _F_i_e_l_d_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_n_,_n_>& fieldMatrix, │ │ │ │ -262 const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& matrix) │ │ │ │ -263 { │ │ │ │ -264 using Result = _F_i_e_l_d_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_,_O_t_h_e_r_S_c_a_l_a_r_>_:_: │ │ │ │ -_P_r_o_m_o_t_e_d_T_y_p_e,n,n>; │ │ │ │ -265 Result result = fieldMatrix; │ │ │ │ -266 result += matrix; │ │ │ │ -267 return result; │ │ │ │ -268 } │ │ │ │ -269 │ │ │ │ -271 template │ │ │ │ -272 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; } │ │ │ │ -_2_7_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, │ │ │ │ -274 const _F_i_e_l_d_M_a_t_r_i_x_<_O_t_h_e_r_S_c_a_l_a_r_,_n_,_n_>& fieldMatrix) │ │ │ │ -275 { │ │ │ │ -276 return fieldMatrix + matrix; │ │ │ │ -277 } │ │ │ │ -278 │ │ │ │ -280 template │ │ │ │ -281 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; } │ │ │ │ -_2_8_2 friend auto _o_p_e_r_a_t_o_r_+_=_ (DiagonalMatrix& diagonalMatrix, │ │ │ │ -283 const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& matrix) │ │ │ │ -284 { │ │ │ │ -285 for (std::size_t i=0; i │ │ │ │ -293 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; } │ │ │ │ -_2_9_4 friend auto _o_p_e_r_a_t_o_r_+_ (const DiagonalMatrix& diagonalMatrix, │ │ │ │ -295 const _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x& matrix) │ │ │ │ -296 { │ │ │ │ -297 using Result = DiagonalMatrix:: │ │ │ │ -PromotedType,n>; │ │ │ │ -298 Result result = diagonalMatrix; │ │ │ │ -299 result += matrix; │ │ │ │ -300 return result; │ │ │ │ -301 } │ │ │ │ -302 │ │ │ │ -304 template │ │ │ │ -305 requires requires(K k, OtherScalar otherScalar) { k + otherScalar; } │ │ │ │ -_3_0_6 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, │ │ │ │ -307 const DiagonalMatrix& diagonalMatrix) │ │ │ │ -308 { │ │ │ │ -309 return diagonalMatrix + matrix; │ │ │ │ -310 } │ │ │ │ -311 │ │ │ │ -312 │ │ │ │ -313 //===== comparison ops │ │ │ │ -314 │ │ │ │ -_3_1_6 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 │ │ │ │ -317 { │ │ │ │ -318 return p_==other._s_c_a_l_a_r(); │ │ │ │ -319 } │ │ │ │ -320 │ │ │ │ -_3_2_2 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 │ │ │ │ -323 { │ │ │ │ -324 return p_!=other._s_c_a_l_a_r(); │ │ │ │ -325 } │ │ │ │ -326 │ │ │ │ +_2_4_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_e_s_t() const; │ │ │ │ +243 │ │ │ │ +_2_4_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t() const; │ │ │ │ +249 │ │ │ │ +_2_5_4 std::size_t _l_e_v_e_l_s() const; │ │ │ │ +255 │ │ │ │ +256 private: │ │ │ │ +262 std::shared_ptr originalFinest_; │ │ │ │ +264 std::shared_ptr finest_; │ │ │ │ +266 std::shared_ptr coarsest_; │ │ │ │ +268 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ +270 int levels_; │ │ │ │ +271 }; │ │ │ │ +272 │ │ │ │ +273 template │ │ │ │ +_2_7_4 _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) │ │ │ │ +275 : originalFinest_(first) │ │ │ │ +276 { │ │ │ │ +277 finest_ = std::allocate_shared(allocator_); │ │ │ │ +278 finest_->element_ = originalFinest_; │ │ │ │ +279 coarsest_ = finest_; │ │ │ │ +280 levels_ = 1; │ │ │ │ +281 } │ │ │ │ +282 │ │ │ │ +284 //TODO: do we actually want to support this? This might be very expensive?! │ │ │ │ +285 template │ │ │ │ +_2_8_6 _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) │ │ │ │ +287 : allocator_(other.allocator_), │ │ │ │ +288 levels_(other.levels_) │ │ │ │ +289 { │ │ │ │ +290 if(!other.finest_) │ │ │ │ +291 { │ │ │ │ +292 finest_=coarsest_=nullptr; │ │ │ │ +293 return; │ │ │ │ +294 } │ │ │ │ +295 finest_ = std::allocate_shared(allocator_); │ │ │ │ +296 std::shared_ptr finer_; │ │ │ │ +297 std::shared_ptr current_ = finest_; │ │ │ │ +298 std::weak_ptr otherWeak_ = other.finest_; │ │ │ │ +299 │ │ │ │ +300 while(! otherWeak_.expired()) │ │ │ │ +301 { │ │ │ │ +302 // create shared_ptr from weak_ptr, we just checked that this is safe │ │ │ │ +303 std::shared_ptr otherCurrent_ = std::shared_ptr │ │ │ │ +(otherWeak_); │ │ │ │ +304 // clone current level │ │ │ │ +305 //TODO: should we use the allocator? │ │ │ │ +306 current_->element_ = │ │ │ │ +307 std::make_shared(*(otherCurrent_->element_)); │ │ │ │ +308 current_->finer_=finer_; │ │ │ │ +309 if(otherCurrent_->redistributed_) │ │ │ │ +310 current_->redistributed_ = │ │ │ │ +311 std::make_shared(*(otherCurrent_->redistributed_)); │ │ │ │ +312 finer_=current_; │ │ │ │ +313 if(not otherCurrent_->coarser_.expired()) │ │ │ │ +314 { │ │ │ │ +315 auto c = std::allocate_shared(allocator_); │ │ │ │ +316 current_->coarser_ = c; │ │ │ │ +317 current_ = c; │ │ │ │ +318 } │ │ │ │ +319 // go to coarser level │ │ │ │ +320 otherWeak_ = otherCurrent_->coarser_; │ │ │ │ +321 } │ │ │ │ +322 coarsest_=current_; │ │ │ │ +323 } │ │ │ │ +324 │ │ │ │ +325 template │ │ │ │ +_3_2_6 std::size_t _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ +327 { │ │ │ │ +328 return levels_; │ │ │ │ +329 } │ │ │ │ 330 │ │ │ │ -332 template │ │ │ │ -_3_3_3 void _m_v (const X& x, Y& y) const │ │ │ │ -334 { │ │ │ │ -335#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -336 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -337 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -338#endif │ │ │ │ -339 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_4_5 void _m_t_v (const X& x, Y& y) const │ │ │ │ -346 { │ │ │ │ -347 _m_v(x, y); │ │ │ │ -348 } │ │ │ │ -349 │ │ │ │ -351 template │ │ │ │ -_3_5_2 void _u_m_v (const X& x, Y& y) const │ │ │ │ -353 { │ │ │ │ -354#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -355 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -356 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -357#endif │ │ │ │ -358 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_6_4 void _u_m_t_v (const X& x, Y& y) const │ │ │ │ -365 { │ │ │ │ -366#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -367 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -368 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -369#endif │ │ │ │ -370 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_3_7_6 void _u_m_h_v (const X& x, Y& y) const │ │ │ │ -377 { │ │ │ │ -378#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -379 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -380 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -381#endif │ │ │ │ -382 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ +_3_3_2 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) │ │ │ │ +333 { │ │ │ │ +334 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); │ │ │ │ +335 } │ │ │ │ +336 │ │ │ │ +337 template │ │ │ │ +_3_3_8 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) │ │ │ │ +339 { │ │ │ │ +340 if(!coarsest_) { │ │ │ │ +341 // we have no levels at all... │ │ │ │ +342 assert(!finest_); │ │ │ │ +343 // allocate into the shared_ptr │ │ │ │ +344 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); │ │ │ │ +345 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ +346 coarsest_->element_ = originalFinest_; │ │ │ │ +347 finest_ = coarsest_; │ │ │ │ +348 }else{ │ │ │ │ +349 auto old_coarsest = coarsest_; │ │ │ │ +350 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ +351 coarsest_->finer_ = old_coarsest; │ │ │ │ +352 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); │ │ │ │ +353 old_coarsest->coarser_ = coarsest_; │ │ │ │ +354 } │ │ │ │ +355 ++levels_; │ │ │ │ +356 } │ │ │ │ +357 │ │ │ │ +358 │ │ │ │ +359 template │ │ │ │ +_3_6_0 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) │ │ │ │ +361 { │ │ │ │ +362 //TODO: wouldn't it be better to do this in the constructor?' │ │ │ │ +363 if(!finest_) { │ │ │ │ +364 // we have no levels at all... │ │ │ │ +365 assert(!coarsest_); │ │ │ │ +366 // allocate into the shared_ptr │ │ │ │ +367 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); │ │ │ │ +368 finest_ = std::allocate_shared(allocator_); │ │ │ │ +369 finest_->element = originalFinest_; │ │ │ │ +370 coarsest_ = finest_; │ │ │ │ +371 }else{ │ │ │ │ +372 finest_->finer_ = std::allocate_shared(allocator_); │ │ │ │ +373 finest_->finer_->coarser_ = finest_; │ │ │ │ +374 finest_ = finest_->finer_; │ │ │ │ +375 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); │ │ │ │ +376 } │ │ │ │ +377 ++levels_; │ │ │ │ +378 } │ │ │ │ +379 │ │ │ │ +380 template │ │ │ │ +_3_8_1 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() │ │ │ │ +382 { │ │ │ │ +383 return _I_t_e_r_a_t_o_r(finest_); │ │ │ │ 384 } │ │ │ │ 385 │ │ │ │ -387 template │ │ │ │ -_3_8_8 void _m_m_v (const X& x, Y& y) const │ │ │ │ -389 { │ │ │ │ -390#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -391 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -392 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -393#endif │ │ │ │ -394 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ +_3_8_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_>_:_:_c_o_a_r_s_e_s_t() │ │ │ │ +388 { │ │ │ │ +389 return _I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ +390 } │ │ │ │ +391 │ │ │ │ +392 template │ │ │ │ +_3_9_3 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 │ │ │ │ +394 { │ │ │ │ +395 return _C_o_n_s_t_I_t_e_r_a_t_o_r(finest_); │ │ │ │ 396 } │ │ │ │ 397 │ │ │ │ -399 template │ │ │ │ -_4_0_0 void _m_m_t_v (const X& x, Y& y) const │ │ │ │ -401 { │ │ │ │ -402#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -403 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -404 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -405#endif │ │ │ │ -406 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_4_1_2 void _m_m_h_v (const X& x, Y& y) const │ │ │ │ -413 { │ │ │ │ -414#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -415 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -416 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -417#endif │ │ │ │ -418 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_4_2_4 void _u_s_m_v (const K& alpha, const X& x, Y& y) const │ │ │ │ -425 { │ │ │ │ -426#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -427 if (x.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -428 if (y.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -429#endif │ │ │ │ -430 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_4_3_6 void _u_s_m_t_v (const K& alpha, const X& x, Y& y) const │ │ │ │ -437 { │ │ │ │ -438#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -439 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -440 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -441#endif │ │ │ │ -442 for (_s_i_z_e___t_y_p_e i=0; i │ │ │ │ -_4_4_8 void _u_s_m_h_v (const K& alpha, const X& x, Y& y) const │ │ │ │ -449 { │ │ │ │ -450#ifdef DUNE_FMatrix_WITH_CHECKING │ │ │ │ -451 if (x.N()!=_N()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -452 if (y.N()!=_M()) DUNE_THROW(FMatrixError,"index out of range"); │ │ │ │ -453#endif │ │ │ │ -454 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 │ │ │ │ -467 { │ │ │ │ -468 return fvmeta::sqrt(n*p_*p_); │ │ │ │ -469 } │ │ │ │ -470 │ │ │ │ -_4_7_2 typename FieldTraits::real_type _f_r_o_b_e_n_i_u_s___n_o_r_m_2 () const │ │ │ │ -473 { │ │ │ │ -474 return n*p_*p_; │ │ │ │ -475 } │ │ │ │ -476 │ │ │ │ -_4_8_2 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m () const │ │ │ │ -483 { │ │ │ │ -484 return std::abs(p_); │ │ │ │ -485 } │ │ │ │ -486 │ │ │ │ -_4_8_8 typename FieldTraits::real_type _i_n_f_i_n_i_t_y___n_o_r_m___r_e_a_l () const │ │ │ │ -489 { │ │ │ │ -490 return fvmeta::absreal(p_); │ │ │ │ -491 } │ │ │ │ -492 │ │ │ │ -494 │ │ │ │ -499 template │ │ │ │ -_5_0_0 void _s_o_l_v_e (V& x, const V& b) const │ │ │ │ -501 { │ │ │ │ -502 for (int i=0; i=n) DUNE_THROW(FMatrixError,"row index out of range"); │ │ │ │ -539 if (j<0 || j>=n) DUNE_THROW(FMatrixError,"column index out of range"); │ │ │ │ -540#endif │ │ │ │ -541 return i==j; │ │ │ │ -542 } │ │ │ │ -543 │ │ │ │ -544 //===== conversion operator │ │ │ │ -545 │ │ │ │ -_5_4_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) │ │ │ │ -548 { │ │ │ │ -549 for (_s_i_z_e___t_y_p_e i=0; i(&p_), i); │ │ │ │ -561 } │ │ │ │ -562 │ │ │ │ -_5_6_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 │ │ │ │ -565 { │ │ │ │ -566 return _c_o_n_s_t___r_e_f_e_r_e_n_c_e(const_cast(&p_), i); │ │ │ │ -567 } │ │ │ │ -568 │ │ │ │ -_5_7_0 const K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) const │ │ │ │ -571 { │ │ │ │ -572 return p_; │ │ │ │ -573 } │ │ │ │ -574 │ │ │ │ -_5_7_6 K& _d_i_a_g_o_n_a_l(_s_i_z_e___t_y_p_e /*i*/) │ │ │ │ -577 { │ │ │ │ -578 return p_; │ │ │ │ -579 } │ │ │ │ -580 │ │ │ │ -_5_8_3 const K& _s_c_a_l_a_r() const │ │ │ │ -584 { │ │ │ │ -585 return p_; │ │ │ │ -586 } │ │ │ │ -587 │ │ │ │ -_5_9_0 K& _s_c_a_l_a_r() │ │ │ │ -591 { │ │ │ │ -592 return p_; │ │ │ │ -593 } │ │ │ │ -594 │ │ │ │ -595 private: │ │ │ │ -596 // the data, very simply a single number │ │ │ │ -597 K p_; │ │ │ │ -598 │ │ │ │ -599 }; │ │ │ │ -600 │ │ │ │ -601 template │ │ │ │ -_6_0_2 struct DenseMatrixAssigner> { │ │ │ │ -_6_0_3 static void _a_p_p_l_y(DenseMatrix& denseMatrix, │ │ │ │ -604 _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) { │ │ │ │ -605 assert(denseMatrix.M() == N); │ │ │ │ -606 assert(denseMatrix.N() == N); │ │ │ │ -607 denseMatrix = field(0); │ │ │ │ -608 for (int i = 0; i < N; ++i) │ │ │ │ -609 denseMatrix[i][i] = rhs._s_c_a_l_a_r(); │ │ │ │ -610 } │ │ │ │ -611 }; │ │ │ │ -612 │ │ │ │ -613 template │ │ │ │ -_6_1_4 struct FieldTraits< _S_c_a_l_e_d_I_d_e_n_t_i_t_y_M_a_t_r_i_x > │ │ │ │ -615 { │ │ │ │ -_6_1_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; │ │ │ │ -_6_1_7 using _r_e_a_l___t_y_p_e = typename FieldTraits::real_type; │ │ │ │ -618 }; │ │ │ │ -619 │ │ │ │ -620} // end namespace │ │ │ │ -621 │ │ │ │ -622#endif │ │ │ │ +398 template │ │ │ │ +_3_9_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_>_:_:_c_o_a_r_s_e_s_t() const │ │ │ │ +400 { │ │ │ │ +401 return _C_o_n_s_t_I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ +402 } │ │ │ │ +403 │ │ │ │ +404 } // namespace Amg │ │ │ │ +405} // namespace Dune │ │ │ │ +406 │ │ │ │ +407#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:286 │ │ │ │ +_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 &) │ │ │ │ +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_:_:_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:332 │ │ │ │ +_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:326 │ │ │ │ +_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:399 │ │ │ │ +_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:338 │ │ │ │ +_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:360 │ │ │ │ +_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:274 │ │ │ │ +_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_:_:_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:387 │ │ │ │ +_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:393 │ │ │ │ +_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:381 │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_F_i_e_l_d_M_a_t_r_i_x │ │ │ │ -DDeeffiinniittiioonn matrixutils.hh:27 │ │ │ │ -_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:42 │ │ │ │ -_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: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_:_:_m_m_t_v │ │ │ │ -void mmtv(const X &x, Y &y) const │ │ │ │ -y -= A^T x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:400 │ │ │ │ -_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:190 │ │ │ │ -_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: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_:_:_e_n_d │ │ │ │ -ConstIterator end() const │ │ │ │ -end iterator │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:159 │ │ │ │ -_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:137 │ │ │ │ -_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 │ │ │ │ -static constexpr std::integral_constant< size_type, n > rows │ │ │ │ -The number of matrix rows. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:73 │ │ │ │ -_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 │ │ │ │ -Test for inequality. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:322 │ │ │ │ -_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:388 │ │ │ │ -_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 indices and sizes. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:55 │ │ │ │ -_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:424 │ │ │ │ -_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: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_:_:_c_o_n_s_t___r_e_f_e_r_e_n_c_e │ │ │ │ -const_row_type const_reference │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:70 │ │ │ │ -_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:333 │ │ │ │ -_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:364 │ │ │ │ -_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:376 │ │ │ │ -_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 │ │ │ │ -Type of a single matrix row. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:65 │ │ │ │ -_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:108 │ │ │ │ -_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: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_:_:_d_e_t_e_r_m_i_n_a_n_t │ │ │ │ -K determinant() const │ │ │ │ -Calculates the determinant of this matrix. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:514 │ │ │ │ -_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 │ │ │ │ -The type representing numbers. │ │ │ │ -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_:_:_u_s_m_t_v │ │ │ │ -void usmtv(const K &alpha, const X &x, Y &y) const │ │ │ │ -y += alpha A^T x │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:436 │ │ │ │ -_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: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_:_:_i_t_e_r_a_t_o_r │ │ │ │ -Iterator iterator │ │ │ │ -typedef for stl compliant access │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:110 │ │ │ │ -_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 │ │ │ │ -static constexpr std::integral_constant< size_type, n > cols │ │ │ │ -The number of matrix columns. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:76 │ │ │ │ -_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:583 │ │ │ │ -_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 FieldMatrix< OtherScalar, n, n > &fieldMatrix, │ │ │ │ -const ScaledIdentityMatrix &matrix) │ │ │ │ -Addition of ScaledIdentityMatrix to FieldMatrix. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:261 │ │ │ │ -_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:352 │ │ │ │ -_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:570 │ │ │ │ -_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) │ │ │ │ -Assignment from scalar. │ │ │ │ -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_I_t_e_r_a_t_o_r │ │ │ │ -ContainerWrapperIterator< const WrapperType, const_reference, const_reference > │ │ │ │ -ConstIterator │ │ │ │ -Iterator class for sequential access. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:144 │ │ │ │ -_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:576 │ │ │ │ -_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 linear system A x = b. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:500 │ │ │ │ -_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 if (i,j) is in the matrix pattern, i.e., if i==j. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:535 │ │ │ │ -_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:112 │ │ │ │ -_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:146 │ │ │ │ -_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:81 │ │ │ │ -_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 │ │ │ │ -Test for equality. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:316 │ │ │ │ -_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:173 │ │ │ │ -_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:224 │ │ │ │ -_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:547 │ │ │ │ -_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 │ │ │ │ -The square of the Frobenius norm. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:472 │ │ │ │ -_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 │ │ │ │ -The Frobenius norm. │ │ │ │ -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_:_:_i_n_f_i_n_i_t_y___n_o_r_m │ │ │ │ -FieldTraits< field_type >::real_type infinity_norm() const │ │ │ │ -The row sum norm. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:482 │ │ │ │ -_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:148 │ │ │ │ -_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:166 │ │ │ │ -_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:527 │ │ │ │ -_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:564 │ │ │ │ -_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: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_:_:_o_p_e_r_a_t_o_r_* │ │ │ │ -friend auto operator*(const ScaledIdentityMatrix &matrix, Scalar scalar) │ │ │ │ -Vector space multiplication with scalar. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:233 │ │ │ │ -_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:488 │ │ │ │ -_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:217 │ │ │ │ -_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 │ │ │ │ -Check if matrix is identical to other matrix. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:101 │ │ │ │ -_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:508 │ │ │ │ -_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:117 │ │ │ │ -_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:590 │ │ │ │ -_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: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_:_:_b_l_o_c_k___t_y_p_e │ │ │ │ -K block_type │ │ │ │ -The type representing matrix entries (which may be matrices themselves). │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:52 │ │ │ │ -_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:412 │ │ │ │ -_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:183 │ │ │ │ -_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 │ │ │ │ -Const type of a single row. │ │ │ │ -DDeeffiinniittiioonn scaledidmatrix.hh:69 │ │ │ │ -_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:345 │ │ │ │ -_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:558 │ │ │ │ -_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:153 │ │ │ │ -_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:521 │ │ │ │ -_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:603 │ │ │ │ -_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:616 │ │ │ │ -_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:617 │ │ │ │ +_D_u_n_e_:_:_t_y_p_e │ │ │ │ +const Dtype_t BaseGetSuperLUType< T >::type │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:135 │ │ │ │ +_D_u_n_e_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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:220 │ │ │ │ +_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:223 │ │ │ │ +_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_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ +LevelIterator & operator=(const LevelIterator< C_, T1_ > &other) │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:145 │ │ │ │ +_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:205 │ │ │ │ +_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:170 │ │ │ │ +_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:154 │ │ │ │ +_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:191 │ │ │ │ +_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:163 │ │ │ │ +_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:176 │ │ │ │ +_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:210 │ │ │ │ +_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:182 │ │ │ │ +_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< C_, T1_ > &other) │ │ │ │ +Copy constructor. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:138 │ │ │ │ +_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:200 │ │ │ │ +_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()=default │ │ │ │ +Constructor. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,71 +66,46 @@ │ │ │
│ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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,52 +1,25 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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) │ │ │ │ -********** 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. │ │ │ │ +namespace   _D_u_n_e_:_:_A_m_g │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,227 +66,171 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
31
│ │ │ -
41
│ │ │ -
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 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 real_type norm (const X& x) const override
│ │ │ -
150 {
│ │ │ -
151 return _communication->norm(x);
│ │ │ -
152 }
│ │ │ -
│ │ │ -
153
│ │ │ -
│ │ │ - │ │ │ -
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 {
│ │ │ - │ │ │ -
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
│ │ │ -
211
│ │ │ -
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
│ │ │ -
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
│ │ │ -
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
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the scalar product (see SolverCategory::Category).
Definition scalarproducts.hh:155
│ │ │ -
X::field_type field_type
The field type used by the vector type domain_type.
Definition scalarproducts.hh:107
│ │ │ -
Default implementation for the scalar case.
Definition scalarproducts.hh:168
│ │ │ -
NonoverlappingSchwarzScalarProduct(std::shared_ptr< const C > comm)
Definition scalarproducts.hh:181
│ │ │ -
NonoverlappingSchwarzScalarProduct(const C &comm)
Definition scalarproducts.hh:184
│ │ │ -
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 novlpschwarz.hh:256
│ │ │ +
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,261 +1,179 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 { │ │ │ │ -31 │ │ │ │ -41 │ │ │ │ -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 _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 _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 _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_:_:_S_c_a_l_a_r_P_r_o_d_u_c_t; │ │ │ │ -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 │ │ │ │ -211 │ │ │ │ -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 _m_a_k_e_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>(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 _A_m_g │ │ │ │ +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_:_:_d_o_t │ │ │ │ -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_:_:_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_:_:_n_o_r_m │ │ │ │ -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_:_:_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 │ │ │ │ -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_:_:_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_:_:_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_:_:_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_:_:_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 │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,82 +66,100 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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 <dune/common/typetraits.hh>
│ │ │ +#include <utility>
│ │ │ +#include <set>
│ │ │ +#include <algorithm>
│ │ │ +#include <complex>
│ │ │ +#include <limits>
│ │ │ +#include <ostream>
│ │ │ +#include <tuple>
│ │ │ +#include <cmath>
│ │ │
│ │ │

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
│ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │

│ │ │ -Typedefs

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

│ │ │ 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
│ │ │ +

Provides classes for the Coloring process of AMG.

│ │ │ +
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,67 +1,86 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ +#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_._._. │ │ │ │ + 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_._._. │ │ │ │ +struct   _D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +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 │ │ │ │ -namespace   _D_u_n_e_:_:_M_e_t_i_s │ │ │ │ -TTyyppeeddeeffss │ │ │ │ -using  _D_u_n_e_:_:_M_e_t_i_s_:_:_r_e_a_l___t = float │ │ │ │ -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 &mat, _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 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,1851 +66,2272 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ - │ │ │ - │ │ │ +
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#include <dune/common/typetraits.hh>
│ │ │ +
21
│ │ │ +
22#include <utility>
│ │ │ +
23#include <set>
│ │ │ +
24#include <algorithm>
│ │ │ +
25#include <complex>
│ │ │ +
26#include <limits>
│ │ │ +
27#include <ostream>
│ │ │ +
28#include <tuple>
│ │ │ +
29#include <cmath>
│ │ │ +
30
│ │ │ +
31namespace Dune
│ │ │ +
32{
│ │ │ +
33 namespace Amg
│ │ │ +
34 {
│ │ │
35
│ │ │ -
43
│ │ │ -
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.
│ │ │ +
45
│ │ │ +
49 template<class T>
│ │ │ +
│ │ │ +
50 class AggregationCriterion : public T
│ │ │ +
51 {
│ │ │ +
52
│ │ │ +
53 public:
│ │ │ + │ │ │ +
58
│ │ │ +
│ │ │ + │ │ │ +
69 : T()
│ │ │ +
70 {}
│ │ │ +
│ │ │ +
71
│ │ │ +
│ │ │ + │ │ │ +
73 : T(parms)
│ │ │ +
74 {}
│ │ │ +
│ │ │ +
75
│ │ │ +
│ │ │ +
84 void setDefaultValuesIsotropic(std::size_t dim, std::size_t diameter=2)
│ │ │ +
85 {
│ │ │ +
86 this->setMaxDistance(diameter-1);
│ │ │ +
87 std::size_t csize=1;
│ │ │ +
88
│ │ │ +
89 for(; dim>0; dim--) {
│ │ │ +
90 csize*=diameter;
│ │ │ +
91 this->setMaxDistance(this->maxDistance()+diameter-1);
│ │ │ +
92 }
│ │ │ +
93 this->setMinAggregateSize(csize);
│ │ │ +
94 this->setMaxAggregateSize(static_cast<std::size_t>(csize*1.5));
│ │ │ +
95 }
│ │ │ +
│ │ │ +
96
│ │ │ +
│ │ │ +
107 void setDefaultValuesAnisotropic(std::size_t dim,std::size_t diameter=2)
│ │ │ +
108 {
│ │ │ +
109 setDefaultValuesIsotropic(dim, diameter);
│ │ │ +
110 this->setMaxDistance(this->maxDistance()+dim-1);
│ │ │ +
111 }
│ │ │ +
│ │ │ +
112 };
│ │ │ +
│ │ │
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 {
│ │ │ -
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 }
│ │ │ -
175 int globalOwnerVertices;
│ │ │ -
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;
│ │ │ +
114 template<class T>
│ │ │ +
│ │ │ +
115 std::ostream& operator<<(std::ostream& os, const AggregationCriterion<T>& criterion)
│ │ │ +
116 {
│ │ │ +
117 os<<"{ maxdistance="<<criterion.maxDistance()<<" minAggregateSize="
│ │ │ +
118 <<criterion.minAggregateSize()<< " maxAggregateSize="<<criterion.maxAggregateSize()
│ │ │ +
119 <<" connectivity="<<criterion.maxConnectivity()<<" debugLevel="<<criterion.debugLevel()<<"}";
│ │ │ +
120 return os;
│ │ │ +
121 }
│ │ │ +
│ │ │ +
122
│ │ │ +
134 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
136 {
│ │ │ +
137 public:
│ │ │ +
141 typedef M Matrix;
│ │ │ +
142
│ │ │ +
146 typedef N Norm;
│ │ │ +
147
│ │ │ +
151 typedef typename Matrix::row_type Row;
│ │ │ +
152
│ │ │ + │ │ │ +
157
│ │ │ +
158 void init(const Matrix* matrix);
│ │ │ +
159
│ │ │ +
160 void initRow(const Row& row, int index);
│ │ │ +
161
│ │ │ +
162 void examine(const ColIter& col);
│ │ │ +
163
│ │ │ +
164 template<class G>
│ │ │ +
165 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ +
166
│ │ │ +
167 bool isIsolated();
│ │ │ +
168
│ │ │ +
169
│ │ │ +
│ │ │ + │ │ │ +
171 : Parameters(parms)
│ │ │ +
172 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
174 : Parameters()
│ │ │ +
175 {}
│ │ │ +
│ │ │ +
176
│ │ │ +
177 protected:
│ │ │ + │ │ │ + │ │ │ +
182 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ + │ │ │ + │ │ │ +
187 int row_;
│ │ │ + │ │ │ +
190 std::vector<real_type> vals_;
│ │ │ +
191 typename std::vector<real_type>::iterator valIter_;
│ │ │ +
192
│ │ │ +
193 };
│ │ │ +
│ │ │ +
194
│ │ │ +
195
│ │ │ +
196 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
198 {
│ │ │ +
199 matrix_ = matrix;
│ │ │ +
200 }
│ │ │ +
│ │ │ +
201
│ │ │ +
202 template<class M, class N>
│ │ │ +
│ │ │ +
203 inline void SymmetricMatrixDependency<M,N>::initRow(const Row& row, int index)
│ │ │ +
204 {
│ │ │ +
205 using std::min;
│ │ │ +
206 vals_.assign(row.size(), 0.0);
│ │ │ +
207 assert(vals_.size()==row.size());
│ │ │ +
208 valIter_=vals_.begin();
│ │ │ +
209
│ │ │ +
210 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ +
211 diagonal_=norm_(row[index]);
│ │ │ +
212 row_ = index;
│ │ │ +
213 }
│ │ │ +
│ │ │
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 }
│ │ │ -
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 }
│ │ │ -
│ │ │ -
283
│ │ │ -
│ │ │ -
284 void reserveSpaceForReceiveInterface(int proc, int size)
│ │ │ -
285 {
│ │ │ -
286 interfaces()[proc].second.reserve(size);
│ │ │ -
287 }
│ │ │ +
215 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
217 {
│ │ │ +
218 using std::max;
│ │ │ +
219 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ +
220 real_type eij = norm_(*col);
│ │ │ +
221 if(!N::is_sign_preserving || eij<0) // || eji<0)
│ │ │ +
222 {
│ │ │ +
223 *valIter_ = eij/diagonal_*eij/norm_(matrix_->operator[](col.index())[col.index()]);
│ │ │ + │ │ │ +
225 }else
│ │ │ +
226 *valIter_ =0;
│ │ │ +
227 ++valIter_;
│ │ │ +
228 }
│ │ │ +
│ │ │ +
229
│ │ │ +
230 template<class M, class N>
│ │ │ +
231 template<class G>
│ │ │ +
│ │ │ +
232 inline void SymmetricMatrixDependency<M,N>::examine(G&, const typename G::EdgeIterator& edge, const ColIter&)
│ │ │ +
233 {
│ │ │ +
234 if(*valIter_ > alpha() * maxValue_) {
│ │ │ +
235 edge.properties().setDepends();
│ │ │ +
236 edge.properties().setInfluences();
│ │ │ +
237 }
│ │ │ +
238 ++valIter_;
│ │ │ +
239 }
│ │ │
│ │ │ +
240
│ │ │ +
241 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
243 {
│ │ │ +
244 if(diagonal_==0)
│ │ │ +
245 DUNE_THROW(Dune::ISTLError, "No diagonal entry for row "<<row_<<".");
│ │ │ +
246 valIter_=vals_.begin();
│ │ │ +
247 return maxValue_ < beta();
│ │ │ +
248 }
│ │ │ +
│ │ │ +
249
│ │ │ +
253 template<class M, class N>
│ │ │ +
│ │ │ +
254 class Dependency : public Parameters
│ │ │ +
255 {
│ │ │ +
256 public:
│ │ │ +
260 typedef M Matrix;
│ │ │ +
261
│ │ │ +
265 typedef N Norm;
│ │ │ +
266
│ │ │ +
270 typedef typename Matrix::row_type Row;
│ │ │ +
271
│ │ │ + │ │ │ +
276
│ │ │ +
277 void init(const Matrix* matrix);
│ │ │ +
278
│ │ │ +
279 void initRow(const Row& row, int index);
│ │ │ +
280
│ │ │ +
281 void examine(const ColIter& col);
│ │ │ +
282
│ │ │ +
283 template<class G>
│ │ │ +
284 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ +
285
│ │ │ + │ │ │ +
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);
│ │ │ -
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 }
│ │ │ -
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
│ │ │ +
288 Dependency(const Parameters& parms)
│ │ │ +
289 : Parameters(parms)
│ │ │ +
290 {}
│ │ │ +
│ │ │ +
291
│ │ │ +
│ │ │ + │ │ │ +
293 : Parameters()
│ │ │ +
294 {}
│ │ │ +
│ │ │ +
295
│ │ │ +
296 protected:
│ │ │ + │ │ │ + │ │ │ +
301 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ + │ │ │ + │ │ │ +
306 int row_;
│ │ │ + │ │ │ +
309 };
│ │ │ +
│ │ │ +
310
│ │ │ +
314 template<class M, class N>
│ │ │ +
│ │ │ + │ │ │ +
316 {
│ │ │ +
317 public:
│ │ │ +
321 typedef M Matrix;
│ │ │ +
322
│ │ │ +
326 typedef N Norm;
│ │ │ +
327
│ │ │ +
331 typedef typename Matrix::row_type Row;
│ │ │ +
332
│ │ │ + │ │ │ +
337
│ │ │ +
338 void init(const Matrix* matrix);
│ │ │ +
339
│ │ │ +
340 void initRow(const Row& row, int index);
│ │ │ +
341
│ │ │ +
342 void examine(const ColIter& col);
│ │ │ +
343
│ │ │ +
344 template<class G>
│ │ │ +
345 void examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col);
│ │ │ +
346
│ │ │ + │ │ │ +
348
│ │ │ +
349
│ │ │ +
│ │ │ + │ │ │ +
351 : Parameters(parms)
│ │ │ +
352 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
354 : Parameters()
│ │ │ +
355 {}
│ │ │ +
│ │ │ +
356
│ │ │ +
357 protected:
│ │ │ + │ │ │ + │ │ │ +
362 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ + │ │ │ + │ │ │ +
367 int row_;
│ │ │ + │ │ │ +
370 private:
│ │ │ +
371 void initRow(const Row& row, int index, const std::true_type&);
│ │ │ +
372 void initRow(const Row& row, int index, const std::false_type&);
│ │ │ +
373 };
│ │ │ +
│ │ │ +
374
│ │ │ +
379 template<int N>
│ │ │ +
│ │ │ + │ │ │ +
381 {
│ │ │ +
382 public:
│ │ │ +
383 enum { /* @brief We preserve the sign.*/
│ │ │ + │ │ │ +
385 };
│ │ │ +
386
│ │ │ +
391 template<class M>
│ │ │ +
│ │ │ +
392 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m,
│ │ │ +
393 [[maybe_unused]] typename std::enable_if_t<!Dune::IsNumber<M>::value>* sfinae = nullptr) const
│ │ │ +
394 {
│ │ │ +
395 typedef typename M::field_type field_type;
│ │ │ +
396 typedef typename FieldTraits<field_type>::real_type real_type;
│ │ │ +
397 static_assert( std::is_convertible<field_type, real_type >::value,
│ │ │ +
398 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ +
399 return m[N][N];
│ │ │ +
400 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ +
401 }
│ │ │ +
│ │ │ +
402
│ │ │ +
407 template<class M>
│ │ │ +
│ │ │ +
408 auto operator()(const M& m,
│ │ │ +
409 typename std::enable_if_t<Dune::IsNumber<M>::value>* /*sfinae*/ = nullptr) const
│ │ │ +
410 {
│ │ │ +
411 typedef typename FieldTraits<M>::real_type real_type;
│ │ │ +
412 static_assert( std::is_convertible<M, real_type >::value,
│ │ │ +
413 "use of diagonal norm in AMG not implemented for complex field_type");
│ │ │ +
414 return m;
│ │ │ +
415 // possible implementation for complex types: return signed_abs(m[N][N]);
│ │ │ +
416 }
│ │ │ +
│ │ │ +
417
│ │ │ +
418 private:
│ │ │ +
419
│ │ │ +
421 template<typename T>
│ │ │ +
422 static T signed_abs(const T & v)
│ │ │ +
423 {
│ │ │ +
424 return v;
│ │ │ +
425 }
│ │ │ +
426
│ │ │ +
428 template<typename T>
│ │ │ +
429 static T signed_abs(const std::complex<T> & v)
│ │ │ +
430 {
│ │ │ +
431 // return sign * abs_value
│ │ │ +
432 // in case of complex numbers this extends to using the csgn function to determine the sign
│ │ │ +
433 return csgn(v) * std::abs(v);
│ │ │ +
434 }
│ │ │ +
435
│ │ │ +
437 template<typename T>
│ │ │ +
438 static T csgn(const T & v)
│ │ │ +
439 {
│ │ │ +
440 return (T(0) < v) - (v < T(0));
│ │ │ +
441 }
│ │ │ +
442
│ │ │ +
444 template<typename T>
│ │ │ +
445 static T csgn(std::complex<T> a)
│ │ │ +
446 {
│ │ │ +
447 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag());
│ │ │ +
448 }
│ │ │ +
449
│ │ │ +
450 };
│ │ │ +
│ │ │ +
451
│ │ │ +
│ │ │ +
456 class FirstDiagonal : public Diagonal<0>
│ │ │ +
457 {};
│ │ │ +
│ │ │ +
458
│ │ │ +
│ │ │ +
464 struct RowSum
│ │ │ +
465 {
│ │ │ +
466
│ │ │ +
467 enum { /* @brief We preserve the sign.*/
│ │ │ + │ │ │ +
469 };
│ │ │ +
474 template<class M>
│ │ │ +
│ │ │ +
475 auto operator()(const M& m) const
│ │ │ +
476 {
│ │ │ +
477 using std::abs;
│ │ │ +
478 if constexpr(Dune::IsNumber<M>::value)
│ │ │ +
479 return abs(m);
│ │ │ +
480 else
│ │ │ +
481 return m.infinity_norm();
│ │ │ +
482 }
│ │ │ +
│ │ │ +
483 };
│ │ │ +
│ │ │ +
484
│ │ │ +
│ │ │ + │ │ │ +
486 {
│ │ │ +
487
│ │ │ +
488 enum { /* @brief We preserve the sign.*/
│ │ │ + │ │ │ +
490 };
│ │ │ +
495 template<class M>
│ │ │ +
│ │ │ +
496 typename FieldTraits<typename M::field_type>::real_type operator()(const M& m) const
│ │ │ +
497 {
│ │ │ +
498 return m.frobenius_norm();
│ │ │ +
499 }
│ │ │ +
│ │ │ +
500 };
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
502 {
│ │ │ +
503
│ │ │ +
504 enum { /* @brief We preserve the sign.*/
│ │ │ + │ │ │ +
506 };
│ │ │ +
511 template<class M>
│ │ │ +
│ │ │ +
512 typename FieldTraits<typename M::field_type>::real_type operator()(const M& /*m*/) const
│ │ │ +
513 {
│ │ │ +
514 return 1;
│ │ │ +
515 }
│ │ │ +
│ │ │ +
516 };
│ │ │ +
│ │ │ +
517
│ │ │ +
523 template<class M, class Norm>
│ │ │ +
│ │ │ +
524 class SymmetricCriterion : public AggregationCriterion<SymmetricDependency<M,Norm> >
│ │ │ +
525 {
│ │ │ +
526 public:
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
529 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
531 {}
│ │ │ +
│ │ │ +
532 };
│ │ │ +
│ │ │ +
533
│ │ │ +
534
│ │ │ +
543 template<class M, class Norm>
│ │ │ +
│ │ │ +
544 class UnSymmetricCriterion : public AggregationCriterion<Dependency<M,Norm> >
│ │ │ +
545 {
│ │ │ +
546 public:
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
549 {}
│ │ │ +
│ │ │ +
│ │ │ + │ │ │ +
551 {}
│ │ │ +
│ │ │ +
552 };
│ │ │ +
│ │ │ +
553 // forward declaration
│ │ │ +
554 template<class G> class Aggregator;
│ │ │ +
555
│ │ │ +
556
│ │ │ +
564 template<class V>
│ │ │ +
│ │ │ + │ │ │ +
566 {
│ │ │ +
567 public:
│ │ │ +
568
│ │ │ +
572 static const V UNAGGREGATED;
│ │ │ +
573
│ │ │ +
577 static const V ISOLATED;
│ │ │ + │ │ │ +
582
│ │ │ + │ │ │ +
587
│ │ │ +
592 typedef PoolAllocator<VertexDescriptor,100> Allocator;
│ │ │ +
593
│ │ │ +
598 typedef SLList<VertexDescriptor,Allocator> VertexList;
│ │ │ +
599
│ │ │ +
│ │ │ + │ │ │ +
604 {
│ │ │ +
605 public:
│ │ │ +
606 template<class EdgeIterator>
│ │ │ +
│ │ │ +
607 void operator()([[maybe_unused]] const EdgeIterator& edge) const
│ │ │ +
608 {}
│ │ │ +
│ │ │ +
609 };
│ │ │ +
│ │ │ +
610
│ │ │ +
611
│ │ │ + │ │ │ +
616
│ │ │ + │ │ │ +
623
│ │ │ + │ │ │ +
628
│ │ │ +
640 template<class M, class G, class C>
│ │ │ +
641 std::tuple<int,int,int,int> buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ +
642 bool finestLevel);
│ │ │ +
643
│ │ │ +
661 template<bool reset, class G, class F, class VM>
│ │ │ +
662 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ +
663 const AggregateDescriptor& aggregate,
│ │ │ +
664 const G& graph,
│ │ │ +
665 F& aggregateVisitor,
│ │ │ +
666 VM& visitedMap) const;
│ │ │ +
667
│ │ │ +
691 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ +
692 std::size_t breadthFirstSearch(const VertexDescriptor& start,
│ │ │ +
693 const AggregateDescriptor& aggregate,
│ │ │ +
694 const G& graph, L& visited, F1& aggregateVisitor,
│ │ │ +
695 F2& nonAggregateVisitor,
│ │ │ +
696 VM& visitedMap) const;
│ │ │ +
697
│ │ │ +
703 void allocate(std::size_t noVertices);
│ │ │ +
704
│ │ │ +
708 std::size_t noVertices() const;
│ │ │ +
709
│ │ │ +
713 void free();
│ │ │ +
714
│ │ │ + │ │ │ +
721
│ │ │ + │ │ │ +
728
│ │ │ + │ │ │ +
730
│ │ │ +
│ │ │ + │ │ │ +
732 {
│ │ │ +
733 return aggregates_;
│ │ │ +
734 }
│ │ │ +
│ │ │ +
735
│ │ │ +
│ │ │ + │ │ │ +
737 {
│ │ │ +
738 return aggregates_+noVertices();
│ │ │ +
739 }
│ │ │ +
│ │ │ +
740
│ │ │ + │ │ │ +
742
│ │ │ +
│ │ │ + │ │ │ +
744 {
│ │ │ +
745 return aggregates_;
│ │ │ +
746 }
│ │ │ +
│ │ │
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 }
│ │ │ -
│ │ │ -
820
│ │ │ -
821 template<class M, class T1, class T2>
│ │ │ -
│ │ │ - │ │ │ -
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
│ │ │ -
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;
│ │ │ -
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;
│ │ │ -
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()]];
│ │ │ -
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.
│ │ │ -
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));
│ │ │ -
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();
│ │ │ +
│ │ │ + │ │ │ +
749 {
│ │ │ +
750 return aggregates_+noVertices();
│ │ │ +
751 }
│ │ │ +
│ │ │ +
752 private:
│ │ │ +
754 AggregatesMap(const AggregatesMap<V>&) = delete;
│ │ │ +
756 AggregatesMap<V>& operator=(const AggregatesMap<V>&) = delete;
│ │ │ +
757
│ │ │ +
761 AggregateDescriptor* aggregates_;
│ │ │ +
762
│ │ │ +
766 std::size_t noVertices_;
│ │ │ +
767 };
│ │ │ +
│ │ │ +
768
│ │ │ +
772 template<class G, class C>
│ │ │ +
773 void buildDependency(G& graph,
│ │ │ +
774 const typename C::Matrix& matrix,
│ │ │ +
775 C criterion,
│ │ │ +
776 bool finestLevel);
│ │ │ +
777
│ │ │ +
782 template<class G, class S>
│ │ │ +
│ │ │ + │ │ │ +
784 {
│ │ │ +
785
│ │ │ +
786 public:
│ │ │ +
787
│ │ │ +
788 /***
│ │ │ +
789 * @brief The type of the matrix graph we work with.
│ │ │ +
790 */
│ │ │ +
791 typedef G MatrixGraph;
│ │ │ + │ │ │ +
796
│ │ │ +
801 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ +
802
│ │ │ +
807 typedef S VertexSet;
│ │ │ +
808
│ │ │ +
812 using size_type = typename VertexSet::size_type;
│ │ │ +
813
│ │ │ +
815 typedef typename VertexSet::const_iterator const_iterator;
│ │ │ +
816
│ │ │ +
820 typedef std::size_t* SphereMap;
│ │ │ +
821
│ │ │ + │ │ │ +
831 VertexSet& connectivity, std::vector<Vertex>& front_);
│ │ │ +
832
│ │ │ +
│ │ │ + │ │ │ +
834 {
│ │ │ +
835 --id_;
│ │ │ +
836 }
│ │ │ +
│ │ │ +
837
│ │ │ +
844 void reconstruct(const Vertex& vertex);
│ │ │ +
845
│ │ │ +
849 void seed(const Vertex& vertex);
│ │ │ +
850
│ │ │ +
854 void add(const Vertex& vertex);
│ │ │ +
855
│ │ │ +
856 void add(std::vector<Vertex>& vertex);
│ │ │ +
860 void clear();
│ │ │ +
861
│ │ │ + │ │ │ + │ │ │ +
870
│ │ │ +
874 int id();
│ │ │ +
875
│ │ │ + │ │ │ +
878
│ │ │ + │ │ │ +
881
│ │ │ +
882 private:
│ │ │ +
886 VertexSet vertices_;
│ │ │ +
887
│ │ │ +
892 int id_;
│ │ │ +
893
│ │ │ +
897 MatrixGraph& graph_;
│ │ │ +
898
│ │ │ +
902 AggregatesMap<Vertex>& aggregates_;
│ │ │ +
903
│ │ │ +
907 VertexSet& connected_;
│ │ │ +
908
│ │ │ +
912 std::vector<Vertex>& front_;
│ │ │ +
913 };
│ │ │ +
│ │ │ +
914
│ │ │ +
918 template<class G>
│ │ │ +
│ │ │ + │ │ │ +
920 {
│ │ │ +
921 public:
│ │ │ +
922
│ │ │ +
926 typedef G MatrixGraph;
│ │ │ +
927
│ │ │ + │ │ │ +
932
│ │ │ + │ │ │ +
935
│ │ │ + │ │ │ +
940
│ │ │ + │ │ │ +
945
│ │ │ +
962 template<class M, class C>
│ │ │ +
963 std::tuple<int,int,int,int> build(const M& m, G& graph,
│ │ │ +
964 AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ +
965 bool finestLevel);
│ │ │ +
966 private:
│ │ │ +
971 typedef PoolAllocator<Vertex,100> Allocator;
│ │ │ +
972
│ │ │ +
976 typedef SLList<Vertex,Allocator> VertexList;
│ │ │ +
977
│ │ │ +
981 typedef std::set<Vertex,std::less<Vertex>,Allocator> VertexSet;
│ │ │ +
982
│ │ │ +
986 typedef std::size_t* SphereMap;
│ │ │ +
987
│ │ │ +
991 MatrixGraph* graph_;
│ │ │ +
992
│ │ │ + │ │ │ +
997
│ │ │ +
1001 std::vector<Vertex> front_;
│ │ │ +
1002
│ │ │ +
1006 VertexSet connected_;
│ │ │ +
1007
│ │ │ +
1011 int size_;
│ │ │ +
1012
│ │ │ +
1016 class Stack
│ │ │ +
1017 {
│ │ │ +
1018 public:
│ │ │ +
1019 static const Vertex NullEntry;
│ │ │ +
1020
│ │ │ +
1021 Stack(const MatrixGraph& graph,
│ │ │ +
1022 const Aggregator<G>& aggregatesBuilder,
│ │ │ +
1023 const AggregatesMap<Vertex>& aggregates);
│ │ │ + │ │ │ + │ │ │ +
1026 private:
│ │ │ +
1027 enum { N = 1300000 };
│ │ │ +
1028
│ │ │ +
1030 const MatrixGraph& graph_;
│ │ │ +
1032 const Aggregator<G>& aggregatesBuilder_;
│ │ │ +
1034 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
1036 int size_;
│ │ │ +
1037 Vertex maxSize_;
│ │ │ +
1039 typename MatrixGraph::ConstVertexIterator begin_;
│ │ │ + │ │ │ +
1041
│ │ │ +
1043 Vertex* vals_;
│ │ │ +
1044
│ │ │ +
1045 };
│ │ │ +
1046
│ │ │ +
1047 friend class Stack;
│ │ │ +
1048
│ │ │ +
1059 template<class V>
│ │ │ +
1060 void visitAggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1061 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1062 V& visitor) const;
│ │ │ +
1063
│ │ │ +
1068 template<class V>
│ │ │ +
1069 class AggregateVisitor
│ │ │ +
1070 {
│ │ │ +
1071 public:
│ │ │ +
1075 typedef V Visitor;
│ │ │ + │ │ │ +
1084 Visitor& visitor);
│ │ │ +
1085
│ │ │ +
1092 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1093
│ │ │ +
1094 private:
│ │ │ +
1096 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
1098 AggregateDescriptor aggregate_;
│ │ │ +
1100 Visitor* visitor_;
│ │ │ +
1101 };
│ │ │ +
1102
│ │ │ +
1106 class Counter
│ │ │ +
1107 {
│ │ │ +
1108 public:
│ │ │ + │ │ │ +
1112 int value();
│ │ │ +
1113
│ │ │ +
1114 protected:
│ │ │ + │ │ │ + │ │ │ +
1119
│ │ │ +
1120 private:
│ │ │ +
1121 int count_;
│ │ │ +
1122 };
│ │ │ +
1123
│ │ │ +
1124
│ │ │ +
1129 class FrontNeighbourCounter : public Counter
│ │ │ +
1130 {
│ │ │ +
1131 public:
│ │ │ + │ │ │ +
1137
│ │ │ +
1138 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │
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
│ │ │ -
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
│ │ │ +
1140 private:
│ │ │ +
1141 const MatrixGraph& graph_;
│ │ │ +
1142 };
│ │ │ +
1143
│ │ │ +
1148 int noFrontNeighbours(const Vertex& vertex) const;
│ │ │ +
1149
│ │ │ +
1153 class TwoWayCounter : public Counter
│ │ │ +
1154 {
│ │ │ +
1155 public:
│ │ │ +
1156 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1157 };
│ │ │ +
1158
│ │ │ +
1170 int twoWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ +
1171 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1172
│ │ │ +
1176 class OneWayCounter : public Counter
│ │ │ +
1177 {
│ │ │ +
1178 public:
│ │ │ +
1179 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1180 };
│ │ │ +
1181
│ │ │ +
1193 int oneWayConnections(const Vertex&, const AggregateDescriptor& aggregate,
│ │ │ +
1194 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1195
│ │ │ +
1202 class ConnectivityCounter : public Counter
│ │ │ +
1203 {
│ │ │ +
1204 public:
│ │ │ +
1210 ConnectivityCounter(const VertexSet& connected, const AggregatesMap<Vertex>& aggregates);
│ │ │ +
1211
│ │ │ +
1212 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1213
│ │ │ +
1214 private:
│ │ │ +
1216 const VertexSet& connected_;
│ │ │ +
1218 const AggregatesMap<Vertex>& aggregates_;
│ │ │ +
1219
│ │ │ +
1220 };
│ │ │ +
1221
│ │ │ +
1233 double connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1241 bool connected(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1242 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1243
│ │ │ +
1251 bool connected(const Vertex& vertex, const SLList<AggregateDescriptor>& aggregateList,
│ │ │ +
1252 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1253
│ │ │ +
1261 class DependencyCounter : public Counter
│ │ │ +
1262 {
│ │ │ +
1263 public:
│ │ │ + │ │ │ +
1268
│ │ │ +
1269 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │ +
1270 };
│ │ │ +
1271
│ │ │ +
1278 class FrontMarker
│ │ │ +
1279 {
│ │ │ +
1280 public:
│ │ │ +
1287 FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph);
│ │ │ +
1288
│ │ │ +
1289 void operator()(const typename MatrixGraph::ConstEdgeIterator& edge);
│ │ │
1290
│ │ │ -
1291#else
│ │ │ -
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));
│ │ │ -
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;
│ │ │ +
1291 private:
│ │ │ +
1293 std::vector<Vertex>& front_;
│ │ │ +
1295 MatrixGraph& graph_;
│ │ │ +
1296 };
│ │ │ +
1297
│ │ │ +
1301 void unmarkFront();
│ │ │ +
1302
│ │ │ +
1317 int unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1318
│ │ │ +
1332 std::pair<int,int> neighbours(const Vertex& vertex,
│ │ │ +
1333 const AggregateDescriptor& aggregate,
│ │ │ +
1334 const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1351 int aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1352
│ │ │ +
1360 bool admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1361
│ │ │ +
1369 std::size_t distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates);
│ │ │ +
1370
│ │ │ +
1379 Vertex mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const;
│ │ │ +
1380
│ │ │ +
1389 void nonisoNeighbourAggregate(const Vertex& vertex,
│ │ │ +
1390 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1391 SLList<Vertex>& neighbours) const;
│ │ │ +
1392
│ │ │ +
1400 template<class C>
│ │ │ +
1401 void growAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ +
1402 template<class C>
│ │ │ +
1403 void growIsolatedAggregate(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates, const C& c);
│ │ │ +
1404 };
│ │ │ +
│ │ │ +
1405
│ │ │ +
1406#ifndef DOXYGEN
│ │ │
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 }
│ │ │ -
│ │ │ -
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());
│ │ │ -
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());
│ │ │ +
1408 template<class M, class N>
│ │ │ +
1409 inline void SymmetricDependency<M,N>::init(const Matrix* matrix)
│ │ │ +
1410 {
│ │ │ +
1411 matrix_ = matrix;
│ │ │ +
1412 }
│ │ │ +
1413
│ │ │ +
1414 template<class M, class N>
│ │ │ +
1415 inline void SymmetricDependency<M,N>::initRow(const Row& row, int index)
│ │ │ +
1416 {
│ │ │ +
1417 initRow(row, index, std::is_convertible<field_type, real_type>());
│ │ │ +
1418 }
│ │ │ +
1419
│ │ │ +
1420 template<class M, class N>
│ │ │ +
1421 inline void SymmetricDependency<M,N>::initRow(const Row& /*row*/, int /*index*/, const std::false_type&)
│ │ │ +
1422 {
│ │ │ +
1423 DUNE_THROW(InvalidStateException, "field_type needs to convertible to real_type");
│ │ │ +
1424 }
│ │ │ +
1425
│ │ │ +
1426 template<class M, class N>
│ │ │ +
1427 inline void SymmetricDependency<M,N>::initRow(const Row& /*row*/, int index, const std::true_type&)
│ │ │ +
1428 {
│ │ │ +
1429 using std::min;
│ │ │ +
1430 maxValue_ = min(- std::numeric_limits<typename Matrix::field_type>::max(), std::numeric_limits<typename Matrix::field_type>::min());
│ │ │ +
1431 row_ = index;
│ │ │ +
1432 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ +
1433 }
│ │ │ +
1434
│ │ │ +
1435 template<class M, class N>
│ │ │ +
1436 inline void SymmetricDependency<M,N>::examine(const ColIter& col)
│ │ │ +
1437 {
│ │ │ +
1438 using std::max;
│ │ │ +
1439 real_type eij = norm_(*col);
│ │ │ +
1440 typename Matrix::ConstColIterator opposite_entry =
│ │ │ +
1441 matrix_->operator[](col.index()).find(row_);
│ │ │ +
1442 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ +
1443 {
│ │ │ +
1444 // Consider this a weak connection we disregard.
│ │ │ +
1445 return;
│ │ │ +
1446 }
│ │ │ +
1447 real_type eji = norm_(*opposite_entry);
│ │ │ +
1448
│ │ │ +
1449 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ +
1450 if(!N::is_sign_preserving || eij<0 || eji<0)
│ │ │ +
1451 maxValue_ = max(maxValue_,
│ │ │ +
1452 eij /diagonal_ * eji/
│ │ │ +
1453 norm_(matrix_->operator[](col.index())[col.index()]));
│ │ │ +
1454 }
│ │ │ +
1455
│ │ │ +
1456 template<class M, class N>
│ │ │ +
1457 template<class G>
│ │ │ +
1458 inline void SymmetricDependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ +
1459 {
│ │ │ +
1460 real_type eij = norm_(*col);
│ │ │ +
1461 typename Matrix::ConstColIterator opposite_entry =
│ │ │ +
1462 matrix_->operator[](col.index()).find(row_);
│ │ │ +
1463
│ │ │ +
1464 if ( opposite_entry == matrix_->operator[](col.index()).end() )
│ │ │ +
1465 {
│ │ │ +
1466 // Consider this as a weak connection we disregard.
│ │ │ +
1467 return;
│ │ │ +
1468 }
│ │ │ +
1469 real_type eji = norm_(*opposite_entry);
│ │ │ +
1470 // skip positive offdiagonals if norm preserves sign of them.
│ │ │ +
1471 if(!N::is_sign_preserving || (eij<0 || eji<0))
│ │ │ +
1472 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) *
│ │ │ +
1473 eij/ diagonal_ > alpha() * maxValue_) {
│ │ │ +
1474 edge.properties().setDepends();
│ │ │ +
1475 edge.properties().setInfluences();
│ │ │ +
1476 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), edge.source());
│ │ │ +
1477 other.setInfluences();
│ │ │ +
1478 other.setDepends();
│ │ │ +
1479 }
│ │ │ +
1480 }
│ │ │ +
1481
│ │ │ +
1482 template<class M, class N>
│ │ │ + │ │ │ +
1484 {
│ │ │ +
1485 return maxValue_ < beta();
│ │ │ +
1486 }
│ │ │ +
1487
│ │ │ +
1488
│ │ │ +
1489 template<class M, class N>
│ │ │ +
1490 inline void Dependency<M,N>::init(const Matrix* matrix)
│ │ │ +
1491 {
│ │ │ +
1492 matrix_ = matrix;
│ │ │ +
1493 }
│ │ │ +
1494
│ │ │ +
1495 template<class M, class N>
│ │ │ +
1496 inline void Dependency<M,N>::initRow([[maybe_unused]] const Row& row, int index)
│ │ │ +
1497 {
│ │ │ +
1498 using std::min;
│ │ │ +
1499 maxValue_ = min(- std::numeric_limits<real_type>::max(), std::numeric_limits<real_type>::min());
│ │ │ +
1500 row_ = index;
│ │ │ +
1501 diagonal_ = norm_(matrix_->operator[](row_)[row_]);
│ │ │ +
1502 }
│ │ │ +
1503
│ │ │ +
1504 template<class M, class N>
│ │ │ +
1505 inline void Dependency<M,N>::examine(const ColIter& col)
│ │ │ +
1506 {
│ │ │ +
1507 using std::max;
│ │ │ +
1508 maxValue_ = max(maxValue_, -norm_(*col));
│ │ │ +
1509 }
│ │ │ +
1510
│ │ │ +
1511 template<class M, class N>
│ │ │ +
1512 template<class G>
│ │ │ +
1513 inline void Dependency<M,N>::examine(G& graph, const typename G::EdgeIterator& edge, const ColIter& col)
│ │ │ +
1514 {
│ │ │ +
1515 if(-norm_(*col) >= maxValue_ * alpha()) {
│ │ │ +
1516 edge.properties().setDepends();
│ │ │ +
1517 typedef typename G::EdgeDescriptor ED;
│ │ │ +
1518 ED e= graph.findEdge(edge.target(), edge.source());
│ │ │ +
1519 if(e!=std::numeric_limits<ED>::max())
│ │ │ +
1520 {
│ │ │ +
1521 typename G::EdgeProperties& other = graph.getEdgeProperties(e);
│ │ │ +
1522 other.setInfluences();
│ │ │ +
1523 }
│ │ │ +
1524 }
│ │ │ +
1525 }
│ │ │ +
1526
│ │ │ +
1527 template<class M, class N>
│ │ │ +
1528 inline bool Dependency<M,N>::isIsolated()
│ │ │ +
1529 {
│ │ │ +
1530 return maxValue_ < beta() * diagonal_;
│ │ │ +
1531 }
│ │ │
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;
│ │ │ -
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();
│ │ │ +
1533 template<class G,class S>
│ │ │ + │ │ │ +
1535 VertexSet& connected, std::vector<Vertex>& front)
│ │ │ +
1536 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates),
│ │ │ +
1537 connected_(connected), front_(front)
│ │ │ +
1538 {}
│ │ │ +
1539
│ │ │ +
1540 template<class G,class S>
│ │ │ +
1541 void Aggregate<G,S>::reconstruct(const Vertex& /*vertex*/)
│ │ │ +
1542 {
│ │ │ +
1543 /*
│ │ │ +
1544 vertices_.push_back(vertex);
│ │ │ +
1545 typedef typename VertexList::const_iterator iterator;
│ │ │ +
1546 iterator begin = vertices_.begin();
│ │ │ +
1547 iterator end = vertices_.end();*/
│ │ │ +
1548 throw "Not yet implemented";
│ │ │ +
1549
│ │ │ +
1550 // while(begin!=end){
│ │ │ +
1551 //for();
│ │ │ +
1552 // }
│ │ │ +
1553
│ │ │ +
1554 }
│ │ │ +
1555
│ │ │ +
1556 template<class G,class S>
│ │ │ +
1557 inline void Aggregate<G,S>::seed(const Vertex& vertex)
│ │ │ +
1558 {
│ │ │ +
1559 dvverb<<"Connected cleared"<<std::endl;
│ │ │ +
1560 connected_.clear();
│ │ │ +
1561 vertices_.clear();
│ │ │ +
1562 connected_.insert(vertex);
│ │ │ +
1563 dvverb << " Inserting "<<vertex<<" size="<<connected_.size();
│ │ │ +
1564 ++id_ ;
│ │ │ +
1565 add(vertex);
│ │ │ +
1566 }
│ │ │ +
1567
│ │ │
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);
│ │ │ -
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;
│ │ │ -
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;
│ │ │ -
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;
│ │ │ -
1691 }
│ │ │ -
1692 time.reset();
│ │ │ -
1693
│ │ │ -
1694 for(int i=0; i < noSendTo; ++i)
│ │ │ -
1695 delete[] sendBuffers[i];
│ │ │ +
1569 template<class G,class S>
│ │ │ +
1570 inline void Aggregate<G,S>::add(const Vertex& vertex)
│ │ │ +
1571 {
│ │ │ +
1572 vertices_.insert(vertex);
│ │ │ +
1573 aggregates_[vertex]=id_;
│ │ │ +
1574 if(front_.size())
│ │ │ +
1575 front_.erase(std::lower_bound(front_.begin(), front_.end(), vertex));
│ │ │ +
1576
│ │ │ +
1577
│ │ │ +
1578 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ +
1579 const iterator end = graph_.endEdges(vertex);
│ │ │ +
1580 for(iterator edge = graph_.beginEdges(vertex); edge != end; ++edge) {
│ │ │ +
1581 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ +
1582 connected_.insert(aggregates_[edge.target()]);
│ │ │ +
1583 dvverb <<" size="<<connected_.size();
│ │ │ +
1584 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ +
1585 !graph_.getVertexProperties(edge.target()).front())
│ │ │ +
1586 {
│ │ │ +
1587 front_.push_back(edge.target());
│ │ │ +
1588 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ +
1589 }
│ │ │ +
1590 }
│ │ │ +
1591 dvverb <<std::endl;
│ │ │ +
1592 std::sort(front_.begin(), front_.end());
│ │ │ +
1593 }
│ │ │ +
1594
│ │ │ +
1595 template<class G,class S>
│ │ │ +
1596 inline void Aggregate<G,S>::add(std::vector<Vertex>& vertices)
│ │ │ +
1597 {
│ │ │ +
1598#ifndef NDEBUG
│ │ │ +
1599 std::size_t oldsize = vertices_.size();
│ │ │ +
1600#endif
│ │ │ +
1601 typedef typename std::vector<Vertex>::iterator Iterator;
│ │ │ +
1602
│ │ │ +
1603 typedef typename VertexSet::iterator SIterator;
│ │ │ +
1604
│ │ │ +
1605 SIterator pos=vertices_.begin();
│ │ │ +
1606 std::vector<Vertex> newFront;
│ │ │ +
1607 newFront.reserve(front_.capacity());
│ │ │ +
1608
│ │ │ +
1609 std::set_difference(front_.begin(), front_.end(), vertices.begin(), vertices.end(),
│ │ │ +
1610 std::back_inserter(newFront));
│ │ │ +
1611 front_=newFront;
│ │ │ +
1612
│ │ │ +
1613 for(Iterator vertex=vertices.begin(); vertex != vertices.end(); ++vertex)
│ │ │ +
1614 {
│ │ │ +
1615 pos=vertices_.insert(pos,*vertex);
│ │ │ +
1616 vertices_.insert(*vertex);
│ │ │ +
1617 graph_.getVertexProperties(*vertex).resetFront(); // Not a front node any more.
│ │ │ +
1618 aggregates_[*vertex]=id_;
│ │ │ +
1619
│ │ │ +
1620 typedef typename MatrixGraph::ConstEdgeIterator iterator;
│ │ │ +
1621 const iterator end = graph_.endEdges(*vertex);
│ │ │ +
1622 for(iterator edge = graph_.beginEdges(*vertex); edge != end; ++edge) {
│ │ │ +
1623 dvverb << " Inserting "<<aggregates_[edge.target()];
│ │ │ +
1624 connected_.insert(aggregates_[edge.target()]);
│ │ │ +
1625 if(aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ +
1626 !graph_.getVertexProperties(edge.target()).front())
│ │ │ +
1627 {
│ │ │ +
1628 front_.push_back(edge.target());
│ │ │ +
1629 graph_.getVertexProperties(edge.target()).setFront();
│ │ │ +
1630 }
│ │ │ +
1631 dvverb <<" size="<<connected_.size();
│ │ │ +
1632 }
│ │ │ +
1633 dvverb <<std::endl;
│ │ │ +
1634 }
│ │ │ +
1635 std::sort(front_.begin(), front_.end());
│ │ │ +
1636 assert(oldsize+vertices.size()==vertices_.size());
│ │ │ +
1637 }
│ │ │ +
1638 template<class G,class S>
│ │ │ +
1639 inline void Aggregate<G,S>::clear()
│ │ │ +
1640 {
│ │ │ +
1641 vertices_.clear();
│ │ │ +
1642 connected_.clear();
│ │ │ +
1643 id_=-1;
│ │ │ +
1644 }
│ │ │ +
1645
│ │ │ +
1646 template<class G,class S>
│ │ │ +
1647 inline typename Aggregate<G,S>::size_type
│ │ │ + │ │ │ +
1649 {
│ │ │ +
1650 return vertices_.size();
│ │ │ +
1651 }
│ │ │ +
1652
│ │ │ +
1653 template<class G,class S>
│ │ │ +
1654 inline typename Aggregate<G,S>::size_type
│ │ │ + │ │ │ +
1656 {
│ │ │ +
1657 return connected_.size();
│ │ │ +
1658 }
│ │ │ +
1659
│ │ │ +
1660 template<class G,class S>
│ │ │ +
1661 inline int Aggregate<G,S>::id()
│ │ │ +
1662 {
│ │ │ +
1663 return id_;
│ │ │ +
1664 }
│ │ │ +
1665
│ │ │ +
1666 template<class G,class S>
│ │ │ + │ │ │ +
1668 {
│ │ │ +
1669 return vertices_.begin();
│ │ │ +
1670 }
│ │ │ +
1671
│ │ │ +
1672 template<class G,class S>
│ │ │ + │ │ │ +
1674 {
│ │ │ +
1675 return vertices_.end();
│ │ │ +
1676 }
│ │ │ +
1677
│ │ │ +
1678 template<class V>
│ │ │ +
1679 const V AggregatesMap<V>::UNAGGREGATED = std::numeric_limits<V>::max();
│ │ │ +
1680
│ │ │ +
1681 template<class V>
│ │ │ +
1682 const V AggregatesMap<V>::ISOLATED = std::numeric_limits<V>::max()-1;
│ │ │ +
1683
│ │ │ +
1684 template<class V>
│ │ │ + │ │ │ +
1686 : aggregates_(0)
│ │ │ +
1687 {}
│ │ │ +
1688
│ │ │ +
1689 template<class V>
│ │ │ + │ │ │ +
1691 {
│ │ │ +
1692 if(aggregates_!=0)
│ │ │ +
1693 delete[] aggregates_;
│ │ │ +
1694 }
│ │ │ +
1695
│ │ │
1696
│ │ │ -
1697 delete[] sendBuffers;
│ │ │ -
1698 delete[] statuses;
│ │ │ -
1699 delete[] requests;
│ │ │ -
1700
│ │ │ -
1701 redistInf.setCommunicator(oocomm.communicator());
│ │ │ +
1697 template<class V>
│ │ │ +
1698 inline AggregatesMap<V>::AggregatesMap(std::size_t noVertices)
│ │ │ +
1699 {
│ │ │ +
1700 allocate(noVertices);
│ │ │ +
1701 }
│ │ │
1702
│ │ │ -
1703 //
│ │ │ -
1704 // 4.2) Create the IndexSet etc.
│ │ │ -
1705 //
│ │ │ -
1706
│ │ │ -
1707 // build the new outputIndexSet
│ │ │ +
1703 template<class V>
│ │ │ +
1704 inline std::size_t AggregatesMap<V>::noVertices() const
│ │ │ +
1705 {
│ │ │ +
1706 return noVertices_;
│ │ │ +
1707 }
│ │ │
1708
│ │ │ -
1709
│ │ │ -
1710 int color=0;
│ │ │ -
1711
│ │ │ -
1712 if (!existentOnNextLevel) {
│ │ │ -
1713 // this process is not used anymore
│ │ │ -
1714 color= MPI_UNDEFINED;
│ │ │ -
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());
│ │ │ +
1709 template<class V>
│ │ │ +
1710 inline void AggregatesMap<V>::allocate(std::size_t noVertices)
│ │ │ +
1711 {
│ │ │ +
1712 aggregates_ = new AggregateDescriptor[noVertices];
│ │ │ +
1713 noVertices_ = noVertices;
│ │ │ +
1714
│ │ │ +
1715 for(std::size_t i=0; i < noVertices; i++)
│ │ │ +
1716 aggregates_[i]=UNAGGREGATED;
│ │ │ +
1717 }
│ │ │ +
1718
│ │ │ +
1719 template<class V>
│ │ │ +
1720 inline void AggregatesMap<V>::free()
│ │ │ +
1721 {
│ │ │ +
1722 assert(aggregates_ != 0);
│ │ │ +
1723 delete[] aggregates_;
│ │ │ +
1724 aggregates_=0;
│ │ │ +
1725 }
│ │ │
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]);
│ │ │ +
1727 template<class V>
│ │ │ + │ │ │ +
1729 AggregatesMap<V>::operator[](const VertexDescriptor& v)
│ │ │ +
1730 {
│ │ │ +
1731 return aggregates_[v];
│ │ │ +
1732 }
│ │ │ +
1733
│ │ │ +
1734 template<class V>
│ │ │ +
1735 inline const typename AggregatesMap<V>::AggregateDescriptor&
│ │ │ +
1736 AggregatesMap<V>::operator[](const VertexDescriptor& v) const
│ │ │ +
1737 {
│ │ │ +
1738 return aggregates_[v];
│ │ │
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();
│ │ │ +
1740
│ │ │ +
1741 template<class V>
│ │ │ +
1742 template<bool reset, class G, class F,class VM>
│ │ │ +
1743 inline std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ +
1744 const AggregateDescriptor& aggregate,
│ │ │ +
1745 const G& graph, F& aggregateVisitor,
│ │ │ +
1746 VM& visitedMap) const
│ │ │ +
1747 {
│ │ │ +
1748 VertexList vlist;
│ │ │
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
│ │ │ +
1750 DummyEdgeVisitor dummy;
│ │ │ +
1751 return breadthFirstSearch<true,reset>(start, aggregate, graph, vlist, aggregateVisitor, dummy, visitedMap);
│ │ │ +
1752 }
│ │ │ +
1753
│ │ │ +
1754 template<class V>
│ │ │ +
1755 template<bool remove, bool reset, class G, class L, class F1, class F2, class VM>
│ │ │ +
1756 std::size_t AggregatesMap<V>::breadthFirstSearch(const V& start,
│ │ │ +
1757 const AggregateDescriptor& aggregate,
│ │ │ +
1758 const G& graph,
│ │ │ +
1759 L& visited,
│ │ │ +
1760 F1& aggregateVisitor,
│ │ │ +
1761 F2& nonAggregateVisitor,
│ │ │ +
1762 VM& visitedMap) const
│ │ │ +
1763 {
│ │ │ +
1764 typedef typename L::const_iterator ListIterator;
│ │ │ +
1765 int visitedSpheres = 0;
│ │ │ +
1766
│ │ │ +
1767 visited.push_back(start);
│ │ │ +
1768 put(visitedMap, start, true);
│ │ │ +
1769
│ │ │ +
1770 ListIterator current = visited.begin();
│ │ │ +
1771 ListIterator end = visited.end();
│ │ │ +
1772 std::size_t i=0, size=visited.size();
│ │ │ +
1773
│ │ │ +
1774 // visit the neighbours of all vertices of the
│ │ │ +
1775 // current sphere.
│ │ │ +
1776 while(current != end) {
│ │ │ +
1777
│ │ │ +
1778 for(; i<size; ++current, ++i) {
│ │ │ +
1779 typedef typename G::ConstEdgeIterator EdgeIterator;
│ │ │ +
1780 const EdgeIterator endEdge = graph.endEdges(*current);
│ │ │
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
│ │ │ +
1782 for(EdgeIterator edge = graph.beginEdges(*current);
│ │ │ +
1783 edge != endEdge; ++edge) {
│ │ │ +
1784
│ │ │ +
1785 if(aggregates_[edge.target()]==aggregate) {
│ │ │ +
1786 if(!get(visitedMap, edge.target())) {
│ │ │ +
1787 put(visitedMap, edge.target(), true);
│ │ │ +
1788 visited.push_back(edge.target());
│ │ │ +
1789 aggregateVisitor(edge);
│ │ │ +
1790 }
│ │ │ +
1791 }else
│ │ │ +
1792 nonAggregateVisitor(edge);
│ │ │ +
1793 }
│ │ │ +
1794 }
│ │ │ +
1795 end = visited.end();
│ │ │ +
1796 size = visited.size();
│ │ │ +
1797 if(current != end)
│ │ │ +
1798 visitedSpheres++;
│ │ │ +
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 if (!std::is_sorted(outputIndexSet.begin(), outputIndexSet.end(),
│ │ │ -
1824 [](const auto& v1, const auto& v2){ return v1.global() < v2.global();}))
│ │ │ -
1825 DUNE_THROW(ISTLError, "OutputIndexSet is not sorted.");
│ │ │ -
1826#endif
│ │ │ -
1827 if(verbose) {
│ │ │ -
1828 oocomm.communicator().barrier();
│ │ │ -
1829 if(oocomm.communicator().rank()==0)
│ │ │ -
1830 std::cout<<" Adding overlap indices took "<<
│ │ │ -
1831 time.elapsed()<<std::endl;
│ │ │ -
1832 }
│ │ │ -
1833 time.reset();
│ │ │ -
1834
│ │ │ -
1835
│ │ │ -
1836 if(color != MPI_UNDEFINED) {
│ │ │ -
1837 outcomm->remoteIndices().setNeighbours(tneighbors);
│ │ │ -
1838 outcomm->remoteIndices().template rebuild<true>();
│ │ │ -
1839
│ │ │ -
1840 }
│ │ │ -
1841
│ │ │ -
1842 // release the memory
│ │ │ -
1843 delete[] sendTo;
│ │ │ -
1844
│ │ │ -
1845 if(verbose) {
│ │ │ -
1846 oocomm.communicator().barrier();
│ │ │ -
1847 if(oocomm.communicator().rank()==0)
│ │ │ -
1848 std::cout<<" Storing indexsets took "<<
│ │ │ -
1849 time.elapsed()<<std::endl;
│ │ │ -
1850 }
│ │ │ -
1851
│ │ │ -
1852#ifdef PERF_REPART
│ │ │ -
1853 // stop the time for step 4) and print the results
│ │ │ -
1854 t4=MPI_Wtime()-t4;
│ │ │ -
1855 tSum = t1 + t2 + t3 + t4;
│ │ │ -
1856 std::cout<<std::endl
│ │ │ -
1857 <<mype<<": WTime for step 1): "<<t1
│ │ │ -
1858 <<" 2): "<<t2
│ │ │ -
1859 <<" 3): "<<t3
│ │ │ -
1860 <<" 4): "<<t4
│ │ │ -
1861 <<" total: "<<tSum
│ │ │ -
1862 <<std::endl;
│ │ │ -
1863#endif
│ │ │ -
1864
│ │ │ -
1865 return color!=MPI_UNDEFINED;
│ │ │ -
1866
│ │ │ -
1867 }
│ │ │ -
│ │ │ -
1868#else
│ │ │ -
1869 template<class G, class P,class T1, class T2, class R>
│ │ │ -
1870 bool graphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ -
1871 std::shared_ptr<P>& outcomm,
│ │ │ -
1872 R& redistInf,
│ │ │ -
1873 bool v=false)
│ │ │ -
1874 {
│ │ │ -
1875 if(nparts!=oocomm.size())
│ │ │ -
1876 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ -
1877 }
│ │ │ -
1878
│ │ │ -
1879
│ │ │ -
1880 template<class G, class P,class T1, class T2, class R>
│ │ │ -
1881 bool commGraphRepartition(const G& graph, P& oocomm, int nparts,
│ │ │ -
1882 std::shared_ptr<P>& outcomm,
│ │ │ -
1883 R& redistInf,
│ │ │ -
1884 bool v=false)
│ │ │ -
1885 {
│ │ │ -
1886 if(nparts!=oocomm.size())
│ │ │ -
1887 DUNE_THROW(NotImplemented, "only available for MPI programs");
│ │ │ -
1888 }
│ │ │ -
1889#endif // HAVE_MPI
│ │ │ -
1890} // end of namespace Dune
│ │ │ -
1891#endif
│ │ │ -
Provides classes for building the matrix graph.
│ │ │ -
Classes providing communication interfaces for overlapping Schwarz methods.
│ │ │ +
1801 if(reset)
│ │ │ +
1802 for(current = visited.begin(); current != end; ++current)
│ │ │ +
1803 put(visitedMap, *current, false);
│ │ │ +
1804
│ │ │ +
1805
│ │ │ +
1806 if(remove)
│ │ │ +
1807 visited.clear();
│ │ │ +
1808
│ │ │ +
1809 return visitedSpheres;
│ │ │ +
1810 }
│ │ │ +
1811
│ │ │ +
1812 template<class G>
│ │ │ + │ │ │ +
1814 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1)
│ │ │ +
1815 {}
│ │ │ +
1816
│ │ │ +
1817 template<class G>
│ │ │ + │ │ │ +
1819 {
│ │ │ +
1820 size_=-1;
│ │ │ +
1821 }
│ │ │ +
1822
│ │ │ +
1823 template<class G, class C>
│ │ │ +
1824 void buildDependency(G& graph,
│ │ │ +
1825 const typename C::Matrix& matrix,
│ │ │ +
1826 C criterion, bool firstlevel)
│ │ │ +
1827 {
│ │ │ +
1828 // assert(graph.isBuilt());
│ │ │ +
1829 typedef typename C::Matrix Matrix;
│ │ │ +
1830 typedef typename G::VertexIterator VertexIterator;
│ │ │ +
1831
│ │ │ +
1832 criterion.init(&matrix);
│ │ │ +
1833
│ │ │ +
1834 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); ++vertex) {
│ │ │ +
1835 typedef typename Matrix::row_type Row;
│ │ │ +
1836
│ │ │ +
1837 const Row& row = matrix[*vertex];
│ │ │ +
1838
│ │ │ +
1839 // Tell the criterion what row we will examine now
│ │ │ +
1840 // This might for example be used for calculating the
│ │ │ +
1841 // maximum offdiagonal value
│ │ │ +
1842 criterion.initRow(row, *vertex);
│ │ │ +
1843
│ │ │ +
1844 // On a first path all columns are examined. After this
│ │ │ +
1845 // the calculator should know whether the vertex is isolated.
│ │ │ +
1846 typedef typename Matrix::ConstColIterator ColIterator;
│ │ │ +
1847 ColIterator end = row.end();
│ │ │ +
1848 typename FieldTraits<typename Matrix::field_type>::real_type absoffdiag=0.;
│ │ │ +
1849
│ │ │ +
1850 using std::max;
│ │ │ +
1851 if(firstlevel) {
│ │ │ +
1852 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ +
1853 if(col.index()!=*vertex) {
│ │ │ +
1854 criterion.examine(col);
│ │ │ +
1855 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm());
│ │ │ +
1856 }
│ │ │ +
1857
│ │ │ +
1858 if(absoffdiag==0)
│ │ │ +
1859 vertex.properties().setExcludedBorder();
│ │ │ +
1860 }
│ │ │ +
1861 else
│ │ │ +
1862 for(ColIterator col = row.begin(); col != end; ++col)
│ │ │ +
1863 if(col.index()!=*vertex)
│ │ │ +
1864 criterion.examine(col);
│ │ │ +
1865
│ │ │ +
1866 // reset the vertex properties
│ │ │ +
1867 //vertex.properties().reset();
│ │ │ +
1868
│ │ │ +
1869 // Check whether the vertex is isolated.
│ │ │ +
1870 if(criterion.isIsolated()) {
│ │ │ +
1871 //std::cout<<"ISOLATED: "<<*vertex<<std::endl;
│ │ │ +
1872 vertex.properties().setIsolated();
│ │ │ +
1873 }else{
│ │ │ +
1874 // Examine all the edges beginning at this vertex.
│ │ │ +
1875 auto eEnd = vertex.end();
│ │ │ +
1876 auto col = matrix[*vertex].begin();
│ │ │ +
1877
│ │ │ +
1878 for(auto edge = vertex.begin(); edge!= eEnd; ++edge, ++col) {
│ │ │ +
1879 // Move to the right column.
│ │ │ +
1880 while(col.index()!=edge.target())
│ │ │ +
1881 ++col;
│ │ │ +
1882 criterion.examine(graph, edge, col);
│ │ │ +
1883 }
│ │ │ +
1884 }
│ │ │ +
1885
│ │ │ +
1886 }
│ │ │ +
1887 }
│ │ │ +
1888
│ │ │ +
1889
│ │ │ +
1890 template<class G>
│ │ │ +
1891 template<class V>
│ │ │ +
1892 inline Aggregator<G>::AggregateVisitor<V>::AggregateVisitor(const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1893 const AggregateDescriptor& aggregate, V& visitor)
│ │ │ +
1894 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor)
│ │ │ +
1895 {}
│ │ │ +
1896
│ │ │ +
1897 template<class G>
│ │ │ +
1898 template<class V>
│ │ │ + │ │ │ +
1900 {
│ │ │ +
1901 if(aggregates_[edge.target()]==aggregate_)
│ │ │ +
1902 visitor_->operator()(edge);
│ │ │ +
1903 }
│ │ │ +
1904
│ │ │ +
1905 template<class G>
│ │ │ +
1906 template<class V>
│ │ │ +
1907 inline void Aggregator<G>::visitAggregateNeighbours(const Vertex& vertex,
│ │ │ +
1908 const AggregateDescriptor& aggregate,
│ │ │ +
1909 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
1910 V& visitor) const
│ │ │ +
1911 {
│ │ │ +
1912 // Only evaluates for edge pointing to the aggregate
│ │ │ +
1913 AggregateVisitor<V> v(aggregates, aggregate, visitor);
│ │ │ +
1914 visitNeighbours(*graph_, vertex, v);
│ │ │ +
1915 }
│ │ │ +
1916
│ │ │ +
1917
│ │ │ +
1918 template<class G>
│ │ │ + │ │ │ +
1920 : count_(0)
│ │ │ +
1921 {}
│ │ │ +
1922
│ │ │ +
1923 template<class G>
│ │ │ + │ │ │ +
1925 {
│ │ │ +
1926 ++count_;
│ │ │ +
1927 }
│ │ │ +
1928
│ │ │ +
1929 template<class G>
│ │ │ + │ │ │ +
1931 {
│ │ │ +
1932 --count_;
│ │ │ +
1933 }
│ │ │ +
1934 template<class G>
│ │ │ + │ │ │ +
1936 {
│ │ │ +
1937 return count_;
│ │ │ +
1938 }
│ │ │ +
1939
│ │ │ +
1940 template<class G>
│ │ │ + │ │ │ +
1942 {
│ │ │ +
1943 if(edge.properties().isTwoWay())
│ │ │ + │ │ │ +
1945 }
│ │ │ +
1946
│ │ │ +
1947 template<class G>
│ │ │ +
1948 int Aggregator<G>::twoWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1949 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
1950 {
│ │ │ +
1951 TwoWayCounter counter;
│ │ │ +
1952 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ +
1953 return counter.value();
│ │ │ +
1954 }
│ │ │ +
1955
│ │ │ +
1956 template<class G>
│ │ │ +
1957 int Aggregator<G>::oneWayConnections(const Vertex& vertex, const AggregateDescriptor& aggregate,
│ │ │ +
1958 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
1959 {
│ │ │ +
1960 OneWayCounter counter;
│ │ │ +
1961 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ +
1962 return counter.value();
│ │ │ +
1963 }
│ │ │ +
1964
│ │ │ +
1965 template<class G>
│ │ │ + │ │ │ +
1967 {
│ │ │ +
1968 if(edge.properties().isOneWay())
│ │ │ + │ │ │ +
1970 }
│ │ │ +
1971
│ │ │ +
1972 template<class G>
│ │ │ +
1973 inline Aggregator<G>::ConnectivityCounter::ConnectivityCounter(const VertexSet& connected,
│ │ │ +
1974 const AggregatesMap<Vertex>& aggregates)
│ │ │ +
1975 : Counter(), connected_(connected), aggregates_(aggregates)
│ │ │ +
1976 {}
│ │ │ +
1977
│ │ │ +
1978
│ │ │ +
1979 template<class G>
│ │ │ + │ │ │ +
1981 {
│ │ │ +
1982 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || aggregates_[edge.target()]==AggregatesMap<Vertex>::UNAGGREGATED)
│ │ │ +
1983 // Would be a new connection
│ │ │ + │ │ │ +
1985 else{
│ │ │ + │ │ │ + │ │ │ +
1988 }
│ │ │ +
1989 }
│ │ │ +
1990
│ │ │ +
1991 template<class G>
│ │ │ +
1992 inline double Aggregator<G>::connectivity(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
1993 {
│ │ │ +
1994 ConnectivityCounter counter(connected_, aggregates);
│ │ │ +
1995 double noNeighbours=visitNeighbours(*graph_, vertex, counter);
│ │ │ +
1996 return (double)counter.value()/noNeighbours;
│ │ │ +
1997 }
│ │ │ +
1998
│ │ │ +
1999 template<class G>
│ │ │ + │ │ │ +
2001 : Counter()
│ │ │ +
2002 {}
│ │ │ +
2003
│ │ │ +
2004 template<class G>
│ │ │ + │ │ │ +
2006 {
│ │ │ +
2007 if(edge.properties().depends())
│ │ │ + │ │ │ +
2009 if(edge.properties().influences())
│ │ │ + │ │ │ +
2011 }
│ │ │ +
2012
│ │ │ +
2013 template<class G>
│ │ │ +
2014 int Aggregator<G>::unusedNeighbours(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2015 {
│ │ │ +
2016 return aggregateNeighbours(vertex, AggregatesMap<Vertex>::UNAGGREGATED, aggregates);
│ │ │ +
2017 }
│ │ │ +
2018
│ │ │ +
2019 template<class G>
│ │ │ +
2020 std::pair<int,int> Aggregator<G>::neighbours(const Vertex& vertex,
│ │ │ +
2021 const AggregateDescriptor& aggregate,
│ │ │ +
2022 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2023 {
│ │ │ +
2024 DependencyCounter unused, aggregated;
│ │ │ +
2025 typedef AggregateVisitor<DependencyCounter> CounterT;
│ │ │ +
2026 typedef std::tuple<CounterT,CounterT> CounterTuple;
│ │ │ +
2027 CombinedFunctor<CounterTuple> visitors(CounterTuple(CounterT(aggregates, AggregatesMap<Vertex>::UNAGGREGATED, unused), CounterT(aggregates, aggregate, aggregated)));
│ │ │ +
2028 visitNeighbours(*graph_, vertex, visitors);
│ │ │ +
2029 return std::make_pair(unused.value(), aggregated.value());
│ │ │ +
2030 }
│ │ │ +
2031
│ │ │ +
2032
│ │ │ +
2033 template<class G>
│ │ │ +
2034 int Aggregator<G>::aggregateNeighbours(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2035 {
│ │ │ +
2036 DependencyCounter counter;
│ │ │ +
2037 visitAggregateNeighbours(vertex, aggregate, aggregates, counter);
│ │ │ +
2038 return counter.value();
│ │ │ +
2039 }
│ │ │ +
2040
│ │ │ +
2041 template<class G>
│ │ │ +
2042 std::size_t Aggregator<G>::distance(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates)
│ │ │ +
2043 {
│ │ │ +
2044 return 0;
│ │ │ +
2045 typename PropertyMapTypeSelector<VertexVisitedTag,G>::Type visitedMap = get(VertexVisitedTag(), *graph_);
│ │ │ +
2046 VertexList vlist;
│ │ │ +
2047 typename AggregatesMap<Vertex>::DummyEdgeVisitor dummy;
│ │ │ +
2048 return aggregates.template breadthFirstSearch<true,true>(vertex,
│ │ │ +
2049 aggregate_->id(), *graph_,
│ │ │ +
2050 vlist, dummy, dummy, visitedMap);
│ │ │ +
2051 }
│ │ │ +
2052
│ │ │ +
2053 template<class G>
│ │ │ +
2054 inline Aggregator<G>::FrontMarker::FrontMarker(std::vector<Vertex>& front, MatrixGraph& graph)
│ │ │ +
2055 : front_(front), graph_(graph)
│ │ │ +
2056 {}
│ │ │ +
2057
│ │ │ +
2058 template<class G>
│ │ │ + │ │ │ +
2060 {
│ │ │ +
2061 Vertex target = edge.target();
│ │ │ +
2062
│ │ │ +
2063 if(!graph_.getVertexProperties(target).front()) {
│ │ │ +
2064 front_.push_back(target);
│ │ │ +
2065 graph_.getVertexProperties(target).setFront();
│ │ │ +
2066 }
│ │ │ +
2067 }
│ │ │ +
2068
│ │ │ +
2069 template<class G>
│ │ │ +
2070 inline bool Aggregator<G>::admissible(const Vertex& vertex, const AggregateDescriptor& aggregate, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2071 {
│ │ │ +
2072 // Todo
│ │ │ +
2073 Dune::dvverb<<" Admissible not yet implemented!"<<std::endl;
│ │ │ +
2074 return true;
│ │ │ +
2075 //Situation 1: front node depends on two nodes. Then these
│ │ │ +
2076 // have to be strongly connected to each other
│ │ │ +
2077
│ │ │ +
2078 // Iterate over all all neighbours of front node
│ │ │ +
2079 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ +
2080 Iterator vend = graph_->endEdges(vertex);
│ │ │ +
2081 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ +
2082 // if(edge.properties().depends() && !edge.properties().influences()
│ │ │ +
2083 if(edge.properties().isStrong()
│ │ │ +
2084 && aggregates[edge.target()]==aggregate)
│ │ │ +
2085 {
│ │ │ +
2086 // Search for another link to the aggregate
│ │ │ +
2087 Iterator edge1 = edge;
│ │ │ +
2088 for(++edge1; edge1 != vend; ++edge1) {
│ │ │ +
2089 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ +
2090 if(edge1.properties().isStrong()
│ │ │ +
2091 && aggregates[edge.target()]==aggregate)
│ │ │ +
2092 {
│ │ │ +
2093 //Search for an edge connecting the two vertices that is
│ │ │ +
2094 //strong
│ │ │ +
2095 bool found=false;
│ │ │ +
2096 Iterator v2end = graph_->endEdges(edge.target());
│ │ │ +
2097 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; ++edge2) {
│ │ │ +
2098 if(edge2.target()==edge1.target() &&
│ │ │ +
2099 edge2.properties().isStrong()) {
│ │ │ +
2100 found =true;
│ │ │ +
2101 break;
│ │ │ +
2102 }
│ │ │ +
2103 }
│ │ │ +
2104 if(found)
│ │ │ +
2105 {
│ │ │ +
2106 return true;
│ │ │ +
2107 }
│ │ │ +
2108 }
│ │ │ +
2109 }
│ │ │ +
2110 }
│ │ │ +
2111 }
│ │ │ +
2112
│ │ │ +
2113 // Situation 2: cluster node depends on front node and other cluster node
│ │ │ +
2115 vend = graph_->endEdges(vertex);
│ │ │ +
2116 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) {
│ │ │ +
2117 //if(!edge.properties().depends() && edge.properties().influences()
│ │ │ +
2118 if(edge.properties().isStrong()
│ │ │ +
2119 && aggregates[edge.target()]==aggregate)
│ │ │ +
2120 {
│ │ │ +
2121 // Search for a link from target that stays within the aggregate
│ │ │ +
2122 Iterator v1end = graph_->endEdges(edge.target());
│ │ │ +
2123
│ │ │ +
2124 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; ++edge1) {
│ │ │ +
2125 //if(edge1.properties().depends() && !edge1.properties().influences()
│ │ │ +
2126 if(edge1.properties().isStrong()
│ │ │ +
2127 && aggregates[edge1.target()]==aggregate)
│ │ │ +
2128 {
│ │ │ +
2129 bool found=false;
│ │ │ +
2130 // Check if front node is also connected to this one
│ │ │ +
2131 Iterator v2end = graph_->endEdges(vertex);
│ │ │ +
2132 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) {
│ │ │ +
2133 if(edge2.target()==edge1.target()) {
│ │ │ +
2134 if(edge2.properties().isStrong())
│ │ │ +
2135 found=true;
│ │ │ +
2136 break;
│ │ │ +
2137 }
│ │ │ +
2138 }
│ │ │ +
2139 if(found)
│ │ │ +
2140 {
│ │ │ +
2141 return true;
│ │ │ +
2142 }
│ │ │ +
2143 }
│ │ │ +
2144 }
│ │ │ +
2145 }
│ │ │ +
2146 }
│ │ │ +
2147 return false;
│ │ │ +
2148 }
│ │ │ +
2149
│ │ │ +
2150 template<class G>
│ │ │ + │ │ │ +
2152 {
│ │ │ +
2153 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2154
│ │ │ +
2155 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex)
│ │ │ +
2156 graph_->getVertexProperties(*vertex).resetFront();
│ │ │ +
2157
│ │ │ +
2158 front_.clear();
│ │ │ +
2159 }
│ │ │ +
2160
│ │ │ +
2161 template<class G>
│ │ │ +
2162 inline void
│ │ │ + │ │ │ +
2164 const AggregatesMap<Vertex>& aggregates,
│ │ │ +
2165 SLList<Vertex>& neighbours) const
│ │ │ +
2166 {
│ │ │ +
2167 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ +
2168 Iterator end=graph_->beginEdges(vertex);
│ │ │ +
2169 neighbours.clear();
│ │ │ +
2170
│ │ │ +
2171 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge)
│ │ │ +
2172 {
│ │ │ +
2173 if(aggregates[edge.target()]!=AggregatesMap<Vertex>::UNAGGREGATED && graph_->getVertexProperties(edge.target()).isolated())
│ │ │ +
2174 neighbours.push_back(aggregates[edge.target()]);
│ │ │ +
2175 }
│ │ │ +
2176 }
│ │ │ +
2177
│ │ │ +
2178 template<class G>
│ │ │ +
2179 inline typename G::VertexDescriptor Aggregator<G>::mergeNeighbour(const Vertex& vertex, const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2180 {
│ │ │ +
2181 typedef typename MatrixGraph::ConstEdgeIterator Iterator;
│ │ │ +
2182
│ │ │ +
2183 Iterator end = graph_->endEdges(vertex);
│ │ │ +
2184 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) {
│ │ │ +
2185 if(aggregates[edge.target()] != AggregatesMap<Vertex>::UNAGGREGATED &&
│ │ │ +
2186 graph_->getVertexProperties(edge.target()).isolated() == graph_->getVertexProperties(edge.source()).isolated()) {
│ │ │ +
2187 if( graph_->getVertexProperties(vertex).isolated() ||
│ │ │ +
2188 ((edge.properties().depends() || edge.properties().influences())
│ │ │ +
2189 && admissible(vertex, aggregates[edge.target()], aggregates)))
│ │ │ +
2190 return edge.target();
│ │ │ +
2191 }
│ │ │ +
2192 }
│ │ │ + │ │ │ +
2194 }
│ │ │ +
2195
│ │ │ +
2196 template<class G>
│ │ │ + │ │ │ +
2198 : Counter(), graph_(graph)
│ │ │ +
2199 {}
│ │ │ +
2200
│ │ │ +
2201 template<class G>
│ │ │ + │ │ │ +
2203 {
│ │ │ +
2204 if(graph_.getVertexProperties(edge.target()).front())
│ │ │ + │ │ │ +
2206 }
│ │ │ +
2207
│ │ │ +
2208 template<class G>
│ │ │ +
2209 int Aggregator<G>::noFrontNeighbours(const Vertex& vertex) const
│ │ │ +
2210 {
│ │ │ +
2211 FrontNeighbourCounter counter(*graph_);
│ │ │ +
2212 visitNeighbours(*graph_, vertex, counter);
│ │ │ +
2213 return counter.value();
│ │ │ +
2214 }
│ │ │ +
2215 template<class G>
│ │ │ +
2216 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ +
2217 const AggregateDescriptor& aggregate,
│ │ │ +
2218 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2219 {
│ │ │ +
2220 typedef typename G::ConstEdgeIterator iterator;
│ │ │ +
2221 const iterator end = graph_->endEdges(vertex);
│ │ │ +
2222 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge)
│ │ │ +
2223 if(aggregates[edge.target()]==aggregate)
│ │ │ +
2224 return true;
│ │ │ +
2225 return false;
│ │ │ +
2226 }
│ │ │ +
2227 template<class G>
│ │ │ +
2228 inline bool Aggregator<G>::connected(const Vertex& vertex,
│ │ │ +
2229 const SLList<AggregateDescriptor>& aggregateList,
│ │ │ +
2230 const AggregatesMap<Vertex>& aggregates) const
│ │ │ +
2231 {
│ │ │ +
2232 typedef typename SLList<AggregateDescriptor>::const_iterator Iter;
│ │ │ +
2233 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i)
│ │ │ +
2234 if(connected(vertex, *i, aggregates))
│ │ │ +
2235 return true;
│ │ │ +
2236 return false;
│ │ │ +
2237 }
│ │ │ +
2238
│ │ │ +
2239 template<class G>
│ │ │ +
2240 template<class C>
│ │ │ +
2241 void Aggregator<G>::growIsolatedAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ +
2242 {
│ │ │ +
2243 SLList<Vertex> connectedAggregates;
│ │ │ +
2244 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates);
│ │ │ +
2245
│ │ │ +
2246 while(aggregate_->size()< c.minAggregateSize() && aggregate_->connectSize() < c.maxConnectivity()) {
│ │ │ +
2247 double maxCon=-1;
│ │ │ +
2248 std::size_t maxFrontNeighbours=0;
│ │ │ +
2249
│ │ │ + │ │ │ +
2251
│ │ │ +
2252 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2253
│ │ │ +
2254 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ +
2255 if(distance(*vertex, aggregates)>c.maxDistance())
│ │ │ +
2256 continue; // distance of proposes aggregate too big
│ │ │ +
2257
│ │ │ +
2258 if(connectedAggregates.size()>0) {
│ │ │ +
2259 // there is already a neighbour cluster
│ │ │ +
2260 // front node must be connected to same neighbour cluster
│ │ │ +
2261
│ │ │ +
2262 if(!connected(*vertex, connectedAggregates, aggregates))
│ │ │ +
2263 continue;
│ │ │ +
2264 }
│ │ │ +
2265
│ │ │ +
2266 double con = connectivity(*vertex, aggregates);
│ │ │ +
2267
│ │ │ +
2268 if(con == maxCon) {
│ │ │ +
2269 std::size_t frontNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2270
│ │ │ +
2271 if(frontNeighbours >= maxFrontNeighbours) {
│ │ │ +
2272 maxFrontNeighbours = frontNeighbours;
│ │ │ +
2273 candidate = *vertex;
│ │ │ +
2274 }
│ │ │ +
2275 }else if(con > maxCon) {
│ │ │ +
2276 maxCon = con;
│ │ │ +
2277 maxFrontNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2278 candidate = *vertex;
│ │ │ +
2279 }
│ │ │ +
2280 }
│ │ │ +
2281
│ │ │ + │ │ │ +
2283 break;
│ │ │ +
2284
│ │ │ +
2285 aggregate_->add(candidate);
│ │ │ +
2286 }
│ │ │ +
2287 }
│ │ │ +
2288
│ │ │ +
2289 template<class G>
│ │ │ +
2290 template<class C>
│ │ │ +
2291 void Aggregator<G>::growAggregate(const Vertex& seed, const AggregatesMap<Vertex>& aggregates, const C& c)
│ │ │ +
2292 {
│ │ │ +
2293 using std::min;
│ │ │ +
2294
│ │ │ +
2295 std::size_t distance_ =0;
│ │ │ +
2296 while(aggregate_->size() < c.minAggregateSize()&& distance_<c.maxDistance()) {
│ │ │ +
2297 int maxTwoCons=0, maxOneCons=0, maxNeighbours=-1;
│ │ │ +
2298 double maxCon=-1;
│ │ │ +
2299
│ │ │ +
2300 std::vector<Vertex> candidates;
│ │ │ +
2301 candidates.reserve(30);
│ │ │ +
2302
│ │ │ +
2303 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2304
│ │ │ +
2305 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ +
2306 // Only nonisolated nodes are considered
│ │ │ +
2307 if(graph_->getVertexProperties(*vertex).isolated())
│ │ │ +
2308 continue;
│ │ │ +
2309
│ │ │ +
2310 int twoWayCons = twoWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ +
2311
│ │ │ +
2312 /* The case of two way connections. */
│ │ │ +
2313 if( maxTwoCons == twoWayCons && twoWayCons > 0) {
│ │ │ +
2314 double con = connectivity(*vertex, aggregates);
│ │ │ +
2315
│ │ │ +
2316 if(con == maxCon) {
│ │ │ +
2317 int neighbours = noFrontNeighbours(*vertex);
│ │ │ +
2318
│ │ │ +
2319 if(neighbours > maxNeighbours) {
│ │ │ +
2320 maxNeighbours = neighbours;
│ │ │ +
2321 candidates.clear();
│ │ │ +
2322 candidates.push_back(*vertex);
│ │ │ +
2323 }else{
│ │ │ +
2324 candidates.push_back(*vertex);
│ │ │ +
2325 }
│ │ │ +
2326 }else if( con > maxCon) {
│ │ │ +
2327 maxCon = con;
│ │ │ +
2328 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2329 candidates.clear();
│ │ │ +
2330 candidates.push_back(*vertex);
│ │ │ +
2331 }
│ │ │ +
2332 }else if(twoWayCons > maxTwoCons) {
│ │ │ +
2333 maxTwoCons = twoWayCons;
│ │ │ +
2334 maxCon = connectivity(*vertex, aggregates);
│ │ │ +
2335 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2336 candidates.clear();
│ │ │ +
2337 candidates.push_back(*vertex);
│ │ │ +
2338
│ │ │ +
2339 // two way connections precede
│ │ │ +
2340 maxOneCons = std::numeric_limits<int>::max();
│ │ │ +
2341 }
│ │ │ +
2342
│ │ │ +
2343 if(twoWayCons > 0)
│ │ │ +
2344 {
│ │ │ +
2345 continue; // THis is a two-way node, skip tests for one way nodes
│ │ │ +
2346 }
│ │ │ +
2347
│ │ │ +
2348 /* The one way case */
│ │ │ +
2349 int oneWayCons = oneWayConnections(*vertex, aggregate_->id(), aggregates);
│ │ │ +
2350
│ │ │ +
2351 if(oneWayCons==0)
│ │ │ +
2352 continue; // No strong connections, skip the tests.
│ │ │ +
2353
│ │ │ +
2354 if(!admissible(*vertex, aggregate_->id(), aggregates))
│ │ │ +
2355 continue;
│ │ │ +
2356
│ │ │ +
2357 if( maxOneCons == oneWayCons && oneWayCons > 0) {
│ │ │ +
2358 double con = connectivity(*vertex, aggregates);
│ │ │ +
2359
│ │ │ +
2360 if(con == maxCon) {
│ │ │ +
2361 int neighbours = noFrontNeighbours(*vertex);
│ │ │ +
2362
│ │ │ +
2363 if(neighbours > maxNeighbours) {
│ │ │ +
2364 maxNeighbours = neighbours;
│ │ │ +
2365 candidates.clear();
│ │ │ +
2366 candidates.push_back(*vertex);
│ │ │ +
2367 }else{
│ │ │ +
2368 if(neighbours==maxNeighbours)
│ │ │ +
2369 {
│ │ │ +
2370 candidates.push_back(*vertex);
│ │ │ +
2371 }
│ │ │ +
2372 }
│ │ │ +
2373 }else if( con > maxCon) {
│ │ │ +
2374 maxCon = con;
│ │ │ +
2375 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2376 candidates.clear();
│ │ │ +
2377 candidates.push_back(*vertex);
│ │ │ +
2378 }
│ │ │ +
2379 }else if(oneWayCons > maxOneCons) {
│ │ │ +
2380 maxOneCons = oneWayCons;
│ │ │ +
2381 maxCon = connectivity(*vertex, aggregates);
│ │ │ +
2382 maxNeighbours = noFrontNeighbours(*vertex);
│ │ │ +
2383 candidates.clear();
│ │ │ +
2384 candidates.push_back(*vertex);
│ │ │ +
2385 }
│ │ │ +
2386 }
│ │ │ +
2387
│ │ │ +
2388
│ │ │ +
2389 if(!candidates.size())
│ │ │ +
2390 break; // No more candidates found
│ │ │ +
2391 distance_=distance(seed, aggregates);
│ │ │ +
2392 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ +
2393 aggregate_->size()));
│ │ │ +
2394 aggregate_->add(candidates);
│ │ │ +
2395 }
│ │ │ +
2396 }
│ │ │ +
2397
│ │ │ +
2398 template<typename V>
│ │ │ +
2399 template<typename M, typename G, typename C>
│ │ │ +
2400 std::tuple<int,int,int,int> AggregatesMap<V>::buildAggregates(const M& matrix, G& graph, const C& criterion,
│ │ │ +
2401 bool finestLevel)
│ │ │ +
2402 {
│ │ │ +
2403 Aggregator<G> aggregator;
│ │ │ +
2404 return aggregator.build(matrix, graph, *this, criterion, finestLevel);
│ │ │ +
2405 }
│ │ │ +
2406
│ │ │ +
2407 template<class G>
│ │ │ +
2408 template<class M, class C>
│ │ │ +
2409 std::tuple<int,int,int,int> Aggregator<G>::build(const M& m, G& graph, AggregatesMap<Vertex>& aggregates, const C& c,
│ │ │ +
2410 bool finestLevel)
│ │ │ +
2411 {
│ │ │ +
2412 using std::max;
│ │ │ +
2413 using std::min;
│ │ │ +
2414 // Stack for fast vertex access
│ │ │ +
2415 Stack stack_(graph, *this, aggregates);
│ │ │ +
2416
│ │ │ +
2417 graph_ = &graph;
│ │ │ +
2418
│ │ │ +
2419 aggregate_ = new Aggregate<G,VertexSet>(graph, aggregates, connected_, front_);
│ │ │ +
2420
│ │ │ +
2421 Timer watch;
│ │ │ +
2422 watch.reset();
│ │ │ +
2423
│ │ │ +
2424 buildDependency(graph, m, c, finestLevel);
│ │ │ +
2425
│ │ │ +
2426 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<<std::endl;
│ │ │ +
2427 int noAggregates, conAggregates, isoAggregates, oneAggregates;
│ │ │ +
2428 std::size_t maxA=0, minA=1000000, avg=0;
│ │ │ +
2429 int skippedAggregates;
│ │ │ +
2430 noAggregates = conAggregates = isoAggregates = oneAggregates =
│ │ │ +
2431 skippedAggregates = 0;
│ │ │ +
2432
│ │ │ +
2433 while(true) {
│ │ │ +
2434 Vertex seed = stack_.pop();
│ │ │ +
2435
│ │ │ +
2436 if(seed == Stack::NullEntry)
│ │ │ +
2437 // No more unaggregated vertices. We are finished!
│ │ │ +
2438 break;
│ │ │ +
2439
│ │ │ +
2440 // Debugging output
│ │ │ +
2441 if((noAggregates+1)%10000 == 0)
│ │ │ +
2442 Dune::dverb<<"c";
│ │ │ +
2443 unmarkFront();
│ │ │ +
2444
│ │ │ +
2445 if(graph.getVertexProperties(seed).excludedBorder()) {
│ │ │ +
2446 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ +
2447 ++skippedAggregates;
│ │ │ +
2448 continue;
│ │ │ +
2449 }
│ │ │ +
2450
│ │ │ +
2451 if(graph.getVertexProperties(seed).isolated()) {
│ │ │ +
2452 if(c.skipIsolated()) {
│ │ │ +
2453 // isolated vertices are not aggregated but skipped on the coarser levels.
│ │ │ +
2454 aggregates[seed]=AggregatesMap<Vertex>::ISOLATED;
│ │ │ +
2455 ++skippedAggregates;
│ │ │ +
2456 // skip rest as no agglomeration is done.
│ │ │ +
2457 continue;
│ │ │ +
2458 }else{
│ │ │ +
2459 aggregate_->seed(seed);
│ │ │ +
2460 growIsolatedAggregate(seed, aggregates, c);
│ │ │ +
2461 }
│ │ │ +
2462 }else{
│ │ │ +
2463 aggregate_->seed(seed);
│ │ │ +
2464 growAggregate(seed, aggregates, c);
│ │ │ +
2465 }
│ │ │ +
2466
│ │ │ +
2467 /* The rounding step. */
│ │ │ +
2468 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->size() < c.maxAggregateSize()) {
│ │ │ +
2469
│ │ │ +
2470 std::vector<Vertex> candidates;
│ │ │ +
2471 candidates.reserve(30);
│ │ │ +
2472
│ │ │ +
2473 typedef typename std::vector<Vertex>::const_iterator Iterator;
│ │ │ +
2474
│ │ │ +
2475 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) {
│ │ │ +
2476
│ │ │ +
2477 if(graph.getVertexProperties(*vertex).isolated())
│ │ │ +
2478 continue; // No isolated nodes here
│ │ │ +
2479
│ │ │ +
2480 if(twoWayConnections( *vertex, aggregate_->id(), aggregates) == 0 &&
│ │ │ +
2481 (oneWayConnections( *vertex, aggregate_->id(), aggregates) == 0 ||
│ │ │ +
2482 !admissible( *vertex, aggregate_->id(), aggregates) ))
│ │ │ +
2483 continue;
│ │ │ +
2484
│ │ │ +
2485 std::pair<int,int> neighbourPair=neighbours(*vertex, aggregate_->id(),
│ │ │ +
2486 aggregates);
│ │ │ +
2487
│ │ │ +
2488 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= unusedNeighbours(*vertex, aggregates))
│ │ │ +
2489 // continue;
│ │ │ +
2490
│ │ │ +
2491 if(neighbourPair.first >= neighbourPair.second)
│ │ │ +
2492 continue;
│ │ │ +
2493
│ │ │ +
2494 if(distance(*vertex, aggregates) > c.maxDistance())
│ │ │ +
2495 continue; // Distance too far
│ │ │ +
2496 candidates.push_back(*vertex);
│ │ │ +
2497 break;
│ │ │ +
2498 }
│ │ │ +
2499
│ │ │ +
2500 if(!candidates.size()) break; // no more candidates found.
│ │ │ +
2501
│ │ │ +
2502 candidates.resize(min(candidates.size(), c.maxAggregateSize()-
│ │ │ +
2503 aggregate_->size()));
│ │ │ +
2504 aggregate_->add(candidates);
│ │ │ +
2505
│ │ │ +
2506 }
│ │ │ +
2507
│ │ │ +
2508 // try to merge aggregates consisting of only one nonisolated vertex with other aggregates
│ │ │ +
2509 if(aggregate_->size()==1 && c.maxAggregateSize()>1) {
│ │ │ +
2510 if(!graph.getVertexProperties(seed).isolated()) {
│ │ │ +
2511 Vertex mergedNeighbour = mergeNeighbour(seed, aggregates);
│ │ │ +
2512
│ │ │ +
2513 if(mergedNeighbour != AggregatesMap<Vertex>::UNAGGREGATED) {
│ │ │ +
2514 // assign vertex to the neighbouring cluster
│ │ │ +
2515 aggregates[seed] = aggregates[mergedNeighbour];
│ │ │ +
2516 aggregate_->invalidate();
│ │ │ +
2517 }else{
│ │ │ +
2518 ++avg;
│ │ │ +
2519 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ +
2520 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ +
2521 ++oneAggregates;
│ │ │ +
2522 ++conAggregates;
│ │ │ +
2523 }
│ │ │ +
2524 }else{
│ │ │ +
2525 ++avg;
│ │ │ +
2526 minA=min(minA,static_cast<std::size_t>(1));
│ │ │ +
2527 maxA=max(maxA,static_cast<std::size_t>(1));
│ │ │ +
2528 ++oneAggregates;
│ │ │ +
2529 ++isoAggregates;
│ │ │ +
2530 }
│ │ │ +
2531 ++avg;
│ │ │ +
2532 }else{
│ │ │ +
2533 avg+=aggregate_->size();
│ │ │ +
2534 minA=min(minA,aggregate_->size());
│ │ │ +
2535 maxA=max(maxA,aggregate_->size());
│ │ │ +
2536 if(graph.getVertexProperties(seed).isolated())
│ │ │ +
2537 ++isoAggregates;
│ │ │ +
2538 else
│ │ │ +
2539 ++conAggregates;
│ │ │ +
2540 }
│ │ │ +
2541
│ │ │ +
2542 }
│ │ │ +
2543
│ │ │ +
2544 Dune::dinfo<<"connected aggregates: "<<conAggregates;
│ │ │ +
2545 Dune::dinfo<<" isolated aggregates: "<<isoAggregates;
│ │ │ +
2546 if(conAggregates+isoAggregates>0)
│ │ │ +
2547 Dune::dinfo<<" one node aggregates: "<<oneAggregates<<" min size="
│ │ │ +
2548 <<minA<<" max size="<<maxA
│ │ │ +
2549 <<" avg="<<avg/(conAggregates+isoAggregates)<<std::endl;
│ │ │ +
2550
│ │ │ +
2551 delete aggregate_;
│ │ │ +
2552 return std::make_tuple(conAggregates+isoAggregates,isoAggregates,
│ │ │ +
2553 oneAggregates,skippedAggregates);
│ │ │ +
2554 }
│ │ │ +
2555
│ │ │ +
2556
│ │ │ +
2557 template<class G>
│ │ │ +
2558 Aggregator<G>::Stack::Stack(const MatrixGraph& graph, const Aggregator<G>& aggregatesBuilder,
│ │ │ +
2559 const AggregatesMap<Vertex>& aggregates)
│ │ │ +
2560 : graph_(graph), aggregatesBuilder_(aggregatesBuilder), aggregates_(aggregates), begin_(graph.begin()), end_(graph.end())
│ │ │ +
2561 {
│ │ │ +
2562 //vals_ = new Vertex[N];
│ │ │ +
2563 }
│ │ │ +
2564
│ │ │ +
2565 template<class G>
│ │ │ + │ │ │ +
2567 {
│ │ │ +
2568 //Dune::dverb << "Max stack size was "<<maxSize_<<" filled="<<filled_<<std::endl;
│ │ │ +
2569 //delete[] vals_;
│ │ │ +
2570 }
│ │ │ +
2571
│ │ │ +
2572 template<class G>
│ │ │ + │ │ │ +
2574 = std::numeric_limits<typename G::VertexDescriptor>::max();
│ │ │ +
2575
│ │ │ +
2576 template<class G>
│ │ │ +
2577 inline typename G::VertexDescriptor Aggregator<G>::Stack::pop()
│ │ │ +
2578 {
│ │ │ +
2579 for(; begin_!=end_ && aggregates_[*begin_] != AggregatesMap<Vertex>::UNAGGREGATED; ++begin_) ;
│ │ │ +
2580
│ │ │ +
2581 if(begin_!=end_)
│ │ │ +
2582 {
│ │ │ +
2583 typename G::VertexDescriptor current=*begin_;
│ │ │ +
2584 ++begin_;
│ │ │ +
2585 return current;
│ │ │ +
2586 }else
│ │ │ +
2587 return NullEntry;
│ │ │ +
2588 }
│ │ │ +
2589
│ │ │ +
2590#endif // DOXYGEN
│ │ │ +
2591
│ │ │ +
2592 template<class V>
│ │ │ +
│ │ │ +
2593 void printAggregates2d(const AggregatesMap<V>& aggregates, int n, int m, std::ostream& os)
│ │ │ +
2594 {
│ │ │ +
2595 using std::max;
│ │ │ +
2596
│ │ │ +
2597 std::ios_base::fmtflags oldOpts=os.flags();
│ │ │ +
2598
│ │ │ +
2599 os.setf(std::ios_base::right, std::ios_base::adjustfield);
│ │ │ +
2600
│ │ │ +
2601 V maxVal=0;
│ │ │ +
2602 int width=1;
│ │ │ +
2603
│ │ │ +
2604 for(int i=0; i< n*m; i++)
│ │ │ +
2605 maxVal=max(maxVal, aggregates[i]);
│ │ │ +
2606
│ │ │ +
2607 for(int i=10; i < 1000000; i*=10)
│ │ │ +
2608 if(maxVal/i>0)
│ │ │ +
2609 width++;
│ │ │ +
2610 else
│ │ │ +
2611 break;
│ │ │ +
2612
│ │ │ +
2613 for(int j=0, entry=0; j < m; j++) {
│ │ │ +
2614 for(int i=0; i<n; i++, entry++) {
│ │ │ +
2615 os.width(width);
│ │ │ +
2616 os<<aggregates[entry]<<" ";
│ │ │ +
2617 }
│ │ │ +
2618
│ │ │ +
2619 os<<std::endl;
│ │ │ +
2620 }
│ │ │ +
2621 os<<std::endl;
│ │ │ +
2622 os.flags(oldOpts);
│ │ │ +
2623 }
│ │ │ +
│ │ │ +
2624
│ │ │ +
2625
│ │ │ +
2626 } // namespace Amg
│ │ │ +
2627
│ │ │ +
2628} // namespace Dune
│ │ │ +
2629
│ │ │ +
2630
│ │ │ +
2631#endif
│ │ │ +
Provides classes for handling internal properties in a graph.
│ │ │ +
Provides classes for building the matrix graph.
│ │ │ + │ │ │ +
Parameter classes for customizing AMG.
│ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:275
│ │ │ +
std::vector< real_type >::iterator valIter_
Definition aggregates.hh:191
│ │ │ +
Matrix::ConstColIterator ColIter
Constant column iterator of the matrix.
Definition aggregates.hh:156
│ │ │ +
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:592
│ │ │ +
iterator begin()
Definition aggregates.hh:743
│ │ │ +
int id()
Get the id identifying the aggregate.
│ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:304
│ │ │ +
size_type size()
Get the size of the aggregate.
│ │ │ +
MatrixGraph::VertexDescriptor Vertex
The vertex identifier.
Definition aggregates.hh:931
│ │ │ +
AggregationCriterion()
Constructor.
Definition aggregates.hh:68
│ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:359
│ │ │ +
void initRow(const Row &row, int index)
│ │ │ +
SymmetricMatrixDependency(const Parameters &parms)
Definition aggregates.hh:170
│ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:260
│ │ │ + │ │ │ +
double alpha() const
Get the scaling value for marking connections as strong. Default value is 1/3.
Definition parameters.hh:70
│ │ │ +
G MatrixGraph
The matrix graph type used.
Definition aggregates.hh:926
│ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:365
│ │ │ +
void operator()(const EdgeIterator &edge) const
Definition aggregates.hh:607
│ │ │ +
typename VertexSet::size_type size_type
Type of size used by allocator of sllist.
Definition aggregates.hh:812
│ │ │ +
SymmetricCriterion()
Definition aggregates.hh:530
│ │ │ +
Dependency()
Definition aggregates.hh:292
│ │ │ +
void examine(const ColIter &col)
│ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:321
│ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:189
│ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:265
│ │ │ +
iterator end()
Definition aggregates.hh:748
│ │ │ +
UnSymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:547
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
void initRow(const Row &row, int index)
Definition aggregates.hh:203
│ │ │ + │ │ │ +
static const Vertex NullEntry
Definition aggregates.hh:1019
│ │ │ +
void examine(const ColIter &col)
Definition aggregates.hh:216
│ │ │ +
Dependency(const Parameters &parms)
Definition aggregates.hh:288
│ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:187
│ │ │ +
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.
│ │ │ +
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
│ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:331
│ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:298
│ │ │ +
size_type connectSize()
Get the number of connections to other aggregates.
│ │ │ +
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:336
│ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &) const
compute the norm of a matrix.
Definition aggregates.hh:512
│ │ │ +
~AggregatesMap()
Destructor.
│ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:181
│ │ │ +
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:1075
│ │ │ +
std::size_t * SphereMap
Type of the mapping of aggregate members onto distance spheres.
Definition aggregates.hh:820
│ │ │ +
AggregationCriterion(const Parameters &parms)
Definition aggregates.hh:72
│ │ │ +
Matrix::row_type Row
Constant Row iterator of the matrix.
Definition aggregates.hh:270
│ │ │ +
std::vector< real_type > vals_
Definition aggregates.hh:190
│ │ │ +
N Norm
The norm to use for examining the matrix entries.
Definition aggregates.hh:326
│ │ │ +
void printAggregates2d(const AggregatesMap< V > &aggregates, int n, int m, std::ostream &os)
Definition aggregates.hh:2593
│ │ │ +
void invalidate()
Definition aggregates.hh:833
│ │ │ +
const_iterator begin() const
Definition aggregates.hh:731
│ │ │ +
real_type maxValue_
Definition aggregates.hh:183
│ │ │ +
Norm norm_
The functor for calculating the norm.
Definition aggregates.hh:185
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
VertexSet::const_iterator const_iterator
Const iterator over a vertex list.
Definition aggregates.hh:815
│ │ │ +
SymmetricCriterion(const Parameters &parms)
Definition aggregates.hh:527
│ │ │ +
MatrixGraph::VertexDescriptor AggregateDescriptor
The type of the aggregate descriptor.
Definition aggregates.hh:934
│ │ │ +
real_type maxValue_
Definition aggregates.hh:363
│ │ │ +
void init(const Matrix *matrix)
Definition aggregates.hh:197
│ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:369
│ │ │ +
AggregateDescriptor * iterator
Definition aggregates.hh:741
│ │ │ +
SymmetricDependency(const Parameters &parms)
Definition aggregates.hh:350
│ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:362
│ │ │ +
~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:57
│ │ │ +
auto operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:475
│ │ │ +
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.
│ │ │ +
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:84
│ │ │ +
const_iterator end() const
Definition aggregates.hh:736
│ │ │ +
V AggregateDescriptor
The aggregate descriptor type.
Definition aggregates.hh:586
│ │ │ +
static const T ISOLATED
Definition aggregates.hh:577
│ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:367
│ │ │ +
SymmetricMatrixDependency()
Definition aggregates.hh:173
│ │ │ + │ │ │ + │ │ │ +
real_type diagonal_
The norm of the current diagonal.
Definition aggregates.hh:308
│ │ │ +
std::size_t noVertices() const
│ │ │ +
void setDefaultValuesAnisotropic(std::size_t dim, std::size_t diameter=2)
Sets reasonable default values for an aisotropic problem.
Definition aggregates.hh:107
│ │ │ +
AggregatesMap(std::size_t noVertices)
Constructs with allocating memory.
│ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:361
│ │ │ +
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:598
│ │ │ + │ │ │ +
ConnectivityCounter(const VertexSet &connected, const AggregatesMap< Vertex > &aggregates)
Constructor.
│ │ │ +
const_iterator end() const
get an iterator over the vertices of the aggregate.
│ │ │ +
void init(const Matrix *matrix)
│ │ │ +
UnSymmetricCriterion()
Definition aggregates.hh:550
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
const AggregateDescriptor * const_iterator
Definition aggregates.hh:729
│ │ │ +
int row_
index of the currently evaluated row.
Definition aggregates.hh:306
│ │ │ +
Stack(const MatrixGraph &graph, const Aggregator< G > &aggregatesBuilder, const AggregatesMap< Vertex > &aggregates)
│ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:182
│ │ │ +
void initRow(const Row &row, int index)
│ │ │ +
M Matrix
The matrix type we build the dependency of.
Definition aggregates.hh:141
│ │ │ +
FieldTraits< field_type >::real_type real_type
Definition aggregates.hh:301
│ │ │ +
const Matrix * matrix_
The matrix we work on.
Definition aggregates.hh:179
│ │ │ +
S VertexSet
The type of a single linked list of vertex descriptors.
Definition aggregates.hh:807
│ │ │ +
FieldTraits< typenameM::field_type >::real_type operator()(const M &m) const
compute the norm of a matrix.
Definition aggregates.hh:496
│ │ │ +
static const T UNAGGREGATED
Definition aggregates.hh:572
│ │ │ +
std::size_t breadthFirstSearch(const VertexDescriptor &start, const AggregateDescriptor &aggregate, const G &graph, F &aggregateVisitor, VM &visitedMap) const
Breadth first search within an aggregate.
│ │ │ +
auto operator()(const M &m, typename std::enable_if_t< Dune::IsNumber< M >::value > *=nullptr) const
Compute the norm of a scalar.
Definition aggregates.hh:408
│ │ │ +
Matrix::field_type field_type
The current max value.
Definition aggregates.hh:300
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
std::ostream & operator<<(std::ostream &os, const AggregationCriterion< T > &criterion)
Definition aggregates.hh:115
│ │ │ +
bool isIsolated()
Definition aggregates.hh:242
│ │ │ +
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:146
│ │ │ +
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:392
│ │ │ +
MatrixGraph::VertexDescriptor Vertex
The vertex descriptor type.
Definition aggregates.hh:795
│ │ │ +
void seed(const Vertex &vertex)
Initialize the aggregate with one vertex.
│ │ │ + │ │ │ +
SymmetricDependency()
Definition aggregates.hh:353
│ │ │ +
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:581
│ │ │ +
real_type maxValue_
Definition aggregates.hh:302
│ │ │ +
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:151
│ │ │ +
PoolAllocator< Vertex, 100 > Allocator
The allocator we use for our lists and the set.
Definition aggregates.hh:801
│ │ │ +
G MatrixGraph
Definition aggregates.hh:791
│ │ │ +
void operator()(const typename MatrixGraph::ConstEdgeIterator &edge)
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:384
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:468
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:505
│ │ │ +
@ is_sign_preserving
Definition aggregates.hh:489
│ │ │
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
│ │ │ -
Definition repartition.hh:47
│ │ │ -
float real_t
Definition repartition.hh:53
│ │ │ -
std::size_t idx_t
Definition repartition.hh:63
│ │ │ +
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
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ -
@ owner
Definition owneroverlapcopy.hh:61
│ │ │ -
@ copy
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
│ │ │ +
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:51
│ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:255
│ │ │ +
Dependency policy for symmetric matrices.
Definition aggregates.hh:316
│ │ │ +
Norm that uses only the [N][N] entry of the block to determine couplings.
Definition aggregates.hh:381
│ │ │ +
Norm that uses only the [0][0] entry of the block to determine couplings.
Definition aggregates.hh:457
│ │ │ +
Functor using the row sum (infinity) norm to determine strong couplings.
Definition aggregates.hh:465
│ │ │ +
Definition aggregates.hh:486
│ │ │ +
Definition aggregates.hh:502
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ +
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:604
│ │ │ +
A class for temporarily storing the vertices of an aggregate in.
Definition aggregates.hh:784
│ │ │
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
│ │ │ -
@ 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
│ │ │ +
VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:308
│ │ │ +
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
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1988 +1,2671 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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> │ │ │ │ +8 │ │ │ │ +9#include "_p_a_r_a_m_e_t_e_r_s_._h_h" │ │ │ │ +10#include "_g_r_a_p_h_._h_h" │ │ │ │ +11#include "_p_r_o_p_e_r_t_i_e_s_._h_h" │ │ │ │ +12#include "_c_o_m_b_i_n_e_d_f_u_n_c_t_o_r_._h_h" │ │ │ │ +13 │ │ │ │ +14#include │ │ │ │ +15#include │ │ │ │ +16#include │ │ │ │ +17#include │ │ │ │ +18#include │ │ │ │ +19#include │ │ │ │ +20#include │ │ │ │ +21 │ │ │ │ +22#include │ │ │ │ +23#include │ │ │ │ +24#include │ │ │ │ +25#include │ │ │ │ +26#include │ │ │ │ +27#include │ │ │ │ +28#include │ │ │ │ +29#include │ │ │ │ +30 │ │ │ │ +31namespace _D_u_n_e │ │ │ │ +32{ │ │ │ │ +33 namespace _A_m_g │ │ │ │ +34 { │ │ │ │ 35 │ │ │ │ -43 │ │ │ │ -44namespace _D_u_n_e │ │ │ │ -45{ │ │ │ │ -_4_6 namespace _M_e_t_i_s │ │ │ │ -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. │ │ │ │ +45 │ │ │ │ +49 template │ │ │ │ +_5_0 class _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n : public T │ │ │ │ +51 { │ │ │ │ +52 │ │ │ │ +53 public: │ │ │ │ +_5_7 typedef T _D_e_p_e_n_d_e_n_c_y_P_o_l_i_c_y; │ │ │ │ +58 │ │ │ │ +_6_8 _A_g_g_r_e_g_a_t_i_o_n_C_r_i_t_e_r_i_o_n() │ │ │ │ +69 : T() │ │ │ │ +70 {} │ │ │ │ +71 │ │ │ │ +_7_2 _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) │ │ │ │ +73 : T(parms) │ │ │ │ +74 {} │ │ │ │ +75 │ │ │ │ +_8_4 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) │ │ │ │ +85 { │ │ │ │ +86 this->setMaxDistance(diameter-1); │ │ │ │ +87 std::size_t csize=1; │ │ │ │ +88 │ │ │ │ +89 for(; dim>0; dim--) { │ │ │ │ +90 csize*=diameter; │ │ │ │ +91 this->setMaxDistance(this->maxDistance()+diameter-1); │ │ │ │ +92 } │ │ │ │ +93 this->setMinAggregateSize(csize); │ │ │ │ +94 this->setMaxAggregateSize(static_cast(csize*1.5)); │ │ │ │ +95 } │ │ │ │ +96 │ │ │ │ +_1_0_7 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) │ │ │ │ +108 { │ │ │ │ +109 _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); │ │ │ │ +110 this->setMaxDistance(this->maxDistance()+dim-1); │ │ │ │ +111 } │ │ │ │ +112 }; │ │ │ │ 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!"< │ │ │ │ +_1_1_5 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) │ │ │ │ +116 { │ │ │ │ +117 os<<"{ maxdistance="< │ │ │ │ +_1_3_5 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 │ │ │ │ +136 { │ │ │ │ +137 public: │ │ │ │ +_1_4_1 typedef M _M_a_t_r_i_x; │ │ │ │ 142 │ │ │ │ -143 namespace │ │ │ │ -144 { │ │ │ │ -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 } │ │ │ │ -175 int globalOwnerVertices; │ │ │ │ -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 } │ │ │ │ -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 │ │ │ │ +165 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); │ │ │ │ +166 │ │ │ │ +167 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ +168 │ │ │ │ +169 │ │ │ │ +_1_7_0 _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) │ │ │ │ +171 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ +172 {} │ │ │ │ +_1_7_3 _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() │ │ │ │ +174 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ +175 {} │ │ │ │ +176 │ │ │ │ +177 protected: │ │ │ │ +_1_7_9 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ +_1_8_1 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_2 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +_1_8_3 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ +_1_8_5 _N_o_r_m _n_o_r_m__; │ │ │ │ +_1_8_7 int _r_o_w__; │ │ │ │ +_1_8_9 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ +_1_9_0 std::vector _v_a_l_s__; │ │ │ │ +_1_9_1 typename std::vector::iterator _v_a_l_I_t_e_r__; │ │ │ │ +192 │ │ │ │ +193 }; │ │ │ │ +194 │ │ │ │ +195 │ │ │ │ +196 template │ │ │ │ +_1_9_7 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) │ │ │ │ +198 { │ │ │ │ +199 _m_a_t_r_i_x__ = matrix; │ │ │ │ +200 } │ │ │ │ +201 │ │ │ │ +202 template │ │ │ │ +_2_0_3 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) │ │ │ │ +204 { │ │ │ │ +205 using std::min; │ │ │ │ +206 _v_a_l_s__.assign(row.size(), 0.0); │ │ │ │ +207 assert(_v_a_l_s__.size()==row.size()); │ │ │ │ +208 _v_a_l_I_t_e_r__=_v_a_l_s__.begin(); │ │ │ │ +209 │ │ │ │ +210 _m_a_x_V_a_l_u_e__ = min(- std::numeric_limits::max(), std:: │ │ │ │ +numeric_limits::min()); │ │ │ │ +211 _d_i_a_g_o_n_a_l__=_n_o_r_m__(row[index]); │ │ │ │ +212 _r_o_w__ = index; │ │ │ │ +213 } │ │ │ │ 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 } │ │ │ │ -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; │ │ │ │ -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 } │ │ │ │ -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); │ │ │ │ +215 template │ │ │ │ +_2_1_6 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) │ │ │ │ +217 { │ │ │ │ +218 using std::max; │ │ │ │ +219 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ +220 _r_e_a_l___t_y_p_e eij = _n_o_r_m__(*_c_o_l); │ │ │ │ +221 if(!N::is_sign_preserving || eij<0) // || eji<0) │ │ │ │ +222 { │ │ │ │ +223 *_v_a_l_I_t_e_r__ = eij/_d_i_a_g_o_n_a_l__*eij/_n_o_r_m__(_m_a_t_r_i_x__->operator[](_c_o_l.index()) │ │ │ │ +[_c_o_l.index()]); │ │ │ │ +224 _m_a_x_V_a_l_u_e__ = max(_m_a_x_V_a_l_u_e__, *_v_a_l_I_t_e_r__); │ │ │ │ +225 }else │ │ │ │ +226 *_v_a_l_I_t_e_r__ =0; │ │ │ │ +227 ++_v_a_l_I_t_e_r__; │ │ │ │ +228 } │ │ │ │ +229 │ │ │ │ +230 template │ │ │ │ +231 template │ │ │ │ +_2_3_2 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&) │ │ │ │ +233 { │ │ │ │ +234 if(*_v_a_l_I_t_e_r__ > _a_l_p_h_a() * _m_a_x_V_a_l_u_e__) { │ │ │ │ +235 edge.properties().setDepends(); │ │ │ │ +236 edge.properties().setInfluences(); │ │ │ │ +237 } │ │ │ │ +238 ++_v_a_l_I_t_e_r__; │ │ │ │ +239 } │ │ │ │ +240 │ │ │ │ +241 template │ │ │ │ +_2_4_2 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() │ │ │ │ +243 { │ │ │ │ +244 if(_d_i_a_g_o_n_a_l__==0) │ │ │ │ +245 DUNE_THROW(_D_u_n_e_:_:_I_S_T_L_E_r_r_o_r, "No diagonal entry for row "<<_r_o_w__<<"."); │ │ │ │ +246 _v_a_l_I_t_e_r__=_v_a_l_s__.begin(); │ │ │ │ +247 return _m_a_x_V_a_l_u_e__ < _b_e_t_a(); │ │ │ │ +248 } │ │ │ │ +249 │ │ │ │ +253 template │ │ │ │ +_2_5_4 class _D_e_p_e_n_d_e_n_c_y : public _P_a_r_a_m_e_t_e_r_s │ │ │ │ +255 { │ │ │ │ +256 public: │ │ │ │ +_2_6_0 typedef M _M_a_t_r_i_x; │ │ │ │ +261 │ │ │ │ +_2_6_5 typedef N _N_o_r_m; │ │ │ │ +266 │ │ │ │ +_2_7_0 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ +271 │ │ │ │ +_2_7_5 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; │ │ │ │ +276 │ │ │ │ +_2_7_7 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ +278 │ │ │ │ +_2_7_9 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ +280 │ │ │ │ +_2_8_1 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ +282 │ │ │ │ +283 template │ │ │ │ +_2_8_4 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); │ │ │ │ +285 │ │ │ │ +_2_8_6 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ +287 │ │ │ │ +_2_8_8 _D_e_p_e_n_d_e_n_c_y(const _P_a_r_a_m_e_t_e_r_s& parms) │ │ │ │ +289 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ +290 {} │ │ │ │ +291 │ │ │ │ +_2_9_2 _D_e_p_e_n_d_e_n_c_y() │ │ │ │ +293 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ +294 {} │ │ │ │ +295 │ │ │ │ +296 protected: │ │ │ │ +_2_9_8 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ +_3_0_0 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_0_1 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +_3_0_2 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ +_3_0_4 _N_o_r_m _n_o_r_m__; │ │ │ │ +_3_0_6 int _r_o_w__; │ │ │ │ +_3_0_8 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ +309 }; │ │ │ │ +310 │ │ │ │ +314 template │ │ │ │ +_3_1_5 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 │ │ │ │ +316 { │ │ │ │ +317 public: │ │ │ │ +_3_2_1 typedef M _M_a_t_r_i_x; │ │ │ │ +322 │ │ │ │ +_3_2_6 typedef N _N_o_r_m; │ │ │ │ 327 │ │ │ │ -328 s=neighbors.size(); │ │ │ │ -329 MPI_Pack(&s, 1, MPITraits::getType(), sendBuf, buffersize, │ │ │ │ -&pos, comm); │ │ │ │ -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); │ │ │ │ +_3_3_1 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e _R_o_w; │ │ │ │ +332 │ │ │ │ +_3_3_6 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; │ │ │ │ +337 │ │ │ │ +_3_3_8 void _i_n_i_t(const _M_a_t_r_i_x* matrix); │ │ │ │ +339 │ │ │ │ +_3_4_0 void _i_n_i_t_R_o_w(const _R_o_w& row, int index); │ │ │ │ +341 │ │ │ │ +_3_4_2 void _e_x_a_m_i_n_e(const _C_o_l_I_t_e_r& _c_o_l); │ │ │ │ +343 │ │ │ │ +344 template │ │ │ │ +_3_4_5 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); │ │ │ │ +346 │ │ │ │ +_3_4_7 bool _i_s_I_s_o_l_a_t_e_d(); │ │ │ │ +348 │ │ │ │ +349 │ │ │ │ +_3_5_0 _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) │ │ │ │ +351 : _P_a_r_a_m_e_t_e_r_s(parms) │ │ │ │ +352 {} │ │ │ │ +_3_5_3 _S_y_m_m_e_t_r_i_c_D_e_p_e_n_d_e_n_c_y() │ │ │ │ +354 : _P_a_r_a_m_e_t_e_r_s() │ │ │ │ +355 {} │ │ │ │ +356 │ │ │ │ +357 protected: │ │ │ │ +_3_5_9 const _M_a_t_r_i_x* _m_a_t_r_i_x__; │ │ │ │ +_3_6_1 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_2 typedef typename FieldTraits::real_type _r_e_a_l___t_y_p_e; │ │ │ │ +_3_6_3 _r_e_a_l___t_y_p_e _m_a_x_V_a_l_u_e__; │ │ │ │ +_3_6_5 _N_o_r_m _n_o_r_m__; │ │ │ │ +_3_6_7 int _r_o_w__; │ │ │ │ +_3_6_9 _r_e_a_l___t_y_p_e _d_i_a_g_o_n_a_l__; │ │ │ │ +370 private: │ │ │ │ +371 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::true_type&); │ │ │ │ +372 void _i_n_i_t_R_o_w(const _R_o_w& row, int index, const std::false_type&); │ │ │ │ +373 }; │ │ │ │ +374 │ │ │ │ +379 template │ │ │ │ +_3_8_0 class _D_i_a_g_o_n_a_l │ │ │ │ +381 { │ │ │ │ +382 public: │ │ │ │ +383 enum { /* @brief We preserve the sign.*/ │ │ │ │ +_3_8_4 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = true │ │ │ │ +385 }; │ │ │ │ +386 │ │ │ │ +391 template │ │ │ │ +_3_9_2 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +m, │ │ │ │ +393 [[maybe_unused]] typename std::enable_if_t::value>* │ │ │ │ +sfinae = nullptr) const │ │ │ │ +394 { │ │ │ │ +395 typedef typename M::field_type field_type; │ │ │ │ +396 typedef typename FieldTraits::real_type real_type; │ │ │ │ +397 static_assert( std::is_convertible::value, │ │ │ │ +398 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ +399 return m[N][N]; │ │ │ │ +400 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ +401 } │ │ │ │ 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 } │ │ │ │ -446 } │ │ │ │ -447 │ │ │ │ +407 template │ │ │ │ +_4_0_8 auto _o_p_e_r_a_t_o_r_(_)(const M& m, │ │ │ │ +409 typename std::enable_if_t::value>* /*sfinae*/ = nullptr) │ │ │ │ +const │ │ │ │ +410 { │ │ │ │ +411 typedef typename FieldTraits::real_type real_type; │ │ │ │ +412 static_assert( std::is_convertible::value, │ │ │ │ +413 "use of diagonal norm in AMG not implemented for complex field_type"); │ │ │ │ +414 return m; │ │ │ │ +415 // possible implementation for complex types: return signed_abs(m[N][N]); │ │ │ │ +416 } │ │ │ │ +417 │ │ │ │ +418 private: │ │ │ │ +419 │ │ │ │ +421 template │ │ │ │ +422 static T signed_abs(const T & v) │ │ │ │ +423 { │ │ │ │ +424 return v; │ │ │ │ +425 } │ │ │ │ +426 │ │ │ │ +428 template │ │ │ │ +429 static T signed_abs(const std::complex & v) │ │ │ │ +430 { │ │ │ │ +431 // return sign * abs_value │ │ │ │ +432 // in case of complex numbers this extends to using the csgn function to │ │ │ │ +determine the sign │ │ │ │ +433 return csgn(v) * std::abs(v); │ │ │ │ +434 } │ │ │ │ +435 │ │ │ │ +437 template │ │ │ │ +438 static T csgn(const T & v) │ │ │ │ +439 { │ │ │ │ +440 return (T(0) < v) - (v < T(0)); │ │ │ │ +441 } │ │ │ │ +442 │ │ │ │ +444 template │ │ │ │ +445 static T csgn(std::complex a) │ │ │ │ +446 { │ │ │ │ +447 return csgn(a.real())+(a.real() == 0.0)*csgn(a.imag()); │ │ │ │ 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 } │ │ │ │ -476 } │ │ │ │ -477 │ │ │ │ -478 struct SortFirst │ │ │ │ -479 { │ │ │ │ -480 template │ │ │ │ -481 bool operator()(const T& t1, const T& t2) const │ │ │ │ -482 { │ │ │ │ -483 return t1 │ │ │ │ +457 {}; │ │ │ │ +458 │ │ │ │ +_4_6_4 struct _R_o_w_S_u_m │ │ │ │ +465 { │ │ │ │ +466 │ │ │ │ +467 enum { /* @brief We preserve the sign.*/ │ │ │ │ +_4_6_8 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ +469 }; │ │ │ │ +474 template │ │ │ │ +_4_7_5 auto _o_p_e_r_a_t_o_r_(_)(const M& m) const │ │ │ │ +476 { │ │ │ │ +477 using std::abs; │ │ │ │ +478 if constexpr(Dune::IsNumber::value) │ │ │ │ +479 return abs(m); │ │ │ │ +480 else │ │ │ │ +481 return m.infinity_norm(); │ │ │ │ +482 } │ │ │ │ +483 }; │ │ │ │ +484 │ │ │ │ +_4_8_5 struct _F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +486 { │ │ │ │ 487 │ │ │ │ -498 template │ │ │ │ -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++) │ │ │ │ -507 { │ │ │ │ -508 if(i->first==old->first) │ │ │ │ -509 { │ │ │ │ -510 std::cerr<<"Value at index "<first<<","<second<<"]==[" │ │ │ │ -512 <first<<","<second<<"]"< │ │ │ │ +_4_9_6 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +m) const │ │ │ │ +497 { │ │ │ │ +498 return m.frobenius_norm(); │ │ │ │ +499 } │ │ │ │ +500 }; │ │ │ │ +_5_0_1 struct _A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +502 { │ │ │ │ +503 │ │ │ │ +504 enum { /* @brief We preserve the sign.*/ │ │ │ │ +_5_0_5 _i_s___s_i_g_n___p_r_e_s_e_r_v_i_n_g = false │ │ │ │ +506 }; │ │ │ │ +511 template │ │ │ │ +_5_1_2 typename FieldTraits::real_type _o_p_e_r_a_t_o_r_(_)(const M& │ │ │ │ +/*m*/) const │ │ │ │ +513 { │ │ │ │ +514 return 1; │ │ │ │ 515 } │ │ │ │ -516 } │ │ │ │ +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 } │ │ │ │ +523 template │ │ │ │ +_5_2_4 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 > │ │ │ │ +525 { │ │ │ │ +526 public: │ │ │ │ +_5_2_7 _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) │ │ │ │ +528 : _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) │ │ │ │ +529 {} │ │ │ │ +_5_3_0 _S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ +531 {} │ │ │ │ +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 } │ │ │ │ +543 template │ │ │ │ +_5_4_4 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 │ │ │ │ +> │ │ │ │ +545 { │ │ │ │ +546 public: │ │ │ │ +_5_4_7 _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) │ │ │ │ +548 : _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) │ │ │ │ +549 {} │ │ │ │ +_5_5_0 _U_n_S_y_m_m_e_t_r_i_c_C_r_i_t_e_r_i_o_n() │ │ │ │ +551 {} │ │ │ │ +552 }; │ │ │ │ +553 // forward declaration │ │ │ │ +554 template class Aggregator; │ │ │ │ +555 │ │ │ │ +556 │ │ │ │ +564 template │ │ │ │ +_5_6_5 class _A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +566 { │ │ │ │ +567 public: │ │ │ │ +568 │ │ │ │ +_5_7_2 static const V _U_N_A_G_G_R_E_G_A_T_E_D; │ │ │ │ +573 │ │ │ │ +_5_7_7 static const V _I_S_O_L_A_T_E_D; │ │ │ │ +_5_8_1 typedef V _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +582 │ │ │ │ +_5_8_6 typedef V _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r; │ │ │ │ +587 │ │ │ │ +_5_9_2 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ +593 │ │ │ │ +_5_9_8 typedef SLList _V_e_r_t_e_x_L_i_s_t; │ │ │ │ +599 │ │ │ │ +_6_0_3 class _D_u_m_m_y_E_d_g_e_V_i_s_i_t_o_r │ │ │ │ +604 { │ │ │ │ +605 public: │ │ │ │ +606 template │ │ │ │ +_6_0_7 void _o_p_e_r_a_t_o_r_(_)([[maybe_unused]] const EdgeIterator& edge) const │ │ │ │ +608 {} │ │ │ │ +609 }; │ │ │ │ +610 │ │ │ │ +611 │ │ │ │ +_6_1_5 _A_g_g_r_e_g_a_t_e_s_M_a_p(); │ │ │ │ +616 │ │ │ │ +_6_2_2 _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); │ │ │ │ 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(); │ │ │ │ -745 } │ │ │ │ -746 } // end anonymous namespace │ │ │ │ +_6_2_7 _~_A_g_g_r_e_g_a_t_e_s_M_a_p(); │ │ │ │ +628 │ │ │ │ +640 template │ │ │ │ +_6_4_1 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, │ │ │ │ +642 bool finestLevel); │ │ │ │ +643 │ │ │ │ +661 template │ │ │ │ +_6_6_2 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, │ │ │ │ +663 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +664 const G& graph, │ │ │ │ +665 F& aggregateVisitor, │ │ │ │ +666 VM& visitedMap) const; │ │ │ │ +667 │ │ │ │ +691 template │ │ │ │ +_6_9_2 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, │ │ │ │ +693 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +694 const G& graph, L& visited, F1& aggregateVisitor, │ │ │ │ +695 F2& nonAggregateVisitor, │ │ │ │ +696 VM& visitedMap) const; │ │ │ │ +697 │ │ │ │ +_7_0_3 void _a_l_l_o_c_a_t_e(std::size_t _n_o_V_e_r_t_i_c_e_s); │ │ │ │ +704 │ │ │ │ +_7_0_8 std::size_t _n_o_V_e_r_t_i_c_e_s() const; │ │ │ │ +709 │ │ │ │ +_7_1_3 void _f_r_e_e(); │ │ │ │ +714 │ │ │ │ +_7_2_0 _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); │ │ │ │ +721 │ │ │ │ +_7_2_7 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; │ │ │ │ +728 │ │ │ │ +_7_2_9 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; │ │ │ │ +730 │ │ │ │ +_7_3_1 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const │ │ │ │ +732 { │ │ │ │ +733 return aggregates_; │ │ │ │ +734 } │ │ │ │ +735 │ │ │ │ +_7_3_6 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const │ │ │ │ +737 { │ │ │ │ +738 return aggregates_+_n_o_V_e_r_t_i_c_e_s(); │ │ │ │ +739 } │ │ │ │ +740 │ │ │ │ +_7_4_1 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; │ │ │ │ +742 │ │ │ │ +_7_4_3 _i_t_e_r_a_t_o_r _b_e_g_i_n() │ │ │ │ +744 { │ │ │ │ +745 return aggregates_; │ │ │ │ +746 } │ │ │ │ 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); │ │ │ │ +_7_4_8 _i_t_e_r_a_t_o_r _e_n_d() │ │ │ │ +749 { │ │ │ │ +750 return aggregates_+_n_o_V_e_r_t_i_c_e_s(); │ │ │ │ +751 } │ │ │ │ +752 private: │ │ │ │ +754 _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; │ │ │ │ +756 _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; │ │ │ │ +757 │ │ │ │ +761 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r* aggregates_; │ │ │ │ 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& mat, _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 │ │ │ │ -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 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 // } │ │ │ │ +766 std::size_t noVertices_; │ │ │ │ +767 }; │ │ │ │ +768 │ │ │ │ +772 template │ │ │ │ +_7_7_3 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ +774 const typename C::Matrix& matrix, │ │ │ │ +775 C criterion, │ │ │ │ +776 bool finestLevel); │ │ │ │ +777 │ │ │ │ +782 template │ │ │ │ +_7_8_3 class _A_g_g_r_e_g_a_t_e │ │ │ │ +784 { │ │ │ │ +785 │ │ │ │ +786 public: │ │ │ │ +787 │ │ │ │ +788 /*** │ │ │ │ +789 * @brief The type of the matrix graph we work with. │ │ │ │ +790 */ │ │ │ │ +_7_9_1 typedef G _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +_7_9_5 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; │ │ │ │ +796 │ │ │ │ +_8_0_1 typedef PoolAllocator _A_l_l_o_c_a_t_o_r; │ │ │ │ +802 │ │ │ │ +_8_0_7 typedef S _V_e_r_t_e_x_S_e_t; │ │ │ │ +808 │ │ │ │ +_8_1_2 using _s_i_z_e___t_y_p_e = typename VertexSet::size_type; │ │ │ │ +813 │ │ │ │ +_8_1_5 typedef typename VertexSet::const_iterator _c_o_n_s_t___i_t_e_r_a_t_o_r; │ │ │ │ +816 │ │ │ │ +_8_2_0 typedef std::size_t* _S_p_h_e_r_e_M_a_p; │ │ │ │ +821 │ │ │ │ +_8_3_0 _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, │ │ │ │ +831 _V_e_r_t_e_x_S_e_t& connectivity, std::vector& front_); │ │ │ │ +832 │ │ │ │ +_8_3_3 void _i_n_v_a_l_i_d_a_t_e() │ │ │ │ +834 { │ │ │ │ +835 --id_; │ │ │ │ +836 } │ │ │ │ +837 │ │ │ │ +_8_4_4 void _r_e_c_o_n_s_t_r_u_c_t(const _V_e_r_t_e_x& vertex); │ │ │ │ +845 │ │ │ │ +_8_4_9 void _s_e_e_d(const _V_e_r_t_e_x& vertex); │ │ │ │ +850 │ │ │ │ +_8_5_4 void _a_d_d(const _V_e_r_t_e_x& vertex); │ │ │ │ +855 │ │ │ │ +_8_5_6 void _a_d_d(std::vector& vertex); │ │ │ │ +_8_6_0 void _c_l_e_a_r(); │ │ │ │ +861 │ │ │ │ +_8_6_5 _s_i_z_e___t_y_p_e _s_i_z_e(); │ │ │ │ +_8_6_9 _s_i_z_e___t_y_p_e _c_o_n_n_e_c_t_S_i_z_e(); │ │ │ │ +870 │ │ │ │ +_8_7_4 int _i_d(); │ │ │ │ +875 │ │ │ │ +_8_7_7 _c_o_n_s_t___i_t_e_r_a_t_o_r _b_e_g_i_n() const; │ │ │ │ +878 │ │ │ │ +_8_8_0 _c_o_n_s_t___i_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +881 │ │ │ │ +882 private: │ │ │ │ +886 _V_e_r_t_e_x_S_e_t vertices_; │ │ │ │ +887 │ │ │ │ +892 int id_; │ │ │ │ 893 │ │ │ │ -894 // std::map edgecount; // edges to other processors │ │ │ │ -895 // typedef typename M::ConstRowIterator RIter; │ │ │ │ -896 // typedef typename M::ConstColIterator CIter; │ │ │ │ -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()]]; │ │ │ │ +897 _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +898 │ │ │ │ +902 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ 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]= mat.N(); // weight is number of rows TODO: Should actually be the │ │ │ │ -nonzeros. │ │ │ │ -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)); │ │ │ │ -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& front_; │ │ │ │ +913 }; │ │ │ │ +914 │ │ │ │ +918 template │ │ │ │ +_9_1_9 class _A_g_g_r_e_g_a_t_o_r │ │ │ │ +920 { │ │ │ │ +921 public: │ │ │ │ +922 │ │ │ │ +_9_2_6 typedef G _M_a_t_r_i_x_G_r_a_p_h; │ │ │ │ +927 │ │ │ │ +_9_3_1 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; │ │ │ │ +932 │ │ │ │ +_9_3_4 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; │ │ │ │ +935 │ │ │ │ +_9_3_9 _A_g_g_r_e_g_a_t_o_r(); │ │ │ │ 940 │ │ │ │ -941 Dune::dinfo< │ │ │ │ +_9_6_3 std::tuple _b_u_i_l_d(const M& m, G& graph, │ │ │ │ +964 _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, const C& c, │ │ │ │ +965 bool finestLevel); │ │ │ │ +966 private: │ │ │ │ +971 typedef PoolAllocator Allocator; │ │ │ │ +972 │ │ │ │ +976 typedef SLList VertexList; │ │ │ │ +977 │ │ │ │ +981 typedef std::set,Allocator> VertexSet; │ │ │ │ +982 │ │ │ │ +986 typedef std::size_t* SphereMap; │ │ │ │ 987 │ │ │ │ -988 _M_e_t_i_s_:_:_i_d_x___t noVertices = vtxdist[oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()]; │ │ │ │ -989 _M_e_t_i_s_:_:_i_d_x___t *gxadj = 0; │ │ │ │ -990 _M_e_t_i_s_:_:_i_d_x___t *gvwgt = 0; │ │ │ │ -991 _M_e_t_i_s_:_:_i_d_x___t *gadjncy = 0; │ │ │ │ -992 _M_e_t_i_s_:_:_i_d_x___t *gadjwgt = 0; │ │ │ │ -993 _M_e_t_i_s_:_:_i_d_x___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._c_o_m_m_u_n_i_c_a_t_o_r().size()]-vtxdist │ │ │ │ -[0]+oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size(); │ │ │ │ -1003 │ │ │ │ -1004 { │ │ │ │ -1005 Dune::dinfo<<"noedges: "; │ │ │ │ -1006 _p_r_i_n_t___c_a_r_r_a_y(Dune::dinfo, noedges, oocomm._c_o_m_m_u_n_i_c_a_t_o_r().size()); │ │ │ │ -1007 Dune::dinfo<::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 "<* aggregate_; │ │ │ │ +997 │ │ │ │ +1001 std::vector front_; │ │ │ │ +1002 │ │ │ │ +1006 VertexSet connected_; │ │ │ │ +1007 │ │ │ │ +1011 int size_; │ │ │ │ +1012 │ │ │ │ +1016 class Stack │ │ │ │ +1017 { │ │ │ │ +1018 public: │ │ │ │ +_1_0_1_9 static const _V_e_r_t_e_x _N_u_l_l_E_n_t_r_y; │ │ │ │ +1020 │ │ │ │ +_1_0_2_1 _S_t_a_c_k(const _M_a_t_r_i_x_G_r_a_p_h& graph, │ │ │ │ +1022 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); │ │ │ │ +_1_0_2_4 _~_S_t_a_c_k(); │ │ │ │ +_1_0_2_5 _V_e_r_t_e_x _p_o_p(); │ │ │ │ +1026 private: │ │ │ │ +1027 enum { N = 1300000 }; │ │ │ │ +1028 │ │ │ │ +1030 const _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +1032 const _A_g_g_r_e_g_a_t_o_r_<_G_>& aggregatesBuilder_; │ │ │ │ +1034 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +1036 int size_; │ │ │ │ +1037 _V_e_r_t_e_x maxSize_; │ │ │ │ +1039 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_; │ │ │ │ +1040 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_; │ │ │ │ +1041 │ │ │ │ +1043 _V_e_r_t_e_x* vals_; │ │ │ │ +1044 │ │ │ │ +1045 }; │ │ │ │ +1046 │ │ │ │ +_1_0_4_7 friend class Stack; │ │ │ │ +1048 │ │ │ │ +1059 template │ │ │ │ +1060 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, │ │ │ │ +1061 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +1062 V& visitor) const; │ │ │ │ +1063 │ │ │ │ +1068 template │ │ │ │ +1069 class AggregateVisitor │ │ │ │ +1070 { │ │ │ │ +1071 public: │ │ │ │ +_1_0_7_5 typedef V _V_i_s_i_t_o_r; │ │ │ │ +_1_0_8_3 _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, │ │ │ │ +1084 _V_i_s_i_t_o_r& visitor); │ │ │ │ +1085 │ │ │ │ +_1_0_9_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); │ │ │ │ +1093 │ │ │ │ +1094 private: │ │ │ │ +1096 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +1098 _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r aggregate_; │ │ │ │ +1100 _V_i_s_i_t_o_r* visitor_; │ │ │ │ +1101 }; │ │ │ │ +1102 │ │ │ │ +1106 class Counter │ │ │ │ +1107 { │ │ │ │ +1108 public: │ │ │ │ +_1_1_1_0 _C_o_u_n_t_e_r(); │ │ │ │ +_1_1_1_2 int _v_a_l_u_e(); │ │ │ │ +1113 │ │ │ │ +1114 protected: │ │ │ │ +_1_1_1_6 void _i_n_c_r_e_m_e_n_t(); │ │ │ │ +_1_1_1_8 void _d_e_c_r_e_m_e_n_t(); │ │ │ │ +1119 │ │ │ │ +1120 private: │ │ │ │ +1121 int count_; │ │ │ │ +1122 }; │ │ │ │ +1123 │ │ │ │ +1124 │ │ │ │ +1129 class FrontNeighbourCounter : public Counter │ │ │ │ +1130 { │ │ │ │ +1131 public: │ │ │ │ +_1_1_3_6 _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); │ │ │ │ +1137 │ │ │ │ +_1_1_3_8 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); │ │ │ │ 1139 │ │ │ │ -1140 Dune::dinfo<::getType(), part, 1, │ │ │ │ -1152 MPITraits::getType(), 0, comm); │ │ │ │ -1153 │ │ │ │ +1140 private: │ │ │ │ +1141 const _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +1142 }; │ │ │ │ +1143 │ │ │ │ +1148 int noFrontNeighbours(const _V_e_r_t_e_x& vertex) const; │ │ │ │ +1149 │ │ │ │ +1153 class TwoWayCounter : public Counter │ │ │ │ 1154 { │ │ │ │ -1155 // release remaining memory │ │ │ │ -1156 delete[] gpart; │ │ │ │ -1157 delete[] noedges; │ │ │ │ -1158 delete[] displ; │ │ │ │ -1159 } │ │ │ │ -1160 │ │ │ │ -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(mat.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(mat)); │ │ │ │ -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 "<& aggregates) const; │ │ │ │ +1172 │ │ │ │ +1176 class OneWayCounter : public Counter │ │ │ │ +1177 { │ │ │ │ +1178 public: │ │ │ │ +_1_1_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); │ │ │ │ +1180 }; │ │ │ │ +1181 │ │ │ │ +1193 int oneWayConnections(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, │ │ │ │ +1194 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ +1195 │ │ │ │ +1202 class ConnectivityCounter : public Counter │ │ │ │ +1203 { │ │ │ │ +1204 public: │ │ │ │ +_1_2_1_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); │ │ │ │ +1211 │ │ │ │ +_1_2_1_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); │ │ │ │ +1213 │ │ │ │ +1214 private: │ │ │ │ +1216 const VertexSet& connected_; │ │ │ │ +1218 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates_; │ │ │ │ +1219 │ │ │ │ +1220 }; │ │ │ │ +1221 │ │ │ │ +1233 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; │ │ │ │ +1241 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, │ │ │ │ +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 bool connected(const _V_e_r_t_e_x& vertex, const SLList& │ │ │ │ +aggregateList, │ │ │ │ +1252 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ 1253 │ │ │ │ -1254 assert(nparts<=static_cast<_M_e_t_i_s_:_:_i_d_x___t>(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 <& front, _M_a_t_r_i_x_G_r_a_p_h& graph); │ │ │ │ +1288 │ │ │ │ +_1_2_8_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); │ │ │ │ 1290 │ │ │ │ -1291#else │ │ │ │ -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)); │ │ │ │ -1351 │ │ │ │ +1291 private: │ │ │ │ +1293 std::vector& front_; │ │ │ │ +1295 _M_a_t_r_i_x_G_r_a_p_h& graph_; │ │ │ │ +1296 }; │ │ │ │ +1297 │ │ │ │ +1301 void unmarkFront(); │ │ │ │ +1302 │ │ │ │ +1317 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; │ │ │ │ +1318 │ │ │ │ +1332 std::pair neighbours(const _V_e_r_t_e_x& vertex, │ │ │ │ +1333 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1334 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates) const; │ │ │ │ +1351 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; │ │ │ │ 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) const; │ │ │ │ +1361 │ │ │ │ +1369 std::size_t distance(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); │ │ │ │ +1370 │ │ │ │ +1379 _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; │ │ │ │ 1380 │ │ │ │ -1381 │ │ │ │ -1382 if(verbose) { │ │ │ │ -1383 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1384 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1385 std::cout<<"Parmetis took "< domainMapping(nparts); │ │ │ │ -1403 if(nparts>1) │ │ │ │ -1404 getDomain(comm, part, indexMap.numOfOwnVtx(), nparts, &myDomain, │ │ │ │ -domainMapping); │ │ │ │ -1405 else │ │ │ │ -1406 domainMapping[0]=0; │ │ │ │ +1389 void nonisoNeighbourAggregate(const _V_e_r_t_e_x& vertex, │ │ │ │ +1390 const _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_e_r_t_e_x_>& aggregates, │ │ │ │ +1391 SLList& neighbours) const; │ │ │ │ +1392 │ │ │ │ +1400 template │ │ │ │ +1401 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); │ │ │ │ +1402 template │ │ │ │ +1403 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); │ │ │ │ +1404 }; │ │ │ │ +1405 │ │ │ │ +1406#ifndef DOXYGEN │ │ │ │ 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 (_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y(oocomm) == │ │ │ │ -1434 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)) │ │ │ │ -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 "< │ │ │ │ -_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()); │ │ │ │ -1516 │ │ │ │ -1517 // calculate total receive message size │ │ │ │ -1518 int totalNoRecv = 0; │ │ │ │ -1519 for(int i=0; i │ │ │ │ +1409 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) │ │ │ │ +1410 { │ │ │ │ +1411 matrix_ = matrix; │ │ │ │ +1412 } │ │ │ │ +1413 │ │ │ │ +1414 template │ │ │ │ +1415 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) │ │ │ │ +1416 { │ │ │ │ +1417 initRow(row, index, std::is_convertible()); │ │ │ │ +1418 } │ │ │ │ +1419 │ │ │ │ +1420 template │ │ │ │ +1421 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&) │ │ │ │ +1422 { │ │ │ │ +1423 DUNE_THROW(InvalidStateException, "field_type needs to convertible to │ │ │ │ +real_type"); │ │ │ │ +1424 } │ │ │ │ +1425 │ │ │ │ +1426 template │ │ │ │ +1427 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::true_type&) │ │ │ │ +1428 { │ │ │ │ +1429 using std::min; │ │ │ │ +1430 maxValue_ = min(- std::numeric_limits::max(), │ │ │ │ +std::numeric_limits::min()); │ │ │ │ +1431 row_ = index; │ │ │ │ +1432 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ +1433 } │ │ │ │ +1434 │ │ │ │ +1435 template │ │ │ │ +1436 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) │ │ │ │ +1437 { │ │ │ │ +1438 using std::max; │ │ │ │ +1439 real_type eij = norm_(*_c_o_l); │ │ │ │ +1440 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 = │ │ │ │ +1441 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ +1442 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ +1443 { │ │ │ │ +1444 // Consider this a weak connection we disregard. │ │ │ │ +1445 return; │ │ │ │ +1446 } │ │ │ │ +1447 real_type eji = norm_(*opposite_entry); │ │ │ │ +1448 │ │ │ │ +1449 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ +1450 if(!N::is_sign_preserving || eij<0 || eji<0) │ │ │ │ +1451 maxValue_ = max(maxValue_, │ │ │ │ +1452 eij /diagonal_ * eji/ │ │ │ │ +1453 norm_(matrix_->operator[](_c_o_l.index())[_c_o_l.index()])); │ │ │ │ +1454 } │ │ │ │ +1455 │ │ │ │ +1456 template │ │ │ │ +1457 template │ │ │ │ +1458 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) │ │ │ │ +1459 { │ │ │ │ +1460 real_type eij = norm_(*_c_o_l); │ │ │ │ +1461 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 = │ │ │ │ +1462 matrix_->operator[](_c_o_l.index()).find(row_); │ │ │ │ +1463 │ │ │ │ +1464 if ( opposite_entry == matrix_->operator[](_c_o_l.index()).end() ) │ │ │ │ +1465 { │ │ │ │ +1466 // Consider this as a weak connection we disregard. │ │ │ │ +1467 return; │ │ │ │ +1468 } │ │ │ │ +1469 real_type eji = norm_(*opposite_entry); │ │ │ │ +1470 // skip positive offdiagonals if norm preserves sign of them. │ │ │ │ +1471 if(!N::is_sign_preserving || (eij<0 || eji<0)) │ │ │ │ +1472 if(eji / norm_(matrix_->operator[](edge.target())[edge.target()]) * │ │ │ │ +1473 eij/ diagonal_ > alpha() * maxValue_) { │ │ │ │ +1474 edge.properties().setDepends(); │ │ │ │ +1475 edge.properties().setInfluences(); │ │ │ │ +1476 typename G::EdgeProperties& other = graph.getEdgeProperties(edge.target(), │ │ │ │ +edge.source()); │ │ │ │ +1477 other.setInfluences(); │ │ │ │ +1478 other.setDepends(); │ │ │ │ +1479 } │ │ │ │ +1480 } │ │ │ │ +1481 │ │ │ │ +1482 template │ │ │ │ +1483 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() │ │ │ │ +1484 { │ │ │ │ +1485 return maxValue_ < beta(); │ │ │ │ +1486 } │ │ │ │ +1487 │ │ │ │ +1488 │ │ │ │ +1489 template │ │ │ │ +1490 inline void _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_n_i_t(const Matrix* matrix) │ │ │ │ +1491 { │ │ │ │ +1492 matrix_ = matrix; │ │ │ │ +1493 } │ │ │ │ +1494 │ │ │ │ +1495 template │ │ │ │ +1496 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) │ │ │ │ +1497 { │ │ │ │ +1498 using std::min; │ │ │ │ +1499 maxValue_ = min(- std::numeric_limits::max(), std:: │ │ │ │ +numeric_limits::min()); │ │ │ │ +1500 row_ = index; │ │ │ │ +1501 diagonal_ = norm_(matrix_->operator[](row_)[row_]); │ │ │ │ +1502 } │ │ │ │ +1503 │ │ │ │ +1504 template │ │ │ │ +1505 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) │ │ │ │ +1506 { │ │ │ │ +1507 using std::max; │ │ │ │ +1508 maxValue_ = max(maxValue_, -norm_(*_c_o_l)); │ │ │ │ +1509 } │ │ │ │ +1510 │ │ │ │ +1511 template │ │ │ │ +1512 template │ │ │ │ +1513 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) │ │ │ │ +1514 { │ │ │ │ +1515 if(-norm_(*_c_o_l) >= maxValue_ * alpha()) { │ │ │ │ +1516 edge.properties().setDepends(); │ │ │ │ +1517 typedef typename G::EdgeDescriptor ED; │ │ │ │ +1518 ED e= graph.findEdge(edge.target(), edge.source()); │ │ │ │ +1519 if(e!=std::numeric_limits::max()) │ │ │ │ +1520 { │ │ │ │ +1521 typename G::EdgeProperties& other = graph.getEdgeProperties(e); │ │ │ │ +1522 other.setInfluences(); │ │ │ │ +1523 } │ │ │ │ +1524 } │ │ │ │ +1525 } │ │ │ │ +1526 │ │ │ │ +1527 template │ │ │ │ +1528 inline bool _D_e_p_e_n_d_e_n_c_y_<_M_,_N_>_:_:_i_s_I_s_o_l_a_t_e_d() │ │ │ │ +1529 { │ │ │ │ +1530 return maxValue_ < beta() * diagonal_; │ │ │ │ +1531 } │ │ │ │ 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; │ │ │ │ -1545 │ │ │ │ -1546 │ │ │ │ -1547#ifdef DEBUG_REPART │ │ │ │ -1548 if(recvFrom.size()) { │ │ │ │ -1549 std::cout< │ │ │ │ +1534 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_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, │ │ │ │ +1535 VertexSet& connected, std::vector& front) │ │ │ │ +1536 : vertices_(), id_(-1), graph_(graph), aggregates_(aggregates), │ │ │ │ +1537 connected_(connected), front_(front) │ │ │ │ +1538 {} │ │ │ │ +1539 │ │ │ │ +1540 template │ │ │ │ +1541 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*/) │ │ │ │ +1542 { │ │ │ │ +1543 /* │ │ │ │ +1544 vertices_.push_back(vertex); │ │ │ │ +1545 typedef typename VertexList::const_iterator iterator; │ │ │ │ +1546 iterator begin = vertices_.begin(); │ │ │ │ +1547 iterator end = vertices_.end();*/ │ │ │ │ +1548 throw "Not yet implemented"; │ │ │ │ +1549 │ │ │ │ +1550 // while(begin!=end){ │ │ │ │ +1551 //for(); │ │ │ │ +1552 // } │ │ │ │ +1553 │ │ │ │ +1554 } │ │ │ │ +1555 │ │ │ │ +1556 template │ │ │ │ +1557 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) │ │ │ │ +1558 { │ │ │ │ +1559 dvverb<<"Connected cleared"<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); │ │ │ │ -1649 │ │ │ │ -1650 if(oldbuffersize │ │ │ │ +1570 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_a_d_d(const _V_e_r_t_e_x& vertex) │ │ │ │ +1571 { │ │ │ │ +1572 vertices_.insert(vertex); │ │ │ │ +1573 aggregates_[vertex]=id_; │ │ │ │ +1574 if(front_.size()) │ │ │ │ +1575 front_.erase(std::lower_bound(front_.begin(), front_.end(), vertex)); │ │ │ │ +1576 │ │ │ │ +1577 │ │ │ │ +1578 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; │ │ │ │ +1579 const iterator end = graph_.endEdges(vertex); │ │ │ │ +1580 for(iterator edge = graph_.beginEdges(vertex); edge != end; ++edge) { │ │ │ │ +1581 dvverb << " Inserting "<_:_:_U_N_A_G_G_R_E_G_A_T_E_D && │ │ │ │ +1626 !graph_.getVertexProperties(edge.target()).front()) │ │ │ │ +1627 { │ │ │ │ +1628 front_.push_back(edge.target()); │ │ │ │ +1629 graph_.getVertexProperties(edge.target()).setFront(); │ │ │ │ +1630 } │ │ │ │ +1631 dvverb <<" size="< │ │ │ │ +1639 inline void _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_l_e_a_r() │ │ │ │ +1640 { │ │ │ │ +1641 vertices_.clear(); │ │ │ │ +1642 connected_.clear(); │ │ │ │ +1643 id_=-1; │ │ │ │ +1644 } │ │ │ │ +1645 │ │ │ │ +1646 template │ │ │ │ +1647 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_i_z_e___t_y_p_e │ │ │ │ +1648 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_i_z_e() │ │ │ │ +1649 { │ │ │ │ +1650 return vertices_.size(); │ │ │ │ +1651 } │ │ │ │ +1652 │ │ │ │ +1653 template │ │ │ │ +1654 inline typename _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_s_i_z_e___t_y_p_e │ │ │ │ +1655 _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_c_o_n_n_e_c_t_S_i_z_e() │ │ │ │ +1656 { │ │ │ │ +1657 return connected_.size(); │ │ │ │ +1658 } │ │ │ │ +1659 │ │ │ │ +1660 template │ │ │ │ +1661 inline int _A_g_g_r_e_g_a_t_e_<_G_,_S_>_:_:_i_d() │ │ │ │ +1662 { │ │ │ │ +1663 return id_; │ │ │ │ +1664 } │ │ │ │ +1665 │ │ │ │ +1666 template │ │ │ │ +1667 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 │ │ │ │ +1668 { │ │ │ │ +1669 return vertices_.begin(); │ │ │ │ +1670 } │ │ │ │ +1671 │ │ │ │ +1672 template │ │ │ │ +1673 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 │ │ │ │ +1674 { │ │ │ │ +1675 return vertices_.end(); │ │ │ │ +1676 } │ │ │ │ +1677 │ │ │ │ +1678 template │ │ │ │ +1679 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(); │ │ │ │ +1680 │ │ │ │ +1681 template │ │ │ │ +1682 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; │ │ │ │ +1683 │ │ │ │ +1684 template │ │ │ │ +1685 _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() │ │ │ │ +1686 : aggregates_(0) │ │ │ │ +1687 {} │ │ │ │ +1688 │ │ │ │ +1689 template │ │ │ │ +1690 _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() │ │ │ │ +1691 { │ │ │ │ +1692 if(aggregates_!=0) │ │ │ │ +1693 delete[] aggregates_; │ │ │ │ +1694 } │ │ │ │ +1695 │ │ │ │ 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()); │ │ │ │ +1697 template │ │ │ │ +1698 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) │ │ │ │ +1699 { │ │ │ │ +1700 allocate(noVertices); │ │ │ │ +1701 } │ │ │ │ 1702 │ │ │ │ -1703 // │ │ │ │ -1704 // 4.2) Create the IndexSet etc. │ │ │ │ -1705 // │ │ │ │ -1706 │ │ │ │ -1707 // build the new outputIndexSet │ │ │ │ +1703 template │ │ │ │ +1704 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 │ │ │ │ +1705 { │ │ │ │ +1706 return noVertices_; │ │ │ │ +1707 } │ │ │ │ 1708 │ │ │ │ -1709 │ │ │ │ -1710 int color=0; │ │ │ │ -1711 │ │ │ │ -1712 if (!existentOnNextLevel) { │ │ │ │ -1713 // this process is not used anymore │ │ │ │ -1714 color= MPI_UNDEFINED; │ │ │ │ -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,_S_o_l_v_e_r_C_a_t_e_g_o_r_y_:_:_c_a_t_e_g_o_r_y │ │ │ │ -(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()); │ │ │ │ +1709 template │ │ │ │ +1710 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) │ │ │ │ +1711 { │ │ │ │ +1712 aggregates_ = new _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r[noVertices]; │ │ │ │ +1713 noVertices_ = noVertices; │ │ │ │ +1714 │ │ │ │ +1715 for(std::size_t i=0; i < noVertices; i++) │ │ │ │ +1716 aggregates_[i]=UNAGGREGATED; │ │ │ │ +1717 } │ │ │ │ +1718 │ │ │ │ +1719 template │ │ │ │ +1720 inline void _A_g_g_r_e_g_a_t_e_s_M_a_p_<_V_>_:_:_f_r_e_e() │ │ │ │ +1721 { │ │ │ │ +1722 assert(aggregates_ != 0); │ │ │ │ +1723 delete[] aggregates_; │ │ │ │ +1724 aggregates_=0; │ │ │ │ +1725 } │ │ │ │ 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<<"->"< │ │ │ │ +1728 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& │ │ │ │ +1729 _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) │ │ │ │ +1730 { │ │ │ │ +1731 return aggregates_[v]; │ │ │ │ +1732 } │ │ │ │ +1733 │ │ │ │ +1734 template │ │ │ │ +1735 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& │ │ │ │ +1736 _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 │ │ │ │ +1737 { │ │ │ │ +1738 return aggregates_[v]; │ │ │ │ 1739 } │ │ │ │ -1740 std::cout< │ │ │ │ +1742 template │ │ │ │ +1743 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, │ │ │ │ +1744 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1745 const G& graph, F& aggregateVisitor, │ │ │ │ +1746 VM& visitedMap) const │ │ │ │ +1747 { │ │ │ │ +1748 VertexList vlist; │ │ │ │ 1749 │ │ │ │ -1750 if(verbose) { │ │ │ │ -1751 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1752 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1753 std::cout<<" Calculating new neighbours ("<first,LocalIndexT(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)); │ │ │ │ -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()<(start, aggregate, graph, vlist, │ │ │ │ +aggregateVisitor, dummy, visitedMap); │ │ │ │ +1752 } │ │ │ │ +1753 │ │ │ │ +1754 template │ │ │ │ +1755 template │ │ │ │ +1756 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, │ │ │ │ +1757 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1758 const G& graph, │ │ │ │ +1759 L& visited, │ │ │ │ +1760 F1& aggregateVisitor, │ │ │ │ +1761 F2& nonAggregateVisitor, │ │ │ │ +1762 VM& visitedMap) const │ │ │ │ +1763 { │ │ │ │ +1764 typedef typename L::const_iterator ListIterator; │ │ │ │ +1765 int visitedSpheres = 0; │ │ │ │ +1766 │ │ │ │ +1767 visited.push_back(start); │ │ │ │ +1768 put(visitedMap, start, true); │ │ │ │ +1769 │ │ │ │ +1770 ListIterator current = visited.begin(); │ │ │ │ +1771 ListIterator end = visited.end(); │ │ │ │ +1772 std::size_t i=0, size=visited.size(); │ │ │ │ +1773 │ │ │ │ +1774 // visit the neighbours of all vertices of the │ │ │ │ +1775 // current sphere. │ │ │ │ +1776 while(current != end) { │ │ │ │ +1777 │ │ │ │ +1778 for(; i │ │ │ │ +1813 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_A_g_g_r_e_g_a_t_o_r() │ │ │ │ +1814 : graph_(0), aggregate_(0), front_(), connected_(), size_(-1) │ │ │ │ +1815 {} │ │ │ │ +1816 │ │ │ │ +1817 template │ │ │ │ +1818 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_~_A_g_g_r_e_g_a_t_o_r() │ │ │ │ +1819 { │ │ │ │ +1820 size_=-1; │ │ │ │ +1821 } │ │ │ │ +1822 │ │ │ │ +1823 template │ │ │ │ +1824 void _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(G& graph, │ │ │ │ +1825 const typename C::Matrix& matrix, │ │ │ │ +1826 C criterion, bool firstlevel) │ │ │ │ +1827 { │ │ │ │ +1828 // assert(graph.isBuilt()); │ │ │ │ +1829 typedef typename C::Matrix Matrix; │ │ │ │ +1830 typedef typename G::VertexIterator VertexIterator; │ │ │ │ +1831 │ │ │ │ +1832 criterion.init(&matrix); │ │ │ │ +1833 │ │ │ │ +1834 for(VertexIterator vertex = graph.begin(); vertex != graph.end(); │ │ │ │ +++vertex) { │ │ │ │ +1835 typedef typename _M_a_t_r_i_x_:_:_r_o_w___t_y_p_e Row; │ │ │ │ +1836 │ │ │ │ +1837 const Row& row = matrix[*vertex]; │ │ │ │ +1838 │ │ │ │ +1839 // Tell the criterion what row we will examine now │ │ │ │ +1840 // This might for example be used for calculating the │ │ │ │ +1841 // maximum offdiagonal value │ │ │ │ +1842 criterion.initRow(row, *vertex); │ │ │ │ +1843 │ │ │ │ +1844 // On a first path all columns are examined. After this │ │ │ │ +1845 // the calculator should know whether the vertex is isolated. │ │ │ │ +1846 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; │ │ │ │ +1847 ColIterator end = row.end(); │ │ │ │ +1848 typename FieldTraits::real_type │ │ │ │ +absoffdiag=0.; │ │ │ │ +1849 │ │ │ │ +1850 using std::max; │ │ │ │ +1851 if(firstlevel) { │ │ │ │ +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 absoffdiag = max(absoffdiag, Impl::asMatrix(*col).frobenius_norm()); │ │ │ │ +1856 } │ │ │ │ +1857 │ │ │ │ +1858 if(absoffdiag==0) │ │ │ │ +1859 vertex.properties().setExcludedBorder(); │ │ │ │ +1860 } │ │ │ │ +1861 else │ │ │ │ +1862 for(ColIterator _c_o_l = row.begin(); _c_o_l != end; ++_c_o_l) │ │ │ │ +1863 if(_c_o_l.index()!=*vertex) │ │ │ │ +1864 criterion.examine(_c_o_l); │ │ │ │ +1865 │ │ │ │ +1866 // reset the vertex properties │ │ │ │ +1867 //vertex.properties().reset(); │ │ │ │ +1868 │ │ │ │ +1869 // Check whether the vertex is isolated. │ │ │ │ +1870 if(criterion.isIsolated()) { │ │ │ │ +1871 //std::cout<<"ISOLATED: "<<*vertex< │ │ │ │ +1891 template │ │ │ │ +1892 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, │ │ │ │ +1893 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, V& visitor) │ │ │ │ +1894 : aggregates_(aggregates), aggregate_(aggregate), visitor_(&visitor) │ │ │ │ +1895 {} │ │ │ │ +1896 │ │ │ │ +1897 template │ │ │ │ +1898 template │ │ │ │ +1899 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) │ │ │ │ +1900 { │ │ │ │ +1901 if(aggregates_[edge.target()]==aggregate_) │ │ │ │ +1902 visitor_->operator()(edge); │ │ │ │ +1903 } │ │ │ │ +1904 │ │ │ │ +1905 template │ │ │ │ +1906 template │ │ │ │ +1907 inline void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_v_i_s_i_t_A_g_g_r_e_g_a_t_e_N_e_i_g_h_b_o_u_r_s(const _V_e_r_t_e_x& vertex, │ │ │ │ +1908 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +1909 const AggregatesMap& aggregates, │ │ │ │ +1910 V& visitor) const │ │ │ │ +1911 { │ │ │ │ +1912 // Only evaluates for edge pointing to the aggregate │ │ │ │ +1913 AggregateVisitor v(aggregates, aggregate, visitor); │ │ │ │ +1914 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, v); │ │ │ │ +1915 } │ │ │ │ +1916 │ │ │ │ +1917 │ │ │ │ +1918 template │ │ │ │ +1919 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() │ │ │ │ +1920 : count_(0) │ │ │ │ +1921 {} │ │ │ │ +1922 │ │ │ │ +1923 template │ │ │ │ +1924 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() │ │ │ │ +1925 { │ │ │ │ +1926 ++count_; │ │ │ │ +1927 } │ │ │ │ +1928 │ │ │ │ +1929 template │ │ │ │ +1930 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() │ │ │ │ +1931 { │ │ │ │ +1932 --count_; │ │ │ │ +1933 } │ │ │ │ +1934 template │ │ │ │ +1935 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() │ │ │ │ +1936 { │ │ │ │ +1937 return count_; │ │ │ │ +1938 } │ │ │ │ +1939 │ │ │ │ +1940 template │ │ │ │ +1941 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) │ │ │ │ +1942 { │ │ │ │ +1943 if(edge.properties().isTwoWay()) │ │ │ │ +1944 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1945 } │ │ │ │ +1946 │ │ │ │ +1947 template │ │ │ │ +1948 int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_t_w_o_W_a_y_C_o_n_n_e_c_t_i_o_n_s(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, │ │ │ │ +1949 const AggregatesMap& aggregates) const │ │ │ │ +1950 { │ │ │ │ +1951 TwoWayCounter counter; │ │ │ │ +1952 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ +1953 return counter.value(); │ │ │ │ +1954 } │ │ │ │ +1955 │ │ │ │ +1956 template │ │ │ │ +1957 int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_o_n_e_W_a_y_C_o_n_n_e_c_t_i_o_n_s(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, │ │ │ │ +1958 const AggregatesMap& aggregates) const │ │ │ │ +1959 { │ │ │ │ +1960 OneWayCounter counter; │ │ │ │ +1961 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ +1962 return counter.value(); │ │ │ │ +1963 } │ │ │ │ +1964 │ │ │ │ +1965 template │ │ │ │ +1966 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) │ │ │ │ +1967 { │ │ │ │ +1968 if(edge.properties().isOneWay()) │ │ │ │ +1969 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1970 } │ │ │ │ +1971 │ │ │ │ +1972 template │ │ │ │ +1973 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, │ │ │ │ +1974 const AggregatesMap& aggregates) │ │ │ │ +1975 : Counter(), connected_(connected), aggregates_(aggregates) │ │ │ │ +1976 {} │ │ │ │ +1977 │ │ │ │ +1978 │ │ │ │ +1979 template │ │ │ │ +1980 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) │ │ │ │ +1981 { │ │ │ │ +1982 if(connected_.find(aggregates_[edge.target()]) == connected_.end() || │ │ │ │ +aggregates_[edge.target()]==_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) │ │ │ │ +1983 // Would be a new connection │ │ │ │ +1984 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1985 else{ │ │ │ │ +1986 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1987 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +1988 } │ │ │ │ +1989 } │ │ │ │ +1990 │ │ │ │ +1991 template │ │ │ │ +1992 inline double _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_c_o_n_n_e_c_t_i_v_i_t_y(const _V_e_r_t_e_x& vertex, const │ │ │ │ +AggregatesMap& aggregates) const │ │ │ │ +1993 { │ │ │ │ +1994 ConnectivityCounter counter(connected_, aggregates); │ │ │ │ +1995 double noNeighbours=_v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ +1996 return (double)counter.value()/noNeighbours; │ │ │ │ +1997 } │ │ │ │ +1998 │ │ │ │ +1999 template │ │ │ │ +2000 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() │ │ │ │ +2001 : Counter() │ │ │ │ +2002 {} │ │ │ │ +2003 │ │ │ │ +2004 template │ │ │ │ +2005 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) │ │ │ │ +2006 { │ │ │ │ +2007 if(edge.properties().depends()) │ │ │ │ +2008 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +2009 if(edge.properties().influences()) │ │ │ │ +2010 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +2011 } │ │ │ │ +2012 │ │ │ │ +2013 template │ │ │ │ +2014 int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_u_n_u_s_e_d_N_e_i_g_h_b_o_u_r_s(const _V_e_r_t_e_x& vertex, const │ │ │ │ +AggregatesMap& aggregates) const │ │ │ │ +2015 { │ │ │ │ +2016 return aggregateNeighbours(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, │ │ │ │ +aggregates); │ │ │ │ +2017 } │ │ │ │ +2018 │ │ │ │ +2019 template │ │ │ │ +2020 std::pair _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_n_e_i_g_h_b_o_u_r_s(const _V_e_r_t_e_x& vertex, │ │ │ │ +2021 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +2022 const AggregatesMap& aggregates) const │ │ │ │ +2023 { │ │ │ │ +2024 DependencyCounter unused, aggregated; │ │ │ │ +2025 typedef AggregateVisitor CounterT; │ │ │ │ +2026 typedef std::tuple CounterTuple; │ │ │ │ +2027 CombinedFunctor visitors(CounterTuple(CounterT(aggregates, │ │ │ │ +_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, unused), CounterT(aggregates, aggregate, │ │ │ │ +aggregated))); │ │ │ │ +2028 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, visitors); │ │ │ │ +2029 return std::make_pair(unused.value(), aggregated.value()); │ │ │ │ +2030 } │ │ │ │ +2031 │ │ │ │ +2032 │ │ │ │ +2033 template │ │ │ │ +2034 int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_a_g_g_r_e_g_a_t_e_N_e_i_g_h_b_o_u_r_s(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 │ │ │ │ +2035 { │ │ │ │ +2036 DependencyCounter counter; │ │ │ │ +2037 visitAggregateNeighbours(vertex, aggregate, aggregates, counter); │ │ │ │ +2038 return counter.value(); │ │ │ │ +2039 } │ │ │ │ +2040 │ │ │ │ +2041 template │ │ │ │ +2042 std::size_t _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_d_i_s_t_a_n_c_e(const _V_e_r_t_e_x& vertex, const │ │ │ │ +AggregatesMap& aggregates) │ │ │ │ +2043 { │ │ │ │ +2044 return 0; │ │ │ │ +2045 typename PropertyMapTypeSelector::Type visitedMap = │ │ │ │ +_g_e_t(VertexVisitedTag(), *graph_); │ │ │ │ +2046 VertexList vlist; │ │ │ │ +2047 typename AggregatesMap::DummyEdgeVisitor dummy; │ │ │ │ +2048 return aggregates.template breadthFirstSearch(vertex, │ │ │ │ +2049 aggregate_->id(), *graph_, │ │ │ │ +2050 vlist, dummy, dummy, visitedMap); │ │ │ │ +2051 } │ │ │ │ +2052 │ │ │ │ +2053 template │ │ │ │ +2054 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) │ │ │ │ +2055 : front_(front), graph_(graph) │ │ │ │ +2056 {} │ │ │ │ +2057 │ │ │ │ +2058 template │ │ │ │ +2059 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) │ │ │ │ +2060 { │ │ │ │ +2061 _V_e_r_t_e_x target = edge.target(); │ │ │ │ +2062 │ │ │ │ +2063 if(!graph_.getVertexProperties(target).front()) { │ │ │ │ +2064 front_.push_back(target); │ │ │ │ +2065 graph_.getVertexProperties(target).setFront(); │ │ │ │ +2066 } │ │ │ │ +2067 } │ │ │ │ +2068 │ │ │ │ +2069 template │ │ │ │ +2070 inline bool _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_a_d_m_i_s_s_i_b_l_e(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 │ │ │ │ +2071 { │ │ │ │ +2072 // Todo │ │ │ │ +2073 Dune::dvverb<<" Admissible not yet implemented!"<endEdges(vertex); │ │ │ │ +2081 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ +2082 // if(edge.properties().depends() && !edge.properties().influences() │ │ │ │ +2083 if(edge.properties().isStrong() │ │ │ │ +2084 && aggregates[edge.target()]==aggregate) │ │ │ │ +2085 { │ │ │ │ +2086 // Search for another link to the aggregate │ │ │ │ +2087 Iterator edge1 = edge; │ │ │ │ +2088 for(++edge1; edge1 != vend; ++edge1) { │ │ │ │ +2089 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ +2090 if(edge1.properties().isStrong() │ │ │ │ +2091 && aggregates[edge.target()]==aggregate) │ │ │ │ +2092 { │ │ │ │ +2093 //Search for an edge connecting the two vertices that is │ │ │ │ +2094 //strong │ │ │ │ +2095 bool found=false; │ │ │ │ +2096 Iterator v2end = graph_->endEdges(edge.target()); │ │ │ │ +2097 for(Iterator edge2 = graph_->beginEdges(edge.target()); edge2 != v2end; │ │ │ │ +++edge2) { │ │ │ │ +2098 if(edge2.target()==edge1.target() && │ │ │ │ +2099 edge2.properties().isStrong()) { │ │ │ │ +2100 found =true; │ │ │ │ +2101 break; │ │ │ │ +2102 } │ │ │ │ +2103 } │ │ │ │ +2104 if(found) │ │ │ │ +2105 { │ │ │ │ +2106 return true; │ │ │ │ +2107 } │ │ │ │ +2108 } │ │ │ │ +2109 } │ │ │ │ +2110 } │ │ │ │ +2111 } │ │ │ │ +2112 │ │ │ │ +2113 // Situation 2: cluster node depends on front node and other cluster node │ │ │ │ +2115 vend = graph_->endEdges(vertex); │ │ │ │ +2116 for(Iterator edge = graph_->beginEdges(vertex); edge != vend; ++edge) { │ │ │ │ +2117 //if(!edge.properties().depends() && edge.properties().influences() │ │ │ │ +2118 if(edge.properties().isStrong() │ │ │ │ +2119 && aggregates[edge.target()]==aggregate) │ │ │ │ +2120 { │ │ │ │ +2121 // Search for a link from target that stays within the aggregate │ │ │ │ +2122 Iterator v1end = graph_->endEdges(edge.target()); │ │ │ │ +2123 │ │ │ │ +2124 for(Iterator edge1=graph_->beginEdges(edge.target()); edge1 != v1end; │ │ │ │ +++edge1) { │ │ │ │ +2125 //if(edge1.properties().depends() && !edge1.properties().influences() │ │ │ │ +2126 if(edge1.properties().isStrong() │ │ │ │ +2127 && aggregates[edge1.target()]==aggregate) │ │ │ │ +2128 { │ │ │ │ +2129 bool found=false; │ │ │ │ +2130 // Check if front node is also connected to this one │ │ │ │ +2131 Iterator v2end = graph_->endEdges(vertex); │ │ │ │ +2132 for(Iterator edge2 = graph_->beginEdges(vertex); edge2 != v2end; ++edge2) │ │ │ │ { │ │ │ │ -1803 outputIndexSet.add(*g,LocalIndexT(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)); │ │ │ │ -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._c_o_m_m_u_n_i_c_a_t_o_r().sum(numOfOwnVtx); │ │ │ │ -1817 // if(numOfOwnVtx!=indexMap.globalOwnerVertices) │ │ │ │ -1818 // { │ │ │ │ -1819 // std::cerr<remoteIndices().setNeighbours(tneighbors); │ │ │ │ -1838 outcomm->remoteIndices().template rebuild(); │ │ │ │ -1839 │ │ │ │ -1840 } │ │ │ │ -1841 │ │ │ │ -1842 // release the memory │ │ │ │ -1843 delete[] sendTo; │ │ │ │ -1844 │ │ │ │ -1845 if(verbose) { │ │ │ │ -1846 oocomm._c_o_m_m_u_n_i_c_a_t_o_r().barrier(); │ │ │ │ -1847 if(oocomm._c_o_m_m_u_n_i_c_a_t_o_r().rank()==0) │ │ │ │ -1848 std::cout<<" Storing indexsets took "<< │ │ │ │ -1849 time.elapsed()< │ │ │ │ -1870 bool graphRepartition(const G& graph, P& oocomm, int nparts, │ │ │ │ -1871 std::shared_ptr

& outcomm, │ │ │ │ -1872 R& redistInf, │ │ │ │ -1873 bool v=false) │ │ │ │ -1874 { │ │ │ │ -1875 if(nparts!=oocomm.size()) │ │ │ │ -1876 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ -1877 } │ │ │ │ -1878 │ │ │ │ -1879 │ │ │ │ -1880 template │ │ │ │ -1881 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, │ │ │ │ -1882 std::shared_ptr

& outcomm, │ │ │ │ -1883 R& redistInf, │ │ │ │ -1884 bool v=false) │ │ │ │ -1885 { │ │ │ │ -1886 if(nparts!=oocomm.size()) │ │ │ │ -1887 DUNE_THROW(NotImplemented, "only available for MPI programs"); │ │ │ │ -1888 } │ │ │ │ -1889#endif // HAVE_MPI │ │ │ │ -1890} // end of namespace Dune │ │ │ │ -1891#endif │ │ │ │ +2133 if(edge2.target()==edge1.target()) { │ │ │ │ +2134 if(edge2.properties().isStrong()) │ │ │ │ +2135 found=true; │ │ │ │ +2136 break; │ │ │ │ +2137 } │ │ │ │ +2138 } │ │ │ │ +2139 if(found) │ │ │ │ +2140 { │ │ │ │ +2141 return true; │ │ │ │ +2142 } │ │ │ │ +2143 } │ │ │ │ +2144 } │ │ │ │ +2145 } │ │ │ │ +2146 } │ │ │ │ +2147 return false; │ │ │ │ +2148 } │ │ │ │ +2149 │ │ │ │ +2150 template │ │ │ │ +2151 void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_u_n_m_a_r_k_F_r_o_n_t() │ │ │ │ +2152 { │ │ │ │ +2153 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2154 │ │ │ │ +2155 for(Iterator vertex=front_.begin(); vertex != front_.end(); ++vertex) │ │ │ │ +2156 graph_->getVertexProperties(*vertex).resetFront(); │ │ │ │ +2157 │ │ │ │ +2158 front_.clear(); │ │ │ │ +2159 } │ │ │ │ +2160 │ │ │ │ +2161 template │ │ │ │ +2162 inline void │ │ │ │ +2163 _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_n_o_n_i_s_o_N_e_i_g_h_b_o_u_r_A_g_g_r_e_g_a_t_e(const _V_e_r_t_e_x& vertex, │ │ │ │ +2164 const AggregatesMap& aggregates, │ │ │ │ +2165 SLList& neighbours) const │ │ │ │ +2166 { │ │ │ │ +2167 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; │ │ │ │ +2168 Iterator end=graph_->beginEdges(vertex); │ │ │ │ +2169 neighbours.clear(); │ │ │ │ +2170 │ │ │ │ +2171 for(Iterator edge=graph_->beginEdges(vertex); edge!=end; ++edge) │ │ │ │ +2172 { │ │ │ │ +2173 if(aggregates[edge.target()]!=_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 && │ │ │ │ +graph_->getVertexProperties(edge.target()).isolated()) │ │ │ │ +2174 neighbours.push_back(aggregates[edge.target()]); │ │ │ │ +2175 } │ │ │ │ +2176 } │ │ │ │ +2177 │ │ │ │ +2178 template │ │ │ │ +2179 inline typename G::VertexDescriptor _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_m_e_r_g_e_N_e_i_g_h_b_o_u_r(const │ │ │ │ +_V_e_r_t_e_x& vertex, const AggregatesMap& aggregates) const │ │ │ │ +2180 { │ │ │ │ +2181 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; │ │ │ │ +2182 │ │ │ │ +2183 Iterator end = graph_->endEdges(vertex); │ │ │ │ +2184 for(Iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) { │ │ │ │ +2185 if(aggregates[edge.target()] != _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 && │ │ │ │ +2186 graph_->getVertexProperties(edge.target()).isolated() == graph_- │ │ │ │ +>getVertexProperties(edge.source()).isolated()) { │ │ │ │ +2187 if( graph_->getVertexProperties(vertex).isolated() || │ │ │ │ +2188 ((edge.properties().depends() || edge.properties().influences()) │ │ │ │ +2189 && admissible(vertex, aggregates[edge.target()], aggregates))) │ │ │ │ +2190 return edge.target(); │ │ │ │ +2191 } │ │ │ │ +2192 } │ │ │ │ +2193 return _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; │ │ │ │ +2194 } │ │ │ │ +2195 │ │ │ │ +2196 template │ │ │ │ +2197 _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) │ │ │ │ +2198 : Counter(), graph_(graph) │ │ │ │ +2199 {} │ │ │ │ +2200 │ │ │ │ +2201 template │ │ │ │ +2202 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) │ │ │ │ +2203 { │ │ │ │ +2204 if(graph_.getVertexProperties(edge.target()).front()) │ │ │ │ +2205 _C_o_u_n_t_e_r_:_:_i_n_c_r_e_m_e_n_t(); │ │ │ │ +2206 } │ │ │ │ +2207 │ │ │ │ +2208 template │ │ │ │ +2209 int _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_n_o_F_r_o_n_t_N_e_i_g_h_b_o_u_r_s(const _V_e_r_t_e_x& vertex) const │ │ │ │ +2210 { │ │ │ │ +2211 FrontNeighbourCounter counter(*graph_); │ │ │ │ +2212 _v_i_s_i_t_N_e_i_g_h_b_o_u_r_s(*graph_, vertex, counter); │ │ │ │ +2213 return counter.value(); │ │ │ │ +2214 } │ │ │ │ +2215 template │ │ │ │ +2216 inline bool _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_c_o_n_n_e_c_t_e_d(const _V_e_r_t_e_x& vertex, │ │ │ │ +2217 const _A_g_g_r_e_g_a_t_e_D_e_s_c_r_i_p_t_o_r& aggregate, │ │ │ │ +2218 const AggregatesMap& aggregates) const │ │ │ │ +2219 { │ │ │ │ +2220 typedef typename G::ConstEdgeIterator iterator; │ │ │ │ +2221 const iterator end = graph_->endEdges(vertex); │ │ │ │ +2222 for(iterator edge = graph_->beginEdges(vertex); edge != end; ++edge) │ │ │ │ +2223 if(aggregates[edge.target()]==aggregate) │ │ │ │ +2224 return true; │ │ │ │ +2225 return false; │ │ │ │ +2226 } │ │ │ │ +2227 template │ │ │ │ +2228 inline bool _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_c_o_n_n_e_c_t_e_d(const _V_e_r_t_e_x& vertex, │ │ │ │ +2229 const SLList& aggregateList, │ │ │ │ +2230 const AggregatesMap& aggregates) const │ │ │ │ +2231 { │ │ │ │ +2232 typedef typename SLList::const_iterator Iter; │ │ │ │ +2233 for(Iter i=aggregateList.begin(); i!=aggregateList.end(); ++i) │ │ │ │ +2234 if(connected(vertex, *i, aggregates)) │ │ │ │ +2235 return true; │ │ │ │ +2236 return false; │ │ │ │ +2237 } │ │ │ │ +2238 │ │ │ │ +2239 template │ │ │ │ +2240 template │ │ │ │ +2241 void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_g_r_o_w_I_s_o_l_a_t_e_d_A_g_g_r_e_g_a_t_e(const _V_e_r_t_e_x& seed, const │ │ │ │ +AggregatesMap& aggregates, const C& c) │ │ │ │ +2242 { │ │ │ │ +2243 SLList connectedAggregates; │ │ │ │ +2244 nonisoNeighbourAggregate(seed, aggregates,connectedAggregates); │ │ │ │ +2245 │ │ │ │ +2246 while(aggregate_->size()< c.minAggregateSize() && aggregate_->connectSize │ │ │ │ +() < c.maxConnectivity()) { │ │ │ │ +2247 double maxCon=-1; │ │ │ │ +2248 std::size_t maxFrontNeighbours=0; │ │ │ │ +2249 │ │ │ │ +2250 _V_e_r_t_e_x candidate=_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; │ │ │ │ +2251 │ │ │ │ +2252 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2253 │ │ │ │ +2254 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ +2255 if(distance(*vertex, aggregates)>c.maxDistance()) │ │ │ │ +2256 continue; // distance of proposes aggregate too big │ │ │ │ +2257 │ │ │ │ +2258 if(connectedAggregates.size()>0) { │ │ │ │ +2259 // there is already a neighbour cluster │ │ │ │ +2260 // front node must be connected to same neighbour cluster │ │ │ │ +2261 │ │ │ │ +2262 if(!connected(*vertex, connectedAggregates, aggregates)) │ │ │ │ +2263 continue; │ │ │ │ +2264 } │ │ │ │ +2265 │ │ │ │ +2266 double con = connectivity(*vertex, aggregates); │ │ │ │ +2267 │ │ │ │ +2268 if(con == maxCon) { │ │ │ │ +2269 std::size_t frontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2270 │ │ │ │ +2271 if(frontNeighbours >= maxFrontNeighbours) { │ │ │ │ +2272 maxFrontNeighbours = frontNeighbours; │ │ │ │ +2273 candidate = *vertex; │ │ │ │ +2274 } │ │ │ │ +2275 }else if(con > maxCon) { │ │ │ │ +2276 maxCon = con; │ │ │ │ +2277 maxFrontNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2278 candidate = *vertex; │ │ │ │ +2279 } │ │ │ │ +2280 } │ │ │ │ +2281 │ │ │ │ +2282 if(candidate==_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) │ │ │ │ +2283 break; │ │ │ │ +2284 │ │ │ │ +2285 aggregate_->add(candidate); │ │ │ │ +2286 } │ │ │ │ +2287 } │ │ │ │ +2288 │ │ │ │ +2289 template │ │ │ │ +2290 template │ │ │ │ +2291 void _A_g_g_r_e_g_a_t_o_r_<_G_>_:_:_g_r_o_w_A_g_g_r_e_g_a_t_e(const _V_e_r_t_e_x& seed, const │ │ │ │ +AggregatesMap& aggregates, const C& c) │ │ │ │ +2292 { │ │ │ │ +2293 using std::min; │ │ │ │ +2294 │ │ │ │ +2295 std::size_t distance_ =0; │ │ │ │ +2296 while(aggregate_->size() < c.minAggregateSize()&& distance_ candidates; │ │ │ │ +2301 candidates.reserve(30); │ │ │ │ +2302 │ │ │ │ +2303 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2304 │ │ │ │ +2305 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ +2306 // Only nonisolated nodes are considered │ │ │ │ +2307 if(graph_->getVertexProperties(*vertex).isolated()) │ │ │ │ +2308 continue; │ │ │ │ +2309 │ │ │ │ +2310 int twoWayCons = twoWayConnections(*vertex, aggregate_->id(), aggregates); │ │ │ │ +2311 │ │ │ │ +2312 /* The case of two way connections. */ │ │ │ │ +2313 if( maxTwoCons == twoWayCons && twoWayCons > 0) { │ │ │ │ +2314 double con = connectivity(*vertex, aggregates); │ │ │ │ +2315 │ │ │ │ +2316 if(con == maxCon) { │ │ │ │ +2317 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ +2318 │ │ │ │ +2319 if(neighbours > maxNeighbours) { │ │ │ │ +2320 maxNeighbours = neighbours; │ │ │ │ +2321 candidates.clear(); │ │ │ │ +2322 candidates.push_back(*vertex); │ │ │ │ +2323 }else{ │ │ │ │ +2324 candidates.push_back(*vertex); │ │ │ │ +2325 } │ │ │ │ +2326 }else if( con > maxCon) { │ │ │ │ +2327 maxCon = con; │ │ │ │ +2328 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2329 candidates.clear(); │ │ │ │ +2330 candidates.push_back(*vertex); │ │ │ │ +2331 } │ │ │ │ +2332 }else if(twoWayCons > maxTwoCons) { │ │ │ │ +2333 maxTwoCons = twoWayCons; │ │ │ │ +2334 maxCon = connectivity(*vertex, aggregates); │ │ │ │ +2335 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2336 candidates.clear(); │ │ │ │ +2337 candidates.push_back(*vertex); │ │ │ │ +2338 │ │ │ │ +2339 // two way connections precede │ │ │ │ +2340 maxOneCons = std::numeric_limits::max(); │ │ │ │ +2341 } │ │ │ │ +2342 │ │ │ │ +2343 if(twoWayCons > 0) │ │ │ │ +2344 { │ │ │ │ +2345 continue; // THis is a two-way node, skip tests for one way nodes │ │ │ │ +2346 } │ │ │ │ +2347 │ │ │ │ +2348 /* The one way case */ │ │ │ │ +2349 int oneWayCons = oneWayConnections(*vertex, aggregate_->id(), aggregates); │ │ │ │ +2350 │ │ │ │ +2351 if(oneWayCons==0) │ │ │ │ +2352 continue; // No strong connections, skip the tests. │ │ │ │ +2353 │ │ │ │ +2354 if(!admissible(*vertex, aggregate_->id(), aggregates)) │ │ │ │ +2355 continue; │ │ │ │ +2356 │ │ │ │ +2357 if( maxOneCons == oneWayCons && oneWayCons > 0) { │ │ │ │ +2358 double con = connectivity(*vertex, aggregates); │ │ │ │ +2359 │ │ │ │ +2360 if(con == maxCon) { │ │ │ │ +2361 int neighbours = noFrontNeighbours(*vertex); │ │ │ │ +2362 │ │ │ │ +2363 if(neighbours > maxNeighbours) { │ │ │ │ +2364 maxNeighbours = neighbours; │ │ │ │ +2365 candidates.clear(); │ │ │ │ +2366 candidates.push_back(*vertex); │ │ │ │ +2367 }else{ │ │ │ │ +2368 if(neighbours==maxNeighbours) │ │ │ │ +2369 { │ │ │ │ +2370 candidates.push_back(*vertex); │ │ │ │ +2371 } │ │ │ │ +2372 } │ │ │ │ +2373 }else if( con > maxCon) { │ │ │ │ +2374 maxCon = con; │ │ │ │ +2375 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2376 candidates.clear(); │ │ │ │ +2377 candidates.push_back(*vertex); │ │ │ │ +2378 } │ │ │ │ +2379 }else if(oneWayCons > maxOneCons) { │ │ │ │ +2380 maxOneCons = oneWayCons; │ │ │ │ +2381 maxCon = connectivity(*vertex, aggregates); │ │ │ │ +2382 maxNeighbours = noFrontNeighbours(*vertex); │ │ │ │ +2383 candidates.clear(); │ │ │ │ +2384 candidates.push_back(*vertex); │ │ │ │ +2385 } │ │ │ │ +2386 } │ │ │ │ +2387 │ │ │ │ +2388 │ │ │ │ +2389 if(!candidates.size()) │ │ │ │ +2390 break; // No more candidates found │ │ │ │ +2391 distance_=distance(seed, aggregates); │ │ │ │ +2392 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ +2393 aggregate_->size())); │ │ │ │ +2394 aggregate_->add(candidates); │ │ │ │ +2395 } │ │ │ │ +2396 } │ │ │ │ +2397 │ │ │ │ +2398 template │ │ │ │ +2399 template │ │ │ │ +2400 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, │ │ │ │ +2401 bool finestLevel) │ │ │ │ +2402 { │ │ │ │ +2403 _A_g_g_r_e_g_a_t_o_r_<_G_> aggregator; │ │ │ │ +2404 return aggregator.build(matrix, graph, *this, criterion, finestLevel); │ │ │ │ +2405 } │ │ │ │ +2406 │ │ │ │ +2407 template │ │ │ │ +2408 template │ │ │ │ +2409 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, │ │ │ │ +2410 bool finestLevel) │ │ │ │ +2411 { │ │ │ │ +2412 using std::max; │ │ │ │ +2413 using std::min; │ │ │ │ +2414 // Stack for fast vertex access │ │ │ │ +2415 Stack stack_(graph, *this, aggregates); │ │ │ │ +2416 │ │ │ │ +2417 graph_ = &graph; │ │ │ │ +2418 │ │ │ │ +2419 aggregate_ = new Aggregate(graph, aggregates, connected_, │ │ │ │ +front_); │ │ │ │ +2420 │ │ │ │ +2421 Timer watch; │ │ │ │ +2422 watch.reset(); │ │ │ │ +2423 │ │ │ │ +2424 _b_u_i_l_d_D_e_p_e_n_d_e_n_c_y(graph, m, c, finestLevel); │ │ │ │ +2425 │ │ │ │ +2426 dverb<<"Build dependency took "<< watch.elapsed()<<" seconds."<_:_:_I_S_O_L_A_T_E_D; │ │ │ │ +2447 ++skippedAggregates; │ │ │ │ +2448 continue; │ │ │ │ +2449 } │ │ │ │ +2450 │ │ │ │ +2451 if(graph.getVertexProperties(seed).isolated()) { │ │ │ │ +2452 if(c.skipIsolated()) { │ │ │ │ +2453 // isolated vertices are not aggregated but skipped on the coarser levels. │ │ │ │ +2454 aggregates[seed]=_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; │ │ │ │ +2455 ++skippedAggregates; │ │ │ │ +2456 // skip rest as no agglomeration is done. │ │ │ │ +2457 continue; │ │ │ │ +2458 }else{ │ │ │ │ +2459 aggregate_->seed(seed); │ │ │ │ +2460 growIsolatedAggregate(seed, aggregates, c); │ │ │ │ +2461 } │ │ │ │ +2462 }else{ │ │ │ │ +2463 aggregate_->seed(seed); │ │ │ │ +2464 growAggregate(seed, aggregates, c); │ │ │ │ +2465 } │ │ │ │ +2466 │ │ │ │ +2467 /* The rounding step. */ │ │ │ │ +2468 while(!(graph.getVertexProperties(seed).isolated()) && aggregate_->size() │ │ │ │ +< c.maxAggregateSize()) { │ │ │ │ +2469 │ │ │ │ +2470 std::vector candidates; │ │ │ │ +2471 candidates.reserve(30); │ │ │ │ +2472 │ │ │ │ +2473 typedef typename std::vector::const_iterator Iterator; │ │ │ │ +2474 │ │ │ │ +2475 for(Iterator vertex = front_.begin(); vertex != front_.end(); ++vertex) { │ │ │ │ +2476 │ │ │ │ +2477 if(graph.getVertexProperties(*vertex).isolated()) │ │ │ │ +2478 continue; // No isolated nodes here │ │ │ │ +2479 │ │ │ │ +2480 if(twoWayConnections( *vertex, aggregate_->id(), aggregates) == 0 && │ │ │ │ +2481 (oneWayConnections( *vertex, aggregate_->id(), aggregates) == 0 || │ │ │ │ +2482 !admissible( *vertex, aggregate_->id(), aggregates) )) │ │ │ │ +2483 continue; │ │ │ │ +2484 │ │ │ │ +2485 std::pair neighbourPair=neighbours(*vertex, aggregate_->id(), │ │ │ │ +2486 aggregates); │ │ │ │ +2487 │ │ │ │ +2488 //if(aggregateNeighbours(*vertex, aggregate_->id(), aggregates) <= │ │ │ │ +unusedNeighbours(*vertex, aggregates)) │ │ │ │ +2489 // continue; │ │ │ │ +2490 │ │ │ │ +2491 if(neighbourPair.first >= neighbourPair.second) │ │ │ │ +2492 continue; │ │ │ │ +2493 │ │ │ │ +2494 if(distance(*vertex, aggregates) > c.maxDistance()) │ │ │ │ +2495 continue; // Distance too far │ │ │ │ +2496 candidates.push_back(*vertex); │ │ │ │ +2497 break; │ │ │ │ +2498 } │ │ │ │ +2499 │ │ │ │ +2500 if(!candidates.size()) break; // no more candidates found. │ │ │ │ +2501 │ │ │ │ +2502 candidates.resize(min(candidates.size(), c.maxAggregateSize()- │ │ │ │ +2503 aggregate_->size())); │ │ │ │ +2504 aggregate_->add(candidates); │ │ │ │ +2505 │ │ │ │ +2506 } │ │ │ │ +2507 │ │ │ │ +2508 // try to merge aggregates consisting of only one nonisolated vertex with │ │ │ │ +other aggregates │ │ │ │ +2509 if(aggregate_->size()==1 && c.maxAggregateSize()>1) { │ │ │ │ +2510 if(!graph.getVertexProperties(seed).isolated()) { │ │ │ │ +2511 _V_e_r_t_e_x mergedNeighbour = mergeNeighbour(seed, aggregates); │ │ │ │ +2512 │ │ │ │ +2513 if(mergedNeighbour != _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) { │ │ │ │ +2514 // assign vertex to the neighbouring cluster │ │ │ │ +2515 aggregates[seed] = aggregates[mergedNeighbour]; │ │ │ │ +2516 aggregate_->invalidate(); │ │ │ │ +2517 }else{ │ │ │ │ +2518 ++avg; │ │ │ │ +2519 minA=min(minA,static_cast(1)); │ │ │ │ +2520 maxA=max(maxA,static_cast(1)); │ │ │ │ +2521 ++oneAggregates; │ │ │ │ +2522 ++conAggregates; │ │ │ │ +2523 } │ │ │ │ +2524 }else{ │ │ │ │ +2525 ++avg; │ │ │ │ +2526 minA=min(minA,static_cast(1)); │ │ │ │ +2527 maxA=max(maxA,static_cast(1)); │ │ │ │ +2528 ++oneAggregates; │ │ │ │ +2529 ++isoAggregates; │ │ │ │ +2530 } │ │ │ │ +2531 ++avg; │ │ │ │ +2532 }else{ │ │ │ │ +2533 avg+=aggregate_->size(); │ │ │ │ +2534 minA=min(minA,aggregate_->size()); │ │ │ │ +2535 maxA=max(maxA,aggregate_->size()); │ │ │ │ +2536 if(graph.getVertexProperties(seed).isolated()) │ │ │ │ +2537 ++isoAggregates; │ │ │ │ +2538 else │ │ │ │ +2539 ++conAggregates; │ │ │ │ +2540 } │ │ │ │ +2541 │ │ │ │ +2542 } │ │ │ │ +2543 │ │ │ │ +2544 Dune::dinfo<<"connected aggregates: "<0) │ │ │ │ +2547 Dune::dinfo<<" one node aggregates: "<::iterator valIter_ │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:191 │ │ │ │ +_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:156 │ │ │ │ +_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:592 │ │ │ │ +_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:743 │ │ │ │ +_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:304 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_i_z_e │ │ │ │ +size_type size() │ │ │ │ +Get the size of the aggregate. │ │ │ │ +_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:931 │ │ │ │ +_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:68 │ │ │ │ +_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:359 │ │ │ │ +_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:170 │ │ │ │ +_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:260 │ │ │ │ +_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_:_:_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_o_r_:_:_M_a_t_r_i_x_G_r_a_p_h │ │ │ │ +G MatrixGraph │ │ │ │ +The matrix graph type used. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:926 │ │ │ │ +_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:365 │ │ │ │ +_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:607 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_:_:_s_i_z_e___t_y_p_e │ │ │ │ +typename VertexSet::size_type size_type │ │ │ │ +Type of size used by allocator of sllist. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:812 │ │ │ │ +_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:530 │ │ │ │ +_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:292 │ │ │ │ +_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:321 │ │ │ │ +_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:189 │ │ │ │ +_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:265 │ │ │ │ +_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:748 │ │ │ │ +_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:547 │ │ │ │ +_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:203 │ │ │ │ +_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:1019 │ │ │ │ +_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:216 │ │ │ │ +_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:288 │ │ │ │ +_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:187 │ │ │ │ +_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_:_:_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_:_:_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:331 │ │ │ │ +_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:298 │ │ │ │ +_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 │ │ │ │ +size_type connectSize() │ │ │ │ +Get the number of connections to other aggregates. │ │ │ │ +_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:336 │ │ │ │ +_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 &) const │ │ │ │ +compute the norm of a matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:512 │ │ │ │ +_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:181 │ │ │ │ +_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:1075 │ │ │ │ +_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:820 │ │ │ │ +_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:72 │ │ │ │ +_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:270 │ │ │ │ +_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:190 │ │ │ │ +_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:326 │ │ │ │ +_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:2593 │ │ │ │ +_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:833 │ │ │ │ +_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:731 │ │ │ │ +_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:183 │ │ │ │ +_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:185 │ │ │ │ +_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:815 │ │ │ │ +_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:527 │ │ │ │ +_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:934 │ │ │ │ +_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:363 │ │ │ │ +_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:197 │ │ │ │ +_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:369 │ │ │ │ +_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:741 │ │ │ │ +_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:350 │ │ │ │ +_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:362 │ │ │ │ +_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:57 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_R_o_w_S_u_m_:_:_o_p_e_r_a_t_o_r_(_) │ │ │ │ +auto operator()(const M &m) const │ │ │ │ +compute the norm of a matrix. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:475 │ │ │ │ +_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_:_:_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:84 │ │ │ │ +_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:736 │ │ │ │ +_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:586 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_ _>_:_:_I_S_O_L_A_T_E_D │ │ │ │ +static const T ISOLATED │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:577 │ │ │ │ +_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:367 │ │ │ │ +_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:173 │ │ │ │ +_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:308 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_ _>_:_:_n_o_V_e_r_t_i_c_e_s │ │ │ │ +std::size_t noVertices() const │ │ │ │ +_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:107 │ │ │ │ +_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:361 │ │ │ │ +_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:598 │ │ │ │ +_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_:_:_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:550 │ │ │ │ +_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:729 │ │ │ │ +_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:306 │ │ │ │ +_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:182 │ │ │ │ +_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:141 │ │ │ │ +_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:301 │ │ │ │ +_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:179 │ │ │ │ +_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:807 │ │ │ │ +_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:496 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_<_ _T_ _>_:_:_U_N_A_G_G_R_E_G_A_T_E_D │ │ │ │ +static const T UNAGGREGATED │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:572 │ │ │ │ +_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_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 > *=nullptr) const │ │ │ │ +Compute the norm of a scalar. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:408 │ │ │ │ +_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:300 │ │ │ │ +_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:115 │ │ │ │ +_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:242 │ │ │ │ +_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:146 │ │ │ │ +_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:392 │ │ │ │ +_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:795 │ │ │ │ +_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:353 │ │ │ │ +_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:581 │ │ │ │ +_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:302 │ │ │ │ +_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:151 │ │ │ │ +_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:801 │ │ │ │ +_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:791 │ │ │ │ +_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_:_:_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:384 │ │ │ │ +_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:468 │ │ │ │ +_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:505 │ │ │ │ +_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:489 │ │ │ │ _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 │ │ │ │ -DDeeffiinniittiioonn repartition.hh:47 │ │ │ │ -_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_:_:_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_:_:_c_o_l │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ +_D_u_n_e_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ _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_:_:_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_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_:_:_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:51 │ │ │ │ +_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:255 │ │ │ │ +_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:316 │ │ │ │ +_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:381 │ │ │ │ +_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:457 │ │ │ │ +_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:465 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_F_r_o_b_e_n_i_u_s_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:486 │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_A_l_w_a_y_s_O_n_e_N_o_r_m │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:502 │ │ │ │ +_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:566 │ │ │ │ +_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:604 │ │ │ │ +_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:784 │ │ │ │ _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_:_:_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_:_:_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_:_:_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,95 +66,45 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │

│ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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 opTraits, const auto &, const ParameterTree &config){ using OpTraits=std::decay_t< decltype(opTraits)>;using D=typename OpTraits::domain_type;using R=typename OpTraits::range_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,78 +1,22 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ -  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 opTraits, const │ │ │ │ - auto &, const ParameterTree &config){ using OpTraits=std::decay_t< decltype │ │ │ │ - (opTraits)>;using D=typename OpTraits::domain_type;using R=typename │ │ │ │ - OpTraits::range_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 >()) │ │ │ │ -********** 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. │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,845 +66,125 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
54
│ │ │ -
66
│ │ │ +
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
│ │ │ -
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 void pre([[maybe_unused]] domain_type&,[[maybe_unused]] range_type&) override
│ │ │ -
103 {}
│ │ │ -
│ │ │ -
104
│ │ │ -
│ │ │ -
105 void apply(domain_type& v, const range_type& d) override
│ │ │ -
106 {
│ │ │ - │ │ │ -
108 range_type copy(d);
│ │ │ -
109 inverse_operator_.apply(v, copy, res);
│ │ │ -
110 }
│ │ │ -
│ │ │ -
111
│ │ │ -
│ │ │ -
112 void post([[maybe_unused]] domain_type&) override
│ │ │ -
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 void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override
│ │ │ -
210 {}
│ │ │ -
│ │ │ -
211
│ │ │ -
│ │ │ -
217 void apply (X& v, const Y& d) override
│ │ │ -
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 void post ([[maybe_unused]] X& x) override
│ │ │ -
231 {}
│ │ │ -
│ │ │ -
232
│ │ │ -
│ │ │ - │ │ │ -
235 {
│ │ │ - │ │ │ -
237 }
│ │ │ -
│ │ │ -
238
│ │ │ -
239 private:
│ │ │ -
241 const M& _A_;
│ │ │ -
243 int _n;
│ │ │ - │ │ │ -
246 };
│ │ │ -
│ │ │ - │ │ │ -
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 void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override
│ │ │ -
330 {}
│ │ │ -
│ │ │ -
331
│ │ │ -
│ │ │ -
337 void apply (X& v, const Y& d) override
│ │ │ -
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 void post ([[maybe_unused]] X& x) override
│ │ │ -
369 {}
│ │ │ -
│ │ │ -
370
│ │ │ -
│ │ │ - │ │ │ -
373 {
│ │ │ - │ │ │ -
375 }
│ │ │ -
│ │ │ -
376
│ │ │ -
377 private:
│ │ │ -
379 const M& _A_;
│ │ │ -
381 int _n;
│ │ │ - │ │ │ -
384 };
│ │ │ -
│ │ │ - │ │ │ -
386
│ │ │ -
387
│ │ │ -
398 template<class M, class X, class Y, int l=1>
│ │ │ - │ │ │ - │ │ │ -
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 void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override
│ │ │ -
481 {}
│ │ │ -
│ │ │ -
482
│ │ │ -
│ │ │ -
488 void apply (X& v, const Y& d) override
│ │ │ -
489 {
│ │ │ -
490 for (int i=0; i<_n; i++) {
│ │ │ -
491 dbjac(_A_,v,d,_w,BL<l>());
│ │ │ -
492 }
│ │ │ -
493 }
│ │ │ -
│ │ │ -
494
│ │ │ -
│ │ │ -
500 void post ([[maybe_unused]] X& x) override
│ │ │ -
501 {}
│ │ │ -
│ │ │ -
502
│ │ │ -
│ │ │ - │ │ │ -
505 {
│ │ │ - │ │ │ -
507 }
│ │ │ -
│ │ │ -
508
│ │ │ -
509 private:
│ │ │ -
511 const M& _A_;
│ │ │ -
513 int _n;
│ │ │ -
515 real_field_type _w;
│ │ │ -
516 };
│ │ │ -
│ │ │ - │ │ │ -
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 void pre([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
│ │ │ -
640 {
│ │ │ -
641 }
│ │ │ -
│ │ │ -
642
│ │ │ -
│ │ │ -
648 void apply(X &v, const Y &d) override
│ │ │ -
649 {
│ │ │ -
650
│ │ │ - │ │ │ -
652
│ │ │ -
653 if (wNotIdentity_)
│ │ │ -
654 {
│ │ │ -
655 v *= _w;
│ │ │ -
656 }
│ │ │ -
657 }
│ │ │ -
│ │ │ -
658
│ │ │ -
│ │ │ -
664 void post([[maybe_unused]] X &x) override
│ │ │ -
665 {
│ │ │ -
666 }
│ │ │ -
│ │ │ -
667
│ │ │ -
│ │ │ - │ │ │ -
670 {
│ │ │ - │ │ │ -
672 }
│ │ │ -
│ │ │ -
673
│ │ │ -
674 protected:
│ │ │ -
675 std::vector<block_type> Dinv_;
│ │ │ -
677 const M &_A_;
│ │ │ - │ │ │ -
681 const bool wNotIdentity_;
│ │ │ -
682 };
│ │ │ -
│ │ │ - │ │ │ -
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 void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override
│ │ │ -
814 {}
│ │ │ -
│ │ │ -
815
│ │ │ -
│ │ │ -
821 void apply (X& v, const Y& d) override
│ │ │ -
822 {
│ │ │ -
823 if( ILU_ )
│ │ │ -
824 {
│ │ │ - │ │ │ -
826 }
│ │ │ -
827 else
│ │ │ -
828 {
│ │ │ - │ │ │ -
830 }
│ │ │ -
831
│ │ │ -
832 if( wNotIdentity_ )
│ │ │ -
833 {
│ │ │ -
834 v *= w_;
│ │ │ -
835 }
│ │ │ -
836 }
│ │ │ -
│ │ │ -
837
│ │ │ -
│ │ │ -
843 void post ([[maybe_unused]] X& x) override
│ │ │ -
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 };
│ │ │ -
│ │ │ - │ │ │ -
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 void pre ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override
│ │ │ -
921 {}
│ │ │ -
│ │ │ -
922
│ │ │ -
│ │ │ -
928 void apply (X& v, const Y& d) override
│ │ │ -
929 {
│ │ │ -
930 v = d;
│ │ │ -
931 v *= _w;
│ │ │ -
932 }
│ │ │ -
│ │ │ -
933
│ │ │ -
│ │ │ -
939 void post ([[maybe_unused]] X& x) override
│ │ │ -
940 {}
│ │ │ -
│ │ │ -
941
│ │ │ -
│ │ │ - │ │ │ -
944 {
│ │ │ - │ │ │ -
946 }
│ │ │ -
│ │ │ -
947
│ │ │ -
948 private:
│ │ │ - │ │ │ -
951 };
│ │ │ -
│ │ │ -
952 DUNE_REGISTER_PRECONDITIONER("richardson", [](auto opTraits, const auto& /*op*/, const ParameterTree& config){
│ │ │ -
953 using OpTraits = std::decay_t<decltype(opTraits)>;
│ │ │ -
954 using D = typename OpTraits::domain_type;
│ │ │ -
955 using R = typename OpTraits::range_type;
│ │ │ -
956 return std::make_shared<Richardson<D,R>>(config);
│ │ │ -
957 });
│ │ │ -
958
│ │ │ -
959
│ │ │ -
970 template< class M, class X, class Y >
│ │ │ -
│ │ │ - │ │ │ -
972 : public Preconditioner< X, Y >
│ │ │ -
973 {
│ │ │ -
974 typedef SeqILDL< M, X, Y > This;
│ │ │ -
975 typedef Preconditioner< X, Y > Base;
│ │ │ -
976
│ │ │ -
977 public:
│ │ │ -
979 typedef std::remove_const_t< M > matrix_type;
│ │ │ -
981 typedef X domain_type;
│ │ │ -
983 typedef Y range_type;
│ │ │ -
985 typedef typename X::field_type field_type;
│ │ │ -
987 typedef Simd::Scalar<field_type> scalar_field_type;
│ │ │ -
989 typedef typename FieldTraits<scalar_field_type>::real_type real_field_type;
│ │ │ -
990
│ │ │ -
│ │ │ -
1003 SeqILDL (const std::shared_ptr<const AssembledLinearOperator<M,X,Y>>& A, const ParameterTree& configuration)
│ │ │ -
1004 : SeqILDL(A->getmat(), configuration)
│ │ │ -
1005 {}
│ │ │ -
│ │ │ -
1006
│ │ │ -
│ │ │ -
1019 SeqILDL(const matrix_type& A, const ParameterTree& config)
│ │ │ -
1020 : SeqILDL(A, config.get<real_field_type>("relaxation", 1.0))
│ │ │ -
1021 {}
│ │ │ -
│ │ │ -
1022
│ │ │ -
│ │ │ -
1031 explicit SeqILDL ( const matrix_type &A, real_field_type relax = real_field_type( 1 ) )
│ │ │ -
1032 : decomposition_( A.N(), A.M(), matrix_type::random ),
│ │ │ -
1033 relax_( relax )
│ │ │ -
1034 {
│ │ │ -
1035 // setup row sizes for lower triangular matrix
│ │ │ -
1036 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ -
1037 {
│ │ │ -
1038 const auto &A_i = *i;
│ │ │ -
1039 const auto ij = A_i.find( i.index() );
│ │ │ -
1040 if( ij != A_i.end() )
│ │ │ -
1041 decomposition_.setrowsize( i.index(), ij.offset()+1 );
│ │ │ -
1042 else
│ │ │ -
1043 DUNE_THROW( ISTLError, "diagonal entry missing" );
│ │ │ -
1044 }
│ │ │ -
1045 decomposition_.endrowsizes();
│ │ │ -
1046
│ │ │ -
1047 // setup row indices for lower triangular matrix
│ │ │ -
1048 for( auto i = A.begin(), iend = A.end(); i != iend; ++i )
│ │ │ -
1049 {
│ │ │ -
1050 const auto &A_i = *i;
│ │ │ -
1051 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij )
│ │ │ -
1052 decomposition_.addindex( i.index(), ij.index() );
│ │ │ -
1053 decomposition_.addindex( i.index(), i.index() );
│ │ │ -
1054 }
│ │ │ -
1055 decomposition_.endindices();
│ │ │ -
1056
│ │ │ -
1057 // copy values of lower triangular matrix
│ │ │ -
1058 auto i = A.begin();
│ │ │ -
1059 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row != rowend; ++row, ++i )
│ │ │ -
1060 {
│ │ │ -
1061 auto ij = i->begin();
│ │ │ -
1062 for( auto col = row->begin(), colend = row->end(); col != colend; ++col, ++ij )
│ │ │ -
1063 *col = *ij;
│ │ │ -
1064 }
│ │ │ -
1065
│ │ │ -
1066 // perform ILDL decomposition
│ │ │ -
1067 bildl_decompose( decomposition_ );
│ │ │ -
1068 }
│ │ │ -
│ │ │ -
1069
│ │ │ -
│ │ │ -
1071 void pre ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override
│ │ │ -
1072 {}
│ │ │ -
│ │ │ -
1073
│ │ │ -
│ │ │ -
1075 void apply ( X &v, const Y &d ) override
│ │ │ -
1076 {
│ │ │ -
1077 bildl_backsolve( decomposition_, v, d, true );
│ │ │ -
1078 v *= relax_;
│ │ │ -
1079 }
│ │ │ -
│ │ │ -
1080
│ │ │ -
│ │ │ -
1082 void post ([[maybe_unused]] X &x) override
│ │ │ -
1083 {}
│ │ │ -
│ │ │ -
1084
│ │ │ - │ │ │ -
1087
│ │ │ -
1088 private:
│ │ │ -
1089 matrix_type decomposition_;
│ │ │ -
1090 real_field_type relax_;
│ │ │ -
1091 };
│ │ │ -
│ │ │ - │ │ │ -
1093
│ │ │ -
1095
│ │ │ -
1096} // end namespace
│ │ │ -
1097
│ │ │ -
1098
│ │ │ -
1099#endif
│ │ │ - │ │ │ -
#define DUNE_REGISTER_PRECONDITIONER(name,...)
Definition solverregistry.hh:13
│ │ │ - │ │ │ -
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.
│ │ │ -
SeqSOR< M, X, Y, l > SeqGS
Sequential Gauss Seidel preconditioner.
Definition preconditioners.hh:399
│ │ │ -
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
│ │ │ -
auto defaultPreconditionerBlockLevelCreator()
Definition solverregistry.hh:34
│ │ │ -
auto defaultPreconditionerCreator()
Definition solverregistry.hh:55
│ │ │ +
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.
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │
Definition allocator.hh:11
│ │ │ -
void bildl_decompose(Matrix &A)
compute ILDL decomposition of a symmetric matrix A
Definition ildl.hh:90
│ │ │
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:158
│ │ │ -
void blockDILUDecomposition(M &A, std::vector< typename M::block_type > &Dinv_)
Definition dilu.hh:52
│ │ │ -
void blockDILUBacksolve(const M &A, const std::vector< typename M::block_type > Dinv_, X &v, const Y &d)
Definition dilu.hh:112
│ │ │ -
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:316
│ │ │ -
void blockILUBacksolve(const M &A, X &v, const Y &d)
LU backsolve with stored inverse.
Definition ilu.hh:103
│ │ │ -
void blockILU0Decomposition(M &A)
compute ILU decomposition of A. A is overwritten by its decomposition
Definition ilu.hh:35
│ │ │ -
void blockILUDecomposition(const M &A, int n, M &ILU)
Definition ilu.hh:176
│ │ │ -
compile-time parameter for block recursion depth
Definition gsetc.hh:45
│ │ │ -
a simple compressed row storage matrix class
Definition ilu.hh:268
│ │ │ -
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:110
│ │ │ -
Base class for matrix free definition of preconditioners.
Definition preconditioner.hh:33
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:116
│ │ │ -
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
│ │ │ -
void post(domain_type &) override
Clean up.
Definition preconditioners.hh:112
│ │ │ -
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
│ │ │ -
void pre(domain_type &, range_type &) override
Prepare the preconditioner.
Definition preconditioners.hh:102
│ │ │ -
void apply(domain_type &v, const range_type &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:105
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:209
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:234
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:230
│ │ │ -
X::field_type field_type
Definition preconditioners.hh:151
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
Definition preconditioners.hh:153
│ │ │ -
X domain_type
Definition preconditioners.hh:147
│ │ │ -
M matrix_type
Definition preconditioners.hh:145
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition preconditioners.hh:217
│ │ │ -
X range_type
Definition preconditioners.hh:149
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_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
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:368
│ │ │ -
M matrix_type
Definition preconditioners.hh:265
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_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
Definition preconditioners.hh:267
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
Definition preconditioners.hh:273
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition preconditioners.hh:337
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:329
│ │ │ -
Y range_type
Definition preconditioners.hh:269
│ │ │ -
SeqSOR(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:320
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:372
│ │ │ -
X::field_type field_type
Definition preconditioners.hh:271
│ │ │ -
SeqSOR(const M &A, int n, real_field_type w)
Constructor.
Definition preconditioners.hh:284
│ │ │ -
SeqJac(const M &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:471
│ │ │ -
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
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition preconditioners.hh:488
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:422
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:480
│ │ │ -
X domain_type
The domain type of the preconditioner.
Definition preconditioners.hh:418
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:504
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:500
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:426
│ │ │ -
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
│ │ │ -
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
│ │ │ -
typename FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:581
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition preconditioners.hh:648
│ │ │ -
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
│ │ │ -
SeqDILU(const M &A, real_field_type w)
Constructor.
Definition preconditioners.hh:589
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:639
│ │ │ -
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
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:669
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:664
│ │ │ -
SeqILU(const M &A, int n, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:777
│ │ │ -
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
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:843
│ │ │ -
const bool wNotIdentity_
true if w != 1.0
Definition preconditioners.hh:864
│ │ │ -
SeqILU(const M &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:763
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:813
│ │ │ -
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
│ │ │ -
SeqILU(const M &A, real_field_type w, const bool resort=false)
Constructor.
Definition preconditioners.hh:726
│ │ │ -
void apply(X &v, const Y &d) override
Apply the preconditioner.
Definition preconditioners.hh:821
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:847
│ │ │ -
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
│ │ │ -
X::field_type field_type
The field type of the preconditioner.
Definition preconditioners.hh:885
│ │ │ -
Y range_type
The range type of the preconditioner.
Definition preconditioners.hh:883
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:920
│ │ │ -
Richardson(real_field_type w=1.0)
Constructor.
Definition preconditioners.hh:896
│ │ │ -
void apply(X &v, const Y &d) override
Apply the precondioner.
Definition preconditioners.hh:928
│ │ │ -
void post(X &x) override
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
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:943
│ │ │ -
SeqILDL(const matrix_type &A, const ParameterTree &config)
Constructor.
Definition preconditioners.hh:1019
│ │ │ -
SeqILDL(const matrix_type &A, real_field_type relax=real_field_type(1))
constructor
Definition preconditioners.hh:1031
│ │ │ -
X domain_type
domain type of the preconditioner
Definition preconditioners.hh:981
│ │ │ -
void post(X &x) override
Clean up.
Definition preconditioners.hh:1082
│ │ │ -
Y range_type
range type of the preconditioner
Definition preconditioners.hh:983
│ │ │ -
std::remove_const_t< M > matrix_type
type of matrix the preconditioner is for
Definition preconditioners.hh:979
│ │ │ -
void apply(X &v, const Y &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition preconditioners.hh:1075
│ │ │ -
FieldTraits< scalar_field_type >::real_type real_field_type
real scalar type underlying the field_type
Definition preconditioners.hh:989
│ │ │ -
SeqILDL(const std::shared_ptr< const AssembledLinearOperator< M, X, Y > > &A, const ParameterTree &configuration)
Constructor.
Definition preconditioners.hh:1003
│ │ │ -
void pre(X &x, Y &b) override
Prepare the preconditioner.
Definition preconditioners.hh:1071
│ │ │ -
Simd::Scalar< field_type > scalar_field_type
scalar type underlying the field_type
Definition preconditioners.hh:987
│ │ │ -
X::field_type field_type
field type of the preconditioner
Definition preconditioners.hh:985
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition preconditioners.hh:1086
│ │ │ -
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
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
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:566
│ │ │ +
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,1149 +1,137 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ +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 { │ │ │ │ -54 │ │ │ │ -66 │ │ │ │ +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 : _n_u_m_b_e_r__(0), _a_g_g_r_e_g_a_t_e_s__(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 _n_u_m_b_e_r__; │ │ │ │ +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 _a_g_g_r_e_g_a_t_e_s__[edge.target()]=_n_u_m_b_e_r__; │ │ │ │ +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 ++_n_u_m_b_e_r__; │ │ │ │ +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 │ │ │ │ -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 void _p_r_e([[maybe_unused]] _d_o_m_a_i_n___t_y_p_e&,[[maybe_unused]] _r_a_n_g_e___t_y_p_e&) │ │ │ │ -override │ │ │ │ -103 {} │ │ │ │ -104 │ │ │ │ -_1_0_5 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) override │ │ │ │ -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 void _p_o_s_t([[maybe_unused]] _d_o_m_a_i_n___t_y_p_e&) override │ │ │ │ -113 {} │ │ │ │ -114 │ │ │ │ -_1_1_6 _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 │ │ │ │ -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 void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override │ │ │ │ -210 {} │ │ │ │ -211 │ │ │ │ -_2_1_7 void _a_p_p_l_y (X& v, const Y& d) override │ │ │ │ -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 void _p_o_s_t ([[maybe_unused]] X& x) override │ │ │ │ -231 {} │ │ │ │ -232 │ │ │ │ -_2_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 override │ │ │ │ -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", │ │ │ │ -_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_>()); │ │ │ │ -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 void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override │ │ │ │ -330 {} │ │ │ │ -331 │ │ │ │ -_3_3_7 void _a_p_p_l_y (X& v, const Y& d) override │ │ │ │ -338 { │ │ │ │ -339 this->template _a_p_p_l_y_<_t_r_u_e_>(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 void _p_o_s_t ([[maybe_unused]] X& x) override │ │ │ │ -369 {} │ │ │ │ -370 │ │ │ │ -_3_7_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() const override │ │ │ │ -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", │ │ │ │ -_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_>()); │ │ │ │ -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", │ │ │ │ -_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_>()); │ │ │ │ -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 void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override │ │ │ │ -481 {} │ │ │ │ -482 │ │ │ │ -_4_8_8 void _a_p_p_l_y (X& v, const Y& d) override │ │ │ │ -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 void _p_o_s_t ([[maybe_unused]] X& x) override │ │ │ │ -501 {} │ │ │ │ -502 │ │ │ │ -_5_0_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 override │ │ │ │ -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", │ │ │ │ -_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_>()); │ │ │ │ -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 _w_N_o_t_I_d_e_n_t_i_t_y__([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 void _p_r_e([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override │ │ │ │ -640 { │ │ │ │ -641 } │ │ │ │ -642 │ │ │ │ -_6_4_8 void _a_p_p_l_y(X &v, const Y &d) override │ │ │ │ -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__, _D_i_n_v__, v, d); │ │ │ │ -652 │ │ │ │ -653 if (_w_N_o_t_I_d_e_n_t_i_t_y__) │ │ │ │ -654 { │ │ │ │ -655 v *= ___w; │ │ │ │ -656 } │ │ │ │ -657 } │ │ │ │ -658 │ │ │ │ -_6_6_4 void _p_o_s_t([[maybe_unused]] X &x) override │ │ │ │ -665 { │ │ │ │ -666 } │ │ │ │ -667 │ │ │ │ -_6_6_9 _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 │ │ │ │ -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", │ │ │ │ -_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_>()); │ │ │ │ -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 void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override │ │ │ │ -814 {} │ │ │ │ -815 │ │ │ │ -_8_2_1 void _a_p_p_l_y (X& v, const Y& d) override │ │ │ │ -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 void _p_o_s_t ([[maybe_unused]] X& x) override │ │ │ │ -844 {} │ │ │ │ -845 │ │ │ │ -_8_4_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_e_g_o_r_y() const override │ │ │ │ -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", │ │ │ │ -_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_>()); │ │ │ │ -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 void _p_r_e ([[maybe_unused]] X& x, [[maybe_unused]] Y& b) override │ │ │ │ -921 {} │ │ │ │ -922 │ │ │ │ -_9_2_8 void _a_p_p_l_y (X& v, const Y& d) override │ │ │ │ -929 { │ │ │ │ -930 v = d; │ │ │ │ -931 v *= _w; │ │ │ │ -932 } │ │ │ │ -933 │ │ │ │ -_9_3_9 void _p_o_s_t ([[maybe_unused]] X& x) override │ │ │ │ -940 {} │ │ │ │ -941 │ │ │ │ -_9_4_3 _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 │ │ │ │ -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 opTraits, const auto& / │ │ │ │ -*op*/, const ParameterTree& config){ │ │ │ │ -953 using OpTraits = std::decay_t; │ │ │ │ -954 using D = typename OpTraits::domain_type; │ │ │ │ -955 using R = typename OpTraits::range_type; │ │ │ │ -956 return std::make_shared>(config); │ │ │ │ -957 }); │ │ │ │ -958 │ │ │ │ -959 │ │ │ │ -970 template< class M, class X, class Y > │ │ │ │ -_9_7_1 class _S_e_q_I_L_D_L │ │ │ │ -972 : public _P_r_e_c_o_n_d_i_t_i_o_n_e_r< X, Y > │ │ │ │ -973 { │ │ │ │ -974 typedef _S_e_q_I_L_D_L_<_ _M_,_ _X_,_ _Y_ _> This; │ │ │ │ -975 typedef _P_r_e_c_o_n_d_i_t_i_o_n_e_r_<_ _X_,_ _Y_ _> Base; │ │ │ │ -976 │ │ │ │ -977 public: │ │ │ │ -_9_7_9 typedef std::remove_const_t< M > _m_a_t_r_i_x___t_y_p_e; │ │ │ │ -_9_8_1 typedef X _d_o_m_a_i_n___t_y_p_e; │ │ │ │ -_9_8_3 typedef Y _r_a_n_g_e___t_y_p_e; │ │ │ │ -_9_8_5 typedef typename X::field_type _f_i_e_l_d___t_y_p_e; │ │ │ │ -_9_8_7 typedef Simd::Scalar _s_c_a_l_a_r___f_i_e_l_d___t_y_p_e; │ │ │ │ -_9_8_9 typedef typename FieldTraits::real_type _r_e_a_l___f_i_e_l_d___t_y_p_e; │ │ │ │ -990 │ │ │ │ -_1_0_0_3 _S_e_q_I_L_D_L (const std::shared_ptr>& A, │ │ │ │ -const ParameterTree& configuration) │ │ │ │ -1004 : _S_e_q_I_L_D_L(A->getmat(), configuration) │ │ │ │ -1005 {} │ │ │ │ -1006 │ │ │ │ -_1_0_1_9 _S_e_q_I_L_D_L(const _m_a_t_r_i_x___t_y_p_e& A, const ParameterTree& config) │ │ │ │ -1020 : _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)) │ │ │ │ -1021 {} │ │ │ │ -1022 │ │ │ │ -_1_0_3_1 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 ) ) │ │ │ │ -1032 : decomposition_( A.N(), A.M(), _m_a_t_r_i_x___t_y_p_e::random ), │ │ │ │ -1033 relax_( relax ) │ │ │ │ -1034 { │ │ │ │ -1035 // setup row sizes for lower triangular matrix │ │ │ │ -1036 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ -1037 { │ │ │ │ -1038 const auto &A_i = *i; │ │ │ │ -1039 const auto ij = A_i.find( i.index() ); │ │ │ │ -1040 if( ij != A_i.end() ) │ │ │ │ -1041 decomposition_.setrowsize( i.index(), ij.offset()+1 ); │ │ │ │ -1042 else │ │ │ │ -1043 DUNE_THROW( ISTLError, "diagonal entry missing" ); │ │ │ │ -1044 } │ │ │ │ -1045 decomposition_.endrowsizes(); │ │ │ │ -1046 │ │ │ │ -1047 // setup row indices for lower triangular matrix │ │ │ │ -1048 for( auto i = A.begin(), iend = A.end(); i != iend; ++i ) │ │ │ │ -1049 { │ │ │ │ -1050 const auto &A_i = *i; │ │ │ │ -1051 for( auto ij = A_i.begin(); ij.index() < i.index() ; ++ij ) │ │ │ │ -1052 decomposition_.addindex( i.index(), ij.index() ); │ │ │ │ -1053 decomposition_.addindex( i.index(), i.index() ); │ │ │ │ -1054 } │ │ │ │ -1055 decomposition_.endindices(); │ │ │ │ -1056 │ │ │ │ -1057 // copy values of lower triangular matrix │ │ │ │ -1058 auto i = A.begin(); │ │ │ │ -1059 for( auto row = decomposition_.begin(), rowend = decomposition_.end(); row │ │ │ │ -!= rowend; ++row, ++i ) │ │ │ │ -1060 { │ │ │ │ -1061 auto ij = i->begin(); │ │ │ │ -1062 for( auto col = row->begin(), colend = row->end(); col != colend; ++col, │ │ │ │ -++ij ) │ │ │ │ -1063 *col = *ij; │ │ │ │ -1064 } │ │ │ │ -1065 │ │ │ │ -1066 // perform ILDL decomposition │ │ │ │ -1067 _b_i_l_d_l___d_e_c_o_m_p_o_s_e( decomposition_ ); │ │ │ │ -1068 } │ │ │ │ -1069 │ │ │ │ -_1_0_7_1 void _p_r_e ([[maybe_unused]] X &x, [[maybe_unused]] Y &b) override │ │ │ │ -1072 {} │ │ │ │ -1073 │ │ │ │ -_1_0_7_5 void _a_p_p_l_y ( X &v, const Y &d ) override │ │ │ │ -1076 { │ │ │ │ -1077 _b_i_l_d_l___b_a_c_k_s_o_l_v_e( decomposition_, v, d, true ); │ │ │ │ -1078 v *= relax_; │ │ │ │ -1079 } │ │ │ │ -1080 │ │ │ │ -_1_0_8_2 void _p_o_s_t ([[maybe_unused]] X &x) override │ │ │ │ -1083 {} │ │ │ │ -1084 │ │ │ │ -_1_0_8_6 _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; } │ │ │ │ -1087 │ │ │ │ -1088 private: │ │ │ │ -1089 _m_a_t_r_i_x___t_y_p_e decomposition_; │ │ │ │ -1090 _r_e_a_l___f_i_e_l_d___t_y_p_e relax_; │ │ │ │ -1091 }; │ │ │ │ -_1_0_9_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("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_>()); │ │ │ │ -1093 │ │ │ │ -1095 │ │ │ │ -1096} // end namespace │ │ │ │ -1097 │ │ │ │ -1098 │ │ │ │ -1099#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:13 │ │ │ │ -_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. │ │ │ │ -_D_u_n_e_:_:_S_e_q_G_S │ │ │ │ -SeqSOR< M, X, Y, l > SeqGS │ │ │ │ -Sequential Gauss Seidel preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:399 │ │ │ │ -_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 │ │ │ │ -_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:34 │ │ │ │ -_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:55 │ │ │ │ +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_:_:_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:577 │ │ │ │ _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:90 │ │ │ │ _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:158 │ │ │ │ -_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:52 │ │ │ │ -_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:112 │ │ │ │ -_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:316 │ │ │ │ -_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:103 │ │ │ │ -_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:35 │ │ │ │ -_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:176 │ │ │ │ -_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:268 │ │ │ │ -_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:110 │ │ │ │ -_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_:_:_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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -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_:_:_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_:_:_p_o_s_t │ │ │ │ -void post(domain_type &) override │ │ │ │ -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_:_:_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_:_:_p_r_e │ │ │ │ -void pre(domain_type &, range_type &) override │ │ │ │ -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_:_:_a_p_p_l_y │ │ │ │ -void apply(domain_type &v, const range_type &d) override │ │ │ │ -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_:_:_p_r_e │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:209 │ │ │ │ -_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 │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:234 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:230 │ │ │ │ -_D_u_n_e_:_:_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_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:151 │ │ │ │ -_D_u_n_e_:_:_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_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:153 │ │ │ │ -_D_u_n_e_:_:_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_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:147 │ │ │ │ -_D_u_n_e_:_:_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_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:145 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_S_O_R_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:217 │ │ │ │ -_D_u_n_e_:_:_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_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -X range_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:149 │ │ │ │ -_D_u_n_e_:_:_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_ _>_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_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_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:368 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_:_:_m_a_t_r_i_x___t_y_p_e │ │ │ │ -M matrix_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:265 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_:_:_r_e_a_l___f_i_e_l_d___t_y_p_e │ │ │ │ -FieldTraits< scalar_field_type >::real_type real_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_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_:_:_d_o_m_a_i_n___t_y_p_e │ │ │ │ -X domain_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:267 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_:_:_s_c_a_l_a_r___f_i_e_l_d___t_y_p_e │ │ │ │ -Simd::Scalar< field_type > scalar_field_type │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:273 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:337 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_:_:_p_r_e │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:329 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_:_:_r_a_n_g_e___t_y_p_e │ │ │ │ -Y range_type │ │ │ │ -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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:372 │ │ │ │ -_D_u_n_e_:_:_S_e_q_S_O_R_<_ _M_,_ _X_,_ _Y_,_ _l_ _>_:_:_f_i_e_l_d___t_y_p_e │ │ │ │ -X::field_type field_type │ │ │ │ -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_:_:_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_:_:_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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:488 │ │ │ │ -_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 │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:504 │ │ │ │ -_D_u_n_e_:_:_S_e_q_J_a_c_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:500 │ │ │ │ -_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_:_:_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_:_:_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_:_:_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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:648 │ │ │ │ -_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_:_:_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_:_:_p_r_e │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:639 │ │ │ │ -_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_D_I_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:669 │ │ │ │ -_D_u_n_e_:_:_S_e_q_D_I_L_U_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:664 │ │ │ │ -_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_:_:_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_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -Clean up. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:843 │ │ │ │ -_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_:_:_p_r_e │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -Prepare the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:813 │ │ │ │ -_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_:_:_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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the preconditioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:821 │ │ │ │ -_D_u_n_e_:_:_S_e_q_I_L_U_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:847 │ │ │ │ -_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_:_:_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_:_:_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 │ │ │ │ -void pre(X &x, Y &b) override │ │ │ │ -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_:_:_a_p_p_l_y │ │ │ │ -void apply(X &v, const Y &d) override │ │ │ │ -Apply the precondioner. │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:928 │ │ │ │ -_D_u_n_e_:_:_R_i_c_h_a_r_d_s_o_n_:_:_p_o_s_t │ │ │ │ -void post(X &x) override │ │ │ │ -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_:_:_c_a_t_e_g_o_r_y │ │ │ │ -SolverCategory::Category category() const override │ │ │ │ -Category of the preconditioner (see SolverCategory::Category). │ │ │ │ -DDeeffiinniittiioonn preconditioners.hh:943 │ │ │ │ -_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:1019 │ │ │ │ -_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:1031 │ │ │ │ -_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:981 │ │ │ │ -_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:1082 │ │ │ │ -_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:983 │ │ │ │ -_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:979 │ │ │ │ -_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:1075 │ │ │ │ -_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:989 │ │ │ │ -_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:1003 │ │ │ │ -_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:1071 │ │ │ │ -_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:987 │ │ │ │ -_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:985 │ │ │ │ -_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:1086 │ │ │ │ -_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 │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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:566 │ │ │ │ +_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,41 +66,80 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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,19 +1,60 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,79 +66,1006 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ +
37
│ │ │ +
42 enum {
│ │ │ + │ │ │ +
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>
│ │ │ + │ │ │ +
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
│ │ │ + │ │ │ +
168
│ │ │ + │ │ │ +
174
│ │ │ + │ │ │ +
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 };
│ │ │ +
│ │ │ +
265
│ │ │ +
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<std::size_t>(*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
│ │ │ + │ │ │ +
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
│ │ │ +
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ +
bool hasCoarsest() const
Definition matrixhierarchy.hh:950
│ │ │ +
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:326
│ │ │ +
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:338
│ │ │ +
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 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
│ │ │ +
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ +
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
│ │ │ +
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:729
│ │ │ +
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
│ │ │ +
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition matrixhierarchy.hh:403
│ │ │ +
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.
│ │ │ +
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
│ │ │ +
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ +
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │ +
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition matrixhierarchy.hh:50
│ │ │
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
│ │ │ +
Definition novlpschwarz.hh:256
│ │ │ +
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:566
│ │ │ +
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
Definition hierarchy.hh:220
│ │ │ +
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Definition hierarchy.hh:223
│ │ │ +
Definition indicescoarsener.hh:36
│ │ │ +
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Definition matrixhierarchy.hh:85
│ │ │ +
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
Definition matrixhierarchy.hh:82
│ │ │ +
std::list< AggregatesMap *, AAllocator > AggregatesMapList
Definition matrixhierarchy.hh:88
│ │ │ +
ParallelInformation ParallelInformation
Definition matrixhierarchy.hh:70
│ │ │ +
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
Definition matrixhierarchy.hh:79
│ │ │ + │ │ │ +
RedistributeInformation< ParallelInformation > RedistributeInfoType
Definition matrixhierarchy.hh:91
│ │ │ +
double getProlongationDampingFactor() const
Definition matrixhierarchy.hh:188
│ │ │ +
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Definition matrixhierarchy.hh:94
│ │ │ +
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
Definition matrixhierarchy.hh:97
│ │ │ +
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
Definition matrixhierarchy.hh:76
│ │ │ +
MatrixOperator::matrix_type Matrix
Definition matrixhierarchy.hh:67
│ │ │ +
M MatrixOperator
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
│ │ │ +
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
│ │ │ +
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,1258 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ +31 { │ │ │ │ +37 │ │ │ │ +42 enum { │ │ │ │ +_5_0 _M_A_X___P_R_O_C_E_S_S_E_S = 72000 │ │ │ │ +51 }; │ │ │ │ +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 │ │ │ │ +_1_0_4 _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 }; │ │ │ │ +_1_0_7 _~_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 │ │ │ │ +_1_1_5 void _b_u_i_l_d(const T& criterion); │ │ │ │ +116 │ │ │ │ +124 template │ │ │ │ +_1_2_5 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 │ │ │ │ +_1_3_2 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 │ │ │ │ +_1_4_0 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 │ │ │ │ +_1_4_7 std::size_t _l_e_v_e_l_s() const; │ │ │ │ +148 │ │ │ │ +_1_5_3 std::size_t _m_a_x_l_e_v_e_l_s() const; │ │ │ │ +154 │ │ │ │ +_1_5_5 bool _h_a_s_C_o_a_r_s_e_s_t() const; │ │ │ │ +156 │ │ │ │ +_1_6_1 bool _i_s_B_u_i_l_t() const; │ │ │ │ +162 │ │ │ │ +_1_6_7 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 │ │ │ │ +_1_7_3 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 │ │ │ │ +_1_7_9 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 │ │ │ │ +_1_8_6 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 │ │ │ │ +_2_0_3 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 _c_a_l_c │ │ │ │ +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 _m_i_n=std::numeric_limits::max(); │ │ │ │ +250 _m_a_x=0; │ │ │ │ +251 _s_u_m=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 _m_i_n=std::min(_m_i_n, row.size()); │ │ │ │ +257 _m_a_x=std::max(_m_a_x, row.size()); │ │ │ │ +258 _s_u_m += 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 }; │ │ │ │ +265 │ │ │ │ +268 static void stats(const _M_a_t_r_i_x& matrix) │ │ │ │ +269 { │ │ │ │ +270 _c_a_l_c c= for_each(matrix.begin(), matrix.end(), _c_a_l_c()); │ │ │ │ +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->buildAggregates(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(endnoVertices()); │ │ │ │ +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 "<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::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 _l_e_v_e_l_s = matrices_.levels(); │ │ │ │ +725 maxlevels_ = parallelInformation_.finest()->communicator().max(_l_e_v_e_l_s); │ │ │ │ +726 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ +727 if(_h_a_s_C_o_a_r_s_e_s_t() && 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 _l_e_v_e_l_s=_a_g_g_r_e_g_a_t_e_s_M_a_p_s().size(); │ │ │ │ +750 int _m_a_x_l_e_v_e_l_s=parallelInformation_.finest()->communicator().max(_l_e_v_e_l_s); │ │ │ │ +751 std::size_t size=(*(_a_g_g_r_e_g_a_t_e_s_M_a_p_s().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(_l_e_v_e_l_s%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(_l_e_v_e_l_s==_m_a_x_l_e_v_e_l_s) { │ │ │ │ +772 const _A_g_g_r_e_g_a_t_e_s_M_a_p& map = *(*(++_a_g_g_r_e_g_a_t_e_s_M_a_p_s().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.begin(); iter != │ │ │ │ +map.end(); ++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 = _p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +().coarsest(); │ │ │ │ +796 --pinfo; │ │ │ │ +797 │ │ │ │ +798 // Now consecutively project the numbers to the finest level. │ │ │ │ +799 for(typename AggregatesMapList::const_reverse_iterator │ │ │ │ +aggregates=++_a_g_g_r_e_g_a_t_e_s_M_a_p_s().rbegin(); │ │ │ │ +800 aggregates != _a_g_g_r_e_g_a_t_e_s_M_a_p_s().rend(); ++aggregates,--_l_e_v_e_l_s) { │ │ │ │ +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(_m_a_x_l_e_v_e_l_s()>_l_e_v_e_l_s()) { │ │ │ │ +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 _l_e_v_e_l_s()==_m_a_x_l_e_v_e_l_s() && │ │ │ │ +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_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments │ │ │ │ +DDeeffiinniittiioonn smoother.hh:67 │ │ │ │ +_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_:_:_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 &) │ │ │ │ +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_:_:_l_e_v_e_l_s │ │ │ │ +std::size_t levels() const │ │ │ │ +Get the number of levels in the hierarchy. │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:326 │ │ │ │ +_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:338 │ │ │ │ +_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_:_:_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_:_:_I_S_O_L_A_T_E_D │ │ │ │ +static const V ISOLATED │ │ │ │ +Identifier of isolated vertices. │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:577 │ │ │ │ +_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_:_:_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:729 │ │ │ │ +_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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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 │ │ │ │ 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_:_:_A_m_g │ │ │ │ +DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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:566 │ │ │ │ +_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 │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:220 │ │ │ │ +_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 │ │ │ │ +DDeeffiinniittiioonn hierarchy.hh:223 │ │ │ │ +_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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_A_l_l_o_c_a_t_o_r │ │ │ │ +typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ +AggregatesMap * > AAllocator │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _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 │ │ │ │ +Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ +ParallelInformationHierarchy │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t │ │ │ │ +std::list< AggregatesMap *, AAllocator > AggregatesMapList │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ +ParallelInformation ParallelInformation │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_: │ │ │ │ +_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 │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ +A Allocator │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e │ │ │ │ +RedistributeInformation< ParallelInformation > RedistributeInfoType │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_R_I_L_A_l_l_o_c_a_t_o_r │ │ │ │ +typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ +RedistributeInfoType > RILAllocator │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_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 │ │ │ │ +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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ +Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > │ │ │ │ +AggregatesMap │ │ │ │ +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_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_M_a_t_r_i_x │ │ │ │ +MatrixOperator::matrix_type 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_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ +M MatrixOperator │ │ │ │ +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 │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:243 │ │ │ │ +_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_:_:_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,46 +74,40 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::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::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...
│ │ │ │ │ │ │ │ │ │ │ │

│ │ │ 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,37 +2,28 @@ │ │ │ │ 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_:_:_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_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_._._. │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,481 +71,334 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
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 }
│ │ │ -
│ │ │ -
74
│ │ │ -
│ │ │ - │ │ │ -
79 {
│ │ │ -
80 return rhs_;
│ │ │ -
81 }
│ │ │ -
│ │ │ -
82
│ │ │ -
│ │ │ - │ │ │ -
88 {
│ │ │ -
89 return lhs_;
│ │ │ -
90 }
│ │ │ -
│ │ │ -
91
│ │ │ -
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 }
│ │ │ -
│ │ │ + │ │ │ +
9#include "amg.hh"
│ │ │ +
10
│ │ │ +
11namespace Dune
│ │ │ +
12{
│ │ │ +
13 namespace Amg
│ │ │ +
14 {
│ │ │ +
15
│ │ │ +
25
│ │ │ +
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
│ │ │ +
52
│ │ │ +
│ │ │ + │ │ │ +
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;
│ │ │ + │ │ │ +
163 typedef typename Amg::ScalarProduct ScalarProduct;
│ │ │ +
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
│ │ │ -
│ │ │ - │ │ │ -
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 {}
│ │ │ -
│ │ │ -
256
│ │ │ -
│ │ │ - │ │ │ -
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) override
│ │ │ -
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) override
│ │ │ -
288 {
│ │ │ -
289 return apply(x,b,1e-8,res);
│ │ │ -
290 }
│ │ │ -
291
│ │ │ -
293 SolverCategory::Category category() const override
│ │ │ -
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
│ │ │ -
│ │ │ -
431 void pre(FineDomainType& x, FineRangeType& b) override
│ │ │ -
432 {
│ │ │ -
433 smoother_->pre(x,b);
│ │ │ -
434 }
│ │ │ -
│ │ │ -
435
│ │ │ -
│ │ │ -
436 void post([[maybe_unused]] FineDomainType& x) override
│ │ │ -
437 {}
│ │ │ -
│ │ │ -
438
│ │ │ -
│ │ │ -
439 void apply(FineDomainType& v, const FineRangeType& d) override
│ │ │ -
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.
│ │ │ -
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition amg.hh:802
│ │ │ -
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ -
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
Definition amg.hh:101
│ │ │ -
Operator Operator
Definition amg.hh:74
│ │ │ +
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 }
│ │ │ +
│ │ │ +
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:88
│ │ │ +
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
Definition amg.hh:101
│ │ │ +
M Operator
Definition amg.hh:74
│ │ │ +
void post(Domain &x)
Clean up.
Definition kamg.hh:293
│ │ │ +
X Range
The range type.
Definition amg.hh:90
│ │ │
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ +
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
Definition amg.hh:85
│ │ │ +
InverseOperator< X, X > CoarseSolver
Definition amg.hh:92
│ │ │
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
void apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition amg.hh:889
│ │ │ -
void calculate(const M &fine, const AggregatesMap< V > &aggregates, M &coarse, const I &pinfo, const O &copy)
Calculate the galerkin product.
│ │ │ +
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
Definition amg.hh:83
│ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition kamg.hh:253
│ │ │ +
PI ParallelInformation
Definition amg.hh:81
│ │ │
Definition allocator.hh:11
│ │ │ +
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │
Definition novlpschwarz.hh:256
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ +
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:66
│ │ │ -
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
│ │ │ -
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_
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_
Definition twolevelmethod.hh:132
│ │ │ -
CoarseRangeType 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
│ │ │ -
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
│ │ │ -
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
│ │ │ -
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 post(FineDomainType &x) override
Definition twolevelmethod.hh:436
│ │ │ -
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) override
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
│ │ │ -
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition twolevelmethod.hh:466
│ │ │ -
void pre(FineDomainType &x, FineRangeType &b) override
Definition twolevelmethod.hh:431
│ │ │ -
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
│ │ │ -
S SmootherType
The type of the fine level smoother.
Definition twolevelmethod.hh:388
│ │ │ +
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Definition hierarchy.hh:220
│ │ │ +
All parameters for AMG.
Definition parameters.hh:416
│ │ │
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 SolverCategory::Category category() const=0
│ │ │
Category
Definition solvercategory.hh:23
│ │ │ -
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
Generalized preconditioned conjugate gradient solver.
Definition solvers.hh:1308
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,661 +1,431 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -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 } │ │ │ │ -74 │ │ │ │ -_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 } │ │ │ │ -91 │ │ │ │ -_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 _A_m_g │ │ │ │ +14 { │ │ │ │ +15 │ │ │ │ +25 │ │ │ │ +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_.category(); │ │ │ │ +44 }; │ │ │ │ +45 │ │ │ │ +52 │ │ │ │ +_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_> │ │ │ │ -AggregatesMap; │ │ │ │ -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 Amg::ScalarProduct _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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,44 +73,77 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::Transfer< V, V1, SequentialInformation >
class  Dune::Amg::Transfer< V, V1, OwnerOverlapCopyCommunication< T1, T2 > >
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::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,32 +1,68 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_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_ _>_ _> │ │ │ │ +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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,250 +71,1842 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
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
│ │ │ -
25
│ │ │ -
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 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,
│ │ │ - │ │ │ +
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 {
│ │ │ +
36
│ │ │ +
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
│ │ │ +
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>
│ │ │ -
│ │ │ - │ │ │ -
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>
│ │ │ -
│ │ │ - │ │ │ -
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...
│ │ │ -
static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, const Vector &fine, OwnerOverlapCopyCommunication< T1, T2 > &comm)
Definition transfer.hh:181
│ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ -
static void prolongateVector(const AggregatesMap< Vertex > &aggregates, Vector &coarse, Vector &fine, Vector &fineRedist, T3 damp, OwnerOverlapCopyCommunication< T1, T2 > &comm, const Redist &redist)
Definition transfer.hh:156
│ │ │ +
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
│ │ │ +
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
│ │ │ +
499 EdgeIndexMap getEdgeIndexMap();
│ │ │ +
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
│ │ │ + │ │ │ +
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
│ │ │ + │ │ │ +
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 {}
│ │ │ +
│ │ │ +
1383
│ │ │ +
│ │ │ + │ │ │ +
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 {}
│ │ │ +
│ │ │ +
1431
│ │ │ +
│ │ │ + │ │ │ +
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
│ │ │ +
const Dtype_t BaseGetSuperLUType< T >::type
Definition supermatrix.hh:135
│ │ │
Definition novlpschwarz.hh:256
│ │ │ -
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:566
│ │ │ -
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
│ │ │ + │ │ │ +
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.
│ │ │ +
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.
│ │ │ + │ │ │ +
@ mutableMatrix
Definition graph.hh:86
│ │ │ +
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.
│ │ │ +
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.
│ │ │ + │ │ │ +
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.
│ │ │ + │ │ │ +
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.
│ │ │ +
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
│ │ │ +
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.
│ │ │ +
VertexIterator end()
Get an iterator over the vertices.
│ │ │ +
VertexPropertiesGraph(Graph &graph, const VertexMap vmap=VertexMap())
Constructor.
│ │ │ +
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.
│ │ │ +
VertexIteratorT< const VertexPropertiesGraph< Graph, VertexProperties, VM > > ConstVertexIterator
The type of the constant Vertex iterator.
Definition graph.hh:889
│ │ │ +
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.
│ │ │ +
VertexIteratorT< VertexPropertiesGraph< Graph, VertexProperties, VM > > VertexIterator
The type of the mutable Vertex iterator.
Definition graph.hh:883
│ │ │ +
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ +
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
│ │ │ +
VertexIteratorT(const Father &iter, C *graph)
Constructor.
│ │ │ +
std::conditional< std::is_same< VertexPropertiesGraph< Graph, VertexProperties, VM >, typenamestd::remove_const< VertexPropertiesGraph< Graph, VertexProperties, VM > >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
│ │ │ + │ │ │ +
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
│ │ │ + │ │ │ + │ │ │ +
EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > EdgeIterator
The type of the mutable edge iterator.
Definition graph.hh:1096
│ │ │ +
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.
│ │ │ +
EdgeIteratorT< const PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > ConstEdgeIterator
The type of the constant edge iterator.
Definition graph.hh:1103
│ │ │ + │ │ │ +
VertexIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > VertexIterator
The type of the mutable Vertex iterator.
Definition graph.hh:1212
│ │ │ +
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target)
Definition graph.hh:1265
│ │ │ + │ │ │ +
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
│ │ │ + │ │ │ +
VertexIteratorT< const PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > ConstVertexIterator
The type of the constant Vertex iterator.
Definition graph.hh:1219
│ │ │ +
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.
│ │ │ + │ │ │ + │ │ │ +
EdgeIteratorT(const Father &iter, C *graph)
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< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > >::type >::value, EdgeProperties &, constEdgeProperties & >::type properties() const
│ │ │ + │ │ │ +
std::conditional< std::is_same< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
│ │ │ +
EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > end() const
│ │ │ +
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
│ │ │ +
EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > begin() const
│ │ │ +
VertexIteratorT(const Father &iter, C *graph)
Constructor.
│ │ │ +
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
│ │ │ +
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,309 +1,2361 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -18 { │ │ │ │ -19 │ │ │ │ -25 │ │ │ │ -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 _A_m_g │ │ │ │ +21 { │ │ │ │ +36 │ │ │ │ +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 */ │ │ │ │ +_8_6 _m_u_t_a_b_l_e_M_a_t_r_i_x = std::is_same::type>::value │ │ │ │ +87 }; │ │ │ │ 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 _p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(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.end(); │ │ │ │ -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_> >_:_: │ │ │ │ -_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, │ │ │ │ -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 { │ │ │ │ +_1_1_2 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ +113 }; │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +_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>_:_:_t_y_p_e │ │ │ │ +_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>_:_:_t_y_p_e │ │ │ │ +_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_> >_:_: │ │ │ │ -_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r( │ │ │ │ -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_> >_:_: │ │ │ │ -_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, │ │ │ │ -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_:_:_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_s_t_r_i_c_t_V_e_c_t_o_r │ │ │ │ -static void restrictVector(const AggregatesMap< Vertex > &aggregates, Vector │ │ │ │ -&coarse, const Vector &fine, OwnerOverlapCopyCommunication< T1, T2 > &comm) │ │ │ │ -DDeeffiinniittiioonn transfer.hh:181 │ │ │ │ -_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:577 │ │ │ │ -_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_ _>_ _>_:_: │ │ │ │ -_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, T3 damp, │ │ │ │ -OwnerOverlapCopyCommunication< T1, T2 > &comm, const Redist &redist) │ │ │ │ -DDeeffiinniittiioonn transfer.hh:156 │ │ │ │ +_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 { │ │ │ │ +_2_2_5 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ +226 }; │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +_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 EdgeIndexMap _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>_:_:_t_y_p_e │ │ │ │ +803 { │ │ │ │ +804 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_t_y_p_e>; │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +_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>_:_:_t_y_p_e │ │ │ │ +_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&>_:_:_t_y_p_e │ │ │ │ +_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>_:_:_t_y_p_e │ │ │ │ +1038 { │ │ │ │ +1039 │ │ │ │ +1040 friend class _E_d_g_e_I_t_e_r_a_t_o_r_T_:_:_t_y_p_e>; │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +_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&>_:_:_t_y_p_e │ │ │ │ +_1_0_8_2 _p_r_o_p_e_r_t_i_e_s() 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 _b_e_g_i_n_E_d_g_e_s(const VertexDescriptor& source); │ │ │ │ +1111 │ │ │ │ +_1_1_1_7 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(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 _b_e_g_i_n_E_d_g_e_s(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 _e_n_d_E_d_g_e_s(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>_:_:_t_y_p_e │ │ │ │ +1140 { │ │ │ │ +1141 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_t_y_p_e>; │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +_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&>_:_:_t_y_p_e │ │ │ │ +_1_1_8_4 _p_r_o_p_e_r_t_i_e_s() const; │ │ │ │ +1185 │ │ │ │ +_1_1_9_1 _E_d_g_e_I_t_e_r_a_t_o_r_T _b_e_g_i_n() const; │ │ │ │ +1192 │ │ │ │ +_1_1_9_8 _E_d_g_e_I_t_e_r_a_t_o_r_T _e_n_d() 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 _b_e_g_i_n(); │ │ │ │ +1226 │ │ │ │ +_1_2_3_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ +1232 │ │ │ │ +_1_2_3_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; │ │ │ │ +1238 │ │ │ │ +_1_2_4_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ +1244 │ │ │ │ +_1_2_5_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); │ │ │ │ +1251 │ │ │ │ +_1_2_5_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; │ │ │ │ +1258 │ │ │ │ +_1_2_6_5 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(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& _g_r_a_p_h, 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 {} │ │ │ │ +1383 │ │ │ │ +_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 {} │ │ │ │ +1431 │ │ │ │ +_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 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r[graph.noEdges()]; │ │ │ │ +1988 │ │ │ │ +1989 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* 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._e_n_d(); │ │ │ │ +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&>_:_:_t_y_p_e │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ +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&>_:_:_t_y_p_e │ │ │ │ +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&>_:_:_t_y_p_e │ │ │ │ +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_:_:_t_y_p_e │ │ │ │ +const Dtype_t BaseGetSuperLUType< T >::type │ │ │ │ +DDeeffiinniittiioonn supermatrix.hh:135 │ │ │ │ _D_u_n_e_:_:_A_m_g │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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:566 │ │ │ │ -_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_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ +_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_:_:_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_<_ _c_o_n_s_t_ _M_a_t_r_i_x_ _>_:_:_m_a_t_r_i_x │ │ │ │ +Matrix & matrix() │ │ │ │ +_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_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 │ │ │ │ +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_:_:_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_<_ _c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_ _M_a_t_r_i_x_ _>_ _>_:_:_s_o_u_r_c_e │ │ │ │ +VertexDescriptor source() const │ │ │ │ +_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_:_:_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_ _>_ _>_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ +@ isMutable │ │ │ │ +DDeeffiinniittiioonn graph.hh:112 │ │ │ │ +_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_<_ _c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_ _M_a_t_r_i_x_ _>_ _>_:_: │ │ │ │ +_i_s_M_u_t_a_b_l_e │ │ │ │ +@ isMutable │ │ │ │ +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_:_:_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_:_:_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_:_:_e_n_d │ │ │ │ +VertexIterator end() │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_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_G_r_a_p_h │ │ │ │ +VertexPropertiesGraph(Graph &graph, const VertexMap vmap=VertexMap()) │ │ │ │ +Constructor. │ │ │ │ +_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_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIteratorT< const VertexPropertiesGraph< Graph, VertexProperties, VM > > │ │ │ │ +ConstVertexIterator │ │ │ │ +The type of the constant Vertex iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:889 │ │ │ │ +_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_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ +VertexIteratorT< VertexPropertiesGraph< Graph, VertexProperties, VM > > │ │ │ │ +VertexIterator │ │ │ │ +The type of the mutable Vertex iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:883 │ │ │ │ +_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 │ │ │ │ +VertexIterator begin() │ │ │ │ +Get an iterator over the vertices. │ │ │ │ +_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_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +VertexIteratorT(const Father &iter, C *graph) │ │ │ │ +Constructor. │ │ │ │ +_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_<_ _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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _V_M_ _>_ _>_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ +std::conditional< std::is_same< VertexPropertiesGraph< Graph, VertexProperties, │ │ │ │ +VM >, typenamestd::remove_const< VertexPropertiesGraph< Graph, │ │ │ │ +VertexProperties, VM > >::type >::value, VertexProperties &, │ │ │ │ +constVertexProperties & >::type properties() const │ │ │ │ +_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_<_ _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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _V_M_ _>_ _>_:_:_e_n_d │ │ │ │ +EdgeIterator end() const │ │ │ │ +_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_<_ _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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _V_M_ _>_ _>_:_:_b_e_g_i_n │ │ │ │ +EdgeIterator begin() const │ │ │ │ +_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ +_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_e_n_d │ │ │ │ +VertexIterator end() │ │ │ │ +_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 │ │ │ │ +EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM │ │ │ │ +> > EdgeIterator │ │ │ │ +The type of the mutable edge iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1096 │ │ │ │ +_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_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ +EdgeIteratorT< const PropertiesGraph< Graph, VertexProperties, EdgeProperties, │ │ │ │ +VM, EM > > ConstEdgeIterator │ │ │ │ +The type of the constant edge iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1103 │ │ │ │ +_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ +_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ +EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ +_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 │ │ │ │ +VertexIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, │ │ │ │ +EM > > VertexIterator │ │ │ │ +The type of the mutable Vertex iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1212 │ │ │ │ +_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ +_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_f_i_n_d_E_d_g_e │ │ │ │ +EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ +&target) │ │ │ │ +DDeeffiinniittiioonn graph.hh:1265 │ │ │ │ +_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ +_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_e_n_d_E_d_g_e_s │ │ │ │ +EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ +_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_<_ _S_u_b_G_r_a_p_h_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ +_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_b_e_g_i_n │ │ │ │ +VertexIterator begin() │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_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 PropertiesGraph< Graph, VertexProperties, │ │ │ │ +EdgeProperties, VM, EM > > ConstVertexIterator │ │ │ │ +The type of the constant Vertex iterator. │ │ │ │ +DDeeffiinniittiioonn graph.hh:1219 │ │ │ │ +_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_<_ _S_u_b_G_r_a_p_h_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ +_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ +VertexProperties & getVertexProperties(const VertexDescriptor &vertex) │ │ │ │ +_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_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ +EdgeIteratorT(const Father &iter, C *graph) │ │ │ │ +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_:_:_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_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_<_ _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ +std::conditional< std::is_same< PropertiesGraph< Graph, VertexProperties, │ │ │ │ +EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, │ │ │ │ +VertexProperties, EdgeProperties, VM, EM > >::type >::value, EdgeProperties &, │ │ │ │ +constEdgeProperties & >::type properties() const │ │ │ │ +_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_<_ _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ +std::conditional< std::is_same< PropertiesGraph< Graph, VertexProperties, │ │ │ │ +EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, │ │ │ │ +VertexProperties, EdgeProperties, VM, EM > >::type >::value, VertexProperties │ │ │ │ +&, constVertexProperties & >::type properties() const │ │ │ │ +_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_<_ _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_e_n_d │ │ │ │ +EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM │ │ │ │ +> > end() const │ │ │ │ +_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_:_:_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_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ +_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_b_e_g_i_n │ │ │ │ +EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM │ │ │ │ +> > begin() const │ │ │ │ +_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_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ +VertexIteratorT(const Father &iter, C *graph) │ │ │ │ +Constructor. │ │ │ │ +_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,90 +73,34 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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>
│ │ │ +#include <dune/common/typetraits.hh>
│ │ │
│ │ │

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::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::GaussSeidelPresmoothDefect< level >
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,80 +1,20 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ +#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_:_:_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 _A_r_g_u_m_e_n_t_s 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_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,1129 +71,156 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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>
│ │ │ +
8#include <cstddef>
│ │ │ +
9#include <dune/common/typetraits.hh>
│ │ │ +
10
│ │ │ +
11namespace Dune
│ │ │ +
12{
│ │ │ +
13 namespace Amg
│ │ │ +
14 {
│ │ │
15
│ │ │ -
16namespace Dune
│ │ │ -
17{
│ │ │ -
18 namespace Amg
│ │ │ -
19 {
│ │ │ -
20
│ │ │ -
26
│ │ │ -
32
│ │ │ -
36 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
38 {
│ │ │ -
42 typedef typename FieldTraits<T>::real_type RelaxationFactor;
│ │ │ -
43
│ │ │ - │ │ │ - │ │ │ -
52
│ │ │ -
│ │ │ - │ │ │ - │ │ │ -
58 {}
│ │ │ -
│ │ │ -
59 };
│ │ │ -
│ │ │ -
60
│ │ │ -
64 template<class T>
│ │ │ -
│ │ │ - │ │ │ -
66 {
│ │ │ - │ │ │ +
16 template<std::size_t level>
│ │ │ +
│ │ │ + │ │ │ +
18
│ │ │ +
19 template<typename M, typename X, typename Y>
│ │ │ +
│ │ │ +
20 static void apply(const M& A, X& x, Y& d,
│ │ │ +
21 const Y& b)
│ │ │ +
22 {
│ │ │ +
23 typedef typename M::ConstRowIterator RowIterator;
│ │ │ +
24 typedef typename M::ConstColIterator ColIterator;
│ │ │ +
25
│ │ │ +
26 typename Y::iterator dIter=d.begin();
│ │ │ +
27 typename Y::const_iterator bIter=b.begin();
│ │ │ +
28 typename X::iterator xIter=x.begin();
│ │ │ +
29
│ │ │ +
30 for(RowIterator row=A.begin(), end=A.end(); row != end;
│ │ │ +
31 ++row, ++dIter, ++xIter, ++bIter)
│ │ │ +
32 {
│ │ │ +
33 ColIterator col=(*row).begin();
│ │ │ +
34 *dIter = *bIter;
│ │ │ +
35
│ │ │ +
36 for (; col.index()<row.index(); ++col)
│ │ │ +
37 {
│ │ │ +
38 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ +
39 *dIter -= (*col)*x[col.index()];
│ │ │ +
40 else
│ │ │ +
41 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ +
42 }
│ │ │ +
43 assert(row.index()==col.index());
│ │ │ +
44 ColIterator diag=col; // upper diagonal matrix not needed as x was 0 before.
│ │ │ +
45
│ │ │ +
46 // Not recursive yet. Just solve with the diagonal
│ │ │ +
47 if constexpr (Dune::IsNumber<std::decay_t<decltype(*diag)>>::value)
│ │ │ +
48 *xIter = (*dIter)/(*diag);
│ │ │ +
49 else
│ │ │ +
50 diag->solve(*xIter,*dIter);
│ │ │ +
51
│ │ │ +
52 *dIter=0; //as r=v
│ │ │ +
53
│ │ │ +
54 // Update residual for the symmetric case
│ │ │ +
55 for(col=(*row).begin(); col.index()<row.index(); ++col)
│ │ │ +
56 {
│ │ │ +
57 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ +
58 d[col.index()] -= (*col)*(*xIter);
│ │ │ +
59 else
│ │ │ +
60 col->mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ +
61 }
│ │ │ +
62 }
│ │ │ +
63 }
│ │ │ +
│ │ │ +
64 };
│ │ │ +
│ │ │ +
65
│ │ │ +
66 template<std::size_t level>
│ │ │ +
│ │ │ + │ │ │
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
│ │ │ -
96 typedef typename SmootherTraits<T>::Arguments SmootherArgs;
│ │ │ -
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 }
│ │ │ -
│ │ │ +
69 template<typename M, typename X, typename Y>
│ │ │ +
│ │ │ +
70 static void apply(const M& A, X& x, Y& d,
│ │ │ +
71 const Y& b)
│ │ │ +
72 {
│ │ │ +
73 typedef typename M::ConstRowIterator RowIterator;
│ │ │ +
74 typedef typename M::ConstColIterator ColIterator;
│ │ │ +
75 typedef typename Y::block_type YBlock;
│ │ │ +
76
│ │ │ +
77 typename Y::iterator dIter=d.beforeEnd();
│ │ │ +
78 typename X::iterator xIter=x.beforeEnd();
│ │ │ +
79 typename Y::const_iterator bIter=b.beforeEnd();
│ │ │ +
80
│ │ │ +
81 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
│ │ │ +
82 --row, --dIter, --xIter, --bIter)
│ │ │ +
83 {
│ │ │ +
84 ColIterator endCol=(*row).beforeBegin();
│ │ │ +
85 ColIterator col=(*row).beforeEnd();
│ │ │ +
86 *dIter = *bIter;
│ │ │ +
87
│ │ │ +
88 for (; col.index()>row.index(); --col)
│ │ │ +
89 {
│ │ │ +
90 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ +
91 *dIter -= (*col)*x[col.index()];
│ │ │ +
92 else
│ │ │ +
93 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ +
94 }
│ │ │ +
95 assert(row.index()==col.index());
│ │ │ +
96 ColIterator diag=col;
│ │ │ +
97 YBlock v=*dIter;
│ │ │ +
98 // upper diagonal matrix
│ │ │ +
99 for (--col; col!=endCol; --col)
│ │ │ +
100 {
│ │ │ +
101 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ +
102 v -= (*col)*x[col.index()];
│ │ │ +
103 else
│ │ │ +
104 (*col).mmv(x[col.index()],v); // v -= sum_{j<i} a_ij * xold_j
│ │ │ +
105 }
│ │ │ +
106
│ │ │ +
107 // Not recursive yet. Just solve with the diagonal
│ │ │ +
108 if constexpr (Dune::IsNumber<std::decay_t<decltype(*diag)>>::value)
│ │ │ +
109 *xIter = v/(*diag);
│ │ │ +
110 else
│ │ │ +
111 diag->solve(*xIter,v);
│ │ │
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
│ │ │ -
177 typedef typename SmootherTraits<T>::Arguments SmootherArgs;
│ │ │ -
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>
│ │ │ -
│ │ │ - │ │ │ -
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>
│ │ │ -
│ │ │ - │ │ │ -
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>
│ │ │ -
│ │ │ - │ │ │ -
336 {
│ │ │ - │ │ │ - │ │ │ -
│ │ │ -
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>
│ │ │ -
│ │ │ - │ │ │ -
348 {
│ │ │ - │ │ │ - │ │ │ -
│ │ │ -
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>
│ │ │ -
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
DefaultSmootherArgs< typename Smoother::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
│ │ │ - │ │ │ -
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
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
│ │ │ - │ │ │ -
int setAggregate(const AggregateDescriptor &)
Definition smoother.hh:691
│ │ │ -
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
│ │ │ - │ │ │ -
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:731
│ │ │ -
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:741
│ │ │ -
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:736
│ │ │ -
const SequentialInformation & getComm()
Definition smoother.hh:128
│ │ │ -
VertexDescriptor AggregateDescriptor
Definition aggregates.hh:586
│ │ │ -
static const VertexDescriptor ISOLATED
Definition aggregates.hh:577
│ │ │ -
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
Definition aggregates.hh:598
│ │ │ -
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
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
│ │ │ - │ │ │ -
Smoother::range_type Range
Definition smoother.hh:372
│ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ - │ │ │ +
113 *dIter-=v;
│ │ │ +
114
│ │ │ +
115 // Update residual for the symmetric case
│ │ │ +
116 // Skip residual computation as it is not needed.
│ │ │ +
117 //for(col=(*row).begin();col.index()<row.index(); ++col)
│ │ │ +
118 //col.mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ +
119 }
│ │ │ +
120 }
│ │ │ +
│ │ │ +
121 };
│ │ │ +
│ │ │ +
122 } // end namespace Amg
│ │ │ +
123} // end namespace Dune
│ │ │ +
124#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
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │
Definition novlpschwarz.hh:256
│ │ │ - │ │ │ -
Sequential overlapping Schwarz preconditioner.
Definition overlappingschwarz.hh:755
│ │ │ - │ │ │ - │ │ │ -
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
│ │ │ -
Traits class for generically constructing non default constructable types.
Definition construction.hh:39
│ │ │ -
Nonoverlapping parallel preconditioner.
Definition novlpschwarz.hh:276
│ │ │ -
SeqSOR< M, X, Y, l >::range_type range_type
Definition novlpschwarz.hh:284
│ │ │ -
SeqSOR< M, X, Y, l >::domain_type domain_type
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:566
│ │ │ -
The (undirected) graph of a matrix.
Definition graph.hh:51
│ │ │ -
VertexIterator end()
Get an iterator over the vertices.
│ │ │ -
VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:308
│ │ │ -
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
│ │ │ -
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ -
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
Definition preconditioners.hh:267
│ │ │ -
Y range_type
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
│ │ │ - │ │ │ - │ │ │ +
Definition fastamgsmoother.hh:17
│ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:20
│ │ │ +
Definition fastamgsmoother.hh:67
│ │ │ +
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:70
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,1346 +1,154 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10 │ │ │ │ +11namespace _D_u_n_e │ │ │ │ +12{ │ │ │ │ +13 namespace _A_m_g │ │ │ │ +14 { │ │ │ │ 15 │ │ │ │ -16namespace _D_u_n_e │ │ │ │ -17{ │ │ │ │ -18 namespace _A_m_g │ │ │ │ -19 { │ │ │ │ -20 │ │ │ │ -26 │ │ │ │ -32 │ │ │ │ -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; │ │ │ │ +16 template │ │ │ │ +_1_7 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 { │ │ │ │ +18 │ │ │ │ +19 template │ │ │ │ +_2_0 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ +21 const Y& b) │ │ │ │ +22 { │ │ │ │ +23 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ +24 typedef typename M::ConstColIterator ColIterator; │ │ │ │ +25 │ │ │ │ +26 typename Y::iterator dIter=d.begin(); │ │ │ │ +27 typename Y::const_iterator bIter=b.begin(); │ │ │ │ +28 typename X::iterator xIter=x.begin(); │ │ │ │ +29 │ │ │ │ +30 for(RowIterator row=A.begin(), end=A.end(); row != end; │ │ │ │ +31 ++row, ++dIter, ++xIter, ++bIter) │ │ │ │ +32 { │ │ │ │ +33 ColIterator _c_o_l=(*row).begin(); │ │ │ │ +34 *dIter = *bIter; │ │ │ │ +35 │ │ │ │ +36 for (; _c_o_l.index()>::value) │ │ │ │ +39 *dIter -= (*_c_o_l)*x[_c_o_l.index()]; │ │ │ │ +40 else │ │ │ │ +41 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{j>::value) │ │ │ │ +48 *xIter = (*dIter)/(*diag); │ │ │ │ +49 else │ │ │ │ +50 diag->solve(*xIter,*dIter); │ │ │ │ +51 │ │ │ │ +52 *dIter=0; //as r=v │ │ │ │ +53 │ │ │ │ +54 // Update residual for the symmetric case │ │ │ │ +55 for(_c_o_l=(*row).begin(); _c_o_l.index()>::value) │ │ │ │ +58 d[_c_o_l.index()] -= (*col)*(*xIter); │ │ │ │ +59 else │ │ │ │ +60 _c_o_l->mmv(*xIter, d[_c_o_l.index()]); //d_j-=A_ij x_i │ │ │ │ +61 } │ │ │ │ +62 } │ │ │ │ +63 } │ │ │ │ +64 }; │ │ │ │ +65 │ │ │ │ +66 template │ │ │ │ +_6_7 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 { │ │ │ │ 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 {}; │ │ │ │ +69 template │ │ │ │ +_7_0 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ +71 const Y& b) │ │ │ │ +72 { │ │ │ │ +73 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ +74 typedef typename M::ConstColIterator ColIterator; │ │ │ │ +75 typedef typename Y::block_type YBlock; │ │ │ │ +76 │ │ │ │ +77 typename Y::iterator dIter=d.beforeEnd(); │ │ │ │ +78 typename X::iterator xIter=x.beforeEnd(); │ │ │ │ +79 typename Y::const_iterator bIter=b.beforeEnd(); │ │ │ │ +80 │ │ │ │ +81 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end; │ │ │ │ +82 --row, --dIter, --xIter, --bIter) │ │ │ │ +83 { │ │ │ │ +84 ColIterator endCol=(*row).beforeBegin(); │ │ │ │ +85 ColIterator _c_o_l=(*row).beforeEnd(); │ │ │ │ +86 *dIter = *bIter; │ │ │ │ 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 SmootherArgs; │ │ │ │ -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> AggregatesMap; │ │ │ │ -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 │ │ │ │ -AggregatesMap& amap) │ │ │ │ -109 { │ │ │ │ -110 _s_e_t_M_a_t_r_i_x(matrix); │ │ │ │ -111 } │ │ │ │ +88 for (; _c_o_l.index()>row.index(); --_c_o_l) │ │ │ │ +89 { │ │ │ │ +90 if constexpr (Dune::IsNumber>::value) │ │ │ │ +91 *dIter -= (*_c_o_l)*x[_c_o_l.index()]; │ │ │ │ +92 else │ │ │ │ +93 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{j>::value) │ │ │ │ +102 v -= (*_c_o_l)*x[_c_o_l.index()]; │ │ │ │ +103 else │ │ │ │ +104 (*col).mmv(x[_c_o_l.index()],v); // v -= sum_{j>::value) │ │ │ │ +109 *xIter = v/(*diag); │ │ │ │ +110 else │ │ │ │ +111 diag->solve(*xIter,v); │ │ │ │ 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 SmootherArgs& 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 SmootherArgs _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 SmootherArgs* 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 SmootherArgs; │ │ │ │ -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 SmootherArgs& 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 SmootherArgs _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 _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 > │ │ │ │ -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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s<_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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s<_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 _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 > │ │ │ │ -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().relaxationFactor); │ │ │ │ -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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s<_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 _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 > │ │ │ │ -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 _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 > │ │ │ │ -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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_> _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 = _S_e_q_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(args); │ │ │ │ -342 return std::make_shared> (seqPrec, │ │ │ │ -args._g_e_t_C_o_m_m()); │ │ │ │ -343 } │ │ │ │ -344 }; │ │ │ │ -345 │ │ │ │ -346 template │ │ │ │ -_3_4_7 struct _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 > │ │ │ │ -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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_> _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 = _S_e_q_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(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_> > │ │ │ │ -Father; │ │ │ │ -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 _F_a_t_h_e_r_:_:_s_e_t_M_a_t_r_i_x(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_> │ │ │ │ -SmootherArgs; │ │ │ │ -579 │ │ │ │ -580 switch(_F_a_t_h_e_r_:_:_g_e_t_A_r_g_s().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 _F_a_t_h_e_r_:_:_s_e_t_M_a_t_r_i_x(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_> │ │ │ │ -SmootherArgs; │ │ │ │ -624 │ │ │ │ -625 switch(_F_a_t_h_e_r_:_:_g_e_t_A_r_g_s().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()]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) │ │ │ │ -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()]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ -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 _s_i_z_e___t_y_p_e; │ │ │ │ -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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,36 +73,32 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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,22 +1,20 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,120 +71,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.
│ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ +
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
│ │ │
Definition novlpschwarz.hh:256
│ │ │ -
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:566
│ │ │ -
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
│ │ │ +
CombinedFunctor(const T &tuple_)
Definition combinedfunctor.hh:38
│ │ │ +
void operator()(const T1 &t)
Definition combinedfunctor.hh:43
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,137 +1,82 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ 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 : _n_u_m_b_e_r__(0), _a_g_g_r_e_g_a_t_e_s__(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 _n_u_m_b_e_r__; │ │ │ │ -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 _a_g_g_r_e_g_a_t_e_s__[edge.target()]=_n_u_m_b_e_r__; │ │ │ │ -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 ++_n_u_m_b_e_r__; │ │ │ │ -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_:_:_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:577 │ │ │ │ +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 │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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:566 │ │ │ │ -_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,38 +74,45 @@ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::RandomAccessBundledPropertyMap< C, K, i, T, R >
 A property map that extracts one property out of a bundle using operator[](). 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::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,28 +2,37 @@ │ │ │ │ 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_:_:_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_:_:_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,96 +71,481 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
24
│ │ │ -
│ │ │ - │ │ │ -
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 {
│ │ │ - │ │ │ -
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
│ │ │ +
74
│ │ │
│ │ │ - │ │ │ -
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 }
│ │ │ +
│ │ │ +
91
│ │ │ +
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 {}
│ │ │ +
│ │ │ +
256
│ │ │ +
│ │ │ + │ │ │ +
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) override
│ │ │ +
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) override
│ │ │ +
288 {
│ │ │ +
289 return apply(x,b,1e-8,res);
│ │ │ +
290 }
│ │ │ +
291
│ │ │ +
293 SolverCategory::Category category() const override
│ │ │ +
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
│ │ │ +
│ │ │ +
431 void pre(FineDomainType& x, FineRangeType& b) override
│ │ │ +
432 {
│ │ │ +
433 smoother_->pre(x,b);
│ │ │ +
434 }
│ │ │ +
│ │ │ +
435
│ │ │ +
│ │ │ +
436 void post([[maybe_unused]] FineDomainType& x) override
│ │ │ +
437 {}
│ │ │ +
│ │ │ +
438
│ │ │ +
│ │ │ +
439 void apply(FineDomainType& v, const FineRangeType& d) override
│ │ │ +
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.
│ │ │ +
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition amg.hh:802
│ │ │ +
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ +
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
Definition amg.hh:101
│ │ │ +
Operator Operator
Definition amg.hh:74
│ │ │ +
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 apply(Domain &v, const Range &d)
Apply one step of the preconditioner to the system A(v)=d.
Definition amg.hh:889
│ │ │ +
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
│ │ │
Definition novlpschwarz.hh:256
│ │ │ -
Tag idnetifying the visited property of a vertex.
Definition properties.hh:29
│ │ │ +
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ +
Parallel algebraic multigrid based on agglomeration.
Definition amg.hh:66
│ │ │ +
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
│ │ │ +
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_
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_
Definition twolevelmethod.hh:132
│ │ │ +
CoarseRangeType 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
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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 post(FineDomainType &x) override
Definition twolevelmethod.hh:436
│ │ │ +
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) override
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
│ │ │ +
SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category).
Definition twolevelmethod.hh:466
│ │ │ +
void pre(FineDomainType &x, FineRangeType &b) override
Definition twolevelmethod.hh:431
│ │ │ +
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
│ │ │ +
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 SolverCategory::Category category() const=0
│ │ │ +
Category
Definition solvercategory.hh:23
│ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,110 +1,661 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -14 { │ │ │ │ -24 │ │ │ │ -_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 { │ │ │ │ -_6_1 _i_n_d_e_x = i │ │ │ │ -62 }; │ │ │ │ -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 _A_m_g │ │ │ │ +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 } │ │ │ │ +74 │ │ │ │ +_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 } │ │ │ │ +91 │ │ │ │ +_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_> │ │ │ │ +AggregatesMap; │ │ │ │ +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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,39 +73,55 @@ │ │ │ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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,25 +1,38 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,168 +71,415 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ +
26
│ │ │ +
│ │ │ + │ │ │ +
31 {
│ │ │ +
32 public:
│ │ │
│ │ │ - │ │ │ - │ │ │ -
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 {}
│ │ │ + │ │ │ +
35 : alpha_(1.0/3.0), beta_(1.0E-5)
│ │ │ +
36 {}
│ │ │ +
│ │ │ +
37
│ │ │ +
│ │ │ +
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 }
│ │ │ -
│ │ │ -
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
│ │ │ - │ │ │ +
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;
│ │ │ +
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 }
│ │ │ +
│ │ │ +
137
│ │ │ +
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 }
│ │ │ +
│ │ │ +
266
│ │ │ +
│ │ │ +
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 }
│ │ │ +
│ │ │ +
315
│ │ │ +
│ │ │ + │ │ │ +
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 }
│ │ │ +
│ │ │ +
359
│ │ │ +
│ │ │ + │ │ │ +
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 }
│ │ │ +
│ │ │ +
447
│ │ │ +
│ │ │ +
451 std::size_t getNoPreSmoothSteps() const
│ │ │ +
452 {
│ │ │ +
453 return preSmoothSteps_;
│ │ │ +
454 }
│ │ │ +
│ │ │ +
455
│ │ │ +
│ │ │ +
460 void setNoPostSmoothSteps(std::size_t steps)
│ │ │ +
461 {
│ │ │ +
462 postSmoothSteps_=steps;
│ │ │ +
463 }
│ │ │ +
│ │ │ +
464
│ │ │ +
│ │ │ +
468 std::size_t getNoPostSmoothSteps() const
│ │ │ +
469 {
│ │ │ +
470 return postSmoothSteps_;
│ │ │ +
471 }
│ │ │ +
│ │ │ +
472
│ │ │ +
│ │ │ +
476 void setGamma(std::size_t gamma)
│ │ │ +
477 {
│ │ │ +
478 gamma_=gamma;
│ │ │ +
479 }
│ │ │ +
│ │ │ +
480
│ │ │ +
│ │ │ +
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 novlpschwarz.hh:256
│ │ │ -
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,181 +1,484 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -25 { │ │ │ │ +8#include │ │ │ │ +9 │ │ │ │ +10namespace _D_u_n_e │ │ │ │ +11{ │ │ │ │ +12 namespace _A_m_g │ │ │ │ +13 { │ │ │ │ 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 } │ │ │ │ +_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 } │ │ │ │ +137 │ │ │ │ +_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, │ │ │ │ +_2_4_7 _s_u_c_c_e_s_s_i_v_e_A_c_c_u=2 │ │ │ │ +248 }; │ │ │ │ +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 } │ │ │ │ +266 │ │ │ │ +_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 } │ │ │ │ +315 │ │ │ │ +_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 } │ │ │ │ +359 │ │ │ │ +_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 } │ │ │ │ +447 │ │ │ │ +_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 } │ │ │ │ +464 │ │ │ │ +_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 } │ │ │ │ +480 │ │ │ │ +_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 │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,54 +73,46 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::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...
class  Dune::Amg::IndicesCoarsener< T, E >
class  Dune::Amg::ParallelIndicesCoarsener< T, E >
class  Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E >
 Coarsen Indices in the parallel case. 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,38 +1,36 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_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_._._. │ │ │ │ +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_:_:_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_:_:_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,415 +71,447 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
26
│ │ │ -
│ │ │ - │ │ │ -
31 {
│ │ │ -
32 public:
│ │ │ -
│ │ │ - │ │ │ -
35 : alpha_(1.0/3.0), beta_(1.0E-5)
│ │ │ -
36 {}
│ │ │ -
│ │ │ -
37
│ │ │ -
│ │ │ -
42 void setBeta(double b)
│ │ │ -
43 {
│ │ │ -
44 beta_ = b;
│ │ │ -
45 }
│ │ │ -
│ │ │ -
46
│ │ │ -
│ │ │ -
52 double beta() const
│ │ │ -
53 {
│ │ │ -
54 return beta_;
│ │ │ -
55 }
│ │ │ -
│ │ │ +
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
│ │ │ +
33
│ │ │ +
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
│ │ │ -
│ │ │ -
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 }
│ │ │ -
│ │ │ -
137
│ │ │ -
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 };
│ │ │ -
│ │ │ +
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
│ │ │ +
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 }
│ │ │ -
│ │ │ -
266
│ │ │ -
│ │ │ -
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 }
│ │ │ -
│ │ │ -
315
│ │ │ -
│ │ │ - │ │ │ -
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 }
│ │ │ -
│ │ │ -
359
│ │ │ -
│ │ │ - │ │ │ -
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 }
│ │ │ -
│ │ │ -
447
│ │ │ -
│ │ │ -
451 std::size_t getNoPreSmoothSteps() const
│ │ │ -
452 {
│ │ │ -
453 return preSmoothSteps_;
│ │ │ -
454 }
│ │ │ -
│ │ │ -
455
│ │ │ -
│ │ │ -
460 void setNoPostSmoothSteps(std::size_t steps)
│ │ │ -
461 {
│ │ │ -
462 postSmoothSteps_=steps;
│ │ │ -
463 }
│ │ │ -
│ │ │ -
464
│ │ │ -
│ │ │ -
468 std::size_t getNoPostSmoothSteps() const
│ │ │ -
469 {
│ │ │ -
470 return postSmoothSteps_;
│ │ │ -
471 }
│ │ │ -
│ │ │ -
472
│ │ │ -
│ │ │ -
476 void setGamma(std::size_t gamma)
│ │ │ -
477 {
│ │ │ -
478 gamma_=gamma;
│ │ │ -
479 }
│ │ │ -
│ │ │ -
480
│ │ │ -
│ │ │ -
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,
│ │ │ + │ │ │ +
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
│ │ │ +
static Graph::VertexDescriptor coarsen(const SequentialInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, SequentialInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates, bool useFixedOrder=false)
Definition indicescoarsener.hh:396
│ │ │ +
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:577
│ │ │ +
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
│ │ │ +
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 novlpschwarz.hh:256
│ │ │ +
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:566
│ │ │ +
Definition indicescoarsener.hh:36
│ │ │ +
Definition indicescoarsener.hh:43
│ │ │ +
Definition pinfo.hh:28
│ │ │ +
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
│ │ │ +
AggregateRenumberer(AggregatesMap< Vertex > &aggregates)
Constructor.
Definition renumberer.hh:40
│ │ │ +
Vertex number_
Definition renumberer.hh:35
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,484 +1,508 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -13 { │ │ │ │ -26 │ │ │ │ -_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 _A_m_g │ │ │ │ +21 { │ │ │ │ +22 │ │ │ │ +33 │ │ │ │ +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 _V_e_r_t_e_x; │ │ │ │ +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 } │ │ │ │ -137 │ │ │ │ -_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, │ │ │ │ -_2_4_7 _s_u_c_c_e_s_s_i_v_e_A_c_c_u=2 │ │ │ │ -248 }; │ │ │ │ +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 _c_o_a_r_s_e_n(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 } │ │ │ │ +253 template │ │ │ │ +254 template │ │ │ │ +255 void ParallelIndicesCoarsener::buildCoarseIndexSet(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 │ │ │ │ -_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 } │ │ │ │ +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 _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, │ │ │ │ +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 } │ │ │ │ -359 │ │ │ │ -_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 } │ │ │ │ -447 │ │ │ │ -_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 } │ │ │ │ -464 │ │ │ │ -_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 } │ │ │ │ -480 │ │ │ │ -_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_:_:_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 │ │ │ │ +static Graph::VertexDescriptor coarsen(const SequentialInformation &fineInfo, │ │ │ │ +Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph:: │ │ │ │ +VertexDescriptor > &aggregates, SequentialInformation &coarseInfo, typename │ │ │ │ +Graph::VertexDescriptor noAggregates, bool useFixedOrder=false) │ │ │ │ +DDeeffiinniittiioonn indicescoarsener.hh:396 │ │ │ │ +_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:577 │ │ │ │ +_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_:_:_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 │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ +_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:566 │ │ │ │ +_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_:_:_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_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -74,70 +74,50 @@ │ │ │
│ │ │ │ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ Namespaces | │ │ │ -Enumerations | │ │ │ -Functions
│ │ │ - │ │ │ +Variables
│ │ │ + │ │ │
│ │ │
│ │ │ │ │ │ -

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::MatrixHierarchy< M, PI, A >::MatrixStats< Matrix, true >::calc
class  Dune::Amg::CoarsenCriterion< T >
 The criterion describing the stop criteria for the coarsening process. More...
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
│ │ │ - │ │ │ - │ │ │ -

│ │ │ -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)

│ │ │ +Variables

template<typename T, typename TI>
const TI::GlobalIndex Dune::Amg::GlobalAggregatesMap< T, TI >::isolatedMarker
│ │ │

Detailed Description

│ │ │ -

Provides a classes representing the hierarchies in AMG.

│ │ │ +

Provdes class for identifying aggregates globally.

│ │ │
Author
Markus Blatt
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ ├── html2text {} │ │ │ │ @@ -1,60 +1,39 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 | _V_a_r_i_a_b_l_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_:_:_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_._._. │ │ │ │ +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 │ │ │ │ -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) │ │ │ │ +VVaarriiaabblleess │ │ │ │ +template │ │ │ │ +const TI::GlobalIndex  _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_ _>_:_:_i_s_o_l_a_t_e_d_M_a_r_k_e_r │ │ │ │ ********** 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,1000 +71,341 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
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
│ │ │ -
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 {
│ │ │ -
37
│ │ │ -
42 enum {
│ │ │ - │ │ │ -
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
│ │ │ -
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>;
│ │ │ -
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>
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
168
│ │ │ - │ │ │ -
174
│ │ │ - │ │ │ -
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 };
│ │ │ -
│ │ │ -
265
│ │ │ -
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<std::size_t>(*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
│ │ │ - │ │ │ -
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
│ │ │ -
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ -
bool hasCoarsest() const
Definition matrixhierarchy.hh:950
│ │ │ -
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:326
│ │ │ -
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:338
│ │ │ -
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 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
│ │ │ +
5#ifndef DUNE_GLOBALAGGREGATES_HH
│ │ │ +
6#define DUNE_GLOBALAGGREGATES_HH
│ │ │ +
7
│ │ │ +
17
│ │ │ +
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
│ │ │ +
│ │ │ +
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 {
│ │ │ +
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
│ │ │ +
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:731
│ │ │ +
const_iterator end() const
Definition aggregates.hh:736
│ │ │
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ -
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
│ │ │ -
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:729
│ │ │ -
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
│ │ │ -
void build(const T &criterion)
Build the matrix hierarchy using aggregation.
Definition matrixhierarchy.hh:403
│ │ │ -
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.
│ │ │ -
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
│ │ │ -
@ atOnceAccu
Accumulate data to one process at once.
Definition parameters.hh:243
│ │ │ -
@ successiveAccu
Successively accumulate to fewer processes.
Definition parameters.hh:247
│ │ │ -
@ MAX_PROCESSES
Hard limit for the number of processes allowed.
Definition matrixhierarchy.hh:50
│ │ │ +
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:572
│ │ │
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
│ │ │
Definition novlpschwarz.hh:256
│ │ │ -
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
│ │ │ +
const TI::GlobalIndex GlobalAggregatesMap< T, TI >::isolatedMarker
Definition globalaggregates.hh:109
│ │ │ +
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
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< T1, LI, 512 > ParallelIndexSet
Definition owneroverlapcopy.hh:449
│ │ │
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ -
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
│ │ │ +
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
Definition hierarchy.hh:220
│ │ │ -
LevelIterator< const Hierarchy< MatrixOperator, Allocator >, const MatrixOperator > ConstIterator
Definition hierarchy.hh:223
│ │ │ -
Definition indicescoarsener.hh:36
│ │ │ -
typename std::allocator_traits< Allocator >::template rebind_alloc< AggregatesMap * > AAllocator
Definition matrixhierarchy.hh:85
│ │ │ -
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
Definition matrixhierarchy.hh:82
│ │ │ -
std::list< AggregatesMap *, AAllocator > AggregatesMapList
Definition matrixhierarchy.hh:88
│ │ │ -
ParallelInformation ParallelInformation
Definition matrixhierarchy.hh:70
│ │ │ -
Dune::Amg::Hierarchy< MatrixOperator, Allocator > ParallelMatrixHierarchy
Definition matrixhierarchy.hh:79
│ │ │ - │ │ │ -
RedistributeInformation< ParallelInformation > RedistributeInfoType
Definition matrixhierarchy.hh:91
│ │ │ -
double getProlongationDampingFactor() const
Definition matrixhierarchy.hh:188
│ │ │ -
typename std::allocator_traits< Allocator >::template rebind_alloc< RedistributeInfoType > RILAllocator
Definition matrixhierarchy.hh:94
│ │ │ -
std::list< RedistributeInfoType, RILAllocator > RedistributeInfoList
Definition matrixhierarchy.hh:97
│ │ │ -
Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > AggregatesMap
Definition matrixhierarchy.hh:76
│ │ │ -
MatrixOperator::matrix_type Matrix
Definition matrixhierarchy.hh:67
│ │ │ -
M MatrixOperator
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
│ │ │ -
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
│ │ │ -
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,1258 +1,433 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -31 { │ │ │ │ -37 │ │ │ │ -42 enum { │ │ │ │ -_5_0 _M_A_X___P_R_O_C_E_S_S_E_S = 72000 │ │ │ │ -51 }; │ │ │ │ -52 │ │ │ │ -59 template > │ │ │ │ -_6_0 class _M_a_t_r_i_x_H_i_e_r_a_r_c_h_y │ │ │ │ +17 │ │ │ │ +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 _A_m_g │ │ │ │ +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 Proxy _o_p_e_r_a_t_o_r_[_](std::size_t index) │ │ │ │ +92 { │ │ │ │ +93 return Proxy(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 │ │ │ │ -_1_0_4 _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 │ │ │ │ -_1_0_7 _~_M_a_t_r_i_x_H_i_e_r_a_r_c_h_y(); │ │ │ │ -108 │ │ │ │ -114 template │ │ │ │ -_1_1_5 void _b_u_i_l_d(const T& criterion); │ │ │ │ -116 │ │ │ │ -124 template │ │ │ │ -_1_2_5 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 │ │ │ │ -_1_3_2 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 │ │ │ │ -_1_4_0 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 │ │ │ │ -_1_4_7 std::size_t _l_e_v_e_l_s() const; │ │ │ │ -148 │ │ │ │ -_1_5_3 std::size_t _m_a_x_l_e_v_e_l_s() const; │ │ │ │ -154 │ │ │ │ -_1_5_5 bool _h_a_s_C_o_a_r_s_e_s_t() const; │ │ │ │ -156 │ │ │ │ -_1_6_1 bool _i_s_B_u_i_l_t() const; │ │ │ │ -162 │ │ │ │ -_1_6_7 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 │ │ │ │ -_1_7_3 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 │ │ │ │ -_1_7_9 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 │ │ │ │ -_1_8_6 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 │ │ │ │ -_2_0_3 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 _i_s_o_l_a_t_e_d_M_a_r_k_e_r; │ │ │ │ +106 }; │ │ │ │ +107 │ │ │ │ +108 template │ │ │ │ +_1_0_9 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 _A_m_g │ │ │ │ +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 _c_a_l_c │ │ │ │ +232 } // end Amg namespace │ │ │ │ +233 │ │ │ │ +234 │ │ │ │ +235#if HAVE_MPI │ │ │ │ +236 template │ │ │ │ +_2_3_7 struct CommPolicy<_A_m_g::GlobalAggregatesMap > │ │ │ │ +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 _m_i_n=std::numeric_limits::max(); │ │ │ │ -250 _m_a_x=0; │ │ │ │ -251 _s_u_m=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 _m_i_n=std::min(_m_i_n, row.size()); │ │ │ │ -257 _m_a_x=std::max(_m_a_x, row.size()); │ │ │ │ -258 _s_u_m += 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 }; │ │ │ │ -265 │ │ │ │ -268 static void stats(const _M_a_t_r_i_x& matrix) │ │ │ │ -269 { │ │ │ │ -270 _c_a_l_c c= for_each(matrix.begin(), matrix.end(), _c_a_l_c()); │ │ │ │ -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->buildAggregates(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(endnoVertices()); │ │ │ │ -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 "<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::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 _l_e_v_e_l_s = matrices_.levels(); │ │ │ │ -725 maxlevels_ = parallelInformation_.finest()->communicator().max(_l_e_v_e_l_s); │ │ │ │ -726 assert(matrices_.levels()==redistributes_.size()); │ │ │ │ -727 if(_h_a_s_C_o_a_r_s_e_s_t() && 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 _l_e_v_e_l_s=_a_g_g_r_e_g_a_t_e_s_M_a_p_s().size(); │ │ │ │ -750 int _m_a_x_l_e_v_e_l_s=parallelInformation_.finest()->communicator().max(_l_e_v_e_l_s); │ │ │ │ -751 std::size_t size=(*(_a_g_g_r_e_g_a_t_e_s_M_a_p_s().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(_l_e_v_e_l_s%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(_l_e_v_e_l_s==_m_a_x_l_e_v_e_l_s) { │ │ │ │ -772 const _A_g_g_r_e_g_a_t_e_s_M_a_p& map = *(*(++_a_g_g_r_e_g_a_t_e_s_M_a_p_s().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.begin(); iter != │ │ │ │ -map.end(); ++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 = _p_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -().coarsest(); │ │ │ │ -796 --pinfo; │ │ │ │ -797 │ │ │ │ -798 // Now consecutively project the numbers to the finest level. │ │ │ │ -799 for(typename AggregatesMapList::const_reverse_iterator │ │ │ │ -aggregates=++_a_g_g_r_e_g_a_t_e_s_M_a_p_s().rbegin(); │ │ │ │ -800 aggregates != _a_g_g_r_e_g_a_t_e_s_M_a_p_s().rend(); ++aggregates,--_l_e_v_e_l_s) { │ │ │ │ -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(_m_a_x_l_e_v_e_l_s()>_l_e_v_e_l_s()) { │ │ │ │ -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 _l_e_v_e_l_s()==_m_a_x_l_e_v_e_l_s() && │ │ │ │ -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_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ -DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments │ │ │ │ -DDeeffiinniittiioonn smoother.hh:67 │ │ │ │ -_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_:_:_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 &) │ │ │ │ -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_:_:_l_e_v_e_l_s │ │ │ │ -std::size_t levels() const │ │ │ │ -Get the number of levels in the hierarchy. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:326 │ │ │ │ -_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:338 │ │ │ │ -_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_:_:_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_:_:_b_e_g_i_n │ │ │ │ +const_iterator begin() const │ │ │ │ +DDeeffiinniittiioonn aggregates.hh:731 │ │ │ │ +_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:736 │ │ │ │ _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:577 │ │ │ │ -_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_:_:_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:729 │ │ │ │ -_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_:_:_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_:_:_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_:_:_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_:_:_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_:_:_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_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:572 │ │ │ │ _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_:_:_A_m_g │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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_:_:_i_s_o_l_a_t_e_d_M_a_r_k_e_r │ │ │ │ +const TI::GlobalIndex GlobalAggregatesMap< T, TI >::isolatedMarker │ │ │ │ +DDeeffiinniittiioonn globalaggregates.hh:109 │ │ │ │ +_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_<_ _T_1_,_ _T_2_ _>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ +Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ +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_<_ _T_1_,_ _T_2_ _>_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +Dune::ParallelIndexSet< T1, LI, 512 > ParallelIndexSet │ │ │ │ +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:566 │ │ │ │ -_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_:_:_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 │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:220 │ │ │ │ -_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 │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:223 │ │ │ │ -_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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_A_l_l_o_c_a_t_o_r │ │ │ │ -typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ -AggregatesMap * > AAllocator │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _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 │ │ │ │ -Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ -ParallelInformationHierarchy │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p_L_i_s_t │ │ │ │ -std::list< AggregatesMap *, AAllocator > AggregatesMapList │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -ParallelInformation ParallelInformation │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_: │ │ │ │ -_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 │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_l_l_o_c_a_t_o_r │ │ │ │ -A Allocator │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_R_e_d_i_s_t_r_i_b_u_t_e_I_n_f_o_T_y_p_e │ │ │ │ -RedistributeInformation< ParallelInformation > RedistributeInfoType │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_R_I_L_A_l_l_o_c_a_t_o_r │ │ │ │ -typename std::allocator_traits< Allocator >::template rebind_alloc< │ │ │ │ -RedistributeInfoType > RILAllocator │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_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 │ │ │ │ -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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_A_g_g_r_e_g_a_t_e_s_M_a_p │ │ │ │ -Dune::Amg::AggregatesMap< typename MatrixGraph< Matrix >::VertexDescriptor > │ │ │ │ -AggregatesMap │ │ │ │ -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_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_M_a_t_r_i_x │ │ │ │ -MatrixOperator::matrix_type 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_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _A_ _>_:_:_M_a_t_r_i_x_O_p_e_r_a_t_o_r │ │ │ │ -M MatrixOperator │ │ │ │ -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 │ │ │ │ -DDeeffiinniittiioonn matrixhierarchy.hh:243 │ │ │ │ -_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_:_:_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,42 +73,72 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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,29 +1,47 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,334 +71,688 @@ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ -
25
│ │ │ -
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
│ │ │ -
52
│ │ │ -
│ │ │ - │ │ │ -
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;
│ │ │ - │ │ │ -
163 typedef typename Amg::ScalarProduct ScalarProduct;
│ │ │ +
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
│ │ │ +
31
│ │ │ +
32namespace Dune
│ │ │ +
33{
│ │ │ +
34 namespace Amg
│ │ │ +
35 {
│ │ │ +
41
│ │ │ +
47
│ │ │ +
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
│ │ │ -
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 }
│ │ │ +
│ │ │ + │ │ │ +
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
│ │ │ +
290 using ScalarProduct = Dune::ScalarProduct<X>;
│ │ │ +
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:88
│ │ │ -
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
Definition amg.hh:101
│ │ │ -
M Operator
Definition amg.hh:74
│ │ │ -
void post(Domain &x)
Clean up.
Definition kamg.hh:293
│ │ │ -
X Range
The range type.
Definition amg.hh:90
│ │ │ + │ │ │ +
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 {
│ │ │ +
479 if constexpr (Dune::IsNumber<Block>::value)
│ │ │ +
480 x[row.index()] = b[row.index()]/(*diag);
│ │ │ +
481 else
│ │ │ +
482 diag->solve(x[row.index()], b[row.index()]);
│ │ │ +
483 }
│ │ │ +
484 }
│ │ │ +
485 if (verbosity_>0)
│ │ │ +
486 std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
│ │ │ +
487 watch1.reset();
│ │ │ +
488 // No smoother to make x consistent! Do it by hand
│ │ │ +
489 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ +
490 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ +
491 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
492 residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ +
493 matrices_->coarsenVector(*rhs_);
│ │ │ +
494 matrices_->coarsenVector(*lhs_);
│ │ │ +
495 matrices_->coarsenVector(*residual_);
│ │ │ +
496
│ │ │ +
497 // The preconditioner might change x and b. So we have to
│ │ │ +
498 // copy the changes to the original vectors.
│ │ │ +
499 x = *lhs_->finest();
│ │ │ +
500 b = *rhs_->finest();
│ │ │ +
501 }
│ │ │ +
│ │ │ +
502 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
504 {
│ │ │ +
505 return matrices_->levels();
│ │ │ +
506 }
│ │ │ +
│ │ │ +
507 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
509 {
│ │ │ +
510 return matrices_->maxlevels();
│ │ │ +
511 }
│ │ │ +
│ │ │ +
512
│ │ │ +
514 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
516 {
│ │ │ +
517 LevelContext levelContext;
│ │ │ +
518 // Init all iterators for the current level
│ │ │ +
519 initIteratorsWithFineLevel(levelContext);
│ │ │ +
520
│ │ │ +
521 assert(v.two_norm()==0);
│ │ │ +
522
│ │ │ +
523 level=0;
│ │ │ +
524 if(matrices_->maxlevels()==1){
│ │ │ +
525 // The coarse solver might modify the d!
│ │ │ +
526 Range b(d);
│ │ │ +
527 mgc(levelContext, v, b);
│ │ │ +
528 }else
│ │ │ +
529 mgc(levelContext, v, d);
│ │ │ +
530 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ +
531 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ +
532 }
│ │ │ +
│ │ │ +
533
│ │ │ +
534 template<class M, class X, class PI, class A>
│ │ │ +
535 void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ +
536 {
│ │ │ +
537 levelContext.matrix = matrices_->matrices().finest();
│ │ │ +
538 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ +
539 levelContext.redist =
│ │ │ +
540 matrices_->redistributeInformation().begin();
│ │ │ +
541 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ +
542 levelContext.lhs = lhs_->finest();
│ │ │ +
543 levelContext.residual = residual_->finest();
│ │ │ +
544 levelContext.rhs = rhs_->finest();
│ │ │ +
545 levelContext.level=0;
│ │ │ +
546 }
│ │ │ +
547
│ │ │ +
548 template<class M, class X, class PI, class A>
│ │ │ +
549 bool FastAMG<M,X,PI,A>
│ │ │ +
550 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ +
551 {
│ │ │ +
552 bool processNextLevel=true;
│ │ │ +
553
│ │ │ +
554 if(levelContext.redist->isSetup()) {
│ │ │ +
555 throw "bla";
│ │ │ +
556 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
│ │ │ +
557 levelContext.residual.getRedistributed());
│ │ │ +
558 processNextLevel = levelContext.residual.getRedistributed().size()>0;
│ │ │ +
559 if(processNextLevel) {
│ │ │ +
560 //restrict defect to coarse level right hand side.
│ │ │ +
561 ++levelContext.pinfo;
│ │ │ +
562 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ +
563 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ +
564 static_cast<const Range&>(levelContext.residual.getRedistributed()),
│ │ │ +
565 *levelContext.pinfo);
│ │ │ +
566 }
│ │ │ +
567 }else{
│ │ │ +
568 //restrict defect to coarse level right hand side.
│ │ │ +
569 ++levelContext.rhs;
│ │ │ +
570 ++levelContext.pinfo;
│ │ │ + │ │ │ +
572 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ +
573 static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
│ │ │ +
574 }
│ │ │ +
575
│ │ │ +
576 if(processNextLevel) {
│ │ │ +
577 // prepare coarse system
│ │ │ +
578 ++levelContext.residual;
│ │ │ +
579 ++levelContext.lhs;
│ │ │ +
580 ++levelContext.matrix;
│ │ │ +
581 ++levelContext.level;
│ │ │ +
582 ++levelContext.redist;
│ │ │ +
583
│ │ │ +
584 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
585 // next level is not the globally coarsest one
│ │ │ +
586 ++levelContext.aggregates;
│ │ │ +
587 }
│ │ │ +
588 // prepare the lhs on the next level
│ │ │ +
589 *levelContext.lhs=0;
│ │ │ +
590 *levelContext.residual=0;
│ │ │ +
591 }
│ │ │ +
592 return processNextLevel;
│ │ │ +
593 }
│ │ │ +
594
│ │ │ +
595 template<class M, class X, class PI, class A>
│ │ │ + │ │ │ +
597 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
│ │ │ +
598 {
│ │ │ +
599 if(processNextLevel) {
│ │ │ +
600 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ +
601 // previous level is not the globally coarsest one
│ │ │ +
602 --levelContext.aggregates;
│ │ │ +
603 }
│ │ │ +
604 --levelContext.redist;
│ │ │ +
605 --levelContext.level;
│ │ │ +
606 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ +
607 --levelContext.matrix;
│ │ │ +
608 --levelContext.residual;
│ │ │ +
609
│ │ │ +
610 }
│ │ │ +
611
│ │ │ +
612 typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
│ │ │ +
613 if(levelContext.redist->isSetup()) {
│ │ │ +
614
│ │ │ +
615 // Need to redistribute during prolongate
│ │ │ + │ │ │ +
617 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ +
618 levelContext.lhs.getRedistributed(),
│ │ │ +
619 matrices_->getProlongationDampingFactor(),
│ │ │ +
620 *levelContext.pinfo, *levelContext.redist);
│ │ │ +
621 }else{
│ │ │ + │ │ │ +
623 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ +
624 matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
│ │ │ +
625
│ │ │ +
626 // printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
│ │ │ +
627 }
│ │ │ +
628
│ │ │ +
629
│ │ │ +
630 if(processNextLevel) {
│ │ │ +
631 --levelContext.rhs;
│ │ │ +
632 }
│ │ │ +
633
│ │ │ +
634 }
│ │ │ +
635
│ │ │ +
636
│ │ │ +
637 template<class M, class X, class PI, class A>
│ │ │ + │ │ │ +
639 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ +
640 {
│ │ │ +
641 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ +
642 GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
│ │ │ +
643 x,
│ │ │ +
644 *levelContext.residual,
│ │ │ +
645 b);
│ │ │ +
646 }
│ │ │ +
647
│ │ │ +
648 template<class M, class X, class PI, class A>
│ │ │ + │ │ │ +
650 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ +
651 {
│ │ │ +
652 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ + │ │ │ +
654 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
│ │ │ +
655 }
│ │ │ +
656
│ │ │ +
657
│ │ │ +
658 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ + │ │ │ +
660 {
│ │ │ + │ │ │ +
662 }
│ │ │ +
│ │ │ +
663
│ │ │ +
664 template<class M, class X, class PI, class A>
│ │ │ +
665 void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
│ │ │ +
666
│ │ │ +
667 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ +
668 // Solve directly
│ │ │ + │ │ │ +
670 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ +
671 if(levelContext.redist->isSetup()) {
│ │ │ +
672 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
│ │ │ +
673 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ +
674 // We are still participating in the computation
│ │ │ +
675 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ +
676 levelContext.rhs.getRedistributed());
│ │ │ +
677 solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
│ │ │ +
678 }
│ │ │ +
679 levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
│ │ │ +
680 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ +
681 }else{
│ │ │ +
682 levelContext.pinfo->copyOwnerToAll(b, b);
│ │ │ +
683 solver_->apply(v, const_cast<Range&>(b), res);
│ │ │ +
684 }
│ │ │ +
685
│ │ │ +
686 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
│ │ │ +
687 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
│ │ │ +
688 if (!res.converged)
│ │ │ +
689 coarsesolverconverged = false;
│ │ │ +
690 }else{
│ │ │ +
691 // presmoothing
│ │ │ +
692 presmooth(levelContext, v, b);
│ │ │ +
693 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
│ │ │ +
694 // printvector(std::cout, *residual, "post presmooth residual", "r", 10);
│ │ │ +
695#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ +
696 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ +
697
│ │ │ +
698 if(processNextLevel) {
│ │ │ +
699 // next level
│ │ │ +
700 for(std::size_t i=0; i<gamma_; i++)
│ │ │ +
701 mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
│ │ │ +
702 }
│ │ │ +
703
│ │ │ +
704 moveToFineLevel(levelContext, processNextLevel, v);
│ │ │ +
705#else
│ │ │ +
706 *lhs=0;
│ │ │ +
707#endif
│ │ │ +
708
│ │ │ +
709 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ +
710 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ +
711 if(!coarsesolverconverged)
│ │ │ +
712 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ +
713 }
│ │ │ +
714
│ │ │ +
715 postsmooth(levelContext, v, b);
│ │ │ +
716 }
│ │ │ +
717 }
│ │ │ +
718
│ │ │ +
719
│ │ │ +
721 template<class M, class X, class PI, class A>
│ │ │ +
│ │ │ +
722 void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ +
723 {
│ │ │ +
724 lhs_=nullptr;
│ │ │ +
725 rhs_=nullptr;
│ │ │ +
726 residual_=nullptr;
│ │ │ +
727 }
│ │ │ +
│ │ │ +
728
│ │ │ +
729 template<class M, class X, class PI, class A>
│ │ │ +
730 template<class A1>
│ │ │ +
│ │ │ +
731 void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ +
732 {
│ │ │ +
733 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ +
734 }
│ │ │ +
│ │ │ +
735
│ │ │ +
736 } // end namespace Amg
│ │ │ +
737} // end namespace Dune
│ │ │ +
738
│ │ │ +
739#endif
│ │ │ +
Prolongation and restriction for amg.
│ │ │ +
Provides a classes representing the hierarchies in AMG.
│ │ │ + │ │ │ +
#define DIRECTSOLVER
│ │ │ +
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.
│ │ │ +
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ +
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │
void presmooth(LevelContext &levelContext, size_t steps)
Apply pre smoothing on the current level.
Definition smoother.hh:406
│ │ │ -
OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy
Definition amg.hh:85
│ │ │ -
InverseOperator< X, X > CoarseSolver
Definition amg.hh:92
│ │ │ +
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
MatrixHierarchy< M, ParallelInformation, A > OperatorHierarchy
Definition amg.hh:83
│ │ │ -
void pre(Domain &x, Range &b)
Prepare the preconditioner.
Definition kamg.hh:253
│ │ │ -
PI ParallelInformation
Definition amg.hh:81
│ │ │ +
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:731
│ │ │ +
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:722
│ │ │ +
std::size_t maxlevels()
Definition fastamg.hh:508
│ │ │ +
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:503
│ │ │ +
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:659
│ │ │ +
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:515
│ │ │ +
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
│ │ │
std::shared_ptr< ScalarProduct< X > > createScalarProduct(const Comm &comm, SolverCategory::Category category)
Definition scalarproducts.hh:242
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ +
constexpr std::size_t blockLevel()
Determine the block level of a possibly nested vector/matrix type.
Definition blocklevel.hh:176
│ │ │
Definition novlpschwarz.hh:256
│ │ │ -
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:66
│ │ │ +
A generic dynamic dense matrix.
Definition matrix.hh:561
│ │ │ +
MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator
Const iterator over the matrix rows.
Definition matrix.hh:586
│ │ │ +
RowIterator end()
Get iterator to one beyond last row.
Definition matrix.hh:616
│ │ │ +
RowIterator begin()
Get iterator to first row.
Definition matrix.hh:610
│ │ │ +
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:20
│ │ │ +
Definition fastamgsmoother.hh:67
│ │ │
LevelIterator< Hierarchy< ParallelInformation, Allocator >, ParallelInformation > Iterator
Definition hierarchy.hh:220
│ │ │ +
The hierarchies build by the coarsening process.
Definition matrixhierarchy.hh:61
│ │ │ +
Dune::Amg::Hierarchy< ParallelInformation, Allocator > ParallelInformationHierarchy
Definition matrixhierarchy.hh:82
│ │ │
All parameters for AMG.
Definition parameters.hh:416
│ │ │ +
Definition transfer.hh:32
│ │ │
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:1308
│ │ │ +
@ sequential
Category for sequential solvers.
Definition solvercategory.hh:25
│ │ │ +
@ value
Whether this is a direct solver.
Definition solvertype.hh:24
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,431 +1,870 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -14 { │ │ │ │ -15 │ │ │ │ -25 │ │ │ │ -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_.category(); │ │ │ │ -44 }; │ │ │ │ -45 │ │ │ │ -52 │ │ │ │ -_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 │ │ │ │ +31 │ │ │ │ +32namespace _D_u_n_e │ │ │ │ +33{ │ │ │ │ +34 namespace _A_m_g │ │ │ │ +35 { │ │ │ │ +41 │ │ │ │ +47 │ │ │ │ +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 Amg::ScalarProduct _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.category(); │ │ │ │ -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(_c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t_<_X_>(*pinfo,_c_a_t_e_g_o_r_y())); │ │ │ │ -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 ScalarProduct = _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_> Smoother; │ │ │ │ +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 FastAMG::createHierarchies(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.iterations = 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_ = _c_r_e_a_t_e_S_c_a_l_a_r_P_r_o_d_u_c_t_<_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::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 _D_I_R_E_C_T_S_O_L_V_E_R_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_>(matrices_->matrices │ │ │ │ +().coarsest().getRedistributed().getmat(), false, false)); │ │ │ │ +419 else │ │ │ │ +420 solver_.reset(); │ │ │ │ +421 }else │ │ │ │ +422 solver_.reset(new _D_I_R_E_C_T_S_O_L_V_E_R_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_>(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& mat=matrices_->matrices().finest()->getmat(); │ │ │ │ +464 for(RowIter row=mat._b_e_g_i_n(); row!=mat._e_n_d(); ++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 { │ │ │ │ +479 if constexpr (Dune::IsNumber::value) │ │ │ │ +480 x[row.index()] = b[row.index()]/(*diag); │ │ │ │ +481 else │ │ │ │ +482 diag->solve(x[row.index()], b[row.index()]); │ │ │ │ +483 } │ │ │ │ +484 } │ │ │ │ +485 if (verbosity_>0) │ │ │ │ +486 std::cout<<" Preprocessing Dirichlet took "<parallelInformation().coarsest()->copyOwnerToAll(x,x); │ │ │ │ +490 rhs_ = std::make_shared>(std::make_shared(b)); │ │ │ │ +491 lhs_ = std::make_shared>(std::make_shared(x)); │ │ │ │ +492 residual_ = std::make_shared>(std::make_shared │ │ │ │ +(x)); │ │ │ │ +493 matrices_->coarsenVector(*rhs_); │ │ │ │ +494 matrices_->coarsenVector(*lhs_); │ │ │ │ +495 matrices_->coarsenVector(*residual_); │ │ │ │ +496 │ │ │ │ +497 // The preconditioner might change x and b. So we have to │ │ │ │ +498 // copy the changes to the original vectors. │ │ │ │ +499 x = *lhs_->finest(); │ │ │ │ +500 b = *rhs_->finest(); │ │ │ │ +501 } │ │ │ │ +502 template │ │ │ │ +_5_0_3 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_l_e_v_e_l_s() │ │ │ │ +504 { │ │ │ │ +505 return matrices_->levels(); │ │ │ │ +506 } │ │ │ │ +507 template │ │ │ │ +_5_0_8 std::size_t _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_>_:_:_m_a_x_l_e_v_e_l_s() │ │ │ │ +509 { │ │ │ │ +510 return matrices_->maxlevels(); │ │ │ │ +511 } │ │ │ │ +512 │ │ │ │ +514 template │ │ │ │ +_5_1_5 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) │ │ │ │ +516 { │ │ │ │ +517 LevelContext levelContext; │ │ │ │ +518 // Init all iterators for the current level │ │ │ │ +519 initIteratorsWithFineLevel(levelContext); │ │ │ │ +520 │ │ │ │ +521 assert(v.two_norm()==0); │ │ │ │ +522 │ │ │ │ +523 level=0; │ │ │ │ +524 if(matrices_->maxlevels()==1){ │ │ │ │ +525 // The coarse solver might modify the d! │ │ │ │ +526 _R_a_n_g_e b(d); │ │ │ │ +527 mgc(levelContext, v, b); │ │ │ │ +528 }else │ │ │ │ +529 mgc(levelContext, v, d); │ │ │ │ +530 if(postSteps_==0||matrices_->maxlevels()==1) │ │ │ │ +531 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ +532 } │ │ │ │ +533 │ │ │ │ +534 template │ │ │ │ +535 void FastAMG::initIteratorsWithFineLevel(LevelContext& │ │ │ │ +levelContext) │ │ │ │ +536 { │ │ │ │ +537 levelContext.matrix = matrices_->matrices().finest(); │ │ │ │ +538 levelContext.pinfo = matrices_->parallelInformation().finest(); │ │ │ │ +539 levelContext.redist = │ │ │ │ +540 matrices_->redistributeInformation().begin(); │ │ │ │ +541 levelContext.aggregates = matrices_->aggregatesMaps().begin(); │ │ │ │ +542 levelContext.lhs = lhs_->finest(); │ │ │ │ +543 levelContext.residual = residual_->finest(); │ │ │ │ +544 levelContext.rhs = rhs_->finest(); │ │ │ │ +545 levelContext.level=0; │ │ │ │ +546 } │ │ │ │ +547 │ │ │ │ +548 template │ │ │ │ +549 bool FastAMG │ │ │ │ +550 ::moveToCoarseLevel(LevelContext& levelContext) │ │ │ │ +551 { │ │ │ │ +552 bool processNextLevel=true; │ │ │ │ +553 │ │ │ │ +554 if(levelContext.redist->isSetup()) { │ │ │ │ +555 throw "bla"; │ │ │ │ +556 levelContext.redist->redistribute(static_cast │ │ │ │ +(*levelContext.residual), │ │ │ │ +557 levelContext.residual.getRedistributed()); │ │ │ │ +558 processNextLevel = levelContext.residual.getRedistributed().size()>0; │ │ │ │ +559 if(processNextLevel) { │ │ │ │ +560 //restrict defect to coarse level right hand side. │ │ │ │ +561 ++levelContext.pinfo; │ │ │ │ +562 Transfer │ │ │ │ +563 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ +564 static_cast(levelContext.residual.getRedistributed()), │ │ │ │ +565 *levelContext.pinfo); │ │ │ │ +566 } │ │ │ │ +567 }else{ │ │ │ │ +568 //restrict defect to coarse level right hand side. │ │ │ │ +569 ++levelContext.rhs; │ │ │ │ +570 ++levelContext.pinfo; │ │ │ │ +571 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +572_ _:_:_r_e_s_t_r_i_c_t_V_e_c_t_o_r(*(*levelContext.aggregates), *levelContext.rhs, │ │ │ │ +573 static_cast(*levelContext.residual), *levelContext.pinfo); │ │ │ │ +574 } │ │ │ │ +575 │ │ │ │ +576 if(processNextLevel) { │ │ │ │ +577 // prepare coarse system │ │ │ │ +578 ++levelContext.residual; │ │ │ │ +579 ++levelContext.lhs; │ │ │ │ +580 ++levelContext.matrix; │ │ │ │ +581 ++levelContext.level; │ │ │ │ +582 ++levelContext.redist; │ │ │ │ +583 │ │ │ │ +584 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +585 // next level is not the globally coarsest one │ │ │ │ +586 ++levelContext.aggregates; │ │ │ │ +587 } │ │ │ │ +588 // prepare the lhs on the next level │ │ │ │ +589 *levelContext.lhs=0; │ │ │ │ +590 *levelContext.residual=0; │ │ │ │ +591 } │ │ │ │ +592 return processNextLevel; │ │ │ │ +593 } │ │ │ │ +594 │ │ │ │ +595 template │ │ │ │ +596 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_> │ │ │ │ +597_ _:_:_m_o_v_e_T_o_F_i_n_e_L_e_v_e_l(LevelContext& levelContext, bool processNextLevel, │ │ │ │ +Domain& x) │ │ │ │ +598 { │ │ │ │ +599 if(processNextLevel) { │ │ │ │ +600 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_- │ │ │ │ +>levels()maxlevels()) { │ │ │ │ +601 // previous level is not the globally coarsest one │ │ │ │ +602 --levelContext.aggregates; │ │ │ │ +603 } │ │ │ │ +604 --levelContext.redist; │ │ │ │ +605 --levelContext.level; │ │ │ │ +606 //prolongate and add the correction (update is in coarse left hand side) │ │ │ │ +607 --levelContext.matrix; │ │ │ │ +608 --levelContext.residual; │ │ │ │ +609 │ │ │ │ +610 } │ │ │ │ +611 │ │ │ │ +612 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 coarseLhs = levelContext.lhs--; │ │ │ │ +613 if(levelContext.redist->isSetup()) { │ │ │ │ +614 │ │ │ │ +615 // Need to redistribute during prolongate │ │ │ │ +616 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +617_ _:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ +618 levelContext.lhs.getRedistributed(), │ │ │ │ +619 matrices_->getProlongationDampingFactor(), │ │ │ │ +620 *levelContext.pinfo, *levelContext.redist); │ │ │ │ +621 }else{ │ │ │ │ +622 _T_r_a_n_s_f_e_r_<_t_y_p_e_n_a_m_e_ _O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y_:_:_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_,_R_a_n_g_e_,_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_> │ │ │ │ +623_ _:_:_p_r_o_l_o_n_g_a_t_e_V_e_c_t_o_r(*(*levelContext.aggregates), *coarseLhs, x, │ │ │ │ +624 matrices_->getProlongationDampingFactor(), *levelContext.pinfo); │ │ │ │ +625 │ │ │ │ +626 // printvector(std::cout, *lhs, "prolongated coarse grid correction", │ │ │ │ +"lhs", 10, 10, 10); │ │ │ │ +627 } │ │ │ │ +628 │ │ │ │ +629 │ │ │ │ +630 if(processNextLevel) { │ │ │ │ +631 --levelContext.rhs; │ │ │ │ +632 } │ │ │ │ +633 │ │ │ │ +634 } │ │ │ │ +635 │ │ │ │ +636 │ │ │ │ +637 template │ │ │ │ +638 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_> │ │ │ │ +639_ _:_:_p_r_e_s_m_o_o_t_h(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ +640 { │ │ │ │ +641 constexpr auto bl = _b_l_o_c_k_L_e_v_e_l_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_>(); │ │ │ │ +642 _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(), │ │ │ │ +643 x, │ │ │ │ +644 *levelContext.residual, │ │ │ │ +645 b); │ │ │ │ +646 } │ │ │ │ +647 │ │ │ │ +648 template │ │ │ │ +649 void _F_a_s_t_A_M_G_<_M_,_X_,_P_I_,_A_> │ │ │ │ +650_ _:_:_p_o_s_t_s_m_o_o_t_h(LevelContext& levelContext, Domain& x, const Range& b) │ │ │ │ +651 { │ │ │ │ +652 constexpr auto bl = _b_l_o_c_k_L_e_v_e_l_<_t_y_p_e_n_a_m_e_ _M_:_:_m_a_t_r_i_x___t_y_p_e_>(); │ │ │ │ +653 _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_<_b_l_> │ │ │ │ +654_ _:_:_a_p_p_l_y(levelContext.matrix->getmat(), x, *levelContext.residual, b); │ │ │ │ +655 } │ │ │ │ +656 │ │ │ │ +657 │ │ │ │ +658 template │ │ │ │ +_6_5_9 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 │ │ │ │ +660 { │ │ │ │ +661 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; │ │ │ │ +662 } │ │ │ │ +663 │ │ │ │ +664 template │ │ │ │ +665 void FastAMG::mgc(LevelContext& levelContext, Domain& v, const │ │ │ │ +Range& b){ │ │ │ │ +666 │ │ │ │ +667 if(levelContext.matrix == matrices_->matrices().coarsest() && levels │ │ │ │ +()==maxlevels()) { │ │ │ │ +668 // Solve directly │ │ │ │ +669 _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t res; │ │ │ │ +670 res._c_o_n_v_e_r_g_e_d=true; // If we do not compute this flag will not get updated │ │ │ │ +671 if(levelContext.redist->isSetup()) { │ │ │ │ +672 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed()); │ │ │ │ +673 if(levelContext.rhs.getRedistributed().size()>0) { │ │ │ │ +674 // We are still participating in the computation │ │ │ │ +675 levelContext.pinfo.getRedistributed().copyOwnerToAll │ │ │ │ +(levelContext.rhs.getRedistributed(), │ │ │ │ +676 levelContext.rhs.getRedistributed()); │ │ │ │ +677 solver_->apply(levelContext.lhs.getRedistributed(), │ │ │ │ +levelContext.rhs.getRedistributed(), res); │ │ │ │ +678 } │ │ │ │ +679 levelContext.redist->redistributeBackward(v, │ │ │ │ +levelContext.lhs.getRedistributed()); │ │ │ │ +680 levelContext.pinfo->copyOwnerToAll(v, v); │ │ │ │ +681 }else{ │ │ │ │ +682 levelContext.pinfo->copyOwnerToAll(b, b); │ │ │ │ +683 solver_->apply(v, const_cast(b), res); │ │ │ │ +684 } │ │ │ │ +685 │ │ │ │ +686 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10); │ │ │ │ +687 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10); │ │ │ │ +688 if (!res._c_o_n_v_e_r_g_e_d) │ │ │ │ +689 coarsesolverconverged = false; │ │ │ │ +690 }else{ │ │ │ │ +691 // presmoothing │ │ │ │ +692 _p_r_e_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ +693 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10); │ │ │ │ +694 // printvector(std::cout, *residual, "post presmooth residual", "r", 10); │ │ │ │ +695#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION │ │ │ │ +696 bool processNextLevel = moveToCoarseLevel(levelContext); │ │ │ │ +697 │ │ │ │ +698 if(processNextLevel) { │ │ │ │ +699 // next level │ │ │ │ +700 for(std::size_t i=0; imatrices().finest()) { │ │ │ │ +710 coarsesolverconverged = matrices_->parallelInformation().finest()- │ │ │ │ +>communicator().prod(coarsesolverconverged); │ │ │ │ +711 if(!coarsesolverconverged) │ │ │ │ +712 DUNE_THROW(MathError, "Coarse solver did not converge"); │ │ │ │ +713 } │ │ │ │ +714 │ │ │ │ +715 _p_o_s_t_s_m_o_o_t_h(levelContext, v, b); │ │ │ │ +716 } │ │ │ │ +717 } │ │ │ │ +718 │ │ │ │ +719 │ │ │ │ +721 template │ │ │ │ +_7_2_2 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) │ │ │ │ +723 { │ │ │ │ +724 lhs_=nullptr; │ │ │ │ +725 rhs_=nullptr; │ │ │ │ +726 residual_=nullptr; │ │ │ │ +727 } │ │ │ │ +728 │ │ │ │ +729 template │ │ │ │ +730 template │ │ │ │ +_7_3_1 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) │ │ │ │ +732 { │ │ │ │ +733 matrices_->getCoarsestAggregatesOnFinest(cont); │ │ │ │ +734 } │ │ │ │ +735 │ │ │ │ +736 } // end namespace Amg │ │ │ │ +737} // end namespace Dune │ │ │ │ +738 │ │ │ │ +739#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 │ │ │ │ +_D_I_R_E_C_T_S_O_L_V_E_R │ │ │ │ +#define DIRECTSOLVER │ │ │ │ +_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:88 │ │ │ │ -_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_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _>_:_:_S_m_o_o_t_h_e_r_A_r_g_s │ │ │ │ -SmootherTraits< Smoother >::Arguments SmootherArgs │ │ │ │ -DDeeffiinniittiioonn amg.hh:101 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _>_:_:_O_p_e_r_a_t_o_r │ │ │ │ -M Operator │ │ │ │ -DDeeffiinniittiioonn amg.hh:74 │ │ │ │ -_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:90 │ │ │ │ +_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. │ │ │ │ +_D_u_n_e_:_:_A_m_g_:_:_S_m_o_o_t_h_e_r_T_r_a_i_t_s_:_:_A_r_g_u_m_e_n_t_s │ │ │ │ +DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments │ │ │ │ +DDeeffiinniittiioonn smoother.hh:67 │ │ │ │ +_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 &) │ │ │ │ +Construct an object with the specified arguments. │ │ │ │ +DDeeffiinniittiioonn construction.hh:52 │ │ │ │ _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_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _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 │ │ │ │ -OperatorHierarchy::ParallelInformationHierarchy ParallelInformationHierarchy │ │ │ │ -DDeeffiinniittiioonn amg.hh:85 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _>_:_:_C_o_a_r_s_e_S_o_l_v_e_r │ │ │ │ -InverseOperator< X, X > CoarseSolver │ │ │ │ -DDeeffiinniittiioonn amg.hh:92 │ │ │ │ +_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_:_:_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_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _>_:_:_O_p_e_r_a_t_o_r_H_i_e_r_a_r_c_h_y │ │ │ │ +_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:731 │ │ │ │ +_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:722 │ │ │ │ +_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:508 │ │ │ │ +_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 │ │ │ │ -DDeeffiinniittiioonn amg.hh:83 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_K_A_M_G_:_:_p_r_e │ │ │ │ +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:503 │ │ │ │ +_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:659 │ │ │ │ +_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:515 │ │ │ │ +_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 kamg.hh:253 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_A_M_G_<_ _M_,_ _X_,_ _S_,_ _P_I_,_ _A_ _>_:_:_P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n │ │ │ │ -PI ParallelInformation │ │ │ │ -DDeeffiinniittiioonn amg.hh:81 │ │ │ │ +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_:_:_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_:_:_c_o_l │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ +_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_:_:_A_m_g │ │ │ │ DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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:66 │ │ │ │ +_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_:_:_C_o_n_s_t_R_o_w_I_t_e_r_a_t_o_r │ │ │ │ +MatrixImp::DenseMatrixBase< T, A >::ConstIterator ConstRowIterator │ │ │ │ +Const iterator over the matrix rows. │ │ │ │ +DDeeffiinniittiioonn matrix.hh:586 │ │ │ │ +_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_:_:_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:20 │ │ │ │ +_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:67 │ │ │ │ _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 │ │ │ │ DDeeffiinniittiioonn hierarchy.hh:220 │ │ │ │ +_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_<_ _M_,_ _P_a_r_a_l_l_e_l_I_n_f_o_r_m_a_t_i_o_n_,_ _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 │ │ │ │ +Dune::Amg::Hierarchy< ParallelInformation, Allocator > │ │ │ │ +ParallelInformationHierarchy │ │ │ │ +DDeeffiinniittiioonn matrixhierarchy.hh:82 │ │ │ │ _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_:_:_T_r_a_n_s_f_e_r │ │ │ │ +DDeeffiinniittiioonn transfer.hh:32 │ │ │ │ _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:1308 │ │ │ │ +_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_:_:_v_a_l_u_e │ │ │ │ +@ value │ │ │ │ +Whether this is a direct solver. │ │ │ │ +DDeeffiinniittiioonn solvertype.hh:24 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -73,45 +73,88 @@ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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 >
class  Dune::Amg::ParallelIndicesCoarsener< T, E >
class  Dune::Amg::IndicesCoarsener< OwnerOverlapCopyCommunication< G, L >, E >
 Coarsen Indices in the parallel case. More...
class  Dune::Amg::IndicesCoarsener< SequentialInformation, E >
 Coarsen Indices in the sequential case. More...
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::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,36 +1,80 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_ _> │ │ │ │ -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_:_:_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_:_:_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_:_:_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_:_:_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 _A_r_g_u_m_e_n_t_s 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -71,447 +71,1129 @@ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -
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
│ │ │ -
33
│ │ │ -
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
│ │ │ +
26
│ │ │ +
32
│ │ │ +
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
│ │ │ +
96 typedef typename SmootherTraits<T>::Arguments SmootherArgs;
│ │ │ +
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
│ │ │ -
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 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 template<typename T, typename E>
│ │ │ -
324 template<typename Graph, typename I>
│ │ │ -
325 void ParallelIndicesCoarsener<T,E>::buildCoarseRemoteIndices(const RemoteIndices& fineRemote,
│ │ │ - │ │ │ -
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));
│ │ │ + │ │ │ +
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
│ │ │ +
177 typedef typename SmootherTraits<T>::Arguments SmootherArgs;
│ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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 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
│ │ │ -
static Graph::VertexDescriptor coarsen(const SequentialInformation &fineInfo, Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph::VertexDescriptor > &aggregates, SequentialInformation &coarseInfo, typename Graph::VertexDescriptor noAggregates, bool useFixedOrder=false)
Definition indicescoarsener.hh:396
│ │ │ -
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:577
│ │ │ -
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.
│ │ │ +
334 template<class X, class Y, class C, class T>
│ │ │ +
│ │ │ + │ │ │ +
336 {
│ │ │ + │ │ │ + │ │ │ +
│ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
348 {
│ │ │ + │ │ │ + │ │ │ +
│ │ │ +
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>
│ │ │ +
│ │ │ + │ │ │ +
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
│ │ │ + │ │ │ +
DefaultSmootherArgs< typename Smoother::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
│ │ │ + │ │ │ +
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ +
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
│ │ │ + │ │ │ +
int setAggregate(const AggregateDescriptor &)
Definition smoother.hh:691
│ │ │ +
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
│ │ │ + │ │ │ +
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:731
│ │ │ +
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:741
│ │ │ +
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:736
│ │ │ +
const SequentialInformation & getComm()
Definition smoother.hh:128
│ │ │ +
VertexDescriptor AggregateDescriptor
Definition aggregates.hh:586
│ │ │ +
static const VertexDescriptor ISOLATED
Definition aggregates.hh:577
│ │ │ +
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
Definition aggregates.hh:598
│ │ │ +
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
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
│ │ │ + │ │ │ +
Smoother::range_type Range
Definition smoother.hh:372
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │
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 novlpschwarz.hh:256
│ │ │ -
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
│ │ │ + │ │ │ + │ │ │ +
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
│ │ │ +
Traits class for generically constructing non default constructable types.
Definition construction.hh:39
│ │ │ +
Nonoverlapping parallel preconditioner.
Definition novlpschwarz.hh:276
│ │ │ +
SeqSOR< M, X, Y, l >::range_type range_type
Definition novlpschwarz.hh:284
│ │ │ +
SeqSOR< M, X, Y, l >::domain_type domain_type
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:566
│ │ │ -
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.
│ │ │ +
VertexIteratorT< const MatrixGraph< Matrix > > ConstVertexIterator
The constant vertex iterator type.
Definition graph.hh:308
│ │ │ +
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
│ │ │ +
VertexIterator begin()
Get an iterator over the vertices.
│ │ │
Definition pinfo.hh:28
│ │ │ -
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
│ │ │ -
AggregateRenumberer(AggregatesMap< Vertex > &aggregates)
Constructor.
Definition renumberer.hh:40
│ │ │ -
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
Definition preconditioners.hh:267
│ │ │ +
Y range_type
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
│ │ │ + │ │ │ + │ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,508 +1,1346 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -21 { │ │ │ │ -22 │ │ │ │ -33 │ │ │ │ -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 _A_m_g │ │ │ │ +19 { │ │ │ │ +20 │ │ │ │ +26 │ │ │ │ +32 │ │ │ │ +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 SmootherArgs; │ │ │ │ +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> AggregatesMap; │ │ │ │ +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 _V_e_r_t_e_x; │ │ │ │ -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 │ │ │ │ +AggregatesMap& 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 SmootherArgs& 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 SmootherArgs _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 SmootherArgs* 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 SmootherArgs; │ │ │ │ +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 SmootherArgs& 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 SmootherArgs _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 _c_o_a_r_s_e_n(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 _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 > │ │ │ │ +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 ParallelIndicesCoarsener::buildCoarseIndexSet(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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s<_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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s<_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 _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 > │ │ │ │ +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().relaxationFactor); │ │ │ │ +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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s<_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 _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, │ │ │ │ -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 _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 > │ │ │ │ +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_:_:_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 │ │ │ │ -static Graph::VertexDescriptor coarsen(const SequentialInformation &fineInfo, │ │ │ │ -Graph &fineGraph, VM &visitedMap, AggregatesMap< typename Graph:: │ │ │ │ -VertexDescriptor > &aggregates, SequentialInformation &coarseInfo, typename │ │ │ │ -Graph::VertexDescriptor noAggregates, bool useFixedOrder=false) │ │ │ │ -DDeeffiinniittiioonn indicescoarsener.hh:396 │ │ │ │ -_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. │ │ │ │ +334 template │ │ │ │ +_3_3_5 struct _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 > │ │ │ │ +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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_> _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 = _S_e_q_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(args); │ │ │ │ +342 return std::make_shared> (seqPrec, │ │ │ │ +args._g_e_t_C_o_m_m()); │ │ │ │ +343 } │ │ │ │ +344 }; │ │ │ │ +345 │ │ │ │ +346 template │ │ │ │ +_3_4_7 struct _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 > │ │ │ │ +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 _C_o_n_s_t_r_u_c_t_i_o_n_T_r_a_i_t_s_<_T_> _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 = _S_e_q_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(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_> > │ │ │ │ +Father; │ │ │ │ +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 _F_a_t_h_e_r_:_:_s_e_t_M_a_t_r_i_x(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_> │ │ │ │ +SmootherArgs; │ │ │ │ +579 │ │ │ │ +580 switch(_F_a_t_h_e_r_:_:_g_e_t_A_r_g_s().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 _F_a_t_h_e_r_:_:_s_e_t_M_a_t_r_i_x(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_> │ │ │ │ +SmootherArgs; │ │ │ │ +624 │ │ │ │ +625 switch(_F_a_t_h_e_r_:_:_g_e_t_A_r_g_s().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()]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) │ │ │ │ +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()]!=_A_g_g_r_e_g_a_t_e_s_M_a_p_:_:_I_S_O_L_A_T_E_D) { │ │ │ │ +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 _s_i_z_e___t_y_p_e; │ │ │ │ +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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,53 +66,54 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -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 <sstream>
│ │ │ +#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,34 +1,33 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ +#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_ _> │ │ │ │ -  _I_t_e_r_a_t_o_r 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,411 +66,161 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
25
│ │ │ -
30
│ │ │ -
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
│ │ │ -
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>;
│ │ │ +
8#include <cmath>
│ │ │ +
9#include <complex>
│ │ │ +
10#include <map>
│ │ │ +
11#include <vector>
│ │ │ +
12#include <sstream>
│ │ │ +
13
│ │ │ +
14#include <dune/common/fmatrix.hh>
│ │ │ +
15#include <dune/common/scalarvectorview.hh>
│ │ │ +
16#include <dune/common/scalarmatrixview.hh>
│ │ │ +
17
│ │ │ +
18#include "istlexception.hh"
│ │ │ +
19
│ │ │ +
23
│ │ │ +
24namespace Dune
│ │ │ +
25{
│ │ │ +
26
│ │ │ +
30
│ │ │ +
│ │ │ +
31 namespace DILU
│ │ │ +
32 {
│ │ │ +
33
│ │ │ +
51 template <class M>
│ │ │ +
│ │ │ +
52 void blockDILUDecomposition(M &A, std::vector<typename M::block_type> &Dinv_)
│ │ │ +
53 {
│ │ │ +
54 auto endi = A.end();
│ │ │ +
55 for (auto row = A.begin(); row != endi; ++row)
│ │ │ +
56 {
│ │ │ +
57 const auto row_i = row.index();
│ │ │ +
58 const auto col = row->find(row_i);
│ │ │ +
59 // initialise Dinv[i] = A[i, i]
│ │ │ +
60 Dinv_[row_i] = *col;
│ │ │ +
61 }
│ │ │ +
62
│ │ │ +
63 for (auto row = A.begin(); row != endi; ++row)
│ │ │ +
64 {
│ │ │ +
65 const auto row_i = row.index();
│ │ │ +
66 for (auto a_ij = row->begin(); a_ij.index() < row_i; ++a_ij)
│ │ │ +
67 {
│ │ │ +
68 const auto col_j = a_ij.index();
│ │ │ +
69 const auto a_ji = A[col_j].find(row_i);
│ │ │ +
70 // if A[i, j] != 0 and A[j, i] != 0
│ │ │ +
71 if (a_ji != A[col_j].end())
│ │ │ +
72 {
│ │ │ +
73 // Dinv[i] -= A[i, j] * d[j] * A[j, i]
│ │ │ +
74 Dinv_[row_i] -= (*a_ij) * Dinv_[col_j] * (*a_ji);
│ │ │ +
75 }
│ │ │ +
76 }
│ │ │
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&>
│ │ │ +
78 // store the inverse
│ │ │ +
79 try
│ │ │ +
80 {
│ │ │ +
81 Impl::asMatrix(Dinv_[row_i]).invert(); // compute inverse of diagonal block
│ │ │ +
82 }
│ │ │ +
83 catch (Dune::FMatrixError &e)
│ │ │ +
84 {
│ │ │ +
85 std::ostringstream sstream;
│ │ │ +
86 sstream << THROWSPEC(MatrixBlockError)
│ │ │ +
87 << "DILU failed to invert matrix block D[" << row_i << "]" << e.what();
│ │ │ + │ │ │ +
89 ex.message(sstream.str());
│ │ │ +
90 ex.r = row_i;
│ │ │ +
91 throw ex;
│ │ │ +
92 }
│ │ │ +
93 }
│ │ │ +
94 }
│ │ │ +
│ │ │ +
95
│ │ │ +
111 template <class M, class X, class Y>
│ │ │ +
│ │ │ +
112 void blockDILUBacksolve(const M &A, const std::vector<typename M::block_type> Dinv_, X &v, const Y &d)
│ │ │ +
113 {
│ │ │ +
114 using dblock = typename Y::block_type;
│ │ │ +
115 using vblock = typename X::block_type;
│ │ │ +
116
│ │ │ +
117 // lower triangular solve: (D + L_A) y = d
│ │ │ +
118 auto endi = A.end();
│ │ │ +
119 for (auto row = A.begin(); row != endi; ++row)
│ │ │
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:
│ │ │ -
128 LevelIterator() = default;
│ │ │ -
129
│ │ │ -
│ │ │ -
130 LevelIterator(std::shared_ptr<Element> element)
│ │ │ -
131 : element_(std::move(element))
│ │ │ -
132 {}
│ │ │ -
│ │ │ -
133
│ │ │ -
135 template <class C_, class T1_,
│ │ │ -
136 std::enable_if_t<std::is_same_v<std::remove_const_t<C>, std::remove_const_t<C_>>, int> = 0,
│ │ │ -
137 std::enable_if_t<std::is_same_v<std::remove_const_t<T1>, std::remove_const_t<T1_>>, int> = 0>
│ │ │ -
│ │ │ - │ │ │ -
139 : element_(other.element_)
│ │ │ -
140 {}
│ │ │ -
│ │ │ -
141
│ │ │ -
142 template <class C_, class T1_,
│ │ │ -
143 std::enable_if_t<std::is_same_v<std::remove_const_t<C>, std::remove_const_t<C_>>, int> = 0,
│ │ │ -
144 std::enable_if_t<std::is_same_v<std::remove_const_t<T1>, std::remove_const_t<T1_>>, int> = 0>
│ │ │ -
│ │ │ - │ │ │ -
146 {
│ │ │ -
147 element_ = other.element_;
│ │ │ -
148 return *this;
│ │ │ -
149 }
│ │ │ +
121 const auto row_i = row.index();
│ │ │ +
122 dblock rhsValue(d[row_i]);
│ │ │ +
123 auto &&rhs = Impl::asVector(rhsValue);
│ │ │ +
124 for (auto a_ij = (*row).begin(); a_ij.index() < row_i; ++a_ij)
│ │ │ +
125 {
│ │ │ +
126 // if A[i][j] != 0
│ │ │ +
127 // rhs -= A[i][j]* y[j], where v_j stores y_j
│ │ │ +
128 const auto col_j = a_ij.index();
│ │ │ +
129 Impl::asMatrix(*a_ij).mmv(v[col_j], rhs);
│ │ │ +
130 }
│ │ │ +
131 // y_i = Dinv_i * rhs
│ │ │ +
132 // storing y_i in v_i
│ │ │ +
133 auto &&vi = Impl::asVector(v[row_i]);
│ │ │ +
134 Impl::asMatrix(Dinv_[row_i]).mv(rhs, vi); // (D + L_A)_ii = D_i
│ │ │ +
135 }
│ │ │ +
136
│ │ │ +
137 // upper triangular solve: (D + U_A) v = Dy
│ │ │ +
138 auto rendi = A.beforeBegin();
│ │ │ +
139 for (auto row = A.beforeEnd(); row != rendi; --row)
│ │ │ +
140 {
│ │ │ +
141 const auto row_i = row.index();
│ │ │ +
142 // rhs = 0
│ │ │ +
143 vblock rhs(0.0);
│ │ │ +
144 for (auto a_ij = (*row).beforeEnd(); a_ij.index() > row_i; --a_ij)
│ │ │ +
145 {
│ │ │ +
146 // if A[i][j] != 0
│ │ │ +
147 // rhs += A[i][j]*v[j]
│ │ │ +
148 const auto col_j = a_ij.index();
│ │ │ +
149 Impl::asMatrix(*a_ij).umv(v[col_j], rhs);
│ │ │ +
150 }
│ │ │ +
151 // calculate update v = M^-1*d
│ │ │ +
152 // v_i = y_i - Dinv_i*rhs
│ │ │ +
153 // before update v_i is y_i
│ │ │ +
154 auto &&vi = Impl::asVector(v[row_i]);
│ │ │ +
155 Impl::asMatrix(Dinv_[row_i]).mmv(rhs, vi);
│ │ │ +
156 }
│ │ │ +
157 }
│ │ │
│ │ │ -
150
│ │ │ -
│ │ │ -
154 bool equals(const LevelIterator<typename std::remove_const<C>::type,
│ │ │ -
155 typename std::remove_const<T1>::type>& other) const
│ │ │ -
156 {
│ │ │ -
157 return element_ == other.element_;
│ │ │ -
158 }
│ │ │ +
158 } // end namespace DILU
│ │ │
│ │ │
159
│ │ │ -
│ │ │ -
163 bool equals(const LevelIterator<const typename std::remove_const<C>::type,
│ │ │ -
164 const typename std::remove_const<T1>::type>& other) const
│ │ │ -
165 {
│ │ │ -
166 return element_ == other.element_;
│ │ │ -
167 }
│ │ │ -
│ │ │ -
168
│ │ │ -
│ │ │ -
170 T1& dereference() const
│ │ │ -
171 {
│ │ │ -
172 return *(element_->element_);
│ │ │ -
173 }
│ │ │ -
│ │ │ -
174
│ │ │ -
│ │ │ - │ │ │ -
177 {
│ │ │ -
178 element_ = element_->coarser_.lock();
│ │ │ -
179 }
│ │ │ -
│ │ │ -
180
│ │ │ -
│ │ │ - │ │ │ -
183 {
│ │ │ -
184 element_ = element_->finer_;
│ │ │ -
185 }
│ │ │ -
│ │ │ -
186
│ │ │ -
│ │ │ -
191 bool isRedistributed() const
│ │ │ -
192 {
│ │ │ -
193 return (bool)element_->redistributed_;
│ │ │ -
194 }
│ │ │ -
│ │ │ -
195
│ │ │ -
│ │ │ - │ │ │ -
201 {
│ │ │ -
202 assert(element_->redistributed_);
│ │ │ -
203 return *element_->redistributed_;
│ │ │ -
204 }
│ │ │ -
│ │ │ -
│ │ │ -
205 void addRedistributed(std::shared_ptr<T1> t)
│ │ │ -
206 {
│ │ │ -
207 element_->redistributed_ = t;
│ │ │ -
208 }
│ │ │ -
│ │ │ -
209
│ │ │ -
│ │ │ - │ │ │ -
211 {
│ │ │ -
212 element_->redistributed_ = nullptr;
│ │ │ -
213 }
│ │ │ -
│ │ │ -
214
│ │ │ -
215 private:
│ │ │ -
216 std::shared_ptr<Element> element_ = {};
│ │ │ -
217 };
│ │ │ -
│ │ │ -
218
│ │ │ - │ │ │ -
221
│ │ │ - │ │ │ -
224
│ │ │ - │ │ │ -
230
│ │ │ - │ │ │ -
236
│ │ │ -
237
│ │ │ - │ │ │ -
243
│ │ │ - │ │ │ -
249
│ │ │ -
254 std::size_t levels() const;
│ │ │ -
255
│ │ │ -
256 private:
│ │ │ -
262 std::shared_ptr<MemberType> originalFinest_;
│ │ │ -
264 std::shared_ptr<Element> finest_;
│ │ │ -
266 std::shared_ptr<Element> coarsest_;
│ │ │ -
268 Allocator allocator_;
│ │ │ -
270 int levels_;
│ │ │ -
271 };
│ │ │ -
│ │ │ -
272
│ │ │ -
273 template<class T, class A>
│ │ │ -
│ │ │ -
274 Hierarchy<T,A>::Hierarchy(const std::shared_ptr<MemberType> & first)
│ │ │ -
275 : originalFinest_(first)
│ │ │ -
276 {
│ │ │ -
277 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
278 finest_->element_ = originalFinest_;
│ │ │ -
279 coarsest_ = finest_;
│ │ │ -
280 levels_ = 1;
│ │ │ -
281 }
│ │ │ -
│ │ │ -
282
│ │ │ -
284 //TODO: do we actually want to support this? This might be very expensive?!
│ │ │ -
285 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
287 : allocator_(other.allocator_),
│ │ │ -
288 levels_(other.levels_)
│ │ │ -
289 {
│ │ │ -
290 if(!other.finest_)
│ │ │ -
291 {
│ │ │ -
292 finest_=coarsest_=nullptr;
│ │ │ -
293 return;
│ │ │ -
294 }
│ │ │ -
295 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
296 std::shared_ptr<Element> finer_;
│ │ │ -
297 std::shared_ptr<Element> current_ = finest_;
│ │ │ -
298 std::weak_ptr<Element> otherWeak_ = other.finest_;
│ │ │ -
299
│ │ │ -
300 while(! otherWeak_.expired())
│ │ │ -
301 {
│ │ │ -
302 // create shared_ptr from weak_ptr, we just checked that this is safe
│ │ │ -
303 std::shared_ptr<Element> otherCurrent_ = std::shared_ptr<Element>(otherWeak_);
│ │ │ -
304 // clone current level
│ │ │ -
305 //TODO: should we use the allocator?
│ │ │ -
306 current_->element_ =
│ │ │ -
307 std::make_shared<MemberType>(*(otherCurrent_->element_));
│ │ │ -
308 current_->finer_=finer_;
│ │ │ -
309 if(otherCurrent_->redistributed_)
│ │ │ -
310 current_->redistributed_ =
│ │ │ -
311 std::make_shared<MemberType>(*(otherCurrent_->redistributed_));
│ │ │ -
312 finer_=current_;
│ │ │ -
313 if(not otherCurrent_->coarser_.expired())
│ │ │ -
314 {
│ │ │ -
315 auto c = std::allocate_shared<Element>(allocator_);
│ │ │ -
316 current_->coarser_ = c;
│ │ │ -
317 current_ = c;
│ │ │ -
318 }
│ │ │ -
319 // go to coarser level
│ │ │ -
320 otherWeak_ = otherCurrent_->coarser_;
│ │ │ -
321 }
│ │ │ -
322 coarsest_=current_;
│ │ │ -
323 }
│ │ │ -
│ │ │ -
324
│ │ │ -
325 template<class T, class A>
│ │ │ -
│ │ │ -
326 std::size_t Hierarchy<T,A>::levels() const
│ │ │ -
327 {
│ │ │ -
328 return levels_;
│ │ │ -
329 }
│ │ │ -
│ │ │ -
330
│ │ │ -
331 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
333 {
│ │ │ -
334 coarsest_->redistributed_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
335 }
│ │ │ -
│ │ │ -
336
│ │ │ -
337 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
339 {
│ │ │ -
340 if(!coarsest_) {
│ │ │ -
341 // we have no levels at all...
│ │ │ -
342 assert(!finest_);
│ │ │ -
343 // allocate into the shared_ptr
│ │ │ -
344 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
345 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
346 coarsest_->element_ = originalFinest_;
│ │ │ -
347 finest_ = coarsest_;
│ │ │ -
348 }else{
│ │ │ -
349 auto old_coarsest = coarsest_;
│ │ │ -
350 coarsest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
351 coarsest_->finer_ = old_coarsest;
│ │ │ -
352 coarsest_->element_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
353 old_coarsest->coarser_ = coarsest_;
│ │ │ -
354 }
│ │ │ -
355 ++levels_;
│ │ │ -
356 }
│ │ │ -
│ │ │ -
357
│ │ │ -
358
│ │ │ -
359 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
361 {
│ │ │ -
362 //TODO: wouldn't it be better to do this in the constructor?'
│ │ │ -
363 if(!finest_) {
│ │ │ -
364 // we have no levels at all...
│ │ │ -
365 assert(!coarsest_);
│ │ │ -
366 // allocate into the shared_ptr
│ │ │ -
367 originalFinest_ = ConstructionTraits<MemberType>::construct(args);
│ │ │ -
368 finest_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
369 finest_->element = originalFinest_;
│ │ │ -
370 coarsest_ = finest_;
│ │ │ -
371 }else{
│ │ │ -
372 finest_->finer_ = std::allocate_shared<Element>(allocator_);
│ │ │ -
373 finest_->finer_->coarser_ = finest_;
│ │ │ -
374 finest_ = finest_->finer_;
│ │ │ -
375 finest_->element = ConstructionTraits<T>::construct(args);
│ │ │ -
376 }
│ │ │ -
377 ++levels_;
│ │ │ -
378 }
│ │ │ -
│ │ │ -
379
│ │ │ -
380 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
382 {
│ │ │ -
383 return Iterator(finest_);
│ │ │ -
384 }
│ │ │ -
│ │ │ -
385
│ │ │ -
386 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
388 {
│ │ │ -
389 return Iterator(coarsest_);
│ │ │ -
390 }
│ │ │ -
│ │ │ -
391
│ │ │ -
392 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
394 {
│ │ │ -
395 return ConstIterator(finest_);
│ │ │ -
396 }
│ │ │ -
│ │ │ -
397
│ │ │ -
398 template<class T, class A>
│ │ │ -
│ │ │ - │ │ │ -
400 {
│ │ │ -
401 return ConstIterator(coarsest_);
│ │ │ -
402 }
│ │ │ -
│ │ │ -
403
│ │ │ -
404 } // namespace Amg
│ │ │ -
405} // namespace Dune
│ │ │ -
406
│ │ │ -
407#endif
│ │ │ -
Helper classes for the construction of classes without empty constructor.
│ │ │ -
Hierarchy(const Hierarchy &other)
Copy constructor (deep copy!).
Definition hierarchy.hh:286
│ │ │ -
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
void addRedistributedOnCoarsest(Arguments &args)
Definition hierarchy.hh:332
│ │ │ -
std::size_t levels() const
Get the number of levels in the hierarchy.
Definition hierarchy.hh:326
│ │ │ -
ConstIterator coarsest() const
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:399
│ │ │ -
void addCoarser(Arguments &args)
Add an element on a coarser level.
Definition hierarchy.hh:338
│ │ │ -
void addFiner(Arguments &args)
Add an element on a finer level.
Definition hierarchy.hh:360
│ │ │ -
Hierarchy(const std::shared_ptr< MemberType > &first)
Construct a new hierarchy.
Definition hierarchy.hh:274
│ │ │ -
const void * Arguments
A type holding all the arguments needed to call the constructor.
Definition construction.hh:44
│ │ │ -
Iterator coarsest()
Get an iterator positioned at the coarsest level.
Definition hierarchy.hh:387
│ │ │ -
ConstIterator finest() const
Get an iterator positioned at the finest level.
Definition hierarchy.hh:393
│ │ │ -
Iterator finest()
Get an iterator positioned at the finest level.
Definition hierarchy.hh:381
│ │ │ -
STL namespace.
│ │ │ +
161
│ │ │ +
162} // end namespace
│ │ │ +
163
│ │ │ +
164#endif
│ │ │ + │ │ │
Definition allocator.hh:11
│ │ │ -
const Dtype_t BaseGetSuperLUType< T >::type
Definition supermatrix.hh:135
│ │ │ -
Definition novlpschwarz.hh:256
│ │ │ -
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:220
│ │ │ -
LevelIterator< const Hierarchy< T, A >, const T > ConstIterator
Type of the const iterator.
Definition hierarchy.hh:223
│ │ │ -
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 & operator=(const LevelIterator< C_, T1_ > &other)
Definition hierarchy.hh:145
│ │ │ -
void addRedistributed(std::shared_ptr< T1 > t)
Definition hierarchy.hh:205
│ │ │ -
T1 & dereference() const
Dereference the iterator.
Definition hierarchy.hh:170
│ │ │ -
bool equals(const LevelIterator< typename std::remove_const< C >::type, typename std::remove_const< T1 >::type > &other) const
Equality check.
Definition hierarchy.hh:154
│ │ │ -
bool isRedistributed() const
Check whether there was a redistribution at the current level.
Definition hierarchy.hh:191
│ │ │ -
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:163
│ │ │ -
void increment()
Move to the next coarser level.
Definition hierarchy.hh:176
│ │ │ -
void deleteRedistributed()
Definition hierarchy.hh:210
│ │ │ -
void decrement()
Move to the next fine level.
Definition hierarchy.hh:182
│ │ │ -
LevelIterator(const LevelIterator< C_, T1_ > &other)
Copy constructor.
Definition hierarchy.hh:138
│ │ │ -
T1 & getRedistributed() const
Get the redistributed container.
Definition hierarchy.hh:200
│ │ │ -
LevelIterator()=default
Constructor.
│ │ │ +
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ +
Definition dilu.hh:32
│ │ │ +
void blockDILUDecomposition(M &A, std::vector< typename M::block_type > &Dinv_)
Definition dilu.hh:52
│ │ │ +
void blockDILUBacksolve(const M &A, const std::vector< typename M::block_type > Dinv_, X &v, const Y &d)
Definition dilu.hh:112
│ │ │ +
Error when performing an operation on a matrix block.
Definition istlexception.hh:52
│ │ │ +
int r
Definition istlexception.hh:54
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,452 +1,160 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -19 { │ │ │ │ -25 │ │ │ │ +8#include │ │ │ │ +9#include │ │ │ │ +10#include │ │ │ │ +11#include │ │ │ │ +12#include │ │ │ │ +13 │ │ │ │ +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 │ │ │ │ +23 │ │ │ │ +24namespace _D_u_n_e │ │ │ │ +25{ │ │ │ │ +26 │ │ │ │ 30 │ │ │ │ -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 │ │ │ │ -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; │ │ │ │ +_3_1 namespace _D_I_L_U │ │ │ │ +32 { │ │ │ │ +33 │ │ │ │ +51 template │ │ │ │ +_5_2 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_) │ │ │ │ +53 { │ │ │ │ +54 auto endi = A.end(); │ │ │ │ +55 for (auto row = A.begin(); row != endi; ++row) │ │ │ │ +56 { │ │ │ │ +57 const auto row_i = row.index(); │ │ │ │ +58 const auto _c_o_l = row->find(row_i); │ │ │ │ +59 // initialise Dinv[i] = A[i, i] │ │ │ │ +60 Dinv_[row_i] = *_c_o_l; │ │ │ │ +61 } │ │ │ │ +62 │ │ │ │ +63 for (auto row = A.begin(); row != endi; ++row) │ │ │ │ +64 { │ │ │ │ +65 const auto row_i = row.index(); │ │ │ │ +66 for (auto a_ij = row->begin(); a_ij.index() < row_i; ++a_ij) │ │ │ │ +67 { │ │ │ │ +68 const auto col_j = a_ij.index(); │ │ │ │ +69 const auto a_ji = A[col_j].find(row_i); │ │ │ │ +70 // if A[i, j] != 0 and A[j, i] != 0 │ │ │ │ +71 if (a_ji != A[col_j].end()) │ │ │ │ +72 { │ │ │ │ +73 // Dinv[i] -= A[i, j] * d[j] * A[j, i] │ │ │ │ +74 Dinv_[row_i] -= (*a_ij) * Dinv_[col_j] * (*a_ji); │ │ │ │ +75 } │ │ │ │ +76 } │ │ │ │ 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&> │ │ │ │ +78 // store the inverse │ │ │ │ +79 try │ │ │ │ +80 { │ │ │ │ +81 Impl::asMatrix(Dinv_[row_i]).invert(); // compute inverse of diagonal block │ │ │ │ +82 } │ │ │ │ +83 catch (Dune::FMatrixError &e) │ │ │ │ +84 { │ │ │ │ +85 std::ostringstream sstream; │ │ │ │ +86 sstream << THROWSPEC(_M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r) │ │ │ │ +87 << "DILU failed to invert matrix block D[" << row_i << "]" << e.what(); │ │ │ │ +88 _M_a_t_r_i_x_B_l_o_c_k_E_r_r_o_r ex; │ │ │ │ +89 ex.message(sstream.str()); │ │ │ │ +90 ex._r = row_i; │ │ │ │ +91 throw ex; │ │ │ │ +92 } │ │ │ │ +93 } │ │ │ │ +94 } │ │ │ │ +95 │ │ │ │ +111 template │ │ │ │ +_1_1_2 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) │ │ │ │ +113 { │ │ │ │ +114 using dblock = typename Y::block_type; │ │ │ │ +115 using vblock = typename X::block_type; │ │ │ │ +116 │ │ │ │ +117 // lower triangular solve: (D + L_A) y = d │ │ │ │ +118 auto endi = A.end(); │ │ │ │ +119 for (auto row = A.begin(); row != endi; ++row) │ │ │ │ 120 { │ │ │ │ -121 friend class _L_e_v_e_l_I_t_e_r_a_t_o_r_:_:_t_y_p_e, │ │ │ │ -122 typename std::remove_const_:_:_t_y_p_e >; │ │ │ │ -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() = default; │ │ │ │ -129 │ │ │ │ -_1_3_0 _L_e_v_e_l_I_t_e_r_a_t_o_r(std::shared_ptr element) │ │ │ │ -131 : element_(std::move(element)) │ │ │ │ -132 {} │ │ │ │ -133 │ │ │ │ -135 template , std:: │ │ │ │ -remove_const_t>, int> = 0, │ │ │ │ -137 std::enable_if_t, std:: │ │ │ │ -remove_const_t>, int> = 0> │ │ │ │ -_1_3_8 _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_<_C___,_T_1___>& other) │ │ │ │ -139 : element_(other.element_) │ │ │ │ -140 {} │ │ │ │ -141 │ │ │ │ -142 template , std:: │ │ │ │ -remove_const_t>, int> = 0, │ │ │ │ -144 std::enable_if_t, std:: │ │ │ │ -remove_const_t>, int> = 0> │ │ │ │ -_1_4_5 _L_e_v_e_l_I_t_e_r_a_t_o_r& _o_p_e_r_a_t_o_r_=(const _L_e_v_e_l_I_t_e_r_a_t_o_r_<_C___,_T_1___>& other) │ │ │ │ -146 { │ │ │ │ -147 element_ = other.element_; │ │ │ │ -148 return *this; │ │ │ │ -149 } │ │ │ │ -150 │ │ │ │ -_1_5_4 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -155 typename std::remove_const::type>& other) const │ │ │ │ -156 { │ │ │ │ -157 return element_ == other.element_; │ │ │ │ -158 } │ │ │ │ +121 const auto row_i = row.index(); │ │ │ │ +122 dblock rhsValue(d[row_i]); │ │ │ │ +123 auto &&rhs = Impl::asVector(rhsValue); │ │ │ │ +124 for (auto a_ij = (*row).begin(); a_ij.index() < row_i; ++a_ij) │ │ │ │ +125 { │ │ │ │ +126 // if A[i][j] != 0 │ │ │ │ +127 // rhs -= A[i][j]* y[j], where v_j stores y_j │ │ │ │ +128 const auto col_j = a_ij.index(); │ │ │ │ +129 Impl::asMatrix(*a_ij).mmv(v[col_j], rhs); │ │ │ │ +130 } │ │ │ │ +131 // y_i = Dinv_i * rhs │ │ │ │ +132 // storing y_i in v_i │ │ │ │ +133 auto &&vi = Impl::asVector(v[row_i]); │ │ │ │ +134 Impl::asMatrix(Dinv_[row_i]).mv(rhs, vi); // (D + L_A)_ii = D_i │ │ │ │ +135 } │ │ │ │ +136 │ │ │ │ +137 // upper triangular solve: (D + U_A) v = Dy │ │ │ │ +138 auto rendi = A.beforeBegin(); │ │ │ │ +139 for (auto row = A.beforeEnd(); row != rendi; --row) │ │ │ │ +140 { │ │ │ │ +141 const auto row_i = row.index(); │ │ │ │ +142 // rhs = 0 │ │ │ │ +143 vblock rhs(0.0); │ │ │ │ +144 for (auto a_ij = (*row).beforeEnd(); a_ij.index() > row_i; --a_ij) │ │ │ │ +145 { │ │ │ │ +146 // if A[i][j] != 0 │ │ │ │ +147 // rhs += A[i][j]*v[j] │ │ │ │ +148 const auto col_j = a_ij.index(); │ │ │ │ +149 Impl::asMatrix(*a_ij).umv(v[col_j], rhs); │ │ │ │ +150 } │ │ │ │ +151 // calculate update v = M^-1*d │ │ │ │ +152 // v_i = y_i - Dinv_i*rhs │ │ │ │ +153 // before update v_i is y_i │ │ │ │ +154 auto &&vi = Impl::asVector(v[row_i]); │ │ │ │ +155 Impl::asMatrix(Dinv_[row_i]).mmv(rhs, vi); │ │ │ │ +156 } │ │ │ │ +157 } │ │ │ │ +158 } // end namespace DILU │ │ │ │ 159 │ │ │ │ -_1_6_3 bool _e_q_u_a_l_s(const _L_e_v_e_l_I_t_e_r_a_t_o_r::type, │ │ │ │ -164 const typename std::remove_const::type>& other) const │ │ │ │ -165 { │ │ │ │ -166 return element_ == other.element_; │ │ │ │ -167 } │ │ │ │ -168 │ │ │ │ -_1_7_0 T1& _d_e_r_e_f_e_r_e_n_c_e() const │ │ │ │ -171 { │ │ │ │ -172 return *(element_->element_); │ │ │ │ -173 } │ │ │ │ -174 │ │ │ │ -_1_7_6 void _i_n_c_r_e_m_e_n_t() │ │ │ │ -177 { │ │ │ │ -178 element_ = element_->coarser_.lock(); │ │ │ │ -179 } │ │ │ │ -180 │ │ │ │ -_1_8_2 void _d_e_c_r_e_m_e_n_t() │ │ │ │ -183 { │ │ │ │ -184 element_ = element_->finer_; │ │ │ │ -185 } │ │ │ │ -186 │ │ │ │ -_1_9_1 bool _i_s_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ -192 { │ │ │ │ -193 return (bool)element_->redistributed_; │ │ │ │ -194 } │ │ │ │ -195 │ │ │ │ -_2_0_0 T1& _g_e_t_R_e_d_i_s_t_r_i_b_u_t_e_d() const │ │ │ │ -201 { │ │ │ │ -202 assert(element_->redistributed_); │ │ │ │ -203 return *element_->redistributed_; │ │ │ │ -204 } │ │ │ │ -_2_0_5 void _a_d_d_R_e_d_i_s_t_r_i_b_u_t_e_d(std::shared_ptr t) │ │ │ │ -206 { │ │ │ │ -207 element_->redistributed_ = t; │ │ │ │ -208 } │ │ │ │ -209 │ │ │ │ -_2_1_0 void _d_e_l_e_t_e_R_e_d_i_s_t_r_i_b_u_t_e_d() │ │ │ │ -211 { │ │ │ │ -212 element_->redistributed_ = nullptr; │ │ │ │ -213 } │ │ │ │ -214 │ │ │ │ -215 private: │ │ │ │ -216 std::shared_ptr element_ = {}; │ │ │ │ -217 }; │ │ │ │ -218 │ │ │ │ -_2_2_0 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; │ │ │ │ -221 │ │ │ │ -_2_2_3 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; │ │ │ │ -224 │ │ │ │ -_2_2_9 _I_t_e_r_a_t_o_r _f_i_n_e_s_t(); │ │ │ │ -230 │ │ │ │ -_2_3_5 _I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t(); │ │ │ │ -236 │ │ │ │ -237 │ │ │ │ -_2_4_2 _C_o_n_s_t_I_t_e_r_a_t_o_r _f_i_n_e_s_t() const; │ │ │ │ -243 │ │ │ │ -_2_4_8 _C_o_n_s_t_I_t_e_r_a_t_o_r _c_o_a_r_s_e_s_t() const; │ │ │ │ -249 │ │ │ │ -_2_5_4 std::size_t _l_e_v_e_l_s() const; │ │ │ │ -255 │ │ │ │ -256 private: │ │ │ │ -262 std::shared_ptr originalFinest_; │ │ │ │ -264 std::shared_ptr finest_; │ │ │ │ -266 std::shared_ptr coarsest_; │ │ │ │ -268 _A_l_l_o_c_a_t_o_r allocator_; │ │ │ │ -270 int levels_; │ │ │ │ -271 }; │ │ │ │ -272 │ │ │ │ -273 template │ │ │ │ -_2_7_4 _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) │ │ │ │ -275 : originalFinest_(first) │ │ │ │ -276 { │ │ │ │ -277 finest_ = std::allocate_shared(allocator_); │ │ │ │ -278 finest_->element_ = originalFinest_; │ │ │ │ -279 coarsest_ = finest_; │ │ │ │ -280 levels_ = 1; │ │ │ │ -281 } │ │ │ │ -282 │ │ │ │ -284 //TODO: do we actually want to support this? This might be very expensive?! │ │ │ │ -285 template │ │ │ │ -_2_8_6 _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) │ │ │ │ -287 : allocator_(other.allocator_), │ │ │ │ -288 levels_(other.levels_) │ │ │ │ -289 { │ │ │ │ -290 if(!other.finest_) │ │ │ │ -291 { │ │ │ │ -292 finest_=coarsest_=nullptr; │ │ │ │ -293 return; │ │ │ │ -294 } │ │ │ │ -295 finest_ = std::allocate_shared(allocator_); │ │ │ │ -296 std::shared_ptr finer_; │ │ │ │ -297 std::shared_ptr current_ = finest_; │ │ │ │ -298 std::weak_ptr otherWeak_ = other.finest_; │ │ │ │ -299 │ │ │ │ -300 while(! otherWeak_.expired()) │ │ │ │ -301 { │ │ │ │ -302 // create shared_ptr from weak_ptr, we just checked that this is safe │ │ │ │ -303 std::shared_ptr otherCurrent_ = std::shared_ptr │ │ │ │ -(otherWeak_); │ │ │ │ -304 // clone current level │ │ │ │ -305 //TODO: should we use the allocator? │ │ │ │ -306 current_->element_ = │ │ │ │ -307 std::make_shared(*(otherCurrent_->element_)); │ │ │ │ -308 current_->finer_=finer_; │ │ │ │ -309 if(otherCurrent_->redistributed_) │ │ │ │ -310 current_->redistributed_ = │ │ │ │ -311 std::make_shared(*(otherCurrent_->redistributed_)); │ │ │ │ -312 finer_=current_; │ │ │ │ -313 if(not otherCurrent_->coarser_.expired()) │ │ │ │ -314 { │ │ │ │ -315 auto c = std::allocate_shared(allocator_); │ │ │ │ -316 current_->coarser_ = c; │ │ │ │ -317 current_ = c; │ │ │ │ -318 } │ │ │ │ -319 // go to coarser level │ │ │ │ -320 otherWeak_ = otherCurrent_->coarser_; │ │ │ │ -321 } │ │ │ │ -322 coarsest_=current_; │ │ │ │ -323 } │ │ │ │ -324 │ │ │ │ -325 template │ │ │ │ -_3_2_6 std::size_t _H_i_e_r_a_r_c_h_y_<_T_,_A_>_:_:_l_e_v_e_l_s() const │ │ │ │ -327 { │ │ │ │ -328 return levels_; │ │ │ │ -329 } │ │ │ │ -330 │ │ │ │ -331 template │ │ │ │ -_3_3_2 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) │ │ │ │ -333 { │ │ │ │ -334 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); │ │ │ │ -335 } │ │ │ │ -336 │ │ │ │ -337 template │ │ │ │ -_3_3_8 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) │ │ │ │ -339 { │ │ │ │ -340 if(!coarsest_) { │ │ │ │ -341 // we have no levels at all... │ │ │ │ -342 assert(!finest_); │ │ │ │ -343 // allocate into the shared_ptr │ │ │ │ -344 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); │ │ │ │ -345 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ -346 coarsest_->element_ = originalFinest_; │ │ │ │ -347 finest_ = coarsest_; │ │ │ │ -348 }else{ │ │ │ │ -349 auto old_coarsest = coarsest_; │ │ │ │ -350 coarsest_ = std::allocate_shared(allocator_); │ │ │ │ -351 coarsest_->finer_ = old_coarsest; │ │ │ │ -352 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); │ │ │ │ -353 old_coarsest->coarser_ = coarsest_; │ │ │ │ -354 } │ │ │ │ -355 ++levels_; │ │ │ │ -356 } │ │ │ │ -357 │ │ │ │ -358 │ │ │ │ -359 template │ │ │ │ -_3_6_0 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) │ │ │ │ -361 { │ │ │ │ -362 //TODO: wouldn't it be better to do this in the constructor?' │ │ │ │ -363 if(!finest_) { │ │ │ │ -364 // we have no levels at all... │ │ │ │ -365 assert(!coarsest_); │ │ │ │ -366 // allocate into the shared_ptr │ │ │ │ -367 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); │ │ │ │ -368 finest_ = std::allocate_shared(allocator_); │ │ │ │ -369 finest_->element = originalFinest_; │ │ │ │ -370 coarsest_ = finest_; │ │ │ │ -371 }else{ │ │ │ │ -372 finest_->finer_ = std::allocate_shared(allocator_); │ │ │ │ -373 finest_->finer_->coarser_ = finest_; │ │ │ │ -374 finest_ = finest_->finer_; │ │ │ │ -375 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); │ │ │ │ -376 } │ │ │ │ -377 ++levels_; │ │ │ │ -378 } │ │ │ │ -379 │ │ │ │ -380 template │ │ │ │ -_3_8_1 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() │ │ │ │ -382 { │ │ │ │ -383 return _I_t_e_r_a_t_o_r(finest_); │ │ │ │ -384 } │ │ │ │ -385 │ │ │ │ -386 template │ │ │ │ -_3_8_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_>_:_:_c_o_a_r_s_e_s_t() │ │ │ │ -388 { │ │ │ │ -389 return _I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ -390 } │ │ │ │ -391 │ │ │ │ -392 template │ │ │ │ -_3_9_3 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 │ │ │ │ -394 { │ │ │ │ -395 return _C_o_n_s_t_I_t_e_r_a_t_o_r(finest_); │ │ │ │ -396 } │ │ │ │ -397 │ │ │ │ -398 template │ │ │ │ -_3_9_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_>_:_:_c_o_a_r_s_e_s_t() const │ │ │ │ -400 { │ │ │ │ -401 return _C_o_n_s_t_I_t_e_r_a_t_o_r(coarsest_); │ │ │ │ -402 } │ │ │ │ -403 │ │ │ │ -404 } // namespace Amg │ │ │ │ -405} // namespace Dune │ │ │ │ -406 │ │ │ │ -407#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:286 │ │ │ │ -_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 &) │ │ │ │ -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_:_:_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:332 │ │ │ │ -_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:326 │ │ │ │ -_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:399 │ │ │ │ -_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:338 │ │ │ │ -_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:360 │ │ │ │ -_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:274 │ │ │ │ -_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_:_:_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:387 │ │ │ │ -_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:393 │ │ │ │ -_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:381 │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +161 │ │ │ │ +162} // end namespace │ │ │ │ +163 │ │ │ │ +164#endif │ │ │ │ +_i_s_t_l_e_x_c_e_p_t_i_o_n_._h_h │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ -_D_u_n_e_:_:_t_y_p_e │ │ │ │ -const Dtype_t BaseGetSuperLUType< T >::type │ │ │ │ -DDeeffiinniittiioonn supermatrix.hh:135 │ │ │ │ -_D_u_n_e_:_:_A_m_g │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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:220 │ │ │ │ -_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:223 │ │ │ │ -_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_:_:_o_p_e_r_a_t_o_r_= │ │ │ │ -LevelIterator & operator=(const LevelIterator< C_, T1_ > &other) │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:145 │ │ │ │ -_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:205 │ │ │ │ -_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:170 │ │ │ │ -_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:154 │ │ │ │ -_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:191 │ │ │ │ -_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:163 │ │ │ │ -_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:176 │ │ │ │ -_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:210 │ │ │ │ -_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:182 │ │ │ │ -_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< C_, T1_ > &other) │ │ │ │ -Copy constructor. │ │ │ │ -DDeeffiinniittiioonn hierarchy.hh:138 │ │ │ │ -_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:200 │ │ │ │ -_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()=default │ │ │ │ -Constructor. │ │ │ │ +_D_u_n_e_:_:_c_o_l │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ +MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ +DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ +_D_u_n_e_:_:_D_I_L_U │ │ │ │ +DDeeffiinniittiioonn dilu.hh:32 │ │ │ │ +_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:52 │ │ │ │ +_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:112 │ │ │ │ +_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_:_:_r │ │ │ │ +int r │ │ │ │ +DDeeffiinniittiioonn istlexception.hh:54 │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,43 +66,60 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::Amg::PropertiesGraphCreator< M, SequentialInformation >
struct  Dune::FieldTraits< MultiTypeBlockVector< Args... > >
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,24 +1,38 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_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_ _> │ │ │ │ +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_._._._ _>_ _> │ │ │ │ + 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,157 +66,365 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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,
│ │ │ -
31 typename SubGraph::EdgeIndexMap>
│ │ │ - │ │ │ -
33
│ │ │ -
34 typedef std::tuple<MatrixGraph*,PropertiesGraph*,SubGraph*> GraphTuple;
│ │ │ +
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 >
│ │ │ + │ │ │ +
24}
│ │ │ +
25
│ │ │ +
26#include "gsetc.hh"
│ │ │ +
27
│ │ │ +
28namespace Dune {
│ │ │ +
29
│ │ │ +
34
│ │ │
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 }
│ │ │ -
│ │ │ +
36
│ │ │ +
37
│ │ │ +
41 template <typename... Args>
│ │ │ +
│ │ │ +
42 struct FieldTraits< MultiTypeBlockVector<Args...> >
│ │ │ +
43 {
│ │ │ + │ │ │ +
45 using real_type = typename MultiTypeBlockVector<Args...>::real_type;
│ │ │ +
46 };
│ │ │ +
│ │ │ +
47
│ │ │ +
50
│ │ │ +
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 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
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
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
│ │ │ -
Definition novlpschwarz.hh:256
│ │ │ -
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.
│ │ │ -
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,187 +1,396 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -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 SubGraph::EdgeIndexMap> │ │ │ │ -_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; │ │ │ │ +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 _M_u_l_t_i_T_y_p_e_B_l_o_c_k_V_e_c_t_o_r; │ │ │ │ +24} │ │ │ │ +25 │ │ │ │ +26#include "_g_s_e_t_c_._h_h" │ │ │ │ +27 │ │ │ │ +28namespace _D_u_n_e { │ │ │ │ +29 │ │ │ │ +34 │ │ │ │ 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()); │ │ │ │ +36 │ │ │ │ +37 │ │ │ │ +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_:_:_f_i_e_l_d___t_y_p_e; │ │ │ │ +_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_:_:_r_e_a_l___t_y_p_e; │ │ │ │ +46 }; │ │ │ │ 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; │ │ │ │ +50 │ │ │ │ +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 >_:_:_t_y_p_e; │ │ │ │ +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_<_ _A_r_g_s_._._._ _>_:_:_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 │ │ │ │ +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_<_ _A_r_g_s_._._._ _>_:_:_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 │ │ │ │ +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 │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,84 +66,68 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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::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...
class  Dune::BlockVector< B, A >
 A vector of blocks with memory management. 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,68 +1,45 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_:_:_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_._._. │ │ │ │ + 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_._._. │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,1847 +66,955 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
36
│ │ │ -
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
│ │ │ -
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 {
│ │ │ -
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
│ │ │ -
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
│ │ │ - │ │ │ +
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
│ │ │ +
37
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ +
166 return *this;
│ │ │ +
167 }
│ │ │ +
168
│ │ │ +
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
│ │ │ +
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
│ │ │ - │ │ │ -
304
│ │ │ - │ │ │ -
309
│ │ │ - │ │ │ -
314
│ │ │ - │ │ │ -
320
│ │ │ - │ │ │ -
325
│ │ │ - │ │ │ -
331
│ │ │ - │ │ │ -
337
│ │ │ - │ │ │ +
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
│ │ │ +
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
│ │ │ - │ │ │ -
374
│ │ │ - │ │ │ -
382
│ │ │ - │ │ │ -
388
│ │ │ -
393 const Matrix& matrix() const;
│ │ │ -
394
│ │ │ -
398 std::size_t noVertices() const;
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ -
499 EdgeIndexMap getEdgeIndexMap();
│ │ │ -
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
│ │ │ +
567
│ │ │ +
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 };
│ │ │ +
│ │ │ +
577
│ │ │ +
580
│ │ │ +
582 template<class K, class A>
│ │ │ +
│ │ │ +
583 std::ostream& operator<< (std::ostream& s, const BlockVector<K, A>& v)
│ │ │ +
584 {
│ │ │ + │ │ │ +
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;
│ │ │ -
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
│ │ │ - │ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ -
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
│ │ │ - │ │ │ +
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
│ │ │ +
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
│ │ │ - │ │ │ -
896
│ │ │ - │ │ │ -
902
│ │ │ - │ │ │ -
908
│ │ │ - │ │ │ -
914
│ │ │ -
920 VertexProperties& getVertexProperties(const VertexDescriptor& vertex);
│ │ │ +
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
│ │ │ +
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;
│ │ │ -
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
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
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 {}
│ │ │ -
│ │ │ -
1383
│ │ │ -
│ │ │ - │ │ │ -
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 {}
│ │ │ -
│ │ │ -
1431
│ │ │ -
│ │ │ - │ │ │ -
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.
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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
│ │ │ +
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.
│ │ │
Definition allocator.hh:11
│ │ │
const Dtype_t BaseGetSuperLUType< T >::type
Definition supermatrix.hh:135
│ │ │ -
Definition novlpschwarz.hh:256
│ │ │ -
derive error class from the base class in common
Definition istlexception.hh:19
│ │ │ - │ │ │ -
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.
│ │ │ -
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.
│ │ │ - │ │ │ -
@ mutableMatrix
Definition graph.hh:86
│ │ │ -
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.
│ │ │ -
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.
│ │ │ - │ │ │ -
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.
│ │ │ - │ │ │ -
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.
│ │ │ -
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
│ │ │ -
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.
│ │ │ -
VertexIterator end()
Get an iterator over the vertices.
│ │ │ -
VertexPropertiesGraph(Graph &graph, const VertexMap vmap=VertexMap())
Constructor.
│ │ │ -
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.
│ │ │ -
VertexIteratorT< const VertexPropertiesGraph< Graph, VertexProperties, VM > > ConstVertexIterator
The type of the constant Vertex iterator.
Definition graph.hh:889
│ │ │ -
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.
│ │ │ -
VertexIteratorT< VertexPropertiesGraph< Graph, VertexProperties, VM > > VertexIterator
The type of the mutable Vertex iterator.
Definition graph.hh:883
│ │ │ -
VertexIterator begin()
Get an iterator over the vertices.
│ │ │ -
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
│ │ │ -
VertexIteratorT(const Father &iter, C *graph)
Constructor.
│ │ │ -
std::conditional< std::is_same< VertexPropertiesGraph< Graph, VertexProperties, VM >, typenamestd::remove_const< VertexPropertiesGraph< Graph, VertexProperties, VM > >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ - │ │ │ -
EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > EdgeIterator
The type of the mutable edge iterator.
Definition graph.hh:1096
│ │ │ -
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.
│ │ │ -
EdgeIteratorT< const PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > ConstEdgeIterator
The type of the constant edge iterator.
Definition graph.hh:1103
│ │ │ - │ │ │ -
VertexIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > VertexIterator
The type of the mutable Vertex iterator.
Definition graph.hh:1212
│ │ │ -
EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor &target)
Definition graph.hh:1265
│ │ │ - │ │ │ -
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
│ │ │ - │ │ │ -
VertexIteratorT< const PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > ConstVertexIterator
The type of the constant Vertex iterator.
Definition graph.hh:1219
│ │ │ -
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.
│ │ │ - │ │ │ - │ │ │ -
EdgeIteratorT(const Father &iter, C *graph)
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< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > >::type >::value, EdgeProperties &, constEdgeProperties & >::type properties() const
│ │ │ - │ │ │ -
std::conditional< std::is_same< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > >::type >::value, VertexProperties &, constVertexProperties & >::type properties() const
│ │ │ -
EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > end() const
│ │ │ -
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
│ │ │ -
EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM > > begin() const
│ │ │ -
VertexIteratorT(const Father &iter, C *graph)
Constructor.
│ │ │ -
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
│ │ │ -
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
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,2361 +1,997 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -21 { │ │ │ │ -36 │ │ │ │ -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 │ │ │ │ +37 │ │ │ │ +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 */ │ │ │ │ -_8_6 _m_u_t_a_b_l_e_M_a_t_r_i_x = std::is_same::type>::value │ │ │ │ -87 }; │ │ │ │ -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 { │ │ │ │ -_1_1_2 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ -113 }; │ │ │ │ +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>_:_:_t_y_p_e │ │ │ │ -_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>_:_:_t_y_p_e │ │ │ │ -_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>_:_:_t_y_p_e │ │ │ │ -_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 { │ │ │ │ -_2_2_5 _i_s_M_u_t_a_b_l_e = std::is_same::value │ │ │ │ -226 }; │ │ │ │ -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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e │ │ │ │ -_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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e = 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_(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 │ │ │ │ +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 EdgeIndexMap _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 │ │ │ │ +567 │ │ │ │ +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 }; │ │ │ │ +577 │ │ │ │ +580 │ │ │ │ +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 _s_i_z_e___t_y_p_e; │ │ │ │ +586 │ │ │ │ +587 for (_s_i_z_e___t_y_p_e 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>_:_:_t_y_p_e │ │ │ │ -803 { │ │ │ │ -804 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_t_y_p_e>; │ │ │ │ -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>_:_:_t_y_p_e │ │ │ │ -_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>_:_:_t_y_p_e │ │ │ │ -_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&>_:_:_t_y_p_e │ │ │ │ -_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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e = 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>_:_:_t_y_p_e │ │ │ │ +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_:_:_t_y_p_e>; │ │ │ │ -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>_:_:_t_y_p_e │ │ │ │ -_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&>_:_:_t_y_p_e │ │ │ │ -_1_0_8_2 _p_r_o_p_e_r_t_i_e_s() 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 _b_e_g_i_n_E_d_g_e_s(const VertexDescriptor& source); │ │ │ │ -1111 │ │ │ │ -_1_1_1_7 _E_d_g_e_I_t_e_r_a_t_o_r _e_n_d_E_d_g_e_s(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 _b_e_g_i_n_E_d_g_e_s(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 _e_n_d_E_d_g_e_s(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>_:_:_t_y_p_e │ │ │ │ -1140 { │ │ │ │ -1141 friend class _V_e_r_t_e_x_I_t_e_r_a_t_o_r_T_:_:_t_y_p_e>; │ │ │ │ -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>_:_:_t_y_p_e │ │ │ │ -_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&>_:_:_t_y_p_e │ │ │ │ -_1_1_8_4 _p_r_o_p_e_r_t_i_e_s() const; │ │ │ │ -1185 │ │ │ │ -_1_1_9_1 _E_d_g_e_I_t_e_r_a_t_o_r_T _b_e_g_i_n() const; │ │ │ │ -1192 │ │ │ │ -_1_1_9_8 _E_d_g_e_I_t_e_r_a_t_o_r_T _e_n_d() 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 _b_e_g_i_n(); │ │ │ │ -1226 │ │ │ │ -_1_2_3_1 _V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d(); │ │ │ │ -1232 │ │ │ │ -_1_2_3_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; │ │ │ │ -1238 │ │ │ │ -_1_2_4_3 _C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r _e_n_d() const; │ │ │ │ -1244 │ │ │ │ -_1_2_5_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); │ │ │ │ -1251 │ │ │ │ -_1_2_5_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; │ │ │ │ -1258 │ │ │ │ -_1_2_6_5 _E_d_g_e_D_e_s_c_r_i_p_t_o_r _f_i_n_d_E_d_g_e(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& _g_r_a_p_h, 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 {} │ │ │ │ -1383 │ │ │ │ -_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 {} │ │ │ │ -1431 │ │ │ │ -_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 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r[graph.noEdges()]; │ │ │ │ -1988 │ │ │ │ -1989 _V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r* 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._e_n_d(); │ │ │ │ -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&>_:_:_t_y_p_e │ │ │ │ -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>_:_:_t_y_p_e │ │ │ │ -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>_:_:_t_y_p_e │ │ │ │ -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&>_:_:_t_y_p_e │ │ │ │ -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&>_:_:_t_y_p_e │ │ │ │ -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. │ │ │ │ -_s_t_d │ │ │ │ -STL namespace. │ │ │ │ +_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. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ _D_u_n_e_:_:_t_y_p_e │ │ │ │ const Dtype_t BaseGetSuperLUType< T >::type │ │ │ │ DDeeffiinniittiioonn supermatrix.hh:135 │ │ │ │ -_D_u_n_e_:_:_A_m_g │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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_:_:_V_e_r_t_e_x_D_e_s_c_r_i_p_t_o_r │ │ │ │ -_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_:_:_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_<_ _c_o_n_s_t_ _M_a_t_r_i_x_ _>_:_:_m_a_t_r_i_x │ │ │ │ -Matrix & matrix() │ │ │ │ -_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_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 │ │ │ │ -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_:_:_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_<_ _c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_ _M_a_t_r_i_x_ _>_ _>_:_:_s_o_u_r_c_e │ │ │ │ -VertexDescriptor source() const │ │ │ │ -_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_:_:_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_ _>_ _>_:_:_i_s_M_u_t_a_b_l_e │ │ │ │ -@ isMutable │ │ │ │ -DDeeffiinniittiioonn graph.hh:112 │ │ │ │ -_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_<_ _c_o_n_s_t_ _M_a_t_r_i_x_G_r_a_p_h_<_ _M_a_t_r_i_x_ _>_ _>_:_: │ │ │ │ -_i_s_M_u_t_a_b_l_e │ │ │ │ -@ isMutable │ │ │ │ -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_:_:_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_:_:_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_:_:_e_n_d │ │ │ │ -VertexIterator end() │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_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_G_r_a_p_h │ │ │ │ -VertexPropertiesGraph(Graph &graph, const VertexMap vmap=VertexMap()) │ │ │ │ -Constructor. │ │ │ │ -_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_:_:_C_o_n_s_t_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIteratorT< const VertexPropertiesGraph< Graph, VertexProperties, VM > > │ │ │ │ -ConstVertexIterator │ │ │ │ -The type of the constant Vertex iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:889 │ │ │ │ -_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_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r │ │ │ │ -VertexIteratorT< VertexPropertiesGraph< Graph, VertexProperties, VM > > │ │ │ │ -VertexIterator │ │ │ │ -The type of the mutable Vertex iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:883 │ │ │ │ -_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 │ │ │ │ -VertexIterator begin() │ │ │ │ -Get an iterator over the vertices. │ │ │ │ -_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_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -VertexIteratorT(const Father &iter, C *graph) │ │ │ │ -Constructor. │ │ │ │ -_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_<_ _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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _V_M_ _>_ _>_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ -std::conditional< std::is_same< VertexPropertiesGraph< Graph, VertexProperties, │ │ │ │ -VM >, typenamestd::remove_const< VertexPropertiesGraph< Graph, │ │ │ │ -VertexProperties, VM > >::type >::value, VertexProperties &, │ │ │ │ -constVertexProperties & >::type properties() const │ │ │ │ -_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_<_ _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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _V_M_ _>_ _>_:_:_e_n_d │ │ │ │ -EdgeIterator end() const │ │ │ │ -_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_<_ _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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _V_M_ _>_ _>_:_:_b_e_g_i_n │ │ │ │ -EdgeIterator begin() const │ │ │ │ -_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ -_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_e_n_d │ │ │ │ -VertexIterator end() │ │ │ │ -_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 │ │ │ │ -EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM │ │ │ │ -> > EdgeIterator │ │ │ │ -The type of the mutable edge iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1096 │ │ │ │ -_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_:_:_C_o_n_s_t_E_d_g_e_I_t_e_r_a_t_o_r │ │ │ │ -EdgeIteratorT< const PropertiesGraph< Graph, VertexProperties, EdgeProperties, │ │ │ │ -VM, EM > > ConstEdgeIterator │ │ │ │ -The type of the constant edge iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1103 │ │ │ │ -_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ -_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_b_e_g_i_n_E_d_g_e_s │ │ │ │ -EdgeIterator beginEdges(const VertexDescriptor &source) │ │ │ │ -_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 │ │ │ │ -VertexIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, │ │ │ │ -EM > > VertexIterator │ │ │ │ -The type of the mutable Vertex iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1212 │ │ │ │ -_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ -_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_f_i_n_d_E_d_g_e │ │ │ │ -EdgeDescriptor findEdge(const VertexDescriptor &source, const VertexDescriptor │ │ │ │ -&target) │ │ │ │ -DDeeffiinniittiioonn graph.hh:1265 │ │ │ │ -_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_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ -_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_e_n_d_E_d_g_e_s │ │ │ │ -EdgeIterator endEdges(const VertexDescriptor &source) │ │ │ │ -_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_<_ _S_u_b_G_r_a_p_h_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ -_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_b_e_g_i_n │ │ │ │ -VertexIterator begin() │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_P_r_o_p_e_r_t_i_e_s_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 PropertiesGraph< Graph, VertexProperties, │ │ │ │ -EdgeProperties, VM, EM > > ConstVertexIterator │ │ │ │ -The type of the constant Vertex iterator. │ │ │ │ -DDeeffiinniittiioonn graph.hh:1219 │ │ │ │ -_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_<_ _S_u_b_G_r_a_p_h_,_ _V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_, │ │ │ │ -_I_d_e_n_t_i_t_y_M_a_p_,_ _t_y_p_e_n_a_m_e_ _S_u_b_G_r_a_p_h_:_:_E_d_g_e_I_n_d_e_x_M_a_p_ _>_:_:_g_e_t_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s │ │ │ │ -VertexProperties & getVertexProperties(const VertexDescriptor &vertex) │ │ │ │ -_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_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T │ │ │ │ -EdgeIteratorT(const Father &iter, C *graph) │ │ │ │ -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_:_:_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_:_:_E_d_g_e_I_t_e_r_a_t_o_r_T_<_ _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ -std::conditional< std::is_same< PropertiesGraph< Graph, VertexProperties, │ │ │ │ -EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, │ │ │ │ -VertexProperties, EdgeProperties, VM, EM > >::type >::value, EdgeProperties &, │ │ │ │ -constEdgeProperties & >::type properties() const │ │ │ │ -_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_<_ _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_p_r_o_p_e_r_t_i_e_s │ │ │ │ -std::conditional< std::is_same< PropertiesGraph< Graph, VertexProperties, │ │ │ │ -EdgeProperties, VM, EM >, typenamestd::remove_const< PropertiesGraph< Graph, │ │ │ │ -VertexProperties, EdgeProperties, VM, EM > >::type >::value, VertexProperties │ │ │ │ -&, constVertexProperties & >::type properties() const │ │ │ │ -_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_<_ _P_r_o_p_e_r_t_i_e_s_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_e_n_d │ │ │ │ -EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM │ │ │ │ -> > end() const │ │ │ │ -_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_:_:_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_G_r_a_p_h_<_ _G_r_a_p_h_, │ │ │ │ -_V_e_r_t_e_x_P_r_o_p_e_r_t_i_e_s_,_ _E_d_g_e_P_r_o_p_e_r_t_i_e_s_,_ _V_M_,_ _E_M_ _>_ _>_:_:_b_e_g_i_n │ │ │ │ -EdgeIteratorT< PropertiesGraph< Graph, VertexProperties, EdgeProperties, VM, EM │ │ │ │ -> > begin() const │ │ │ │ -_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_:_:_V_e_r_t_e_x_I_t_e_r_a_t_o_r_T │ │ │ │ -VertexIteratorT(const Father &iter, C *graph) │ │ │ │ -Constructor. │ │ │ │ -_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_:_:_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_:_:_s_i_z_e___t_y_p_e │ │ │ │ +_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_<_ _B_,_ _A_ _>_:_:_c_a_p_a_c_i_t_y │ │ │ │ +size_type capacity() const │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,60 +66,58 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -Classes | │ │ │ Namespaces | │ │ │ -Variables
│ │ │ - │ │ │ +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
│ │ │ - │ │ │ - │ │ │ - │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │

│ │ │ -Variables

template<typename T, typename TI>
const TI::GlobalIndex Dune::Amg::GlobalAggregatesMap< T, TI >::isolatedMarker

│ │ │ +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,39 +1,44 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 | _V_a_r_i_a_b_l_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 │ │ │ │ -VVaarriiaabblleess │ │ │ │ -template │ │ │ │ -const TI::GlobalIndex  _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_ _>_:_:_i_s_o_l_a_t_e_d_M_a_r_k_e_r │ │ │ │ -********** DDeettaaiilleedd DDeessccrriippttiioonn ********** │ │ │ │ -Provdes class for identifying aggregates globally. │ │ │ │ - Author │ │ │ │ - Markus Blatt │ │ │ │ +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. │ │ │ │ =============================================================================== │ │ │ │ Generated by _[_d_o_x_y_g_e_n_] 1.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,347 +66,211 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ -
17
│ │ │ -
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:731
│ │ │ -
const_iterator end() const
Definition aggregates.hh:736
│ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ -
const AggregateDescriptor * const_iterator
Definition aggregates.hh:729
│ │ │ -
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:572
│ │ │ +
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
│ │ │ -
Definition novlpschwarz.hh:256
│ │ │ -
const TI::GlobalIndex GlobalAggregatesMap< T, TI >::isolatedMarker
Definition globalaggregates.hh:109
│ │ │ -
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
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< T1, LI, 512 > ParallelIndexSet
Definition owneroverlapcopy.hh:449
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ -
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
│ │ │ -
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
│ │ │ +
Definition foreach.hh:66
│ │ │ +
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,433 +1,239 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ -17 │ │ │ │ -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 _A_m_g │ │ │ │ -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 Proxy _o_p_e_r_a_t_o_r_[_](std::size_t index) │ │ │ │ -92 { │ │ │ │ -93 return Proxy(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 _i_s_o_l_a_t_e_d_M_a_r_k_e_r; │ │ │ │ -106 }; │ │ │ │ -107 │ │ │ │ -108 template │ │ │ │ -_1_0_9 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 _A_m_g │ │ │ │ -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 _F_o_r_E_a_c_h{ │ │ │ │ +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<_A_m_g::GlobalAggregatesMap > │ │ │ │ -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:731 │ │ │ │ -_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:736 │ │ │ │ -_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:577 │ │ │ │ -_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:729 │ │ │ │ -_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:572 │ │ │ │ +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_:_:_A_m_g │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_D_u_n_e_:_:_A_m_g_:_:_i_s_o_l_a_t_e_d_M_a_r_k_e_r │ │ │ │ -const TI::GlobalIndex GlobalAggregatesMap< T, TI >::isolatedMarker │ │ │ │ -DDeeffiinniittiioonn globalaggregates.hh:109 │ │ │ │ -_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_<_ _T_1_,_ _T_2_ _>_:_:_G_l_o_b_a_l_L_o_o_k_u_p_I_n_d_e_x_S_e_t │ │ │ │ -Dune::GlobalLookupIndexSet< ParallelIndexSet > GlobalLookupIndexSet │ │ │ │ -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_<_ _T_1_,_ _T_2_ _>_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ -Dune::ParallelIndexSet< T1, LI, 512 > ParallelIndexSet │ │ │ │ -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:566 │ │ │ │ -_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_:_:_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 │ │ │ │ +DDeeffiinniittiioonn foreach.hh:66 │ │ │ │ +_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,62 +66,60 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ 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/solverregistry.hh>
│ │ │
│ │ │

Go to the source code of this file.

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

│ │ │ Classes

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::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 >
class  Dune::LDL< Matrix >
 Use the LDL package to directly solve linear systems – empty default class. More...
class  Dune::LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > >
 The LDL direct sparse solver for matrices of type BCRSMatrix. More...
struct  Dune::IsDirectSolver< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > >
struct  Dune::StoresColumnCompressed< LDL< BCRSMatrix< FieldMatrix< T, n, m >, A > > >
│ │ │ │ │ │ │ │ │ - │ │ │ +

│ │ │ Namespaces

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

│ │ │ +Functions

 Dune::DUNE_REGISTER_SOLVER ("ldl", [](auto opTraits, const auto &op, const Dune::ParameterTree &config) -> std::shared_ptr< typename decltype(opTraits)::solver_type > { using OpTraits=decltype(opTraits);using M=typename OpTraits::matrix_type;if constexpr(OpTraits::isParallel){ if(opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune::InvalidStateException, "LDL works only for sequential operators.");} if constexpr(std::is_convertible_v< LDL< M > *, Dune::InverseOperator< typename OpTraits::domain_type, typename OpTraits::range_type > * > &&std::is_same_v< typename FieldTraits< M >::field_type, double >){ const auto &A=opTraits.getAssembledOpOrThrow(op);const M &mat=A->getmat();int verbose=config.get("verbose", 0);return std::make_shared< LDL< M > >(mat, verbose);} DUNE_THROW(UnsupportedType, "Unsupported Type in LDL (only FieldMatrix<double,...> supported)");})
│ │ │

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,47 +1,50 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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_r_e_g_i_s_t_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_:_:_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_ _> │ │ │ │ + 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_:_:_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_._._. │ │ │ │ +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_ _>_ _>_ _> │ │ │ │ +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_ _>_ _>_ _> │ │ │ │ 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___S_O_L_V_E_R ("ldl", [](auto opTraits, const auto &op, const │ │ │ │ + Dune::ParameterTree &config) -> std::shared_ptr< typename decltype │ │ │ │ + (opTraits)::solver_type > { using OpTraits=decltype(opTraits);using │ │ │ │ + M=typename OpTraits::matrix_type;if constexpr(OpTraits::isParallel){ if │ │ │ │ + (opTraits.getCommOrThrow(op).communicator().size() > 1) DUNE_THROW(Dune:: │ │ │ │ + InvalidStateException, "LDL works only for sequential operators.");} if │ │ │ │ + constexpr(std::is_convertible_v< _L_D_L< M > *, _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r< typename │ │ │ │ + OpTraits::domain_type, typename OpTraits::range_type > * > &&std::is_same_v< │ │ │ │ + typename FieldTraits< M >::field_type, double >){ const auto │ │ │ │ + &A=opTraits.getAssembledOpOrThrow(op);const M &mat=A->getmat();int │ │ │ │ + verbose=config.get("verbose", 0);return std::make_shared< _L_D_L< M > >(mat, │ │ │ │ + verbose);} DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, "Unsupported Type in _L_D_L (only │ │ │ │ + _F_i_e_l_d_M_a_t_r_i_x supported)");}) │ │ │ │ ********** 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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,751 +66,428 @@ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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 {
│ │ │ -
30
│ │ │ -
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
│ │ │ -
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 };
│ │ │ +
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 {
│ │ │ +
40
│ │ │ +
41 // forward declarations
│ │ │ +
42 template<class M, class T, class TM, class TD, class TA>
│ │ │ + │ │ │ +
44
│ │ │ +
45 template<class T, bool tag>
│ │ │ + │ │ │ +
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 void apply(domain_type& x, range_type& b, [[maybe_unused]] double reduction, InverseOperatorResult& res) override
│ │ │ +
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
│ │ │ +
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 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);
│ │ │ -
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);
│ │ │ +
367 template<typename T, typename A, int n, int m>
│ │ │ +
│ │ │ + │ │ │ +
369 {
│ │ │ +
370 enum {value = true};
│ │ │ +
371 };
│ │ │ +
│ │ │ +
372
│ │ │ + │ │ │ +
374 [](auto opTraits, const auto& op, const Dune::ParameterTree& config)
│ │ │ +
375 -> std::shared_ptr<typename decltype(opTraits)::solver_type>
│ │ │ +
376 {
│ │ │ +
377 using OpTraits = decltype(opTraits);
│ │ │ +
378 using M = typename OpTraits::matrix_type;
│ │ │ +
379 // works only for sequential operators
│ │ │ +
380 if constexpr (OpTraits::isParallel){
│ │ │ +
381 if(opTraits.getCommOrThrow(op).communicator().size() > 1)
│ │ │ +
382 DUNE_THROW(Dune::InvalidStateException, "LDL works only for sequential operators.");
│ │ │ +
383 }
│ │ │ +
384 // check if LDL<M>* is convertible to
│ │ │ +
385 // InverseOperator*. This allows only the explicit
│ │ │ +
386 // specialized variants of LDL
│ │ │ +
387 if constexpr (std::is_convertible_v<LDL<M>*,
│ │ │ +
388 Dune::InverseOperator<typename OpTraits::domain_type,
│ │ │ +
389 typename OpTraits::range_type>*> &&
│ │ │ +
390 std::is_same_v<typename FieldTraits<M>::field_type, double>
│ │ │ +
391 ){
│ │ │ +
392 const auto& A = opTraits.getAssembledOpOrThrow(op);
│ │ │ +
393 const M& mat = A->getmat();
│ │ │ +
394 int verbose = config.get("verbose", 0);
│ │ │ +
395 return std::make_shared<LDL<M>>(mat,verbose);
│ │ │ +
396 }
│ │ │ +
397 DUNE_THROW(UnsupportedType,
│ │ │ +
398 "Unsupported Type in LDL (only FieldMatrix<double,...> supported)");
│ │ │ +
399 });
│ │ │ +
400
│ │ │ +
401} // end namespace Dune
│ │ │
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<std::size_t>(minRowSize_, row_.size());
│ │ │ -
543 maxRowSize_=std::max<std::size_t>(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.
│ │ │ -
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.
│ │ │ -
static const V ISOLATED
Identifier of isolated vertices.
Definition aggregates.hh:577
│ │ │ -
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
│ │ │ -
static const V UNAGGREGATED
Identifier of not yet aggregated vertices.
Definition aggregates.hh:572
│ │ │ -
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.
│ │ │ +
403
│ │ │ +
404#endif //HAVE_SUITESPARSE_LDL
│ │ │ +
405#endif //DUNE_ISTL_LDL_HH
│ │ │ + │ │ │ +
Templates characterizing the type of a solver.
│ │ │ + │ │ │ +
#define DUNE_REGISTER_SOLVER(name,...)
Definition solverregistry.hh:16
│ │ │ +
Implementations of the inverse operator interface.
│ │ │ +
friend class SeqOverlappingSchwarz
Definition ldl.hh:303
│ │ │ +
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
│ │ │ +
void apply(domain_type &x, range_type &b, InverseOperatorResult &res) override
Apply inverse operator,.
Definition ldl.hh:152
│ │ │ +
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
│ │ │ +
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
│ │ │ +
void apply(domain_type &x, range_type &b, double reduction, InverseOperatorResult &res) override
apply inverse operator, with given convergence criteria.
Definition ldl.hh:166
│ │ │ +
virtual ~LDL()
Default constructor.
Definition ldl.hh:145
│ │ │ +
void free()
Free allocated space.
Definition ldl.hh:246
│ │ │ +
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
│ │ │ +
SolverCategory::Category category() const override
Category of the solver (see SolverCategory::Category).
Definition ldl.hh:90
│ │ │ +
LDL(const Matrix &matrix, const ParameterTree &config)
Constructs the LDL solver.
Definition ldl.hh:136
│ │ │ +
ISTL::Impl::BCCSMatrixInitializer< BCRSMatrix< FieldMatrix< T, n, m >, A >, int > MatrixInitializer
Type of an associated initializer class.
Definition ldl.hh:83
│ │ │ +
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
│ │ │ + │ │ │ + │ │ │
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
│ │ │ -
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ -
Definition novlpschwarz.hh:256
│ │ │ -
Class providing information about the mapping of the vertices onto aggregates.
Definition aggregates.hh:566
│ │ │ -
A Dummy visitor that does nothing for each visited edge.
Definition aggregates.hh:604
│ │ │ -
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
│ │ │ +
static auto coldim(const M &)
Definition matrixutils.hh:219
│ │ │ +
static auto rowdim(const M &)
Definition matrixutils.hh:214
│ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:467
│ │ │ +
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:2010
│ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2004
│ │ │ +
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 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:97
│ │ │ +
Definition solvertype.hh:16
│ │ │ +
Definition solvertype.hh:30
│ │ │
│ │ │ │ │ │ │ │ │
│ │ │ │ │ │ ├── html2text {} │ │ │ │ @@ -1,828 +1,521 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 _A_m_g │ │ │ │ -19 { │ │ │ │ -30 │ │ │ │ -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 │ │ │ │ -_1_8_7 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 │ │ │ │ -_1_9_6 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_r_e_g_i_s_t_r_y_._h_h> │ │ │ │ +28 │ │ │ │ +29namespace _D_u_n_e { │ │ │ │ +40 │ │ │ │ +41 // forward declarations │ │ │ │ +42 template │ │ │ │ +43 class _S_e_q_O_v_e_r_l_a_p_p_i_n_g_S_c_h_w_a_r_z; │ │ │ │ +44 │ │ │ │ +45 template │ │ │ │ +46 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; │ │ │ │ +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 _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 │ │ │ │ +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 _s_e_t_M_a_t_r_i_x(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 _s_e_t_M_a_t_r_i_x(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 _f_r_e_e(); │ │ │ │ +149 } │ │ │ │ +150 │ │ │ │ +_1_5_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, _I_n_v_e_r_s_e_O_p_e_r_a_t_o_r_R_e_s_u_l_t& res) │ │ │ │ +override │ │ │ │ +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 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) override │ │ │ │ +167 { │ │ │ │ +168 _a_p_p_l_y(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 _f_r_e_e(); │ │ │ │ +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 _f_r_e_e(); │ │ │ │ +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 GalerkinProduct::buildOverlapVertices(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); │ │ │ │ +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 _D_U_N_E___R_E_G_I_S_T_E_R___S_O_L_V_E_R("ldl", │ │ │ │ +374 [](auto opTraits, const auto& op, const Dune::ParameterTree& config) │ │ │ │ +375 -> std::shared_ptr │ │ │ │ +376 { │ │ │ │ +377 using OpTraits = decltype(opTraits); │ │ │ │ +378 using M = typename OpTraits::matrix_type; │ │ │ │ +379 // works only for sequential operators │ │ │ │ +380 if constexpr (OpTraits::isParallel){ │ │ │ │ +381 if(opTraits.getCommOrThrow(op).communicator().size() > 1) │ │ │ │ +382 DUNE_THROW(Dune::InvalidStateException, "LDL works only for sequential │ │ │ │ +operators."); │ │ │ │ +383 } │ │ │ │ +384 // check if LDL* is convertible to │ │ │ │ +385 // InverseOperator*. This allows only the explicit │ │ │ │ +386 // specialized variants of LDL │ │ │ │ +387 if constexpr (std::is_convertible_v*, │ │ │ │ +388 _D_u_n_e_:_:_I_n_v_e_r_s_e_O_p_e_r_a_t_o_r*> && │ │ │ │ +390 std::is_same_v::field_type, double> │ │ │ │ +391 ){ │ │ │ │ +392 const auto& A = opTraits.getAssembledOpOrThrow(op); │ │ │ │ +393 const M& mat = A->getmat(); │ │ │ │ +394 int verbose = config.get("verbose", 0); │ │ │ │ +395 return std::make_shared>(mat,verbose); │ │ │ │ +396 } │ │ │ │ +397 DUNE_THROW(_U_n_s_u_p_p_o_r_t_e_d_T_y_p_e, │ │ │ │ +398 "Unsupported Type in LDL (only FieldMatrix supported)"); │ │ │ │ +399 }); │ │ │ │ +400 │ │ │ │ +401} // end namespace Dune │ │ │ │ 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& _i_n_d_e_x) │ │ │ │ -553 { │ │ │ │ -554 row_.insert(_i_n_d_e_x); │ │ │ │ -555#ifdef DUNE_ISTL_WITH_CHECKING │ │ │ │ -556 diagonalInserted = diagonalInserted || row_.index()==_i_n_d_e_x; │ │ │ │ -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: fastamgsmoother.hh File Reference │ │ │ +dune-istl: matrixmarket.hh File Reference │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,41 +66,208 @@ │ │ │
│ │ │
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ Classes | │ │ │ -Namespaces
│ │ │ -
fastamgsmoother.hh File Reference
│ │ │ +Namespaces | │ │ │ +Enumerations | │ │ │ +Functions | │ │ │ +Variables
│ │ │ + │ │ │
│ │ │
│ │ │ -
#include <cstddef>
│ │ │ -#include <dune/common/typetraits.hh>
│ │ │ + │ │ │ +

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/gmpfield.hh>
│ │ │ +#include <dune/common/hybridutilities.hh>
│ │ │ +#include <dune/common/quadmath.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::Amg::GaussSeidelPostsmoothDefect< 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::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,20 +1,251 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ +#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_:_:_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_<_ _T_ _> │ │ │ │ +  Helper metaprogram to get the matrix market string representation of │ │ │ │ + the numeric type. _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_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,161 +66,1557 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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#include <dune/common/typetraits.hh>
│ │ │ -
10
│ │ │ -
11namespace Dune
│ │ │ -
12{
│ │ │ -
13 namespace Amg
│ │ │ -
14 {
│ │ │ -
15
│ │ │ -
16 template<std::size_t level>
│ │ │ -
│ │ │ - │ │ │ -
18
│ │ │ -
19 template<typename M, typename X, typename Y>
│ │ │ -
│ │ │ -
20 static void apply(const M& A, X& x, Y& d,
│ │ │ -
21 const Y& b)
│ │ │ -
22 {
│ │ │ -
23 typedef typename M::ConstRowIterator RowIterator;
│ │ │ -
24 typedef typename M::ConstColIterator ColIterator;
│ │ │ -
25
│ │ │ -
26 typename Y::iterator dIter=d.begin();
│ │ │ -
27 typename Y::const_iterator bIter=b.begin();
│ │ │ -
28 typename X::iterator xIter=x.begin();
│ │ │ -
29
│ │ │ -
30 for(RowIterator row=A.begin(), end=A.end(); row != end;
│ │ │ -
31 ++row, ++dIter, ++xIter, ++bIter)
│ │ │ -
32 {
│ │ │ -
33 ColIterator col=(*row).begin();
│ │ │ -
34 *dIter = *bIter;
│ │ │ -
35
│ │ │ -
36 for (; col.index()<row.index(); ++col)
│ │ │ -
37 {
│ │ │ -
38 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ -
39 *dIter -= (*col)*x[col.index()];
│ │ │ -
40 else
│ │ │ -
41 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ -
42 }
│ │ │ -
43 assert(row.index()==col.index());
│ │ │ -
44 ColIterator diag=col; // upper diagonal matrix not needed as x was 0 before.
│ │ │ -
45
│ │ │ -
46 // Not recursive yet. Just solve with the diagonal
│ │ │ -
47 if constexpr (Dune::IsNumber<std::decay_t<decltype(*diag)>>::value)
│ │ │ -
48 *xIter = (*dIter)/(*diag);
│ │ │ -
49 else
│ │ │ -
50 diag->solve(*xIter,*dIter);
│ │ │ -
51
│ │ │ -
52 *dIter=0; //as r=v
│ │ │ -
53
│ │ │ -
54 // Update residual for the symmetric case
│ │ │ -
55 for(col=(*row).begin(); col.index()<row.index(); ++col)
│ │ │ -
56 {
│ │ │ -
57 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ -
58 d[col.index()] -= (*col)*(*xIter);
│ │ │ -
59 else
│ │ │ -
60 col->mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ -
61 }
│ │ │ -
62 }
│ │ │ -
63 }
│ │ │ -
│ │ │ -
64 };
│ │ │ -
│ │ │ -
65
│ │ │ -
66 template<std::size_t level>
│ │ │ -
│ │ │ - │ │ │ -
68
│ │ │ -
69 template<typename M, typename X, typename Y>
│ │ │ -
│ │ │ -
70 static void apply(const M& A, X& x, Y& d,
│ │ │ -
71 const Y& b)
│ │ │ -
72 {
│ │ │ -
73 typedef typename M::ConstRowIterator RowIterator;
│ │ │ -
74 typedef typename M::ConstColIterator ColIterator;
│ │ │ -
75 typedef typename Y::block_type YBlock;
│ │ │ -
76
│ │ │ -
77 typename Y::iterator dIter=d.beforeEnd();
│ │ │ -
78 typename X::iterator xIter=x.beforeEnd();
│ │ │ -
79 typename Y::const_iterator bIter=b.beforeEnd();
│ │ │ -
80
│ │ │ -
81 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
│ │ │ -
82 --row, --dIter, --xIter, --bIter)
│ │ │ -
83 {
│ │ │ -
84 ColIterator endCol=(*row).beforeBegin();
│ │ │ -
85 ColIterator col=(*row).beforeEnd();
│ │ │ -
86 *dIter = *bIter;
│ │ │ -
87
│ │ │ -
88 for (; col.index()>row.index(); --col)
│ │ │ -
89 {
│ │ │ -
90 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ -
91 *dIter -= (*col)*x[col.index()];
│ │ │ -
92 else
│ │ │ -
93 (*col).mmv(x[col.index()],*dIter); // rhs -= sum_{j<i} a_ij * xnew_j
│ │ │ -
94 }
│ │ │ -
95 assert(row.index()==col.index());
│ │ │ -
96 ColIterator diag=col;
│ │ │ -
97 YBlock v=*dIter;
│ │ │ -
98 // upper diagonal matrix
│ │ │ -
99 for (--col; col!=endCol; --col)
│ │ │ -
100 {
│ │ │ -
101 if constexpr (Dune::IsNumber<std::decay_t<decltype(*col)>>::value)
│ │ │ -
102 v -= (*col)*x[col.index()];
│ │ │ -
103 else
│ │ │ -
104 (*col).mmv(x[col.index()],v); // v -= sum_{j<i} a_ij * xold_j
│ │ │ -
105 }
│ │ │ -
106
│ │ │ -
107 // Not recursive yet. Just solve with the diagonal
│ │ │ -
108 if constexpr (Dune::IsNumber<std::decay_t<decltype(*diag)>>::value)
│ │ │ -
109 *xIter = v/(*diag);
│ │ │ -
110 else
│ │ │ -
111 diag->solve(*xIter,v);
│ │ │ -
112
│ │ │ -
113 *dIter-=v;
│ │ │ -
114
│ │ │ -
115 // Update residual for the symmetric case
│ │ │ -
116 // Skip residual computation as it is not needed.
│ │ │ -
117 //for(col=(*row).begin();col.index()<row.index(); ++col)
│ │ │ -
118 //col.mmv(*xIter, d[col.index()]); //d_j-=A_ij x_i
│ │ │ -
119 }
│ │ │ -
120 }
│ │ │ -
│ │ │ -
121 };
│ │ │ -
│ │ │ -
122 } // end namespace Amg
│ │ │ -
123} // end namespace Dune
│ │ │ -
124#endif
│ │ │ +
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/gmpfield.hh>
│ │ │ +
28#include <dune/common/hybridutilities.hh>
│ │ │ +
29#include <dune/common/quadmath.hh>
│ │ │ +
30#include <dune/common/stdstreams.hh>
│ │ │ +
31#include <dune/common/simd/simd.hh>
│ │ │ +
32
│ │ │ + │ │ │ +
34#include <dune/istl/bvector.hh>
│ │ │ +
35#include <dune/istl/matrixutils.hh> // countNonZeros()
│ │ │ + │ │ │ +
37
│ │ │ +
38namespace Dune
│ │ │ +
39{
│ │ │ +
40
│ │ │ +
60
│ │ │ +
│ │ │ + │ │ │ +
67 {
│ │ │ +
77 template<class T>
│ │ │ +
│ │ │ + │ │ │ +
79 enum {
│ │ │ + │ │ │ +
84 };
│ │ │ +
85
│ │ │ +
│ │ │ +
86 static std::string str()
│ │ │ +
87 {
│ │ │ +
88 return "unknown";
│ │ │ +
89 }
│ │ │ +
│ │ │ +
90 };
│ │ │ +
│ │ │ +
91
│ │ │ +
92 template<>
│ │ │ +
│ │ │ +
93 struct mm_numeric_type<int>
│ │ │ +
94 {
│ │ │ +
95 enum {
│ │ │ + │ │ │ +
100 };
│ │ │ +
101
│ │ │ +
│ │ │ +
102 static std::string str()
│ │ │ +
103 {
│ │ │ +
104 return "integer";
│ │ │ +
105 }
│ │ │ +
│ │ │ +
106 };
│ │ │ +
│ │ │ +
107
│ │ │ +
108 template<>
│ │ │ +
│ │ │ +
109 struct mm_numeric_type<double>
│ │ │ +
110 {
│ │ │ +
111 enum {
│ │ │ + │ │ │ +
116 };
│ │ │ +
117
│ │ │ +
│ │ │ +
118 static std::string str()
│ │ │ +
119 {
│ │ │ +
120 return "real";
│ │ │ +
121 }
│ │ │ +
│ │ │ +
122 };
│ │ │ +
│ │ │ +
123
│ │ │ +
124 template<>
│ │ │ +
│ │ │ +
125 struct mm_numeric_type<float>
│ │ │ +
126 {
│ │ │ +
127 enum {
│ │ │ + │ │ │ +
132 };
│ │ │ +
133
│ │ │ +
│ │ │ +
134 static std::string str()
│ │ │ +
135 {
│ │ │ +
136 return "real";
│ │ │ +
137 }
│ │ │ +
│ │ │ +
138 };
│ │ │ +
│ │ │ +
139
│ │ │ +
140#if HAVE_GMP
│ │ │ +
141 template<unsigned int precision>
│ │ │ +
142 struct mm_numeric_type<Dune::GMPField<precision>>
│ │ │ +
143 {
│ │ │ +
144 enum {
│ │ │ +
148 is_numeric=true
│ │ │ +
149 };
│ │ │ +
150
│ │ │ +
151 static std::string str()
│ │ │ +
152 {
│ │ │ +
153 return "real";
│ │ │ +
154 }
│ │ │ +
155 };
│ │ │ +
156#endif
│ │ │ +
157
│ │ │ +
158#if HAVE_QUADMATH
│ │ │ +
159 template<>
│ │ │ +
160 struct mm_numeric_type<Dune::Float128>
│ │ │ +
161 {
│ │ │ +
162 enum {
│ │ │ +
166 is_numeric=true
│ │ │ +
167 };
│ │ │ +
168
│ │ │ +
169 static std::string str()
│ │ │ +
170 {
│ │ │ +
171 return "real";
│ │ │ +
172 }
│ │ │ +
173 };
│ │ │ +
174#endif
│ │ │ +
175
│ │ │ +
176 template<>
│ │ │ +
│ │ │ +
177 struct mm_numeric_type<std::complex<double> >
│ │ │ +
178 {
│ │ │ +
179 enum {
│ │ │ + │ │ │ +
184 };
│ │ │ +
185
│ │ │ +
│ │ │ +
186 static std::string str()
│ │ │ +
187 {
│ │ │ +
188 return "complex";
│ │ │ +
189 }
│ │ │ +
│ │ │ +
190 };
│ │ │ +
│ │ │ +
191
│ │ │ +
192 template<>
│ │ │ +
│ │ │ +
193 struct mm_numeric_type<std::complex<float> >
│ │ │ +
194 {
│ │ │ +
195 enum {
│ │ │ + │ │ │ +
200 };
│ │ │ +
201
│ │ │ +
│ │ │ +
202 static std::string str()
│ │ │ +
203 {
│ │ │ +
204 return "complex";
│ │ │ +
205 }
│ │ │ +
│ │ │ +
206 };
│ │ │ +
│ │ │ +
207
│ │ │ +
216 template<class M>
│ │ │ + │ │ │ +
218
│ │ │ +
219 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
221 {
│ │ │ +
│ │ │ +
222 static void print(std::ostream& os)
│ │ │ +
223 {
│ │ │ +
224 os<<"%%MatrixMarket matrix coordinate ";
│ │ │ +
225 os<<mm_numeric_type<Simd::Scalar<typename Imp::BlockTraits<T>::field_type>>::str()<<" general"<<std::endl;
│ │ │ +
226 }
│ │ │ +
│ │ │ +
227 };
│ │ │ +
│ │ │ +
228
│ │ │ +
229 template<typename B, typename A>
│ │ │ +
│ │ │ + │ │ │ +
231 {
│ │ │ +
│ │ │ +
232 static void print(std::ostream& os)
│ │ │ +
233 {
│ │ │ +
234 os<<"%%MatrixMarket matrix array ";
│ │ │ +
235 os<<mm_numeric_type<Simd::Scalar<typename Imp::BlockTraits<B>::field_type>>::str()<<" general"<<std::endl;
│ │ │ +
236 }
│ │ │ +
│ │ │ +
237 };
│ │ │ +
│ │ │ +
238
│ │ │ +
239 template<typename T, int j>
│ │ │ +
│ │ │ +
240 struct mm_header_printer<FieldVector<T,j> >
│ │ │ +
241 {
│ │ │ +
│ │ │ +
242 static void print(std::ostream& os)
│ │ │ +
243 {
│ │ │ +
244 os<<"%%MatrixMarket matrix array ";
│ │ │ +
245 os<<mm_numeric_type<T>::str()<<" general"<<std::endl;
│ │ │ +
246 }
│ │ │ +
│ │ │ +
247 };
│ │ │ +
│ │ │ +
248
│ │ │ +
249 template<typename T, int i, int j>
│ │ │ +
│ │ │ + │ │ │ +
251 {
│ │ │ +
│ │ │ +
252 static void print(std::ostream& os)
│ │ │ +
253 {
│ │ │ +
254 os<<"%%MatrixMarket matrix array ";
│ │ │ +
255 os<<mm_numeric_type<T>::str()<<" general"<<std::endl;
│ │ │ +
256 }
│ │ │ +
│ │ │ +
257 };
│ │ │ +
│ │ │ +
258
│ │ │ +
267 template<class M>
│ │ │ + │ │ │ +
269
│ │ │ +
270 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
272 {
│ │ │ + │ │ │ +
274 static_assert(IsNumber<T>::value, "Only scalar entries are expected here!");
│ │ │ +
275
│ │ │ +
│ │ │ +
276 static void print(std::ostream& os, const M&)
│ │ │ +
277 {
│ │ │ +
278 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
279 os<<"1 1"<<std::endl;
│ │ │ +
280 }
│ │ │ +
│ │ │ +
281 };
│ │ │ +
│ │ │ +
282
│ │ │ +
283 template<typename T, typename A, int i>
│ │ │ +
│ │ │ +
284 struct mm_block_structure_header<BlockVector<FieldVector<T,i>,A> >
│ │ │ +
285 {
│ │ │ + │ │ │ +
287
│ │ │ +
│ │ │ +
288 static void print(std::ostream& os, const M&)
│ │ │ +
289 {
│ │ │ +
290 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
291 os<<i<<" "<<1<<std::endl;
│ │ │ +
292 }
│ │ │ +
│ │ │ +
293 };
│ │ │ +
│ │ │ +
294
│ │ │ +
295 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
297 {
│ │ │ + │ │ │ +
299 static_assert(IsNumber<T>::value, "Only scalar entries are expected here!");
│ │ │ +
300
│ │ │ +
│ │ │ +
301 static void print(std::ostream& os, const M&)
│ │ │ +
302 {
│ │ │ +
303 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
304 os<<"1 1"<<std::endl;
│ │ │ +
305 }
│ │ │ +
│ │ │ +
306 };
│ │ │ +
│ │ │ +
307
│ │ │ +
308 template<typename T, typename A, int i, int j>
│ │ │ +
│ │ │ + │ │ │ +
310 {
│ │ │ + │ │ │ +
312
│ │ │ +
│ │ │ +
313 static void print(std::ostream& os, const M&)
│ │ │ +
314 {
│ │ │ +
315 os<<"% ISTL_STRUCT blocked ";
│ │ │ +
316 os<<i<<" "<<j<<std::endl;
│ │ │ +
317 }
│ │ │ +
│ │ │ +
318 };
│ │ │ +
│ │ │ +
319
│ │ │ +
320
│ │ │ +
321 template<typename T, int i, int j>
│ │ │ +
│ │ │ + │ │ │ +
323 {
│ │ │ + │ │ │ +
325
│ │ │ +
│ │ │ +
326 static void print(std::ostream& /*os*/, const M& /*m*/)
│ │ │ +
327 {}
│ │ │ +
│ │ │ +
328 };
│ │ │ +
│ │ │ +
329
│ │ │ +
330 template<typename T, int i>
│ │ │ +
│ │ │ +
331 struct mm_block_structure_header<FieldVector<T,i> >
│ │ │ +
332 {
│ │ │ +
333 typedef FieldVector<T,i> M;
│ │ │ +
334
│ │ │ +
│ │ │ +
335 static void print(std::ostream& /*os*/, const M& /*m*/)
│ │ │ +
336 {}
│ │ │ +
│ │ │ +
337 };
│ │ │ +
│ │ │ +
338
│ │ │ + │ │ │ +
340 enum { MM_MAX_LINE_LENGTH=1025 };
│ │ │ +
341
│ │ │ + │ │ │ +
343
│ │ │ + │ │ │ +
345
│ │ │ + │ │ │ +
347
│ │ │ +
│ │ │ +
348 struct MMHeader
│ │ │ +
349 {
│ │ │ +
│ │ │ + │ │ │ + │ │ │ +
352 {}
│ │ │ +
│ │ │ + │ │ │ + │ │ │ + │ │ │ +
356 };
│ │ │ +
│ │ │ +
357
│ │ │ +
│ │ │ +
358 inline bool lineFeed(std::istream& file)
│ │ │ +
359 {
│ │ │ +
360 char c;
│ │ │ +
361 if(!file.eof())
│ │ │ +
362 c=file.peek();
│ │ │ +
363 else
│ │ │ +
364 return false;
│ │ │ +
365 // ignore whitespace
│ │ │ +
366 while(c==' ')
│ │ │ +
367 {
│ │ │ +
368 file.get();
│ │ │ +
369 if(file.eof())
│ │ │ +
370 return false;
│ │ │ +
371 c=file.peek();
│ │ │ +
372 }
│ │ │ +
373
│ │ │ +
374 if(c=='\n') {
│ │ │ +
375 /* eat the line feed */
│ │ │ +
376 file.get();
│ │ │ +
377 return true;
│ │ │ +
378 }
│ │ │ +
379 return false;
│ │ │ +
380 }
│ │ │ +
│ │ │ +
381
│ │ │ +
│ │ │ +
382 inline void skipComments(std::istream& file)
│ │ │ +
383 {
│ │ │ +
384 lineFeed(file);
│ │ │ +
385 char c=file.peek();
│ │ │ +
386 // ignore comment lines
│ │ │ +
387 while(c=='%')
│ │ │ +
388 {
│ │ │ +
389 /* discard the rest of the line */
│ │ │ +
390 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
391 c=file.peek();
│ │ │ +
392 }
│ │ │ +
393 }
│ │ │ +
│ │ │ +
394
│ │ │ +
395
│ │ │ +
│ │ │ +
396 inline bool readMatrixMarketBanner(std::istream& file, MMHeader& mmHeader)
│ │ │ +
397 {
│ │ │ +
398 std::string buffer;
│ │ │ +
399 char c;
│ │ │ +
400 file >> buffer;
│ │ │ +
401 c=buffer[0];
│ │ │ +
402 mmHeader=MMHeader();
│ │ │ +
403 if(c!='%')
│ │ │ +
404 return false;
│ │ │ +
405 dverb<<buffer<<std::endl;
│ │ │ +
406 /* read the banner */
│ │ │ +
407 if(buffer!="%%MatrixMarket") {
│ │ │ +
408 /* discard the rest of the line */
│ │ │ +
409 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
410 return false;
│ │ │ +
411 }
│ │ │ +
412
│ │ │ +
413 if(lineFeed(file))
│ │ │ +
414 /* premature end of line */
│ │ │ +
415 return false;
│ │ │ +
416
│ │ │ +
417 /* read the matrix_type */
│ │ │ +
418 file >> buffer;
│ │ │ +
419
│ │ │ +
420 if(buffer != "matrix")
│ │ │ +
421 {
│ │ │ +
422 /* discard the rest of the line */
│ │ │ +
423 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
424 return false;
│ │ │ +
425 }
│ │ │ +
426
│ │ │ +
427 if(lineFeed(file))
│ │ │ +
428 /* premature end of line */
│ │ │ +
429 return false;
│ │ │ +
430
│ │ │ +
431 /* The type of the matrix */
│ │ │ +
432 file >> buffer;
│ │ │ +
433
│ │ │ +
434 if(buffer.empty())
│ │ │ +
435 return false;
│ │ │ +
436
│ │ │ +
437 std::transform(buffer.begin(), buffer.end(), buffer.begin(),
│ │ │ +
438 ::tolower);
│ │ │ +
439
│ │ │ +
440 switch(buffer[0])
│ │ │ +
441 {
│ │ │ +
442 case 'a' :
│ │ │ +
443 /* sanity check */
│ │ │ +
444 if(buffer != "array")
│ │ │ +
445 {
│ │ │ +
446 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
447 return false;
│ │ │ +
448 }
│ │ │ +
449 mmHeader.type=array_type;
│ │ │ +
450 break;
│ │ │ +
451 case 'c' :
│ │ │ +
452 /* sanity check */
│ │ │ +
453 if(buffer != "coordinate")
│ │ │ +
454 {
│ │ │ +
455 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
456 return false;
│ │ │ +
457 }
│ │ │ +
458 mmHeader.type=coordinate_type;
│ │ │ +
459 break;
│ │ │ +
460 default :
│ │ │ +
461 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
462 return false;
│ │ │ +
463 }
│ │ │ +
464
│ │ │ +
465 if(lineFeed(file))
│ │ │ +
466 /* premature end of line */
│ │ │ +
467 return false;
│ │ │ +
468
│ │ │ +
469 /* The numeric type used. */
│ │ │ +
470 file >> buffer;
│ │ │ +
471
│ │ │ +
472 if(buffer.empty())
│ │ │ +
473 return false;
│ │ │ +
474
│ │ │ +
475 std::transform(buffer.begin(), buffer.end(), buffer.begin(),
│ │ │ +
476 ::tolower);
│ │ │ +
477 switch(buffer[0])
│ │ │ +
478 {
│ │ │ +
479 case 'i' :
│ │ │ +
480 /* sanity check */
│ │ │ +
481 if(buffer != "integer")
│ │ │ +
482 {
│ │ │ +
483 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
484 return false;
│ │ │ +
485 }
│ │ │ +
486 mmHeader.ctype=integer_type;
│ │ │ +
487 break;
│ │ │ +
488 case 'r' :
│ │ │ +
489 /* sanity check */
│ │ │ +
490 if(buffer != "real")
│ │ │ +
491 {
│ │ │ +
492 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
493 return false;
│ │ │ +
494 }
│ │ │ +
495 mmHeader.ctype=double_type;
│ │ │ +
496 break;
│ │ │ +
497 case 'c' :
│ │ │ +
498 /* sanity check */
│ │ │ +
499 if(buffer != "complex")
│ │ │ +
500 {
│ │ │ +
501 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
502 return false;
│ │ │ +
503 }
│ │ │ +
504 mmHeader.ctype=complex_type;
│ │ │ +
505 break;
│ │ │ +
506 case 'p' :
│ │ │ +
507 /* sanity check */
│ │ │ +
508 if(buffer != "pattern")
│ │ │ +
509 {
│ │ │ +
510 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
511 return false;
│ │ │ +
512 }
│ │ │ +
513 mmHeader.ctype=pattern;
│ │ │ +
514 break;
│ │ │ +
515 default :
│ │ │ +
516 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
517 return false;
│ │ │ +
518 }
│ │ │ +
519
│ │ │ +
520 if(lineFeed(file))
│ │ │ +
521 return false;
│ │ │ +
522
│ │ │ +
523 file >> buffer;
│ │ │ +
524
│ │ │ +
525 std::transform(buffer.begin(), buffer.end(), buffer.begin(),
│ │ │ +
526 ::tolower);
│ │ │ +
527 switch(buffer[0])
│ │ │ +
528 {
│ │ │ +
529 case 'g' :
│ │ │ +
530 /* sanity check */
│ │ │ +
531 if(buffer != "general")
│ │ │ +
532 {
│ │ │ +
533 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
534 return false;
│ │ │ +
535 }
│ │ │ +
536 mmHeader.structure=general;
│ │ │ +
537 break;
│ │ │ +
538 case 'h' :
│ │ │ +
539 /* sanity check */
│ │ │ +
540 if(buffer != "hermitian")
│ │ │ +
541 {
│ │ │ +
542 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
543 return false;
│ │ │ +
544 }
│ │ │ +
545 mmHeader.structure=hermitian;
│ │ │ +
546 break;
│ │ │ +
547 case 's' :
│ │ │ +
548 if(buffer.size()==1) {
│ │ │ +
549 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
550 return false;
│ │ │ +
551 }
│ │ │ +
552
│ │ │ +
553 switch(buffer[1])
│ │ │ +
554 {
│ │ │ +
555 case 'y' :
│ │ │ +
556 /* sanity check */
│ │ │ +
557 if(buffer != "symmetric")
│ │ │ +
558 {
│ │ │ +
559 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
560 return false;
│ │ │ +
561 }
│ │ │ +
562 mmHeader.structure=symmetric;
│ │ │ +
563 break;
│ │ │ +
564 case 'k' :
│ │ │ +
565 /* sanity check */
│ │ │ +
566 if(buffer != "skew-symmetric")
│ │ │ +
567 {
│ │ │ +
568 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
569 return false;
│ │ │ +
570 }
│ │ │ +
571 mmHeader.structure=skew_symmetric;
│ │ │ +
572 break;
│ │ │ +
573 default :
│ │ │ +
574 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
575 return false;
│ │ │ +
576 }
│ │ │ +
577 break;
│ │ │ +
578 default :
│ │ │ +
579 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
580 return false;
│ │ │ +
581 }
│ │ │ +
582 file.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
583 c=file.peek();
│ │ │ +
584 return true;
│ │ │ +
585
│ │ │ +
586 }
│ │ │ +
│ │ │ +
587
│ │ │ +
588 template<std::size_t brows, std::size_t bcols>
│ │ │ +
589 std::tuple<std::size_t, std::size_t, std::size_t>
│ │ │ +
│ │ │ +
590 calculateNNZ(std::size_t rows, std::size_t cols, std::size_t entries, const MMHeader& header)
│ │ │ +
591 {
│ │ │ +
592 std::size_t blockrows=rows/brows;
│ │ │ +
593 std::size_t blockcols=cols/bcols;
│ │ │ +
594 std::size_t blocksize=brows*bcols;
│ │ │ +
595 std::size_t blockentries=0;
│ │ │ +
596
│ │ │ +
597 switch(header.structure)
│ │ │ +
598 {
│ │ │ +
599 case general :
│ │ │ +
600 blockentries = entries/blocksize; break;
│ │ │ +
601 case skew_symmetric :
│ │ │ +
602 blockentries = 2*entries/blocksize; break;
│ │ │ +
603 case symmetric :
│ │ │ +
604 blockentries = (2*entries-rows)/blocksize; break;
│ │ │ +
605 case hermitian :
│ │ │ +
606 blockentries = (2*entries-rows)/blocksize; break;
│ │ │ +
607 default :
│ │ │ +
608 throw Dune::NotImplemented();
│ │ │ +
609 }
│ │ │ +
610 return std::make_tuple(blockrows, blockcols, blockentries);
│ │ │ +
611 }
│ │ │ +
│ │ │ +
612
│ │ │ +
613 /*
│ │ │ +
614 * @brief Storage class for the column index and the numeric value.
│ │ │ +
615 *
│ │ │ +
616 * \tparam T Either a NumericWrapper of the numeric type or PatternDummy
│ │ │ +
617 * for MatrixMarket pattern case.
│ │ │ +
618 */
│ │ │ +
619 template<typename T>
│ │ │ +
│ │ │ +
620 struct IndexData : public T
│ │ │ +
621 {
│ │ │ +
622 std::size_t index = {};
│ │ │ +
623 };
│ │ │ +
│ │ │ +
624
│ │ │ +
625
│ │ │ +
636 template<typename T>
│ │ │ +
│ │ │ + │ │ │ +
638 {
│ │ │ +
639 T number = {};
│ │ │ +
│ │ │ +
640 operator T&()
│ │ │ +
641 {
│ │ │ +
642 return number;
│ │ │ +
643 }
│ │ │ +
│ │ │ +
644 };
│ │ │ +
│ │ │ +
645
│ │ │ +
│ │ │ + │ │ │ +
650 {};
│ │ │ +
│ │ │ +
651
│ │ │ +
652 template<>
│ │ │ +
│ │ │ + │ │ │ +
654 {};
│ │ │ +
│ │ │ +
655
│ │ │ +
656 template<typename T>
│ │ │ +
│ │ │ +
657 std::istream& operator>>(std::istream& is, NumericWrapper<T>& num)
│ │ │ +
658 {
│ │ │ +
659 return is>>num.number;
│ │ │ +
660 }
│ │ │ +
│ │ │ +
661
│ │ │ +
│ │ │ +
662 inline std::istream& operator>>(std::istream& is, [[maybe_unused]] NumericWrapper<PatternDummy>& num)
│ │ │ +
663 {
│ │ │ +
664 return is;
│ │ │ +
665 }
│ │ │ +
│ │ │ +
666
│ │ │ +
672 template<typename T>
│ │ │ +
│ │ │ +
673 bool operator<(const IndexData<T>& i1, const IndexData<T>& i2)
│ │ │ +
674 {
│ │ │ +
675 return i1.index<i2.index;
│ │ │ +
676 }
│ │ │ +
│ │ │ +
677
│ │ │ +
683 template<typename T>
│ │ │ +
│ │ │ +
684 std::istream& operator>>(std::istream& is, IndexData<T>& data)
│ │ │ +
685 {
│ │ │ +
686 is>>data.index;
│ │ │ +
687 /* MatrixMarket indices are one based. Decrement for C++ */
│ │ │ +
688 --data.index;
│ │ │ +
689 return is>>data.number;
│ │ │ +
690 }
│ │ │ +
│ │ │ +
691
│ │ │ +
697 template<typename T>
│ │ │ +
│ │ │ +
698 std::istream& operator>>(std::istream& is, IndexData<NumericWrapper<std::complex<T>>>& data)
│ │ │ +
699 {
│ │ │ +
700 is>>data.index;
│ │ │ +
701 /* MatrixMarket indices are one based. Decrement for C++ */
│ │ │ +
702 --data.index;
│ │ │ +
703 // real and imaginary part needs to be read separately as
│ │ │ +
704 // complex numbers are not provided in pair form. (x,y)
│ │ │ +
705 NumericWrapper<T> real, imag;
│ │ │ +
706 is>>real;
│ │ │ +
707 is>>imag;
│ │ │ +
708 data.number = {real.number, imag.number};
│ │ │ +
709 return is;
│ │ │ +
710 }
│ │ │ +
│ │ │ +
711
│ │ │ +
718 template<typename D, int brows, int bcols>
│ │ │ +
│ │ │ + │ │ │ +
720 {
│ │ │ +
726 template<typename T>
│ │ │ +
│ │ │ +
727 void operator()(const std::vector<std::set<IndexData<D> > >& rows,
│ │ │ +
728 BCRSMatrix<T>& matrix)
│ │ │ +
729 {
│ │ │ +
730 static_assert(IsNumber<T>::value && brows==1 && bcols==1, "Only scalar entries are expected here!");
│ │ │ +
731 for (auto iter=matrix.begin(); iter!= matrix.end(); ++iter)
│ │ │ +
732 {
│ │ │ +
733 auto brow=iter.index();
│ │ │ +
734 for (auto siter=rows[brow].begin(); siter != rows[brow].end(); ++siter)
│ │ │ +
735 (*iter)[siter->index] = siter->number;
│ │ │ +
736 }
│ │ │ +
737 }
│ │ │ +
│ │ │ +
738
│ │ │ +
744 template<typename T>
│ │ │ +
│ │ │ +
745 void operator()(const std::vector<std::set<IndexData<D> > >& rows,
│ │ │ + │ │ │ +
747 {
│ │ │ +
748 for (auto iter=matrix.begin(); iter!= matrix.end(); ++iter)
│ │ │ +
749 {
│ │ │ +
750 for (auto brow=iter.index()*brows,
│ │ │ +
751 browend=iter.index()*brows+brows;
│ │ │ +
752 brow<browend; ++brow)
│ │ │ +
753 {
│ │ │ +
754 for (auto siter=rows[brow].begin(), send=rows[brow].end();
│ │ │ +
755 siter != send; ++siter)
│ │ │ +
756 (*iter)[siter->index/bcols][brow%brows][siter->index%bcols]=siter->number;
│ │ │ +
757 }
│ │ │ +
758 }
│ │ │ +
759 }
│ │ │ +
│ │ │ +
760 };
│ │ │ +
│ │ │ +
761
│ │ │ +
762 template<int brows, int bcols>
│ │ │ +
│ │ │ + │ │ │ +
764 {
│ │ │ +
765 template<typename M>
│ │ │ +
│ │ │ +
766 void operator()(const std::vector<std::set<IndexData<PatternDummy> > >& /*rows*/,
│ │ │ +
767 M& /*matrix*/)
│ │ │ +
768 {}
│ │ │ +
│ │ │ +
769 };
│ │ │ +
│ │ │ +
770
│ │ │ +
771 template<class T> struct is_complex : std::false_type {};
│ │ │ +
772 template<class T> struct is_complex<std::complex<T>> : std::true_type {};
│ │ │ +
773
│ │ │ +
774 // wrapper for std::conj. Returns T if T is not complex.
│ │ │ +
775 template<class T>
│ │ │ +
│ │ │ +
776 std::enable_if_t<!is_complex<T>::value, T> conj(const T& r){
│ │ │ +
777 return r;
│ │ │ +
778 }
│ │ │ +
│ │ │ +
779
│ │ │ +
780 template<class T>
│ │ │ +
│ │ │ +
781 std::enable_if_t<is_complex<T>::value, T> conj(const T& r){
│ │ │ +
782 return std::conj(r);
│ │ │ +
783 }
│ │ │ +
│ │ │ +
784
│ │ │ +
785 template<typename M>
│ │ │ +
│ │ │ + │ │ │ +
787 {};
│ │ │ +
│ │ │ +
788
│ │ │ +
789 template<typename B, typename A>
│ │ │ +
│ │ │ + │ │ │ +
791 {
│ │ │ +
792 enum {
│ │ │ +
793 rows = 1,
│ │ │ + │ │ │ +
795 };
│ │ │ +
796 };
│ │ │ +
│ │ │ +
797
│ │ │ +
798 template<typename B, int i, int j, typename A>
│ │ │ +
│ │ │ + │ │ │ +
800 {
│ │ │ +
801 enum {
│ │ │ +
802 rows = i,
│ │ │ + │ │ │ +
804 };
│ │ │ +
805 };
│ │ │ +
│ │ │ +
806
│ │ │ +
807 template<typename T, typename A, typename D>
│ │ │ +
│ │ │ + │ │ │ +
809 std::istream& file, std::size_t entries,
│ │ │ +
810 const MMHeader& mmHeader, const D&)
│ │ │ +
811 {
│ │ │ + │ │ │ +
813
│ │ │ +
814 // Number of rows and columns of T, if it is a matrix (1x1 otherwise)
│ │ │ +
815 constexpr int brows = mm_multipliers<Matrix>::rows;
│ │ │ +
816 constexpr int bcols = mm_multipliers<Matrix>::cols;
│ │ │ +
817
│ │ │ +
818 // First path
│ │ │ +
819 // store entries together with column index in a separate
│ │ │ +
820 // data structure
│ │ │ +
821 std::vector<std::set<IndexData<D> > > rows(matrix.N()*brows);
│ │ │ +
822
│ │ │ +
823 auto readloop = [&] (auto symmetryFixup) {
│ │ │ +
824 for(std::size_t i = 0; i < entries; ++i) {
│ │ │ +
825 std::size_t row;
│ │ │ +
826 IndexData<D> data;
│ │ │ +
827 skipComments(file);
│ │ │ +
828 file>>row;
│ │ │ +
829 --row; // Index was 1 based.
│ │ │ +
830 assert(row/bcols<matrix.N());
│ │ │ +
831 file>>data;
│ │ │ +
832 assert(data.index/bcols<matrix.M());
│ │ │ +
833 rows[row].insert(data);
│ │ │ +
834 if(row!=data.index)
│ │ │ +
835 symmetryFixup(row, data);
│ │ │ +
836 }
│ │ │ +
837 };
│ │ │ +
838
│ │ │ +
839 switch(mmHeader.structure)
│ │ │ +
840 {
│ │ │ +
841 case general:
│ │ │ +
842 readloop([](auto...){});
│ │ │ +
843 break;
│ │ │ +
844 case symmetric :
│ │ │ +
845 readloop([&](auto row, auto data) {
│ │ │ +
846 IndexData<D> data_sym(data);
│ │ │ +
847 data_sym.index = row;
│ │ │ +
848 rows[data.index].insert(data_sym);
│ │ │ +
849 });
│ │ │ +
850 break;
│ │ │ +
851 case skew_symmetric :
│ │ │ +
852 readloop([&](auto row, auto data) {
│ │ │ +
853 IndexData<D> data_sym;
│ │ │ +
854 data_sym.number = -data.number;
│ │ │ +
855 data_sym.index = row;
│ │ │ +
856 rows[data.index].insert(data_sym);
│ │ │ +
857 });
│ │ │ +
858 break;
│ │ │ +
859 case hermitian :
│ │ │ +
860 readloop([&](auto row, auto data) {
│ │ │ +
861 IndexData<D> data_sym;
│ │ │ +
862 data_sym.number = conj(data.number);
│ │ │ +
863 data_sym.index = row;
│ │ │ +
864 rows[data.index].insert(data_sym);
│ │ │ +
865 });
│ │ │ +
866 break;
│ │ │ +
867 default:
│ │ │ +
868 DUNE_THROW(Dune::NotImplemented,
│ │ │ +
869 "Only general, symmetric, skew-symmetric and hermitian is supported right now!");
│ │ │ +
870 }
│ │ │ +
871
│ │ │ +
872 // Setup the matrix sparsity pattern
│ │ │ +
873 int nnz=0;
│ │ │ +
874 for(typename Matrix::CreateIterator iter=matrix.createbegin();
│ │ │ +
875 iter!= matrix.createend(); ++iter)
│ │ │ +
876 {
│ │ │ +
877 for(std::size_t brow=iter.index()*brows, browend=iter.index()*brows+brows;
│ │ │ +
878 brow<browend; ++brow)
│ │ │ +
879 {
│ │ │ +
880 typedef typename std::set<IndexData<D> >::const_iterator Siter;
│ │ │ +
881 for(Siter siter=rows[brow].begin(), send=rows[brow].end();
│ │ │ +
882 siter != send; ++siter, ++nnz)
│ │ │ +
883 iter.insert(siter->index/bcols);
│ │ │ +
884 }
│ │ │ +
885 }
│ │ │ +
886
│ │ │ +
887 //Set the matrix values
│ │ │ +
888 matrix=0;
│ │ │ +
889
│ │ │ + │ │ │ +
891
│ │ │ +
892 Setter(rows, matrix);
│ │ │ +
893 }
│ │ │ +
│ │ │ +
894
│ │ │ +
│ │ │ +
895 inline std::tuple<std::string, std::string> splitFilename(const std::string& filename) {
│ │ │ +
896 std::size_t lastdot = filename.find_last_of(".");
│ │ │ +
897 if(lastdot == std::string::npos)
│ │ │ +
898 return std::make_tuple(filename, "");
│ │ │ +
899 else {
│ │ │ +
900 std::string potentialFileExtension = filename.substr(lastdot);
│ │ │ +
901 if (potentialFileExtension == ".mm" || potentialFileExtension == ".mtx")
│ │ │ +
902 return std::make_tuple(filename.substr(0, lastdot), potentialFileExtension);
│ │ │ +
903 else
│ │ │ +
904 return std::make_tuple(filename, "");
│ │ │ +
905 }
│ │ │ +
906 }
│ │ │ +
│ │ │ +
907
│ │ │ +
908 } // end namespace MatrixMarketImpl
│ │ │ +
│ │ │ +
909
│ │ │ +
│ │ │ +
910 class MatrixMarketFormatError : public Dune::Exception
│ │ │ +
911 {};
│ │ │ +
│ │ │ +
912
│ │ │ +
913
│ │ │ +
│ │ │ +
914 inline void mm_read_header(std::size_t& rows, std::size_t& cols,
│ │ │ +
915 MatrixMarketImpl::MMHeader& header, std::istream& istr,
│ │ │ +
916 bool isVector)
│ │ │ +
917 {
│ │ │ +
918 using namespace MatrixMarketImpl;
│ │ │ +
919
│ │ │ +
920 if(!readMatrixMarketBanner(istr, header)) {
│ │ │ +
921 std::cerr << "First line was not a correct Matrix Market banner. Using default:\n"
│ │ │ +
922 << "%%MatrixMarket matrix coordinate real general"<<std::endl;
│ │ │ +
923 // Go to the beginning of the file
│ │ │ +
924 istr.clear() ;
│ │ │ +
925 istr.seekg(0, std::ios::beg);
│ │ │ +
926 if(isVector)
│ │ │ +
927 header.type=array_type;
│ │ │ +
928 }
│ │ │ +
929
│ │ │ +
930 skipComments(istr);
│ │ │ +
931
│ │ │ +
932 if(lineFeed(istr))
│ │ │ + │ │ │ +
934
│ │ │ +
935 istr >> rows;
│ │ │ +
936
│ │ │ +
937 if(lineFeed(istr))
│ │ │ + │ │ │ +
939 istr >> cols;
│ │ │ +
940 }
│ │ │ +
│ │ │ +
941
│ │ │ +
942 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
944 std::size_t size,
│ │ │ +
945 std::istream& istr,
│ │ │ +
946 size_t lane)
│ │ │ +
947 {
│ │ │ +
948 for (int i=0; size>0; ++i, --size)
│ │ │ +
949 istr>>Simd::lane(lane,vector[i]);
│ │ │ +
950 }
│ │ │ +
│ │ │ +
951
│ │ │ +
952 template<typename T, typename A, int entries>
│ │ │ +
│ │ │ +
953 void mm_read_vector_entries(Dune::BlockVector<Dune::FieldVector<T,entries>,A>& vector,
│ │ │ +
954 std::size_t size,
│ │ │ +
955 std::istream& istr,
│ │ │ +
956 size_t lane)
│ │ │ +
957 {
│ │ │ +
958 for(int i=0; size>0; ++i, --size) {
│ │ │ +
959 Simd::Scalar<T> val;
│ │ │ +
960 istr>>val;
│ │ │ +
961 Simd::lane(lane, vector[i/entries][i%entries])=val;
│ │ │ +
962 }
│ │ │ +
963 }
│ │ │ +
│ │ │ +
964
│ │ │ +
965
│ │ │ +
972 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
974 std::istream& istr)
│ │ │ +
975 {
│ │ │ +
976 typedef typename Dune::BlockVector<T,A>::field_type field_type;
│ │ │ +
977 using namespace MatrixMarketImpl;
│ │ │ +
978
│ │ │ +
979 MMHeader header;
│ │ │ +
980 std::size_t rows, cols;
│ │ │ +
981 mm_read_header(rows,cols,header,istr, true);
│ │ │ +
982 if(cols!=Simd::lanes<field_type>()) {
│ │ │ +
983 if(Simd::lanes<field_type>() == 1)
│ │ │ +
984 DUNE_THROW(MatrixMarketFormatError, "cols!=1, therefore this is no vector!");
│ │ │ +
985 else
│ │ │ +
986 DUNE_THROW(MatrixMarketFormatError, "cols does not match the number of lanes in the field_type!");
│ │ │ +
987 }
│ │ │ +
988
│ │ │ +
989 if(header.type!=array_type)
│ │ │ +
990 DUNE_THROW(MatrixMarketFormatError, "Vectors have to be stored in array format!");
│ │ │ +
991
│ │ │ +
992
│ │ │ +
993 if constexpr (Dune::IsNumber<T>())
│ │ │ +
994 vector.resize(rows);
│ │ │ +
995 else
│ │ │ +
996 {
│ │ │ +
997 T dummy;
│ │ │ +
998 auto blocksize = dummy.size();
│ │ │ +
999 std::size_t size=rows/blocksize;
│ │ │ +
1000 if(size*blocksize!=rows)
│ │ │ +
1001 DUNE_THROW(MatrixMarketFormatError, "Block size of vector is not correct!");
│ │ │ +
1002
│ │ │ +
1003 vector.resize(size);
│ │ │ +
1004 }
│ │ │ +
1005
│ │ │ +
1006 istr.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
1007 for(size_t l=0;l<Simd::lanes<field_type>();++l){
│ │ │ +
1008 mm_read_vector_entries(vector, rows, istr, l);
│ │ │ +
1009 }
│ │ │ +
1010 }
│ │ │ +
│ │ │ +
1011
│ │ │ +
1018 template<typename T, typename A>
│ │ │ +
│ │ │ + │ │ │ +
1020 std::istream& istr)
│ │ │ +
1021 {
│ │ │ +
1022 using namespace MatrixMarketImpl;
│ │ │ + │ │ │ +
1024
│ │ │ +
1025 MMHeader header;
│ │ │ +
1026 if(!readMatrixMarketBanner(istr, header)) {
│ │ │ +
1027 std::cerr << "First line was not a correct Matrix Market banner. Using default:\n"
│ │ │ +
1028 << "%%MatrixMarket matrix coordinate real general"<<std::endl;
│ │ │ +
1029 // Go to the beginning of the file
│ │ │ +
1030 istr.clear() ;
│ │ │ +
1031 istr.seekg(0, std::ios::beg);
│ │ │ +
1032 }
│ │ │ +
1033 skipComments(istr);
│ │ │ +
1034
│ │ │ +
1035 std::size_t rows, cols, entries;
│ │ │ +
1036
│ │ │ +
1037 if(lineFeed(istr))
│ │ │ + │ │ │ +
1039
│ │ │ +
1040 istr >> rows;
│ │ │ +
1041
│ │ │ +
1042 if(lineFeed(istr))
│ │ │ + │ │ │ +
1044 istr >> cols;
│ │ │ +
1045
│ │ │ +
1046 if(lineFeed(istr))
│ │ │ + │ │ │ +
1048
│ │ │ +
1049 istr >>entries;
│ │ │ +
1050
│ │ │ +
1051 std::size_t nnz, blockrows, blockcols;
│ │ │ +
1052
│ │ │ +
1053 // Number of rows and columns of T, if it is a matrix (1x1 otherwise)
│ │ │ +
1054 constexpr int brows = mm_multipliers<Matrix>::rows;
│ │ │ +
1055 constexpr int bcols = mm_multipliers<Matrix>::cols;
│ │ │ +
1056
│ │ │ +
1057 std::tie(blockrows, blockcols, nnz) = calculateNNZ<brows, bcols>(rows, cols, entries, header);
│ │ │ +
1058
│ │ │ +
1059 istr.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
│ │ │ +
1060
│ │ │ +
1061
│ │ │ +
1062 matrix.setSize(blockrows, blockcols, nnz);
│ │ │ + │ │ │ +
1064
│ │ │ +
1065 if(header.type==array_type)
│ │ │ +
1066 DUNE_THROW(Dune::NotImplemented, "Array format currently not supported for matrices!");
│ │ │ +
1067
│ │ │ +
1068 readSparseEntries(matrix, istr, entries, header, NumericWrapper<typename Matrix::field_type>());
│ │ │ +
1069 }
│ │ │ +
│ │ │ +
1070
│ │ │ +
1071 // Print a scalar entry
│ │ │ +
1072 template<typename B>
│ │ │ +
│ │ │ +
1073 void mm_print_entry(const B& entry,
│ │ │ +
1074 std::size_t rowidx,
│ │ │ +
1075 std::size_t colidx,
│ │ │ +
1076 std::ostream& ostr)
│ │ │ +
1077 {
│ │ │ +
1078 if constexpr (IsNumber<B>())
│ │ │ +
1079 ostr << rowidx << " " << colidx << " " << entry << std::endl;
│ │ │ +
1080 else
│ │ │ +
1081 {
│ │ │ +
1082 for (auto row=entry.begin(); row != entry.end(); ++row, ++rowidx) {
│ │ │ +
1083 int coli=colidx;
│ │ │ +
1084 for (auto col = row->begin(); col != row->end(); ++col, ++coli)
│ │ │ +
1085 ostr<< rowidx<<" "<<coli<<" "<<*col<<std::endl;
│ │ │ +
1086 }
│ │ │ +
1087 }
│ │ │ +
1088 }
│ │ │ +
│ │ │ +
1089
│ │ │ +
1090 // Write a vector entry
│ │ │ +
1091 template<typename V>
│ │ │ +
│ │ │ +
1092 void mm_print_vector_entry(const V& entry, std::ostream& ostr,
│ │ │ +
1093 const std::integral_constant<int,1>&,
│ │ │ +
1094 size_t lane)
│ │ │ +
1095 {
│ │ │ +
1096 ostr<<Simd::lane(lane,entry)<<std::endl;
│ │ │ +
1097 }
│ │ │ +
│ │ │ +
1098
│ │ │ +
1099 // Write a vector
│ │ │ +
1100 template<typename V>
│ │ │ +
│ │ │ +
1101 void mm_print_vector_entry(const V& vector, std::ostream& ostr,
│ │ │ +
1102 const std::integral_constant<int,0>&,
│ │ │ +
1103 size_t lane)
│ │ │ +
1104 {
│ │ │ +
1105 using namespace MatrixMarketImpl;
│ │ │ +
1106
│ │ │ +
1107 // Is the entry a supported numeric type?
│ │ │ +
1108 const int isnumeric = mm_numeric_type<Simd::Scalar<typename V::block_type>>::is_numeric;
│ │ │ +
1109 typedef typename V::const_iterator VIter;
│ │ │ +
1110
│ │ │ +
1111 for(VIter i=vector.begin(); i != vector.end(); ++i)
│ │ │ +
1112
│ │ │ +
1113 mm_print_vector_entry(*i, ostr,
│ │ │ +
1114 std::integral_constant<int,isnumeric>(),
│ │ │ +
1115 lane);
│ │ │ +
1116 }
│ │ │ +
│ │ │ +
1117
│ │ │ +
1118 template<typename T, typename A>
│ │ │ +
│ │ │ +
1119 std::size_t countEntries(const BlockVector<T,A>& vector)
│ │ │ +
1120 {
│ │ │ +
1121 return vector.size();
│ │ │ +
1122 }
│ │ │ +
│ │ │ +
1123
│ │ │ +
1124 template<typename T, typename A, int i>
│ │ │ +
│ │ │ +
1125 std::size_t countEntries(const BlockVector<FieldVector<T,i>,A>& vector)
│ │ │ +
1126 {
│ │ │ +
1127 return vector.size()*i;
│ │ │ +
1128 }
│ │ │ +
│ │ │ +
1129
│ │ │ +
1130 // Version for writing vectors.
│ │ │ +
1131 template<typename V>
│ │ │ +
│ │ │ +
1132 void writeMatrixMarket(const V& vector, std::ostream& ostr,
│ │ │ +
1133 const std::integral_constant<int,0>&)
│ │ │ +
1134 {
│ │ │ +
1135 using namespace MatrixMarketImpl;
│ │ │ +
1136 typedef typename V::field_type field_type;
│ │ │ +
1137
│ │ │ +
1138 ostr<<countEntries(vector)<<" "<<Simd::lanes<field_type>()<<std::endl;
│ │ │ +
1139 const int isnumeric = mm_numeric_type<Simd::Scalar<V>>::is_numeric;
│ │ │ +
1140 for(size_t l=0;l<Simd::lanes<field_type>(); ++l){
│ │ │ +
1141 mm_print_vector_entry(vector,ostr, std::integral_constant<int,isnumeric>(), l);
│ │ │ +
1142 }
│ │ │ +
1143 }
│ │ │ +
│ │ │ +
1144
│ │ │ +
1145 // Versions for writing matrices
│ │ │ +
1146 template<typename M>
│ │ │ +
│ │ │ +
1147 void writeMatrixMarket(const M& matrix,
│ │ │ +
1148 std::ostream& ostr,
│ │ │ +
1149 const std::integral_constant<int,1>&)
│ │ │ +
1150 {
│ │ │ +
1151 ostr<<matrix.N()*MatrixMarketImpl::mm_multipliers<M>::rows<<" "
│ │ │ + │ │ │ +
1153 <<countNonZeros(matrix)<<std::endl;
│ │ │ +
1154
│ │ │ +
1155 typedef typename M::const_iterator riterator;
│ │ │ +
1156 typedef typename M::ConstColIterator citerator;
│ │ │ +
1157 for(riterator row=matrix.begin(); row != matrix.end(); ++row)
│ │ │ +
1158 for(citerator col = row->begin(); col != row->end(); ++col)
│ │ │ +
1159 // Matrix Market indexing start with 1!
│ │ │ + │ │ │ + │ │ │ +
1162 }
│ │ │ +
│ │ │ +
1163
│ │ │ +
1164
│ │ │ +
1168 template<typename M>
│ │ │ +
│ │ │ +
1169 void writeMatrixMarket(const M& matrix,
│ │ │ +
1170 std::ostream& ostr)
│ │ │ +
1171 {
│ │ │ +
1172 using namespace MatrixMarketImpl;
│ │ │ +
1173
│ │ │ +
1174 // Write header information
│ │ │ +
1175 mm_header_printer<M>::print(ostr);
│ │ │ +
1176 mm_block_structure_header<M>::print(ostr,matrix);
│ │ │ +
1177 // Choose the correct function for matrix and vector
│ │ │ +
1178 writeMatrixMarket(matrix,ostr,std::integral_constant<int,IsMatrix<M>::value>());
│ │ │ +
1179 }
│ │ │ +
│ │ │ +
1180
│ │ │ +
1181 static const int default_precision = -1;
│ │ │ +
1193 template<typename M>
│ │ │ +
│ │ │ +
1194 void storeMatrixMarket(const M& matrix,
│ │ │ +
1195 std::string filename,
│ │ │ +
1196 int prec=default_precision)
│ │ │ +
1197 {
│ │ │ +
1198 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1199 std::string rfilename;
│ │ │ +
1200 std::ofstream file;
│ │ │ +
1201 if (extension != "") {
│ │ │ +
1202 rfilename = pureFilename + extension;
│ │ │ +
1203 file.open(rfilename.c_str());
│ │ │ +
1204 if(!file)
│ │ │ +
1205 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1206 }
│ │ │ +
1207 else {
│ │ │ +
1208 // only try .mm so we do not ignore potential errors
│ │ │ +
1209 rfilename = pureFilename + ".mm";
│ │ │ +
1210 file.open(rfilename.c_str());
│ │ │ +
1211 if(!file)
│ │ │ +
1212 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1213 }
│ │ │ +
1214
│ │ │ +
1215 file.setf(std::ios::scientific,std::ios::floatfield);
│ │ │ +
1216 if(prec>0)
│ │ │ +
1217 file.precision(prec);
│ │ │ +
1218 writeMatrixMarket(matrix, file);
│ │ │ +
1219 file.close();
│ │ │ +
1220 }
│ │ │ +
│ │ │ +
1221
│ │ │ +
1222#if HAVE_MPI
│ │ │ +
1237 template<typename M, typename G, typename L>
│ │ │ +
│ │ │ +
1238 void storeMatrixMarket(const M& matrix,
│ │ │ +
1239 std::string filename,
│ │ │ + │ │ │ +
1241 bool storeIndices=true,
│ │ │ +
1242 int prec=default_precision)
│ │ │ +
1243 {
│ │ │ +
1244 // Get our rank
│ │ │ +
1245 int rank = comm.communicator().rank();
│ │ │ +
1246 // Write the local matrix
│ │ │ +
1247 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1248 std::string rfilename;
│ │ │ +
1249 std::ofstream file;
│ │ │ +
1250 if (extension != "") {
│ │ │ +
1251 rfilename = pureFilename + "_" + std::to_string(rank) + extension;
│ │ │ +
1252 file.open(rfilename.c_str());
│ │ │ +
1253 dverb<< rfilename <<std::endl;
│ │ │ +
1254 if(!file)
│ │ │ +
1255 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1256 }
│ │ │ +
1257 else {
│ │ │ +
1258 // only try .mm so we do not ignore potential errors
│ │ │ +
1259 rfilename = pureFilename + "_" + std::to_string(rank) + ".mm";
│ │ │ +
1260 file.open(rfilename.c_str());
│ │ │ +
1261 dverb<< rfilename <<std::endl;
│ │ │ +
1262 if(!file)
│ │ │ +
1263 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1264 }
│ │ │ +
1265 file.setf(std::ios::scientific,std::ios::floatfield);
│ │ │ +
1266 if(prec>0)
│ │ │ +
1267 file.precision(prec);
│ │ │ +
1268 writeMatrixMarket(matrix, file);
│ │ │ +
1269 file.close();
│ │ │ +
1270
│ │ │ +
1271 if(!storeIndices)
│ │ │ +
1272 return;
│ │ │ +
1273
│ │ │ +
1274 // Write the global to local index mapping
│ │ │ +
1275 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx";
│ │ │ +
1276 file.open(rfilename.c_str());
│ │ │ +
1277 if(!file)
│ │ │ +
1278 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str());
│ │ │ +
1279 file.setf(std::ios::scientific,std::ios::floatfield);
│ │ │ + │ │ │ +
1281 typedef typename IndexSet::const_iterator Iterator;
│ │ │ +
1282 for(Iterator iter = comm.indexSet().begin();
│ │ │ +
1283 iter != comm.indexSet().end(); ++iter) {
│ │ │ +
1284 file << iter->global()<<" "<<(std::size_t)iter->local()<<" "
│ │ │ +
1285 <<(int)iter->local().attribute()<<" "<<(int)iter->local().isPublic()<<std::endl;
│ │ │ +
1286 }
│ │ │ +
1287 // Store neighbour information for efficient remote indices setup.
│ │ │ +
1288 file<<"neighbours:";
│ │ │ +
1289 const std::set<int>& neighbours=comm.remoteIndices().getNeighbours();
│ │ │ +
1290 typedef std::set<int>::const_iterator SIter;
│ │ │ +
1291 for(SIter neighbour=neighbours.begin(); neighbour != neighbours.end(); ++neighbour) {
│ │ │ +
1292 file<<" "<< *neighbour;
│ │ │ +
1293 }
│ │ │ +
1294 file.close();
│ │ │ +
1295 }
│ │ │ +
│ │ │ +
1296
│ │ │ +
1311 template<typename M, typename G, typename L>
│ │ │ +
│ │ │ +
1312 void loadMatrixMarket(M& matrix,
│ │ │ +
1313 const std::string& filename,
│ │ │ + │ │ │ +
1315 bool readIndices=true)
│ │ │ +
1316 {
│ │ │ +
1317 using namespace MatrixMarketImpl;
│ │ │ +
1318
│ │ │ + │ │ │ +
1320 typedef typename LocalIndexT::Attribute Attribute;
│ │ │ +
1321 // Get our rank
│ │ │ +
1322 int rank = comm.communicator().rank();
│ │ │ +
1323 // load local matrix
│ │ │ +
1324 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1325 std::string rfilename;
│ │ │ +
1326 std::ifstream file;
│ │ │ +
1327 if (extension != "") {
│ │ │ +
1328 rfilename = pureFilename + "_" + std::to_string(rank) + extension;
│ │ │ +
1329 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1330 dverb<< rfilename <<std::endl;
│ │ │ +
1331 if(!file)
│ │ │ +
1332 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1333 }
│ │ │ +
1334 else {
│ │ │ +
1335 // try both .mm and .mtx
│ │ │ +
1336 rfilename = pureFilename + "_" + std::to_string(rank) + ".mm";
│ │ │ +
1337 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1338 if(!file) {
│ │ │ +
1339 rfilename = pureFilename + "_" + std::to_string(rank) + ".mtx";
│ │ │ +
1340 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1341 dverb<< rfilename <<std::endl;
│ │ │ +
1342 if(!file)
│ │ │ +
1343 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1344 }
│ │ │ +
1345 }
│ │ │ +
1346 readMatrixMarket(matrix,file);
│ │ │ +
1347 file.close();
│ │ │ +
1348
│ │ │ +
1349 if(!readIndices)
│ │ │ +
1350 return;
│ │ │ +
1351
│ │ │ +
1352 // read indices
│ │ │ + │ │ │ +
1354 IndexSet& pis=comm.pis;
│ │ │ +
1355 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx";
│ │ │ +
1356 file.open(rfilename.c_str());
│ │ │ +
1357 if(!file)
│ │ │ +
1358 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1359 if(pis.size()!=0)
│ │ │ +
1360 DUNE_THROW(InvalidIndexSetState, "Index set is not empty!");
│ │ │ +
1361
│ │ │ +
1362 pis.beginResize();
│ │ │ +
1363 while(!file.eof() && file.peek()!='n') {
│ │ │ +
1364 G g;
│ │ │ +
1365 file >>g;
│ │ │ +
1366 std::size_t l;
│ │ │ +
1367 file >>l;
│ │ │ +
1368 int c;
│ │ │ +
1369 file >>c;
│ │ │ +
1370 bool b;
│ │ │ +
1371 file >> b;
│ │ │ +
1372 pis.add(g,LocalIndexT(l,Attribute(c),b));
│ │ │ +
1373 lineFeed(file);
│ │ │ +
1374 }
│ │ │ +
1375 pis.endResize();
│ │ │ +
1376 if(!file.eof()) {
│ │ │ +
1377 // read neighbours
│ │ │ +
1378 std::string s;
│ │ │ +
1379 file>>s;
│ │ │ +
1380 if(s!="neighbours:")
│ │ │ +
1381 DUNE_THROW(MatrixMarketFormatError, "was expecting the string: \"neighbours:\"");
│ │ │ +
1382 std::set<int> nb;
│ │ │ +
1383 while(!file.eof()) {
│ │ │ +
1384 int i;
│ │ │ +
1385 file >> i;
│ │ │ +
1386 nb.insert(i);
│ │ │ +
1387 }
│ │ │ +
1388 file.close();
│ │ │ +
1389 comm.ri.setNeighbours(nb);
│ │ │ +
1390 }
│ │ │ +
1391 comm.ri.template rebuild<false>();
│ │ │ +
1392 }
│ │ │ +
│ │ │ +
1393
│ │ │ +
1394 #endif
│ │ │ +
1395
│ │ │ +
1406 template<typename M>
│ │ │ +
│ │ │ +
1407 void loadMatrixMarket(M& matrix,
│ │ │ +
1408 const std::string& filename)
│ │ │ +
1409 {
│ │ │ +
1410 auto [pureFilename, extension] = MatrixMarketImpl::splitFilename(filename);
│ │ │ +
1411 std::string rfilename;
│ │ │ +
1412 std::ifstream file;
│ │ │ +
1413 if (extension != "") {
│ │ │ +
1414 rfilename = pureFilename + extension;
│ │ │ +
1415 file.open(rfilename.c_str());
│ │ │ +
1416 if(!file)
│ │ │ +
1417 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1418 }
│ │ │ +
1419 else {
│ │ │ +
1420 // try both .mm and .mtx
│ │ │ +
1421 rfilename = pureFilename + ".mm";
│ │ │ +
1422 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1423 if(!file) {
│ │ │ +
1424 rfilename = pureFilename + ".mtx";
│ │ │ +
1425 file.open(rfilename.c_str(), std::ios::in);
│ │ │ +
1426 if(!file)
│ │ │ +
1427 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str());
│ │ │ +
1428 }
│ │ │ +
1429 }
│ │ │ +
1430 readMatrixMarket(matrix,file);
│ │ │ +
1431 file.close();
│ │ │ +
1432 }
│ │ │ +
│ │ │ +
1433
│ │ │ +
1435}
│ │ │ +
1436#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.
│ │ │ +
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:973
│ │ │ +
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:1194
│ │ │ +
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:1312
│ │ │ +
std::size_t countEntries(const BlockVector< T, A > &vector)
Definition matrixmarket.hh:1119
│ │ │ +
void writeMatrixMarket(const V &vector, std::ostream &ostr, const std::integral_constant< int, 0 > &)
Definition matrixmarket.hh:1132
│ │ │ +
void mm_print_vector_entry(const V &entry, std::ostream &ostr, const std::integral_constant< int, 1 > &, size_t lane)
Definition matrixmarket.hh:1092
│ │ │ +
static const int default_precision
Definition matrixmarket.hh:1181
│ │ │ +
void mm_read_vector_entries(Dune::BlockVector< T, A > &vector, std::size_t size, std::istream &istr, size_t lane)
Definition matrixmarket.hh:943
│ │ │ +
void mm_read_header(std::size_t &rows, std::size_t &cols, MatrixMarketImpl::MMHeader &header, std::istream &istr, bool isVector)
Definition matrixmarket.hh:914
│ │ │ +
void mm_print_entry(const B &entry, std::size_t rowidx, std::size_t colidx, std::ostream &ostr)
Definition matrixmarket.hh:1073
│ │ │ +
STL namespace.
│ │ │
Definition allocator.hh:11
│ │ │
MatrixSparsityPatternGatherScatter< M, I >::ColIter MatrixSparsityPatternGatherScatter< M, I >::col
Definition matrixredistribute.hh:591
│ │ │ -
Definition novlpschwarz.hh:256
│ │ │ -
Definition fastamgsmoother.hh:17
│ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:20
│ │ │ -
Definition fastamgsmoother.hh:67
│ │ │ -
static void apply(const M &A, X &x, Y &d, const Y &b)
Definition fastamgsmoother.hh:70
│ │ │ +
Definition matrixmarket.hh:67
│ │ │ +
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:590
│ │ │ +
bool operator<(const IndexData< T > &i1, const IndexData< T > &i2)
LessThan operator.
Definition matrixmarket.hh:673
│ │ │ +
LineType
Definition matrixmarket.hh:339
│ │ │ +
@ DATA
Definition matrixmarket.hh:339
│ │ │ +
@ MM_HEADER
Definition matrixmarket.hh:339
│ │ │ +
@ MM_ISTLSTRUCT
Definition matrixmarket.hh:339
│ │ │ +
bool readMatrixMarketBanner(std::istream &file, MMHeader &mmHeader)
Definition matrixmarket.hh:396
│ │ │ +
@ MM_MAX_LINE_LENGTH
Definition matrixmarket.hh:340
│ │ │ +
void readSparseEntries(Dune::BCRSMatrix< T, A > &matrix, std::istream &file, std::size_t entries, const MMHeader &mmHeader, const D &)
Definition matrixmarket.hh:808
│ │ │ +
MM_TYPE
Definition matrixmarket.hh:342
│ │ │ +
@ array_type
Definition matrixmarket.hh:342
│ │ │ +
@ coordinate_type
Definition matrixmarket.hh:342
│ │ │ +
@ unknown_type
Definition matrixmarket.hh:342
│ │ │ +
std::istream & operator>>(std::istream &is, NumericWrapper< T > &num)
Definition matrixmarket.hh:657
│ │ │ +
void skipComments(std::istream &file)
Definition matrixmarket.hh:382
│ │ │ +
bool lineFeed(std::istream &file)
Definition matrixmarket.hh:358
│ │ │ +
MM_STRUCTURE
Definition matrixmarket.hh:346
│ │ │ +
@ skew_symmetric
Definition matrixmarket.hh:346
│ │ │ +
@ general
Definition matrixmarket.hh:346
│ │ │ +
@ hermitian
Definition matrixmarket.hh:346
│ │ │ +
@ unknown_structure
Definition matrixmarket.hh:346
│ │ │ +
@ symmetric
Definition matrixmarket.hh:346
│ │ │ +
MM_CTYPE
Definition matrixmarket.hh:344
│ │ │ +
@ unknown_ctype
Definition matrixmarket.hh:344
│ │ │ +
@ pattern
Definition matrixmarket.hh:344
│ │ │ +
@ complex_type
Definition matrixmarket.hh:344
│ │ │ +
@ double_type
Definition matrixmarket.hh:344
│ │ │ +
@ integer_type
Definition matrixmarket.hh:344
│ │ │ +
std::enable_if_t<!is_complex< T >::value, T > conj(const T &r)
Definition matrixmarket.hh:776
│ │ │ +
std::tuple< std::string, std::string > splitFilename(const std::string &filename)
Definition matrixmarket.hh:895
│ │ │ +
A sparse block matrix with compressed row storage.
Definition bcrsmatrix.hh:467
│ │ │ +
Iterator begin()
Get iterator to first row.
Definition bcrsmatrix.hh:672
│ │ │ +
@ row_wise
Build in a row-wise manner.
Definition bcrsmatrix.hh:518
│ │ │ +
Iterator end()
Get iterator to one beyond last row.
Definition bcrsmatrix.hh:678
│ │ │ +
CreateIterator createend()
get create iterator pointing to one after the last block
Definition bcrsmatrix.hh:1103
│ │ │ +
size_type M() const
number of columns (counted in blocks)
Definition bcrsmatrix.hh:2010
│ │ │ +
CreateIterator createbegin()
get initial create iterator
Definition bcrsmatrix.hh:1097
│ │ │ +
size_type N() const
number of rows (counted in blocks)
Definition bcrsmatrix.hh:2004
│ │ │ +
void setBuildMode(BuildMode bm)
Sets the build mode of the matrix.
Definition bcrsmatrix.hh:831
│ │ │ +
void setSize(size_type rows, size_type columns, size_type nnz=0)
Set the size of the matrix.
Definition bcrsmatrix.hh:859
│ │ │ +
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:78
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:83
│ │ │ +
static std::string str()
Definition matrixmarket.hh:86
│ │ │ +
static std::string str()
Definition matrixmarket.hh:102
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:99
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:115
│ │ │ +
static std::string str()
Definition matrixmarket.hh:118
│ │ │ +
static std::string str()
Definition matrixmarket.hh:134
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:131
│ │ │ +
static std::string str()
Definition matrixmarket.hh:186
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:183
│ │ │ +
static std::string str()
Definition matrixmarket.hh:202
│ │ │ +
@ is_numeric
Whether T is a supported numeric type.
Definition matrixmarket.hh:199
│ │ │ +
Meta program to write the correct Matrix Market header.
Definition matrixmarket.hh:217
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:222
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:232
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:242
│ │ │ +
static void print(std::ostream &os)
Definition matrixmarket.hh:252
│ │ │ +
Metaprogram for writing the ISTL block structure header.
Definition matrixmarket.hh:268
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:276
│ │ │ +
BlockVector< T, A > M
Definition matrixmarket.hh:273
│ │ │ +
BlockVector< FieldVector< T, i >, A > M
Definition matrixmarket.hh:286
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:288
│ │ │ +
BCRSMatrix< T, A > M
Definition matrixmarket.hh:298
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:301
│ │ │ +
BCRSMatrix< FieldMatrix< T, i, j >, A > M
Definition matrixmarket.hh:311
│ │ │ +
static void print(std::ostream &os, const M &)
Definition matrixmarket.hh:313
│ │ │ +
FieldMatrix< T, i, j > M
Definition matrixmarket.hh:324
│ │ │ +
static void print(std::ostream &, const M &)
Definition matrixmarket.hh:326
│ │ │ +
static void print(std::ostream &, const M &)
Definition matrixmarket.hh:335
│ │ │ +
FieldVector< T, i > M
Definition matrixmarket.hh:333
│ │ │ +
Definition matrixmarket.hh:349
│ │ │ +
MM_STRUCTURE structure
Definition matrixmarket.hh:355
│ │ │ +
MM_TYPE type
Definition matrixmarket.hh:353
│ │ │ +
MMHeader()
Definition matrixmarket.hh:350
│ │ │ +
MM_CTYPE ctype
Definition matrixmarket.hh:354
│ │ │ +
Definition matrixmarket.hh:621
│ │ │ +
std::size_t index
Definition matrixmarket.hh:622
│ │ │ +
a wrapper class of numeric values.
Definition matrixmarket.hh:638
│ │ │ +
T number
Definition matrixmarket.hh:639
│ │ │ +
Utility class for marking the pattern type of the MatrixMarket matrices.
Definition matrixmarket.hh:650
│ │ │ +
Functor to the data values of the matrix.
Definition matrixmarket.hh:720
│ │ │ +
void operator()(const std::vector< std::set< IndexData< D > > > &rows, BCRSMatrix< T > &matrix)
Sets the matrix values.
Definition matrixmarket.hh:727
│ │ │ +
void operator()(const std::vector< std::set< IndexData< D > > > &rows, BCRSMatrix< FieldMatrix< T, brows, bcols > > &matrix)
Sets the matrix values.
Definition matrixmarket.hh:745
│ │ │ +
void operator()(const std::vector< std::set< IndexData< PatternDummy > > > &, M &)
Definition matrixmarket.hh:766
│ │ │ +
Definition matrixmarket.hh:771
│ │ │ +
Definition matrixmarket.hh:787
│ │ │ + │ │ │ + │ │ │ + │ │ │ + │ │ │ +
Definition matrixmarket.hh:911
│ │ │ +
Definition matrixutils.hh:27
│ │ │ +
@ value
True if T is an ISTL matrix.
Definition matrixutils.hh:509
│ │ │ +
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
│ │ │ +
OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category cat_=SolverCategory::overlapping, bool freecomm_=false)
Definition owneroverlapcopy.hh:554
│ │ │ +
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,154 +1,1719 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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#include │ │ │ │ -10 │ │ │ │ -11namespace _D_u_n_e │ │ │ │ -12{ │ │ │ │ -13 namespace _A_m_g │ │ │ │ -14 { │ │ │ │ -15 │ │ │ │ -16 template │ │ │ │ -_1_7 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 { │ │ │ │ -18 │ │ │ │ -19 template │ │ │ │ -_2_0 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ -21 const Y& b) │ │ │ │ -22 { │ │ │ │ -23 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ -24 typedef typename M::ConstColIterator ColIterator; │ │ │ │ -25 │ │ │ │ -26 typename Y::iterator dIter=d.begin(); │ │ │ │ -27 typename Y::const_iterator bIter=b.begin(); │ │ │ │ -28 typename X::iterator xIter=x.begin(); │ │ │ │ -29 │ │ │ │ -30 for(RowIterator row=A.begin(), end=A.end(); row != end; │ │ │ │ -31 ++row, ++dIter, ++xIter, ++bIter) │ │ │ │ -32 { │ │ │ │ -33 ColIterator _c_o_l=(*row).begin(); │ │ │ │ -34 *dIter = *bIter; │ │ │ │ -35 │ │ │ │ -36 for (; _c_o_l.index()>::value) │ │ │ │ -39 *dIter -= (*_c_o_l)*x[_c_o_l.index()]; │ │ │ │ -40 else │ │ │ │ -41 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{j>::value) │ │ │ │ -48 *xIter = (*dIter)/(*diag); │ │ │ │ -49 else │ │ │ │ -50 diag->solve(*xIter,*dIter); │ │ │ │ -51 │ │ │ │ -52 *dIter=0; //as r=v │ │ │ │ -53 │ │ │ │ -54 // Update residual for the symmetric case │ │ │ │ -55 for(_c_o_l=(*row).begin(); _c_o_l.index()>::value) │ │ │ │ -58 d[_c_o_l.index()] -= (*col)*(*xIter); │ │ │ │ -59 else │ │ │ │ -60 _c_o_l->mmv(*xIter, d[_c_o_l.index()]); //d_j-=A_ij x_i │ │ │ │ -61 } │ │ │ │ -62 } │ │ │ │ -63 } │ │ │ │ -64 }; │ │ │ │ -65 │ │ │ │ -66 template │ │ │ │ -_6_7 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 { │ │ │ │ -68 │ │ │ │ -69 template │ │ │ │ -_7_0 static void _a_p_p_l_y(const M& A, X& x, Y& d, │ │ │ │ -71 const Y& b) │ │ │ │ -72 { │ │ │ │ -73 typedef typename M::ConstRowIterator RowIterator; │ │ │ │ -74 typedef typename M::ConstColIterator ColIterator; │ │ │ │ -75 typedef typename Y::block_type YBlock; │ │ │ │ -76 │ │ │ │ -77 typename Y::iterator dIter=d.beforeEnd(); │ │ │ │ -78 typename X::iterator xIter=x.beforeEnd(); │ │ │ │ -79 typename Y::const_iterator bIter=b.beforeEnd(); │ │ │ │ -80 │ │ │ │ -81 for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end; │ │ │ │ -82 --row, --dIter, --xIter, --bIter) │ │ │ │ -83 { │ │ │ │ -84 ColIterator endCol=(*row).beforeBegin(); │ │ │ │ -85 ColIterator _c_o_l=(*row).beforeEnd(); │ │ │ │ -86 *dIter = *bIter; │ │ │ │ -87 │ │ │ │ -88 for (; _c_o_l.index()>row.index(); --_c_o_l) │ │ │ │ -89 { │ │ │ │ -90 if constexpr (Dune::IsNumber>::value) │ │ │ │ -91 *dIter -= (*_c_o_l)*x[_c_o_l.index()]; │ │ │ │ -92 else │ │ │ │ -93 (*col).mmv(x[_c_o_l.index()],*dIter); // rhs -= sum_{j>::value) │ │ │ │ -102 v -= (*_c_o_l)*x[_c_o_l.index()]; │ │ │ │ -103 else │ │ │ │ -104 (*col).mmv(x[_c_o_l.index()],v); // v -= sum_{j │ │ │ │ +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#include │ │ │ │ +31#include │ │ │ │ +32 │ │ │ │ +33#include <_d_u_n_e_/_i_s_t_l_/_b_c_r_s_m_a_t_r_i_x_._h_h> │ │ │ │ +34#include <_d_u_n_e_/_i_s_t_l_/_b_v_e_c_t_o_r_._h_h> │ │ │ │ +35#include <_d_u_n_e_/_i_s_t_l_/_m_a_t_r_i_x_u_t_i_l_s_._h_h> // countNonZeros() │ │ │ │ +36#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> │ │ │ │ +37 │ │ │ │ +38namespace _D_u_n_e │ │ │ │ +39{ │ │ │ │ +40 │ │ │ │ +60 │ │ │ │ +_6_6 namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l │ │ │ │ +67 { │ │ │ │ +77 template │ │ │ │ +_7_8 struct _m_m___n_u_m_e_r_i_c___t_y_p_e { │ │ │ │ +79 enum { │ │ │ │ +_8_3 _i_s___n_u_m_e_r_i_c=false │ │ │ │ +84 }; │ │ │ │ +85 │ │ │ │ +_8_6 static std::string _s_t_r() │ │ │ │ +87 { │ │ │ │ +88 return "unknown"; │ │ │ │ +89 } │ │ │ │ +90 }; │ │ │ │ +91 │ │ │ │ +92 template<> │ │ │ │ +_9_3 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +94 { │ │ │ │ +95 enum { │ │ │ │ +_9_9 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +100 }; │ │ │ │ +101 │ │ │ │ +_1_0_2 static std::string _s_t_r() │ │ │ │ +103 { │ │ │ │ +104 return "integer"; │ │ │ │ 105 } │ │ │ │ -106 │ │ │ │ -107 // Not recursive yet. Just solve with the diagonal │ │ │ │ -108 if constexpr (Dune::IsNumber>::value) │ │ │ │ -109 *xIter = v/(*diag); │ │ │ │ -110 else │ │ │ │ -111 diag->solve(*xIter,v); │ │ │ │ -112 │ │ │ │ -113 *dIter-=v; │ │ │ │ -114 │ │ │ │ -115 // Update residual for the symmetric case │ │ │ │ -116 // Skip residual computation as it is not needed. │ │ │ │ -117 //for(col=(*row).begin();col.index() │ │ │ │ +_1_0_9 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +110 { │ │ │ │ +111 enum { │ │ │ │ +_1_1_5 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +116 }; │ │ │ │ +117 │ │ │ │ +_1_1_8 static std::string _s_t_r() │ │ │ │ +119 { │ │ │ │ +120 return "real"; │ │ │ │ +121 } │ │ │ │ +122 }; │ │ │ │ +123 │ │ │ │ +124 template<> │ │ │ │ +_1_2_5 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +126 { │ │ │ │ +127 enum { │ │ │ │ +_1_3_1 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +132 }; │ │ │ │ +133 │ │ │ │ +_1_3_4 static std::string _s_t_r() │ │ │ │ +135 { │ │ │ │ +136 return "real"; │ │ │ │ +137 } │ │ │ │ +138 }; │ │ │ │ +139 │ │ │ │ +140#if HAVE_GMP │ │ │ │ +141 template │ │ │ │ +142 struct mm_numeric_type<_D_u_n_e::GMPField> │ │ │ │ +143 { │ │ │ │ +144 enum { │ │ │ │ +148 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +149 }; │ │ │ │ +150 │ │ │ │ +151 static std::string _s_t_r() │ │ │ │ +152 { │ │ │ │ +153 return "real"; │ │ │ │ +154 } │ │ │ │ +155 }; │ │ │ │ +156#endif │ │ │ │ +157 │ │ │ │ +158#if HAVE_QUADMATH │ │ │ │ +159 template<> │ │ │ │ +160 struct _m_m___n_u_m_e_r_i_c___t_y_p_e │ │ │ │ +161 { │ │ │ │ +162 enum { │ │ │ │ +166 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +167 }; │ │ │ │ +168 │ │ │ │ +169 static std::string _s_t_r() │ │ │ │ +170 { │ │ │ │ +171 return "real"; │ │ │ │ +172 } │ │ │ │ +173 }; │ │ │ │ +174#endif │ │ │ │ +175 │ │ │ │ +176 template<> │ │ │ │ +_1_7_7 struct _m_m___n_u_m_e_r_i_c___t_y_p_e<_s_t_d::complex > │ │ │ │ +178 { │ │ │ │ +179 enum { │ │ │ │ +_1_8_3 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +184 }; │ │ │ │ +185 │ │ │ │ +_1_8_6 static std::string _s_t_r() │ │ │ │ +187 { │ │ │ │ +188 return "complex"; │ │ │ │ +189 } │ │ │ │ +190 }; │ │ │ │ +191 │ │ │ │ +192 template<> │ │ │ │ +_1_9_3 struct _m_m___n_u_m_e_r_i_c___t_y_p_e<_s_t_d::complex > │ │ │ │ +194 { │ │ │ │ +195 enum { │ │ │ │ +_1_9_9 _i_s___n_u_m_e_r_i_c=true │ │ │ │ +200 }; │ │ │ │ +201 │ │ │ │ +_2_0_2 static std::string _s_t_r() │ │ │ │ +203 { │ │ │ │ +204 return "complex"; │ │ │ │ +205 } │ │ │ │ +206 }; │ │ │ │ +207 │ │ │ │ +216 template │ │ │ │ +_2_1_7 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r; │ │ │ │ +218 │ │ │ │ +219 template │ │ │ │ +_2_2_0 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 > │ │ │ │ +221 { │ │ │ │ +_2_2_2 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +223 { │ │ │ │ +224 os<<"%%MatrixMarket matrix coordinate "; │ │ │ │ +225 os<:: │ │ │ │ +field_type>>::str()<<" general"< │ │ │ │ +_2_3_0 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 > │ │ │ │ +231 { │ │ │ │ +_2_3_2 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +233 { │ │ │ │ +234 os<<"%%MatrixMarket matrix array "; │ │ │ │ +235 os<:: │ │ │ │ +field_type>>::str()<<" general"< │ │ │ │ +_2_4_0 struct _m_m___h_e_a_d_e_r___p_r_i_n_t_e_r > │ │ │ │ +241 { │ │ │ │ +_2_4_2 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +243 { │ │ │ │ +244 os<<"%%MatrixMarket matrix array "; │ │ │ │ +245 os<::str()<<" general"< │ │ │ │ +_2_5_0 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 > │ │ │ │ +251 { │ │ │ │ +_2_5_2 static void _p_r_i_n_t(std::ostream& os) │ │ │ │ +253 { │ │ │ │ +254 os<<"%%MatrixMarket matrix array "; │ │ │ │ +255 os<::str()<<" general"< │ │ │ │ +_2_6_8 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r; │ │ │ │ +269 │ │ │ │ +270 template │ │ │ │ +_2_7_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 > │ │ │ │ +272 { │ │ │ │ +_2_7_3 typedef _B_l_o_c_k_V_e_c_t_o_r_<_T_,_A_> _M; │ │ │ │ +274 static_assert(IsNumber::value, "Only scalar entries are expected │ │ │ │ +here!"); │ │ │ │ +275 │ │ │ │ +_2_7_6 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +277 { │ │ │ │ +278 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +279 os<<"1 1"< │ │ │ │ +_2_8_4 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> > │ │ │ │ +285 { │ │ │ │ +_2_8_6 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; │ │ │ │ +287 │ │ │ │ +_2_8_8 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +289 { │ │ │ │ +290 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +291 os< │ │ │ │ +_2_9_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 > │ │ │ │ +297 { │ │ │ │ +_2_9_8 typedef _B_C_R_S_M_a_t_r_i_x_<_T_,_A_> _M; │ │ │ │ +299 static_assert(IsNumber::value, "Only scalar entries are expected │ │ │ │ +here!"); │ │ │ │ +300 │ │ │ │ +_3_0_1 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +302 { │ │ │ │ +303 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +304 os<<"1 1"< │ │ │ │ +_3_0_9 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> > │ │ │ │ +310 { │ │ │ │ +_3_1_1 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; │ │ │ │ +312 │ │ │ │ +_3_1_3 static void _p_r_i_n_t(std::ostream& os, const _M&) │ │ │ │ +314 { │ │ │ │ +315 os<<"% ISTL_STRUCT blocked "; │ │ │ │ +316 os< │ │ │ │ +_3_2_2 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 > │ │ │ │ +323 { │ │ │ │ +_3_2_4 typedef _F_i_e_l_d_M_a_t_r_i_x_<_T_,_i_,_j_> _M; │ │ │ │ +325 │ │ │ │ +_3_2_6 static void _p_r_i_n_t(std::ostream& /*os*/, const _M& /*m*/) │ │ │ │ +327 {} │ │ │ │ +328 }; │ │ │ │ +329 │ │ │ │ +330 template │ │ │ │ +_3_3_1 struct _m_m___b_l_o_c_k___s_t_r_u_c_t_u_r_e___h_e_a_d_e_r > │ │ │ │ +332 { │ │ │ │ +_3_3_3 typedef FieldVector _M; │ │ │ │ +334 │ │ │ │ +_3_3_5 static void _p_r_i_n_t(std::ostream& /*os*/, const _M& /*m*/) │ │ │ │ +336 {} │ │ │ │ +337 }; │ │ │ │ +338 │ │ │ │ +_3_3_9 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 }; │ │ │ │ +_3_4_0 enum { _M_M___M_A_X___L_I_N_E___L_E_N_G_T_H=1025 }; │ │ │ │ +341 │ │ │ │ +_3_4_2 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 }; │ │ │ │ +343 │ │ │ │ +_3_4_4 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 }; │ │ │ │ +345 │ │ │ │ +_3_4_6 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 }; │ │ │ │ +347 │ │ │ │ +_3_4_8 struct _M_M_H_e_a_d_e_r │ │ │ │ +349 { │ │ │ │ +_3_5_0 _M_M_H_e_a_d_e_r() │ │ │ │ +351 : _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) │ │ │ │ +352 {} │ │ │ │ +_3_5_3 _M_M___T_Y_P_E _t_y_p_e; │ │ │ │ +_3_5_4 _M_M___C_T_Y_P_E _c_t_y_p_e; │ │ │ │ +_3_5_5 _M_M___S_T_R_U_C_T_U_R_E _s_t_r_u_c_t_u_r_e; │ │ │ │ +356 }; │ │ │ │ +357 │ │ │ │ +_3_5_8 inline bool _l_i_n_e_F_e_e_d(std::istream& file) │ │ │ │ +359 { │ │ │ │ +360 char c; │ │ │ │ +361 if(!file.eof()) │ │ │ │ +362 c=file.peek(); │ │ │ │ +363 else │ │ │ │ +364 return false; │ │ │ │ +365 // ignore whitespace │ │ │ │ +366 while(c==' ') │ │ │ │ +367 { │ │ │ │ +368 file.get(); │ │ │ │ +369 if(file.eof()) │ │ │ │ +370 return false; │ │ │ │ +371 c=file.peek(); │ │ │ │ +372 } │ │ │ │ +373 │ │ │ │ +374 if(c=='\n') { │ │ │ │ +375 /* eat the line feed */ │ │ │ │ +376 file.get(); │ │ │ │ +377 return true; │ │ │ │ +378 } │ │ │ │ +379 return false; │ │ │ │ +380 } │ │ │ │ +381 │ │ │ │ +_3_8_2 inline void _s_k_i_p_C_o_m_m_e_n_t_s(std::istream& file) │ │ │ │ +383 { │ │ │ │ +384 _l_i_n_e_F_e_e_d(file); │ │ │ │ +385 char c=file.peek(); │ │ │ │ +386 // ignore comment lines │ │ │ │ +387 while(c=='%') │ │ │ │ +388 { │ │ │ │ +389 /* discard the rest of the line */ │ │ │ │ +390 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +391 c=file.peek(); │ │ │ │ +392 } │ │ │ │ +393 } │ │ │ │ +394 │ │ │ │ +395 │ │ │ │ +_3_9_6 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) │ │ │ │ +397 { │ │ │ │ +398 std::string buffer; │ │ │ │ +399 char c; │ │ │ │ +400 file >> buffer; │ │ │ │ +401 c=buffer[0]; │ │ │ │ +402 mmHeader=_M_M_H_e_a_d_e_r(); │ │ │ │ +403 if(c!='%') │ │ │ │ +404 return false; │ │ │ │ +405 dverb<::max(),'\n'); │ │ │ │ +410 return false; │ │ │ │ +411 } │ │ │ │ +412 │ │ │ │ +413 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +414 /* premature end of line */ │ │ │ │ +415 return false; │ │ │ │ +416 │ │ │ │ +417 /* read the matrix_type */ │ │ │ │ +418 file >> buffer; │ │ │ │ +419 │ │ │ │ +420 if(buffer != "matrix") │ │ │ │ +421 { │ │ │ │ +422 /* discard the rest of the line */ │ │ │ │ +423 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +424 return false; │ │ │ │ +425 } │ │ │ │ +426 │ │ │ │ +427 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +428 /* premature end of line */ │ │ │ │ +429 return false; │ │ │ │ +430 │ │ │ │ +431 /* The type of the matrix */ │ │ │ │ +432 file >> buffer; │ │ │ │ +433 │ │ │ │ +434 if(buffer.empty()) │ │ │ │ +435 return false; │ │ │ │ +436 │ │ │ │ +437 std::transform(buffer.begin(), buffer.end(), buffer.begin(), │ │ │ │ +438 ::tolower); │ │ │ │ +439 │ │ │ │ +440 switch(buffer[0]) │ │ │ │ +441 { │ │ │ │ +442 case 'a' : │ │ │ │ +443 /* sanity check */ │ │ │ │ +444 if(buffer != "array") │ │ │ │ +445 { │ │ │ │ +446 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +447 return false; │ │ │ │ +448 } │ │ │ │ +449 mmHeader._t_y_p_e=_a_r_r_a_y___t_y_p_e; │ │ │ │ +450 break; │ │ │ │ +451 case 'c' : │ │ │ │ +452 /* sanity check */ │ │ │ │ +453 if(buffer != "coordinate") │ │ │ │ +454 { │ │ │ │ +455 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +456 return false; │ │ │ │ +457 } │ │ │ │ +458 mmHeader._t_y_p_e=_c_o_o_r_d_i_n_a_t_e___t_y_p_e; │ │ │ │ +459 break; │ │ │ │ +460 default : │ │ │ │ +461 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +462 return false; │ │ │ │ +463 } │ │ │ │ +464 │ │ │ │ +465 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +466 /* premature end of line */ │ │ │ │ +467 return false; │ │ │ │ +468 │ │ │ │ +469 /* The numeric type used. */ │ │ │ │ +470 file >> buffer; │ │ │ │ +471 │ │ │ │ +472 if(buffer.empty()) │ │ │ │ +473 return false; │ │ │ │ +474 │ │ │ │ +475 std::transform(buffer.begin(), buffer.end(), buffer.begin(), │ │ │ │ +476 ::tolower); │ │ │ │ +477 switch(buffer[0]) │ │ │ │ +478 { │ │ │ │ +479 case 'i' : │ │ │ │ +480 /* sanity check */ │ │ │ │ +481 if(buffer != "integer") │ │ │ │ +482 { │ │ │ │ +483 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +484 return false; │ │ │ │ +485 } │ │ │ │ +486 mmHeader._c_t_y_p_e=_i_n_t_e_g_e_r___t_y_p_e; │ │ │ │ +487 break; │ │ │ │ +488 case 'r' : │ │ │ │ +489 /* sanity check */ │ │ │ │ +490 if(buffer != "real") │ │ │ │ +491 { │ │ │ │ +492 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +493 return false; │ │ │ │ +494 } │ │ │ │ +495 mmHeader._c_t_y_p_e=_d_o_u_b_l_e___t_y_p_e; │ │ │ │ +496 break; │ │ │ │ +497 case 'c' : │ │ │ │ +498 /* sanity check */ │ │ │ │ +499 if(buffer != "complex") │ │ │ │ +500 { │ │ │ │ +501 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +502 return false; │ │ │ │ +503 } │ │ │ │ +504 mmHeader._c_t_y_p_e=_c_o_m_p_l_e_x___t_y_p_e; │ │ │ │ +505 break; │ │ │ │ +506 case 'p' : │ │ │ │ +507 /* sanity check */ │ │ │ │ +508 if(buffer != "pattern") │ │ │ │ +509 { │ │ │ │ +510 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +511 return false; │ │ │ │ +512 } │ │ │ │ +513 mmHeader._c_t_y_p_e=_p_a_t_t_e_r_n; │ │ │ │ +514 break; │ │ │ │ +515 default : │ │ │ │ +516 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +517 return false; │ │ │ │ +518 } │ │ │ │ +519 │ │ │ │ +520 if(_l_i_n_e_F_e_e_d(file)) │ │ │ │ +521 return false; │ │ │ │ +522 │ │ │ │ +523 file >> buffer; │ │ │ │ +524 │ │ │ │ +525 std::transform(buffer.begin(), buffer.end(), buffer.begin(), │ │ │ │ +526 ::tolower); │ │ │ │ +527 switch(buffer[0]) │ │ │ │ +528 { │ │ │ │ +529 case 'g' : │ │ │ │ +530 /* sanity check */ │ │ │ │ +531 if(buffer != "general") │ │ │ │ +532 { │ │ │ │ +533 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +534 return false; │ │ │ │ +535 } │ │ │ │ +536 mmHeader._s_t_r_u_c_t_u_r_e=_g_e_n_e_r_a_l; │ │ │ │ +537 break; │ │ │ │ +538 case 'h' : │ │ │ │ +539 /* sanity check */ │ │ │ │ +540 if(buffer != "hermitian") │ │ │ │ +541 { │ │ │ │ +542 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +543 return false; │ │ │ │ +544 } │ │ │ │ +545 mmHeader._s_t_r_u_c_t_u_r_e=_h_e_r_m_i_t_i_a_n; │ │ │ │ +546 break; │ │ │ │ +547 case 's' : │ │ │ │ +548 if(buffer.size()==1) { │ │ │ │ +549 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +550 return false; │ │ │ │ +551 } │ │ │ │ +552 │ │ │ │ +553 switch(buffer[1]) │ │ │ │ +554 { │ │ │ │ +555 case 'y' : │ │ │ │ +556 /* sanity check */ │ │ │ │ +557 if(buffer != "symmetric") │ │ │ │ +558 { │ │ │ │ +559 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +560 return false; │ │ │ │ +561 } │ │ │ │ +562 mmHeader._s_t_r_u_c_t_u_r_e=_s_y_m_m_e_t_r_i_c; │ │ │ │ +563 break; │ │ │ │ +564 case 'k' : │ │ │ │ +565 /* sanity check */ │ │ │ │ +566 if(buffer != "skew-symmetric") │ │ │ │ +567 { │ │ │ │ +568 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +569 return false; │ │ │ │ +570 } │ │ │ │ +571 mmHeader._s_t_r_u_c_t_u_r_e=_s_k_e_w___s_y_m_m_e_t_r_i_c; │ │ │ │ +572 break; │ │ │ │ +573 default : │ │ │ │ +574 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +575 return false; │ │ │ │ +576 } │ │ │ │ +577 break; │ │ │ │ +578 default : │ │ │ │ +579 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +580 return false; │ │ │ │ +581 } │ │ │ │ +582 file.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +583 c=file.peek(); │ │ │ │ +584 return true; │ │ │ │ +585 │ │ │ │ +586 } │ │ │ │ +587 │ │ │ │ +588 template │ │ │ │ +589 std::tuple │ │ │ │ +_5_9_0 _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) │ │ │ │ +591 { │ │ │ │ +592 std::size_t blockrows=rows/brows; │ │ │ │ +593 std::size_t blockcols=cols/bcols; │ │ │ │ +594 std::size_t blocksize=brows*bcols; │ │ │ │ +595 std::size_t blockentries=0; │ │ │ │ +596 │ │ │ │ +597 switch(header._s_t_r_u_c_t_u_r_e) │ │ │ │ +598 { │ │ │ │ +599 case _g_e_n_e_r_a_l : │ │ │ │ +600 blockentries = entries/blocksize; break; │ │ │ │ +601 case _s_k_e_w___s_y_m_m_e_t_r_i_c : │ │ │ │ +602 blockentries = 2*entries/blocksize; break; │ │ │ │ +603 case _s_y_m_m_e_t_r_i_c : │ │ │ │ +604 blockentries = (2*entries-rows)/blocksize; break; │ │ │ │ +605 case _h_e_r_m_i_t_i_a_n : │ │ │ │ +606 blockentries = (2*entries-rows)/blocksize; break; │ │ │ │ +607 default : │ │ │ │ +608 throw Dune::NotImplemented(); │ │ │ │ +609 } │ │ │ │ +610 return std::make_tuple(blockrows, blockcols, blockentries); │ │ │ │ +611 } │ │ │ │ +612 │ │ │ │ +613 /* │ │ │ │ +614 * @brief Storage class for the column index and the numeric value. │ │ │ │ +615 * │ │ │ │ +616 * \tparam T Either a NumericWrapper of the numeric type or PatternDummy │ │ │ │ +617 * for MatrixMarket pattern case. │ │ │ │ +618 */ │ │ │ │ +619 template │ │ │ │ +_6_2_0 struct _I_n_d_e_x_D_a_t_a : public T │ │ │ │ +621 { │ │ │ │ +_6_2_2 std::size_t _i_n_d_e_x = {}; │ │ │ │ +623 }; │ │ │ │ +624 │ │ │ │ +625 │ │ │ │ +636 template │ │ │ │ +_6_3_7 struct _N_u_m_e_r_i_c_W_r_a_p_p_e_r │ │ │ │ +638 { │ │ │ │ +_6_3_9 T _n_u_m_b_e_r = {}; │ │ │ │ +_6_4_0 operator T&() │ │ │ │ +641 { │ │ │ │ +642 return _n_u_m_b_e_r; │ │ │ │ +643 } │ │ │ │ +644 }; │ │ │ │ +645 │ │ │ │ +_6_4_9 struct _P_a_t_t_e_r_n_D_u_m_m_y │ │ │ │ +650 {}; │ │ │ │ +651 │ │ │ │ +652 template<> │ │ │ │ +_6_5_3 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> │ │ │ │ +654 {}; │ │ │ │ +655 │ │ │ │ +656 template │ │ │ │ +_6_5_7 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) │ │ │ │ +658 { │ │ │ │ +659 return is>>num._n_u_m_b_e_r; │ │ │ │ +660 } │ │ │ │ +661 │ │ │ │ +_6_6_2 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) │ │ │ │ +663 { │ │ │ │ +664 return is; │ │ │ │ +665 } │ │ │ │ +666 │ │ │ │ +672 template │ │ │ │ +_6_7_3 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) │ │ │ │ +674 { │ │ │ │ +675 return i1._i_n_d_e_x │ │ │ │ +_6_8_4 std::istream& _o_p_e_r_a_t_o_r_>_>(std::istream& is, _I_n_d_e_x_D_a_t_a_<_T_>& data) │ │ │ │ +685 { │ │ │ │ +686 is>>data._i_n_d_e_x; │ │ │ │ +687 /* MatrixMarket indices are one based. Decrement for C++ */ │ │ │ │ +688 --data._i_n_d_e_x; │ │ │ │ +689 return is>>data.number; │ │ │ │ +690 } │ │ │ │ +691 │ │ │ │ +697 template │ │ │ │ +_6_9_8 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) │ │ │ │ +699 { │ │ │ │ +700 is>>data.index; │ │ │ │ +701 /* MatrixMarket indices are one based. Decrement for C++ */ │ │ │ │ +702 --data.index; │ │ │ │ +703 // real and imaginary part needs to be read separately as │ │ │ │ +704 // complex numbers are not provided in pair form. (x,y) │ │ │ │ +705 _N_u_m_e_r_i_c_W_r_a_p_p_e_r_<_T_> real, imag; │ │ │ │ +706 is>>real; │ │ │ │ +707 is>>imag; │ │ │ │ +708 data._n_u_m_b_e_r = {real._n_u_m_b_e_r, imag._n_u_m_b_e_r}; │ │ │ │ +709 return is; │ │ │ │ +710 } │ │ │ │ +711 │ │ │ │ +718 template │ │ │ │ +_7_1_9 struct _M_a_t_r_i_x_V_a_l_u_e_s_S_e_t_t_e_r │ │ │ │ +720 { │ │ │ │ +726 template │ │ │ │ +_7_2_7 void _o_p_e_r_a_t_o_r_(_)(const std::vector > >& rows, │ │ │ │ +728 _B_C_R_S_M_a_t_r_i_x_<_T_>& matrix) │ │ │ │ +729 { │ │ │ │ +730 static_assert(IsNumber::value && brows==1 && bcols==1, "Only scalar │ │ │ │ +entries are expected here!"); │ │ │ │ +731 for (auto iter=matrix._b_e_g_i_n(); iter!= matrix._e_n_d(); ++iter) │ │ │ │ +732 { │ │ │ │ +733 auto brow=iter.index(); │ │ │ │ +734 for (auto siter=rows[brow].begin(); siter != rows[brow].end(); ++siter) │ │ │ │ +735 (*iter)[siter->index] = siter->number; │ │ │ │ +736 } │ │ │ │ +737 } │ │ │ │ +738 │ │ │ │ +744 template │ │ │ │ +_7_4_5 void _o_p_e_r_a_t_o_r_(_)(const std::vector > >& rows, │ │ │ │ +746 _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) │ │ │ │ +747 { │ │ │ │ +748 for (auto iter=matrix.begin(); iter!= matrix.end(); ++iter) │ │ │ │ +749 { │ │ │ │ +750 for (auto brow=iter.index()*brows, │ │ │ │ +751 browend=iter.index()*brows+brows; │ │ │ │ +752 browindex/bcols][brow%brows][siter->index%bcols]=siter->number; │ │ │ │ +757 } │ │ │ │ +758 } │ │ │ │ +759 } │ │ │ │ +760 }; │ │ │ │ +761 │ │ │ │ +762 template │ │ │ │ +_7_6_3 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> │ │ │ │ +764 { │ │ │ │ +765 template │ │ │ │ +_7_6_6 void _o_p_e_r_a_t_o_r_(_)(const std::vector > >& / │ │ │ │ +*rows*/, │ │ │ │ +767 M& /*matrix*/) │ │ │ │ +768 {} │ │ │ │ +769 }; │ │ │ │ +770 │ │ │ │ +_7_7_1 template struct _i_s___c_o_m_p_l_e_x : std::false_type {}; │ │ │ │ +_7_7_2 template struct _i_s___c_o_m_p_l_e_x<_s_t_d::complex> : std::true_type {}; │ │ │ │ +773 │ │ │ │ +774 // wrapper for std::conj. Returns T if T is not complex. │ │ │ │ +775 template │ │ │ │ +_7_7_6 std::enable_if_t::value, T> _c_o_n_j(const T& r){ │ │ │ │ +777 return r; │ │ │ │ +778 } │ │ │ │ +779 │ │ │ │ +780 template │ │ │ │ +_7_8_1 std::enable_if_t::value, T> _c_o_n_j(const T& r){ │ │ │ │ +782 return std::conj(r); │ │ │ │ +783 } │ │ │ │ +784 │ │ │ │ +785 template │ │ │ │ +_7_8_6 struct _m_m___m_u_l_t_i_p_l_i_e_r_s │ │ │ │ +787 {}; │ │ │ │ +788 │ │ │ │ +789 template │ │ │ │ +_7_9_0 struct _m_m___m_u_l_t_i_p_l_i_e_r_s<_B_C_R_S_M_a_t_r_i_x > │ │ │ │ +791 { │ │ │ │ +792 enum { │ │ │ │ +_7_9_3 _r_o_w_s = 1, │ │ │ │ +_7_9_4 _c_o_l_s = 1 │ │ │ │ +795 }; │ │ │ │ +796 }; │ │ │ │ +797 │ │ │ │ +798 template │ │ │ │ +_7_9_9 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> > │ │ │ │ +800 { │ │ │ │ +801 enum { │ │ │ │ +_8_0_2 _r_o_w_s = i, │ │ │ │ +_8_0_3 _c_o_l_s = j │ │ │ │ +804 }; │ │ │ │ +805 }; │ │ │ │ +806 │ │ │ │ +807 template │ │ │ │ +_8_0_8 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, │ │ │ │ +809 std::istream& file, std::size_t entries, │ │ │ │ +810 const _M_M_H_e_a_d_e_r& mmHeader, const D&) │ │ │ │ +811 { │ │ │ │ +812 typedef _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_> _M_a_t_r_i_x; │ │ │ │ +813 │ │ │ │ +814 // Number of rows and columns of T, if it is a matrix (1x1 otherwise) │ │ │ │ +815 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; │ │ │ │ +816 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; │ │ │ │ +817 │ │ │ │ +818 // First path │ │ │ │ +819 // store entries together with column index in a separate │ │ │ │ +820 // data structure │ │ │ │ +821 std::vector > > rows(matrix._N()*brows); │ │ │ │ +822 │ │ │ │ +823 auto readloop = [&] (auto symmetryFixup) { │ │ │ │ +824 for(std::size_t i = 0; i < entries; ++i) { │ │ │ │ +825 std::size_t row; │ │ │ │ +826 _I_n_d_e_x_D_a_t_a_<_D_> data; │ │ │ │ +827 _s_k_i_p_C_o_m_m_e_n_t_s(file); │ │ │ │ +828 file>>row; │ │ │ │ +829 --row; // Index was 1 based. │ │ │ │ +830 assert(row/bcols>data; │ │ │ │ +832 assert(data._i_n_d_e_x/bcols data_sym(data); │ │ │ │ +847 data_sym._i_n_d_e_x = row; │ │ │ │ +848 rows[data.index].insert(data_sym); │ │ │ │ +849 }); │ │ │ │ +850 break; │ │ │ │ +851 case _s_k_e_w___s_y_m_m_e_t_r_i_c : │ │ │ │ +852 readloop([&](auto row, auto data) { │ │ │ │ +853 _I_n_d_e_x_D_a_t_a_<_D_> data_sym; │ │ │ │ +854 data_sym.number = -data.number; │ │ │ │ +855 data_sym._i_n_d_e_x = row; │ │ │ │ +856 rows[data.index].insert(data_sym); │ │ │ │ +857 }); │ │ │ │ +858 break; │ │ │ │ +859 case _h_e_r_m_i_t_i_a_n : │ │ │ │ +860 readloop([&](auto row, auto data) { │ │ │ │ +861 _I_n_d_e_x_D_a_t_a_<_D_> data_sym; │ │ │ │ +862 data_sym.number = _c_o_n_j(data.number); │ │ │ │ +863 data_sym._i_n_d_e_x = row; │ │ │ │ +864 rows[data.index].insert(data_sym); │ │ │ │ +865 }); │ │ │ │ +866 break; │ │ │ │ +867 default: │ │ │ │ +868 DUNE_THROW(Dune::NotImplemented, │ │ │ │ +869 "Only general, symmetric, skew-symmetric and hermitian is supported right │ │ │ │ +now!"); │ │ │ │ +870 } │ │ │ │ +871 │ │ │ │ +872 // Setup the matrix sparsity pattern │ │ │ │ +873 int nnz=0; │ │ │ │ +874 for(typename Matrix::CreateIterator iter=matrix._c_r_e_a_t_e_b_e_g_i_n(); │ │ │ │ +875 iter!= matrix._c_r_e_a_t_e_e_n_d(); ++iter) │ │ │ │ +876 { │ │ │ │ +877 for(std::size_t brow=iter.index()*brows, browend=iter.index()*brows+brows; │ │ │ │ +878 brow >::const_iterator Siter; │ │ │ │ +881 for(Siter siter=rows[brow].begin(), send=rows[brow].end(); │ │ │ │ +882 siter != send; ++siter, ++nnz) │ │ │ │ +883 iter.insert(siter->index/bcols); │ │ │ │ +884 } │ │ │ │ +885 } │ │ │ │ +886 │ │ │ │ +887 //Set the matrix values │ │ │ │ +888 matrix=0; │ │ │ │ +889 │ │ │ │ +890 _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; │ │ │ │ +891 │ │ │ │ +892 Setter(rows, matrix); │ │ │ │ +893 } │ │ │ │ +894 │ │ │ │ +_8_9_5 inline std::tuple _s_p_l_i_t_F_i_l_e_n_a_m_e(const std:: │ │ │ │ +string& filename) { │ │ │ │ +896 std::size_t lastdot = filename.find_last_of("."); │ │ │ │ +897 if(lastdot == std::string::npos) │ │ │ │ +898 return std::make_tuple(filename, ""); │ │ │ │ +899 else { │ │ │ │ +900 std::string potentialFileExtension = filename.substr(lastdot); │ │ │ │ +901 if (potentialFileExtension == ".mm" || potentialFileExtension == ".mtx") │ │ │ │ +902 return std::make_tuple(filename.substr(0, lastdot), │ │ │ │ +potentialFileExtension); │ │ │ │ +903 else │ │ │ │ +904 return std::make_tuple(filename, ""); │ │ │ │ +905 } │ │ │ │ +906 } │ │ │ │ +907 │ │ │ │ +908 } // end namespace MatrixMarketImpl │ │ │ │ +909 │ │ │ │ +_9_1_0 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 │ │ │ │ +911 {}; │ │ │ │ +912 │ │ │ │ +913 │ │ │ │ +_9_1_4 inline void _m_m___r_e_a_d___h_e_a_d_e_r(std::size_t& rows, std::size_t& cols, │ │ │ │ +915 _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, │ │ │ │ +916 bool isVector) │ │ │ │ +917 { │ │ │ │ +918 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +919 │ │ │ │ +920 if(!readMatrixMarketBanner(istr, header)) { │ │ │ │ +921 std::cerr << "First line was not a correct Matrix Market banner. Using │ │ │ │ +default:\n" │ │ │ │ +922 << "%%MatrixMarket matrix coordinate real general"<> rows; │ │ │ │ +936 │ │ │ │ +937 if(lineFeed(istr)) │ │ │ │ +938 throw _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r(); │ │ │ │ +939 istr >> cols; │ │ │ │ +940 } │ │ │ │ +941 │ │ │ │ +942 template │ │ │ │ +_9_4_3 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, │ │ │ │ +944 std::size_t size, │ │ │ │ +945 std::istream& istr, │ │ │ │ +946 size_t lane) │ │ │ │ +947 { │ │ │ │ +948 for (int i=0; size>0; ++i, --size) │ │ │ │ +949 istr>>Simd::lane(lane,vector[i]); │ │ │ │ +950 } │ │ │ │ +951 │ │ │ │ +952 template │ │ │ │ +_9_5_3 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, │ │ │ │ +954 std::size_t size, │ │ │ │ +955 std::istream& istr, │ │ │ │ +956 size_t lane) │ │ │ │ +957 { │ │ │ │ +958 for(int i=0; size>0; ++i, --size) { │ │ │ │ +959 Simd::Scalar val; │ │ │ │ +960 istr>>val; │ │ │ │ +961 Simd::lane(lane, vector[i/entries][i%entries])=val; │ │ │ │ +962 } │ │ │ │ +963 } │ │ │ │ +964 │ │ │ │ +965 │ │ │ │ +972 template │ │ │ │ +_9_7_3 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, │ │ │ │ +974 std::istream& istr) │ │ │ │ +975 { │ │ │ │ +976 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; │ │ │ │ +977 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +978 │ │ │ │ +979 MMHeader header; │ │ │ │ +980 std::size_t rows, cols; │ │ │ │ +981 _m_m___r_e_a_d___h_e_a_d_e_r(rows,cols,header,istr, true); │ │ │ │ +982 if(cols!=Simd::lanes()) { │ │ │ │ +983 if(Simd::lanes() == 1) │ │ │ │ +984 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!"); │ │ │ │ +985 else │ │ │ │ +986 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!"); │ │ │ │ +987 } │ │ │ │ +988 │ │ │ │ +989 if(header.type!=array_type) │ │ │ │ +990 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!"); │ │ │ │ +991 │ │ │ │ +992 │ │ │ │ +993 if constexpr (Dune::IsNumber()) │ │ │ │ +994 vector._r_e_s_i_z_e(rows); │ │ │ │ +995 else │ │ │ │ +996 { │ │ │ │ +997 T dummy; │ │ │ │ +998 auto blocksize = dummy.size(); │ │ │ │ +999 std::size_t size=rows/blocksize; │ │ │ │ +1000 if(size*blocksize!=rows) │ │ │ │ +1001 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!"); │ │ │ │ +1002 │ │ │ │ +1003 vector._r_e_s_i_z_e(size); │ │ │ │ +1004 } │ │ │ │ +1005 │ │ │ │ +1006 istr.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +1007 for(size_t l=0;l();++l){ │ │ │ │ +1008 _m_m___r_e_a_d___v_e_c_t_o_r___e_n_t_r_i_e_s(vector, rows, istr, l); │ │ │ │ +1009 } │ │ │ │ +1010 } │ │ │ │ +1011 │ │ │ │ +1018 template │ │ │ │ +_1_0_1_9 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, │ │ │ │ +1020 std::istream& istr) │ │ │ │ +1021 { │ │ │ │ +1022 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +1023 using _M_a_t_r_i_x = _D_u_n_e_:_:_B_C_R_S_M_a_t_r_i_x_<_T_,_A_>; │ │ │ │ +1024 │ │ │ │ +1025 MMHeader header; │ │ │ │ +1026 if(!readMatrixMarketBanner(istr, header)) { │ │ │ │ +1027 std::cerr << "First line was not a correct Matrix Market banner. Using │ │ │ │ +default:\n" │ │ │ │ +1028 << "%%MatrixMarket matrix coordinate real general"<> rows; │ │ │ │ +1041 │ │ │ │ +1042 if(lineFeed(istr)) │ │ │ │ +1043 throw _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r(); │ │ │ │ +1044 istr >> cols; │ │ │ │ +1045 │ │ │ │ +1046 if(lineFeed(istr)) │ │ │ │ +1047 throw _M_a_t_r_i_x_M_a_r_k_e_t_F_o_r_m_a_t_E_r_r_o_r(); │ │ │ │ +1048 │ │ │ │ +1049 istr >>entries; │ │ │ │ +1050 │ │ │ │ +1051 std::size_t nnz, blockrows, blockcols; │ │ │ │ +1052 │ │ │ │ +1053 // Number of rows and columns of T, if it is a matrix (1x1 otherwise) │ │ │ │ +1054 constexpr int brows = mm_multipliers::rows; │ │ │ │ +1055 constexpr int bcols = mm_multipliers::cols; │ │ │ │ +1056 │ │ │ │ +1057 std::tie(blockrows, blockcols, nnz) = calculateNNZ(rows, │ │ │ │ +cols, entries, header); │ │ │ │ +1058 │ │ │ │ +1059 istr.ignore(std::numeric_limits::max(),'\n'); │ │ │ │ +1060 │ │ │ │ +1061 │ │ │ │ +1062 matrix._s_e_t_S_i_z_e(blockrows, blockcols, nnz); │ │ │ │ +1063 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); │ │ │ │ +1064 │ │ │ │ +1065 if(header.type==array_type) │ │ │ │ +1066 DUNE_THROW(Dune::NotImplemented, "Array format currently not supported for │ │ │ │ +matrices!"); │ │ │ │ +1067 │ │ │ │ +1068 readSparseEntries(matrix, istr, entries, header, NumericWrapper()); │ │ │ │ +1069 } │ │ │ │ +1070 │ │ │ │ +1071 // Print a scalar entry │ │ │ │ +1072 template │ │ │ │ +_1_0_7_3 void _m_m___p_r_i_n_t___e_n_t_r_y(const B& entry, │ │ │ │ +1074 std::size_t rowidx, │ │ │ │ +1075 std::size_t colidx, │ │ │ │ +1076 std::ostream& ostr) │ │ │ │ +1077 { │ │ │ │ +1078 if constexpr (IsNumber()) │ │ │ │ +1079 ostr << rowidx << " " << colidx << " " << entry << std::endl; │ │ │ │ +1080 else │ │ │ │ +1081 { │ │ │ │ +1082 for (auto row=entry.begin(); row != entry.end(); ++row, ++rowidx) { │ │ │ │ +1083 int coli=colidx; │ │ │ │ +1084 for (auto _c_o_l = row->begin(); _c_o_l != row->end(); ++_c_o_l, ++coli) │ │ │ │ +1085 ostr<< rowidx<<" "< │ │ │ │ +_1_0_9_2 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, │ │ │ │ +1093 const std::integral_constant&, │ │ │ │ +1094 size_t lane) │ │ │ │ +1095 { │ │ │ │ +1096 ostr< │ │ │ │ +_1_1_0_1 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, │ │ │ │ +1102 const std::integral_constant&, │ │ │ │ +1103 size_t lane) │ │ │ │ +1104 { │ │ │ │ +1105 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +1106 │ │ │ │ +1107 // Is the entry a supported numeric type? │ │ │ │ +1108 const int isnumeric = mm_numeric_type>::is_numeric; │ │ │ │ +1109 typedef typename V::const_iterator VIter; │ │ │ │ +1110 │ │ │ │ +1111 for(VIter i=vector.begin(); i != vector.end(); ++i) │ │ │ │ +1112 │ │ │ │ +1113 _m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y(*i, ostr, │ │ │ │ +1114 std::integral_constant(), │ │ │ │ +1115 lane); │ │ │ │ +1116 } │ │ │ │ +1117 │ │ │ │ +1118 template │ │ │ │ +_1_1_1_9 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) │ │ │ │ +1120 { │ │ │ │ +1121 return vector.size(); │ │ │ │ +1122 } │ │ │ │ +1123 │ │ │ │ +1124 template │ │ │ │ +_1_1_2_5 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) │ │ │ │ +1126 { │ │ │ │ +1127 return vector.size()*i; │ │ │ │ +1128 } │ │ │ │ +1129 │ │ │ │ +1130 // Version for writing vectors. │ │ │ │ +1131 template │ │ │ │ +_1_1_3_2 void _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(const V& vector, std::ostream& ostr, │ │ │ │ +1133 const std::integral_constant&) │ │ │ │ +1134 { │ │ │ │ +1135 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +1136 typedef typename V::field_type field_type; │ │ │ │ +1137 │ │ │ │ +1138 ostr<<_c_o_u_n_t_E_n_t_r_i_e_s(vector)<<" "<()<>::is_numeric; │ │ │ │ +1140 for(size_t l=0;l(); ++l){ │ │ │ │ +1141 _m_m___p_r_i_n_t___v_e_c_t_o_r___e_n_t_r_y(vector,ostr, std::integral_constant │ │ │ │ +(), l); │ │ │ │ +1142 } │ │ │ │ +1143 } │ │ │ │ +1144 │ │ │ │ +1145 // Versions for writing matrices │ │ │ │ +1146 template │ │ │ │ +_1_1_4_7 void _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1148 std::ostream& ostr, │ │ │ │ +1149 const std::integral_constant&) │ │ │ │ +1150 { │ │ │ │ +1151 ostr<_:_:_r_o_w_s<<" " │ │ │ │ +1152 <_:_:_c_o_l_s<<" " │ │ │ │ +1153 <<_c_o_u_n_t_N_o_n_Z_e_r_o_s(matrix)<begin(); _c_o_l != row->end(); ++_c_o_l) │ │ │ │ +1159 // Matrix Market indexing start with 1! │ │ │ │ +1160 _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, │ │ │ │ +1161 _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); │ │ │ │ +1162 } │ │ │ │ +1163 │ │ │ │ +1164 │ │ │ │ +1168 template │ │ │ │ +_1_1_6_9 void _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1170 std::ostream& ostr) │ │ │ │ +1171 { │ │ │ │ +1172 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +1173 │ │ │ │ +1174 // Write header information │ │ │ │ +1175 mm_header_printer::print(ostr); │ │ │ │ +1176 mm_block_structure_header::print(ostr,matrix); │ │ │ │ +1177 // Choose the correct function for matrix and vector │ │ │ │ +1178 _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>()); │ │ │ │ +1179 } │ │ │ │ +1180 │ │ │ │ +_1_1_8_1 static const int _d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n = -1; │ │ │ │ +1193 template │ │ │ │ +_1_1_9_4 void _s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1195 std::string filename, │ │ │ │ +1196 int prec=_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n) │ │ │ │ +1197 { │ │ │ │ +1198 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); │ │ │ │ +1199 std::string rfilename; │ │ │ │ +1200 std::ofstream file; │ │ │ │ +1201 if (extension != "") { │ │ │ │ +1202 rfilename = pureFilename + extension; │ │ │ │ +1203 file.open(rfilename.c_str()); │ │ │ │ +1204 if(!file) │ │ │ │ +1205 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str │ │ │ │ +()); │ │ │ │ +1206 } │ │ │ │ +1207 else { │ │ │ │ +1208 // only try .mm so we do not ignore potential errors │ │ │ │ +1209 rfilename = pureFilename + ".mm"; │ │ │ │ +1210 file.open(rfilename.c_str()); │ │ │ │ +1211 if(!file) │ │ │ │ +1212 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str │ │ │ │ +()); │ │ │ │ +1213 } │ │ │ │ +1214 │ │ │ │ +1215 file.setf(std::ios::scientific,std::ios::floatfield); │ │ │ │ +1216 if(prec>0) │ │ │ │ +1217 file.precision(prec); │ │ │ │ +1218 _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(matrix, file); │ │ │ │ +1219 file.close(); │ │ │ │ +1220 } │ │ │ │ +1221 │ │ │ │ +1222#if HAVE_MPI │ │ │ │ +1237 template │ │ │ │ +_1_2_3_8 void _s_t_o_r_e_M_a_t_r_i_x_M_a_r_k_e_t(const M& matrix, │ │ │ │ +1239 std::string filename, │ │ │ │ +1240 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, │ │ │ │ +1241 bool storeIndices=true, │ │ │ │ +1242 int prec=_d_e_f_a_u_l_t___p_r_e_c_i_s_i_o_n) │ │ │ │ +1243 { │ │ │ │ +1244 // Get our rank │ │ │ │ +1245 int rank = comm._c_o_m_m_u_n_i_c_a_t_o_r().rank(); │ │ │ │ +1246 // Write the local matrix │ │ │ │ +1247 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); │ │ │ │ +1248 std::string rfilename; │ │ │ │ +1249 std::ofstream file; │ │ │ │ +1250 if (extension != "") { │ │ │ │ +1251 rfilename = pureFilename + "_" + std::to_string(rank) + extension; │ │ │ │ +1252 file.open(rfilename.c_str()); │ │ │ │ +1253 dverb<< rfilename <0) │ │ │ │ +1267 file.precision(prec); │ │ │ │ +1268 _w_r_i_t_e_M_a_t_r_i_x_M_a_r_k_e_t(matrix, file); │ │ │ │ +1269 file.close(); │ │ │ │ +1270 │ │ │ │ +1271 if(!storeIndices) │ │ │ │ +1272 return; │ │ │ │ +1273 │ │ │ │ +1274 // Write the global to local index mapping │ │ │ │ +1275 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx"; │ │ │ │ +1276 file.open(rfilename.c_str()); │ │ │ │ +1277 if(!file) │ │ │ │ +1278 DUNE_THROW(IOError, "Could not open file for storage: " << rfilename.c_str │ │ │ │ +()); │ │ │ │ +1279 file.setf(std::ios::scientific,std::ios::floatfield); │ │ │ │ +1280 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; │ │ │ │ +1281 typedef typename IndexSet::const_iterator Iterator; │ │ │ │ +1282 for(Iterator iter = comm._i_n_d_e_x_S_e_t().begin(); │ │ │ │ +1283 iter != comm._i_n_d_e_x_S_e_t().end(); ++iter) { │ │ │ │ +1284 file << iter->global()<<" "<<(std::size_t)iter->local()<<" " │ │ │ │ +1285 <<(int)iter->local().attribute()<<" "<<(int)iter->local().isPublic │ │ │ │ +()<& neighbours=comm._r_e_m_o_t_e_I_n_d_i_c_e_s().getNeighbours(); │ │ │ │ +1290 typedef std::set::const_iterator SIter; │ │ │ │ +1291 for(SIter neighbour=neighbours.begin(); neighbour != neighbours.end(); │ │ │ │ +++neighbour) { │ │ │ │ +1292 file<<" "<< *neighbour; │ │ │ │ +1293 } │ │ │ │ +1294 file.close(); │ │ │ │ +1295 } │ │ │ │ +1296 │ │ │ │ +1311 template │ │ │ │ +_1_3_1_2 void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M& matrix, │ │ │ │ +1313 const std::string& filename, │ │ │ │ +1314 _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, │ │ │ │ +1315 bool readIndices=true) │ │ │ │ +1316 { │ │ │ │ +1317 using namespace _M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l; │ │ │ │ +1318 │ │ │ │ +1319 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; │ │ │ │ +1320 typedef typename LocalIndexT::Attribute Attribute; │ │ │ │ +1321 // Get our rank │ │ │ │ +1322 int rank = comm.communicator().rank(); │ │ │ │ +1323 // load local matrix │ │ │ │ +1324 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); │ │ │ │ +1325 std::string rfilename; │ │ │ │ +1326 std::ifstream file; │ │ │ │ +1327 if (extension != "") { │ │ │ │ +1328 rfilename = pureFilename + "_" + std::to_string(rank) + extension; │ │ │ │ +1329 file.open(rfilename.c_str(), std::ios::in); │ │ │ │ +1330 dverb<< rfilename <_:_:_P_a_r_a_l_l_e_l_I_n_d_e_x_S_e_t │ │ │ │ +IndexSet; │ │ │ │ +1354 IndexSet& pis=comm.pis; │ │ │ │ +1355 rfilename = pureFilename + "_" + std::to_string(rank) + ".idx"; │ │ │ │ +1356 file.open(rfilename.c_str()); │ │ │ │ +1357 if(!file) │ │ │ │ +1358 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str()); │ │ │ │ +1359 if(pis.size()!=0) │ │ │ │ +1360 DUNE_THROW(InvalidIndexSetState, "Index set is not empty!"); │ │ │ │ +1361 │ │ │ │ +1362 pis.beginResize(); │ │ │ │ +1363 while(!file.eof() && file.peek()!='n') { │ │ │ │ +1364 G g; │ │ │ │ +1365 file >>g; │ │ │ │ +1366 std::size_t l; │ │ │ │ +1367 file >>l; │ │ │ │ +1368 int c; │ │ │ │ +1369 file >>c; │ │ │ │ +1370 bool b; │ │ │ │ +1371 file >> b; │ │ │ │ +1372 pis.add(g,LocalIndexT(l,Attribute(c),b)); │ │ │ │ +1373 lineFeed(file); │ │ │ │ +1374 } │ │ │ │ +1375 pis.endResize(); │ │ │ │ +1376 if(!file.eof()) { │ │ │ │ +1377 // read neighbours │ │ │ │ +1378 std::string s; │ │ │ │ +1379 file>>s; │ │ │ │ +1380 if(s!="neighbours:") │ │ │ │ +1381 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:\""); │ │ │ │ +1382 std::set nb; │ │ │ │ +1383 while(!file.eof()) { │ │ │ │ +1384 int i; │ │ │ │ +1385 file >> i; │ │ │ │ +1386 nb.insert(i); │ │ │ │ +1387 } │ │ │ │ +1388 file.close(); │ │ │ │ +1389 comm.ri.setNeighbours(nb); │ │ │ │ +1390 } │ │ │ │ +1391 comm.ri.template rebuild(); │ │ │ │ +1392 } │ │ │ │ +1393 │ │ │ │ +1394 #endif │ │ │ │ +1395 │ │ │ │ +1406 template │ │ │ │ +_1_4_0_7 void _l_o_a_d_M_a_t_r_i_x_M_a_r_k_e_t(M& matrix, │ │ │ │ +1408 const std::string& filename) │ │ │ │ +1409 { │ │ │ │ +1410 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); │ │ │ │ +1411 std::string rfilename; │ │ │ │ +1412 std::ifstream file; │ │ │ │ +1413 if (extension != "") { │ │ │ │ +1414 rfilename = pureFilename + extension; │ │ │ │ +1415 file.open(rfilename.c_str()); │ │ │ │ +1416 if(!file) │ │ │ │ +1417 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str()); │ │ │ │ +1418 } │ │ │ │ +1419 else { │ │ │ │ +1420 // try both .mm and .mtx │ │ │ │ +1421 rfilename = pureFilename + ".mm"; │ │ │ │ +1422 file.open(rfilename.c_str(), std::ios::in); │ │ │ │ +1423 if(!file) { │ │ │ │ +1424 rfilename = pureFilename + ".mtx"; │ │ │ │ +1425 file.open(rfilename.c_str(), std::ios::in); │ │ │ │ +1426 if(!file) │ │ │ │ +1427 DUNE_THROW(IOError, "Could not open file: " << rfilename.c_str()); │ │ │ │ +1428 } │ │ │ │ +1429 } │ │ │ │ +1430 _r_e_a_d_M_a_t_r_i_x_M_a_r_k_e_t(matrix,file); │ │ │ │ +1431 file.close(); │ │ │ │ +1432 } │ │ │ │ +1433 │ │ │ │ +1435} │ │ │ │ +1436#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. │ │ │ │ +_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:973 │ │ │ │ +_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:1194 │ │ │ │ +_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:1312 │ │ │ │ +_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:1119 │ │ │ │ +_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:1132 │ │ │ │ +_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:1092 │ │ │ │ +_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:1181 │ │ │ │ +_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:943 │ │ │ │ +_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:914 │ │ │ │ +_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:1073 │ │ │ │ +_s_t_d │ │ │ │ +STL namespace. │ │ │ │ _D_u_n_e │ │ │ │ DDeeffiinniittiioonn allocator.hh:11 │ │ │ │ _D_u_n_e_:_:_c_o_l │ │ │ │ MatrixSparsityPatternGatherScatter< M, I >::ColIter │ │ │ │ MatrixSparsityPatternGatherScatter< M, I >::col │ │ │ │ DDeeffiinniittiioonn matrixredistribute.hh:591 │ │ │ │ -_D_u_n_e_:_:_A_m_g │ │ │ │ -DDeeffiinniittiioonn novlpschwarz.hh:256 │ │ │ │ -_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:17 │ │ │ │ -_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:20 │ │ │ │ -_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:67 │ │ │ │ -_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:70 │ │ │ │ +_D_u_n_e_:_:_M_a_t_r_i_x_M_a_r_k_e_t_I_m_p_l │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:67 │ │ │ │ +_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:590 │ │ │ │ +_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:673 │ │ │ │ +_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:339 │ │ │ │ +_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:339 │ │ │ │ +_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:339 │ │ │ │ +_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:339 │ │ │ │ +_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:396 │ │ │ │ +_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:340 │ │ │ │ +_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:808 │ │ │ │ +_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:342 │ │ │ │ +_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:342 │ │ │ │ +_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:342 │ │ │ │ +_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:342 │ │ │ │ +_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:657 │ │ │ │ +_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:382 │ │ │ │ +_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:358 │ │ │ │ +_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:346 │ │ │ │ +_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:346 │ │ │ │ +_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:346 │ │ │ │ +_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:346 │ │ │ │ +_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:346 │ │ │ │ +_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:346 │ │ │ │ +_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:344 │ │ │ │ +_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:344 │ │ │ │ +_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:344 │ │ │ │ +_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:344 │ │ │ │ +_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:344 │ │ │ │ +_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:344 │ │ │ │ +_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:776 │ │ │ │ +_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:895 │ │ │ │ +_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:467 │ │ │ │ +_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:672 │ │ │ │ +_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:518 │ │ │ │ +_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:678 │ │ │ │ +_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:1103 │ │ │ │ +_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:2010 │ │ │ │ +_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:1097 │ │ │ │ +_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:2004 │ │ │ │ +_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:831 │ │ │ │ +_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:859 │ │ │ │ +_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:78 │ │ │ │ +_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:83 │ │ │ │ +_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_r │ │ │ │ +static std::string str() │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:86 │ │ │ │ +_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:102 │ │ │ │ +_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_ _>_:_:_i_s___n_u_m_e_r_i_c │ │ │ │ +@ is_numeric │ │ │ │ +Whether T is a supported numeric type. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:99 │ │ │ │ +_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_ _>_:_:_i_s___n_u_m_e_r_i_c │ │ │ │ +@ is_numeric │ │ │ │ +Whether T is a supported numeric type. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:115 │ │ │ │ +_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:118 │ │ │ │ +_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:134 │ │ │ │ +_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_ _>_:_:_i_s___n_u_m_e_r_i_c │ │ │ │ +@ is_numeric │ │ │ │ +Whether T is a supported numeric type. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:131 │ │ │ │ +_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:186 │ │ │ │ +_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_ _>_ _>_:_:_i_s___n_u_m_e_r_i_c │ │ │ │ +@ is_numeric │ │ │ │ +Whether T is a supported numeric type. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:183 │ │ │ │ +_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:202 │ │ │ │ +_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_ _>_ _>_:_:_i_s___n_u_m_e_r_i_c │ │ │ │ +@ is_numeric │ │ │ │ +Whether T is a supported numeric type. │ │ │ │ +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 │ │ │ │ +Meta program to write the correct Matrix Market header. │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:217 │ │ │ │ +_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:222 │ │ │ │ +_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:232 │ │ │ │ +_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:242 │ │ │ │ +_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:252 │ │ │ │ +_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: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_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:276 │ │ │ │ +_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:273 │ │ │ │ +_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:286 │ │ │ │ +_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:288 │ │ │ │ +_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:298 │ │ │ │ +_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:301 │ │ │ │ +_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:311 │ │ │ │ +_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:313 │ │ │ │ +_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:324 │ │ │ │ +_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 &, const M &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:326 │ │ │ │ +_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 &, const M &) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:335 │ │ │ │ +_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:333 │ │ │ │ +_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:349 │ │ │ │ +_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:355 │ │ │ │ +_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:353 │ │ │ │ +_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:350 │ │ │ │ +_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:354 │ │ │ │ +_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:621 │ │ │ │ +_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:622 │ │ │ │ +_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:638 │ │ │ │ +_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:639 │ │ │ │ +_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:650 │ │ │ │ +_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:720 │ │ │ │ +_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:727 │ │ │ │ +_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:745 │ │ │ │ +_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 > > > &, M │ │ │ │ +&) │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:766 │ │ │ │ +_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:771 │ │ │ │ +_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:787 │ │ │ │ +_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_ _>_ _>_:_:_c_o_l_s │ │ │ │ +@ cols │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:794 │ │ │ │ +_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_ _>_ _>_:_:_r_o_w_s │ │ │ │ +@ rows │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:793 │ │ │ │ +_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_ _> │ │ │ │ +_>_:_:_r_o_w_s │ │ │ │ +@ rows │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:802 │ │ │ │ +_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_ _> │ │ │ │ +_>_:_:_c_o_l_s │ │ │ │ +@ cols │ │ │ │ +DDeeffiinniittiioonn matrixmarket.hh:803 │ │ │ │ +_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:911 │ │ │ │ +_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_:_:_v_a_l_u_e │ │ │ │ +@ value │ │ │ │ +True if T is an ISTL matrix. │ │ │ │ +DDeeffiinniittiioonn matrixutils.hh:509 │ │ │ │ +_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_<_ _T_,_ _T_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 │ │ │ │ +OwnerOverlapCopyCommunication(MPI_Comm comm_, SolverCategory::Category │ │ │ │ +cat_=SolverCategory::overlapping, bool freecomm_=false) │ │ │ │ +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_:_:_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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,79 +66,57 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │
│ │ │ -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 <sstream>
│ │ │ +#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 > *=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 > *=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,47 +1,39 @@ │ │ │ │ dune-istl 2.11 │ │ │ │ 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 │ │ │ │ +#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 │ │ │ │ -MMaaccrrooss │ │ │ │ -#define  _D_I_R_E_C_T_S_O_L_V_E_R   SuperLU │ │ │ │ +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 > *=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 > │ │ │ │ + *=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 │ │ │ │ +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.15.0 │ │ ├── ./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 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ @@ -66,693 +66,263 @@ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
│ │ │
│ │ │ -
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
│ │ │ +
3#ifndef DUNE_ISTL_ILDL_HH
│ │ │ +
4#define DUNE_ISTL_ILDL_HH
│ │ │ +
5
│ │ │ +
6#include <sstream>
│ │ │
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>
│ │ │ - │ │ │ +
8#include <dune/common/scalarvectorview.hh>
│ │ │ +
9#include <dune/common/scalarmatrixview.hh>
│ │ │ +
10#include "ilu.hh"
│ │ │ +
11
│ │ │ +
18
│ │ │ +
19namespace Dune
│ │ │ +
20{
│ │ │
21
│ │ │ -
22#include "fastamgsmoother.hh"
│ │ │ -
23
│ │ │ -
31
│ │ │ -
32namespace Dune
│ │ │ -
33{
│ │ │ -
34 namespace Amg
│ │ │ -
35 {
│ │ │ -
41
│ │ │ -
47
│ │ │ -
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
│ │ │ -
│ │ │ - │ │ │ -
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
│ │ │ -
290 using ScalarProduct = Dune::ScalarProduct<X>;
│ │ │ -
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 {
│ │ │ -
479 if constexpr (Dune::IsNumber<Block>::value)
│ │ │ -
480 x[row.index()] = b[row.index()]/(*diag);
│ │ │ -
481 else
│ │ │ -
482 diag->solve(x[row.index()], b[row.index()]);
│ │ │ -
483 }
│ │ │ -
484 }
│ │ │ -
485 if (verbosity_>0)
│ │ │ -
486 std::cout<<" Preprocessing Dirichlet took "<<watch1.elapsed()<<std::endl;
│ │ │ -
487 watch1.reset();
│ │ │ -
488 // No smoother to make x consistent! Do it by hand
│ │ │ -
489 matrices_->parallelInformation().coarsest()->copyOwnerToAll(x,x);
│ │ │ -
490 rhs_ = std::make_shared<Hierarchy<Range,A>>(std::make_shared<Range>(b));
│ │ │ -
491 lhs_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ -
492 residual_ = std::make_shared<Hierarchy<Domain,A>>(std::make_shared<Domain>(x));
│ │ │ -
493 matrices_->coarsenVector(*rhs_);
│ │ │ -
494 matrices_->coarsenVector(*lhs_);
│ │ │ -
495 matrices_->coarsenVector(*residual_);
│ │ │ -
496
│ │ │ -
497 // The preconditioner might change x and b. So we have to
│ │ │ -
498 // copy the changes to the original vectors.
│ │ │ -
499 x = *lhs_->finest();
│ │ │ -
500 b = *rhs_->finest();
│ │ │ -
501 }
│ │ │ -
│ │ │ -
502 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
504 {
│ │ │ -
505 return matrices_->levels();
│ │ │ -
506 }
│ │ │ -
│ │ │ -
507 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
509 {
│ │ │ -
510 return matrices_->maxlevels();
│ │ │ -
511 }
│ │ │ -
│ │ │ -
512
│ │ │ -
514 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
516 {
│ │ │ -
517 LevelContext levelContext;
│ │ │ -
518 // Init all iterators for the current level
│ │ │ -
519 initIteratorsWithFineLevel(levelContext);
│ │ │ -
520
│ │ │ -
521 assert(v.two_norm()==0);
│ │ │ -
522
│ │ │ -
523 level=0;
│ │ │ -
524 if(matrices_->maxlevels()==1){
│ │ │ -
525 // The coarse solver might modify the d!
│ │ │ -
526 Range b(d);
│ │ │ -
527 mgc(levelContext, v, b);
│ │ │ -
528 }else
│ │ │ -
529 mgc(levelContext, v, d);
│ │ │ -
530 if(postSteps_==0||matrices_->maxlevels()==1)
│ │ │ -
531 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ -
532 }
│ │ │ -
│ │ │ -
533
│ │ │ -
534 template<class M, class X, class PI, class A>
│ │ │ -
535 void FastAMG<M,X,PI,A>::initIteratorsWithFineLevel(LevelContext& levelContext)
│ │ │ -
536 {
│ │ │ -
537 levelContext.matrix = matrices_->matrices().finest();
│ │ │ -
538 levelContext.pinfo = matrices_->parallelInformation().finest();
│ │ │ -
539 levelContext.redist =
│ │ │ -
540 matrices_->redistributeInformation().begin();
│ │ │ -
541 levelContext.aggregates = matrices_->aggregatesMaps().begin();
│ │ │ -
542 levelContext.lhs = lhs_->finest();
│ │ │ -
543 levelContext.residual = residual_->finest();
│ │ │ -
544 levelContext.rhs = rhs_->finest();
│ │ │ -
545 levelContext.level=0;
│ │ │ -
546 }
│ │ │ -
547
│ │ │ -
548 template<class M, class X, class PI, class A>
│ │ │ -
549 bool FastAMG<M,X,PI,A>
│ │ │ -
550 ::moveToCoarseLevel(LevelContext& levelContext)
│ │ │ -
551 {
│ │ │ -
552 bool processNextLevel=true;
│ │ │ -
553
│ │ │ -
554 if(levelContext.redist->isSetup()) {
│ │ │ -
555 throw "bla";
│ │ │ -
556 levelContext.redist->redistribute(static_cast<const Range&>(*levelContext.residual),
│ │ │ -
557 levelContext.residual.getRedistributed());
│ │ │ -
558 processNextLevel = levelContext.residual.getRedistributed().size()>0;
│ │ │ -
559 if(processNextLevel) {
│ │ │ -
560 //restrict defect to coarse level right hand side.
│ │ │ -
561 ++levelContext.pinfo;
│ │ │ -
562 Transfer<typename OperatorHierarchy::AggregatesMap::AggregateDescriptor,Range,ParallelInformation>
│ │ │ -
563 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ -
564 static_cast<const Range&>(levelContext.residual.getRedistributed()),
│ │ │ -
565 *levelContext.pinfo);
│ │ │ -
566 }
│ │ │ -
567 }else{
│ │ │ -
568 //restrict defect to coarse level right hand side.
│ │ │ -
569 ++levelContext.rhs;
│ │ │ -
570 ++levelContext.pinfo;
│ │ │ - │ │ │ -
572 ::restrictVector(*(*levelContext.aggregates), *levelContext.rhs,
│ │ │ -
573 static_cast<const Range&>(*levelContext.residual), *levelContext.pinfo);
│ │ │ -
574 }
│ │ │ -
575
│ │ │ -
576 if(processNextLevel) {
│ │ │ -
577 // prepare coarse system
│ │ │ -
578 ++levelContext.residual;
│ │ │ -
579 ++levelContext.lhs;
│ │ │ -
580 ++levelContext.matrix;
│ │ │ -
581 ++levelContext.level;
│ │ │ -
582 ++levelContext.redist;
│ │ │ -
583
│ │ │ -
584 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ -
585 // next level is not the globally coarsest one
│ │ │ -
586 ++levelContext.aggregates;
│ │ │ -
587 }
│ │ │ -
588 // prepare the lhs on the next level
│ │ │ -
589 *levelContext.lhs=0;
│ │ │ -
590 *levelContext.residual=0;
│ │ │ -
591 }
│ │ │ -
592 return processNextLevel;
│ │ │ -
593 }
│ │ │ -
594
│ │ │ -
595 template<class M, class X, class PI, class A>
│ │ │ - │ │ │ -
597 ::moveToFineLevel(LevelContext& levelContext, bool processNextLevel, Domain& x)
│ │ │ -
598 {
│ │ │ -
599 if(processNextLevel) {
│ │ │ -
600 if(levelContext.matrix != matrices_->matrices().coarsest() || matrices_->levels()<matrices_->maxlevels()) {
│ │ │ -
601 // previous level is not the globally coarsest one
│ │ │ -
602 --levelContext.aggregates;
│ │ │ -
603 }
│ │ │ -
604 --levelContext.redist;
│ │ │ -
605 --levelContext.level;
│ │ │ -
606 //prolongate and add the correction (update is in coarse left hand side)
│ │ │ -
607 --levelContext.matrix;
│ │ │ -
608 --levelContext.residual;
│ │ │ -
609
│ │ │ -
610 }
│ │ │ -
611
│ │ │ -
612 typename Hierarchy<Domain,A>::Iterator coarseLhs = levelContext.lhs--;
│ │ │ -
613 if(levelContext.redist->isSetup()) {
│ │ │ -
614
│ │ │ -
615 // Need to redistribute during prolongate
│ │ │ - │ │ │ -
617 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ -
618 levelContext.lhs.getRedistributed(),
│ │ │ -
619 matrices_->getProlongationDampingFactor(),
│ │ │ -
620 *levelContext.pinfo, *levelContext.redist);
│ │ │ -
621 }else{
│ │ │ - │ │ │ -
623 ::prolongateVector(*(*levelContext.aggregates), *coarseLhs, x,
│ │ │ -
624 matrices_->getProlongationDampingFactor(), *levelContext.pinfo);
│ │ │ -
625
│ │ │ -
626 // printvector(std::cout, *lhs, "prolongated coarse grid correction", "lhs", 10, 10, 10);
│ │ │ -
627 }
│ │ │ -
628
│ │ │ -
629
│ │ │ -
630 if(processNextLevel) {
│ │ │ -
631 --levelContext.rhs;
│ │ │ -
632 }
│ │ │ -
633
│ │ │ -
634 }
│ │ │ -
635
│ │ │ -
636
│ │ │ -
637 template<class M, class X, class PI, class A>
│ │ │ - │ │ │ -
639 ::presmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ -
640 {
│ │ │ -
641 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ -
642 GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(),
│ │ │ -
643 x,
│ │ │ -
644 *levelContext.residual,
│ │ │ -
645 b);
│ │ │ -
646 }
│ │ │ -
647
│ │ │ -
648 template<class M, class X, class PI, class A>
│ │ │ - │ │ │ -
650 ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b)
│ │ │ -
651 {
│ │ │ -
652 constexpr auto bl = blockLevel<typename M::matrix_type>();
│ │ │ - │ │ │ -
654 ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b);
│ │ │ -
655 }
│ │ │ -
656
│ │ │ -
657
│ │ │ -
658 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ - │ │ │ -
660 {
│ │ │ - │ │ │ -
662 }
│ │ │ -
│ │ │ -
663
│ │ │ -
664 template<class M, class X, class PI, class A>
│ │ │ -
665 void FastAMG<M,X,PI,A>::mgc(LevelContext& levelContext, Domain& v, const Range& b){
│ │ │ -
666
│ │ │ -
667 if(levelContext.matrix == matrices_->matrices().coarsest() && levels()==maxlevels()) {
│ │ │ -
668 // Solve directly
│ │ │ - │ │ │ -
670 res.converged=true; // If we do not compute this flag will not get updated
│ │ │ -
671 if(levelContext.redist->isSetup()) {
│ │ │ -
672 levelContext.redist->redistribute(b, levelContext.rhs.getRedistributed());
│ │ │ -
673 if(levelContext.rhs.getRedistributed().size()>0) {
│ │ │ -
674 // We are still participating in the computation
│ │ │ -
675 levelContext.pinfo.getRedistributed().copyOwnerToAll(levelContext.rhs.getRedistributed(),
│ │ │ -
676 levelContext.rhs.getRedistributed());
│ │ │ -
677 solver_->apply(levelContext.lhs.getRedistributed(), levelContext.rhs.getRedistributed(), res);
│ │ │ -
678 }
│ │ │ -
679 levelContext.redist->redistributeBackward(v, levelContext.lhs.getRedistributed());
│ │ │ -
680 levelContext.pinfo->copyOwnerToAll(v, v);
│ │ │ -
681 }else{
│ │ │ -
682 levelContext.pinfo->copyOwnerToAll(b, b);
│ │ │ -
683 solver_->apply(v, const_cast<Range&>(b), res);
│ │ │ -
684 }
│ │ │ -
685
│ │ │ -
686 // printvector(std::cout, *lhs, "coarse level update", "u", 10, 10, 10);
│ │ │ -
687 // printvector(std::cout, *rhs, "coarse level rhs", "rhs", 10, 10, 10);
│ │ │ -
688 if (!res.converged)
│ │ │ -
689 coarsesolverconverged = false;
│ │ │ -
690 }else{
│ │ │ -
691 // presmoothing
│ │ │ -
692 presmooth(levelContext, v, b);
│ │ │ -
693 // printvector(std::cout, *lhs, "update", "u", 10, 10, 10);
│ │ │ -
694 // printvector(std::cout, *residual, "post presmooth residual", "r", 10);
│ │ │ -
695#ifndef DUNE_AMG_NO_COARSEGRIDCORRECTION
│ │ │ -
696 bool processNextLevel = moveToCoarseLevel(levelContext);
│ │ │ -
697
│ │ │ -
698 if(processNextLevel) {
│ │ │ -
699 // next level
│ │ │ -
700 for(std::size_t i=0; i<gamma_; i++)
│ │ │ -
701 mgc(levelContext, *levelContext.lhs, *levelContext.rhs);
│ │ │ -
702 }
│ │ │ -
703
│ │ │ -
704 moveToFineLevel(levelContext, processNextLevel, v);
│ │ │ -
705#else
│ │ │ -
706 *lhs=0;
│ │ │ -
707#endif
│ │ │ -
708
│ │ │ -
709 if(levelContext.matrix == matrices_->matrices().finest()) {
│ │ │ -
710 coarsesolverconverged = matrices_->parallelInformation().finest()->communicator().prod(coarsesolverconverged);
│ │ │ -
711 if(!coarsesolverconverged)
│ │ │ -
712 DUNE_THROW(MathError, "Coarse solver did not converge");
│ │ │ -
713 }
│ │ │ -
714
│ │ │ -
715 postsmooth(levelContext, v, b);
│ │ │ -
716 }
│ │ │ -
717 }
│ │ │ -
718
│ │ │ -
719
│ │ │ -
721 template<class M, class X, class PI, class A>
│ │ │ -
│ │ │ -
722 void FastAMG<M,X,PI,A>::post([[maybe_unused]] Domain& x)
│ │ │ -
723 {
│ │ │ -
724 lhs_=nullptr;
│ │ │ -
725 rhs_=nullptr;
│ │ │ -
726 residual_=nullptr;
│ │ │ -
727 }
│ │ │ -
│ │ │ -
728
│ │ │ -
729 template<class M, class X, class PI, class A>
│ │ │ -
730 template<class A1>
│ │ │ -
│ │ │ -
731 void FastAMG<M,X,PI,A>::getCoarsestAggregateNumbers(std::vector<std::size_t,A1>& cont)
│ │ │ -
732 {
│ │ │ -
733 matrices_->getCoarsestAggregatesOnFinest(cont);
│ │ │ -
734 }
│ │ │ -
│ │ │ -
735
│ │ │ -
736 } // end namespace Amg
│ │ │ -
737} // end namespace Dune
│ │ │ -
738
│ │ │ -
739#endif
│ │ │ -
Classes for using UMFPack with ISTL matrices.
│ │ │ -
Classes for using SuperLU 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.
│ │ │ - │ │ │ -
#define DIRECTSOLVER
│ │ │ -
Some generic functions for pretty printing vectors and matrices.
│ │ │ -
DefaultSmootherArgs< typename T::matrix_type::field_type > Arguments
Definition smoother.hh:67
│ │ │ -
static std::shared_ptr< T > construct(Arguments &)
Construct an object with the specified arguments.
Definition construction.hh:52
│ │ │ -
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
│ │ │ -
void postsmooth(LevelContext &levelContext, size_t steps)
Apply post smoothing on the current level.
Definition smoother.hh:428
│ │ │ -
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:731
│ │ │ -
ParallelInformationHierarchy::Iterator pinfo
The iterator over the parallel information.
Definition fastamg.hh:211
│ │ │ -
< TRUNCATED DUE TO SIZE LIMIT: 10485760 bytes